summaryrefslogtreecommitdiffstats
path: root/hw/bt.c
Commit message (Collapse)AuthorAgeFilesLines
* hw/bt.c: Timeout messages when bt interface isn't functionalAlistair Popple2015-10-081-9/+17
| | | | | | | | | | | | During system bring up we may not have a properly functioning ipmi interface. This prevents skiboot completing the boot process as it waits for certain bt messages to complete before continuing. This patch alters the bt message timeouts to ensure messages timeout in the case of a non-responsive bt interface. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* hw/bt.c: Check for timeout after checking for message responseAlistair Popple2015-10-071-1/+2
| | | | | | | | | When deciding if a BT message has timed out we should first check for a message response. This will ensure that messages will not time out if there was a delay calling the pollers. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* timer: Pass current timer to timer callbacksBenjamin Herrenschmidt2015-09-111-7/+6
| | | | | | | | | The caller usually has it and it avoids additional mftb() which can be expensive. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> [stewart@linux.vnet.ibm.com: fix run-timer unit test] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* ipmi: Provide a macro for netfn return codeNeelesh Gupta2015-07-101-1/+2
| | | | | | | Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Cc: Alistair Popple <alistair@popple.id.au> Acked-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* bt: Check before dequeuing messages with ipmi_dequeue_msgAlistair Popple2015-07-031-1/+1
| | | | | | | | | | We will soon expose the dequeue message function which deletes previously queued messages from the message queue. It could help catch a few bugs by doing some extra checks. Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* hw/bt.c: Fix trivial typosKamalesh Babulal2015-07-021-3/+3
| | | | | | | | | | | | Fix trivial typos 'messasge' -> 'message' 'resposne' -> 'response' 'intialized' -> 'initialized' One of them, is in the log message. Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Support for Naples LPC serial interruptsBenjamin Herrenschmidt2015-06-191-1/+11
| | | | | | | | | | | | | | | | | | | | | | | This adds support for the HW SerIRQ deserializer of the P8 LPC bridge which is properly wired up on Naples. It also adds support for detecting and reporting LPC error interrupts on all P8s. On most platforms (Rhesus is the exception here due to the way it lets Linux handle the UART interrupts directly), we modify the device-tree to properly represent the LPC controller as a cascaded interrupt-controller and the "interrupts" property of LPC devices to contain the actual LPC interrupt number for the device. We add a mechanism for drivers to register specific LPC interrupts, and a "workaround" for pre-Naples P8 which platforms can use to call all of them for when the external FPGA based deserializer is used. There's also a callback on LPC resets which isn't used yet, we need a bit more work on the general LPC error handling, but it can be done a separate patches. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* hw/bt: Fix bt_msg_del lockingAlistair Popple2015-06-191-1/+5
| | | | | | | | | | bt_msg_del() calls ipmi_cmd_done() to free the message and process any error callbacks. However it should drop the lock prior to calling ipmi_cmd_done() as some error callbacks may try to queue ipmi messages leading to a dead lock. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Merge branch 'stable'Stewart Smith2015-06-181-4/+5
|\
| * hw/bt.c: Fix message response searchAlistair Popple2015-06-181-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bt_get_resp() uses the sequence number to locate the outstanding message by searching the queue with list_for_each(...). The check to see if a message was found in the queue is: if (!bt_msg || (bt_msg->seq != seq)) However this check is incorrect. list_for_each(...) does not set bt_msg to NULL at the end of the loop, nor does it set it to the last element in the list. Rather it ends up pointing at an offset from the list_head. Therefore bt_msg is never equal to NULL and the first half of this condition is always false. However the second condition is almost always true as sequence numbers are constantly increasing and unlikely to match whatever bt_msg->seq ends up pointing to, but in rare circumstances it is possible for bt_msg->seq to equal seq and hence the overall expression can evaluate to false. This leads to bt_msg being used as a valid message pointer even though it points to an incorrect address, typically causing a xstop due to an invalid address access when ipmi_cmd_done(...) attempts to call the callbacks. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | bt: Remove B_BUSY stateAlistair Popple2015-05-131-18/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bt layer used to cache the value of B_BUSY in the state machine, assuming that once B_BUSY was cleared by the BMC that it would never be set by the BMC again unless a message was sent to the bt interface. This was mostly true for the AMI firmware except when the BMC reboots which causes B_BUSY to be set. There may also be additional circumstances which set B_BUSY. Therefore the bt layer must check B_BUSY is clear before sending a message making the B_BUSY state superfluous. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | hw/bt: Add netfn to BT_ERR messageJeremy Kerr2015-05-111-2/+3
|/ | | | | | | | | It's not too useful to print the command without the netfn, so add this into the BT_ERR macro. Reported by: Nick Bofferding <bofferdn@us.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Add xscom_ok() and lpc_ok() to check XSCOM and LPC usabilityBenjamin Herrenschmidt2015-05-011-2/+9
| | | | | | | | | | | | | | | | | | | | | | his primarily checks whether the caller already holds the corresponding locks to avoid re-entrancy in some of the deep error path such as when XSCOM itself triggers an error log. It will be extended in the case of LPC to also handle known HW error states. We use them to avoid queuing/polling in the BT driver and to discard characters in the UART driver. Note: This will not normally involve a loss of log to the UART as the UART driver is also protected by the console suspend mechanism. So this is a safety mechanism only. This fixes issues where the generation of error logs inside the LPC or XSCOM drivers could cause a re-entrancy (via the BT interface) causing deadlocks. Now, the error logs IPMI messages will be queued up and delivered later on the next poll handler. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* bt: Add a temporary workaround for bmc dropping messagesAlistair Popple2015-04-091-8/+26
| | | | | | | | | | | | | | | | There is a bug (most likely on the bmc) that causes some bt messages to be ignored. The message data is still in the bt fifo and the message read pointers still appear to be valid so we can attempt a resend by just setting the appropriate status flag. A single retry seems to fix the problem most of the time, however this should be regarded as a temporary fix. If unlucky we could encounter the same bug resetting the flag so the message could still get dropped. Signed-off-by: Alistair Popple <alistair@popple.id.au> Acked-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* sparse: bt_backend can be staticCédric Le Goater2015-03-051-1/+1
| | | | | Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* bt: Make queue length 10Joel Stanley2015-03-041-2/+2
| | | | | | | | | | | | Now that skiboot supports more IPMI functionality we are queuing more than 5 messages at a time. For example in the astbmc platform.init() adds 6 messages to the queue. Shifting to ten ensures current systems boot without dropping messages, and should give us some breathing room. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* sparse: state_str is unusedCédric Le Goater2015-02-261-6/+0
| | | | | Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* bt: Minor locking fix for bt_get_resp()Alistair Popple2015-02-231-1/+0
| | | | | | | | | bt_get_resp() should return with the bt lock held. Under very rare error conditions bt_get_resp() would drop the lock before returning. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* bt: Improve error messagesAlistair Popple2015-02-231-5/+10
| | | | | | | | | | | | | Most of the error messages in the bt layer don't report enough information to assist with debugging. This patch standardises the information reported when the bt layer encounters an error such as a timeout. It also fixes a problem where expired messages would produce a spurious warning about an incorrect netfn. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* bt: Cleanup bt state machine and fix SMS_ATN bugAlistair Popple2015-02-191-88/+88
| | | | | | | | | | | | | | | Currently the SMS_ATN bit is processed by the bt interrupt handler. This means that on systems without a functional bmc interrupt (such as during early bring up) an SMS_ATN will not be noticed, including the watchdog pre-timeout which results in the wdt expiring. This patch moves the check for SMS_ATN into the main bt polling loop, ensuring it is processed even without functional bmc interrupts. It also cleans up the logic in bt_poll() to make it clearer and reduce the number of lpc register reads. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* ipmi: handle SMS_ATN eventsJeremy Kerr2015-02-091-0/+6
| | | | | | | | | | | | | | When the bt interface sets the SMS_ATN flag, we perform a Get Message Flags to determine what messages are available. The only message type currently processed is the Event Message Buffer, which provides SEL messages for indicating OEM specific events such as graceful system shutdown and PNOR access requested. These events will be handled by the IPMI layer in skiboot. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* ipmi/bt: Enable adding messages to the start of the queueAlistair Popple2014-12-021-5/+23
| | | | | | | | | | By default new ipmi messages are added to the end of the transmission queue. However sometimes it is necessary to add messages to the start of the queue. This patch adds a new ipmi function that adds messages to the start of the transmission queue. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* bt: Use new polling timer interface instead of OPAL pollersBenjamin Herrenschmidt2014-11-121-7/+22
| | | | | | ... which I'm trying to deprecate Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* bt: Reinitialise bt interface correctly after a resetAlistair Popple2014-11-121-6/+6
| | | | | | | Add a call to bt_init_interface() in bt_reset_interface(). This ensures that interrupts are re-enabled after a bt interface reset. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* bt/ipmi: Quieten logging outputAlistair Popple2014-11-121-3/+0
| | | | | | | | | | | | Some tools (eg. ipmitool) that use the Linux ipmi stack send potentially invalid commands to probe functionality. Currently skiboot prints an error to the console whenever this happens resulting in excessive noise when using the Linux ipmi stack. This patch just removes and/or lowers the logging level of these errors. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* bt: Fix message timeoutsAlistair Popple2014-11-121-7/+14
| | | | | | | | | | | | | The initial timeout scheme started a message timeout when it was added to the queue rather than when transmission was started. To avoid timing out messages that just got stuck behind a couple of slow ones we should instead just check that the active message has not timed out. This patch ensures timeout values are only checked for the currently active message. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* bt: Add locking for bt hardware pollingAlistair Popple2014-11-121-34/+40
| | | | | | | | | | | This patch adds some locking to the polling of the bt hardware/state. Prior to having proper interrupts and events working this was not so critical as we would only ever have one call to bt_poll running at a time. However functioning interrupts mean we can have multiple calls to bt_poll so we need to add some locking to ensure consistency between the state machine and the hardware. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* bt: Add call to bt_poll to kick start message state machineAlistair Popple2014-11-121-22/+24
| | | | | | | | | | | | | | | The bt interface relies on a fairly simple state machine to send messages to the bmc. Messages are added to a queue for sending and something calls the state machine to start sending messages, usually via opal_poll_events. However under some circumstances this doesn't happen so we need to crank the state machine to start start sending messages. This patch adds a call to bt_poll to make sure we start sending a message which should ensure the bmc generates an irq once the message is sent to continue processing. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* ipmi: Add an opal interface to the ipmi stackAlistair Popple2014-10-301-8/+28
| | | | | | | | | This patch adds two opal calls (opal_ipmi_send and opal_ipmi_recv) to allow an operating system to send and receive arbitrary ipmi messages to the BMC. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* ipmi/bt: Rework iBT register accessBenjamin Herrenschmidt2014-10-051-33/+54
| | | | | | | | | | | | | The bits in the control register are mostly write-1-to-clear, so the rmw sequences in bt_setmask() and bt_clearmask() don't work. Additionally, H_BUSY is weird as it's a write-1-to-toggle, so let's write a "safe" function that sets it to the desired state based on its previous state. (We can optimize that further later). Also enable interrupt operations. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* bt: Add message timeoutAlistair Popple2014-10-011-5/+35
| | | | | | | | | This patch adds message timeouts to the bt layer. When a response to a message is not recieved within a given time we call the error callback with a completion code indicating a timeout. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* bt: Limit the outstanding message queue lengthAlistair Popple2014-10-011-0/+21
| | | | | | | | | | This patch ensures that the number of outstanding messages in the bt interface queue can not grow unchecked. If adding a message to the queue causes it to exceed the maximum size we remove the oldest message from the queue. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* ipmi/bt: Improve message validation and allow out-of-order command responsesAlistair Popple2014-10-011-27/+32
| | | | | | | | | | This patch adds validation of the ipmi cmd and netfn numbers returned by the bmc. It also ensures the sequence number is correct by searching the outstanding message queue for the corresponding sequence number. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* bt/ipmi: Convert to using asynchronous messagingAlistair Popple2014-10-011-60/+19
| | | | | | | | | | | Previously we were doing synchronous messaging and cranking the bt state machine from within OPAL. This was not ideal as it could potentially take control away from the OS for long periods of time if the BMC is busy. This patch solves the problem using the opal_poll api to do asynchronous messaging. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* ipmi: Refactored ipmi layer to use generic backendAlistair Popple2014-10-011-20/+28
| | | | | | | | | | | | The initial implementation of the ipmi stack was still tightly coupled with the backend (in this case bt). This patch refactors the ipmi code to use a generic backend device. The core ipmi messaging functionality and the implementation of specific commands has also been split into different files. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* bt/ipmi: Fixup allocation of bt/ipmi messagesAlistair Popple2014-10-011-24/+42
| | | | | | | | | | | The original implementation of the bt and ipmi layers required the bt, ipmi and message data to be allocated separately. This is sub-optimal as it could cause excessive memory fragmentation. This patch fixes the problem by adding a function to the bt layer to allocate space for both the required data and bt/ipmi message. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* ipmi/bt: Fixup BT device tree propertyAlistair Popple2014-08-141-1/+1
| | | | | | | | | | It seems that when we commited the IPMI/BT driver we updated the device tree compatible property for the iBT interface. Unfortunately Palmetto still requires a DT fixup for this node and somewhere along the way there was a typo. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* ipmi: Add a base IPMI stack with a BT driverAlistair Popple2014-08-131-0/+400
This patch adds a basic IPMI layer to the sapphire core and support for a BT IPMI interface as found on the Aspeed BMC of the Palmetto platform [ Changed the compatible property -- BenH ] Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
OpenPOWER on IntegriCloud