As, I'm so glad I have IPMI working in qemu and can simulate these things.
Can you try the attached patch?
-corey
On 04/03/2015 10:33 AM, Corey Minyard wrote:
> I finally got a little time to look at this. I think I know what is
> going on. The IPMI driver is trying to disable the interrupt bit in the
> BMC, since the device doesn't support interrupts (at least according to
> ACPI) and it's a bad idea to have a device trying to send interrupts in
> that situation. That's done by clearing bit 0 in the global enables.
>
> The IPMI spec, however, has a vague statement that a BMC may elect to
> always have interrupts always enabled. It looks like that vendor
> interpreted that statement to mean to give an error if you try to clear
> that bit and the BMC has interrupts always enabled. This is bad because:
>
> 1. The device doesn't support interrupts, anyway. I could understand
> if it didn't want to enable the bit, but not wanting to clear it?
> 2. It's very hard to write software to properly handle some error
> situations if you can't disable the interrupts. I mean, how hard
> could disabling interrupts be?
>
> I'll try to figure something out.
>
> -corey
>
>
> On 03/25/2015 08:39 PM, Thomas D. wrote:
>> Hi,
>>
>> seems like I have the same board like Arne:
>>
>> # ipmitool mc info
>> Device ID : 32
>> Device Revision : 1
>> Firmware Revision : 1.76
>> IPMI Version : 2.0
>> Manufacturer ID : 10876
>> Manufacturer Name : Supermicro
>> Product ID : 2067 (0x0813)
>> Product Name : Unknown (0x813)
>> Device Available : yes
>> Provides Device SDRs : no
>> Additional Device Support :
>> Sensor Device
>> SDR Repository Device
>> SEL Device
>> FRU Inventory Device
>> IPMB Event Receiver
>> IPMB Event Generator
>> Chassis Device
>>
>> (Supermicro A1SRi-2758F in my case)
>>
>> Also linux-3.19.2. Here's my full log:
>>
>> [21396.783764] IPMI System Interface driver.
>> [21396.783813] ipmi_si: probing via ACPI
>> [21396.783865] ipmi_si 00:06: [io 0x0ca2] regsize 1 spacing 1 irq 0
>> [21396.783869] ipmi_si: Adding ACPI-specified kcs state machine
>> [21396.783888] ipmi_si: probing via SMBIOS
>> [21396.783892] ipmi_si: SMBIOS: io 0xca2 regsize 1 spacing 1 irq 0
>> [21396.783894] ipmi_si: Adding SMBIOS-specified kcs state machine duplicate
>> interface
>> [21396.783897] ipmi_si: probing via SPMI
>> [21396.783900] ipmi_si: SPMI: io 0xca2 regsize 1 spacing 1 irq 0
>> [21396.783902] ipmi_si: Adding SPMI-specified kcs state machine duplicate
>> interface
>> [21396.783905] ipmi_si: Trying ACPI-specified kcs state machine at i/o
>> address 0xca2, slave address 0x0, irq 0
>> [21397.058339] ipmi_si 00:06: Found new BMC (man_id: 0x002a7c, prod_id:
>> 0x0813, dev_id: 0x20)
>> [21397.058456] ipmi_si 00:06: IPMI kcs interface initialized
>> [21397.064319] start_kcs_transaction - 18 01
>> [21397.064696] start_kcs_transaction - b0 00 00
>> [21397.065442] start_kcs_transaction - 18 01
>> [21397.065714] start_kcs_transaction - 28 20
>> [21397.065991] start_kcs_transaction - 28 22
>> [21397.066792] start_kcs_transaction - 28 23 06 00 00 00 00 05
>> [21397.067302] start_kcs_transaction - 28 23 06 00 00 00 05 21
>> [21397.067982] start_kcs_transaction - 28 23 06 00 00 00 26 12
>> [21397.068531] start_kcs_transaction - 28 23 06 00 47 00 00 05
>> [21397.068940] start_kcs_transaction - 28 23 06 00 47 00 05 21
>> [21397.069582] start_kcs_transaction - 28 23 06 00 47 00 26 15
>> [21397.070127] start_kcs_transaction - 28 23 06 00 8a 00 00 05
>> [21397.070547] start_kcs_transaction - 28 23 06 00 8a 00 05 21
>> [21397.071190] start_kcs_transaction - 28 23 06 00 8a 00 26 19
>> [21397.071767] start_kcs_transaction - 28 23 06 00 cd 00 00 05
>> [21397.072192] start_kcs_transaction - 28 23 06 00 cd 00 05 21
>> [21397.072820] start_kcs_transaction - 28 23 06 00 cd 00 26 15
>> [21397.073468] start_kcs_transaction - 28 23 06 00 10 01 00 05
>> [21397.074691] start_kcs_transaction - 28 23 06 00 10 01 05 21
>> [21397.075408] start_kcs_transaction - 28 23 06 00 10 01 26 15
>> [21397.075975] start_kcs_transaction - 28 23 06 00 53 01 00 05
>> [21397.076393] start_kcs_transaction - 28 23 06 00 53 01 05 21
>> [21397.077038] start_kcs_transaction - 28 23 06 00 53 01 26 15
>> [21397.077582] start_kcs_transaction - 28 23 06 00 96 01 00 05
>> [21397.078005] start_kcs_transaction - 28 23 06 00 96 01 05 21
>> [21397.078642] start_kcs_transaction - 28 23 06 00 96 01 26 15
>> [21397.079196] start_kcs_transaction - 28 23 06 00 d9 01 00 05
>> [21397.079589] start_kcs_transaction - 28 23 06 00 d9 01 05 21
>> [21397.080267] start_kcs_transaction - 28 23 06 00 d9 01 26 0e
>> [21397.080789] start_kcs_transaction - 28 23 06 00 1c 02 00 05
>> [21397.081209] start_kcs_transaction - 28 23 06 00 1c 02 05 21
>> [21397.081847] start_kcs_transaction - 28 23 06 00 1c 02 26 0e
>> [21397.082332] start_kcs_transaction - 28 23 06 00 5f 02 00 05
>> [21397.082744] start_kcs_transaction - 28 23 06 00 5f 02 05 21
>> [21397.084297] start_kcs_transaction - 28 23 06 00 5f 02 26 0e
>> [21397.085003] start_kcs_transaction - 28 23 06 00 a2 02 00 05
>> [21397.085583] start_kcs_transaction - 28 23 06 00 a2 02 05 21
>> [21397.086433] start_kcs_transaction - 28 23 06 00 a2 02 26 0e
>> [21397.087094] start_kcs_transaction - 28 23 06 00 e5 02 00 05
>> [21397.087717] start_kcs_transaction - 28 23 06 00 e5 02 05 21
>> [21397.088545] start_kcs_transaction - 28 23 06 00 e5 02 26 0f
>> [21397.089227] start_kcs_transaction - 28 23 06 00 28 03 00 05
>> [21397.089817] start_kcs_transaction - 28 23 06 00 28 03 05 21
>> [21397.090676] start_kcs_transaction - 28 23 06 00 28 03 26 0d
>> [21397.091317] start_kcs_transaction - 28 23 06 00 6b 03 00 05
>> [21397.091951] start_kcs_transaction - 28 23 06 00 6b 03 05 21
>> [21397.092750] start_kcs_transaction - 28 23 06 00 6b 03 26 0e
>> [21397.094364] start_kcs_transaction - 28 23 06 00 ae 03 00 05
>> [21397.094963] start_kcs_transaction - 28 23 06 00 ae 03 05 21
>> [21397.095797] start_kcs_transaction - 28 23 06 00 ae 03 26 10
>> [21397.096415] start_kcs_transaction - 28 23 06 00 f1 03 00 05
>> [21397.097040] start_kcs_transaction - 28 23 06 00 f1 03 05 21
>> [21397.097845] start_kcs_transaction - 28 23 06 00 f1 03 26 0e
>> [21397.098553] start_kcs_transaction - 28 23 06 00 34 04 00 05
>> [21397.099136] start_kcs_transaction - 28 23 06 00 34 04 05 21
>> [21397.099975] start_kcs_transaction - 28 23 06 00 34 04 26 11
>> [21397.100651] start_kcs_transaction - 28 23 06 00 77 04 00 05
>> [21397.101283] start_kcs_transaction - 28 23 06 00 77 04 05 21
>> [21397.102099] start_kcs_transaction - 28 23 06 00 77 04 26 12
>> [21397.102825] start_kcs_transaction - 28 23 06 00 ba 04 00 05
>> [21397.103476] start_kcs_transaction - 28 23 06 00 ba 04 05 21
>> [21397.104908] start_kcs_transaction - 28 23 06 00 ba 04 26 17
>> [21397.105697] start_kcs_transaction - 28 23 06 00 fd 04 00 05
>> [21397.106287] start_kcs_transaction - 28 23 06 00 fd 04 05 12
>> [21397.107012] start_kcs_transaction - 28 23 06 00 40 05 00 05
>> [21397.107594] start_kcs_transaction - 28 23 06 00 40 05 05 13
>> [21397.108327] start_kcs_transaction - 18 2f
>> [21397.108658] start_kcs_transaction - 18 2e 0d
>> [21398.105616] start_kcs_transaction - 18 2f
>> [21398.105875] start_kcs_transaction - 18 2e 0c
>> [21398.106035] ipmi_si 00:06: Could not set the global enables: 0xcc.
>> [21398.106038] start_kcs_transaction - 18 33
>> [21399.106407] start_kcs_transaction - 18 2f
>> [21399.106657] start_kcs_transaction - 18 2e 0c
>> [21399.106812] ipmi_si 00:06: Could not set the global enables: 0xcc.
>> [21399.106814] start_kcs_transaction - 18 33
>> [21400.107202] start_kcs_transaction - 18 2f
>> [21400.107431] start_kcs_transaction - 18 2e 0c
>> [21400.107592] ipmi_si 00:06: Could not set the global enables: 0xcc.
>>
>> I hope this will help...
>>
>> Please CC me, I am not subscried to this list.
>>
>> Thanks!
>>
>>
>> -Thomas
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Dive into the World of Parallel Programming The Go Parallel Website,
>> sponsored
>> by Intel and developed in partnership with Slashdot Media, is your hub for
>> all
>> things parallel software development, from weekly thought leadership blogs to
>> news, videos, case studies, tutorials and more. Take a look and join the
>> conversation now. http://goparallel.sourceforge.net/
>> _______________________________________________
>> Openipmi-developer mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/openipmi-developer
>From a56d6e31f092b6aff0dc2800cce5048a9f5d1407 Mon Sep 17 00:00:00 2001
From: Corey Minyard <[email protected]>
Date: Fri, 3 Apr 2015 12:13:48 -0500
Subject: [PATCH] ipmi: Handle BMCs that don't allow clearing the rcv irq bit
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 <[email protected]>
---
drivers/char/ipmi/ipmi_si_intf.c | 109 ++++++++++++++++++++++++++++++++++++---
1 file changed, 102 insertions(+), 7 deletions(-)
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 003b4c1..4a4c816 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -263,6 +263,11 @@ struct smi_info {
bool supports_event_msg_buff;
/*
+ * Can we clear the global enables receive irq bit?
+ */
+
+ bool cannot_clear_recv_irq_bit;
+ /*
* Did we get an attention that we did not handle?
*/
bool got_attn;
@@ -461,6 +466,9 @@ static void smi_mod_timer(struct smi_info *smi_info, unsigned long new_val)
* allocate messages, we just leave them in the BMC and run the system
* polled until we can allocate some memory. Once we have some
* memory, we will re-enable the interrupt.
+ *
+ * Note that we cannot just use disable_irq(), since the interrupt may
+ * be shared.
*/
static inline bool disable_si_irq(struct smi_info *smi_info)
{
@@ -549,20 +557,15 @@ static u8 current_global_enables(struct smi_info *smi_info, u8 base,
if (smi_info->supports_event_msg_buff)
enables |= IPMI_BMC_EVT_MSG_BUFF;
- else
- enables &= ~IPMI_BMC_EVT_MSG_BUFF;
- if (smi_info->irq && !smi_info->interrupt_disabled)
+ if ((smi_info->irq && !smi_info->interrupt_disabled) ||
+ smi_info->cannot_clear_recv_irq_bit)
enables |= IPMI_BMC_RCV_MSG_INTR;
- else
- enables &= ~IPMI_BMC_RCV_MSG_INTR;
if (smi_info->supports_event_msg_buff &&
smi_info->irq && !smi_info->interrupt_disabled)
enables |= IPMI_BMC_EVT_MSG_INTR;
- else
- enables &= ~IPMI_BMC_EVT_MSG_INTR;
*irq_on = enables & (IPMI_BMC_EVT_MSG_INTR | IPMI_BMC_RCV_MSG_INTR);
@@ -2900,6 +2903,96 @@ static int try_get_dev_id(struct smi_info *smi_info)
return rv;
}
+/*
+ * Some BMCs do not support clearing the receive irq bit in the global
+ * enables (even if they don't support interrupts on the BMC). Check
+ * for this and handle it properly.
+ */
+static void check_clr_rcv_irq(struct smi_info *smi_info)
+{
+ unsigned char msg[3];
+ unsigned char *resp;
+ unsigned long resp_len;
+ int rv;
+
+ resp = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL);
+ if (!resp) {
+ printk(KERN_WARNING PFX "Out of memory allocating response for"
+ " global enables command, cannot check recv irq bit"
+ " handling.\n");
+ return;
+ }
+
+ msg[0] = IPMI_NETFN_APP_REQUEST << 2;
+ msg[1] = IPMI_GET_BMC_GLOBAL_ENABLES_CMD;
+ smi_info->handlers->start_transaction(smi_info->si_sm, msg, 2);
+
+ rv = wait_for_msg_done(smi_info);
+ if (rv) {
+ printk(KERN_WARNING PFX "Error getting response from get"
+ " global enables command, cannot check recv irq bit"
+ " handling.\n");
+ goto out;
+ }
+
+ resp_len = smi_info->handlers->get_result(smi_info->si_sm,
+ resp, IPMI_MAX_MSG_LENGTH);
+
+ if (resp_len < 4 ||
+ resp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 ||
+ resp[1] != IPMI_GET_BMC_GLOBAL_ENABLES_CMD ||
+ resp[2] != 0) {
+ printk(KERN_WARNING PFX "Invalid return from get global"
+ " enables command, cannot check recv irq bit"
+ " handling.\n");
+ rv = -EINVAL;
+ goto out;
+ }
+
+ if ((resp[3] & IPMI_BMC_RCV_MSG_INTR) == 0)
+ /* Already clear, should work ok. */
+ goto out;
+
+ msg[0] = IPMI_NETFN_APP_REQUEST << 2;
+ msg[1] = IPMI_SET_BMC_GLOBAL_ENABLES_CMD;
+ msg[2] = resp[3] & ~IPMI_BMC_RCV_MSG_INTR;
+ smi_info->handlers->start_transaction(smi_info->si_sm, msg, 3);
+
+ rv = wait_for_msg_done(smi_info);
+ if (rv) {
+ printk(KERN_WARNING PFX "Error getting response from set"
+ " global, enables command, cannot check recv irq bit"
+ " handling.\n");
+ goto out;
+ }
+
+ resp_len = smi_info->handlers->get_result(smi_info->si_sm,
+ resp, IPMI_MAX_MSG_LENGTH);
+
+ if (resp_len < 3 ||
+ resp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 ||
+ resp[1] != IPMI_SET_BMC_GLOBAL_ENABLES_CMD) {
+ printk(KERN_WARNING PFX "Invalid return from get global,"
+ "enables command, cannot check recv irq bit"
+ " handling.\n");
+ rv = -EINVAL;
+ goto out;
+ }
+
+ if (resp[2] != 0) {
+ /*
+ * An error when setting the event buffer bit means
+ * clearing the bit is not supported.
+ */
+ printk(KERN_WARNING PFX "The BMC does not support clearing,"
+ "the recv irq bit, compensating, but the BMC needs to"
+ " be fixed.\n");
+ smi_info->cannot_clear_recv_irq_bit = true;
+ }
+ out:
+ kfree(resp);
+}
+
static int try_enable_event_buffer(struct smi_info *smi_info)
{
unsigned char msg[3];
@@ -3395,6 +3488,8 @@ static int try_smi_init(struct smi_info *new_smi)
goto out_err;
}
+ check_clr_rcv_irq(new_smi);
+
setup_oem_data_handler(new_smi);
setup_xaction_handlers(new_smi);
--
1.8.3.1
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Openipmi-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openipmi-developer