Skip to contentSkip to conversation

ipmi: bmc-sim improvements

PATCH In review Nicholas Piggin 3 participants 11 messages Apr 1, 2025 – Apr 12, 2025

lore
Share & tools
lore
#0 lore raw

v3 cover ipmi: bmc-sim improvements

These little things came up when looking at behaviour of IPMI with the bmc-sim implementation running the ppc powernv machine, and trying to clean up error messages and missing features.

Since v1 (thanks to Corey for review and suggestions):
- Added fwinfo to PCI devices
- Report interrupt number in Get Channel Info for ISA, PCI, and unknown/unassigned.
- Fix error reporting for Get Channel Info unsupported channels. Verify it is the correct error code that ipmitool looks for
https://github.com/ipmitool/ipmitool/blob/master/lib/ipmi_channel.c#L256C16-L256C45
- Change _CH_ to _CHANNEL_ in some defines names.
- Also avoid adding event logs with watchdog don't log flag.

Since v2:
- Don't log watchog flag should not apply to watchdog expiry field.
- Moved protocol type field from class to IPMIFwInfo.
- Rename new FwInfo member irq to irq_source.
- Add comments about handling PCI devices to existing callers of ->fwinfo

Thanks,
Nick

Nicholas Piggin (5):
ipmi/pci-ipmi-bt: Rename copy-paste variables
ipmi: add fwinfo to pci ipmi devices
ipmi/bmc-sim: Add 'Get Channel Info' command
ipmi/bmc-sim: implement watchdog dont log flag ipmi/bmc-sim: add error handling for 'Set BMC Global Enables' command

 include/hw/ipmi/ipmi.h     |  15 ++++++
 hw/acpi/ipmi.c             |   3 +-
 hw/ipmi/ipmi_bmc_sim.c     | 104 ++++++++++++++++++++++++++++++++-----
 hw/ipmi/ipmi_bt.c          |   2 +
 hw/ipmi/ipmi_kcs.c         |   1 +
 hw/ipmi/isa_ipmi_bt.c      |   1 +
 hw/ipmi/isa_ipmi_kcs.c     |   1 +
 hw/ipmi/pci_ipmi_bt.c      |  50 +++++++++++-------
 hw/ipmi/pci_ipmi_kcs.c     |  11 ++++
 hw/smbios/smbios_type_38.c |   7 ++-
 10 files changed, 162 insertions(+), 33 deletions(-)
Signature · 1 line
2.47.1
#1 lore raw

PATCH v3 1/5 ipmi/pci-ipmi-bt: Rename copy-paste variables

IPMI drivers use p/k suffix in variable names depending on bt or kcs. The pci bt driver must have come from the kcs driver because it's still using k suffixes in some cases. Rename.

---
 hw/ipmi/pci_ipmi_bt.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)
hw/ipmi/pci_ipmi_bt.c +19 -19
index afeea6f3031..a3b742d22c9 100644
@@ -38,49 +38,49 @@ struct PCIIPMIBTDevice {
     uint32_t uuid;
 };
 
-static void pci_ipmi_raise_irq(IPMIBT *ik)
+static void pci_ipmi_raise_irq(IPMIBT *ib)
 {
-    PCIIPMIBTDevice *pik = ik->opaque;
+    PCIIPMIBTDevice *pib = ib->opaque;
 
-    pci_set_irq(&pik->dev, true);
+    pci_set_irq(&pib->dev, true);
 }
 
-static void pci_ipmi_lower_irq(IPMIBT *ik)
+static void pci_ipmi_lower_irq(IPMIBT *ib)
 {
-    PCIIPMIBTDevice *pik = ik->opaque;
+    PCIIPMIBTDevice *pib = ib->opaque;
 
-    pci_set_irq(&pik->dev, false);
+    pci_set_irq(&pib->dev, false);
 }
 
 static void pci_ipmi_bt_realize(PCIDevice *pd, Error **errp)
 {
     Error *err = NULL;
-    PCIIPMIBTDevice *pik = PCI_IPMI_BT(pd);
+    PCIIPMIBTDevice *pib = PCI_IPMI_BT(pd);
     IPMIInterface *ii = IPMI_INTERFACE(pd);
     IPMIInterfaceClass *iic = IPMI_INTERFACE_GET_CLASS(ii);
 
-    if (!pik->bt.bmc) {
+    if (!pib->bt.bmc) {
         error_setg(errp, "IPMI device requires a bmc attribute to be set");
         return;
     }
 
-    pik->uuid = ipmi_next_uuid();
+    pib->uuid = ipmi_next_uuid();
 
-    pik->bt.bmc->intf = ii;
-    pik->bt.opaque = pik;
+    pib->bt.bmc->intf = ii;
+    pib->bt.opaque = pib;
 
     pci_config_set_prog_interface(pd->config, 0x02); /* BT */
     pci_config_set_interrupt_pin(pd->config, 0x01);
-    pik->bt.use_irq = 1;
-    pik->bt.raise_irq = pci_ipmi_raise_irq;
-    pik->bt.lower_irq = pci_ipmi_lower_irq;
+    pib->bt.use_irq = 1;
+    pib->bt.raise_irq = pci_ipmi_raise_irq;
+    pib->bt.lower_irq = pci_ipmi_lower_irq;
 
     iic->init(ii, 8, &err);
     if (err) {
         error_propagate(errp, err);
         return;
     }
-    pci_register_bar(pd, 0, PCI_BASE_ADDRESS_SPACE_IO, &pik->bt.io);
+    pci_register_bar(pd, 0, PCI_BASE_ADDRESS_SPACE_IO, &pib->bt.io);
 }
 
 const VMStateDescription vmstate_PCIIPMIBTDevice = {
@@ -96,16 +96,16 @@ const VMStateDescription vmstate_PCIIPMIBTDevice = {
 
 static void pci_ipmi_bt_instance_init(Object *obj)
 {
-    PCIIPMIBTDevice *pik = PCI_IPMI_BT(obj);
+    PCIIPMIBTDevice *pib = PCI_IPMI_BT(obj);
 
-    ipmi_bmc_find_and_link(obj, (Object **) &pik->bt.bmc);
+    ipmi_bmc_find_and_link(obj, (Object **) &pib->bt.bmc);
 }
 
 static void *pci_ipmi_bt_get_backend_data(IPMIInterface *ii)
 {
-    PCIIPMIBTDevice *pik = PCI_IPMI_BT(ii);
+    PCIIPMIBTDevice *pib = PCI_IPMI_BT(ii);
 
-    return &pik->bt;
+    return &pib->bt;
 }
 
 static void pci_ipmi_bt_class_init(ObjectClass *oc, void *data)
Signature · 1 line
2.47.1
#2 lore raw

PATCH v3 2/5 ipmi: add fwinfo to pci ipmi devices

In reply to Nicholas Piggin

This requires some adjustments to callers to avoid possible behaviour changes for PCI devices.

---
 include/hw/ipmi/ipmi.h     |  5 +++++
 hw/acpi/ipmi.c             |  3 ++-
 hw/ipmi/isa_ipmi_bt.c      |  1 +
 hw/ipmi/isa_ipmi_kcs.c     |  1 +
 hw/ipmi/pci_ipmi_bt.c      | 12 ++++++++++++
 hw/ipmi/pci_ipmi_kcs.c     | 11 +++++++++++
 hw/smbios/smbios_type_38.c |  7 ++++++-
 7 files changed, 38 insertions(+), 2 deletions(-)
include/hw/ipmi/ipmi.h +5 -0
index 77a7213ed93..c8ef04856e1 100644
@@ -90,6 +90,11 @@ typedef struct IPMIFwInfo {
     } memspace;
 
     int interrupt_number;
+    enum {
+        IPMI_NO_IRQ = 0,
+        IPMI_ISA_IRQ,
+        IPMI_PCI_IRQ,
+    } irq_source;
     enum {
         IPMI_LEVEL_IRQ,
         IPMI_EDGE_IRQ
hw/acpi/ipmi.c +2 -1
index a20e57d465c..39f8f2f6d68 100644
@@ -55,7 +55,8 @@ static Aml *aml_ipmi_crs(IPMIFwInfo *info)
         abort();
     }
 
-    if (info->interrupt_number) {
+    /* Should PCI interrupts also be appended? */
+    if (info->irq_source == IPMI_ISA_IRQ && info->interrupt_number) {
         aml_append(crs, aml_irq_no_flags(info->interrupt_number));
     }
 
hw/ipmi/isa_ipmi_bt.c +1 -0
index a1b66d5ee82..4a6496b5980 100644
@@ -49,6 +49,7 @@ static void isa_ipmi_bt_get_fwinfo(struct IPMIInterface *ii, IPMIFwInfo *info)
     ISAIPMIBTDevice *iib = ISA_IPMI_BT(ii);
 
     ipmi_bt_get_fwinfo(&iib->bt, info);
+    info->irq_source = IPMI_ISA_IRQ;
     info->interrupt_number = iib->isairq;
     info->i2c_slave_address = iib->bt.bmc->slave_addr;
     info->uuid = iib->uuid;
hw/ipmi/isa_ipmi_kcs.c +1 -0
index d9ebdd5371f..31d16aba74e 100644
@@ -49,6 +49,7 @@ static void isa_ipmi_kcs_get_fwinfo(IPMIInterface *ii, IPMIFwInfo *info)
     ISAIPMIKCSDevice *iik = ISA_IPMI_KCS(ii);
 
     ipmi_kcs_get_fwinfo(&iik->kcs, info);
+    info->irq_source = IPMI_ISA_IRQ;
     info->interrupt_number = iik->isairq;
     info->uuid = iik->uuid;
 }
hw/ipmi/pci_ipmi_bt.c +12 -0
index a3b742d22c9..7ba8b3ab965 100644
@@ -38,6 +38,17 @@ struct PCIIPMIBTDevice {
     uint32_t uuid;
 };
 
+static void pci_ipmi_bt_get_fwinfo(struct IPMIInterface *ii, IPMIFwInfo *info)
+{
+    PCIIPMIBTDevice *pib = PCI_IPMI_BT(ii);
+
+    ipmi_bt_get_fwinfo(&pib->bt, info);
+    info->irq_source = IPMI_PCI_IRQ;
+    info->interrupt_number = pci_intx(&pib->dev);
+    info->i2c_slave_address = pib->bt.bmc->slave_addr;
+    info->uuid = pib->uuid;
+}
+
 static void pci_ipmi_raise_irq(IPMIBT *ib)
 {
     PCIIPMIBTDevice *pib = ib->opaque;
@@ -125,6 +136,7 @@ static void pci_ipmi_bt_class_init(ObjectClass *oc, void *data)
 
     iic->get_backend_data = pci_ipmi_bt_get_backend_data;
     ipmi_bt_class_init(iic);
+    iic->get_fwinfo = pci_ipmi_bt_get_fwinfo;
 }
 
 static const TypeInfo pci_ipmi_bt_info = {
hw/ipmi/pci_ipmi_kcs.c +11 -0
index 05ba97ec58f..c817f1e8808 100644
@@ -38,6 +38,16 @@ struct PCIIPMIKCSDevice {
     uint32_t uuid;
 };
 
+static void pci_ipmi_bt_get_fwinfo(struct IPMIInterface *ii, IPMIFwInfo *info)
+{
+    PCIIPMIKCSDevice *pik = PCI_IPMI_KCS(ii);
+
+    ipmi_kcs_get_fwinfo(&pik->kcs, info);
+    info->irq_source = IPMI_PCI_IRQ;
+    info->interrupt_number = pci_intx(&pik->dev);
+    info->uuid = pik->uuid;
+}
+
 static void pci_ipmi_raise_irq(IPMIKCS *ik)
 {
     PCIIPMIKCSDevice *pik = ik->opaque;
@@ -125,6 +135,7 @@ static void pci_ipmi_kcs_class_init(ObjectClass *oc, void *data)
 
     iic->get_backend_data = pci_ipmi_kcs_get_backend_data;
     ipmi_kcs_class_init(iic);
+    iic->get_fwinfo = pci_ipmi_kcs_get_fwinfo;
 }
 
 static const TypeInfo pci_ipmi_kcs_info = {
hw/smbios/smbios_type_38.c +6 -1
index 168b886647d..e9b856fcd96 100644
@@ -72,7 +72,12 @@ static void smbios_build_one_type_38(IPMIFwInfo *info)
                      " SMBIOS, ignoring this entry.", info->register_spacing);
         return;
     }
-    t->interrupt_number = info->interrupt_number;
+    if (info->irq_source == IPMI_ISA_IRQ) {
+        t->interrupt_number = info->interrupt_number;
+    } else {
+        /* TODO: How to handle PCI? */
+        t->interrupt_number = 0;
+    }
 
     SMBIOS_BUILD_TABLE_POST;
 }
Signature · 1 line
2.47.1
Reviewed-by on v3 2/5
#3 lore raw

Re: [PATCH v3 2/5] ipmi: add fwinfo to pci ipmi devices

Quoted 4 lines · Nicholas Piggin

This requires some adjustments to callers to avoid possible behaviour changes for PCI devices.

Quoted 9 lines
---
  include/hw/ipmi/ipmi.h     |  5 +++++
  hw/acpi/ipmi.c             |  3 ++-
  hw/ipmi/isa_ipmi_bt.c      |  1 +
  hw/ipmi/isa_ipmi_kcs.c     |  1 +
  hw/ipmi/pci_ipmi_bt.c      | 12 ++++++++++++
  hw/ipmi/pci_ipmi_kcs.c     | 11 +++++++++++
  hw/smbios/smbios_type_38.c |  7 ++++++-
  7 files changed, 38 insertions(+), 2 deletions(-)
#4 lore raw

PATCH v3 3/5 ipmi/bmc-sim: Add 'Get Channel Info' command

In reply to Nicholas Piggin

Linux issues this command when booting a powernv machine.

---
 include/hw/ipmi/ipmi.h | 10 +++++++
 hw/ipmi/ipmi_bmc_sim.c | 68 ++++++++++++++++++++++++++++++++++++++++--
 hw/ipmi/ipmi_bt.c      |  2 ++
 hw/ipmi/ipmi_kcs.c     |  1 +
 4 files changed, 79 insertions(+), 2 deletions(-)
include/hw/ipmi/ipmi.h +10 -0
index c8ef04856e1..802a2febb07 100644
@@ -41,6 +41,15 @@ enum ipmi_op {
     IPMI_SEND_NMI
 };
 
+/* Channel properties */
+#define IPMI_CHANNEL_IPMB                0x00
+#define IPMI_CHANNEL_SYSTEM              0x0f
+#define IPMI_CHANNEL_MEDIUM_IPMB         0x01
+#define IPMI_CHANNEL_MEDIUM_SYSTEM       0x0c
+#define IPMI_CHANNEL_PROTOCOL_IPMB       0x01
+#define IPMI_CHANNEL_PROTOCOL_KCS        0x05
+#define IPMI_CHANNEL_PROTOCOL_BT_15      0x08
+
 #define IPMI_CC_INVALID_CMD                              0xc1
 #define IPMI_CC_COMMAND_INVALID_FOR_LUN                  0xc2
 #define IPMI_CC_TIMEOUT                                  0xc3
@@ -76,6 +85,7 @@ typedef struct IPMIFwInfo {
     int interface_type;
     uint8_t ipmi_spec_major_revision;
     uint8_t ipmi_spec_minor_revision;
+    uint8_t ipmi_channel_protocol;
     uint8_t i2c_slave_address;
     uint32_t uuid;
 
hw/ipmi/ipmi_bmc_sim.c +66 -2

92 lines not on this page · raw message

hw/ipmi/ipmi_bt.c +2 -0
index 583fc64730c..28cf6ab2185 100644
@@ -419,6 +419,8 @@ void ipmi_bt_get_fwinfo(struct IPMIBT *ib, IPMIFwInfo *info)
     info->interface_type = IPMI_SMBIOS_BT;
     info->ipmi_spec_major_revision = 2;
     info->ipmi_spec_minor_revision = 0;
+    /* BT System Interface Format, IPMI v1.5 */
+    info->ipmi_channel_protocol = IPMI_CHANNEL_PROTOCOL_BT_15;
     info->base_address = ib->io_base;
     info->register_length = ib->io_length;
     info->register_spacing = 1;
hw/ipmi/ipmi_kcs.c +1 -0
index c15977cab4c..578dd7cef34 100644
@@ -405,6 +405,7 @@ void ipmi_kcs_get_fwinfo(IPMIKCS *ik, IPMIFwInfo *info)
     info->interface_type = IPMI_SMBIOS_KCS;
     info->ipmi_spec_major_revision = 2;
     info->ipmi_spec_minor_revision = 0;
+    info->ipmi_channel_protocol = IPMI_CHANNEL_PROTOCOL_KCS;
     info->base_address = ik->io_base;
     info->i2c_slave_address = ik->bmc->slave_addr;
     info->register_length = ik->io_length;
Signature · 1 line
2.47.1
#5 lore raw

PATCH v3 4/5 ipmi/bmc-sim: implement watchdog dont log flag

In reply to Nicholas Piggin

If the dont-log flag is set in the 'timer use' field for the 'set watchdog' command, a watchdog timeout will not get logged as a timer use expiration.

---
 hw/ipmi/ipmi_bmc_sim.c | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)
hw/ipmi/ipmi_bmc_sim.c +17 -9
index d63f2348ba1..98cfab6a455 100644
@@ -514,7 +514,8 @@ static void gen_event(IPMIBmcSim *ibs, unsigned int sens_num, uint8_t deassert,
 
 static void sensor_set_discrete_bit(IPMIBmcSim *ibs, unsigned int sensor,
                                     unsigned int bit, unsigned int val,
-                                    uint8_t evd1, uint8_t evd2, uint8_t evd3)
+                                    uint8_t evd1, uint8_t evd2, uint8_t evd3,
+                                    bool do_log)
 {
     IPMISensor *sens;
     uint16_t mask;
@@ -534,7 +535,7 @@ static void sensor_set_discrete_bit(IPMIBmcSim *ibs, unsigned int sensor,
             return; /* Already asserted */
         }
         sens->assert_states |= mask & sens->assert_suppt;
-        if (sens->assert_enable & mask & sens->assert_states) {
+        if (do_log && (sens->assert_enable & mask & sens->assert_states)) {
             /* Send an event on assert */
             gen_event(ibs, sensor, 0, evd1, evd2, evd3);
         }
@@ -544,7 +545,7 @@ static void sensor_set_discrete_bit(IPMIBmcSim *ibs, unsigned int sensor,
             return; /* Already deasserted */
         }
         sens->deassert_states |= mask & sens->deassert_suppt;
-        if (sens->deassert_enable & mask & sens->deassert_states) {
+        if (do_log && (sens->deassert_enable & mask & sens->deassert_states)) {
             /* Send an event on deassert */
             gen_event(ibs, sensor, 1, evd1, evd2, evd3);
         }
@@ -700,6 +701,7 @@ static void ipmi_sim_handle_timeout(IPMIBmcSim *ibs)
 {
     IPMIInterface *s = ibs->parent.intf;
     IPMIInterfaceClass *k = IPMI_INTERFACE_GET_CLASS(s);
+    bool do_log = !IPMI_BMC_WATCHDOG_GET_DONT_LOG(ibs);
 
     if (!ibs->watchdog_running) {
         goto out;
@@ -711,14 +713,16 @@ static void ipmi_sim_handle_timeout(IPMIBmcSim *ibs)
             ibs->msg_flags |= IPMI_BMC_MSG_FLAG_WATCHDOG_TIMEOUT_MASK;
             k->do_hw_op(s, IPMI_SEND_NMI, 0);
             sensor_set_discrete_bit(ibs, IPMI_WATCHDOG_SENSOR, 8, 1,
-                                    0xc8, (2 << 4) | 0xf, 0xff);
+                                    0xc8, (2 << 4) | 0xf, 0xff,
+                                    do_log);
             break;
 
         case IPMI_BMC_WATCHDOG_PRE_MSG_INT:
             ibs->msg_flags |= IPMI_BMC_MSG_FLAG_WATCHDOG_TIMEOUT_MASK;
             k->set_atn(s, 1, attn_irq_enabled(ibs));
             sensor_set_discrete_bit(ibs, IPMI_WATCHDOG_SENSOR, 8, 1,
-                                    0xc8, (3 << 4) | 0xf, 0xff);
+                                    0xc8, (3 << 4) | 0xf, 0xff,
+                                    do_log);
             break;
 
         default:
@@ -738,24 +742,28 @@ static void ipmi_sim_handle_timeout(IPMIBmcSim *ibs)
     switch (IPMI_BMC_WATCHDOG_GET_ACTION(ibs)) {
     case IPMI_BMC_WATCHDOG_ACTION_NONE:
         sensor_set_discrete_bit(ibs, IPMI_WATCHDOG_SENSOR, 0, 1,
-                                0xc0, ibs->watchdog_use & 0xf, 0xff);
+                                0xc0, ibs->watchdog_use & 0xf, 0xff,
+                                do_log);
         break;
 
     case IPMI_BMC_WATCHDOG_ACTION_RESET:
         sensor_set_discrete_bit(ibs, IPMI_WATCHDOG_SENSOR, 1, 1,
-                                0xc1, ibs->watchdog_use & 0xf, 0xff);
+                                0xc1, ibs->watchdog_use & 0xf, 0xff,
+                                do_log);
         k->do_hw_op(s, IPMI_RESET_CHASSIS, 0);
         break;
 
     case IPMI_BMC_WATCHDOG_ACTION_POWER_DOWN:
         sensor_set_discrete_bit(ibs, IPMI_WATCHDOG_SENSOR, 2, 1,
-                                0xc2, ibs->watchdog_use & 0xf, 0xff);
+                                0xc2, ibs->watchdog_use & 0xf, 0xff,
+                                do_log);
         k->do_hw_op(s, IPMI_POWEROFF_CHASSIS, 0);
         break;
 
     case IPMI_BMC_WATCHDOG_ACTION_POWER_CYCLE:
         sensor_set_discrete_bit(ibs, IPMI_WATCHDOG_SENSOR, 2, 1,
-                                0xc3, ibs->watchdog_use & 0xf, 0xff);
+                                0xc3, ibs->watchdog_use & 0xf, 0xff,
+                                do_log);
         k->do_hw_op(s, IPMI_POWERCYCLE_CHASSIS, 0);
         break;
     }
Signature · 1 line
2.47.1
#6 lore raw

PATCH v3 5/5 ipmi/bmc-sim: add error handling for 'Set BMC Global Enables' command

In reply to Nicholas Piggin

Mask out unsupported bits and return failure if attempting to set any. This is not required by the IPMI spec, but it does require that system software not change bits it isn't aware of.

---
 hw/ipmi/ipmi_bmc_sim.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
hw/ipmi/ipmi_bmc_sim.c +9 -1
index 98cfab6a455..3c008a3a603 100644
@@ -235,6 +235,7 @@ struct IPMIBmcSim {
 #define IPMI_BMC_MSG_FLAG_RCV_MSG_QUEUE_SET(s) \
     (IPMI_BMC_MSG_FLAG_RCV_MSG_QUEUE & (s)->msg_flags)
 
+#define IPMI_BMC_GLOBAL_ENABLES_SUPPORTED 0x0f
 #define IPMI_BMC_RCV_MSG_QUEUE_INT_BIT    0
 #define IPMI_BMC_EVBUF_FULL_INT_BIT       1
 #define IPMI_BMC_EVENT_MSG_BUF_BIT        2
@@ -934,7 +935,14 @@ static void set_bmc_global_enables(IPMIBmcSim *ibs,
                                    uint8_t *cmd, unsigned int cmd_len,
                                    RspBuffer *rsp)
 {
-    set_global_enables(ibs, cmd[2]);
+    uint8_t val = cmd[2];
+
+    if (val & ~IPMI_BMC_GLOBAL_ENABLES_SUPPORTED) {
+        rsp_buffer_set_error(rsp, IPMI_CC_INVALID_DATA_FIELD);
+        return;
+    }
+
+    set_global_enables(ibs, val);
 }
 
 static void get_bmc_global_enables(IPMIBmcSim *ibs,
Signature · 1 line
2.47.1
Acked-by on the v3 series
#7 lore raw
In reply to Nicholas Piggin
Quoted 3 lines · Nicholas Piggin

These little things came up when looking at behaviour of IPMI with the bmc-sim implementation running the ppc powernv machine, and trying to clean up error messages and missing features.

This all looks good to me. Thanks to Philippe for reviewing, too.

I can give you an

if you are working on this for your own tree, or I can take it into mine.

-corey

Quoted 45 lines

Since v1 (thanks to Corey for review and suggestions):
- Added fwinfo to PCI devices
- Report interrupt number in Get Channel Info for ISA, PCI, and unknown/unassigned.
- Fix error reporting for Get Channel Info unsupported channels. Verify it is the correct error code that ipmitool looks for
https://github.com/ipmitool/ipmitool/blob/master/lib/ipmi_channel.c#L256C16-L256C45
- Change _CH_ to _CHANNEL_ in some defines names.
- Also avoid adding event logs with watchdog don't log flag.

Since v2:
- Don't log watchog flag should not apply to watchdog expiry field.
- Moved protocol type field from class to IPMIFwInfo.
- Rename new FwInfo member irq to irq_source.
- Add comments about handling PCI devices to existing callers of ->fwinfo

Thanks,
Nick

Nicholas Piggin (5):
ipmi/pci-ipmi-bt: Rename copy-paste variables
ipmi: add fwinfo to pci ipmi devices
ipmi/bmc-sim: Add 'Get Channel Info' command
ipmi/bmc-sim: implement watchdog dont log flag ipmi/bmc-sim: add error handling for 'Set BMC Global Enables' command

 include/hw/ipmi/ipmi.h     |  15 ++++++
 hw/acpi/ipmi.c             |   3 +-
 hw/ipmi/ipmi_bmc_sim.c     | 104 ++++++++++++++++++++++++++++++++-----
 hw/ipmi/ipmi_bt.c          |   2 +
 hw/ipmi/ipmi_kcs.c         |   1 +
 hw/ipmi/isa_ipmi_bt.c      |   1 +
 hw/ipmi/isa_ipmi_kcs.c     |   1 +
 hw/ipmi/pci_ipmi_bt.c      |  50 +++++++++++-------
 hw/ipmi/pci_ipmi_kcs.c     |  11 ++++
 hw/smbios/smbios_type_38.c |   7 ++-
 10 files changed, 162 insertions(+), 33 deletions(-)
Signature · 1 line
2.47.1
#8 lore raw
Quoted 5 lines · Corey Minyard
Quoted 3 lines · Nicholas Piggin

These little things came up when looking at behaviour of IPMI with the bmc-sim implementation running the ppc powernv machine, and trying to clean up error messages and missing features.

Quoted 8 lines

This all looks good to me. Thanks to Philippe for reviewing, too.

I can give you an

if you are working on this for your own tree, or I can take it into mine.

Hey Corey,

Thanks for all the review, and sorry I missed your question...

I don't have anything further in my tree, I don't have an immediate need for it, it was just tidying up a few errors and warnings I noticed.

I'd be happy for you to take it in your tree and send it up when it suits you.

Thanks,
Nick

#9 lore raw
Quoted 17 lines · Nicholas Piggin
Quoted 5 lines · Corey Minyard
Quoted 3 lines · Nicholas Piggin

These little things came up when looking at behaviour of IPMI with the bmc-sim implementation running the ppc powernv machine, and trying to clean up error messages and missing features.

Quoted 8 lines

This all looks good to me. Thanks to Philippe for reviewing, too.

I can give you an

if you are working on this for your own tree, or I can take it into mine.

Hey Corey,

Quoted 8 lines

Thanks for all the review, and sorry I missed your question...

I don't have anything further in my tree, I don't have an immediate need for it, it was just tidying up a few errors and warnings I noticed.

I'd be happy for you to take it in your tree and send it up when it suits you.

Ok, it's in my tree. I had to fix up pci_ipmi_kcs.c, it defined pci_ipmi_bt_get_fwinfo, not pci_ipmi_kcs_get_fwinfo.

-corey

Quoted 3 lines

Thanks,
Nick

#10 lore raw
Quoted 24 lines · Corey Minyard
Quoted 23 lines · Nicholas Piggin
Quoted 5 lines · Corey Minyard
Quoted 3 lines · Nicholas Piggin

These little things came up when looking at behaviour of IPMI with the bmc-sim implementation running the ppc powernv machine, and trying to clean up error messages and missing features.

Quoted 8 lines

This all looks good to me. Thanks to Philippe for reviewing, too.

I can give you an

if you are working on this for your own tree, or I can take it into mine.

Hey Corey,

Thanks for all the review, and sorry I missed your question...

I don't have anything further in my tree, I don't have an immediate need for it, it was just tidying up a few errors and warnings I noticed.

Quoted 5 lines
Quoted 2 lines

I'd be happy for you to take it in your tree and send it up when it suits you.

Ok, it's in my tree. I had to fix up pci_ipmi_kcs.c, it defined pci_ipmi_bt_get_fwinfo, not pci_ipmi_kcs_get_fwinfo.

Thanks, I noiced that just now too I thought I'd had a config that built it but clearly not :( Sorry.

Thanks,
Nick