smbios: Add a function to directly add an entry
PATCH 10/16 qom: release previous object when setting
In reply to [email protected]From: Corey Minyard <[email protected]>
When setting an object, if you don't release the previous object that was there, it may become unusable. This change allows a chardev to be removed from one object's properties and added to another's.
--- qom/object.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
qom/object.c +2 -0
@@ -731,6 +731,8 @@ void object_property_set(Object *obj, Visitor *v, const char *name,if (!prop->set) {error_set (errp,QERR_PERMISSION_DENIED ); }else { +if (prop->release) + prop->release (obj, name, prop->opaque); prop->set (obj, v, prop->opaque, name, errp); } }
Signature · 1 line
1.7.4.1
PATCH 7/16 qemu-char: remove free of chr from win_stdio_close
In reply to [email protected]From: Corey Minyard <[email protected]>
This will result in a double free on close, because it's freed in qemu_chr_delete() right after calling the close function.
--- qemu-char.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
qemu-char.c +0 -1
@@ -1946,7 +1946,6 @@ static void win_stdio_close(CharDriverState *chr) }g_free (chr->opaque); -g_free (chr); stdio_nb_clients--; }
Signature · 1 line
1.7.4.1
PATCH 15/16 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 | 1528 ++++++++++++++++++++++++++++++++++++ 4 files changed, 1531 insertions(+), 0 deletions(-) create mode 100644 hw/ipmi_sim.c
default-configs/i386-softmmu.mak +1 -0
@@ -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
@@ -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
@@ -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 +1528 -0
1,528 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 2/16 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 | 24 ++++++++++++++---------- hw/pc.h | 11 ++++++----- hw/pc_piix.c | 12 ++++++++---- 3 files changed, 28 insertions(+), 19 deletions(-)
hw/pc.c +14 -10
@@ -970,21 +970,13 @@ 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, +void pc_memory_init (MemoryRegion *system_memory,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 +6 -5
@@ -106,14 +106,15 @@ void pc_register_ferr_irq(qemu_irq irq);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, +void pc_memory_init (MemoryRegion *system_memory,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
@@ -178,10 +178,8 @@ static void pc_init1(MemoryRegion *system_memory,/* allocate ram and load rom/bios */ if (!xen_enabled ()) { - fw_cfg =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));
@@ -275,6 +273,12 @@ static void pc_init1(MemoryRegion *system_memory,pci_create_simple (pci_bus, piix3_devfn +2 ,"piix3-usb-uhci" ); } +if (!xen_enabled ()) { + fw_cfg =pc_bios_init (kernel_filename, kernel_cmdline, + initrd_filename, below_4g_mem_size, + pci_enabled ? rom_memory : system_memory); + } +if (pci_enabled && acpi_enabled) {i2c_bus *smbus;
Signature · 1 line
1.7.4.1
PATCH 1/16 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
@@ -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
@@ -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
PATCH 3/16 vl: Move init_timer_alarm() earlier
From: Corey Minyard <[email protected]>
The timers may be used in initialization, so move them earlier so they are ready. A reconnect options will be added to qemu-char, and it uses a timer, but the timer alarm wasn't initialized yet.
--- vl.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
vl.c +5 -5
@@ -3245,6 +3245,11 @@ int main(int argc, char **argv, char **envp)qemu_set_version (machine->hw_version); } +if (init_timer_alarm () <0 ) { +fprintf (stderr,"could not initialize alarm timer\n" ); +exit (1 ); + } +/* Init CPU def lists, based on config * - Must be called after all the qemu_read_config_file() calls * - Must be called before list_cpus()
@@ -3422,11 +3427,6 @@ int main(int argc, char **argv, char **envp)os_set_line_buffering (); -if (init_timer_alarm () <0 ) { -fprintf (stderr,"could not initialize alarm timer\n" ); -exit (1 ); - } -#ifdef CONFIG_SPICE /* spice needs the timers to be initialized by this point */ qemu_spice_init ();
Signature · 1 line
1.7.4.1
PATCH 14/16 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 | 354 ++++++++++++++++++++++++++++++++++++ 4 files changed, 357 insertions(+), 0 deletions(-) create mode 100644 hw/ipmi_bt.c
default-configs/i386-softmmu.mak +1 -0
@@ -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
@@ -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
@@ -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 +354 -0
354 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 5/16 qemu-char: Allow a chardev to reconnect if disconnected
In reply to [email protected]From: Corey Minyard <[email protected]>
Allow a socket that connects to reconnect on a periodic basis if it fails to connect at startup or if the connection drops while in use.
--- qemu-char.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++---- qemu-char.h | 4 ++++ qemu-config.c | 3 +++ qemu-options.hx | 11 ++++++++--- 4 files changed, 65 insertions(+), 7 deletions(-)
qemu-char.c +50 -4
@@ -111,9 +111,15 @@ void qemu_chr_be_event(CharDriverState *s, int event)/* Keep track if the char device is open */ switch (event) {case CHR_EVENT_OPENED : +if (s->recon_timer) +qemu_del_timer (s->recon_timer); s->opened =1 ;break ;case CHR_EVENT_CLOSED : +if (s->recon_timer) +qemu_mod_timer (s->recon_timer, + (qemu_get_clock_ns (vm_clock) + + (s->recon_time *1000000000ULL ))); s->opened =0 ;break ; }
@@ -2726,6 +2732,19 @@ static const struct {#endif }; +static void recon_timeout (void *opaque) +{ +CharDriverState *chr = opaque; + +if (chr->opened) +return ; + +qemu_mod_timer (chr->recon_timer, + (qemu_get_clock_ns (vm_clock) + + (chr->recon_time *1000000000ULL ))); + backend_table[chr->backend].open (chr, chr->opts); +} +CharDriverState *qemu_chr_new_from_opts (QemuOpts *opts,void (*init)(struct CharDriverState *s)) {
@@ -2753,11 +2772,36 @@ CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts, } chr =g_malloc0 (sizeof (CharDriverState)); + + chr->backend = i; +if ((chr->recon_time =qemu_opt_get_number (opts,"reconnect" ,0 ))) { +if (strcmp (qemu_opt_get (opts,"backend" ),"socket" ) !=0 ) { +g_free (chr); +fprintf (stderr,"chardev: reconnect only supported on sockets\n" ); +return NULL ; + } +if (qemu_opt_get_bool (opts,"server" ,0 )) { +g_free (chr); +fprintf (stderr,"chardev: server device cannot reconnect\n" ); +return NULL ; + } + chr->opts = opts; + chr->recon_timer =qemu_new_timer_ns (vm_clock, recon_timeout, chr); + +/* Make sure it connects in time. */ +qemu_mod_timer (chr->recon_timer, + (qemu_get_clock_ns (vm_clock) + + (chr->recon_time *1000000000ULL ))); + } +if (!backend_table[i].open (chr, opts)) { -g_free (chr); -fprintf (stderr,"chardev: opening backend \"%s\" failed\n" , -qemu_opt_get (opts,"backend" )); -return NULL ; +if (!chr->recon_time) { +/* Reconnect is not enabled, give up */ +g_free (chr); +fprintf (stderr,"chardev: opening backend \"%s\" failed\n" , +qemu_opt_get (opts,"backend" )); +return NULL ; + } }if (!chr->filename)
@@ -2829,6 +2873,8 @@ void qemu_chr_delete(CharDriverState *chr)QTAILQ_REMOVE (&chardevs, chr, next);if (chr->chr_close) chr->chr_close (chr); +if (chr->recon_timer) +qemu_free_timer (chr->recon_timer);g_free (chr->filename);g_free (chr->label);g_free (chr);
qemu-char.h +4 -0
@@ -75,6 +75,10 @@ struct CharDriverState {int opened;int avail_connections;QTAILQ_ENTRY (CharDriverState) next; +int backend; +QemuOpts *opts; +QEMUTimer *recon_timer; +uint64_t recon_time; };/**
qemu-config.c +3 -0
@@ -209,6 +209,9 @@ static QemuOptsList qemu_chardev_opts = { .name = "mux", .type = QEMU_OPT_BOOL, },{ + .name = "reconnect", + .type = QEMU_OPT_NUMBER, + },{ .name = "signal", .type = QEMU_OPT_BOOL, },{
qemu-options.hx +8 -3
@@ -1620,8 +1620,9 @@ DEFHEADING(Character device options:) DEF("chardev", HAS_ARG, QEMU_OPTION_chardev, "-chardev null,id=id[,mux=on|off]\n" "-chardev socket,id=id[,host=host],port=host[,to=to][,ipv4][,ipv6][,nodelay]\n" - " [,server][,nowait][,telnet][,mux=on|off] (tcp)\n" - "-chardev socket,id=id,path=path[,server][,nowait][,telnet],[mux=on|off] (unix)\n" + " [,server][,nowait][,telnet][,mux=on|off][,reconnect=seconds] (tcp)\n" + "-chardev socket,id=id,path=path[,server][,nowait][,telnet][,mux=on|off]\n" + " [,reconnect=seconds] (unix)\n" "-chardev udp,id=id[,host=host],port=port[,localaddr=localaddr]\n" " [,localport=localport][,ipv4][,ipv6][,mux=on|off]\n" "-chardev msmouse,id=id[,mux=on|off]\n"
@@ -1690,7 +1691,7 @@ Options to each backend are described below. A void device. This device will not emit any data, and will drop any data it receives. The null backend does not take any options. -@item -chardev socket ,id=@var{id} [@var{TCP options} or @var{unix options}] [,server] [,nowait] [,telnet] +@item -chardev socket ,id=@var{id} [@var{TCP options} or @var{unix options}] [,server] [,nowait] [,telnet] [,reconnect=@var{seconds}] Create a two-way stream socket, which can be either a TCP or a unix socket. A unix socket will be created if @option{path} is specified. Behaviour is
@@ -1704,6 +1705,10 @@ connect to a listening socket. @option{telnet} specifies that traffic on the socket should interpret telnet escape sequences. +@option{reconnect} specifies that if the socket does not come up at startup, +or if the socket is closed for some reason (like the other end exited), +wait the given number of seconds and attempt to reconnect. + TCP and unix socket options are given below: @table @option
Signature · 1 line
1.7.4.1
PATCH 16/16 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 | 479 ++++++++++++++++++++++++++++++++++++ 4 files changed, 482 insertions(+), 0 deletions(-) create mode 100644 hw/ipmi_extern.c
default-configs/i386-softmmu.mak +1 -0
@@ -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
@@ -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
@@ -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 +479 -0
479 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 4/16 qemu-char: Allocate CharDriverState in qemu_chr_new_from_opts
In reply to [email protected]From: Corey Minyard <[email protected]>
This allocates the CharDriverState structure in a more logical place. It reduces code size and it allows a coming option to automatically attempt to reconnect a chardev if the connection fails.
--- console.c | 9 +---- console.h | 2 +- hw/baum.c | 6 +-- hw/baum.h | 2 +- hw/msmouse.c | 5 +-- hw/msmouse.h | 2 +- qemu-char.c | 93 +++++++++++++++++++++------------------------------- spice-qemu-char.c | 4 +-- ui/qemu-spice.h | 2 +- 9 files changed, 48 insertions(+), 77 deletions(-)
console.c +2 -7
@@ -1513,15 +1513,12 @@ static void text_console_do_init(CharDriverState *chr, DisplayState *ds) chr->init (chr); } -CharDriverState *text_console_init (QemuOpts *opts) +CharDriverState *text_console_init (CharDriverState *chr,QemuOpts *opts) { -CharDriverState *chr;TextConsole *s;unsigned width;unsigned height; - chr =g_malloc0 (sizeof (CharDriverState)); - width =qemu_opt_get_number (opts,"width" ,0 );if (width ==0 ) width =qemu_opt_get_number (opts,"cols" ,0 ) *FONT_WIDTH ;
@@ -1536,10 +1533,8 @@ CharDriverState *text_console_init(QemuOpts *opts) s =new_console (NULL ,TEXT_CONSOLE_FIXED_SIZE ); } -if (!s) { -g_free (chr); +if (!s)return NULL ; - } s->chr = chr; s->g_width = width;
console.h +1 -1
@@ -359,7 +359,7 @@ void vga_hw_text_update(console_ch_t *chardata);int is_graphic_console (void );int is_fixedsize_console (void ); -CharDriverState *text_console_init (QemuOpts *opts); +CharDriverState *text_console_init (CharDriverState *chr,QemuOpts *opts);void text_consoles_set_display (DisplayState *ds);void console_select (unsigned int index);void console_color_init (DisplayState *ds);
hw/baum.c +2 -4
@@ -562,10 +562,9 @@ static void baum_close(struct CharDriverState *chr)g_free (baum); } -CharDriverState *chr_baum_init (QemuOpts *opts) +CharDriverState *chr_baum_init (CharDriverState *chr,QemuOpts *opts) {BaumDriverState *baum; -CharDriverState *chr;brlapi_handle_t *handle;#ifdef CONFIG_SDL SDL_SysWMinfo info;
@@ -573,7 +572,7 @@ CharDriverState *chr_baum_init(QemuOpts *opts)int tty; baum =g_malloc0 (sizeof (BaumDriverState)); - baum->chr = chr =g_malloc0 (sizeof (CharDriverState)); + baum->chr = chr; chr->opaque = baum; chr->chr_write = baum_write;
@@ -621,7 +620,6 @@ fail:brlapi__closeConnection (handle); fail_handle:g_free (handle); -g_free (chr);g_free (baum);return NULL ; }
hw/baum.h +1 -1
@@ -23,4 +23,4 @@*/ /* char device */ -CharDriverState *chr_baum_init (QemuOpts *opts); +CharDriverState *chr_baum_init (CharDriverState *chr,QemuOpts *opts);
hw/msmouse.c +1 -4
@@ -64,11 +64,8 @@ static void msmouse_chr_close (struct CharDriverState *chr)g_free (chr); } -CharDriverState *qemu_chr_open_msmouse (QemuOpts *opts) +CharDriverState *qemu_chr_open_msmouse (CharDriverState *chr,QemuOpts *opts) { -CharDriverState *chr; - - chr =g_malloc0 (sizeof (CharDriverState)); chr->chr_write = msmouse_chr_write; chr->chr_close = msmouse_chr_close;
hw/msmouse.h +1 -1
@@ -1,2 +1,2 @@/* msmouse.c */ -CharDriverState *qemu_chr_open_msmouse (QemuOpts *opts); +CharDriverState *qemu_chr_open_msmouse (CharDriverState *chr,QemuOpts *opts);
qemu-char.c +38 -55
305 lines not on this page · raw message
spice-qemu-char.c +1 -3
@@ -188,9 +188,8 @@ static void print_allowed_subtypes(void)fprintf (stderr,"\n" ); } -CharDriverState *qemu_chr_open_spice (QemuOpts *opts) +CharDriverState *qemu_chr_open_spice (CharDriverState *chr,QemuOpts *opts) { -CharDriverState *chr;SpiceCharDriver *s;const char * name =qemu_opt_get (opts,"name" );uint32_t debug =qemu_opt_get_number (opts,"debug" ,0 );
@@ -214,7 +213,6 @@ CharDriverState *qemu_chr_open_spice(QemuOpts *opts)return NULL ; } - chr =g_malloc0 (sizeof (CharDriverState)); s =g_malloc0 (sizeof (SpiceCharDriver)); s->chr = chr; s->debug = debug;
ui/qemu-spice.h +1 -1
@@ -45,7 +45,7 @@ int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,void do_info_spice_print (Monitor *mon,const QObject *data);void do_info_spice (Monitor *mon,QObject **ret_data); -CharDriverState *qemu_chr_open_spice (QemuOpts *opts); +CharDriverState *qemu_chr_open_spice (CharDriverState *chr,QemuOpts *opts);#else /* CONFIG_SPICE */ #include "monitor.h"
Signature · 1 line
1.7.4.1
PATCH 6/16 qemu-char: Fix a race reporting opens and closes
In reply to [email protected]From: Corey Minyard <[email protected]>
When an open event is reported, it is done through a bh. But close events are reported immediately. So if an open event is in the bh and a close occurs, an extraneous open happens, which can confuse a user.
To fix this, this patch sets the "opened" flag immediately instead of in the bh handler and checks to make sure the opened flag is set before reporting an open event.
This also modifies the spice code to call qemu_chr_generic_open to report an open, to keep things consistent.
--- qemu-char.c | 17 +++++++++++++++-- spice-qemu-char.c | 6 ++++-- 2 files changed, 19 insertions(+), 4 deletions(-)
qemu-char.c +15 -2
@@ -111,9 +111,12 @@ void qemu_chr_be_event(CharDriverState *s, int event)/* Keep track if the char device is open */ switch (event) {case CHR_EVENT_OPENED : +/* +* See the comment in qemu_chr_generic_open_bh() for why +* 's->opened = 1' is not here. +*/ if (s->recon_timer)qemu_del_timer (s->recon_timer); - s->opened =1 ;break ;case CHR_EVENT_CLOSED :if (s->recon_timer)
@@ -132,13 +135,23 @@ void qemu_chr_be_event(CharDriverState *s, int event)static void qemu_chr_generic_open_bh (void *opaque) {CharDriverState *s = opaque; -qemu_chr_be_event (s,CHR_EVENT_OPENED ); +/* +* Since the "close" event doesn't go through a bh, there is a +* possible race condition if a close comes in after an open, but +* the open is in the bh queue. So we double-check here, and we +* set opened in qemu_chr_generic_open() instead of +* qemu_chr_be_event(). +*/ +if (s->opened) +qemu_chr_be_event (s,CHR_EVENT_OPENED );qemu_bh_delete (s->bh); s->bh =NULL ; }void qemu_chr_generic_open (CharDriverState *s) { +/* See the comment in qemu_chr_generic_open_bh() for why this is here */ + s->opened =1 ;if (s->bh ==NULL ) { s->bh =qemu_bh_new (qemu_chr_generic_open_bh, s);qemu_bh_schedule (s->bh);
spice-qemu-char.c +4 -2
@@ -93,8 +93,10 @@ static void vmc_state(SpiceCharDeviceInstance *sin, int connected)return ; } -qemu_chr_be_event (scd->chr, - connected ?CHR_EVENT_OPENED :CHR_EVENT_CLOSED ); +if (connected) +qemu_chr_generic_open (scd->chr); +else +qemu_chr_be_event (scd->chr,CHR_EVENT_CLOSED ); }static SpiceCharDeviceInterface vmc_interface = {
Signature · 1 line
1.7.4.1
PATCH 11/16 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 | 182 ++++++++++++++++++++++++++++ hw/ipmi.h | 228 ++++++++++++++++++++++++++++++++++++ qemu-doc.texi | 2 + 6 files changed, 416 insertions(+), 0 deletions(-) create mode 100644 hw/ipmi.c create mode 100644 hw/ipmi.h
default-configs/i386-softmmu.mak +1 -0
@@ -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
@@ -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
@@ -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 +182 -0
182 lines not on this page · raw message
hw/ipmi.h new file +228 -0
228 lines not on this page · raw message
qemu-doc.texi +2 -0
@@ -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
Signature · 1 line
1.7.4.1
PATCH 9/16 qdev: Add a pre-firmware init capability
In reply to [email protected]From: Corey Minyard <[email protected]>
Some devices may need to do some firmware-type initialization before the firmware itself is initialized. For instance, any device that adds SMBIOS table entries (like IPMI) will need to do that before the BIOS is initialized.
So add a list of devices that get initialized before the firmware initialization. Since those devices get removed from the list so they don't get initialized twice, convert the qemu_opt_foreach() to use the safe list traversal.
--- hw/pc.c | 2 ++ hw/qdev-monitor.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ hw/qdev.h | 3 +++ qemu-option.c | 4 ++-- 4 files changed, 57 insertions(+), 2 deletions(-)
hw/pc.c +2 -0
@@ -1010,6 +1010,8 @@ void *pc_bios_init(const char *kernel_filename,void *fw_cfg;int linux_boot, i; +qdev_prefw_init_check (); +/* Initialize PC system firmware */ pc_system_firmware_init (rom_memory);
hw/qdev-monitor.c +50 -0
56 lines not on this page · raw message
hw/qdev.h +3 -0
@@ -167,6 +167,9 @@ int qdev_simple_unplug_cb(DeviceState *dev);void qdev_machine_creation_done (void );bool qdev_machine_modified (void ); +void qdev_add_prefw_init (const char *name); +void qdev_prefw_init_check (void ); +qemu_irq qdev_get_gpio_in (DeviceState *dev,int n);void qdev_connect_gpio_out (DeviceState *dev,int n,qemu_irq pin);
qemu-option.c +2 -2
@@ -709,10 +709,10 @@ int qemu_opt_set_bool(QemuOpts *opts, const char *name, bool val)int qemu_opt_foreach (QemuOpts *opts,qemu_opt_loopfunc func,void *opaque,int abort_on_failure) { -QemuOpt *opt; +QemuOpt *opt, *next_opt;int rc =0 ; - QTAILQ_FOREACH(opt, &opts->head, next) { + QTAILQ_FOREACH_SAFE(opt, &opts->head, next, next_opt) { rc =func (opt->name, opt->str, opaque);if (abort_on_failure && rc !=0 )break ;
Signature · 1 line
1.7.4.1
PATCH 8/16 qemu-char: Close fd at end of file
In reply to [email protected]From: Corey Minyard <[email protected]>
The chardev backends that used qemu_chr_open_fd did not get their file descriptors closed at end of file or when the chardev was closed. This could result in a file descriptor leak.
--- qemu-char.c | 29 +++++++++++++++++++++++------ 1 files changed, 23 insertions(+), 6 deletions(-)
qemu-char.c +23 -6
@@ -563,6 +563,7 @@ static int stdio_nb_clients;typedef struct {int fd_in, fd_out;int max_size; +int close_fds_on_close; }FDCharDriver ;
@@ -581,6 +582,18 @@ static int fd_chr_read_poll(void *opaque)return s->max_size; } +static void fd_close_fds (FDCharDriver *s) +{ +if (!s->close_fds_on_close) +return ; + +if ((s->fd_out != s->fd_in) && (s->fd_out !=-1 )) +close (s->fd_out); + s->fd_out =-1 ; +close (s->fd_in); + s->fd_in =-1 ; +} +static void fd_chr_read (void *opaque) {CharDriverState *chr = opaque;
@@ -597,6 +610,7 @@ static void fd_chr_read(void *opaque)if (size ==0 ) {/* FD has been closed. Remove it from the active list. */ qemu_set_fd_handler2 (s->fd_in,NULL ,NULL ,NULL ,NULL ); +fd_close_fds (s);qemu_chr_be_event (chr,CHR_EVENT_CLOSED );return ; }
@@ -626,6 +640,7 @@ static void fd_chr_close(struct CharDriverState *chr)if (display_type ==DT_NOGRAPHIC && s->fd_in ==0 ) { }else {qemu_set_fd_handler2 (s->fd_in,NULL ,NULL ,NULL ,NULL ); +fd_close_fds (s); } }
@@ -635,13 +650,15 @@ static void fd_chr_close(struct CharDriverState *chr)/* open a character device to a unix fd */ static CharDriverState *qemu_chr_open_fd (CharDriverState *chr, -int fd_in,int fd_out) +int fd_in,int fd_out, +int close_fds_on_close) {FDCharDriver *s; s =g_malloc0 (sizeof (FDCharDriver)); s->fd_in = fd_in; s->fd_out = fd_out; + s->close_fds_on_close = close_fds_on_close; chr->opaque = s; chr->chr_write = fd_chr_write; chr->chr_update_read_handler = fd_chr_update_read_handler;
@@ -662,7 +679,7 @@ static CharDriverState *qemu_chr_open_file_out(CharDriverState *chr,if (fd_out <0 ) {return NULL ; } -return qemu_chr_open_fd (chr,-1 , fd_out); +return qemu_chr_open_fd (chr,-1 , fd_out,1 ); }static CharDriverState *qemu_chr_open_pipe (CharDriverState *chr,QemuOpts *opts)
@@ -690,7 +707,7 @@ static CharDriverState *qemu_chr_open_pipe(CharDriverState *chr, QemuOpts *opts)return NULL ; } } -return qemu_chr_open_fd (chr, fd_in, fd_out); +return qemu_chr_open_fd (chr, fd_in, fd_out,1 ); }
@@ -794,7 +811,7 @@ static CharDriverState *qemu_chr_open_stdio(CharDriverState *chr,atexit (term_exit); } -qemu_chr_open_fd (chr,0 ,1 ); +qemu_chr_open_fd (chr,0 ,1 ,0 ); chr->chr_close = qemu_chr_close_stdio; chr->chr_set_echo = qemu_chr_set_echo_stdio;qemu_set_fd_handler2 (0 , stdio_read_poll, stdio_read,NULL , chr);
@@ -1239,7 +1256,7 @@ static CharDriverState *qemu_chr_open_tty(CharDriverState *chr, QemuOpts *opts)return NULL ; }tty_serial_init (fd,115200 ,'N' ,8 ,1 ); -qemu_chr_open_fd (chr, fd, fd); +qemu_chr_open_fd (chr, fd, fd,1 ); chr->chr_ioctl = tty_serial_ioctl; chr->chr_close = qemu_chr_close_tty;return chr;
@@ -2313,7 +2330,7 @@ static void tcp_chr_read(void *opaque)CharDriverState *qemu_chr_open_eventfd (int eventfd) {CharDriverState *chr =g_malloc0 (sizeof (CharDriverState)); -return qemu_chr_open_fd (chr, eventfd, eventfd); +return qemu_chr_open_fd (chr, eventfd, eventfd,0 ); }#endif
Signature · 1 line
1.7.4.1
PATCH 12/16 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 | 156 ++++++++++++++++++++++++++++++++++++ hw/smbios.h | 12 +++ 5 files changed, 171 insertions(+), 0 deletions(-) create mode 100644 hw/isa_ipmi.c
default-configs/i386-softmmu.mak +1 -0
@@ -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
@@ -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
@@ -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 +156 -0
156 lines not on this page · raw message
hw/smbios.h +12 -0
@@ -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
PATCH 13/16 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 | 329 ++++++++++++++++++++++++++++++++++++ 4 files changed, 332 insertions(+), 0 deletions(-) create mode 100644 hw/ipmi_kcs.c
default-configs/i386-softmmu.mak +1 -0
@@ -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
@@ -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
@@ -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 +329 -0
329 lines not on this page · raw message
Signature · 1 line
1.7.4.1
I messed up and didn't get an introduction for these patches. So here goes.
These patches are for adding an IPMI interface to QEMU. It adds a KCS and BT interface; it should be easy to add a SMIC interface if anyone wants that, but it's not often used. For simulation of an IPMI management controller, it is a basic one that is built in to KVM, and it can make a connection to an external simulator.
I think I got all the previous comments handled. Once I realized how the class stuff worked, things made a lot more sense to me.
The OpenIPMI library (openipmi.sf.net) has a simulator that will work as an external simulator in the latest release candidate.
This patch fixes up a few things that the IPMI driver needs:
Allow a driver to add entries to the SMBIOS table.
Add the ability for a chardev that makes an external connection to reconnect if the initial connection fails or if it fails while in use.
In order to move the chardev to the external interface simulator, it had to be released or the add to the external interface failed.
Patches 7 and 8 in the series are not really related, they are things that I saw that seemed to be issues. I meant to pull them out but I forgot. These patches really got accidentally sent, but since they are out, well, they are out.
There are two things that I know of that are still missing:
Documentation. I'm planning to write docs for this, but I don't really see a place to do this. I don't see many other docs for devices. Where should I put them? If it's in qemu-options.hx, where in that file should they be?
Tests. I looked at the test infrastructure, and I don't really see many tests, so not much to go on for examples. I think I have it figured out, but I'll basically have to write a driver to be able to really test this. It would be nice if I could use the Linux driver, but I guess that's not really feasible.
-corey
Re: [Qemu-devel] [PATCH 10/16] qom: release previous object when setting
In reply to [email protected]Il 15/07/2012 22:25, [email protected] ha scritto:
Quoted 16 lines
From: Corey Minyard <[email protected]>
When setting an object, if you don't release the previous object that was there, it may become unusable. This change allows a chardev to be removed from one object's properties and added to another's.
--- qom/object.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)qom/object.c +0
-0
qom/object.c void object_property_set(Object *obj, Visitor *v, const char *name, · line 738
Quoted 8 lines
qom/object.c +2
-0@@ -731,6 +731,8 @@ void object_property_set(Object *obj, Visitor *v, const char *name,if (!prop->set) {error_set (errp,QERR_PERMISSION_DENIED ); }else { +if (prop->release) + prop->release (obj, name, prop->opaque); prop->set (obj, v, prop->opaque, name, errp); } }
... but you need to run scripts/checkpatch.pl on your patches to conform to coding style.
Thanks!
Paolo
Re: [Qemu-devel] [PATCH 12/16] IPMI: Add a PC ISA type structure
In reply to [email protected]Il 15/07/2012 22:25, [email protected] ha scritto:
Quoted 7 lines
hw/isa_ipmi.c new file +7
-0+/* Clear the property from this device so we can put it elsewhere */ + chr = isa->chr; +qdev_prop_set_chr (&dev->qdev,"chardev" ,NULL ); + +if (chr) { + bdev =qdev_create (NULL ,"ipmi-bmc-extern" ); +qdev_prop_set_chr (bdev,"chardev" , chr);
hw/isa_ipmi.c line 75
Quoted 10 lines
hw/isa_ipmi.c new file +10
-0+ }else { + bdev =qdev_create (NULL ,"ipmi-bmc-sim" ); + } +snprintf (typename,sizeof (typename),"ipmi-interface-%s" , isa->interface); + idev =qdev_create (&isa_bus->qbus, typename); +qdev_prop_set_ptr (bdev,"ipmiif" , idev); +qdev_prop_set_uint64 (idev,"iobase" , isa->iobase); +qdev_prop_set_ptr (idev,"bmc" , bdev); +qdev_prop_set_uint8 (idev,"slave-addr" , isa->slave_addr); + rc =qdev_init (idev);
I think this is adding a bit of extra complication. You do not need to add explicit devices for this.
If you want to make ipmi-bmc-* and ipmi-interface-* objects, you can create them with object_new, set the properties manually with the returned pointer and add the object to the parent with object_property_add_child.
Otherwise, it should also be fine if you just add them as function pointers.
Either way also lets you keep the ownership of the chardev in the ISA IPMI device, and avoids that "info qtree" looks strange and does not show the chardev you assigned.
Paolo
Quoted 7 lines · On 07/15/2012 02:24 PM, [email protected] wrote:
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.
Quoted 5 lines
Signed-off-by Corey Minyard <[email protected]>--- hw/smbios.c | 27 +++++++++++++++++++++++++++ hw/smbios.h | 15 ++++++++------- 2 files changed, 35 insertions(+), 7 deletions(-)
Are you planning to expose this via the command line? Libvirt would like the ability to set arbitrary name/value pairs in SMBIOS (such as asset tag in the type 3 page), rather than the current limitation of only being able to set pre-defined names in just type 0 and 1 sections.
Signature · 2 lines
Eric Blake [email protected] +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 13 lines · Eric Blake
Quoted 7 lines · On 07/15/2012 02:24 PM, [email protected] wrote:
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.
Quoted 5 lines
Signed-off-by Corey Minyard <[email protected]>--- hw/smbios.c | 27 +++++++++++++++++++++++++++ hw/smbios.h | 15 ++++++++------- 2 files changed, 35 insertions(+), 7 deletions(-)
Quoted 5 lines
Are you planning to expose this via the command line? Libvirt would like the ability to set arbitrary name/value pairs in SMBIOS (such as asset tag in the type 3 page), rather than the current limitation of only being able to set pre-defined names in just type 0 and 1 sections.
Well, I wan't planning on it, I only did what I needed for IPMI. Adding a command line interface would be more learning that I can probably afford right now.
-corey
Re: [Qemu-devel] [PATCH 10/16] qom: release previous object when setting
In reply to Paolo BonziniQuoted 27 lines · Paolo Bonzini
Il 15/07/2012 22:25, [email protected] ha scritto:
Quoted 16 lines
From: Corey Minyard <[email protected]>
When setting an object, if you don't release the previous object that was there, it may become unusable. This change allows a chardev to be removed from one object's properties and added to another's.
--- qom/object.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)qom/object.c +0
-0qom/object.c void object_property_set(Object *obj, Visitor *v, const char *name, · line 738
Quoted 8 lines
qom/object.c +2
-0@@ -731,6 +731,8 @@ void object_property_set(Object *obj, Visitor *v, const char *name,if (!prop->set) {error_set (errp,QERR_PERMISSION_DENIED ); }else { +if (prop->release) + prop->release (obj, name, prop->opaque); prop->set (obj, v, prop->opaque, name, errp); } }Acked-by Paolo Bonzini <[email protected]>
Quoted 2 lines
... but you need to run
scripts/checkpatch.plon your patches to conform to coding style.
Ok. I'm running everything through the script. I didn't realize the coding standard was that different from Linux.
Thanks,
-corey
Re: [Qemu-devel] [PATCH 12/16] IPMI: Add a PC ISA type structure
In reply to Paolo BonziniQuoted 12 lines · Paolo Bonzini
Il 15/07/2012 22:25, [email protected] ha scritto:
Quoted 11 lines
hw/isa_ipmi.c new file +11
-0+/* Clear the property from this device so we can put it elsewhere */ + chr = isa->chr; +qdev_prop_set_chr (&dev->qdev,"chardev" ,NULL ); + +if (chr) { + bdev =qdev_create (NULL ,"ipmi-bmc-extern" ); +qdev_prop_set_chr (bdev,"chardev" , chr); + }else { + bdev =qdev_create (NULL ,"ipmi-bmc-sim" ); + } +snprintf (typename,sizeof (typename),"ipmi-interface-%s" , isa->interface);
Quoted 8 lines
hw/isa_ipmi.c line 75
Quoted 6 lines
hw/isa_ipmi.c new file +6
-0+ idev =qdev_create (&isa_bus->qbus, typename); +qdev_prop_set_ptr (bdev,"ipmiif" , idev); +qdev_prop_set_uint64 (idev,"iobase" , isa->iobase); +qdev_prop_set_ptr (idev,"bmc" , bdev); +qdev_prop_set_uint8 (idev,"slave-addr" , isa->slave_addr); + rc =qdev_init (idev);I think this is adding a bit of extra complication. You do not need to add explicit devices for this.
Yeah, but the qdevs did a lot of nice things for me :). But I understand.
Quoted 5 lines
If you want to make ipmi-bmc-* and ipmi-interface-* objects, you can create them with
object_new, set the properties manually with the returned pointer and add the object to the parent withobject_property_add_child.
The main reason I went with qdevs originally was because all the properties are defined for qdevs. I'd have to do all my own properties otherwise.
However, I think all the properties are represented by what is already there in isa-ipmi, so just having pointers to the interface and bmc objects is ok, I think.
Quoted 6 lines
Otherwise, it should also be fine if you just add them as function pointers.
Either way also lets you keep the ownership of the chardev in the ISA IPMI device, and avoids that "info qtree" looks strange and does not show the chardev you assigned.
Yeah, I see that now. Makes sense.
BTW, where do you want me to document this? I didn't see an obvious place in qemu-options.hx.
I'm working on tests, too. I didn't find much there already, but I'll see what I can add.
Thanks,
-corey