pc: CPU hotplug support for Q35
v2 cover pc: CPU hotplug support for Q35
Changes since v1:
* renamed hotplug.c/.h to cpu_hotplug.c/.h
* make all prefixes acpi_cpu_hotplug and AcpiCpuHotplug
* updated docs/specs/acpi_cpu_hotplug.txt with Q35's IO port range
* exclude CPU/PCI/GPE IO ranges from resources advertised in PCI bus _CRS
* advertise CPU hotplug IO range using ACPI Device(ACPI0004)._CRS object.
* change Q35 IO port ase from 0xa18 to 0xcd8, to avoid increasing fragmentation of PCI bus IO space
* replaced runtime IO port setting with compile time one, since port mapping is hadcoded and there is not real need to set it dynamically.
* Use the same headers for C and ASL code so that port/length values won't be duplicated.
* Fix deps for ACPI tables, so that thay would be rebuild when included files are touched. (Added only includes, I've touched, it's not complete but a good start anyway)
Tested with RHEL6, WS2012R2, WS2003
Series is based on mst/pci tree, git tree for testing:
https://github.com/imammedo/qemu/commits/q35_cpu_hp_static_v2
Igor Mammedov (9):
acpi: factor out common cpu hotplug code for PIIX4/Q35
acpi: ich9: add CPU hotplug handling to Q35 machine
pc: rebuild ACPI hex files if included *.dsl are touched
pc: set PRST base in DSDT depending on chipset
pc: PIIX DSDT: exclude CPU/PCI hotplug & GPE0 IO range from PCI bus
resources
pc: Q35 DSDT: exclude CPU hotplug IO range from PCI bus resources
pc: ACPI: expose PRST IO range via _CRS
pc: ACPI: unify source of CPU hotplug IO base/len
pc: ACPI: update acpi-dsdt.hex.generated q35-acpi-dsdt.hex.generated
docs/specs/acpi_cpu_hotplug.txt | 4 +- hw/acpi/Makefile.objs | 2 +- hw/acpi/cpu_hotplug.c | 64 +++++++ hw/acpi/ich9.c | 14 ++ hw/acpi/piix4.c | 80 +-------- hw/i386/Makefile.objs | 14 +- hw/i386/acpi-dsdt-cpu-hotplug.dsl | 12 +- hw/i386/acpi-dsdt-pci-crs.dsl | 15 +- hw/i386/acpi-dsdt.dsl | 38 +++++ hw/i386/acpi-dsdt.hex.generated | 328 +++++++++++++++++++++++++++--------- hw/i386/q35-acpi-dsdt.dsl | 17 ++ hw/i386/q35-acpi-dsdt.hex.generated | 133 ++++++++++++--- include/hw/acpi/cpu_hotplug.h | 34 ++++ include/hw/acpi/ich9.h | 9 + include/hw/acpi/piix4.h | 5 + 15 files changed, 578 insertions(+), 191 deletions(-) create mode 100644 hw/acpi/cpu_hotplug.c create mode 100644 include/hw/acpi/cpu_hotplug.h
Signature · 1 line
1.8.4.2
PATCH v2 1/9 acpi: factor out common cpu hotplug code for PIIX4/Q35
.. so it could be used for adding CPU hotplug to Q35 machine
--- hw/acpi/Makefile.objs | 2 +- hw/acpi/cpu_hotplug.c | 64 +++++++++++++++++++++++++++++++++++ hw/acpi/piix4.c | 77 ++++--------------------------------------- include/hw/acpi/cpu_hotplug.h | 30 +++++++++++++++++ 4 files changed, 101 insertions(+), 72 deletions(-) create mode 100644 hw/acpi/cpu_hotplug.c create mode 100644 include/hw/acpi/cpu_hotplug.h
hw/acpi/Makefile.objs +1 -1
@@ -1 +1 @@ -common-obj-$(CONFIG_ACPI) += core.o piix4.o ich9.o pcihp.o +common-obj-$(CONFIG_ACPI) += core.o piix4.o ich9.o pcihp.o cpu_hotplug.o
hw/acpi/cpu_hotplug.c new file +64 -0
64 lines not on this page · raw message
hw/acpi/piix4.c +6 -71
131 lines not on this page · raw message
include/hw/acpi/cpu_hotplug.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* QEMU ACPI hotplug utilities +* +* Copyright (C) 2013 Red Hat Inc +* +* Authors: +* Igor Mammedov <[email protected]> +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ +#ifndef ACPI_HOTPLUG_H +#define ACPI_HOTPLUG_H + +#include "hw/acpi/acpi.h" + +#define ACPI_CPU_HOTPLUG_STATUS 4 + +#define ACPI_GPE_PROC_LEN 32 + +typedef struct AcpiCpuHotplug { +MemoryRegion io; +uint8_t sts[ACPI_GPE_PROC_LEN ]; +}AcpiCpuHotplug ; + +void AcpiCpuHotplug_add (ACPIGPE *gpe,AcpiCpuHotplug *g,CPUState *cpu); + +void AcpiCpuHotplug_init (MemoryRegion *parent,Object *owner, +AcpiCpuHotplug *gpe_cpu,uint16_t base); +#endif
Signature · 1 line
1.8.4.2
PATCH v2 3/9 pc: rebuild ACPI hex files if included *.dsl are touched
In reply to Igor Mammedov--- hw/i386/Makefile.objs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
hw/i386/Makefile.objs +6 -1
@@ -16,7 +16,12 @@ iasl-option=$(shell if test -z "`$(1) $(2) 2>&1 > /dev/null`" \ ifdef IASL #IASL Present. Generate hex files from .dsl -hw/i386/%.hex: $(SRC_PATH)/hw/i386/%.dsl $(SRC_PATH)/scripts/acpi_extract_preprocess.py $(SRC_PATH)/scripts/acpi_extract.py +DSL_DEPS = $(SRC_PATH)/hw/i386/%.dsl \ + $(SRC_PATH)/scripts/acpi_extract_preprocess.py \ + $(SRC_PATH)/scripts/acpi_extract.py \ + $(SRC_PATH)/hw/i386/acpi-dsdt-*.dsl + +hw/i386/%.hex: $(DSL_DEPS) $(call quiet-command, cpp -P $< -o $*.dsl.i.orig, " CPP $(TARGET_DIR)$*.dsl.i.orig") $(call quiet-command, $(PYTHON) $(SRC_PATH)/scripts/acpi_extract_preprocess.py $*.dsl.i.orig > $*.dsl.i, " ACPI_PREPROCESS $(TARGET_DIR)$*.dsl.i") $(call quiet-command, $(IASL) $(call iasl-option,$(IASL),-Pn,) -vs -l -tc -p $* $*.dsl.i $(if $(V), , > /dev/null) 2>&1 ," IASL $(TARGET_DIR)$*.dsl.i")
Signature · 1 line
1.8.4.2
PATCH v2 2/9 acpi: ich9: add CPU hotplug handling to Q35 machine
In reply to Igor Mammedov.. use IO port 0xcd8-0xcf7 range for CPU present bitmap
--- docs/specs/acpi_cpu_hotplug.txt | 4 +++- hw/acpi/ich9.c | 16 ++++++++++++++++ include/hw/acpi/ich9.h | 4 ++++ 3 files changed, 23 insertions(+), 1 deletion(-)
docs/specs/acpi_cpu_hotplug.txt +3 -1
@@ -10,7 +10,9 @@ ACPI GPE block (IO ports 0xafe0-0xafe3, byte access): Generic ACPI GPE block. Bit 2 (GPE.2) used to notify CPU hot-add/remove event to ACPI BIOS, via SCI interrupt. -CPU present bitmap (IO port 0xaf00-0xaf1f, 1-byte access): +CPU present bitmap for: + ICH9-LPC (IO port 0x0cd8-0xcf7, 1-byte access) + PIIX-PM (IO port 0xaf00-0xaf1f, 1-byte access) --------------------------------------------------------------- One bit per CPU. Bit position reflects corresponding CPU APIC ID. Read-only.
hw/acpi/ich9.c +16 -0
@@ -44,6 +44,8 @@ do { printf("%s "fmt, __func__, ## __VA_ARGS__); } while (0)#define ICH9_DEBUG (fmt, ...) do { } while (0)#endif +#define ICH9_PROC_BASE 0x0CD8 +static void ich9_pm_update_sci_fn (ACPIREGS *regs) {ICH9LPCPMRegs *pm =container_of (regs, ICH9LPCPMRegs, acpi_regs);
@@ -185,6 +187,15 @@ static void pm_powerdown_req(Notifier *n, void *opaque)acpi_pm1_evt_power_down (&pm->acpi_regs); } +static void ich9_cpu_added_req (Notifier *n,void *opaque) +{ +ICH9LPCPMRegs *pm =container_of (n, ICH9LPCPMRegs, cpu_added_notifier); + +assert (pm !=NULL ); +AcpiCpuHotplug_add (&pm->acpi_regs.gpe, &pm->gpe_cpu,CPU (opaque)); +acpi_update_sci (&pm->acpi_regs, pm->irq); +} +void ich9_pm_init (PCIDevice *lpc_pci,ICH9LPCPMRegs *pm,qemu_irq sci_irq) {
@@ -210,6 +221,11 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,qemu_register_reset (pm_reset, pm); pm->powerdown_notifier.notify = pm_powerdown_req;qemu_register_powerdown_notifier (&pm->powerdown_notifier); + +AcpiCpuHotplug_init (pci_address_space_io (lpc_pci),OBJECT (lpc_pci), + &pm->gpe_cpu,ICH9_PROC_BASE ); + pm->cpu_added_notifier.notify = ich9_cpu_added_req; +qemu_register_cpu_added_notifier (&pm->cpu_added_notifier); } static void ich9_pm_get_gpe0_blk(Object *obj, Visitor *v,
include/hw/acpi/ich9.h +4 -0
@@ -22,6 +22,7 @@#define HW_ACPI_ICH9_H #include "hw/acpi/acpi.h" +#include "hw/acpi/cpu_hotplug.h" typedef struct ICH9LPCPMRegs { /*
@@ -42,6 +43,9 @@ typedef struct ICH9LPCPMRegs {uint32_t pm_io_base;Notifier powerdown_notifier; + +AcpiCpuHotplug gpe_cpu; +Notifier cpu_added_notifier; } ICH9LPCPMRegs; void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,
Signature · 1 line
1.8.4.2
PATCH v2 4/9 pc: set PRST base in DSDT depending on chipset
In reply to Igor Mammedov--- hw/i386/acpi-dsdt-cpu-hotplug.dsl | 2 +- hw/i386/acpi-dsdt.dsl | 1 + hw/i386/q35-acpi-dsdt.dsl | 1 + 3 files changed, 3 insertions(+), 1 deletion(-)
hw/i386/acpi-dsdt-cpu-hotplug.dsl +1 -1
@@ -52,7 +52,7 @@ Scope(\_SB) { Sleep(200) } - OperationRegion(PRST, SystemIO, 0xaf00, 32) + OperationRegion(PRST, SystemIO, CPU_STATUS_BASE, 32) Field(PRST, ByteAcc, NoLock, Preserve) { PRS, 256 }
hw/i386/acpi-dsdt.dsl +1 -0
@@ -290,6 +290,7 @@ DefinitionBlock ( } } +#define CPU_STATUS_BASE 0xaf00 #include "acpi-dsdt-cpu-hotplug.dsl"
hw/i386/q35-acpi-dsdt.dsl +1 -0
@@ -405,6 +405,7 @@ DefinitionBlock ( define_gsi_link(GSIH, 0, 0x17) } +#define CPU_STATUS_BASE 0x0CD8 #include "acpi-dsdt-cpu-hotplug.dsl"
Signature · 1 line
1.8.4.2
PATCH v2 5/9 pc: PIIX DSDT: exclude CPU/PCI hotplug & GPE0 IO range from PCI bus resources
In reply to Igor Mammedov.. so that they might not be used by PCI devices.
Note:
Resort to concatenating templates with preprocessor help, because 1.0b spec isn't supporting ConcatenateResTemplate, as result Windows XP fails to execute PCI0._CRS method if ConcatenateResTemplate() is used.
---
Follow up patch will expose them as motherboard resources
--- hw/i386/acpi-dsdt-pci-crs.dsl | 8 +------- hw/i386/acpi-dsdt.dsl | 29 +++++++++++++++++++++++++++++ hw/i386/q35-acpi-dsdt.dsl | 8 ++++++++ 3 files changed, 38 insertions(+), 7 deletions(-)
hw/i386/acpi-dsdt-pci-crs.dsl +1 -7
@@ -37,13 +37,7 @@ Scope(\_SB.PCI0) { 0x0000, // Address Translation Offset 0x0CF8, // Address Length ,, , TypeStatic) - WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, - 0x0000, // Address Space Granularity - 0x0D00, // Address Range Minimum - 0xFFFF, // Address Range Maximum - 0x0000, // Address Translation Offset - 0xF300, // Address Length - ,, , TypeStatic) + BOARD_SPECIFIC_PCI_RESOURSES DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite, 0x00000000, // Address Space Granularity 0x000A0000, // Address Range Minimum
hw/i386/acpi-dsdt.dsl +29 -0
@@ -35,6 +35,35 @@ DefinitionBlock ( /**************************************************************** * PCI Bus definition ****************************************************************/ +#define BOARD_SPECIFIC_PCI_RESOURSES \ + WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ + 0x0000, \ + 0x0D00, \ + 0xADFF, \ + 0x0000, \ + 0xA100, \ + ,, , TypeStatic) \ + WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ + 0x0000, \ + 0xAE14, \ + 0xAEFF, \ + 0x0000, \ + 0x00EC, \ + ,, , TypeStatic) \ + WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ + 0x0000, \ + 0xAF20, \ + 0xAFDF, \ + 0x0000, \ + 0x00C0, \ + ,, , TypeStatic) \ + WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ + 0x0000, \ + 0xAFE4, \ + 0xFFFF, \ + 0x0000, \ + 0x501C, \ + ,, , TypeStatic) Scope(\_SB) { Device(PCI0) {
hw/i386/q35-acpi-dsdt.dsl +8 -0
@@ -48,6 +48,14 @@ DefinitionBlock ( /**************************************************************** * PCI Bus definition ****************************************************************/ +#define BOARD_SPECIFIC_PCI_RESOURSES \ + WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ + 0x0000, \ + 0x0D00, \ + 0xFFFF, \ + 0x0000, \ + 0xF300, \ + ,, , TypeStatic) Scope(\_SB) { Device(PCI0) {
Signature · 1 line
1.8.4.2
PATCH v2 6/9 pc: Q35 DSDT: exclude CPU hotplug IO range from PCI bus resources
In reply to Igor Mammedov--- hw/i386/acpi-dsdt-pci-crs.dsl | 7 ------- hw/i386/acpi-dsdt.dsl | 7 +++++++ hw/i386/q35-acpi-dsdt.dsl | 7 +++++++ 3 files changed, 14 insertions(+), 7 deletions(-)
hw/i386/acpi-dsdt-pci-crs.dsl +0 -7
@@ -30,13 +30,6 @@ Scope(\_SB.PCI0) { 0x01, // Address Alignment 0x08, // Address Length ) - WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, - 0x0000, // Address Space Granularity - 0x0000, // Address Range Minimum - 0x0CF7, // Address Range Maximum - 0x0000, // Address Translation Offset - 0x0CF8, // Address Length - ,, , TypeStatic) BOARD_SPECIFIC_PCI_RESOURSES DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite, 0x00000000, // Address Space Granularity
hw/i386/acpi-dsdt.dsl +7 -0
@@ -38,6 +38,13 @@ DefinitionBlock ( #define BOARD_SPECIFIC_PCI_RESOURSES \ WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ 0x0000, \ + 0x0000, \ + 0x0CF7, \ + 0x0000, \ + 0x0CF8, \ + ,, , TypeStatic) \ + WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ + 0x0000, \ 0x0D00, \ 0xADFF, \ 0x0000, \
hw/i386/q35-acpi-dsdt.dsl +7 -0
@@ -51,6 +51,13 @@ DefinitionBlock ( #define BOARD_SPECIFIC_PCI_RESOURSES \ WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ 0x0000, \ + 0x0000, \ + 0x0CD7, \ + 0x0000, \ + 0x0CD8, \ + ,, , TypeStatic) \ + WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ + 0x0000, \ 0x0D00, \ 0xFFFF, \ 0x0000, \
Signature · 1 line
1.8.4.2
PATCH v2 7/9 pc: ACPI: expose PRST IO range via _CRS
In reply to Igor Mammedov.. so OSPM could notice resource conflict if there is any.
--- hw/i386/acpi-dsdt-cpu-hotplug.dsl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
hw/i386/acpi-dsdt-cpu-hotplug.dsl +10 -1
@@ -52,7 +52,8 @@ Scope(\_SB) { Sleep(200) } - OperationRegion(PRST, SystemIO, CPU_STATUS_BASE, 32) +#define CPU_STATUS_LEN 32 + OperationRegion(PRST, SystemIO, CPU_STATUS_BASE, CPU_STATUS_LEN) Field(PRST, ByteAcc, NoLock, Preserve) { PRS, 256 }
@@ -89,4 +90,12 @@ Scope(\_SB) { Increment(Local0) } } + + Device(PRES) { + Name(_HID, "ACPI0004") + + Name(_CRS, ResourceTemplate() { + IO(Decode16, CPU_STATUS_BASE, CPU_STATUS_BASE, 0, CPU_STATUS_LEN) + }) + } }
Signature · 1 line
1.8.4.2
PATCH v2 8/9 pc: ACPI: unify source of CPU hotplug IO base/len
In reply to Igor Mammedovuse C headers defines as source of IO base/len for respective values in ASL code.
--- hw/acpi/ich9.c | 4 +--- hw/acpi/piix4.c | 5 ++--- hw/i386/Makefile.objs | 9 +++++++-- hw/i386/acpi-dsdt-cpu-hotplug.dsl | 7 ++++--- hw/i386/acpi-dsdt.dsl | 3 ++- hw/i386/q35-acpi-dsdt.dsl | 3 ++- include/hw/acpi/cpu_hotplug.h | 6 +++++- include/hw/acpi/ich9.h | 5 +++++ include/hw/acpi/piix4.h | 5 +++++ 9 files changed, 33 insertions(+), 14 deletions(-)
hw/acpi/ich9.c +1 -3
@@ -44,8 +44,6 @@ do { printf("%s "fmt, __func__, ## __VA_ARGS__); } while (0)#define ICH9_DEBUG (fmt, ...) do { } while (0)#endif -#define ICH9_PROC_BASE 0x0CD8 -static void ich9_pm_update_sci_fn (ACPIREGS *regs) {ICH9LPCPMRegs *pm =container_of (regs, ICH9LPCPMRegs, acpi_regs);
@@ -223,7 +221,7 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,qemu_register_powerdown_notifier (&pm->powerdown_notifier);AcpiCpuHotplug_init (pci_address_space_io (lpc_pci),OBJECT (lpc_pci), - &pm->gpe_cpu,ICH9_PROC_BASE ); + &pm->gpe_cpu,ICH9_CPU_HOTPLUG_IO_BASE ); pm->cpu_added_notifier.notify = ich9_cpu_added_req;qemu_register_cpu_added_notifier (&pm->cpu_added_notifier); }
hw/acpi/piix4.c +2 -3
@@ -51,8 +51,6 @@#define PCI_EJ_BASE 0xae08#define PCI_RMV_BASE 0xae0c -#define PIIX4_PROC_BASE 0xaf00 -#define PIIX4_PCI_HOTPLUG_STATUS 2struct pci_status {
@@ -702,7 +700,8 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion *parent,pci_bus_hotplug (bus, piix4_device_hotplug,DEVICE (s)); } -AcpiCpuHotplug_init (parent,OBJECT (s), &s->gpe_cpu,PIIX4_PROC_BASE ); +AcpiCpuHotplug_init (parent,OBJECT (s), &s->gpe_cpu, +PIIX4_CPU_HOTPLUG_IO_BASE ); s->cpu_added_notifier.notify = piix4_cpu_added_req;qemu_register_cpu_added_notifier (&s->cpu_added_notifier); }
hw/i386/Makefile.objs +7 -2
@@ -19,10 +19,15 @@ ifdef IASL DSL_DEPS = $(SRC_PATH)/hw/i386/%.dsl \ $(SRC_PATH)/scripts/acpi_extract_preprocess.py \ $(SRC_PATH)/scripts/acpi_extract.py \ - $(SRC_PATH)/hw/i386/acpi-dsdt-*.dsl + $(SRC_PATH)/hw/i386/acpi-dsdt-*.dsl \ + $(SRC_PATH)/include/hw/acpi/ich9.h \ + $(SRC_PATH)/include/hw/acpi/piix4.h \ + $(SRC_PATH)/include/hw/acpi/cpu_hotplug.h + +ASL_FLAGS = $(QEMU_CFLAGS) -DACPI_ASL hw/i386/%.hex: $(DSL_DEPS) - $(call quiet-command, cpp -P $< -o $*.dsl.i.orig, " CPP $(TARGET_DIR)$*.dsl.i.orig") + $(call quiet-command, cpp $(ASL_FLAGS) -P $< -o $*.dsl.i.orig, " CPP $(TARGET_DIR)$*.dsl.i.orig") $(call quiet-command, $(PYTHON) $(SRC_PATH)/scripts/acpi_extract_preprocess.py $*.dsl.i.orig > $*.dsl.i, " ACPI_PREPROCESS $(TARGET_DIR)$*.dsl.i") $(call quiet-command, $(IASL) $(call iasl-option,$(IASL),-Pn,) -vs -l -tc -p $* $*.dsl.i $(if $(V), , > /dev/null) 2>&1 ," IASL $(TARGET_DIR)$*.dsl.i") $(call quiet-command, $(PYTHON) $(SRC_PATH)/scripts/acpi_extract.py $*.lst > $*.off, " ACPI_EXTRACT $(TARGET_DIR)$*.off")
hw/i386/acpi-dsdt-cpu-hotplug.dsl +4 -3
@@ -17,6 +17,8 @@ * CPU hotplug ****************************************************************/ +#include "hw/acpi/cpu_hotplug.h" + Scope(\_SB) { /* Objects filled in by run-time generated SSDT */ External(NTFY, MethodObj)
@@ -52,8 +54,7 @@ Scope(\_SB) { Sleep(200) } -#define CPU_STATUS_LEN 32 - OperationRegion(PRST, SystemIO, CPU_STATUS_BASE, CPU_STATUS_LEN) + OperationRegion(PRST, SystemIO, CPU_STATUS_BASE, ACPI_GPE_PROC_LEN) Field(PRST, ByteAcc, NoLock, Preserve) { PRS, 256 }
@@ -95,7 +96,7 @@ Scope(\_SB) { Name(_HID, "ACPI0004") Name(_CRS, ResourceTemplate() { - IO(Decode16, CPU_STATUS_BASE, CPU_STATUS_BASE, 0, CPU_STATUS_LEN) + IO(Decode16, CPU_STATUS_BASE, CPU_STATUS_BASE, 0, ACPI_GPE_PROC_LEN) }) } }
hw/i386/acpi-dsdt.dsl +2 -1
@@ -326,7 +326,8 @@ DefinitionBlock ( } } -#define CPU_STATUS_BASE 0xaf00 +#include "hw/acpi/piix4.h" +#define CPU_STATUS_BASE PIIX4_CPU_HOTPLUG_IO_BASE #include "acpi-dsdt-cpu-hotplug.dsl"
hw/i386/q35-acpi-dsdt.dsl +2 -1
@@ -420,7 +420,8 @@ DefinitionBlock ( define_gsi_link(GSIH, 0, 0x17) } -#define CPU_STATUS_BASE 0x0CD8 +#include "hw/acpi/ich9.h" +#define CPU_STATUS_BASE ICH9_CPU_HOTPLUG_IO_BASE #include "acpi-dsdt-cpu-hotplug.dsl"
include/hw/acpi/cpu_hotplug.h +5 -1
@@ -12,11 +12,14 @@ #ifndef ACPI_HOTPLUG_H #define ACPI_HOTPLUG_H +#define ACPI_GPE_PROC_LEN 32 + +#ifndef ACPI_ASL + #include "hw/acpi/acpi.h" #define ACPI_CPU_HOTPLUG_STATUS 4 -#define ACPI_GPE_PROC_LEN 32 typedef struct AcpiCpuHotplug { MemoryRegion io;
@@ -27,4 +30,5 @@ void AcpiCpuHotplug_add(ACPIGPE *gpe, AcpiCpuHotplug *g, CPUState *cpu);void AcpiCpuHotplug_init (MemoryRegion *parent,Object *owner,AcpiCpuHotplug *gpe_cpu,uint16_t base); +#endif /* !ACPI_ASL */ #endif
include/hw/acpi/ich9.h +5 -0
@@ -21,6 +21,10 @@#ifndef HW_ACPI_ICH9_H #define HW_ACPI_ICH9_H +#define ICH9_CPU_HOTPLUG_IO_BASE 0x0CD8 + +#ifndef ACPI_ASL +#include "hw/acpi/acpi.h" #include "hw/acpi/cpu_hotplug.h"
@@ -55,4 +59,5 @@ extern const VMStateDescription vmstate_ich9_pm;void ich9_pm_add_properties (Object *obj,ICH9LPCPMRegs *pm,Error **errp); +#endif /* !ACPI_ASL */ #endif /* HW_ACPI_ICH9_H */
include/hw/acpi/piix4.h +5 -0
@@ -1,8 +1,13 @@#ifndef HW_ACPI_PIIX4_H #define HW_ACPI_PIIX4_H +#define PIIX4_CPU_HOTPLUG_IO_BASE 0xaf00 + +#ifndef ACPI_ASL +#include "qemu/typedefs.h" Object *piix4_pm_find (void ); +#endif /* !ACPI_ASL */ #endif
Signature · 1 line
1.8.4.2
PATCH v2 9/9 pc: ACPI: update acpi-dsdt.hex.generated q35-acpi-dsdt.hex.generated
In reply to Igor Mammedov--- hw/i386/acpi-dsdt.hex.generated | 328 +++++++++++++++++++++++++++--------- hw/i386/q35-acpi-dsdt.hex.generated | 133 ++++++++++++--- 2 files changed, 362 insertions(+), 99 deletions(-)
hw/i386/acpi-dsdt.hex.generated +250 -78
@@ -3,12 +3,12 @@ static unsigned char AcpiDsdtAmlCode[] = { 0x53, 0x44, 0x54, -0x37, +0xe0, 0x11, 0x0, 0x0, 0x1, -0xd8, +0xba, 0x42, 0x58, 0x50,
@@ -31,8 +31,8 @@ static unsigned char AcpiDsdtAmlCode[] = { 0x4e, 0x54, 0x4c, -0x23, -0x8, +0x15, +0x11, 0x13, 0x20, 0x10,
@@ -146,7 +146,7 @@ static unsigned char AcpiDsdtAmlCode[] = { 0x1, 0x10, 0x4e, -0x15, +0x18, 0x2e, 0x5f, 0x53,
@@ -163,9 +163,9 @@ static unsigned char AcpiDsdtAmlCode[] = { 0x53, 0x11, 0x42, -0x7, 0xa, -0x6e, +0xa, +0x9e, 0x88, 0xd, 0x0,
@@ -217,11 +217,59 @@ static unsigned char AcpiDsdtAmlCode[] = { 0x0, 0xd, 0xff, +0xad, +0x0, +0x0, +0x0, +0xa1, +0x88, +0xd, +0x0, +0x1, +0xc, +0x3, +0x0, +0x0, +0x14, +0xae, 0xff, +0xae, +0x0, +0x0, +0xec, +0x0, +0x88, +0xd, 0x0, +0x1, +0xc, +0x3, +0x0, +0x0, +0x20, +0xaf, +0xdf, +0xaf, 0x0, 0x0, -0xf3, +0xc0, +0x0, +0x88, +0xd, +0x0, +0x1, +0xc, +0x3, +0x0, +0x0, +0xe4, +0xaf, +0xff, +0xff, +0x0, +0x0, +0x1c, +0x50, 0x87, 0x17, 0x0,
@@ -347,7 +395,7 @@ static unsigned char AcpiDsdtAmlCode[] = { 0x45, 0x53, 0xa, -0x5c, +0x8c, 0x50, 0x53, 0x33,
@@ -358,7 +406,7 @@ static unsigned char AcpiDsdtAmlCode[] = { 0x45, 0x53, 0xa, -0x60, +0x90, 0x50, 0x45, 0x33,
@@ -369,7 +417,7 @@ static unsigned char AcpiDsdtAmlCode[] = { 0x45, 0x53, 0xa, -0x68, +0x98, 0x50, 0x4c, 0x33,
@@ -860,8 +908,8 @@ static unsigned char AcpiDsdtAmlCode[] = { 0x4e, 0x1, 0x10, -0x4c, -0x1b, +0x4b, +0x1e, 0x2f, 0x3, 0x5f,
@@ -879,6 +927,53 @@ static unsigned char AcpiDsdtAmlCode[] = { 0x5b, 0x82, 0x2d, +0x53, +0x4d, +0x43, +0x5f, +0x8, +0x5f, +0x48, +0x49, +0x44, +0xc, +0x6, +0x10, +0x0, +0x1, +0x8, +0x5f, +0x53, +0x54, +0x41, +0xb, +0x0, +0xff, +0x8, +0x5f, +0x43, +0x52, +0x53, +0x11, +0x10, +0xa, +0xd, +0x47, +0x1, +0x0, +0x3, +0x0, +0x3, +0x1, +0x20, +0x22, +0x40, +0x0, +0x79, +0x0, +0x5b, +0x82, +0x2d, 0x52, 0x54, 0x43,
@@ -1305,7 +1400,7 @@ static unsigned char AcpiDsdtAmlCode[] = { 0x79, 0x0, 0x10, -0x4b, +0x48, 0x8, 0x2e, 0x5f,
@@ -1371,79 +1466,76 @@ static unsigned char AcpiDsdtAmlCode[] = { 0x45, 0x4a, 0x20, +0x5b, +0x80, +0x42, +0x4e, +0x4d, +0x52, +0x1, +0xb, +0x10, +0xae, +0xa, +0x4, +0x5b, +0x81, +0xb, +0x42, +0x4e, +0x4d, +0x52, +0x43, +0x42, +0x4e, +0x55, +0x4d, +0x20, +0x5b, +0x1, +0x42, +0x4c, +0x43, +0x4b, +0x0, 0x14, -0x11, +0x25, 0x50, 0x43, 0x45, 0x4a, -0x1, +0x2, +0x5b, +0x23, +0x42, +0x4c, +0x43, +0x4b, +0xff, +0xff, 0x70, -0x79, -0x1, 0x68, -0x0, 0x42, -0x30, -0x45, -0x4a, -0xa4, -0x0, -0x14, -0x36, -0x50, -0x43, 0x4e, -0x46, -0x0, -0x70, -0x0, -0x60, -0xa2, -0x2c, -0x95, -0x60, -0xa, -0x1f, -0x75, -0x60, -0xa0, -0x11, -0x7b, -0x50, -0x43, -0x49, 0x55, +0x4d, +0x70, 0x79, 0x1, -0x60, +0x69, 0x0, -0x0, -0x50, -0x43, -0x4e, -0x54, -0x60, -0x1, -0xa0, -0x12, -0x7b, -0x50, +0x42, +0x30, +0x45, +0x4a, +0x5b, +0x27, +0x42, +0x4c, 0x43, -0x49, -0x44, -0x79, -0x1, -0x60, -0x0, +0x4b, +0xa4, 0x0, -0x50, -0x43, -0x4e, -0x54, -0x60, -0xa, -0x3, 0x10, 0x4a, 0xa0,
@@ -4016,8 +4108,8 @@ static unsigned char AcpiDsdtAmlCode[] = { 0x53, 0x1, 0x10, -0x47, -0xe, +0x40, +0x11, 0x5f, 0x53, 0x42,
@@ -4247,9 +4339,50 @@ static unsigned char AcpiDsdtAmlCode[] = { 0x3, 0x75, 0x60, +0x5b, +0x82, +0x27, +0x50, +0x52, +0x45, +0x53, +0x8, +0x5f, +0x48, +0x49, +0x44, +0xd, +0x41, +0x43, +0x50, +0x49, +0x30, +0x30, +0x30, +0x34, +0x0, +0x8, +0x5f, +0x43, +0x52, +0x53, +0x11, +0xd, +0xa, +0xa, +0x47, +0x1, +0x0, +0xaf, +0x0, +0xaf, +0x0, +0x20, +0x79, +0x0, 0x10, -0x4e, -0x9, +0x42, +0xc, 0x5f, 0x47, 0x50,
@@ -4277,12 +4410,31 @@ static unsigned char AcpiDsdtAmlCode[] = { 0x30, 0x0, 0x14, -0x15, +0x39, 0x5f, 0x45, 0x30, 0x31, 0x0, +0x5b, +0x23, +0x5c, +0x2f, +0x3, +0x5f, +0x53, +0x42, +0x5f, +0x50, +0x43, +0x49, +0x30, +0x42, +0x4c, +0x43, +0x4b, +0xff, +0xff, 0x5c, 0x2f, 0x3,
@@ -4297,7 +4449,24 @@ static unsigned char AcpiDsdtAmlCode[] = { 0x50, 0x43, 0x4e, -0x46, +0x54, +0x5b, +0x27, +0x5c, +0x2f, +0x3, +0x5f, +0x53, +0x42, +0x5f, +0x50, +0x43, +0x49, +0x30, +0x42, +0x4c, +0x43, +0x4b, 0x14, 0x10, 0x5f,
@@ -4407,3 +4576,6 @@ static unsigned char AcpiDsdtAmlCode[] = { 0x46, 0x0 }; +static unsigned short piix_dsdt_applesmc_sta[] = { +0x3b4 +};
hw/i386/q35-acpi-dsdt.hex.generated +112 -21
207 lines not on this page · raw message
Signature · 1 line
1.8.4.2
Re: [Qemu-devel] [PATCH 7/9] pc: ACPI: expose PRST IO range via _CRS
In reply to Igor MammedovQuoted 22 lines · Igor Mammedov
.. so OSPM could notice resource conflict if there is any.
Signed-off-by Igor Mammedov <[email protected]>--- hw/i386/acpi-dsdt-cpu-hotplug.dsl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)hw/i386/acpi-dsdt-cpu-hotplug.dsl +2
-1@@ -52,7 +52,8 @@ Scope(\_SB) { Sleep(200) } - OperationRegion(PRST, SystemIO, CPU_STATUS_BASE, 32) +#define CPU_STATUS_LEN 32 + OperationRegion(PRST, SystemIO, CPU_STATUS_BASE, CPU_STATUS_LEN) Field(PRST, ByteAcc, NoLock, Preserve) { PRS, 256 }
hw/i386/acpi-dsdt-cpu-hotplug.dsl Scope(\_SB) { · line 94
Quoted 5 lines
hw/i386/acpi-dsdt-cpu-hotplug.dsl +2
-0@@ -89,4 +90,12 @@ Scope(\_SB) { Increment(Local0) } } + + Device(PRES) {
How about
#define CPU_HOTPLUG_RESOURCE_DEVICE PRES
or something?
hw/i386/acpi-dsdt-cpu-hotplug.dsl Scope(\_SB) { · line 95
Quoted 1 line
hw/i386/acpi-dsdt-cpu-hotplug.dsl +1
-0+ Name(_HID, "ACPI0004")
Does this need to be marked as hidden with _STA?
Quoted 8 lines
hw/i386/acpi-dsdt-cpu-hotplug.dsl +5
-0+ + Name(_CRS, ResourceTemplate() { + IO(Decode16, CPU_STATUS_BASE, CPU_STATUS_BASE, 0, CPU_STATUS_LEN) + }) + } }Signature · 1 line
1.8.4.2
Re: [Qemu-devel] [PATCH 5/9] pc: PIIX DSDT: exclude CPU/PCI hotplug & GPE0 IO range from PCI bus resources
In reply to Igor MammedovQuoted 9 lines · Igor Mammedov
.. so that they might not be used by PCI devices.
Note:
Resort to concatenating templates with preprocessor help, because 1.0b spec isn't supporting ConcatenateResTemplate, as result Windows XP fails to execute PCI0._CRS method ifConcatenateResTemplate()is used.Signed-off-by Igor Mammedov <[email protected]>
Interesting. Could be worth getting rid of ConcatenateResTemplate in other places too so XP works on more systems ...
Quoted 57 lines
---
Follow up patch will expose them as motherboard resources--- hw/i386/acpi-dsdt-pci-crs.dsl | 8 +------- hw/i386/acpi-dsdt.dsl | 29 +++++++++++++++++++++++++++++ hw/i386/q35-acpi-dsdt.dsl | 8 ++++++++ 3 files changed, 38 insertions(+), 7 deletions(-)hw/i386/acpi-dsdt-pci-crs.dsl +1
-7@@ -37,13 +37,7 @@ Scope(\_SB.PCI0) { 0x0000, // Address Translation Offset 0x0CF8, // Address Length ,, , TypeStatic) - WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, - 0x0000, // Address Space Granularity - 0x0D00, // Address Range Minimum - 0xFFFF, // Address Range Maximum - 0x0000, // Address Translation Offset - 0xF300, // Address Length - ,, , TypeStatic) + BOARD_SPECIFIC_PCI_RESOURSES DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite, 0x00000000, // Address Space Granularity 0x000A0000, // Address Range Minimumhw/i386/acpi-dsdt.dsl +22
-0@@ -35,6 +35,35 @@ DefinitionBlock ( /**************************************************************** * PCI Bus definition ****************************************************************/ +#define BOARD_SPECIFIC_PCI_RESOURSES \ + WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ + 0x0000, \ + 0x0D00, \ + 0xADFF, \ + 0x0000, \ + 0xA100, \ + ,, , TypeStatic) \ + WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ + 0x0000, \ + 0xAE14, \ + 0xAEFF, \ + 0x0000, \ + 0x00EC, \ + ,, , TypeStatic) \ + WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ + 0x0000, \ + 0xAF20, \ + 0xAFDF, \ + 0x0000, \ + 0x00C0, \ + ,, , TypeStatic) \
hw/i386/acpi-dsdt.dsl DefinitionBlock ( · line 69
Quoted 10 lines
hw/i386/acpi-dsdt.dsl +7
-0+ WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ + 0x0000, \ + 0xAFE4, \ + 0xFFFF, \ + 0x0000, \ + 0x501C, \ + ,, , TypeStatic) Scope(\_SB) { Device(PCI0) {
Could you add some comments here to document where does each number comes from please?
E.g. /* PIIX4_PROC_BASE + 0x100 */ or something.
Ideally we'd generate this based on defines used
by host, but that does not have to block merging
this patch.
Quoted 21 lines
hw/i386/q35-acpi-dsdt.dsl +8
-0@@ -48,6 +48,14 @@ DefinitionBlock ( /**************************************************************** * PCI Bus definition ****************************************************************/ +#define BOARD_SPECIFIC_PCI_RESOURSES \ + WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ + 0x0000, \ + 0x0D00, \ + 0xFFFF, \ + 0x0000, \ + 0xF300, \ + ,, , TypeStatic) Scope(\_SB) { Device(PCI0) {Signature · 1 line
1.8.4.2
Re: [Qemu-devel] [PATCH 8/9] pc: ACPI: unify source of CPU hotplug IO base/len
In reply to Igor MammedovQuoted 4 lines · Igor Mammedov
use C headers defines as source of IO base/len for respective values in ASL code.
Signed-off-by Igor Mammedov <[email protected]>
That's cool.
It's a bit confusing that you add macro in one patch, then drop it in another.
Could you reorder patches?
Add define and use it in host first, then use it directly.
It's not critical, nice to have.
Quoted 144 lines
--- hw/acpi/ich9.c | 4 +--- hw/acpi/piix4.c | 5 ++--- hw/i386/Makefile.objs | 9 +++++++-- hw/i386/acpi-dsdt-cpu-hotplug.dsl | 7 ++++--- hw/i386/acpi-dsdt.dsl | 3 ++- hw/i386/q35-acpi-dsdt.dsl | 3 ++- include/hw/acpi/cpu_hotplug.h | 6 +++++- include/hw/acpi/ich9.h | 5 +++++ include/hw/acpi/piix4.h | 5 +++++ 9 files changed, 33 insertions(+), 14 deletions(-)hw/acpi/ich9.c +1
-3@@ -44,8 +44,6 @@ do { printf("%s "fmt, __func__, ## __VA_ARGS__); } while (0)#define ICH9_DEBUG (fmt, ...) do { } while (0)#endif -#define ICH9_PROC_BASE 0x0CD8 -static void ich9_pm_update_sci_fn (ACPIREGS *regs) {ICH9LPCPMRegs *pm =container_of (regs, ICH9LPCPMRegs, acpi_regs);@@ -223,7 +221,7 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,qemu_register_powerdown_notifier (&pm->powerdown_notifier);AcpiCpuHotplug_init (pci_address_space_io (lpc_pci),OBJECT (lpc_pci), - &pm->gpe_cpu,ICH9_PROC_BASE ); + &pm->gpe_cpu,ICH9_CPU_HOTPLUG_IO_BASE ); pm->cpu_added_notifier.notify = ich9_cpu_added_req;qemu_register_cpu_added_notifier (&pm->cpu_added_notifier); }hw/acpi/piix4.c +2
-3@@ -51,8 +51,6 @@#define PCI_EJ_BASE 0xae08#define PCI_RMV_BASE 0xae0c -#define PIIX4_PROC_BASE 0xaf00 -#define PIIX4_PCI_HOTPLUG_STATUS 2struct pci_status {@@ -702,7 +700,8 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion *parent,pci_bus_hotplug (bus, piix4_device_hotplug,DEVICE (s)); } -AcpiCpuHotplug_init (parent,OBJECT (s), &s->gpe_cpu,PIIX4_PROC_BASE ); +AcpiCpuHotplug_init (parent,OBJECT (s), &s->gpe_cpu, +PIIX4_CPU_HOTPLUG_IO_BASE ); s->cpu_added_notifier.notify = piix4_cpu_added_req;qemu_register_cpu_added_notifier (&s->cpu_added_notifier); }hw/i386/Makefile.objs +7
-2@@ -19,10 +19,15 @@ ifdef IASL DSL_DEPS = $(SRC_PATH)/hw/i386/%.dsl \ $(SRC_PATH)/scripts/acpi_extract_preprocess.py \ $(SRC_PATH)/scripts/acpi_extract.py \ - $(SRC_PATH)/hw/i386/acpi-dsdt-*.dsl + $(SRC_PATH)/hw/i386/acpi-dsdt-*.dsl \ + $(SRC_PATH)/include/hw/acpi/ich9.h \ + $(SRC_PATH)/include/hw/acpi/piix4.h \ + $(SRC_PATH)/include/hw/acpi/cpu_hotplug.h + +ASL_FLAGS = $(QEMU_CFLAGS) -DACPI_ASL hw/i386/%.hex: $(DSL_DEPS) - $(call quiet-command, cpp -P $< -o $*.dsl.i.orig, " CPP $(TARGET_DIR)$*.dsl.i.orig") + $(call quiet-command, cpp $(ASL_FLAGS) -P $< -o $*.dsl.i.orig, " CPP $(TARGET_DIR)$*.dsl.i.orig") $(call quiet-command, $(PYTHON) $(SRC_PATH)/scripts/acpi_extract_preprocess.py $*.dsl.i.orig > $*.dsl.i, " ACPI_PREPROCESS $(TARGET_DIR)$*.dsl.i") $(call quiet-command, $(IASL) $(call iasl-option,$(IASL),-Pn,) -vs -l -tc -p $* $*.dsl.i $(if $(V), , > /dev/null) 2>&1 ," IASL $(TARGET_DIR)$*.dsl.i") $(call quiet-command, $(PYTHON) $(SRC_PATH)/scripts/acpi_extract.py $*.lst > $*.off, " ACPI_EXTRACT $(TARGET_DIR)$*.off")hw/i386/acpi-dsdt-cpu-hotplug.dsl +4
-3@@ -17,6 +17,8 @@ * CPU hotplug ****************************************************************/ +#include "hw/acpi/cpu_hotplug.h" + Scope(\_SB) { /* Objects filled in by run-time generated SSDT */ External(NTFY, MethodObj)@@ -52,8 +54,7 @@ Scope(\_SB) { Sleep(200) } -#define CPU_STATUS_LEN 32 - OperationRegion(PRST, SystemIO, CPU_STATUS_BASE, CPU_STATUS_LEN) + OperationRegion(PRST, SystemIO, CPU_STATUS_BASE, ACPI_GPE_PROC_LEN) Field(PRST, ByteAcc, NoLock, Preserve) { PRS, 256 }@@ -95,7 +96,7 @@ Scope(\_SB) { Name(_HID, "ACPI0004") Name(_CRS, ResourceTemplate() { - IO(Decode16, CPU_STATUS_BASE, CPU_STATUS_BASE, 0, CPU_STATUS_LEN) + IO(Decode16, CPU_STATUS_BASE, CPU_STATUS_BASE, 0, ACPI_GPE_PROC_LEN) }) } }hw/i386/acpi-dsdt.dsl +2
-1@@ -326,7 +326,8 @@ DefinitionBlock ( } } -#define CPU_STATUS_BASE 0xaf00 +#include "hw/acpi/piix4.h" +#define CPU_STATUS_BASE PIIX4_CPU_HOTPLUG_IO_BASE #include "acpi-dsdt-cpu-hotplug.dsl"hw/i386/q35-acpi-dsdt.dsl +2
-1@@ -420,7 +420,8 @@ DefinitionBlock ( define_gsi_link(GSIH, 0, 0x17) } -#define CPU_STATUS_BASE 0x0CD8 +#include "hw/acpi/ich9.h" +#define CPU_STATUS_BASE ICH9_CPU_HOTPLUG_IO_BASE #include "acpi-dsdt-cpu-hotplug.dsl"include/hw/acpi/cpu_hotplug.h +0
-0
include/hw/acpi/cpu_hotplug.h line 17
Quoted 6 lines
include/hw/acpi/cpu_hotplug.h +3
-0@@ -12,11 +12,14 @@#ifndef ACPI_HOTPLUG_H #define ACPI_HOTPLUG_H +#define ACPI_GPE_PROC_LEN 32 + +#ifndef ACPI_ASL
I think you use this to split the header out - things for IASL and things not for IASL.
Let's not do pre-processor tricks. Just create a new header for IASL only. cpu_hotplug_defs.h or something.
Put a comment there that only defines are allowed there.
Quoted 56 lines
include/hw/acpi/cpu_hotplug.h +2
-1+#include "hw/acpi/acpi.h" #define ACPI_CPU_HOTPLUG_STATUS 4 -#define ACPI_GPE_PROC_LEN 32 typedef struct AcpiCpuHotplug { MemoryRegion io;@@ -27,4 +30,5 @@ void AcpiCpuHotplug_add(ACPIGPE *gpe, AcpiCpuHotplug *g, CPUState *cpu);void AcpiCpuHotplug_init (MemoryRegion *parent,Object *owner,AcpiCpuHotplug *gpe_cpu,uint16_t base); +#endif /* !ACPI_ASL */ #endif include/hw/acpi/ich9.h +5
-0@@ -21,6 +21,10 @@#ifndef HW_ACPI_ICH9_H #define HW_ACPI_ICH9_H +#define ICH9_CPU_HOTPLUG_IO_BASE 0x0CD8 + +#ifndef ACPI_ASL +#include "hw/acpi/acpi.h" #include "hw/acpi/cpu_hotplug.h" @@ -55,4 +59,5 @@ extern const VMStateDescription vmstate_ich9_pm;void ich9_pm_add_properties (Object *obj,ICH9LPCPMRegs *pm,Error **errp); +#endif /* !ACPI_ASL */ #endif /* HW_ACPI_ICH9_H */ include/hw/acpi/piix4.h +5
-0@@ -1,8 +1,13 @@#ifndef HW_ACPI_PIIX4_H #define HW_ACPI_PIIX4_H +#define PIIX4_CPU_HOTPLUG_IO_BASE 0xaf00 + +#ifndef ACPI_ASL +#include "qemu/typedefs.h" Object *piix4_pm_find (void ); +#endif /* !ACPI_ASL */ #endif Signature · 1 line
1.8.4.2
Re: [Qemu-devel] [PATCH 3/9] pc: rebuild ACPI hex files if included *.dsl are touched
In reply to Igor MammedovQuoted 13 lines · Igor Mammedov
Signed-off-by Igor Mammedov <[email protected]>--- hw/i386/Makefile.objs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)hw/i386/Makefile.objs +0
-0@@ -16,7 +16,12 @@ iasl-option=$(shell if test -z "`$(1) $(2) 2>&1 > /dev/null`" \ ifdef IASL #IASL Present. Generate hex files from .dsl
hw/i386/Makefile.objs iasl-option=$(shell if test -z "`$(1) $(2) 2>&1 > /dev/null`" \ · line 27
Quoted 10 lines
hw/i386/Makefile.objs +6
-1-hw/i386/%.hex: $(SRC_PATH)/hw/i386/%.dsl $(SRC_PATH)/scripts/acpi_extract_preprocess.py $(SRC_PATH)/scripts/acpi_extract.py +DSL_DEPS = $(SRC_PATH)/hw/i386/%.dsl \ + $(SRC_PATH)/scripts/acpi_extract_preprocess.py \ + $(SRC_PATH)/scripts/acpi_extract.py \ + $(SRC_PATH)/hw/i386/acpi-dsdt-*.dsl + +hw/i386/%.hex: $(DSL_DEPS) $(call quiet-command, cpp -P $< -o $*.dsl.i.orig, " CPP $(TARGET_DIR)$*.dsl.i.orig") $(call quiet-command, $(PYTHON) $(SRC_PATH)/scripts/acpi_extract_preprocess.py $*.dsl.i.orig > $*.dsl.i, " ACPI_PREPROCESS $(TARGET_DIR)$*.dsl.i") $(call quiet-command, $(IASL) $(call iasl-option,$(IASL),-Pn,) -vs -l -tc -p $* $*.dsl.i $(if $(V), , > /dev/null) 2>&1 ," IASL $(TARGET_DIR)$*.dsl.i")
It's generally nasty to have rules that generate files already in the source tree. In partuclar people expect make clean to get back the original tree.
How about only doing this when some variable is defined?
Quoted 2 lines
Signature · 1 line
1.8.4.2
Quoted 19 lines · Igor Mammedov
Changes since v1:
* renamed hotplug.c/.h to cpu_hotplug.c/.h
* make all prefixesacpi_cpu_hotplugand AcpiCpuHotplug
* updateddocs/specs/acpi_cpu_hotplug.txtwith Q35's IO port range
* exclude CPU/PCI/GPE IO ranges from resources advertised in PCI bus_CRS
* advertise CPU hotplug IO range using ACPI Device(ACPI0004)._CRS object.
* change Q35 IO port ase from0xa18to0xcd8, to avoid increasing fragmentation of PCI bus IO space
* replaced runtime IO port setting with compile time one, since port mapping is hadcoded and there is not real need to set it dynamically.
* Use the same headers for C and ASL code so that port/length values won't be duplicated.
* Fix deps for ACPI tables, so that thay would be rebuild when included files are touched. (Added only includes, I've touched, it's not complete but a good start anyway)
Quoted 1 line
Tested with RHEL6, WS2012R2, WS2003
Sent some minor comments, otherwise looks good, thanks!
Quoted 36 lines
Series is based on mst/pci tree, git tree for testing:
https://github.com/imammedo/qemu/commits/q35_cpu_hp_static_v2Igor Mammedov (9):
acpi: factor out common cpu hotplug code for PIIX4/Q35
acpi: ich9: add CPU hotplug handling to Q35 machine
pc: rebuild ACPI hex files if included *.dsl are touched
pc: set PRST base in DSDT depending on chipset
pc: PIIX DSDT: exclude CPU/PCI hotplug & GPE0 IO range from PCI bus
resources
pc: Q35 DSDT: exclude CPU hotplug IO range from PCI bus resources
pc: ACPI: expose PRST IO range via_CRS
pc: ACPI: unify source of CPU hotplug IO base/len
pc: ACPI: update acpi-dsdt.hex.generated q35-acpi-dsdt.hex.generateddocs/specs/acpi_cpu_hotplug.txt | 4 +- hw/acpi/Makefile.objs | 2 +- hw/acpi/cpu_hotplug.c | 64 +++++++ hw/acpi/ich9.c | 14 ++ hw/acpi/piix4.c | 80 +-------- hw/i386/Makefile.objs | 14 +- hw/i386/acpi-dsdt-cpu-hotplug.dsl | 12 +- hw/i386/acpi-dsdt-pci-crs.dsl | 15 +- hw/i386/acpi-dsdt.dsl | 38 +++++ hw/i386/acpi-dsdt.hex.generated | 328 +++++++++++++++++++++++++++--------- hw/i386/q35-acpi-dsdt.dsl | 17 ++ hw/i386/q35-acpi-dsdt.hex.generated | 133 ++++++++++++--- include/hw/acpi/cpu_hotplug.h | 34 ++++ include/hw/acpi/ich9.h | 9 + include/hw/acpi/piix4.h | 5 + 15 files changed, 578 insertions(+), 191 deletions(-) create mode 100644 hw/acpi/cpu_hotplug.c create mode 100644 include/hw/acpi/cpu_hotplug.hSignature · 1 line
1.8.4.2
Re: [Qemu-devel] [PATCH 3/9] pc: rebuild ACPI hex files if included *.dsl are touched
In reply to Michael S. TsirkinQuoted 21 lines · On Wed, 8 Jan 2014 19:47:03 +0200 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 20 lines · Igor Mammedov
Signed-off-by Igor Mammedov <[email protected]>--- hw/i386/Makefile.objs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)hw/i386/Makefile.objs +6
-1@@ -16,7 +16,12 @@ iasl-option=$(shell if test -z "`$(1) $(2) 2>&1 > /dev/null`" \ ifdef IASL #IASL Present. Generate hex files from .dsl -hw/i386/%.hex: $(SRC_PATH)/hw/i386/%.dsl $(SRC_PATH)/scripts/acpi_extract_preprocess.py $(SRC_PATH)/scripts/acpi_extract.py +DSL_DEPS = $(SRC_PATH)/hw/i386/%.dsl \ + $(SRC_PATH)/scripts/acpi_extract_preprocess.py \ + $(SRC_PATH)/scripts/acpi_extract.py \ + $(SRC_PATH)/hw/i386/acpi-dsdt-*.dsl + +hw/i386/%.hex: $(DSL_DEPS)
Quoted 8 lines
hw/i386/Makefile.objs iasl-option=$(shell if test -z "`$(1) $(2) 2>&1 > /dev/null`" \ · line 27
Quoted 3 lines
hw/i386/Makefile.objs +0
-0$(call quiet-command, cpp -P $< -o $*.dsl.i.orig, " CPP $(TARGET_DIR)$*.dsl.i.orig") $(call quiet-command, $(PYTHON) $(SRC_PATH)/scripts/acpi_extract_preprocess.py $*.dsl.i.orig > $*.dsl.i, " ACPI_PREPROCESS $(TARGET_DIR)$*.dsl.i") $(call quiet-command, $(IASL) $(call iasl-option,$(IASL),-Pn,) -vs -l -tc -p $* $*.dsl.i $(if $(V), , > /dev/null) 2>&1 ," IASL $(TARGET_DIR)$*.dsl.i")It's generally nasty to have rules that generate files already in the source tree. In partuclar people expect make clean to get back the original tree.
How about only doing this when some variable is defined?
I'm not sure if I get you, %.hex files in source tree are always rebuilt if IASL present (i.e. it's just cached copy for IASL-less case).
From my POV as developer if I touched included file then dependent files must be rebuild even without 'make clean'. Otherwise it would break bisection for example where stale table is used due to lack of deps.
Patch just fixes a bug in build process, i.e. adds deps on included files. It's crude but still an improvement over current behavior.
All that said, I don't care much about this patch and can drop it.
Quoted 3 lines
Quoted 3 lines
Signature · 2 lines
-- 1.8.4.2
Re: [Qemu-devel] [PATCH 5/9] pc: PIIX DSDT: exclude CPU/PCI hotplug & GPE0 IO range from PCI bus resources
In reply to Michael S. TsirkinQuoted 9 lines · On Wed, 8 Jan 2014 19:00:55 +0200 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 8 lines · Igor Mammedov
.. so that they might not be used by PCI devices.
Note:
Resort to concatenating templates with preprocessor help, because 1.0b spec isn't supporting ConcatenateResTemplate, as result Windows XP fails to execute PCI0._CRS method ifConcatenateResTemplate()is used.
Quoted 4 lines
Quoted 1 line
Signed-off-by Igor Mammedov <[email protected]>Interesting. Could be worth getting rid of ConcatenateResTemplate in other places too so XP works on more systems ...
I guess they aren't used if there is no complains, anyway it's topic for another time/patch.
Quoted 66 lines
Quoted 66 lines
---
Follow up patch will expose them as motherboard resources--- hw/i386/acpi-dsdt-pci-crs.dsl | 8 +------- hw/i386/acpi-dsdt.dsl | 29 +++++++++++++++++++++++++++++ hw/i386/q35-acpi-dsdt.dsl | 8 ++++++++ 3 files changed, 38 insertions(+), 7 deletions(-)hw/i386/acpi-dsdt-pci-crs.dsl +1
-7@@ -37,13 +37,7 @@ Scope(\_SB.PCI0) { 0x0000, // Address Translation Offset 0x0CF8, // Address Length ,, , TypeStatic) - WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, - 0x0000, // Address Space Granularity - 0x0D00, // Address Range Minimum - 0xFFFF, // Address Range Maximum - 0x0000, // Address Translation Offset - 0xF300, // Address Length - ,, , TypeStatic) + BOARD_SPECIFIC_PCI_RESOURSES DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite, 0x00000000, // Address Space Granularity 0x000A0000, // Address Range Minimumhw/i386/acpi-dsdt.dsl +29
-0@@ -35,6 +35,35 @@ DefinitionBlock ( /**************************************************************** * PCI Bus definition ****************************************************************/ +#define BOARD_SPECIFIC_PCI_RESOURSES \ + WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ + 0x0000, \ + 0x0D00, \ + 0xADFF, \ + 0x0000, \ + 0xA100, \ + ,, , TypeStatic) \ + WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ + 0x0000, \ + 0xAE14, \ + 0xAEFF, \ + 0x0000, \ + 0x00EC, \ + ,, , TypeStatic) \ + WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ + 0x0000, \ + 0xAF20, \ + 0xAFDF, \ + 0x0000, \ + 0x00C0, \ + ,, , TypeStatic) \ + WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ + 0x0000, \ + 0xAFE4, \ + 0xFFFF, \ + 0x0000, \ + 0x501C, \ + ,, , TypeStatic)
Quoted 6 lines
hw/i386/acpi-dsdt.dsl DefinitionBlock ( · line 69
Quoted 2 lines
hw/i386/acpi-dsdt.dsl +0
-0Scope(\_SB) { Device(PCI0) {Could you add some comments here to document where does each number comes from please?
E.g. /*PIIX4_PROC_BASE+0x100*/ or something.
done
Quoted 26 lines
Ideally we'd generate this based on defines used
by host, but that does not have to block merging
this patch.Quoted 21 lines
hw/i386/q35-acpi-dsdt.dsl +8
-0@@ -48,6 +48,14 @@ DefinitionBlock ( /**************************************************************** * PCI Bus definition ****************************************************************/ +#define BOARD_SPECIFIC_PCI_RESOURSES \ + WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ + 0x0000, \ + 0x0D00, \ + 0xFFFF, \ + 0x0000, \ + 0xF300, \ + ,, , TypeStatic) Scope(\_SB) { Device(PCI0) {Signature · 1 line
1.8.4.2
Re: [Qemu-devel] [PATCH 5/9] pc: PIIX DSDT: exclude CPU/PCI hotplug & GPE0 IO range from PCI bus resources
Quoted 12 lines · Igor Mammedov
Quoted 9 lines · On Wed, 8 Jan 2014 19:00:55 +0200 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 8 lines · Igor Mammedov
.. so that they might not be used by PCI devices.
Note:
Resort to concatenating templates with preprocessor help, because 1.0b spec isn't supporting ConcatenateResTemplate, as result Windows XP fails to execute PCI0._CRS method ifConcatenateResTemplate()is used.
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Igor Mammedov <[email protected]>Interesting. Could be worth getting rid of ConcatenateResTemplate in other places too so XP works on more systems ...
I guess they aren't used if there is no complains,
I think the workaround is simple - don't have so much memory, that's why people don't complain.
Quoted 1 line
anyway it's topic for another time/patch.
Absolutely.
Quoted 100 lines
Quoted 66 lines
Quoted 66 lines
---
Follow up patch will expose them as motherboard resources--- hw/i386/acpi-dsdt-pci-crs.dsl | 8 +------- hw/i386/acpi-dsdt.dsl | 29 +++++++++++++++++++++++++++++ hw/i386/q35-acpi-dsdt.dsl | 8 ++++++++ 3 files changed, 38 insertions(+), 7 deletions(-)hw/i386/acpi-dsdt-pci-crs.dsl +1
-7@@ -37,13 +37,7 @@ Scope(\_SB.PCI0) { 0x0000, // Address Translation Offset 0x0CF8, // Address Length ,, , TypeStatic) - WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, - 0x0000, // Address Space Granularity - 0x0D00, // Address Range Minimum - 0xFFFF, // Address Range Maximum - 0x0000, // Address Translation Offset - 0xF300, // Address Length - ,, , TypeStatic) + BOARD_SPECIFIC_PCI_RESOURSES DWordMemory(ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite, 0x00000000, // Address Space Granularity 0x000A0000, // Address Range Minimumhw/i386/acpi-dsdt.dsl +29
-0@@ -35,6 +35,35 @@ DefinitionBlock ( /**************************************************************** * PCI Bus definition ****************************************************************/ +#define BOARD_SPECIFIC_PCI_RESOURSES \ + WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ + 0x0000, \ + 0x0D00, \ + 0xADFF, \ + 0x0000, \ + 0xA100, \ + ,, , TypeStatic) \ + WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ + 0x0000, \ + 0xAE14, \ + 0xAEFF, \ + 0x0000, \ + 0x00EC, \ + ,, , TypeStatic) \ + WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ + 0x0000, \ + 0xAF20, \ + 0xAFDF, \ + 0x0000, \ + 0x00C0, \ + ,, , TypeStatic) \ + WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ + 0x0000, \ + 0xAFE4, \ + 0xFFFF, \ + 0x0000, \ + 0x501C, \ + ,, , TypeStatic)Quoted 6 lines
hw/i386/acpi-dsdt.dsl DefinitionBlock ( · line 69
Quoted 2 lines
hw/i386/acpi-dsdt.dsl +0
-0Scope(\_SB) { Device(PCI0) {Could you add some comments here to document where does each number comes from please?
E.g. /*PIIX4_PROC_BASE+0x100*/ or something.done
Quoted 26 lines
Ideally we'd generate this based on defines used
by host, but that does not have to block merging
this patch.Quoted 21 lines
hw/i386/q35-acpi-dsdt.dsl +8
-0@@ -48,6 +48,14 @@ DefinitionBlock ( /**************************************************************** * PCI Bus definition ****************************************************************/ +#define BOARD_SPECIFIC_PCI_RESOURSES \ + WordIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, \ + 0x0000, \ + 0x0D00, \ + 0xFFFF, \ + 0x0000, \ + 0xF300, \ + ,, , TypeStatic) Scope(\_SB) { Device(PCI0) {Signature · 1 line
1.8.4.2