Skip to contentSkip to conversation

First shot at adding IPMI to qemu

PATCH New [email protected] 3 participants 12 messages Jul 2, 2012 – Jul 9, 2012 KVM

lore
Share & tools
lore
#0 lore raw

I had asked about getting an IPMI device into qemu and received some interest, and it's useful to me, so I've done some work to add it. The following patch set has a set of patches to add an IPMI KCS device, and IPMI BT device, a built-in BMC (IPMI management controller), and a way to attach an external BMC through a chardev.

There was some discussion on whether to make the BMC internal or external, but I went ahead and added both. The internal one is fairly basic and not extensible, at least without adding code. I've modified the OpenIPMI library simulator to work with the external interface to allow it to receive connections from the qemu external simulator with a fairly basic protocol.

I've also added the ability for the OpenIPMI library to manage a VM to power it on, power it off, reset it, and handle an IPMI watchdog timer. So it looks quite like a real system. Instructions for using it are in the OpenIPMI release candidate I uploaded to
https://sourceforge.net/projects/openipmi

Since IPMI can advertise it's presence via SMBIOS, I added a way for a driver to add an SMBIOS entry. I also added a way to query a free interrupt from the ISA bus, since the interrupt is in the SMBIOS entry and nobody really cares which one is used.

#1 lore raw

PATCH 1/9 smbios: Add a function to directly add an entry

From: Corey Minyard <[email protected]>

There was no way to directly add a table entry to the SMBIOS table, even though the BIOS supports this. So add a function to do this. This is in preparation for the IPMI handler adding it's SMBIOS table entry.

---
 hw/smbios.c |   27 +++++++++++++++++++++++++++
 hw/smbios.h |   15 ++++++++-------
 2 files changed, 35 insertions(+), 7 deletions(-)
hw/smbios.c +27 -0
index c57237d..98c7f99 100644
@@ -178,6 +178,33 @@ static void smbios_build_type_1_fields(const char *t)
                          strlen(buf) + 1, buf);
 }
 
+int smbios_table_entry_add(struct smbios_structure_header *entry)
+{
+    struct smbios_table *table;
+    struct smbios_structure_header *header;
+    unsigned int size = entry->length;
+
+    if (!smbios_entries) {
+        smbios_entries_len = sizeof(uint16_t);
+        smbios_entries = g_malloc0(smbios_entries_len);
+    }
+    smbios_entries = g_realloc(smbios_entries, smbios_entries_len +
+			       sizeof(*table) + size);
+    table = (struct smbios_table *)(smbios_entries + smbios_entries_len);
+    table->header.type = SMBIOS_TABLE_ENTRY;
+    table->header.length = cpu_to_le16(sizeof(*table) + size);
+
+    header = (struct smbios_structure_header *)(table->data);
+    memcpy(header, entry, size);
+
+    smbios_check_collision(header->type, SMBIOS_TABLE_ENTRY);
+
+    smbios_entries_len += sizeof(*table) + size;
+    (*(uint16_t *)smbios_entries) =
+	cpu_to_le16(le16_to_cpu(*(uint16_t *)smbios_entries) + 1);
+    return 0;
+}
+
 int smbios_entry_add(const char *t)
 {
     char buf[1024];
hw/smbios.h +8 -7
index 94e3641..6431a15 100644
@@ -13,21 +13,22 @@
  *
  */
 
+/* This goes at the beginning of every SMBIOS structure. */
+struct smbios_structure_header {
+    uint8_t type;
+    uint8_t length;
+    uint16_t handle;
+} QEMU_PACKED;
+
 int smbios_entry_add(const char *t);
 void smbios_add_field(int type, int offset, int len, void *data);
 uint8_t *smbios_get_table(size_t *length);
+int smbios_table_entry_add(struct smbios_structure_header *entry);
 
 /*
  * SMBIOS spec defined tables
  */
 
-/* This goes at the beginning of every SMBIOS structure. */
-struct smbios_structure_header {
-    uint8_t type;
-    uint8_t length;
-    uint16_t handle;
-} QEMU_PACKED;
-
 /* SMBIOS type 0 - BIOS Information */
 struct smbios_type_0 {
     struct smbios_structure_header header;
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 2/9 pc: move SMBIOS setup to after device init

In reply to [email protected]

From: Corey Minyard <[email protected]>

Setting up the firmware interface for the SMBIOS table needs to be done later in the process, after device initialization, so that devices can add entries to the table.

---
 hw/pc.c      |   22 +++++++++++++---------
 hw/pc.h      |    9 +++++----
 hw/pc_piix.c |   12 ++++++++----
 3 files changed, 26 insertions(+), 17 deletions(-)
hw/pc.c +13 -9
index fb04c8b..c0acb6a 100644
@@ -971,20 +971,12 @@ void pc_cpus_init(const char *cpu_model)
 }
 
 void pc_memory_init(MemoryRegion *system_memory,
-                    const char *kernel_filename,
-                    const char *kernel_cmdline,
-                    const char *initrd_filename,
                     ram_addr_t below_4g_mem_size,
                     ram_addr_t above_4g_mem_size,
-                    MemoryRegion *rom_memory,
                     MemoryRegion **ram_memory)
 {
-    int linux_boot, i;
-    MemoryRegion *ram, *option_rom_mr;
+    MemoryRegion *ram;
     MemoryRegion *ram_below_4g, *ram_above_4g;
-    void *fw_cfg;
-
-    linux_boot = (kernel_filename != NULL);
 
     /* Allocate RAM.  We allocate it as a single memory region and use
      * aliases to address portions of it, mostly for backwards compatibility
@@ -1006,7 +998,17 @@ void pc_memory_init(MemoryRegion *system_memory,
         memory_region_add_subregion(system_memory, 0x100000000ULL,
                                     ram_above_4g);
     }
+}
 
+void pc_bios_init(const char *kernel_filename,
+		  const char *kernel_cmdline,
+		  const char *initrd_filename,
+		  ram_addr_t below_4g_mem_size,
+		  MemoryRegion *rom_memory)
+{
+    MemoryRegion *option_rom_mr;
+    void *fw_cfg;
+    int linux_boot, i;
 
     /* Initialize PC system firmware */
     pc_system_firmware_init(rom_memory);
@@ -1019,6 +1021,8 @@ void pc_memory_init(MemoryRegion *system_memory,
                                         option_rom_mr,
                                         1);
 
+    linux_boot = (kernel_filename != NULL);
+
     fw_cfg = bochs_bios_init();
     rom_set_fw(fw_cfg);
 
hw/pc.h +5 -4
index 8ccf202..33ab689 100644
@@ -107,13 +107,14 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
 
 void pc_cpus_init(const char *cpu_model);
 void pc_memory_init(MemoryRegion *system_memory,
-                    const char *kernel_filename,
-                    const char *kernel_cmdline,
-                    const char *initrd_filename,
                     ram_addr_t below_4g_mem_size,
                     ram_addr_t above_4g_mem_size,
-                    MemoryRegion *rom_memory,
                     MemoryRegion **ram_memory);
+void pc_bios_init(const char *kernel_filename,
+		  const char *kernel_cmdline,
+		  const char *initrd_filename,
+		  ram_addr_t below_4g_mem_size,
+		  MemoryRegion *rom_memory);
 qemu_irq *pc_allocate_cpu_irq(void);
 DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus);
 void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
hw/pc_piix.c +8 -4
index fb86f27..21b4f59 100644
@@ -176,10 +176,8 @@ static void pc_init1(MemoryRegion *system_memory,
 
     /* allocate ram and load rom/bios */
     if (!xen_enabled()) {
-        pc_memory_init(system_memory,
-                       kernel_filename, kernel_cmdline, initrd_filename,
-                       below_4g_mem_size, above_4g_mem_size,
-                       pci_enabled ? rom_memory : system_memory, &ram_memory);
+        pc_memory_init(system_memory, below_4g_mem_size, above_4g_mem_size,
+		       &ram_memory);
     }
 
     gsi_state = g_malloc0(sizeof(*gsi_state));
@@ -287,6 +285,12 @@ static void pc_init1(MemoryRegion *system_memory,
     if (pci_enabled) {
         pc_pci_device_init(pci_bus);
     }
+
+    if (!xen_enabled()) {
+	pc_bios_init(kernel_filename, kernel_cmdline, initrd_filename,
+		     below_4g_mem_size,
+		     pci_enabled ? rom_memory : system_memory);
+    }
 }
 
 static void pc_init_pci(ram_addr_t ram_size,
Signature · 1 line
1.7.4.1
#3 lore raw

PATCH 3/9 isa: Add a way to query for a free interrupt

In reply to [email protected]

From: Corey Minyard <[email protected]>

This lets devices that don't care about their interrupt number, like IPMI, just grab any unused interrupt.

---
 hw/isa-bus.c |   13 +++++++++++++
 hw/isa.h     |    2 ++
 2 files changed, 15 insertions(+), 0 deletions(-)
hw/isa-bus.c +13 -0
index 5a43f03..f561f21 100644
@@ -71,6 +71,7 @@ qemu_irq isa_get_irq(ISADevice *dev, int isairq)
     if (isairq < 0 || isairq > 15) {
         hw_error("isa irq %d invalid", isairq);
     }
+    isabus->irq_inuse[isairq] = 1;
     return isabus->irqs[isairq];
 }
 
@@ -82,6 +83,18 @@ void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq)
     dev->nirqs++;
 }
 
+int isa_find_free_irq(ISABus *bus)
+{
+    unsigned int i;
+
+    /* 0 and 1 are called for, 2 is the chain interrupt */
+    for (i = 3; i < ISA_NUM_IRQS; i++) {
+	if (!bus->irq_inuse[i])
+	    return i;
+    }
+    return 0;
+}
+
 static inline void isa_init_ioport(ISADevice *dev, uint16_t ioport)
 {
     if (dev && (dev->ioport_id == 0 || ioport < dev->ioport_id)) {
hw/isa.h +2 -0
index f7bc4b5..9447296 100644
@@ -28,6 +28,7 @@ struct ISABus {
     BusState qbus;
     MemoryRegion *address_space_io;
     qemu_irq *irqs;
+    int irq_inuse[ISA_NUM_IRQS];
 };
 
 struct ISADevice {
@@ -41,6 +42,7 @@ ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space_io);
 void isa_bus_irqs(ISABus *bus, qemu_irq *irqs);
 qemu_irq isa_get_irq(ISADevice *dev, int isairq);
 void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq);
+int isa_find_free_irq(ISABus *bus);
 MemoryRegion *isa_address_space(ISADevice *dev);
 ISADevice *isa_create(ISABus *bus, const char *name);
 ISADevice *isa_try_create(ISABus *bus, const char *name);
Signature · 1 line
1.7.4.1
#4 lore raw

PATCH 4/9 Add a base IPMI interface

In reply to [email protected]

From: Corey Minyard <[email protected]>

Add the basic IPMI types and infrastructure to QEMU. Low-level interfaces and simulation interfaces will register with this; it's kind of the go-between to tie them together.

---
 default-configs/i386-softmmu.mak   |    1 +
 default-configs/x86_64-softmmu.mak |    1 +
 hw/Makefile.objs                   |    2 +
 hw/ipmi.c                          |  147 +++++++++++++++++++++++++++
 hw/ipmi.h                          |  192 ++++++++++++++++++++++++++++++++++++
 qemu-doc.texi                      |    2 +
 qemu-options.hx                    |   35 +++++++
 sysemu.h                           |    8 ++
 vl.c                               |   46 +++++++++
 9 files changed, 434 insertions(+), 0 deletions(-)
 create mode 100644 hw/ipmi.c
 create mode 100644 hw/ipmi.h
default-configs/i386-softmmu.mak +1 -0
index 2c78175..eb17afc 100644
@@ -7,6 +7,7 @@ CONFIG_VGA_ISA=y
 CONFIG_VGA_CIRRUS=y
 CONFIG_VMWARE_VGA=y
 CONFIG_VMMOUSE=y
+CONFIG_IPMI=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
 CONFIG_I8254=y
default-configs/x86_64-softmmu.mak +1 -0
index 233a856..e4e3e4f 100644
@@ -7,6 +7,7 @@ CONFIG_VGA_ISA=y
 CONFIG_VGA_CIRRUS=y
 CONFIG_VMWARE_VGA=y
 CONFIG_VMMOUSE=y
+CONFIG_IPMI=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
 CONFIG_I8254=y
hw/Makefile.objs +2 -0
index 30c0b78..0d55997 100644
@@ -20,6 +20,8 @@ hw-obj-$(CONFIG_M48T59) += m48t59.o
 hw-obj-$(CONFIG_ESCC) += escc.o
 hw-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o
 
+hw-obj-$(CONFIG_IPMI) += ipmi.o
+
 hw-obj-$(CONFIG_SERIAL) += serial.o
 hw-obj-$(CONFIG_PARALLEL) += parallel.o
 hw-obj-$(CONFIG_I8254) += i8254_common.o i8254.o
hw/ipmi.c new file +147 -0

147 lines not on this page · raw message

hw/ipmi.h new file +192 -0

192 lines not on this page · raw message

qemu-doc.texi +2 -0
index 0af0ff4..effa2da 100644
@@ -195,6 +195,8 @@ PCI and ISA network adapters
 @item
 Serial ports
 @item
+IPMI BMC, either and internal or external one
+@item
 Creative SoundBlaster 16 sound card
 @item
 ENSONIQ AudioPCI ES1370 sound card
qemu-options.hx +35 -0
index 125a4da..823f6bc 100644
@@ -2204,6 +2204,41 @@ Three button serial mouse. Configure the guest to use Microsoft protocol.
 @end table
 ETEXI
 
+DEF("ipmi", HAS_ARG, QEMU_OPTION_ipmi, \
+    "-ipmi [kcs|bt,]dev|local|none  IPMI interface to the dev, or internal BMC\n",
+    QEMU_ARCH_ALL)
+STEXI
+@item -ipmi [bt|kcs,]@var{dev}|local|none
+@findex -ipmi
+Set up an IPMI interface.  The physical interface may either be
+KCS or BT, the default is KCS.  Two options are available for
+simulation of the IPMI BMC.  If @code{local} is specified, then a
+minimal internal BMC is used.  This BMC is basically useful as a
+watchdog timer and for fooling a system into thinking IPMI is there.
+
+If @var{dev} is specified (see the serial section above for details on
+what can be specified for @var{dev}) then a connection to an external IPMI
+simulator is made.  This interface has the ability to do power control
+and reset, so it can do the normal IPMI types of things required.
+
+The OpenIPMI project's lanserv simulator is capable of providing
+this interface.  It is also capable of an IPMI LAN interface, and
+you can do power control (the lanserv simulator is capable of starting
+a VM, too) and reset of a virtual machine over a standard remote LAN
+interface.  For details on this, see OpenIPMI.
+
+The remote connection to a LAN interface will reconnect if disconnected,
+so if a remote BMC fails and restarts, it will still be usable.
+
+For instance, to connect to an external interface on the local machine
+port 9002 with a BT physical interface, do the following:
+@table @code
+@item -ipmi bt,tcp:localhost:9002
+@end table
+
+Use @code{-ipmi none} to disable IPMI.
+ETEXI
+
 DEF("parallel", HAS_ARG, QEMU_OPTION_parallel, \
     "-parallel dev   redirect the parallel port to char device 'dev'\n",
     QEMU_ARCH_ALL)
sysemu.h +8 -0
index eb3da5a..b71cd7a 100644
@@ -172,6 +172,14 @@ int do_pcie_aer_inject_error(Monitor *mon,
 
 extern CharDriverState *serial_hds[MAX_SERIAL_PORTS];
 
+/* IPMI devices */
+
+#define MAX_IPMI_DEVICES 1
+
+extern int do_local_ipmi;
+extern int ipmi_types[MAX_IPMI_DEVICES];
+extern QemuOpts *ipmi_hds[MAX_IPMI_DEVICES];
+
 /* parallel ports */
 
 #define MAX_PARALLEL_PORTS 3
vl.c +46 -0

82 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#5 lore raw

PATCH 5/9 IPMI: Add a PC ISA type structure

In reply to [email protected]

From: Corey Minyard <[email protected]>

This provides the base infrastructure to tie IPMI low-level interfaces into a PC ISA bus.

---
 default-configs/i386-softmmu.mak   |    1 +
 default-configs/x86_64-softmmu.mak |    1 +
 hw/Makefile.objs                   |    1 +
 hw/isa_ipmi.c                      |  138 ++++++++++++++++++++++++++++++++++++
 hw/pc.c                            |   12 +++
 hw/pc.h                            |   18 +++++
 hw/smbios.h                        |   12 +++
 7 files changed, 183 insertions(+), 0 deletions(-)
 create mode 100644 hw/isa_ipmi.c
default-configs/i386-softmmu.mak +1 -0
index eb17afc..c0aff0d 100644
@@ -8,6 +8,7 @@ CONFIG_VGA_CIRRUS=y
 CONFIG_VMWARE_VGA=y
 CONFIG_VMMOUSE=y
 CONFIG_IPMI=y
+CONFIG_ISA_IPMI=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
 CONFIG_I8254=y
default-configs/x86_64-softmmu.mak +1 -0
index e4e3e4f..615e4f2 100644
@@ -8,6 +8,7 @@ CONFIG_VGA_CIRRUS=y
 CONFIG_VMWARE_VGA=y
 CONFIG_VMMOUSE=y
 CONFIG_IPMI=y
+CONFIG_ISA_IPMI=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
 CONFIG_I8254=y
hw/Makefile.objs +1 -0
index 0d55997..8f27ffe 100644
@@ -21,6 +21,7 @@ hw-obj-$(CONFIG_ESCC) += escc.o
 hw-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o
 
 hw-obj-$(CONFIG_IPMI) += ipmi.o
+hw-obj-$(CONFIG_ISA_IPMI) += isa_ipmi.o
 
 hw-obj-$(CONFIG_SERIAL) += serial.o
 hw-obj-$(CONFIG_PARALLEL) += parallel.o
hw/isa_ipmi.c new file +138 -0

138 lines not on this page · raw message

hw/pc.c +12 -0
index c0acb6a..965e053 100644
@@ -1173,6 +1173,18 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
         fd[i] = drive_get(IF_FLOPPY, 0, i);
     }
     *floppy = fdctrl_init_isa(isa_bus, fd);
+
+    i = 0;
+    if (do_local_ipmi) {
+	ipmi_isa_init(isa_bus, isa_find_free_irq(isa_bus), ipmi_types[i], NULL);
+	i++;
+    }
+    for(; i < MAX_IPMI_DEVICES; i++) {
+	if (ipmi_hds[i]) {
+	    ipmi_isa_init(isa_bus, isa_find_free_irq(isa_bus),
+			  ipmi_types[i], ipmi_hds[i]);
+	}
+    }
 }
 
 void pc_pci_device_init(PCIBus *pci_bus)
hw/pc.h +18 -0
index 33ab689..5b6d947 100644
@@ -223,6 +223,24 @@ static inline bool isa_ne2000_init(ISABus *bus, int base, int irq, NICInfo *nd)
     return true;
 }
 
+/* IPMI */
+static inline bool ipmi_isa_init(ISABus *bus, int irq,
+				 int type, QemuOpts *opts)
+{
+    ISADevice *dev;
+
+    dev = isa_try_create(bus, "isa-ipmi");
+    if (!dev) {
+        return false;
+    }
+    qdev_prop_set_uint32(&dev->qdev, "type", type);
+    qdev_prop_set_uint32(&dev->qdev, "irq", irq);
+    qdev_prop_set_ptr(&dev->qdev, "charopts", opts);
+    if (qdev_init(&dev->qdev) < 0) {
+        return false;
+    }
+    return true;
+}
 /* pc_sysfw.c */
 void pc_system_firmware_init(MemoryRegion *rom_memory);
 
hw/smbios.h +12 -0
index 6431a15..b9e4a61 100644
@@ -155,6 +155,18 @@ struct smbios_type_32 {
     uint8_t boot_status;
 } QEMU_PACKED;
 
+/* SMBIOS type 38 - IPMI Device Information */
+struct smbios_type_38 {
+    struct smbios_structure_header header;
+    uint8_t interface_type;
+    uint8_t ipmi_version;
+    uint8_t i2c_slave_addr;
+    uint8_t nv_storage_dev_addr;
+    uint64_t base_addr;
+    uint8_t base_addr_mod_and_irq_info;
+    uint8_t interrupt_number;
+} QEMU_PACKED;
+
 /* SMBIOS type 127 -- End-of-table */
 struct smbios_type_127 {
     struct smbios_structure_header header;
Signature · 1 line
1.7.4.1
#6 lore raw

PATCH 6/9 IPMI: Add a KCS low-level interface

In reply to [email protected]

From: Corey Minyard <[email protected]>

This provides the simulation of the KCS hardware interface.

---
 default-configs/i386-softmmu.mak   |    1 +
 default-configs/x86_64-softmmu.mak |    1 +
 hw/Makefile.objs                   |    1 +
 hw/ipmi_kcs.c                      |  259 ++++++++++++++++++++++++++++++++++++
 hw/ipmi_kcs.h                      |   82 +++++++++++
 5 files changed, 344 insertions(+), 0 deletions(-)
 create mode 100644 hw/ipmi_kcs.c
 create mode 100644 hw/ipmi_kcs.h
default-configs/i386-softmmu.mak +1 -0
index c0aff0d..b549389 100644
@@ -9,6 +9,7 @@ CONFIG_VMWARE_VGA=y
 CONFIG_VMMOUSE=y
 CONFIG_IPMI=y
 CONFIG_ISA_IPMI=y
+CONFIG_IPMI_KCS=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
 CONFIG_I8254=y
default-configs/x86_64-softmmu.mak +1 -0
index 615e4f2..af7d2a9 100644
@@ -9,6 +9,7 @@ CONFIG_VMWARE_VGA=y
 CONFIG_VMMOUSE=y
 CONFIG_IPMI=y
 CONFIG_ISA_IPMI=y
+CONFIG_IPMI_KCS=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
 CONFIG_I8254=y
hw/Makefile.objs +1 -0
index 8f27ffe..99e5d1e 100644
@@ -22,6 +22,7 @@ hw-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o
 
 hw-obj-$(CONFIG_IPMI) += ipmi.o
 hw-obj-$(CONFIG_ISA_IPMI) += isa_ipmi.o
+hw-obj-$(CONFIG_IPMI_KCS) += ipmi_kcs.o
 
 hw-obj-$(CONFIG_SERIAL) += serial.o
 hw-obj-$(CONFIG_PARALLEL) += parallel.o
hw/ipmi_kcs.c new file +259 -0

259 lines not on this page · raw message

hw/ipmi_kcs.h new file +82 -0

82 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#7 lore raw

PATCH 7/9 IPMI: Add a BT low-level interface

In reply to [email protected]

From: Corey Minyard <[email protected]>

This provides the simulation of the BT hardware interface for IPMI.

---
 default-configs/i386-softmmu.mak   |    1 +
 default-configs/x86_64-softmmu.mak |    1 +
 hw/Makefile.objs                   |    1 +
 hw/ipmi_bt.c                       |  265 ++++++++++++++++++++++++++++++++++++
 hw/ipmi_bt.h                       |   99 +++++++++++++
 5 files changed, 367 insertions(+), 0 deletions(-)
 create mode 100644 hw/ipmi_bt.c
 create mode 100644 hw/ipmi_bt.h
default-configs/i386-softmmu.mak +1 -0
index b549389..f8f8e6d 100644
@@ -10,6 +10,7 @@ CONFIG_VMMOUSE=y
 CONFIG_IPMI=y
 CONFIG_ISA_IPMI=y
 CONFIG_IPMI_KCS=y
+CONFIG_IPMI_BT=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
 CONFIG_I8254=y
default-configs/x86_64-softmmu.mak +1 -0
index af7d2a9..8c1177d 100644
@@ -10,6 +10,7 @@ CONFIG_VMMOUSE=y
 CONFIG_IPMI=y
 CONFIG_ISA_IPMI=y
 CONFIG_IPMI_KCS=y
+CONFIG_IPMI_BT=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
 CONFIG_I8254=y
hw/Makefile.objs +1 -0
index 99e5d1e..e1d30cc 100644
@@ -23,6 +23,7 @@ hw-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o
 hw-obj-$(CONFIG_IPMI) += ipmi.o
 hw-obj-$(CONFIG_ISA_IPMI) += isa_ipmi.o
 hw-obj-$(CONFIG_IPMI_KCS) += ipmi_kcs.o
+hw-obj-$(CONFIG_IPMI_BT) += ipmi_bt.o
 
 hw-obj-$(CONFIG_SERIAL) += serial.o
 hw-obj-$(CONFIG_PARALLEL) += parallel.o
hw/ipmi_bt.c new file +265 -0

265 lines not on this page · raw message

hw/ipmi_bt.h new file +99 -0

99 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#8 lore raw

PATCH 8/9 IPMI: Add a local BMC simulation

In reply to [email protected]

From: Corey Minyard <[email protected]>

This provides a minimal local BMC, basically enough to comply with the spec and provide a complete watchdog timer (including a sensor, SDR, and event).

---
 default-configs/i386-softmmu.mak   |    1 +
 default-configs/x86_64-softmmu.mak |    1 +
 hw/Makefile.objs                   |    1 +
 hw/ipmi_sim.c                      | 1273 ++++++++++++++++++++++++++++++++++++
 hw/ipmi_sim.h                      |  270 ++++++++
 5 files changed, 1546 insertions(+), 0 deletions(-)
 create mode 100644 hw/ipmi_sim.c
 create mode 100644 hw/ipmi_sim.h
default-configs/i386-softmmu.mak +1 -0
index f8f8e6d..8c99d5d 100644
@@ -11,6 +11,7 @@ CONFIG_IPMI=y
 CONFIG_ISA_IPMI=y
 CONFIG_IPMI_KCS=y
 CONFIG_IPMI_BT=y
+CONFIG_IPMI_LOCAL=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
 CONFIG_I8254=y
default-configs/x86_64-softmmu.mak +1 -0
index 8c1177d..4d01883 100644
@@ -11,6 +11,7 @@ CONFIG_IPMI=y
 CONFIG_ISA_IPMI=y
 CONFIG_IPMI_KCS=y
 CONFIG_IPMI_BT=y
+CONFIG_IPMI_LOCAL=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
 CONFIG_I8254=y
hw/Makefile.objs +1 -0
index e1d30cc..193227d 100644
@@ -24,6 +24,7 @@ hw-obj-$(CONFIG_IPMI) += ipmi.o
 hw-obj-$(CONFIG_ISA_IPMI) += isa_ipmi.o
 hw-obj-$(CONFIG_IPMI_KCS) += ipmi_kcs.o
 hw-obj-$(CONFIG_IPMI_BT) += ipmi_bt.o
+hw-obj-$(CONFIG_IPMI_LOCAL) += ipmi_sim.o
 
 hw-obj-$(CONFIG_SERIAL) += serial.o
 hw-obj-$(CONFIG_PARALLEL) += parallel.o
hw/ipmi_sim.c new file +1273 -0

1,273 lines not on this page · raw message

hw/ipmi_sim.h new file +270 -0

270 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#9 lore raw

PATCH 9/9 IPMI: Add an external connection simulation interface

In reply to [email protected]

From: Corey Minyard <[email protected]>

This adds an interface for IPMI that connects to a remote BMC over a chardev (generally a TCP socket). The OpenIPMI lanserv simulator describes this interface, see that for interface details.

---
 default-configs/i386-softmmu.mak   |    1 +
 default-configs/x86_64-softmmu.mak |    1 +
 hw/Makefile.objs                   |    1 +
 hw/ipmi_extern.c                   |  421 ++++++++++++++++++++++++++++++++++++
 hw/ipmi_extern.h                   |   75 +++++++
 5 files changed, 499 insertions(+), 0 deletions(-)
 create mode 100644 hw/ipmi_extern.c
 create mode 100644 hw/ipmi_extern.h
default-configs/i386-softmmu.mak +1 -0
index 8c99d5d..325f92e 100644
@@ -12,6 +12,7 @@ CONFIG_ISA_IPMI=y
 CONFIG_IPMI_KCS=y
 CONFIG_IPMI_BT=y
 CONFIG_IPMI_LOCAL=y
+CONFIG_IPMI_EXTERN=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
 CONFIG_I8254=y
default-configs/x86_64-softmmu.mak +1 -0
index 4d01883..2ac9177 100644
@@ -12,6 +12,7 @@ CONFIG_ISA_IPMI=y
 CONFIG_IPMI_KCS=y
 CONFIG_IPMI_BT=y
 CONFIG_IPMI_LOCAL=y
+CONFIG_IPMI_EXTERN=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
 CONFIG_I8254=y
hw/Makefile.objs +1 -0
index 193227d..06757b0 100644
@@ -25,6 +25,7 @@ hw-obj-$(CONFIG_ISA_IPMI) += isa_ipmi.o
 hw-obj-$(CONFIG_IPMI_KCS) += ipmi_kcs.o
 hw-obj-$(CONFIG_IPMI_BT) += ipmi_bt.o
 hw-obj-$(CONFIG_IPMI_LOCAL) += ipmi_sim.o
+hw-obj-$(CONFIG_IPMI_EXTERN) += ipmi_extern.o
 
 hw-obj-$(CONFIG_SERIAL) += serial.o
 hw-obj-$(CONFIG_PARALLEL) += parallel.o
hw/ipmi_extern.c new file +421 -0

421 lines not on this page · raw message

hw/ipmi_extern.h new file +75 -0

75 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#10 lore raw
In reply to [email protected]

I haven't heard anything about these patches. Any comments, good or bad? Has anyone tried these?

Thanks,

-corey

Quoted 28 lines · On 07/02/2012 02:44 PM, [email protected] wrote:

I had asked about getting an IPMI device into qemu and received some interest, and it's useful to me, so I've done some work to add it. The following patch set has a set of patches to add an IPMI KCS device, and IPMI BT device, a built-in BMC (IPMI management controller), and a way to attach an external BMC through a chardev.

There was some discussion on whether to make the BMC internal or external, but I went ahead and added both. The internal one is fairly basic and not extensible, at least without adding code. I've modified the OpenIPMI library simulator to work with the external interface to allow it to receive connections from the qemu external simulator with a fairly basic protocol.

I've also added the ability for the OpenIPMI library to manage a VM to power it on, power it off, reset it, and handle an IPMI watchdog timer. So it looks quite like a real system. Instructions for using it are in the OpenIPMI release candidate I uploaded to
https://sourceforge.net/projects/openipmi

Since IPMI can advertise it's presence via SMBIOS, I added a way for a driver to add an SMBIOS entry. I also added a way to query a free interrupt from the ISA bus, since the interrupt is in the SMBIOS entry and nobody really cares which one is used.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw
Quoted 2 lines · Corey Minyard

I haven't heard anything about these patches. Any comments, good or bad? Has anyone tried these?

You really ought to post this to the qemu-devel mailing list, since that's where the majority of QEMU developers hang out. This KVM list is primarily for KVM specific development tasks in QEMU.

Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|