From d5747cace73a9002f097a7da41253749c59fb36a Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 2 Jun 2014 15:24:57 +0200 Subject: pc: create custom generic PC machine type it will be used for PC specific options/variables Signed-off-by: Igor Mammedov Acked-by: Peter Crosthwaite Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/pc.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'include/hw/i386') diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index fa9d99792a..aade1b23bb 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -12,9 +12,33 @@ #include "qemu/bitmap.h" #include "sysemu/sysemu.h" #include "hw/pci/pci.h" +#include "hw/boards.h" #define HPET_INTCAP "hpet-intcap" +struct PCMachineState { + /*< private >*/ + MachineState parent_obj; +}; + +struct PCMachineClass { + /*< private >*/ + MachineClass parent_class; +}; + +typedef struct PCMachineState PCMachineState; +typedef struct PCMachineClass PCMachineClass; + +#define TYPE_PC_MACHINE "generic-pc-machine" +#define PC_MACHINE(obj) \ + OBJECT_CHECK(PCMachineState, (obj), TYPE_PC_MACHINE) +#define PC_MACHINE_GET_CLASS(obj) \ + OBJECT_GET_CLASS(PCMachineClass, (obj), TYPE_PC_MACHINE) +#define PC_MACHINE_CLASS(klass) \ + OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE) + +void qemu_register_pc_machine(QEMUMachine *m); + /* PC-style peripherals (also used by other machines). */ typedef struct PcPciInfo { -- cgit v1.2.3 From 619d11e4631000f20318dec90b87f314272bfa4a Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 2 Jun 2014 15:25:08 +0200 Subject: pc: initialize memory hotplug address space initialize and map hotplug memory address space container into guest's RAM address space. Signed-off-by: Igor Mammedov Acked-by: Peter Crosthwaite Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/pc.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/hw/i386') diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index aade1b23bb..48d4c5e9f0 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -16,9 +16,19 @@ #define HPET_INTCAP "hpet-intcap" +/** + * PCMachineState: + * @hotplug_memory_base: address in guest RAM address space where hotplug memory + * address space begins. + * @hotplug_memory: hotplug memory addess space container + */ struct PCMachineState { /*< private >*/ MachineState parent_obj; + + /* */ + ram_addr_t hotplug_memory_base; + MemoryRegion hotplug_memory; }; struct PCMachineClass { -- cgit v1.2.3 From de268e134c03612970d6f2c214df6287c9621cc8 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 2 Jun 2014 15:25:10 +0200 Subject: pc: add 'etc/reserved-memory-end' fw_cfg interface for SeaBIOS 'etc/reserved-memory-end' will allow QEMU to tell BIOS where PCI BARs mapping could safely start in high memory. Allowing BIOS to start mapping 64-bit PCI BARs at address where it wouldn't conflict with other mappings QEMU might place before it. That permits QEMU to reserve extra address space before 64-bit PCI hole for memory hotplug. Signed-off-by: Igor Mammedov Acked-by: Peter Crosthwaite Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/pc.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/hw/i386') diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 48d4c5e9f0..501d9a0773 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -77,6 +77,7 @@ struct PcGuestInfo { uint64_t *node_cpu; FWCfgState *fw_cfg; bool has_acpi_build; + bool has_reserved_memory; }; /* parallel.c */ -- cgit v1.2.3 From 95bee274fd1d22dc6d35e52987f8b5d29fe754dd Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 2 Jun 2014 15:25:12 +0200 Subject: pc: add memory hotplug handler to PC_MACHINE that will perform mapping of PC_DIMM device into guest's RAM address space Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/pc.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/hw/i386') diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 501d9a0773..c3ed8586df 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -31,9 +31,17 @@ struct PCMachineState { MemoryRegion hotplug_memory; }; +/** + * PCMachineClass: + * @get_hotplug_handler: pointer to parent class callback @get_hotplug_handler + */ struct PCMachineClass { /*< private >*/ MachineClass parent_class; + + /*< public >*/ + HotplugHandler *(*get_hotplug_handler)(MachineState *machine, + DeviceState *dev); }; typedef struct PCMachineState PCMachineState; -- cgit v1.2.3 From 34774320c3b05287a06775c31578bd1e2cb20b83 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 2 Jun 2014 15:25:20 +0200 Subject: acpi:piix4: add memory hotplug handling Add memory hotplug initialization/handling to PIIX4_PM device and enable it by default for post 2.0 machine types Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin MST: resolve conflict in pc.h --- include/hw/i386/pc.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'include/hw/i386') diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index c3ed8586df..f6d41729c5 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -310,11 +310,17 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); PC_Q35_COMPAT_1_5 #define PC_COMPAT_2_0 \ + {\ + .driver = "PIIX4_PM",\ + .property = "memory-hotplug-support",\ + .value = "off",\ + },\ {\ .driver = "apic",\ .property = "version",\ .value = stringify(0x11),\ - },{\ + },\ + {\ .driver = "nec-usb-xhci",\ .property = "superspeed-ports-first",\ .value = "off",\ -- cgit v1.2.3 From 1f8621842ebba95002f500935ac84e7dcf71a540 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 2 Jun 2014 15:25:22 +0200 Subject: acpi:ich9: add memory hotplug handling Add memory hotplug initialization/handling to ICH9 LPC device and enable it by default for post 2.0 machine types Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/pc.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include/hw/i386') diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index f6d41729c5..1635aede0f 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -286,7 +286,12 @@ int e820_get_num_entries(void); bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); #define PC_Q35_COMPAT_2_0 \ - PC_COMPAT_2_0 + PC_COMPAT_2_0, \ + {\ + .driver = "ICH9 LPC",\ + .property = "memory-hotplug-support",\ + .value = "off",\ + } #define PC_Q35_COMPAT_1_7 \ PC_COMPAT_1_7, \ -- cgit v1.2.3 From 781bbd6bec587606b1b98b78512f2bba64183b0c Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 2 Jun 2014 15:25:24 +0200 Subject: pc: add acpi-device link to PCMachineState the link will used later to access device implementing ACPI functions instead of adhoc lookup in QOM tree. Signed-off-by: Igor Mammedov Acked-by: Peter Crosthwaite Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/pc.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'include/hw/i386') diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 1635aede0f..6050115042 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -21,6 +21,7 @@ * @hotplug_memory_base: address in guest RAM address space where hotplug memory * address space begins. * @hotplug_memory: hotplug memory addess space container + * @acpi_dev: link to ACPI PM device that performs ACPI hotplug handling */ struct PCMachineState { /*< private >*/ @@ -29,8 +30,12 @@ struct PCMachineState { /* */ ram_addr_t hotplug_memory_base; MemoryRegion hotplug_memory; + + HotplugHandler *acpi_dev; }; +#define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device" + /** * PCMachineClass: * @get_hotplug_handler: pointer to parent class callback @get_hotplug_handler @@ -210,7 +215,8 @@ void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name); I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, qemu_irq sci_irq, qemu_irq smi_irq, - int kvm_enabled, FWCfgState *fw_cfg); + int kvm_enabled, FWCfgState *fw_cfg, + DeviceState **piix4_pm); void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr); /* hpet.c */ -- cgit v1.2.3 From bf1e89395996c3a4c888faf297433482934ec007 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 2 Jun 2014 15:25:27 +0200 Subject: pc: add "hotplug-memory-region-size" property to PC_MACHINE ... it will be used by acpi-build code and by unit tests Signed-off-by: Igor Mammedov Acked-by: Peter Crosthwaite Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/pc.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/hw/i386') diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 6050115042..a2bf22c6a1 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -35,6 +35,7 @@ struct PCMachineState { }; #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device" +#define PC_MACHINE_MEMHP_REGION_SIZE "hotplug-memory-region-size" /** * PCMachineClass: -- cgit v1.2.3 From 292b1634d008d289d633ff5a8f2275288f607e56 Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Sun, 8 Jun 2014 18:45:25 +0300 Subject: ich: get rid of spaces in type name Names with spaces in them are nasty, let's not go there. Signed-off-by: Michael S. Tsirkin --- include/hw/i386/ich9.h | 2 +- include/hw/i386/pc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include/hw/i386') diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h index e19143555e..59ea25b49a 100644 --- a/include/hw/i386/ich9.h +++ b/include/hw/i386/ich9.h @@ -24,7 +24,7 @@ I2CBus *ich9_smb_init(PCIBus *bus, int devfn, uint32_t smb_io_base); #define ICH9_CC_SIZE (16 * 1024) /* 16KB */ -#define TYPE_ICH9_LPC_DEVICE "ICH9 LPC" +#define TYPE_ICH9_LPC_DEVICE "ICH9-LPC" #define ICH9_LPC_DEVICE(obj) \ OBJECT_CHECK(ICH9LPCState, (obj), TYPE_ICH9_LPC_DEVICE) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index a2bf22c6a1..2e6ac04aea 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -295,7 +295,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); #define PC_Q35_COMPAT_2_0 \ PC_COMPAT_2_0, \ {\ - .driver = "ICH9 LPC",\ + .driver = "ICH9-LPC",\ .property = "memory-hotplug-support",\ .value = "off",\ } -- cgit v1.2.3 From f57fcf706342f8545d77a538c4319b752511f672 Mon Sep 17 00:00:00 2001 From: Jason Wang Date: Tue, 20 May 2014 14:01:44 +0800 Subject: virtio-net: announce self by guest It's hard to track all mac addresses and their configurations (e.g vlan or ipv6) in qemu. Without this information, it's impossible to build proper garp packet after migration. The only possible solution to this is let guest (who knows all configurations) to do this. So, this patch introduces a new readonly config status bit of virtio-net, VIRTIO_NET_S_ANNOUNCE which is used to notify guest to announce presence of its link through config update interrupt.When guest has done the announcement, it should ack the notification through VIRTIO_NET_CTRL_ANNOUNCE_ACK cmd. This feature is negotiated by a new feature bit VIRTIO_NET_F_ANNOUNCE (which has already been supported by Linux guest). During load, a counter of announcing rounds is set so that after the vm is running it can trigger rounds of config interrupts to notify the guest to build and send the correct garps. Cc: Liuyongan Cc: Amos Kong Signed-off-by: Jason Wang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/pc.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/hw/i386') diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 2e6ac04aea..a9529f418c 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -351,6 +351,11 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); .driver = "pci-serial-4x",\ .property = "prog_if",\ .value = stringify(0),\ + },\ + {\ + .driver = "virtio-net-pci",\ + .property = "guest_announce",\ + .value = "off",\ } #define PC_COMPAT_1_7 \ -- cgit v1.2.3 From 9521d42b546f2f624d4dcd299e13a9ab37eb1d82 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 10 Jun 2014 19:15:17 +0800 Subject: pc: pass MachineState to pc_memory_init Signed-off-by: Paolo Bonzini Signed-off-by: Hu Tao Reviewed-By: Igor Mammedov Acked-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/pc.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'include/hw/i386') diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index a9529f418c..76d4c6e725 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -3,6 +3,7 @@ #include "qemu-common.h" #include "exec/memory.h" +#include "hw/boards.h" #include "hw/isa/isa.h" #include "hw/block/fdc.h" #include "net/net.h" @@ -183,10 +184,8 @@ PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size, void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory, MemoryRegion *pci_address_space); -FWCfgState *pc_memory_init(MemoryRegion *system_memory, - const char *kernel_filename, - const char *kernel_cmdline, - const char *initrd_filename, +FWCfgState *pc_memory_init(MachineState *machine, + MemoryRegion *system_memory, ram_addr_t below_4g_mem_size, ram_addr_t above_4g_mem_size, MemoryRegion *rom_memory, -- cgit v1.2.3