Commit Graph

736 Commits

Author SHA1 Message Date
Linus Torvalds
6fa09d3139 A bunch of little cleanups
Nothing major, no functional changes.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE/Q1c5nzg9ZpmiCaGYfOMkJGb/4EFAmCIqRYACgkQYfOMkJGb
 /4H6rA/+IDw24s5QesAU5BDEDZSrQ1e9lLSiDIIjMbQNBUsDrm97ossagyCIyZdT
 IefULEKl0Xd1q7greV3ixOAOUP+6FU8TWbHdgcdl/IOzo0wCNWUZv6ZXGI8rPSaV
 31P6aivyPkkjIAchKGbi0Xdoo3MjZfnFQPWLGp1Nk0WZz4adiVmz9fCFMqqC2KpP
 W6yAFc3scJZV+rwTQ8xzjsFje7lg3T9tgVhXgZ9FyWmOugneoCKjX5pNN+P2naA0
 4o4xSvJwhBrDeqjJJIUPzbWWXqimtMa8mEjbgJmBtPwbUf5Yt4gtIg+vt1asTabZ
 QvjtMnvxLX3B/aOffBJX/TXj8DcEq1TOW7Gu0DY3NDT4dV8DeLhTKXPKrDdaSlwc
 ElZaVOpoNCT8ipeNajHmkiuGHGcfomIHwVRsQXaE5lPNXmdBO2gq3XaVYOD5fWc1
 8Q7VFimrJCIlfv2ILmhlVdJcm2ujUJYuUzv7NxrCE8CJwa7Hz5qv3QIumsA4gsVu
 fWE/UH0Uk5uJNxUGw+371hIlS/E0P89FdXS5dX6cG454lftxgDmjSHW+b6qJ5EFk
 kBthgIFl7elQY0y1RSWXUKCt0ZkOL3d7hpYedvIZqCpIoyX+RU4llgg6xgiKAv7C
 LhW1SrfnI8MCNlLJR7tWzDDOmsN7rq+cisRQgD3DwrYLch1miB8=
 =/fjx
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-5.13-1' of git://github.com/cminyard/linux-ipmi

Pull IPMI updates from Corey Minyard:
 "A bunch of little cleanups

  Nothing major, no functional changes"

* tag 'for-linus-5.13-1' of git://github.com/cminyard/linux-ipmi:
  ipmi_si: Join string literals back
  ipmi_si: Drop redundant check before calling put_device()
  ipmi_si: Use strstrip() to remove surrounding spaces
  ipmi_si: Get rid of ->addr_source_cleanup()
  ipmi_si: Reuse si_to_str[] array in ipmi_hardcode_init_one()
  ipmi_si: Introduce ipmi_panic_event_str[] array
  ipmi_si: Use proper ACPI macros to check error code for failures
  ipmi_si: Utilize temporary variable to hold device pointer
  ipmi_si: Remove bogus err_free label
  ipmi_si: Switch to use platform_get_mem_or_io()
  ipmi: Handle device properties with software node API
  ipmi:ssif: make ssif_i2c_send() void
  ipmi: Refine retry conditions for getting device id
2021-04-28 15:54:57 -07:00
Chia-Wei, Wang
8f88156f82 ipmi: kcs: aspeed: Adapt to new LPC DTS layout
Add check against LPC device v2 compatible string to
ensure that the fixed device tree layout is adopted.
The LPC register offsets are also fixed accordingly.

Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
Acked-by: Haiyue Wang <haiyue.wang@linux.intel.com>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Link: https://lore.kernel.org/r/20210319062752.145730-3-andrew@aj.id.au
Signed-off-by: Joel Stanley <joel@jms.id.au>
2021-04-09 13:39:21 +09:30
Andy Shevchenko
07cbd87b04 ipmi_si: Join string literals back
For easy grepping on debug purposes join string literals back in
the messages.

No functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Message-Id: <20210402174334.13466-11-andriy.shevchenko@linux.intel.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-04-02 12:53:42 -05:00
Andy Shevchenko
25f314db2e ipmi_si: Drop redundant check before calling put_device()
put_device() is NULL aware, drop redundant check before calling it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Message-Id: <20210402174334.13466-10-andriy.shevchenko@linux.intel.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-04-02 12:53:39 -05:00
Andy Shevchenko
d14ce8c770 ipmi_si: Use strstrip() to remove surrounding spaces
Instead of home grown analogue, use strstrip() from the kernel library.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Message-Id: <20210402174334.13466-9-andriy.shevchenko@linux.intel.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-04-02 12:53:36 -05:00
Andy Shevchenko
2dafddb882 ipmi_si: Get rid of ->addr_source_cleanup()
The ->addr_source_cleanup() callback is solely used by PCI driver
and only for one purpose, i.e. to disable device. Get rid of
->addr_source_cleanup() by switching to PCI managed API.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Message-Id: <20210402174334.13466-8-andriy.shevchenko@linux.intel.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-04-02 12:53:34 -05:00
Andy Shevchenko
59cdb2e7c8 ipmi_si: Reuse si_to_str[] array in ipmi_hardcode_init_one()
Instead of making the comparison one by one, reuse si_to_str[] array
in ipmi_hardcode_init_one() in conjunction with match_string() API.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Message-Id: <20210402174334.13466-7-andriy.shevchenko@linux.intel.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-04-02 12:53:32 -05:00
Andy Shevchenko
649a7d46d0 ipmi_si: Introduce ipmi_panic_event_str[] array
Instead of repeating twice the constant literals, introduce
ipmi_panic_event_str[] array. It allows to simplify the code
with help of match_string() API.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Message-Id: <20210402174334.13466-6-andriy.shevchenko@linux.intel.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-04-02 12:53:28 -05:00
Andy Shevchenko
bd7a33bfa1 ipmi_si: Use proper ACPI macros to check error code for failures
Instead of direct comparison, use proper ACPI macros to check error code
for failures.

While at it, drop unneeded 'else' keyword.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Message-Id: <20210402174334.13466-5-andriy.shevchenko@linux.intel.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-04-02 12:53:25 -05:00
Andy Shevchenko
96c4d0de91 ipmi_si: Utilize temporary variable to hold device pointer
Introduce a temporary variable to hold a device pointer.
It can be utilized in the ->probe() and save a bit of LOCs.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Message-Id: <20210402174334.13466-4-andriy.shevchenko@linux.intel.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-04-02 12:53:22 -05:00
Andy Shevchenko
ea63a26e2b ipmi_si: Remove bogus err_free label
There is no more 'free' in the error path, so drop the label and
return errors inline.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Message-Id: <20210402174334.13466-3-andriy.shevchenko@linux.intel.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-04-02 12:53:19 -05:00
Andy Shevchenko
079dea006f ipmi_si: Switch to use platform_get_mem_or_io()
Switch to use new platform_get_mem_or_io() instead of home grown analogue.
Note, we also introduce ipmi_set_addr_data_and_space() helper here.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Message-Id: <20210402174334.13466-2-andriy.shevchenko@linux.intel.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-04-02 12:53:15 -05:00
Heikki Krogerus
c053c4eb5a ipmi: Handle device properties with software node API
The old device property API is going to be removed.
Replacing the device_add_properties() call with the software
node API equivalent, device_create_managed_software_node().

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Message-Id: <20210304090312.26827-1-heikki.krogerus@linux.intel.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-03-10 19:00:02 -06:00
Liguang Zhang
dcd10526ac ipmi:ssif: make ssif_i2c_send() void
This function actually needs no return value. So remove the unneeded
check and make it void.

Signed-off-by: Liguang Zhang <zhangliguang@linux.alibaba.com>
Message-Id: <20210301140515.18951-1-zhangliguang@linux.alibaba.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-03-10 19:00:02 -06:00
Terry Duncan
c6ddd5f1c3 ipmi: Refine retry conditions for getting device id
Rarely but still failures are observed while getting BMC device ID
so this commit changes the condition to retry to get device id
when cc is not IPMI_CC_NO_ERROR.

Signed-off-by: Terry Duncan <terry.s.duncan@intel.com>
Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
Message-Id: <20210225045027.9344-1-jae.hyun.yoo@linux.intel.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-03-10 19:00:02 -06:00
Wolfram Sang
fc26067c74 ipmi: remove open coded version of SMBus block write
The block-write function of the core was not used because there was no
client-struct to use. However, in this case it seems apropriate to use a
temporary client struct. Because we are answering a request we recieved
when being a client ourselves. So, convert the code to use a temporary
client and use the block-write function of the I2C core.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Asmaa Mnebhi <asmaa@nvidia.com>
Acked-by: Corey Minyard <cminyard@mvista.com>
Message-Id: <20210128085544.7609-1-wsa+renesas@sang-engineering.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-01-28 07:15:12 -06:00
Zheng Yongjun
fad0319cac char: ipmi: convert comma to semicolon
Replace a comma between expression statements by a semicolon.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Message-Id: <20201216132615.15529-1-zhengyongjun3@huawei.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-12-16 07:54:54 -06:00
Qinglang Miao
368ffd9adc ipmi: msghandler: Suppress suspicious RCU usage warning
while running ipmi, ipmi_smi_watcher_register() caused
a suspicious RCU usage warning.

-----

=============================
WARNING: suspicious RCU usage
5.10.0-rc3+ #1 Not tainted
-----------------------------
drivers/char/ipmi/ipmi_msghandler.c:750 RCU-list traversed in non-reader section!!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
2 locks held by syz-executor.0/4254:
stack backtrace:
CPU: 0 PID: 4254 Comm: syz-executor.0 Not tainted 5.10.0-rc3+ #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1 04/ 01/2014
Call Trace:
dump_stack+0x19d/0x200
ipmi_smi_watcher_register+0x2d3/0x340 [ipmi_msghandler]
acpi_ipmi_init+0xb1/0x1000 [acpi_ipmi]
do_one_initcall+0x149/0x7e0
do_init_module+0x1ef/0x700
load_module+0x3467/0x4140
__do_sys_finit_module+0x10d/0x1a0
do_syscall_64+0x34/0x80
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x468ded

-----

It is safe because smi_watchers_mutex is locked and srcu_read_lock
has been used, so simply pass lockdep_is_held() to the
list_for_each_entry_rcu() to suppress this warning.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Message-Id: <20201119070839.381-1-miaoqinglang@huawei.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-11-19 06:36:28 -06:00
Yejune Deng
a01a89b1db ipmi/watchdog: replace atomic_add() and atomic_sub()
atomic_inc() and atomic_dec() looks better

Signed-off-by: Yejune Deng <yejune.deng@gmail.com>
Message-Id: <1605511807-7135-1-git-send-email-yejune.deng@gmail.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-11-17 06:57:45 -06:00
Tom Rix
0df7b988d9 char: ipmi: remove unneeded break
A break is not needed if it is preceded by a return

Signed-off-by: Tom Rix <trix@redhat.com>
Message-Id: <20201019194805.14996-1-trix@redhat.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-10-27 16:08:22 -05:00
Linus Torvalds
6e4dc3d592 Bug fix pull for IPMI for 5.10
Some minor bug fixes, return values, cleanups of prints, conversion of
 tasklets to the new API.
 
 The biggest change is retrying the initial information fetch from the
 management controller.  If that fails, the iterface is not operational,
 and one group was having trouble with the management controller not
 being ready when the OS started up.  So a retry was added.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE/Q1c5nzg9ZpmiCaGYfOMkJGb/4EFAl+Fzb0ACgkQYfOMkJGb
 /4F84w//RX/gaI1LkhkMKjrvtepNOElijAePFdPdCNYHvE+c50cADNHLstiQVaGk
 3URa/F1ba9LNlYsof9Y2L4PT5m6UUhmzWbJ3i0CZRJoqZUB4cZAzwrzHAG4oDqdG
 C8bO4mSHsglE5uTeZ7WPquzqfF7Jjq53tmVHRUYAc9MhAFph2x+8uW+zpyU/Y47a
 QMVdn3cE69B80IuZPa6puAlRKhF6M4RpfGCFgKzBXz4Hbf+3V290hI5ulwU60PV7
 MLrnsHbQzNybdKRN78nnBVB0bXIZDxz92Nk4HYjYIJhZYleVdZVH6BiFOa2ZpkxP
 F2rrsztjhaKV1fSXfxGivFATsrmcZ9zw7crYSmZBMoRQcr4gjG4LqPI+feBFZ3oy
 V8LtNcLQHM7v62iOfGIP83mOezhgF9S0I/HuCliB0V5GXRJv7MfrMKmmgCzCchuK
 koFgcWBGFzTDPRhjUeK1YyMxyM/F1JjRs8fK7qaG9e4hmqtGyE6nlg0W15VlPCt6
 jBGjy4Vn4WMNSdn/XBd/i4UEL1yOCaHbUrLexZc2+q3dlpWOcQ19JwQTkSLY95bM
 IrIKjLy7Rbnnnji1tAYgzqV2RzY3g35/Vv4T7XI9HDPplasCWUV/7+BDMNy2A8ec
 kq/bvwl3aoPiXKXDe512SyPR1R0b/SJWkdzLdznMGtOIqNnjjac=
 =t7Qa
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-5.10-1' of git://github.com/cminyard/linux-ipmi

Pull IPMI updates from Corey Minyard:
 "Some minor bug fixes, return values, cleanups of prints, conversion of
  tasklets to the new API.

  The biggest change is retrying the initial information fetch from the
  management controller. If that fails, the iterface is not operational,
  and one group was having trouble with the management controller not
  being ready when the OS started up. So a retry was added"

* tag 'for-linus-5.10-1' of git://github.com/cminyard/linux-ipmi:
  ipmi_si: Fix wrong return value in try_smi_init()
  ipmi: msghandler: Fix a signedness bug
  ipmi: add retry in try_get_dev_id()
  ipmi: Clean up some printks
  ipmi:msghandler: retry to get device id on an error
  ipmi:sm: Print current state when the state is invalid
  ipmi: Reset response handler when failing to send the command
  ipmi: add a newline when printing parameter 'panic_op' by sysfs
  char: ipmi: convert tasklets to use new tasklet_setup() API
2020-10-14 15:00:20 -07:00
Tianjia Zhang
8fe7990ced ipmi_si: Fix wrong return value in try_smi_init()
On an error exit path, a negative error code should be returned
instead of a positive return value.

Fixes: 90b2d4f15f ("ipmi_si: Remove hacks for adding a dummy platform devices")
Cc: Corey Minyard <cminyard@mvista.com>
Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Message-Id: <20201005145212.84435-1-tianjia.zhang@linux.alibaba.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-10-05 13:30:51 -05:00
Dan Carpenter
c011410d91 ipmi: msghandler: Fix a signedness bug
The type for the completion codes should be unsigned char instead of
char.  If it is declared as a normal char then the conditions in
__get_device_id() are impossible because the IPMI_DEVICE_IN_FW_UPDATE_ERR
error codes are higher than 127.

    drivers/char/ipmi/ipmi_msghandler.c:2449 __get_device_id()
    warn: impossible condition '(bmc->cc == 209) => ((-128)-127 == 209)'

Fixes: f8910ffa81 ("ipmi:msghandler: retry to get device id on an error")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Message-Id: <20200918142756.GB909725@mwanda>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-09-18 16:34:52 -05:00
Xianting Tian
42d8a346c5 ipmi: add retry in try_get_dev_id()
Use a retry machanism to give the BMC more opportunities to correctly
respond when we receive specific completion codes.

This is similar to what is done in __get_device_id().

Signed-off-by: Xianting Tian <tian.xianting@h3c.com>
Message-Id: <20200916062129.26129-1-tian.xianting@h3c.com>
[Moved GET_DEVICE_ID_MAX_RETRY to include/linux/ipmi.h, reworded some
 text.]
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-09-16 08:54:53 -05:00
Corey Minyard
a190db945b ipmi: Clean up some printks
Convert to dev_xxx() and fix some verbage.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-09-15 09:57:45 -05:00
Xianting Tian
f8910ffa81 ipmi:msghandler: retry to get device id on an error
We fail to get the BMCS's device id with low probability when loading
the ipmi driver and it causes BMC device registration failed. When this
issue occurs we got below kernel prints:

  [Wed Sep  9 19:52:03 2020] ipmi_si IPI0001:00: IPMI message handler:
     device id demangle failed: -22
  [Wed Sep  9 19:52:03 2020] IPMI BT: using default values
  [Wed Sep  9 19:52:03 2020] IPMI BT: req2rsp=5 secs retries=2
  [Wed Sep  9 19:52:03 2020] ipmi_si IPI0001:00: Unable to get the
     device id: -5
  [Wed Sep  9 19:52:04 2020] ipmi_si IPI0001:00: Unable to register
     device: error -5

When this issue happens, we want to manually unload the driver and try to
load it again, but it can't be unloaded by 'rmmod' as it is already 'in
use'.

We add a print in handle_one_recv_msg(), when this issue happens,
the msg we received is "Recv: 1c 01 d5", which means the data_len is 1,
data[0] is 0xd5 (completion code), which means "bmc cannot execute
command.  Command, or request parameter(s), not supported in present
state".  Debug code:
	static int handle_one_recv_msg(struct ipmi_smi *intf,
                               struct ipmi_smi_msg *msg) {
        	printk("Recv: %*ph\n", msg->rsp_size, msg->rsp);
		... ...
	}
Then in ipmi_demangle_device_id(), it returned '-EINVAL' as 'data_len < 7'
and 'data[0] != 0'.

We created this patch to retry the get device id when this error
happens.  We reproduced this issue again and the retry succeed on the
first retry, we finally got the correct msg and then all is ok:
Recv: 1c 01 00 01 81 05 84 02 af db 07 00 01 00 b9 00 10 00

So use a retry machanism in this patch to give bmc more opportunity to
correctly response kernel when we received specific completion codes.

Signed-off-by: Xianting Tian <tian.xianting@h3c.com>
Message-Id: <20200915071817.4484-1-tian.xianting@h3c.com>
[Cleaned up the verbage a bit in the header and prints.]
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-09-15 09:57:45 -05:00
Xianting Tian
c2b1e76d8c ipmi:sm: Print current state when the state is invalid
Print current state before returning IPMI_NOT_IN_MY_STATE_ERR so we can
know where this issue is coming from and possibly fix the state machine.

Signed-off-by: Xianting Tian <tian.xianting@h3c.com>
Message-Id: <20200915074441.4090-1-tian.xianting@h3c.com>
[Converted printk() to pr_xxx().]
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-09-15 09:46:20 -05:00
Markus Boehme
81e7571ea3 ipmi: Reset response handler when failing to send the command
When failing to send a command we don't expect a response. Clear the
`null_user_handler` like is done in the success path.

Signed-off-by: Markus Boehme <markubo@amazon.com>
Message-Id: <1599495937-10654-1-git-send-email-markubo@amazon.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-09-15 08:52:27 -05:00
Xiongfeng Wang
8a00e56a14 ipmi: add a newline when printing parameter 'panic_op' by sysfs
When I cat ipmi_msghandler parameter 'panic_op' by sysfs, it displays as
follows. It's better to add a newline for easy reading.

root@(none):/# cat /sys/module/ipmi_msghandler/parameters/panic_op
noneroot@(none):/#

Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Message-Id: <1599130873-2402-1-git-send-email-wangxiongfeng2@huawei.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-09-03 13:34:35 -05:00
Gustavo A. R. Silva
df561f6688 treewide: Use fallthrough pseudo-keyword
Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.

[1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
2020-08-23 17:36:59 -05:00
Allen Pais
83dea12856 char: ipmi: convert tasklets to use new tasklet_setup() API
In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
Message-Id: <20200817091617.28119-3-allen.cryptic@gmail.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-08-18 06:04:11 -05:00
Xiongfeng Wang
634b06def1 ipmi/watchdog: add missing newlines when printing parameters by sysfs
When I cat some ipmi_watchdog parameters by sysfs, it displays as
follows. It's better to add a newline for easy reading.

root@(none):/# cat /sys/module/ipmi_watchdog/parameters/action
resetroot@(none):/# cat /sys/module/ipmi_watchdog/parameters/preaction
pre_noneroot@(none):/# cat /sys/module/ipmi_watchdog/parameters/preop
preop_noneroot@(none):/#

Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Message-Id: <1595313309-43881-1-git-send-email-wangxiongfeng2@huawei.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-07-21 06:29:15 -05:00
Jing Xiangfeng
a7f0f92aa8 ipmi: remve duplicate code in __ipmi_bmc_register()
__ipmi_bmc_register() jumps to the label 'out_free_my_dev_name' in an
error path. So we can remove duplicate code in the if (rv).

Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
Message-Id: <20200720080838.148737-1-jingxiangfeng@huawei.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-07-20 06:31:50 -05:00
Misono Tomohiro
29a5491015 ipmi: ssif: Remove finished TODO comment about SMBus alert
commit 9162052173 ("ipmi: Add alert handling to SSIF") introduces
support of SMBus alert. So, just remove TODO comment in order not to
confuse future readers.

Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
Message-Id: <20200624065405.17653-2-misono.tomohiro@jp.fujitsu.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-06-24 06:41:42 -05:00
Linus Torvalds
1f2dc7f5b6 IPMI update for 5.8
A few small fixes for things, nothing earth shattering.
 
 -corey
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE/Q1c5nzg9ZpmiCaGYfOMkJGb/4EFAl7ZQ+UACgkQYfOMkJGb
 /4GJYg//dOy9/1GQ2jKuOGuS9K9dJdDVrnazR0tlHhBfQnhaNZRE6lWhwfpQSd/3
 D1hHD7+DOU0ytFyx3lJN6bSA7jW+yw5ZRtDzATFZOKuPDWXaO+zsB+e/L+z2z2S7
 Gw9RiJ6FzzEv3T33K6JoKU4Db4nGSCUbg5UK9gOrzPr4MFopAU1AiDLThPjsrrao
 Snt9Cyd1lLGfJuREkMWKYutsCYqB+BeMSfIe8HC+0vKxGmFX8T60A+bNtjfAtPx+
 pQ4BkmaV/p9K5BSI3O4Io60qj4VTH+7TUKszwAOy8zjC+WG0mkLMFJgjO2uLiBbo
 UvkRMbxRB7v/VEDOjpS8z5cSVVBZ2GotnBFoMDgLbQIbu6R5Dz3gMgFRY3kx3wqe
 eHWAOh/XFXGul4h76rvTp8RDSoe4DXWbLLemsbWZrYq0tbyKyyhCgIcP9+Qh/8yC
 CrKVeVF0RvHpKpDY7uT5KFQ/PS7GFf5SyK9YdbQqlRS66rn5JCE3kAW+6aeUF4Vz
 ZdArNIEEZMZxwZr4wqHTF9ZL7C4+zw5Y3q7HKUAkXK9GRGdp1BYUvgzPtLKz7FWM
 9JvuNRO4RhMWk0a0BkvwxlHl2odPe9mQiOjMB4ld/msukmSlileKn58JHHxAYlwK
 Qotqfaq5Iq6UKujdBV95Z6SOXDpjG/0QY9zrAziSTClm7tQML14=
 =nuZ5
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-5.8-1' of git://github.com/cminyard/linux-ipmi

Pull IPMI updates from Corey Minyard:
 "A few small fixes for things, nothing earth shattering"

* tag 'for-linus-5.8-1' of git://github.com/cminyard/linux-ipmi:
  ipmi:ssif: Remove dynamic platform device handing
  Try to load acpi_ipmi when an SSIF ACPI IPMI interface is added
  ipmi_si: Load acpi_ipmi when ACPI IPMI interface added
  ipmi:bt-bmc: Fix error handling and status check
  ipmi: Replace guid_copy() with import_guid() where it makes sense
  ipmi: use vzalloc instead of kmalloc for user creation
  ipmi:bt-bmc: Fix some format issue of the code
  ipmi:bt-bmc: Avoid unnecessary check
2020-06-05 13:58:04 -07:00
Linus Torvalds
b23c4771ff A fair amount of stuff this time around, dominated by yet another massive
set from Mauro toward the completion of the RST conversion.  I *really*
 hope we are getting close to the end of this.  Meanwhile, those patches
 reach pretty far afield to update document references around the tree;
 there should be no actual code changes there.  There will be, alas, more of
 the usual trivial merge conflicts.
 
 Beyond that we have more translations, improvements to the sphinx
 scripting, a number of additions to the sysctl documentation, and lots of
 fixes.
 -----BEGIN PGP SIGNATURE-----
 
 iQFDBAABCAAtFiEEIw+MvkEiF49krdp9F0NaE2wMflgFAl7VId8PHGNvcmJldEBs
 d24ubmV0AAoJEBdDWhNsDH5Yq/gH/iaDgirQZV6UZ2v9sfwQNYolNpf2sKAuOZjd
 bPFB7WJoMQbKwQEvYrAUL2+5zPOcLYuIfzyOfo1BV1py+EyKbACcKjI4AedxfJF7
 +NchmOBhlEqmEhzx2U08HRc4/8J223WG17fJRVsV3p+opJySexSFeQucfOciX5NR
 RUCxweWWyg/FgyqjkyMMTtsePqZPmcT5dWTlVXISlbWzcv5NFhuJXnSrw8Sfzcmm
 SJMzqItv3O+CabnKQ8kMLV2PozXTMfjeWH47ZUK0Y8/8PP9+cvqwFzZ0UDQJ1Xaz
 oyW/TqmunaXhfMsMFeFGSwtfgwRHvXdxkQdtwNHvo1dV4dzTvDw=
 =fDC/
 -----END PGP SIGNATURE-----

Merge tag 'docs-5.8' of git://git.lwn.net/linux

Pull documentation updates from Jonathan Corbet:
 "A fair amount of stuff this time around, dominated by yet another
  massive set from Mauro toward the completion of the RST conversion. I
  *really* hope we are getting close to the end of this. Meanwhile,
  those patches reach pretty far afield to update document references
  around the tree; there should be no actual code changes there. There
  will be, alas, more of the usual trivial merge conflicts.

  Beyond that we have more translations, improvements to the sphinx
  scripting, a number of additions to the sysctl documentation, and lots
  of fixes"

* tag 'docs-5.8' of git://git.lwn.net/linux: (130 commits)
  Documentation: fixes to the maintainer-entry-profile template
  zswap: docs/vm: Fix typo accept_threshold_percent in zswap.rst
  tracing: Fix events.rst section numbering
  docs: acpi: fix old http link and improve document format
  docs: filesystems: add info about efivars content
  Documentation: LSM: Correct the basic LSM description
  mailmap: change email for Ricardo Ribalda
  docs: sysctl/kernel: document unaligned controls
  Documentation: admin-guide: update bug-hunting.rst
  docs: sysctl/kernel: document ngroups_max
  nvdimm: fixes to maintainter-entry-profile
  Documentation/features: Correct RISC-V kprobes support entry
  Documentation/features: Refresh the arch support status files
  Revert "docs: sysctl/kernel: document ngroups_max"
  docs: move locking-specific documents to locking/
  docs: move digsig docs to the security book
  docs: move the kref doc into the core-api book
  docs: add IRQ documentation at the core-api book
  docs: debugging-via-ohci1394.txt: add it to the core-api book
  docs: fix references for ipmi.rst file
  ...
2020-06-01 15:45:27 -07:00
Corey Minyard
2a556ce779 ipmi:ssif: Remove dynamic platform device handing
Platform devices can only come in through the DMI interface, and that
will get done before initialization is complete.  Therefore there is no
reason to hande getting a device in new_ssif_client after
initialization.

Dynamic entries can still come in through the i2c interfaces, but that's
handled differently.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-05-27 18:25:56 -05:00
Corey Minyard
e641abd3c7 Try to load acpi_ipmi when an SSIF ACPI IPMI interface is added
This is similar to the recent patch for the SI interface, but for SSIF.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-05-18 06:32:02 -05:00
Stuart Hayes
429b00f606 ipmi_si: Load acpi_ipmi when ACPI IPMI interface added
Try to load acpi_ipmi when an ACPI IPMI interface is added, so that the
ACPI IPMI OpRegion is accessible.

Signed-off-by: Stuart Hayes <stuart.w.hayes@gmail.com>
Message-Id: <20200311192409.59923-1-stuart.w.hayes@gmail.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-05-18 06:32:02 -05:00
Tang Bin
49826937e7 ipmi:bt-bmc: Fix error handling and status check
If the function platform_get_irq() failed, the negative value
returned will not be detected here. So fix error handling in
bt_bmc_config_irq(). And in the function bt_bmc_probe(),
when get irq failed, it will print error message. So use
platform_get_irq_optional() to simplify code. Finally in the
function bt_bmc_remove() should make the right status check
if get irq failed.

Signed-off-by: Shengju Zhang <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Message-Id: <20200505102906.17196-1-tangbin@cmss.chinamobile.com>
[Also set bt_bmc->irq to a negative value if devm_request_irq() fails.]
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-05-18 06:32:02 -05:00
Andy Shevchenko
878caa9659 ipmi: Replace guid_copy() with import_guid() where it makes sense
There is a specific API to treat raw data as GUID, i.e. import_guid().
Use it instead of guid_copy() with explicit casting.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Message-Id: <20200422130348.38749-1-andriy.shevchenko@linux.intel.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-05-18 06:32:02 -05:00
Feng Tang
7c47a219b9 ipmi: use vzalloc instead of kmalloc for user creation
We met mulitple times of failure of staring bmc-watchdog,
due to the runtime memory allocation failure of order 4.

     bmc-watchdog: page allocation failure: order:4, mode:0x40cc0(GFP_KERNEL|__GFP_COMP), nodemask=(null),cpuset=/,mems_allowed=0-1
     CPU: 1 PID: 2571 Comm: bmc-watchdog Not tainted 5.5.0-00045-g7d6bb61d6188c #1
     Hardware name: Intel Corporation S2600WFT/S2600WFT, BIOS SE5C620.86B.00.01.0015.110720180833 11/07/2018
     Call Trace:
      dump_stack+0x66/0x8b
      warn_alloc+0xfe/0x160
      __alloc_pages_slowpath+0xd3e/0xd80
      __alloc_pages_nodemask+0x2f0/0x340
      kmalloc_order+0x18/0x70
      kmalloc_order_trace+0x1d/0xb0
      ipmi_create_user+0x55/0x2c0 [ipmi_msghandler]
      ipmi_open+0x72/0x110 [ipmi_devintf]
      chrdev_open+0xcb/0x1e0
      do_dentry_open+0x1ce/0x380
      path_openat+0x305/0x14f0
      do_filp_open+0x9b/0x110
      do_sys_open+0x1bd/0x250
      do_syscall_64+0x5b/0x1f0
      entry_SYSCALL_64_after_hwframe+0x44/0xa9

Using vzalloc/vfree for creating ipmi_user heals the
problem

Thanks to Stephen Rothwell for finding the vmalloc.h
inclusion issue.

Signed-off-by: Feng Tang <feng.tang@intel.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-05-18 06:32:02 -05:00
Tang Bin
8ed678dbac ipmi:bt-bmc: Fix some format issue of the code
Fix some format issue of the code in bt-bmc.c

Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Signed-off-by: Shengju Zhang <zhangshengju@cmss.chinamobile.com>
Message-Id: <20200414141814.19048-1-tangbin@cmss.chinamobile.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-05-18 06:32:02 -05:00
Tang Bin
0b671eed0c ipmi:bt-bmc: Avoid unnecessary check
bt_bmc_probe() is only called with an openfirmware platform device.
Therefore there is no need to check that the passed in device is NULL or
that it has an openfirmware node.

Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Message-Id: <20200408115958.2848-1-tangbin@cmss.chinamobile.com>
[Fixed the title up a bit.]
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-05-18 06:32:02 -05:00
Mauro Carvalho Chehab
283b69bf79 docs: fix references for ipmi.rst file
As this file got moved, fix references for it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/b6c1ded590f27198de15b16237509128e55fa810.1588345503.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2020-05-15 11:55:21 -06:00
Wolfram Sang
653d374771 char: ipmi: convert to use i2c_new_client_device()
Move away from the deprecated API.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Message-Id: <20200326210958.13051-2-wsa+renesas@sang-engineering.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-05-14 15:37:31 -05:00
Dan Carpenter
e96387677c ipmi: kcs: Fix aspeed_kcs_probe_of_v1()
This needs to return the newly allocated struct but instead it returns
zero which leads to an immediate Oops in the caller.

Fixes: 09f5f68070 ("ipmi: kcs: aspeed: Implement v2 bindings")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Message-Id: <20200407122149.GA100026@mwanda>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-04-07 08:35:40 -05:00
Jules Irenge
562bf77058 ipmi: Add missing annotation for ipmi_ssif_lock_cond() and ipmi_ssif_unlock_cond()
Sparse reports a warning at ipmi_ssif_unlock_cond()
	and ipmi_ssif_lock_cond()

warning: context imbalance in ipmi_ssif_lock_cond()
	- wrong count at exit
 warning: context imbalance in ipmi_ssif_unlock_cond()
	- unexpected unlock

The root cause is the missing annotation at ipmi_ssif_unlock_cond()
	and ipmi_ssif_lock_cond()

Add the missing __acquires(&ata_scsi_rbuf_lock)
Add the missing __releases(&ata_scsi_rbuf_lock)

Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
Message-Id: <20200403160505.2832-6-jbi.octave@gmail.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-04-03 13:34:57 -05:00
Andrew Jeffery
09f5f68070 ipmi: kcs: aspeed: Implement v2 bindings
The v2 bindings allow us to extract the resources from the devicetree.
The table in the driver is retained to derive the channel index, which
removes the need for kcs_chan property from the v1 bindings. The v2
bindings allow us to reduce the number of warnings generated by the
existing devicetree nodes.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Haiyue Wang <haiyue.wang@linux.intel.com>
Message-Id: <01ef3787e9ddaa9d87cfd55a2ac793053b5a69de.1576462051.git-series.andrew@aj.id.au>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-04-03 08:05:05 -05:00
Andrew Jeffery
af6432c76a ipmi: kcs: Finish configuring ASPEED KCS device before enable
The interrupts were configured after the channel was enabled. Configure
them beforehand so they will work.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Haiyue Wang <haiyue.wang@linux.intel.com>
Message-Id: <c0aba2c9dfe2d0525e9cefd37995983ead0ec242.1576462051.git-series.andrew@aj.id.au>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-04-03 08:05:05 -05:00