Add Q35 base support
v4 cover Add Q35 base support
Hi,
These patches are intened to give us a base set of patches for Q35 upon which to build. The major change in this series is to add the memory controller hub, or 'mch' as proper member of the q35 host structure. This change refactors the code a bit, and moves more intialization out of pc_q35.c and into q35.c. We probably could go further and introduce a generic north bridge class and make the 'mch' a child of it, but I'm not proposing that kind of change this late in the development cycle.
I've also dropped as many non-essential bits as possible, such as if=ahci from the patch series. Patches 13-14 allow the use of the '-L' option to specify the directory of the q35 dsdt table. These aren't strictly necessary. As one could pass:
-bios /root/seabios/seabios/out/bios.bin -acpitable file=/root/seabios/seabios/out/q35-acpi-dsdt.aml
But its rather cumbersome, and including the automatic load of the dsdt table, is the future direction. That is, once the seabios bits are included we can pull the q35 dsdt table into the qemu tree, and avoid extra options altogether.
Testing:
I've booted f16, f17, Windows7, Windows 8. (BSDs and Win xp work with a piix3-ide controller). And Gabriel Somlo has reported success with Mac OS X. I'm also going to look at writing qtest cases.
Thanks,
-Jason
Git trees:
git://github.com/jibaron/q35-qemu.gitgit://github.com/jibaron/q35-seabios.git
Todo:
-add ahci migration back (need to cover more fields, but basically works) -add ACPI hotplug support (pcie hotplug is currently working) -add qtest test cases
Changes from v3:
-Compose 'mch' as part of the q35 host strucuture -cleanup naming
-drop if=ahci
Changes from v2:
-Patch restructure (broke out ich9 chips + data structures separately) -added passthrough support
-add support for -usb to fill out host pci bus
-Dropped automatic load of dsdt table for piix
-cleanups
-dropped wmask on smbus (mst)
-sparse host bus
Changes from v1:
-Updated end of low mem from 0xe0000000 -> 0xb0000000 (Gerd Hoffmann)
-so 0xb000000-0xc000000 is memconfig
-0xc000000-0xfec00000 is 32-bit pci window -style/various cleanups
-introduced IF_AHCI
-introduced mach_if
-split dsdt out of bios, now passed for piix4 as well (Paolo, Gerd) -Removed add opaque argument to pci_map_irq_fn (Michael S. Tsirkin) -removed patches that were merged in v1
Isaku Yamahata (3):
pc, pc_piix: split out pc nic initialization
pc/piix_pci: factor out smram/pam logic
q35: Introduce q35 pc based chipset emulator
Jan Kiszka (3):
q35: Suppress SMM BIOS initialization under KVM
q35: Fix non-PCI IRQ processing in ich9_lpc_update_apic
q35: Add kvmclock support
Jason Baron (8):
pc: Move ioapic_init() from pc_piix.c to pc.c
pc_piix: Move kvm irq routing functions out of pc_piix.c
ich9: Add acpi support and definitions
ich9: Add the lpc chip
ich9: Add smbus
ich9: Add i82801b11 dmi-to-pci bridge
Add a fallback bios file search, if -L fails.
q35: automatically load the q35 dsdt table
hw/Makefile.objs | 3 + hw/acpi_ich9.c | 322 ++++++++++++++++++++++++++++++ hw/acpi_ich9.h | 47 +++++ hw/i386/Makefile.objs | 1 + hw/i82801b11.c | 125 ++++++++++++ hw/ich9.h | 207 +++++++++++++++++++ hw/kvm/ioapic.c | 40 ++++ hw/lpc_ich9.c | 525 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/pam.c | 87 ++++++++ hw/pam.h | 97 +++++++++ hw/pc.c | 58 ++++++ hw/pc.h | 5 + hw/pc_piix.c | 79 +------- hw/pc_q35.c | 230 +++++++++++++++++++++ hw/pci_ids.h | 14 ++ hw/piix_pci.c | 68 ++----- hw/q35.c | 309 +++++++++++++++++++++++++++++ hw/q35.h | 150 ++++++++++++++ hw/smbus_ich9.c | 159 +++++++++++++++ kvm.h | 2 + vl.c | 36 +++- 21 files changed, 2425 insertions(+), 139 deletions(-) create mode 100644 hw/acpi_ich9.c create mode 100644 hw/acpi_ich9.h create mode 100644 hw/i82801b11.c create mode 100644 hw/ich9.h create mode 100644 hw/lpc_ich9.c create mode 100644 hw/pam.c create mode 100644 hw/pam.h create mode 100644 hw/pc_q35.c create mode 100644 hw/q35.c create mode 100644 hw/q35.h create mode 100644 hw/smbus_ich9.c
PATCH v4 1/14 pc, pc_piix: split out pc nic initialization
From: Isaku Yamahata <[email protected]>
Factor out pc nic initialization.
This simplifies the pc initialization and will reduce the code duplication of q35 pc initialization.
--- hw/pc.c | 15 +++++++++++++++ hw/pc.h | 1 + hw/pc_piix.c | 9 +-------- 3 files changed, 17 insertions(+), 8 deletions(-)
hw/pc.c +15 -0
@@ -1058,6 +1058,21 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, *floppy =fdctrl_init_isa (isa_bus, fd); } +void pc_nic_init (ISABus *isa_bus,PCIBus *pci_bus) +{ +int i; + +for (i =0 ; i < nb_nics; i++) { +NICInfo *nd = &nd_table[i]; + +if (!pci_bus || (nd->model &&strcmp (nd->model,"ne2k_isa" ) ==0 )) { +pc_init_ne2k_isa (isa_bus, nd); + }else { +pci_nic_init_nofail (nd,"e1000" ,NULL ); + } + } +} +void pc_pci_device_init (PCIBus *pci_bus) {int max_bus;
hw/pc.h +1 -0
@@ -98,6 +98,7 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,const char *boot_device, ISADevice *floppy, BusState *ide0, BusState *ide1, ISADevice *s); +void pc_nic_init (ISABus *isa_bus,PCIBus *pci_bus);void pc_pci_device_init (PCIBus *pci_bus);typedef void (*cpu_set_smm_t )(int smm,void *arg);
hw/pc_piix.c +1 -8
@@ -234,14 +234,7 @@ static void pc_init1(MemoryRegion *system_memory,/* init basic PC hardware */ pc_basic_device_init (isa_bus, gsi, &rtc_state, &floppy,xen_enabled ()); -for (i =0 ; i < nb_nics; i++) { -NICInfo *nd = &nd_table[i]; - -if (!pci_enabled || (nd->model &&strcmp (nd->model,"ne2k_isa" ) ==0 )) -pc_init_ne2k_isa (isa_bus, nd); -else -pci_nic_init_nofail (nd,"e1000" ,NULL ); - } +pc_nic_init (isa_bus, pci_bus);ide_drive_get (hd,MAX_IDE_BUS );if (pci_enabled) {
Signature · 1 line
1.7.1
PATCH v4 2/14 pc: Move ioapic_init() from pc_piix.c to pc.c
In reply to Jason BaronFrom: Jason Baron <[email protected]>
Move ioapic_init() from pc_piix.c to pc.c, to make it a common function. Rename ioapic_init() -> ioapic_init_gsi().
Move to pc.h so q35 can use them as well.
--- hw/pc.c | 24 ++++++++++++++++++++++++ hw/pc.h | 2 ++ hw/pc_piix.c | 25 +------------------------ 3 files changed, 27 insertions(+), 24 deletions(-)
hw/pc.c +24 -0
@@ -1083,3 +1083,27 @@ void pc_pci_device_init(PCIBus *pci_bus)pci_create_simple (pci_bus,-1 ,"lsi53c895a" ); } } + +void ioapic_init_gsi (GSIState *gsi_state,const char *parent_name) +{ +DeviceState *dev; +SysBusDevice *d; +unsigned int i; + +if (kvm_irqchip_in_kernel ()) { + dev =qdev_create (NULL ,"kvm-ioapic" ); + }else { + dev =qdev_create (NULL ,"ioapic" ); + } +if (parent_name) { +object_property_add_child (object_resolve_path (parent_name,NULL ), +"ioapic" ,OBJECT (dev),NULL ); + } +qdev_init_nofail (dev); + d =sysbus_from_qdev (dev); +sysbus_mmio_map (d,0 ,0xfec00000 ); + +for (i =0 ; i <IOAPIC_NUM_PINS ; i++) { + gsi_state->ioapic_irq[i] =qdev_get_gpio_in (dev, i); + } +}
hw/pc.h +2 -0
@@ -104,6 +104,8 @@ void pc_pci_device_init(PCIBus *pci_bus);typedef void (*cpu_set_smm_t )(int smm,void *arg);void cpu_smm_register (cpu_set_smm_t callback,void *arg); +void ioapic_init_gsi (GSIState *gsi_state,const char *parent_name); +/* acpi.c */ extern int acpi_enabled;extern char *acpi_tables;
hw/pc_piix.c +1 -24
@@ -95,29 +95,6 @@ static void kvm_piix3_gsi_handler(void *opaque, int n, int level) } } -static void ioapic_init (GSIState *gsi_state) -{ -DeviceState *dev; -SysBusDevice *d; -unsigned int i; - -if (kvm_irqchip_in_kernel ()) { - dev =qdev_create (NULL ,"kvm-ioapic" ); - }else { - dev =qdev_create (NULL ,"ioapic" ); - } -/* FIXME: this should be under the piix3. */ -object_property_add_child (object_resolve_path ("i440fx" ,NULL ), -"ioapic" ,OBJECT (dev),NULL ); -qdev_init_nofail (dev); - d =sysbus_from_qdev (dev); -sysbus_mmio_map (d,0 ,0xfec00000 ); - -for (i =0 ; i <IOAPIC_NUM_PINS ; i++) { - gsi_state->ioapic_irq[i] =qdev_get_gpio_in (dev, i); - } -} -/* PC hardware initialisation */ static void pc_init1(MemoryRegion *system_memory, MemoryRegion *system_io,
@@ -221,7 +198,7 @@ static void pc_init1(MemoryRegion *system_memory, gsi_state->i8259_irq[i] = i8259[i]; }if (pci_enabled) { -ioapic_init (gsi_state); +ioapic_init_gsi (gsi_state,"i440fx" ); }pc_register_ferr_irq (gsi[13 ]);
Signature · 1 line
1.7.1
PATCH v4 3/14 pc_piix: Move kvm irq routing functions out of pc_piix.c
In reply to Jason BaronFrom: Jason Baron <[email protected]>
Rename: kvm_piix3_gsi_handlei() -> kvm_pc_gsi_handler()
kvm_piix3_setup_irq_routing() -> kvm_pc_setup_irq_routing()
This is in preparation for other users, namely q35 at this time.
--- hw/kvm/ioapic.c | 40 ++++++++++++++++++++++++++++++++++++++++ hw/pc_piix.c | 45 ++------------------------------------------- kvm.h | 2 ++ 3 files changed, 44 insertions(+), 43 deletions(-)
hw/kvm/ioapic.c +40 -0
@@ -15,6 +15,46 @@#include "hw/apic_internal.h" #include "kvm.h" +/* PC Utility function */ +void kvm_pc_setup_irq_routing (bool pci_enabled) +{ +KVMState *s = kvm_state; +int i; + +if (kvm_check_extension (s,KVM_CAP_IRQ_ROUTING )) { +for (i =0 ; i <8 ; ++i) { +if (i ==2 ) { +continue ; + } +kvm_irqchip_add_irq_route (s, i,KVM_IRQCHIP_PIC_MASTER , i); + } +for (i =8 ; i <16 ; ++i) { +kvm_irqchip_add_irq_route (s, i,KVM_IRQCHIP_PIC_SLAVE , i -8 ); + } +if (pci_enabled) { +for (i =0 ; i <24 ; ++i) { +if (i ==0 ) { +kvm_irqchip_add_irq_route (s, i,KVM_IRQCHIP_IOAPIC ,2 ); + }else if (i !=2 ) { +kvm_irqchip_add_irq_route (s, i,KVM_IRQCHIP_IOAPIC , i); + } + } + } + } +} + +void kvm_pc_gsi_handler (void *opaque,int n,int level) +{ +GSIState *s = opaque; + +if (n <ISA_NUM_IRQS ) { +/* Kernel will forward to both PIC and IOAPIC */ +qemu_set_irq (s->i8259_irq[n], level); + }else { +qemu_set_irq (s->ioapic_irq[n], level); + } +} +typedef struct KVMIOAPICState KVMIOAPICState ;struct KVMIOAPICState {
hw/pc_piix.c +2 -43
57 lines not on this page · raw message
kvm.h +2 -0
@@ -275,4 +275,6 @@ void kvm_irqchip_release_virq(KVMState *s, int virq);int kvm_irqchip_add_irqfd_notifier (KVMState *s,EventNotifier *n,int virq);int kvm_irqchip_remove_irqfd_notifier (KVMState *s,EventNotifier *n,int virq); +void kvm_pc_gsi_handler (void *opaque,int n,int level); +void kvm_pc_setup_irq_routing (bool pci_enabled);#endif
Signature · 1 line
1.7.1
PATCH v4 4/14 pc/piix_pci: factor out smram/pam logic
In reply to Jason BaronFrom: Isaku Yamahata <[email protected]>
Factor out smram/pam logic for use by other chipsets, namely q35 at this point.
Note: Should be factored out into a generic North Bridge Class.
--- hw/Makefile.objs | 1 + hw/pam.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++ hw/pam.h | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ hw/piix_pci.c | 68 ++++++++----------------------------- 4 files changed, 200 insertions(+), 53 deletions(-) create mode 100644 hw/pam.c create mode 100644 hw/pam.h
hw/Makefile.objs +1 -0
@@ -37,6 +37,7 @@ common-obj-$(CONFIG_SMARTCARD) += ccid-card-passthru.o common-obj-$(CONFIG_SMARTCARD_NSS) += ccid-card-emulated.o common-obj-$(CONFIG_I8259) += i8259_common.o i8259.o common-obj-y += fifo.o +common-obj-y += pam.o # PPC devices common-obj-$(CONFIG_PREP_PCI) += prep_pci.o
hw/pam.c new file +87 -0
87 lines not on this page · raw message
hw/pam.h new file +97 -0
97 lines not on this page · raw message
hw/piix_pci.c +15 -53
104 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v4 5/14 ich9: Add acpi support and definitions
In reply to Jason BaronFrom: Jason Baron <[email protected]>
Lay the groundwork for subsequent ich9 support.
--- hw/Makefile.objs | 1 + hw/acpi_ich9.c | 315 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ hw/acpi_ich9.h | 47 ++++++++ hw/ich9.h | 207 +++++++++++++++++++++++++++++++++++ hw/pci_ids.h | 12 ++ 5 files changed, 582 insertions(+), 0 deletions(-) create mode 100644 hw/acpi_ich9.c create mode 100644 hw/acpi_ich9.h create mode 100644 hw/ich9.h
hw/Makefile.objs +1 -0
@@ -38,6 +38,7 @@ common-obj-$(CONFIG_SMARTCARD_NSS) += ccid-card-emulated.o common-obj-$(CONFIG_I8259) += i8259_common.o i8259.o common-obj-y += fifo.o common-obj-y += pam.o +common-obj-y += acpi_ich9.o # PPC devices common-obj-$(CONFIG_PREP_PCI) += prep_pci.o
hw/acpi_ich9.c new file +315 -0
315 lines not on this page · raw message
hw/acpi_ich9.h new file +47 -0
47 lines not on this page · raw message
hw/ich9.h new file +207 -0
207 lines not on this page · raw message
hw/pci_ids.h +12 -0
@@ -36,6 +36,7 @@#define PCI_CLASS_BRIDGE_HOST 0x0600#define PCI_CLASS_BRIDGE_ISA 0x0601#define PCI_CLASS_BRIDGE_PCI 0x0604 +#define PCI_CLASS_BRDIGE_PCI_INF_SUB 0x01#define PCI_CLASS_BRIDGE_OTHER 0x0680#define PCI_CLASS_COMMUNICATION_SERIAL 0x0700
@@ -116,6 +117,17 @@#define PCI_DEVICE_ID_INTEL_82371AB 0x7111#define PCI_DEVICE_ID_INTEL_82371AB_2 0x7112#define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113 + +#define PCI_DEVICE_ID_INTEL_ICH9_0 0x2910 +#define PCI_DEVICE_ID_INTEL_ICH9_1 0x2917 +#define PCI_DEVICE_ID_INTEL_ICH9_2 0x2912 +#define PCI_DEVICE_ID_INTEL_ICH9_3 0x2913 +#define PCI_DEVICE_ID_INTEL_ICH9_4 0x2914 +#define PCI_DEVICE_ID_INTEL_ICH9_5 0x2919 +#define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930 +#define PCI_DEVICE_ID_INTEL_ICH9_7 0x2916 +#define PCI_DEVICE_ID_INTEL_ICH9_8 0x2918 +#define PCI_DEVICE_ID_INTEL_82801I_UHCI1 0x2934#define PCI_DEVICE_ID_INTEL_82801I_UHCI2 0x2935#define PCI_DEVICE_ID_INTEL_82801I_UHCI3 0x2936
Signature · 1 line
1.7.1
PATCH v4 6/14 ich9: Add the lpc chip
In reply to Jason BaronFrom: Jason Baron <[email protected]>
Add support for the ICH9 LPC chip.
--- hw/i386/Makefile.objs | 1 + hw/lpc_ich9.c | 523 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 524 insertions(+), 0 deletions(-) create mode 100644 hw/lpc_ich9.c
hw/i386/Makefile.objs +1 -0
@@ -6,6 +6,7 @@ obj-y += pci-hotplug.o smbios.o wdt_ib700.o obj-y += debugcon.o multiboot.o obj-y += pc_piix.o obj-y += pc_sysfw.o +obj-y += lpc_ich9.o obj-$(CONFIG_XEN) += xen_platform.o xen_apic.o obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_msi.o
hw/lpc_ich9.c new file +523 -0
523 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v4 7/14 ich9: Add smbus
In reply to Jason BaronFrom: Jason Baron <[email protected]>
Add support for the ich9 smbus chip.
--- hw/Makefile.objs | 2 +- hw/smbus_ich9.c | 159 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 160 insertions(+), 1 deletions(-) create mode 100644 hw/smbus_ich9.c
hw/Makefile.objs +1 -1
@@ -38,7 +38,7 @@ common-obj-$(CONFIG_SMARTCARD_NSS) += ccid-card-emulated.o common-obj-$(CONFIG_I8259) += i8259_common.o i8259.o common-obj-y += fifo.o common-obj-y += pam.o -common-obj-y += acpi_ich9.o +common-obj-y += acpi_ich9.o smbus_ich9.o # PPC devices common-obj-$(CONFIG_PREP_PCI) += prep_pci.o
hw/smbus_ich9.c new file +159 -0
159 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v4 8/14 q35: Introduce q35 pc based chipset emulator
In reply to Jason BaronFrom: Isaku Yamahata <[email protected]>
pc q35 based chipset emulator to support pci express natively. Based on Anthony Liguori's suggestion, the machine name is 'q35-next', with an alias of 'q35'. At this point, there are no compatibility guarantees. When the chipset stabilizes more, we will begin to version the machine names.
Major features which still need to be added:
-Migration support (mostly around ahci)
-ACPI hotplug support (pcie hotplug support is working) -Passthrough support
--- hw/i386/Makefile.objs | 2 +- hw/pc_q35.c | 220 +++++++++++++++++++++++++++++++++++ hw/pci_ids.h | 2 + hw/q35.c | 309 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/q35.h | 150 ++++++++++++++++++++++++ 5 files changed, 682 insertions(+), 1 deletions(-) create mode 100644 hw/pc_q35.c create mode 100644 hw/q35.c create mode 100644 hw/q35.h
hw/i386/Makefile.objs +1 -1
@@ -6,7 +6,7 @@ obj-y += pci-hotplug.o smbios.o wdt_ib700.o obj-y += debugcon.o multiboot.o obj-y += pc_piix.o obj-y += pc_sysfw.o -obj-y += lpc_ich9.o +obj-y += lpc_ich9.o q35.o pc_q35.o obj-$(CONFIG_XEN) += xen_platform.o xen_apic.o obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_msi.o
hw/pc_q35.c new file +220 -0
220 lines not on this page · raw message
hw/pci_ids.h +2 -0
@@ -138,6 +138,8 @@#define PCI_DEVICE_ID_INTEL_82801I_EHCI2 0x293c#define PCI_DEVICE_ID_INTEL_82599_SFP_VF 0x10ed +#define PCI_DEVICE_ID_INTEL_Q35_MCH 0x29c0 +#define PCI_VENDOR_ID_XEN 0x5853#define PCI_DEVICE_ID_XEN_PLATFORM 0x0001
hw/q35.c new file +309 -0
309 lines not on this page · raw message
hw/q35.h new file +150 -0
150 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v4 9/14 ich9: Add i82801b11 dmi-to-pci bridge
In reply to Jason BaronFrom: Jason Baron <[email protected]>
Add the dmi-to-pci i82801b11 bridge chip. This is the pci bridge chip that q35 uses on its host bus for PCI bus arbitration.
--- hw/Makefile.objs | 1 + hw/i82801b11.c | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+), 0 deletions(-) create mode 100644 hw/i82801b11.c
hw/Makefile.objs +1 -0
@@ -9,6 +9,7 @@ common-obj-$(CONFIG_PCI) += shpc.o common-obj-$(CONFIG_PCI) += slotid_cap.o common-obj-$(CONFIG_PCI) += pci_host.o pcie_host.o common-obj-$(CONFIG_PCI) += ioh3420.o xio3130_upstream.o xio3130_downstream.o +common-obj-$(CONFIG_PCI) += i82801b11.o common-obj-y += watchdog.o common-obj-$(CONFIG_ISA_MMIO) += isa_mmio.o common-obj-$(CONFIG_ECC) += ecc.o
hw/i82801b11.c new file +125 -0
125 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v4 10/14 q35: Suppress SMM BIOS initialization under KVM
In reply to Jason BaronFrom: Jan Kiszka <[email protected]>
Same as for i44fx: KVM does not support SMM yet. Signal it initialized to Seabios to avoid failures.
--- hw/acpi_ich9.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
hw/acpi_ich9.c +7 -0
@@ -28,6 +28,7 @@#include "qemu-timer.h" #include "sysemu.h" #include "acpi.h" +#include "kvm.h" #include "ich9.h"
@@ -292,6 +293,12 @@ static void pm_reset(void *opaque)acpi_pm_tmr_reset (&pm->acpi_regs);acpi_gpe_reset (&pm->acpi_regs); +if (kvm_enabled ()) { +/* Mark SMM as already inited to prevent SMM from running. KVM does not +* support SMM mode. */ + pm->smi_en |=ICH9_PMIO_SMI_EN_APMC_EN ; + } +pm_update_sci (pm); }
Signature · 1 line
1.7.1
PATCH v4 11/14 q35: Fix non-PCI IRQ processing in ich9_lpc_update_apic
In reply to Jason BaronFrom: Jan Kiszka <[email protected]>
Avoid passing a non-PCI IRQ to ich9_gsi_to_pirq. It's wrong and triggers an assertion.
--- hw/lpc_ich9.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
hw/lpc_ich9.c +4 -2
@@ -264,9 +264,11 @@ static int ich9_gsi_to_pirq(int gsi)static void ich9_lpc_update_apic (ICH9LPCState *lpc,int gsi) { -int level; +int level =0 ; - level =pci_bus_get_irq_level (lpc->d.bus,ich9_gsi_to_pirq (gsi)); +if (gsi >=ICH9_LPC_PIC_NUM_PINS ) { + level |=pci_bus_get_irq_level (lpc->d.bus,ich9_gsi_to_pirq (gsi)); + }if (gsi ==ich9_lpc_sci_irq (lpc)) { level |= lpc->sci_level; }
Signature · 1 line
1.7.1
PATCH v4 12/14 q35: Add kvmclock support
In reply to Jason BaronFrom: Jan Kiszka <[email protected]>
--- hw/pc_q35.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
hw/pc_q35.c +3 -0
@@ -34,6 +34,7 @@#include "mc146818rtc.h" #include "xen.h" #include "kvm.h" +#include "kvm/clock.h" #include "q35.h" #include "exec-memory.h" #include "ich9.h"
@@ -87,6 +88,8 @@ static void pc_q35_init(QEMUMachineInitArgs *args)pc_cpus_init (cpu_model); +kvmclock_create (); +if (ram_size >=0xb0000000 ) { above_4g_mem_size = ram_size -0xb0000000 ; below_4g_mem_size =0xb0000000 ;
Signature · 1 line
1.7.1
PATCH v4 13/14 Add a fallback bios file search, if -L fails.
In reply to Jason BaronFrom: Jason Baron <[email protected]>
If -L <dir> is specified, and qemu does not find the bios file in <dir>, then the search fails. Add infrastructure such that the search will continue in the default paths, if not found in the -L path.
--- vl.c | 36 +++++++++++++++++++++++++----------- 1 files changed, 25 insertions(+), 11 deletions(-)
vl.c +25 -11
@@ -177,6 +177,7 @@ int main(int argc, char **argv)#define MAX_VIRTIO_CONSOLES 1static const char *data_dir; +static const char *data_dir_fallback;const char *bios_name =NULL ;enum vga_retrace_method vga_retrace_method =VGA_RETRACE_DUMB ;DisplayType display_type =DT_DEFAULT ;
@@ -2009,16 +2010,16 @@ static int balloon_parse(const char *arg)return -1 ; } -char *qemu_find_file (int type,const char *name) +static char *qemu_find_file_in_dir (int type,const char *name,const char *dir) {int len;const char *subdir;char *buf; -/* Try the name as a straight path first */ -if (access (name,R_OK ) ==0 ) { -return g_strdup (name); +if (!dir) { +return NULL ; } +switch (type) {case QEMU_FILE_TYPE_BIOS : subdir ="" ;
@@ -2029,9 +2030,9 @@ char *qemu_find_file(int type, const char *name)default :abort (); } - len =strlen (data_dir) +strlen (name) +strlen (subdir) +2 ; + len =strlen (dir) +strlen (name) +strlen (subdir) +2 ; buf =g_malloc0 (len); -snprintf (buf, len,"%s/%s%s" , data_dir, subdir, name); +snprintf (buf, len,"%s/%s%s" , dir, subdir, name);if (access (buf,R_OK )) {g_free (buf);return NULL ;
@@ -2039,6 +2040,21 @@ char *qemu_find_file(int type, const char *name)return buf; } +char *qemu_find_file (int type,const char *name) +{ +char *filename; + +/* Try the name as a straight path first */ +if (access (name,R_OK ) ==0 ) { +return g_strdup (name); + } + filename =qemu_find_file_in_dir (type, name, data_dir); +if (!filename) { + filename =qemu_find_file_in_dir (type, name, data_dir_fallback); + } +return filename; +} +static int device_help_func (QemuOpts *opts,void *opaque) {return qdev_device_help (opts);
@@ -3538,12 +3554,10 @@ int main(int argc, char **argv, char **envp)/* If no data_dir is specified then try to find it relative to the executable path. */ -if (!data_dir) { - data_dir =os_find_datadir (argv[0 ]); - } + data_dir_fallback =os_find_datadir (argv[0 ]);/* If all else fails use the install path specified when building. */ -if (!data_dir) { - data_dir =CONFIG_QEMU_DATADIR ; +if (!data_dir_fallback) { + data_dir_fallback =CONFIG_QEMU_DATADIR ; }/*
Signature · 1 line
1.7.1
PATCH v4 14/14 q35: automatically load the q35 dsdt table
In reply to Jason BaronFrom: Jason Baron <[email protected]>
Automatically, locate the required q35 dsdt table on load. Otherwise we error out. This could be done in the bios, but its harder to produce a good error message.
--- hw/pc.c | 19 +++++++++++++++++++ hw/pc.h | 2 ++ hw/pc_q35.c | 7 +++++++ 3 files changed, 28 insertions(+), 0 deletions(-)
hw/pc.c +19 -0
@@ -1107,3 +1107,22 @@ void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name) gsi_state->ioapic_irq[i] =qdev_get_gpio_in (dev, i); } } + +int find_and_load_dsdt (const char *dsdt_name) +{ +char *filename; +char buf[1024 ]; + + filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , dsdt_name); +if (!filename) { +return -1 ; + } +snprintf (buf,sizeof (buf),"file=%s" , filename); +g_free (filename); +if (acpi_table_add (buf) <0 ) { +fprintf (stderr,"Wrong acpi table provided\n" ); +return -1 ; + } + +return 0 ; +}
hw/pc.h +2 -0
@@ -185,5 +185,7 @@ void pc_system_firmware_init(MemoryRegion *rom_memory);#define E820_UNUSABLE 5int e820_add_entry (uint64_t ,uint64_t ,uint32_t ); +int find_and_load_dsdt (const char *dsdt_name); +#endif
hw/pc_q35.c +7 -0
@@ -86,6 +86,13 @@ static void pc_q35_init(QEMUMachineInitArgs *args)PCIDevice *ahci;qemu_irq *cmos_s3; +/* let's first see if we can find the proper dsdt */ +if (find_and_load_dsdt ("q35-acpi-dsdt.aml" )) { +fprintf (stderr,"Couldn't find q35 dsdt table!\n" +"Try updating your bios.\n" ); +exit (1 ); + } +pc_cpus_init (cpu_model);kvmclock_create ();
Signature · 1 line
1.7.1
Quoted 9 lines · Jason Baron
Hi,
These patches are intened to give us a base set of patches for Q35 upon which to build. The major change in this series is to add the memory controller hub, or 'mch' as proper member of the q35 host structure. This change refactors the code a bit, and moves more intialization out of
pc_q35.cand intoq35.c. We probably could go further and introduce a generic north bridge class and make the 'mch' a child of it, but I'm not proposing that kind of change this late in the development cycle.
Tested the patches while hacking on q35 seabios support last days.
Quoted 11 lines
I've also dropped as many non-essential bits as possible, such as if=ahci from the patch series. Patches 13-14 allow the use of the '-L' option to specify the directory of the q35 dsdt table. These aren't strictly necessary. As one could pass:
(quoted diff) +0
-2-bios /root/seabios/seabios/out/bios.bin -acpitable file=/root/seabios/seabios/out/q35-acpi-dsdt.amlBut its rather cumbersome, and including the automatic load of the dsdt table, is the future direction. That is, once the seabios bits are included we can pull the q35 dsdt table into the qemu tree, and avoid extra options altogether.
I'd prefer to not include patches 13+14.
Patch 13 is not needed long-term for q35, it is just a temporary testing convinience. Having a search path instead of a single directory might be a useful feature independent of q35 support, but I think for this we should simply allow to explicitly specify a search path, i.e. something like -L "/path/to/dir/one:/path/to/dir/two".
Patch 14 should wait until we've merged seabios with q35 support. It also needs to be fixed to allow overriding the acpi table via command line, i.e. only automatically load the default dsdt in case no dsdt was specified via -acpitable.
Patches 1-12 are fine (and they still apply to master).
cheers,
Gerd
Quoted 3 lines · Jason Baron
These patches are intened to give us a base set of patches for Q35 upon which to build. The major change in this series is to add the memory controller hub, or 'mch' as proper member of the q35 host structure. This change refactors the
Fails to build with all targets enabled:
[ ... ]
LINK alpha-softmmu/qemu-system-alpha../hw/acpi_ich9.o: In function `ich9_pm_init':
acpi_ich9.c:(.text+0x5d): undefined reference to acpi_pm_tmr_init' acpi_ich9.c:(.text+0x65): undefined reference to acpi_pm1_cnt_init' acpi_ich9.c:(.text+0x72): undefined reference to `acpi_gpe_init'
[ ... ]
cheers,
Gerd
Re: [Qemu-devel] [PATCH v4 05/14 (re-post)] ich9: Add acpi support and definitions
In reply to Jason BaronFrom: Jason Baron <[email protected]>
Lay the groundwork for subsequent ich9 support.
---
hw/Makefile.objs | 2 hw/acpi_ich9.c | 315 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ hw/acpi_ich9.h | 47 ++++++++ hw/ich9.h | 207 +++++++++++++++++++++++++++++++++++ hw/pci_ids.h | 12 ++ 5 files changed, 582 insertions(+), 1 deletions(-) create mode 100644 hw/acpi_ich9.c create mode 100644 hw/acpi_ich9.h create mode 100644 hw/ich9.h
hw/Makefile.objs +1 -1
@@ -27,7 +27,7 @@ common-obj-$(CONFIG_I8254) += i8254_common.o i8254.o common-obj-$(CONFIG_PCSPK) += pcspk.o common-obj-$(CONFIG_PCKBD) += pckbd.o common-obj-$(CONFIG_FDC) += fdc.o -common-obj-$(CONFIG_ACPI) += acpi.o acpi_piix4.o +common-obj-$(CONFIG_ACPI) += acpi.o acpi_piix4.o acpi_ich9.o common-obj-$(CONFIG_APM) += pm_smbus.o apm.o common-obj-$(CONFIG_DMA) += dma.o common-obj-$(CONFIG_I82374) += i82374.o
hw/acpi_ich9.c new file +315 -0
315 lines not on this page · raw message
hw/acpi_ich9.h new file +47 -0
47 lines not on this page · raw message
hw/ich9.h new file +207 -0
207 lines not on this page · raw message
hw/pci_ids.h +12 -0
@@ -36,6 +36,7 @@#define PCI_CLASS_BRIDGE_HOST 0x0600#define PCI_CLASS_BRIDGE_ISA 0x0601#define PCI_CLASS_BRIDGE_PCI 0x0604 +#define PCI_CLASS_BRDIGE_PCI_INF_SUB 0x01#define PCI_CLASS_BRIDGE_OTHER 0x0680#define PCI_CLASS_COMMUNICATION_SERIAL 0x0700
@@ -116,6 +117,17 @@#define PCI_DEVICE_ID_INTEL_82371AB 0x7111#define PCI_DEVICE_ID_INTEL_82371AB_2 0x7112#define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113 + +#define PCI_DEVICE_ID_INTEL_ICH9_0 0x2910 +#define PCI_DEVICE_ID_INTEL_ICH9_1 0x2917 +#define PCI_DEVICE_ID_INTEL_ICH9_2 0x2912 +#define PCI_DEVICE_ID_INTEL_ICH9_3 0x2913 +#define PCI_DEVICE_ID_INTEL_ICH9_4 0x2914 +#define PCI_DEVICE_ID_INTEL_ICH9_5 0x2919 +#define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930 +#define PCI_DEVICE_ID_INTEL_ICH9_7 0x2916 +#define PCI_DEVICE_ID_INTEL_ICH9_8 0x2918 +#define PCI_DEVICE_ID_INTEL_82801I_UHCI1 0x2934#define PCI_DEVICE_ID_INTEL_82801I_UHCI2 0x2935#define PCI_DEVICE_ID_INTEL_82801I_UHCI3 0x2936
Re: [Qemu-devel] [PATCH v4 07/14 (re-post)] ich9: Add smbus
In reply to Jason BaronFrom: Jason Baron <[email protected]>
Add support for the ich9 smbus chip.
---
hw/Makefile.objs | 2 - hw/smbus_ich9.c | 159 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 160 insertions(+), 1 deletions(-) create mode 100644 hw/smbus_ich9.c
hw/Makefile.objs +1 -1
@@ -27,7 +27,7 @@ common-obj-$(CONFIG_I8254) += i8254_common.o i8254.o common-obj-$(CONFIG_PCSPK) += pcspk.o common-obj-$(CONFIG_PCKBD) += pckbd.o common-obj-$(CONFIG_FDC) += fdc.o -common-obj-$(CONFIG_ACPI) += acpi.o acpi_piix4.o acpi_ich9.o +common-obj-$(CONFIG_ACPI) += acpi.o acpi_piix4.o acpi_ich9.o smbus_ich9.o common-obj-$(CONFIG_APM) += pm_smbus.o apm.o common-obj-$(CONFIG_DMA) += dma.o common-obj-$(CONFIG_I82374) += i82374.o
hw/smbus_ich9.c new file +159 -0
159 lines not on this page · raw message
Quoted 14 lines · Gerd Hoffmann
Quoted 3 lines
These patches are intened to give us a base set of patches for Q35 upon which to build. The major change in this series is to add the memory controller hub, or 'mch' as proper member of the q35 host structure. This change refactors the
Fails to build with all targets enabled:
[ ... ]
LINK alpha-softmmu/qemu-system-alpha
../hw/acpi_ich9.o: In function `ich9_pm_init':
acpi_ich9.c:(.text+0x5d): undefined reference toacpi_pm_tmr_init' acpi_ich9.c:(.text+0x65): undefined reference toacpi_pm1_cnt_init' acpi_ich9.c:(.text+0x72): undefined reference to `acpi_gpe_init'
Quoted 5 lines
[ ... ]
cheers,
Gerd
Adding the patch below fixes this:
hw/Makefile.objs +1 -2
@@ -28,7 +28,7 @@ common-obj-$(CONFIG_I8254) += i8254_common.o i8254.o common-obj-$(CONFIG_PCSPK) += pcspk.o common-obj-$(CONFIG_PCKBD) += pckbd.o common-obj-$(CONFIG_FDC) += fdc.o -common-obj-$(CONFIG_ACPI) += acpi.o acpi_piix4.o +common-obj-$(CONFIG_ACPI) += acpi.o acpi_piix4.o acpi_ich9.o smbus_ich9.o common-obj-$(CONFIG_APM) += pm_smbus.o apm.o common-obj-$(CONFIG_DMA) += dma.o common-obj-$(CONFIG_I82374) += i82374.o
@@ -39,7 +39,6 @@ common-obj-$(CONFIG_SMARTCARD_NSS) += ccid-card-emulated.o common-obj-$(CONFIG_I8259) += i8259_common.o i8259.o common-obj-y += fifo.o common-obj-y += pam.o -common-obj-y += acpi_ich9.o smbus_ich9.o # PPC devices common-obj-$(CONFIG_PREP_PCI) += prep_pci.o
I've also re-posted patches 5 & 7, to reflect this update. Thanks for pointing this out.
Thanks,
-Jason