summaryrefslogtreecommitdiff
path: root/drivers/char/ipmi
AgeCommit message (Collapse)AuthorFilesLines
2021-06-22ipmi: kcs_bmc_aspeed: Fix less than zero comparison of a unsigned intColin Ian King1-3/+5
The comparisons of the unsigned int hw_type to less than zero always false because it is unsigned. Fix this by using an int for the assignment and less than zero check. Addresses-Coverity: ("Unsigned compared against 0") Fixes: 9d2df9a0ad80 ("ipmi: kcs_bmc_aspeed: Implement KCS SerIRQ configuration") Signed-off-by: Colin Ian King <colin.king@canonical.com> Message-Id: <20210616162913.15259-1-colin.king@canonical.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-06-22ipmi: kcs_bmc_aspeed: Optionally apply status addressAndrew Jeffery1-33/+83
Some Aspeed KCS devices can derive the status register address from the address of the data register. As such, the address of the status register can be implicit in the configuration if desired. On the other hand, sometimes address schemes might be requested that are incompatible with the default addressing scheme. Allow these requests where possible if the devicetree specifies the status register address. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Reviewed-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com> Message-Id: <20210608104757.582199-17-andrew@aj.id.au> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-06-22ipmi: kcs_bmc_aspeed: Fix IBFIE typo from datasheetAndrew Jeffery1-12/+12
Input Buffer Full Interrupt Enable (IBFIE) is typoed as IBFIF for some registers in the datasheet. Fix the driver to use the sensible acronym. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Reviewed-by: Zev Weiss <zweiss@equinix.com> Message-Id: <20210608104757.582199-16-andrew@aj.id.au> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-06-22ipmi: kcs_bmc_aspeed: Implement KCS SerIRQ configurationAndrew Jeffery1-2/+180
Apply the SerIRQ ID and level/sense behaviours from the devicetree if provided. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Message-Id: <20210608104757.582199-15-andrew@aj.id.au> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-06-22ipmi: kcs_bmc: Add serio adaptorAndrew Jeffery3-0/+172
kcs_bmc_serio acts as a bridge between the KCS drivers in the IPMI subsystem and the existing userspace interfaces available through the serio subsystem. This is useful when userspace would like to make use of the BMC KCS devices for purposes that aren't IPMI. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Message-Id: <20210608104757.582199-12-andrew@aj.id.au> Reviewed-by: Zev Weiss <zweiss@equinix.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-06-22ipmi: kcs_bmc: Enable IBF on openAndrew Jeffery3-19/+12
This way devices don't get delivered IRQs when no-one is interested. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Message-Id: <20210608104757.582199-11-andrew@aj.id.au> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-06-22ipmi: kcs_bmc: Allow clients to control KCS IRQ stateAndrew Jeffery6-57/+131
Add a mechanism for controlling whether the client associated with a KCS device will receive Input Buffer Full (IBF) and Output Buffer Empty (OBE) events. This enables an abstract implementation of poll() for KCS devices. A wart in the implementation is that the ASPEED KCS devices don't support an OBE interrupt for the BMC. Instead we pretend it has one by polling the status register waiting for the Output Buffer Full (OBF) bit to clear, and generating an event when OBE is observed. Cc: CS20 KWLiu <KWLIU@nuvoton.com> Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Reviewed-by: Zev Weiss <zweiss@equinix.com> Message-Id: <20210608104757.582199-10-andrew@aj.id.au> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-06-22ipmi: kcs_bmc: Decouple the IPMI chardev from the coreAndrew Jeffery5-13/+128
Now that we have untangled the data-structures, split the userspace interface out into its own module. Userspace interfaces and drivers are registered to the KCS BMC core to support arbitrary binding of either. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Message-Id: <20210608104757.582199-9-andrew@aj.id.au> Reviewed-by: Zev Weiss <zweiss@equinix.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-06-22ipmi: kcs_bmc: Strip private client data from struct kcs_bmcAndrew Jeffery7-294/+367
Move all client-private data out of `struct kcs_bmc` into the KCS client implementation. With this change the KCS BMC core code now only concerns itself with abstract `struct kcs_bmc` and `struct kcs_bmc_client` types, achieving expected separation of concerns. Further, the change clears the path for implementation of alternative userspace interfaces. The chardev data-structures are rearranged in the same manner applied to the KCS device driver data-structures in an earlier patch - `struct kcs_bmc_client` is embedded in the client's private data and we exploit container_of() to translate as required. Finally, now that it is free of client data, `struct kcs_bmc` is renamed to `struct kcs_bmc_device` to contrast `struct kcs_bmc_client`. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Reviewed-by: Zev Weiss <zweiss@equinix.com> Message-Id: <20210608104757.582199-8-andrew@aj.id.au> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-06-22ipmi: kcs_bmc: Split headers into device and clientAndrew Jeffery7-52/+117
Strengthen the distinction between code that abstracts the implementation of the KCS behaviours (device drivers) and code that exploits KCS behaviours (clients). Neither needs to know about the APIs required by the other, so provide separate headers. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Message-Id: <20210608104757.582199-7-andrew@aj.id.au> Reviewed-by: Zev Weiss <zweiss@equinix.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-06-22ipmi: kcs_bmc: Turn the driver data-structures inside-outAndrew Jeffery5-67/+110
Make the KCS device drivers responsible for allocating their own memory. Until now the private data for the device driver was allocated internal to the private data for the chardev interface. This coupling required the slightly awkward API of passing through the struct size for the driver private data to the chardev constructor, and then retrieving a pointer to the driver private data from the allocated chardev memory. In addition to being awkward, the arrangement prevents the implementation of alternative userspace interfaces as the device driver private data is not independent. Peel a layer off the onion and turn the data-structures inside out by exploiting container_of() and embedding `struct kcs_device` in the driver private data. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Reviewed-by: Zev Weiss <zweiss@equinix.com> Message-Id: <20210608104757.582199-6-andrew@aj.id.au> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-06-22ipmi: kcs_bmc: Split out kcs_bmc_cdev_ipmiAndrew Jeffery4-412/+451
Take steps towards defining a coherent API to separate the KCS device drivers from the userspace interface. Decreasing the coupling will improve the separation of concerns and enable the introduction of alternative userspace interfaces. For now, simply split the chardev logic out to a separate file. The code continues to build into the same module. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Reviewed-by: Zev Weiss <zweiss@equinix.com> Message-Id: <20210608104757.582199-5-andrew@aj.id.au> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-06-22ipmi: kcs_bmc: Rename {read,write}_{status,data}() functionsAndrew Jeffery1-27/+25
Rename the functions in preparation for separating the IPMI chardev out from the KCS BMC core. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Reviewed-by: Zev Weiss <zweiss@equinix.com> Message-Id: <20210608104757.582199-4-andrew@aj.id.au> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-06-22ipmi: kcs_bmc: Make status update atomicAndrew Jeffery4-6/+21
Enable more efficient implementation of read-modify-write sequences. Both device drivers for the KCS BMC stack use regmaps. The new callback allows us to exploit regmap_update_bits(). Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Reviewed-by: Zev Weiss <zweiss@equinix.com> Message-Id: <20210608104757.582199-3-andrew@aj.id.au> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-06-22ipmi: kcs_bmc_aspeed: Use of match data to extract KCS propertiesAndrew Jeffery1-76/+76
Unpack and remove the aspeed_kcs_probe_of_v[12]() functions to aid rearranging how the private device-driver memory is allocated. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Message-Id: <20210608104757.582199-2-andrew@aj.id.au> Reviewed-by: Zev Weiss <zweiss@equinix.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-05-13ipmi/watchdog: Stop watchdog timer when the current action is 'none'Petr Pavlu1-10/+12
When an IPMI watchdog timer is being stopped in ipmi_close() or ipmi_ioctl(WDIOS_DISABLECARD), the current watchdog action is updated to WDOG_TIMEOUT_NONE and _ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB) is called to install this action. The latter function ends up invoking __ipmi_set_timeout() which makes the actual 'Set Watchdog Timer' IPMI request. For IPMI 1.0, this operation results in fully stopping the watchdog timer. For IPMI >= 1.5, function __ipmi_set_timeout() always specifies the "don't stop" flag in the prepared 'Set Watchdog Timer' IPMI request. This causes that the watchdog timer has its action correctly updated to 'none' but the timer continues to run. A problem is that IPMI firmware can then still log an expiration event when the configured timeout is reached, which is unexpected because the watchdog timer was requested to be stopped. The patch fixes this problem by not setting the "don't stop" flag in __ipmi_set_timeout() when the current action is WDOG_TIMEOUT_NONE which results in stopping the watchdog timer. This makes the behaviour for IPMI >= 1.5 consistent with IPMI 1.0. It also matches the logic in __ipmi_heartbeat() which does not allow to reset the watchdog if the current action is WDOG_TIMEOUT_NONE as that would start the timer. Signed-off-by: Petr Pavlu <petr.pavlu@suse.com> Message-Id: <10a41bdc-9c99-089c-8d89-fa98ce5ea080@suse.com> Cc: stable@vger.kernel.org Signed-off-by: Corey Minyard <cminyard@mvista.com>
2021-04-29Merge tag 'for-linus-5.13-1' of git://github.com/cminyard/linux-ipmiLinus Torvalds9-266/+137
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-09ipmi: kcs: aspeed: Adapt to new LPC DTS layoutChia-Wei, Wang1-11/+16
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-02ipmi_si: Join string literals backAndy Shevchenko6-66/+38
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-02ipmi_si: Drop redundant check before calling put_device()Andy Shevchenko1-2/+1
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-02ipmi_si: Use strstrip() to remove surrounding spacesAndy Shevchenko1-12/+4
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-02ipmi_si: Get rid of ->addr_source_cleanup()Andy Shevchenko3-22/+2
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-02ipmi_si: Reuse si_to_str[] array in ipmi_hardcode_init_one()Andy Shevchenko3-16/+16
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-02ipmi_si: Introduce ipmi_panic_event_str[] arrayAndy Shevchenko1-32/+19
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-02ipmi_si: Use proper ACPI macros to check error code for failuresAndy Shevchenko1-6/+6
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-02ipmi_si: Utilize temporary variable to hold device pointerAndy Shevchenko1-8/+7
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-02ipmi_si: Remove bogus err_free labelAndy Shevchenko1-12/+5
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-02ipmi_si: Switch to use platform_get_mem_or_io()Andy Shevchenko1-20/+14
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-03-11ipmi: Handle device properties with software node APIHeikki Krogerus1-1/+1
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-11ipmi:ssif: make ssif_i2c_send() voidLiguang Zhang1-61/+20
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-11ipmi: Refine retry conditions for getting device idTerry Duncan2-8/+4
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-01-28ipmi: remove open coded version of SMBus block writeWolfram Sang1-12/+12
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>
2020-12-16char: ipmi: convert comma to semicolonZheng Yongjun1-3/+3
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-11-19ipmi: msghandler: Suppress suspicious RCU usage warningQinglang Miao1-1/+2
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-17ipmi/watchdog: replace atomic_add() and atomic_sub()Yejune Deng1-4/+4
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-10-28char: ipmi: remove unneeded breakTom Rix1-1/+0
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-15Merge tag 'for-linus-5.10-1' of git://github.com/cminyard/linux-ipmiLinus Torvalds5-36/+89
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-05ipmi_si: Fix wrong return value in try_smi_init()Tianjia Zhang1-1/+1
On an error exit path, a negative error code should be returned instead of a positive return value. Fixes: 90b2d4f15ff7 ("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-09-19ipmi: msghandler: Fix a signedness bugDan Carpenter2-2/+2
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: f8910ffa81b0 ("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-16ipmi: add retry in try_get_dev_id()Xianting Tian2-2/+17
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-15ipmi: Clean up some printksCorey Minyard3-19/+29
Convert to dev_xxx() and fix some verbage. Signed-off-by: Corey Minyard <cminyard@mvista.com>
2020-09-15ipmi:msghandler: retry to get device id on an errorXianting Tian1-4/+25
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-15ipmi:sm: Print current state when the state is invalidXianting Tian3-3/+9
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-15ipmi: Reset response handler when failing to send the commandMarkus Boehme1-1/+3
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-03ipmi: add a newline when printing parameter 'panic_op' by sysfsXiongfeng Wang1-4/+4
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-08-24treewide: Use fallthrough pseudo-keywordGustavo A. R. Silva1-1/+1
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-18char: ipmi: convert tasklets to use new tasklet_setup() APIAllen Pais1-7/+6
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-07-21ipmi/watchdog: add missing newlines when printing parameters by sysfsXiongfeng Wang1-2/+7
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-20ipmi: remve duplicate code in __ipmi_bmc_register()Jing Xiangfeng1-2/+0
__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-06-24ipmi: ssif: Remove finished TODO comment about SMBus alertMisono Tomohiro1-5/+0
commit 9162052173d2 ("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>