summaryrefslogtreecommitdiff
path: root/drivers/char/ipmi/ipmi_si_intf.c
AgeCommit message (Collapse)Author
2017-12-16ipmi: Stop timers before cleaning up the moduleMasamitsu Yamazaki
commit 4f7f5551a760eb0124267be65763008169db7087 upstream. System may crash after unloading ipmi_si.ko module because a timer may remain and fire after the module cleaned up resources. cleanup_one_si() contains the following processing. /* * Make sure that interrupts, the timer and the thread are * stopped and will not run again. */ if (to_clean->irq_cleanup) to_clean->irq_cleanup(to_clean); wait_for_timer_and_thread(to_clean); /* * Timeouts are stopped, now make sure the interrupts are off * in the BMC. Note that timers and CPU interrupts are off, * so no need for locks. */ while (to_clean->curr_msg || (to_clean->si_state != SI_NORMAL)) { poll(to_clean); schedule_timeout_uninterruptible(1); } si_state changes as following in the while loop calling poll(to_clean). SI_GETTING_MESSAGES => SI_CHECKING_ENABLES => SI_SETTING_ENABLES => SI_GETTING_EVENTS => SI_NORMAL As written in the code comments above, timers are expected to stop before the polling loop and not to run again. But the timer is set again in the following process when si_state becomes SI_SETTING_ENABLES. => poll => smi_event_handler => handle_transaction_done // smi_info->si_state == SI_SETTING_ENABLES => start_getting_events => start_new_msg => smi_mod_timer => mod_timer As a result, before the timer set in start_new_msg() expires, the polling loop may see si_state becoming SI_NORMAL and the module clean-up finishes. For example, hard LOCKUP and panic occurred as following. smi_timeout was called after smi_event_handler, kcs_event and hangs at port_inb() trying to access I/O port after release. [exception RIP: port_inb+19] RIP: ffffffffc0473053 RSP: ffff88069fdc3d80 RFLAGS: 00000006 RAX: ffff8806800f8e00 RBX: ffff880682bd9400 RCX: 0000000000000000 RDX: 0000000000000ca3 RSI: 0000000000000ca3 RDI: ffff8806800f8e40 RBP: ffff88069fdc3d80 R8: ffffffff81d86dfc R9: ffffffff81e36426 R10: 00000000000509f0 R11: 0000000000100000 R12: 0000000000]:000000 R13: 0000000000000000 R14: 0000000000000246 R15: ffff8806800f8e00 ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0000 --- <NMI exception stack> --- To fix the problem I defined a flag, timer_can_start, as member of struct smi_info. The flag is enabled immediately after initializing the timer and disabled immediately before waiting for timer deletion. Fixes: 0cfec916e86d ("ipmi: Start the timer and thread on internal msgs") Signed-off-by: Yamazaki Masamitsu <m-yamazaki@ah.jp.nec.com> [Adjusted for recent changes in the driver.] [Some fairly major changes went into the IPMI driver in 4.15, so this required a backport as the code had changed and moved to a different file. The 4.14 version of this patch moved some code under an if statement causing it to not apply to 4.7-4.13.] Signed-off-by: Corey Minyard <cminyard@mvista.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-07-27ipmi: remove trydefaults parameter and default initTony Camuso
Parameter trydefaults=1 causes the ipmi_init to initialize ipmi through the legacy port io space that was designated for ipmi. Architectures that do not map legacy port io can panic when trydefaults=1. Rather than implement build-time conditional exceptions for each architecture that does not map legacy port io, we have removed legacy port io from the driver. Parameter 'trydefaults' has been removed. Attempts to use it hereafter will evoke the "Unknown symbol in module, or unknown parameter" message. The patch was built against a number of architectures and tested for regressions and functionality on x86_64 and ARM64. Signed-off-by: Tony Camuso <tcamuso@redhat.com> Removed the config entry and the address source entry for default, since neither were used any more. Signed-off-by: Corey Minyard <cminyard@mvista.com>
2016-05-16IPMI: reserve memio regions separatelyCorey Minyard
Commit d61a3ead2680 ("[PATCH] IPMI: reserve I/O ports separately") changed the way I/O ports were reserved and includes this comment in log: Some BIOSes reserve disjoint I/O regions in their ACPI tables for the IPMI controller. This causes problems when trying to register the entire I/O region. Therefore we must register each I/O port separately. There is a similar problem with memio regions on an arm64 platform (AMD Seattle). Where I see: ipmi message handler version 39.2 ipmi_si AMDI0300:00: probing via device tree ipmi_si AMDI0300:00: ipmi_si: probing via ACPI ipmi_si AMDI0300:00: [mem 0xe0010000] regsize 1 spacing 4 irq 23 ipmi_si: Adding ACPI-specified kcs state machine IPMI System Interface driver. ipmi_si: Trying ACPI-specified kcs state machine at mem \ address 0xe0010000, slave address 0x0, irq 23 ipmi_si: Could not set up I/O space The problem is that the ACPI core registers disjoint regions for the platform device: e0010000-e0010000 : AMDI0300:00 e0010004-e0010004 : AMDI0300:00 and the ipmi_si driver tries to register one region e0010000-e0010004. Based on a patch from Mark Salter <msalter@redhat.com>, who also wrote all the above text. Signed-off-by: Corey Minyard <cminyard@mvista.com> Tested-by: Mark Salter <msalter@redhat.com>
2016-05-16ipmi: Fix some minor coding style issuesCorey Minyard
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2016-03-18ipmi: do not probe ACPI devices if si_tryacpi is unsetJoe Lawrence
Extend the tryacpi module parameter to turn off acpi_ipmi_probe such that hard-coded options (type, ports, address, etc.) have complete control over the smi_info data structures setup by the driver. Signed-off-by: Joe Lawrence <joe.lawrence@stratus.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2016-03-18ipmi_si: Avoid a wrong long timeout on transaction doneCorey Minyard
Under some circumstances, the IPMI state machine could return a call without delay option but the driver would still do a long delay because the result wasn't checked. Instead of calling the state machine after transaction done, just go back to the top of the processing to start over. Signed-off-by: Corey Minyard <cminyard@mvista.com>
2016-03-18ipmi_si: Fix module parameter doc namesCorey Minyard
Several were tryacpi instead of their actual values. Signed-off-by: Corey Minyard <cminyard@mvista.com>
2016-02-03ipmi: put acpi.h with the other headersTony Camuso
Enclosing '#include <linux/acpi.h>' within '#ifdef CONFIG_ACPI' is unnecessary, since it has its own conditional compile for CONFIG_ACPI. Commit 0fbcf4af7c83 ("ipmi: Convert the IPMI SI ACPI handling to a platform device") exposed this as a problem for platforms that do not support ACPI when it introduced a call to ACPI_PTR() macro outside of the CONFIG_ACPI conditional compile. This would have been perfectly acceptable if acpi.h were not conditionally excluded for the non-acpi platform, because the conditional compile within acpi.h defines ACPI_PTR() to return NULL when compiled for non acpi platforms. Signed-off-by: Tony Camuso <tcamuso@redhat.com> Fixed commit reference in header to conform to standard. Signed-off-by: Corey Minyard <cminyard@mvista.com>
2016-01-12ipmi: Remove unnecessary pci_disable_device.Dave Jones
We call cleanup_one_si from ipmi_pci_remove, which calls ->addr_source_cleanup, which gets set to point to ipmi_pci_cleanup, which does a pci_disable_device. On return from this, we do a second pci_disable_device, which results in the trace below. ipmi_si 0000:00:16.0: disabling already-disabled device Call Trace: [<ffffffff818ce54c>] dump_stack+0x45/0x57 [<ffffffff810525f7>] warn_slowpath_common+0x97/0xe0 [<ffffffff810526f6>] warn_slowpath_fmt+0x46/0x50 [<ffffffff81497ca1>] pci_disable_device+0xb1/0xc0 [<ffffffffa00851a5>] ipmi_pci_remove+0x25/0x30 [ipmi_si] [<ffffffff8149a696>] pci_device_remove+0x46/0xc0 [<ffffffff8156801f>] __device_release_driver+0x7f/0xf0 [<ffffffff81568978>] driver_detach+0xb8/0xc0 [<ffffffff81567e50>] bus_remove_driver+0x50/0xa0 [<ffffffff8156914e>] driver_unregister+0x2e/0x60 [<ffffffff8149a3e5>] pci_unregister_driver+0x25/0x90 [<ffffffffa0085804>] cleanup_ipmi_si+0xd4/0xf0 [ipmi_si] [<ffffffff810c727a>] SyS_delete_module+0x12a/0x200 [<ffffffff818d4d72>] system_call_fastpath+0x12/0x17 Signed-off-by: Dave Jones <dsj@fb.com>
2016-01-12ipmi: constify some struct and char arraysLABBE Corentin
Lots of char arrays could be set as const since they contain only literal char arrays. We could in the same time make const some struct members who are pointer to those const char arrays. Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2015-12-09ipmi: move timer init to before irq is setupJan Stancek
We encountered a panic on boot in ipmi_si on a dell per320 due to an uninitialized timer as follows. static int smi_start_processing(void *send_info, ipmi_smi_t intf) { /* Try to claim any interrupts. */ if (new_smi->irq_setup) new_smi->irq_setup(new_smi); --> IRQ arrives here and irq handler tries to modify uninitialized timer which triggers BUG_ON(!timer->function) in __mod_timer(). Call Trace: <IRQ> [<ffffffffa0532617>] start_new_msg+0x47/0x80 [ipmi_si] [<ffffffffa053269e>] start_check_enables+0x4e/0x60 [ipmi_si] [<ffffffffa0532bd8>] smi_event_handler+0x1e8/0x640 [ipmi_si] [<ffffffff810f5584>] ? __rcu_process_callbacks+0x54/0x350 [<ffffffffa053327c>] si_irq_handler+0x3c/0x60 [ipmi_si] [<ffffffff810efaf0>] handle_IRQ_event+0x60/0x170 [<ffffffff810f245e>] handle_edge_irq+0xde/0x180 [<ffffffff8100fc59>] handle_irq+0x49/0xa0 [<ffffffff8154643c>] do_IRQ+0x6c/0xf0 [<ffffffff8100ba53>] ret_from_intr+0x0/0x11 /* Set up the timer that drives the interface. */ setup_timer(&new_smi->si_timer, smi_timeout, (long)new_smi); The following patch fixes the problem. To: Openipmi-developer@lists.sourceforge.net To: Corey Minyard <minyard@acm.org> CC: linux-kernel@vger.kernel.org Signed-off-by: Jan Stancek <jstancek@redhat.com> Signed-off-by: Tony Camuso <tcamuso@redhat.com> Signed-off-by: Corey Minyard <cminyard@mvista.com> Cc: stable@vger.kernel.org # Applies cleanly to 3.10-, needs small rework before
2015-11-15char: ipmi: Move MODULE_DEVICE_TABLE() to follow structLuis de Bethencourt
The policy for drivers is to have MODULE_DEVICE_TABLE() just after the struct used in it. For clarity. Suggested-by: Corey Minyard <minyard@acm.org> Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2015-11-15ipmi: Stop the timer immediately if idleCorey Minyard
The IPMI driver would let the final timeout just happen, but it could easily just stop the timer. If the timer stop fails that's ok, that should be rare. Signed-off-by: Corey Minyard <cminyard@mvista.com>
2015-11-15ipmi: Start the timer and thread on internal msgsCorey Minyard
The timer and thread were not being started for internal messages, so in interrupt mode if something hung the timer would never go off and clean things up. Factor out the internal message sending and start the timer for those messages, too. Signed-off-by: Corey Minyard <cminyard@mvista.com> Tested-by: Gouji, Masayuki <gouji.masayuki@jp.fujitsu.com> Cc: stable@vger.kernel.org
2015-09-03ipmi: add of_device_id in MODULE_DEVICE_TABLEBrijesh Singh
Fix autoloading ipmi modules when using device tree. Signed-off-by: Brijesh Singh <brijeshkumar.singh@amd.com> Moved this change up into the CONFIG_OF section to account for changes to the probing code. Signed-off-by: Corey Minyard <cminyard@mvista.com>
2015-09-03ipmi: Compensate for BMCs that wont set the irq enable bitCorey Minyard
It appears that some BMCs support interrupts but don't support setting the irq enable bits. The interrupts are just always on. Sigh. Add code to compensate. The new code was very similar to another functions, so this also factors out the common code into other functions. Signed-off-by: Corey Minyard <cminyard@mvista.com> Tested-by: Henrik Korkuc <henrik@kirneh.eu>
2015-09-03ipmi: Don't flush messages in sender() in run-to-completion modeHidehiro Kawai
When flushing queued messages in run-to-completion mode, smi_event_handler() is recursively called. flush_messages() smi_event_handler() handle_transaction_done() deliver_recv_msg() ipmi_smi_msg_received() smi_recv_tasklet() sender() flush_messages() smi_event_handler() ... The depth of the recursive call depends on the number of queued messages, so it can cause a stack overflow if many messages have been queued. To solve this problem, this patch removes flush_messages() from sender()@ipmi_si_intf.c. Instead, add flush_messages() to caller side of sender() if needed. Additionally, to implement this, add new handler flush_messages to struct ipmi_smi_handlers. Signed-off-by: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com> Fixed up a comment and some spacing issues. Signed-off-by: Corey Minyard <cminyard@mvista.com>
2015-09-03ipmi: Factor out message flushing procedureHidehiro Kawai
Factor out message flushing procedure which is used in run-to-completion mode. This patch doesn't change the logic. Signed-off-by: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2015-09-03ipmi: Make some data const that was only readCorey Minyard
Several data structures were only used for reading, so make them const. Signed-off-by: Corey Minyard <cminyard@mvista.com>
2015-09-03ipmi: Delete an unnecessary check before the function call "cleanup_one_si"Markus Elfring
The cleanup_one_si() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2015-09-03char:ipmi - Change 1 to true for bool type variables during initialization.Shailendra Verma
Signed-off-by: Shailendra Verma <shailendra.capricorn@gmail.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2015-09-03ipmi: Convert the IPMI SI ACPI handling to a platform deviceCorey Minyard
The IPMI SI driver was using direct PNP, but that was not really ideal because the IPMI device is a platform device. There was some special handling in the acpi_pnp.c code for making this work, but that was breaking ACPI handling for the IPMI SSIF driver. So without this patch there were significant issues getting the SSIF driver to work with ACPI. So use a platform device for ACPI detection and remove the entry from acpi_pnp.c. Signed-off-by: Corey Minyard <cminyard@mvista.com>
2015-05-05ipmi: Fix a problem that messages are not issued in run_to_completion modeHidehiro Kawai
start_next_msg() issues a message placed in smi_info->waiting_msg if it is non-NULL. However, sender() sets a message to smi_info->curr_msg and NULL to smi_info->waiting_msg in the context of run_to_completion mode. As the result, it leads an infinite loop by waiting the completion of unissued message when leaving dying message after kernel panic. sender() should set the message to smi_info->waiting_msg not curr_msg. Signed-off-by: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2015-05-05ipmi: Report an error if ACPI _IFT doesn't existCorey Minyard
When probing an ACPI table, report a specific error, instead of just returning an error, if _IFT doesn't exist. Signed-off-by: Corey Minyard <cminyard@mvista.com>
2015-05-05ipmi: Don't report err in the SI driver for SSIF devicesCorey Minyard
Really ignore them by returning -ENODEV from the probe, but not doing anything. Signed-off-by: Corey Minyard <cminyard@mvista.com>
2015-05-05ipmi: Remove incorrect use of seq_has_overflowedJoe Perches
commit d6c5dc18d863 ("ipmi: Remove uses of return value of seq_printf") incorrectly changed the return value of various proc_show functions to use seq_has_overflowed(). These functions should return 0 on completion rather than 1/true on overflow. 1 is the same as #define SEQ_SKIP which would cause the output to not be emitted (skipped) instead. This is a logical defect only as the length of these outputs are all smaller than the initial allocation done by the seq filesystem. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2015-04-21Merge tag 'char-misc-4.1-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc Pull char/misc driver updates from Greg KH: "Here's the big char/misc driver patchset for 4.1-rc1. Lots of different driver subsystem updates here, nothing major, full details are in the shortlog. All of this has been in linux-next for a while" * tag 'char-misc-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (133 commits) mei: trace: remove unused TRACE_SYSTEM_STRING DTS: ARM: OMAP3-N900: Add lis3lv02d support Documentation: DT: lis302: update wakeup binding lis3lv02d: DT: add wakeup unit 2 and wakeup threshold lis3lv02d: DT: use s32 to support negative values Drivers: hv: hv_balloon: correctly handle num_pages>INT_MAX case Drivers: hv: hv_balloon: correctly handle val.freeram<num_pages case mei: replace check for connection instead of transitioning mei: use mei_cl_is_connected consistently mei: fix mei_poll operation hv_vmbus: Add gradually increased delay for retries in vmbus_post_msg() Drivers: hv: hv_balloon: survive ballooning request with num_pages=0 Drivers: hv: hv_balloon: eliminate jumps in piecewiese linear floor function Drivers: hv: hv_balloon: do not online pages in offline blocks hv: remove the per-channel workqueue hv: don't schedule new works in vmbus_onoffer()/vmbus_onoffer_rescind() hv: run non-blocking message handlers in the dispatch tasklet coresight: moving to new "hwtracing" directory coresight-tmc: Adding a status interface to sysfs coresight: remove the unnecessary configuration coresight-default-sink ...
2015-04-10ipmi: Handle BMCs that don't allow clearing the rcv irq bitCorey Minyard
Some BMCs don't let you clear the receive irq bit in the global enables. This is kind of silly, but they give an error if you try to clear it. Compensate for this by detecting the situation and working around it. Signed-off-by: Corey Minyard <cminyard@mvista.com> Tested-by: Thomas D <whissi@whissi.de> Reviewed-by: Thomas D <whissi@whissi.de>
2015-03-16char: constify of_device_id arrayFabian Frederick
of_device_id is always used as const. (See driver.of_match_table and open firmware functions) Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-19ipmi: Fix a memory ordering issueCorey Minyard
From a locking point of view it is safe to check waiting_msg without a lock, but there is a memory ordering issue that causes it to possibly not be set right when viewed from another processor. We are already claiming a lock right after that, move the check to inside the lock to enforce the memory ordering. Signed-off-by: Corey Minyard <cminyard@mvista.com>
2015-02-19ipmi: Remove uses of return value of seq_printfJoe Perches
The seq_printf like functions will soon be changed to return void. Convert these uses to check seq_has_overflowed instead. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2015-02-19ipmi: Update timespec usage to timespec64John Stultz
As part of the internal y2038 cleanup, this patch removes timespec usage in the ipmi driver, replacing it timespec64 Cc: openipmi-developer@lists.sourceforge.net Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Corey Minyard <minyard@mvista.com>
2015-02-19ipmi: Cleanup DEBUG_TIMING ifdef usageJohn Stultz
The driver uses #ifdef DEBUG_TIMING in order to conditionally print out timestamped debug messages. Unfortunately it adds the ifdefs all over the usage sites. This patch cleans it up by adding a debug_timestamp() function which is compiled out if DEBUG_TIMING isn't present. This cleans up all the ugly ifdefs in the function logic. Cc: openipmi-developer@lists.sourceforge.net Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Corey Minyard <minyard@mvista.com>
2015-02-19drivers:char:ipmi: Remove unneeded FIXME comment in the file,ipmi_si_intf.cNicholas Krause
Removes a no longer needed FIXME comment in the function,acpi_gpe_irq_setup for the file,ipmi_si_intf.c. This comment is no longer needed as clearly we are passing the correct level of ACPI_GPE_LEVEL_TRIGGERED to the installer function,acpi_install_gpe_handler due to no breakage after years of using this ACPI level in the function,acpi_install_gpe_handler. Signed-off-by: Nicholas Krause <xerofoify@gmail.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
2014-12-14Merge tag 'driver-core-3.19-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core update from Greg KH: "Here's the set of driver core patches for 3.19-rc1. They are dominated by the removal of the .owner field in platform drivers. They touch a lot of files, but they are "simple" changes, just removing a line in a structure. Other than that, a few minor driver core and debugfs changes. There are some ath9k patches coming in through this tree that have been acked by the wireless maintainers as they relied on the debugfs changes. Everything has been in linux-next for a while" * tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits) Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries" fs: debugfs: add forward declaration for struct device type firmware class: Deletion of an unnecessary check before the function call "vunmap" firmware loader: fix hung task warning dump devcoredump: provide a one-way disable function device: Add dev_<level>_once variants ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries ath: use seq_file api for ath9k debugfs files debugfs: add helper function to create device related seq_file drivers/base: cacheinfo: remove noisy error boot message Revert "core: platform: add warning if driver has no owner" drivers: base: support cpu cache information interface to userspace via sysfs drivers: base: add cpu_device_create to support per-cpu devices topology: replace custom attribute macros with standard DEVICE_ATTR* cpumask: factor out show_cpumap into separate helper function driver core: Fix unbalanced device reference in drivers_probe driver core: fix race with userland in device_add() sysfs/kernfs: make read requests on pre-alloc files use the buffer. sysfs/kernfs: allow attributes to request write buffer be pre-allocated. fs: sysfs: return EGBIG on write if offset is larger than file size ...
2014-12-11ipmi: Check the BT interrupt enable periodicallyCorey Minyard
On a reset, the BMC may reset the BT enable in the processor registers (different than the global enables in the BMC). Check it periodically and fix it if necessary. Signed-off-by: Corey Minyard <cminyard@mvista.com> Tested-by: Tony Rex <tony.rex@ericsson.com> Tested-by: Magnus Johansson E <magnus.e.johansson@ericsson.com>
2014-12-11ipmi: Fix attention handling for system interfacesCorey Minyard
If an attention came in while handling a message response, it could cause the state machine to go into the wrong mode and lock things up if the state machine wasn't in normal mode. So if the state machine is not in normal mode, save the attention flag for later. Signed-off-by: Corey Minyard <cminyard@mvista.com> Tested-by: Tony Rex <tony.rex@ericsson.com> Tested-by: Magnus Johansson E <magnus.e.johansson@ericsson.com> Cc: Per Fogelström <per.fogelstrom@ericsson.com>
2014-12-11ipmi: Periodically check to see if irqs and messages are set rightCorey Minyard
The BMC can be reset while we are running; that means the interrupt and event message buffer settings may be wrong. So periodically check to see if these values are correct, and fix them if they are wrong. Signed-off-by: Corey Minyard <cminyard@mvista.com> Tested-by: Tony Rex <tony.rex@ericsson.com> Tested-by: Magnus Johansson E <magnus.e.johansson@ericsson.com>
2014-12-11ipmi: Remove the now unused priority from SMI senderCorey Minyard
Since the queue was moved into the message handler, the priority field is now irrelevant. Signed-off-by: Corey Minyard <cminyard@mvista.com>
2014-12-11ipmi: Remove the now unnecessary message queueCorey Minyard
A message queue was added to the message handler, so the SMI interfaces only need to handle one message at a time. Pull out the message queue. This also leads to some significant simplification in the shutdown of an interface, since the message handler now does a lot of the cleanup. Signed-off-by: Corey Minyard <cminyard@mvista.com>
2014-12-11ipmi: Fix handling of BMC flagsCorey Minyard
The handling of BMC flags wasn't quite right in a few places, mainly around enabling and disabling interrupts in the BMC. Clean up the code and fix the handling of the flags. Signed-off-by: Corey Minyard <cminyard@mvista.com>
2014-12-11ipmi: Fix a bug in hot add/removeCorey Minyard
There was a wrong variable used in the name parsing. Signed-off-by: Corey Minyard <cminyard@mvista.com>
2014-12-11ipmi: Remove useless sysfs_name parametersCorey Minyard
It was always "bmc", so just hardcode it. It makes no sense to pass that in. Signed-off-by: Corey Minyard <cminyard@mvista.com>
2014-12-11ipmi: Move the address source to string to ipmi-generic codeCorey Minyard
It was in the system interface driver, but is generic functionality. Signed-off-by: Corey Minyard <cminyard@mvista.com>
2014-12-11ipmi: Ignore SSIF in the PNP handlingCorey Minyard
Signed-off-by: Corey Minyard <cminyard@mvista.com>
2014-10-20char: ipmi: drop owner assignment from platform_driversWolfram Sang
A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-10-07ipmi: Clear drvdata when interface is removedTakao Indoh
This patch fixes a bug on hotmod removing. After ipmi interface is removed using hotmod, kernel panic occurs when rmmod impi_si. For example, try this: # echo "remove,"`cat /proc/ipmi/0/params` > \ /sys/module/ipmi_si/parameters/hotmod # rmmod ipmi_si Then, rmmod fails with the following messages. ------------[ cut here ]------------ WARNING: CPU: 12 PID: 10819 at /mnt/repos/linux/lib/list_debug.c:53 __list_del_entry+0x63/0xd0() CPU: 12 PID: 10819 Comm: rmmod Not tainted 3.17.0-rc1 #19 Hardware name: FUJITSU-SV PRIMERGY BX920 S2/D3030, BIOS 080015 Rev.3D81.3030 02/10/2012 Call Trace: dump_stack+0x45/0x56 warn_slowpath_common+0x7d/0xa0 warn_slowpath_fmt+0x4c/0x50 __list_del_entry+0x63/0xd0 list_del+0xd/0x30 cleanup_one_si+0x2a/0x230 [ipmi_si] ipmi_pnp_remove+0x15/0x20 [ipmi_si] pnp_device_remove+0x24/0x40 __device_release_driver+0x7f/0xf0 driver_detach+0xb0/0xc0 bus_remove_driver+0x55/0xd0 driver_unregister+0x2c/0x50 pnp_unregister_driver+0x12/0x20 cleanup_ipmi_si+0xbc/0xf0 [ipmi_si] SyS_delete_module+0x132/0x1c0 system_call_fastpath+0x16/0x1b ---[ end trace 70b4377268f85c23 ]--- list_del in cleanup_one_si() fails because the smi_info is already removed when hotmod removing. When ipmi interface is removed by hotmod, smi_info is removed by cleanup_one_si(), but is is still set in drvdata. Therefore when rmmod ipmi_si, ipmi_pnp_remove tries to remove it again and fails. By this patch, a pointer to smi_info in drvdata is cleared when hotmod removing so that it will be not accessed when rmmod. changelog: v2: - Clear drvdata in cleanup_one_si - Change subject v1: https://lkml.org/lkml/2014/9/8/741 Signed-off-by: Takao Indoh <indou.takao@jp.fujitsu.com> Signed-off-by: Corey Minyard <cminyard@mvista.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-10-07ipmi: work around gcc-4.9 build warningArnd Bergmann
Building ipmi on arm with gcc-4.9 results in this warning for an allmodconfig build: drivers/char/ipmi/ipmi_si_intf.c: In function 'ipmi_thread': include/linux/time.h:28:5: warning: 'busy_until.tv_sec' may be used uninitialized in this function [-Wmaybe-uninitialized] if (lhs->tv_sec > rhs->tv_sec) ^ drivers/char/ipmi/ipmi_si_intf.c:1007:18: note: 'busy_until.tv_sec' was declared here struct timespec busy_until; ^ The warning is bogus and this case can not occur. Apparently this is a false positive resulting from gcc getting a little smarter about tracking assignments but not smart enough. Marking the ipmi_thread_busy_wait function as inline gives the gcc optimization logic enough information to figure out for itself that the case cannot happen, which gets rid of the warning without adding any fake initialization. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Corey Minyard <cminyard@mvista.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-10-07ipmi/of: Don't use unavailable interfacesBenjamin Herrenschmidt
If an IPMI controller is used by the firmware and as such marked with a reserved status, we shouldn't use it. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Corey Minyard <cminyard@mvista.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-05-07Merge branch 'sched/urgent' into sched/core, to avoid conflictsIngo Molnar
Signed-off-by: Ingo Molnar <mingo@kernel.org>