qemu: generate acpi tables for the guest
cover qemu: generate acpi tables for the guest
This patchset moves all generation of ACPI tables
from guest BIOS to the hypervisor.
Although ACPI tables come from a system BIOS on real hw, it makes sense that the ACPI tables are coupled with the virtual machine, since they have to abstract the x86 machine to the OS's.
Several future developments that this will enable:
- make it easier to use alternative firmware:
any firmware can just load the ACPI tables from QEMU. case in point OVMF.
- make it easier to add more chipsets without bumping into fw_cfg boundaries.
- describe a complex configuration
e.g. a bridged PCI topology to enable
acpi hotplug of devices behind a PCI bridge, or for multi-root topology.
If you look at the actual code:
i386: imports ACPI table generation code from seabios
you will see that it's more complex than it needs to be, with lots of low level casts
and similar tricks.
There's also a bit of duplication where we
already declare similar acpi structures in qemu.
This is the result of code being a direct port from seabios. Laszlo's patch (build ACPI MADT (APIC) for fw_cfg) shows how this will be cleaned up by follow-up work. I think it's best to do it in this order: port code directly, and apply cleanups and reduce duplication that results, on top.
This way it's much easier to see that we don't introduce regressions.
In particular, for a simple VM with piix,
I booted a guest on qemu with and without the change, and verified that ACPI tables are unchanged except for trivial pointer address changes.
Such binary compatibility makes it easier to be
confident that this change won't break things.
So the idea is Laszlo's patchset (patches 2-7) will be rebased on top of this patchset, this way we'll get small cleanup changes, where each step is easy to verify as not changing anything from Guest POV.
One issue this patchset creates is cross-version migration. Specifically migration to qemu 1.5 will not work if it happens while bios is accessing fw_cfg when we migrate.
This is a general problem of the fw_cfg implementation, I plan to extend fw_cfg implementation to address this.
I plan to test q35 and numa setups before I submit this for inclusion, in a similar way.
git trees, for those interested in testing this:
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git acpi
git://git.kernel.org/pub/scm/virt/kvm/mst/seabios.git acpi
bios patchset will be posted tomorrow (need to clean up the commit log a bit).
Laszlo Ersek (1):
refer to FWCfgState explicitly
Michael S. Tsirkin (12):
apic: rename apic specific bitopts
hw/i386/pc.c: move IO_APIC_DEFAULT_ADDRESS to include/hw/i386/apic.h
fw_cfg: move typedef to qemu/typedefs.h
i386: add ACPI table files from seabios
acpi: add rules to compile ASL source
acpi: pre-compiled ASL files
range: add Range structure
i386: add bios linker/loader
i386: generate pc guest info
pc: pass PCI hole ranges to Guests
i386: ACPI table generation code from seabios
pc: reuse guest info for legacy fw cfg
configure | 9 +- hw/acpi/ich9.c | 7 +- hw/acpi/piix4.c | 44 +- hw/core/loader.c | 2 +- hw/i386/Makefile.objs | 27 + hw/i386/acpi-build.c | 685 ++++ hw/i386/acpi-dsdt-cpu-hotplug.dsl | 93 + hw/i386/acpi-dsdt-dbug.dsl | 41 + hw/i386/acpi-dsdt-hpet.dsl | 51 + hw/i386/acpi-dsdt-isa.dsl | 117 + hw/i386/acpi-dsdt-pci-crs.dsl | 105 + hw/i386/acpi-dsdt.dsl | 343 ++ hw/i386/acpi-dsdt.hex.generated | 4409 ++++++++++++++++++++ hw/i386/bios-linker-loader.c | 155 + hw/i386/multiboot.c | 2 +- hw/i386/multiboot.h | 4 +- hw/i386/pc.c | 159 +- hw/i386/pc_piix.c | 28 +- hw/i386/pc_q35.c | 14 +- hw/i386/q35-acpi-dsdt.dsl | 452 +++ hw/i386/q35-acpi-dsdt.hex.generated | 7346 ++++++++++++++++++++++++++++++++++ hw/i386/ssdt-misc.dsl | 73 + hw/i386/ssdt-misc.hex.generated | 190 + hw/i386/ssdt-pcihp.dsl | 51 + hw/i386/ssdt-pcihp.hex.generated | 108 + hw/i386/ssdt-proc.dsl | 63 + hw/i386/ssdt-proc.hex.generated | 134 + hw/intc/apic.c | 42 +- hw/isa/lpc_ich9.c | 11 +- hw/mips/mips_malta.c | 2 +- hw/pci-host/q35.c | 5 + hw/sparc/sun4m.c | 6 +- hw/sparc64/sun4u.c | 2 +- include/hw/acpi/ich9.h | 2 +- include/hw/i386/acpi-build.h | 9 + include/hw/i386/apic.h | 2 + include/hw/i386/bios-linker-loader.h | 26 + include/hw/i386/ich9.h | 3 +- include/hw/i386/pc.h | 67 +- include/hw/loader.h | 3 +- include/hw/nvram/fw_cfg.h | 2 +- include/hw/pci-host/q35.h | 2 + include/qemu/range.h | 22 + include/qemu/typedefs.h | 2 + scripts/acpi_extract.py | 362 ++ scripts/acpi_extract_preprocess.py | 52 + scripts/update-acpi.sh | 4 + 47 files changed, 15248 insertions(+), 90 deletions(-) create mode 100644 hw/i386/acpi-build.c create mode 100644 hw/i386/acpi-dsdt-cpu-hotplug.dsl create mode 100644 hw/i386/acpi-dsdt-dbug.dsl create mode 100644 hw/i386/acpi-dsdt-hpet.dsl create mode 100644 hw/i386/acpi-dsdt-isa.dsl create mode 100644 hw/i386/acpi-dsdt-pci-crs.dsl create mode 100644 hw/i386/acpi-dsdt.dsl create mode 100644 hw/i386/acpi-dsdt.hex.generated create mode 100644 hw/i386/bios-linker-loader.c create mode 100644 hw/i386/q35-acpi-dsdt.dsl create mode 100644 hw/i386/q35-acpi-dsdt.hex.generated create mode 100644 hw/i386/ssdt-misc.dsl create mode 100644 hw/i386/ssdt-misc.hex.generated create mode 100644 hw/i386/ssdt-pcihp.dsl create mode 100644 hw/i386/ssdt-pcihp.hex.generated create mode 100644 hw/i386/ssdt-proc.dsl create mode 100644 hw/i386/ssdt-proc.hex.generated create mode 100644 include/hw/i386/acpi-build.h create mode 100644 include/hw/i386/bios-linker-loader.h create mode 100755 scripts/acpi_extract.py create mode 100755 scripts/acpi_extract_preprocess.py create mode 100644 scripts/update-acpi.sh
Signature · 1 line
MST
RFC PATCH 1/13 apic: rename apic specific bitopts
apic has its own version of bitops, with the
difference that it works on u32 and not long.
Add apic_ prefix to avoid namespace clashes.
--- hw/intc/apic.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-)
hw/intc/apic.c +21 -21
@@ -40,18 +40,18 @@ static void apic_get_delivery_bitmask(uint32_t *deliver_bitmask, uint8_t dest, uint8_t dest_mode);/* Find first bit starting from msb */ -static int fls_bit (uint32_t value) +static int apic_fls_bit (uint32_t value) {return 31 -clz32 (value); }/* Find first bit starting from lsb */ -static int ffs_bit (uint32_t value) +static int apic_ffs_bit (uint32_t value) {return ctz32 (value); } -static inline void set_bit (uint32_t *tab,int index) +static inline void apic_set_bit (uint32_t *tab,int index) {int i, mask; i = index >>5 ;
@@ -59,7 +59,7 @@ static inline void set_bit(uint32_t *tab, int index) tab[i] |= mask; } -static inline void reset_bit (uint32_t *tab,int index) +static inline void apic_reset_bit (uint32_t *tab,int index) {int i, mask; i = index >>5 ;
@@ -67,7 +67,7 @@ static inline void reset_bit(uint32_t *tab, int index) tab[i] &= ~mask; } -static inline int get_bit (uint32_t *tab,int index) +static inline int apic_get_bit (uint32_t *tab,int index) {int i, mask; i = index >>5 ;
@@ -81,7 +81,7 @@ static int get_highest_priority_int(uint32_t *tab)int i;for (i =7 ; i >=0 ; i--) {if (tab[i] !=0 ) { -return i *32 +fls_bit (tab[i]); +return i *32 +apic_fls_bit (tab[i]); } }return -1 ;
@@ -184,7 +184,7 @@ void apic_deliver_pic_intr(DeviceState *d, int level)case APIC_DM_FIXED :if (!(lvt &APIC_LVT_LEVEL_TRIGGER ))break ; -reset_bit (s->irr, lvt &0xff ); +apic_reset_bit (s->irr, lvt &0xff );/* fall through */ case APIC_DM_EXTINT :cpu_reset_interrupt (CPU (s->cpu),CPU_INTERRUPT_HARD );
@@ -230,7 +230,7 @@ static void apic_bus_deliver(const uint32_t *deliver_bitmask, d =-1 ;for (i =0 ; i <MAX_APIC_WORDS ; i++) {if (deliver_bitmask[i]) { - d = i *32 +ffs_bit (deliver_bitmask[i]); + d = i *32 +apic_ffs_bit (deliver_bitmask[i]);break ; } }
@@ -386,13 +386,13 @@ void apic_poll_irq(DeviceState *d)static void apic_set_irq (APICCommonState *s,int vector_num,int trigger_mode) { -apic_report_irq_delivered (!get_bit (s->irr, vector_num)); +apic_report_irq_delivered (!apic_get_bit (s->irr, vector_num)); -set_bit (s->irr, vector_num); +apic_set_bit (s->irr, vector_num);if (trigger_mode) -set_bit (s->tmr, vector_num); +apic_set_bit (s->tmr, vector_num);else -reset_bit (s->tmr, vector_num); +apic_reset_bit (s->tmr, vector_num);if (s->vapic_paddr) {apic_sync_vapic (s,SYNC_ISR_IRR_TO_VAPIC );/*
@@ -412,8 +412,8 @@ static void apic_eoi(APICCommonState *s) isrv =get_highest_priority_int (s->isr);if (isrv <0 )return ; -reset_bit (s->isr, isrv); -if (!(s->spurious_vec &APIC_SV_DIRECTED_IO ) &&get_bit (s->tmr, isrv)) { +apic_reset_bit (s->isr, isrv); +if (!(s->spurious_vec &APIC_SV_DIRECTED_IO ) &&apic_get_bit (s->tmr, isrv)) {ioapic_eoi_broadcast (isrv); }apic_sync_vapic (s,SYNC_FROM_VAPIC |SYNC_TO_VAPIC );
@@ -452,7 +452,7 @@ static void apic_get_delivery_bitmask(uint32_t *deliver_bitmask,int idx =apic_find_dest (dest);memset (deliver_bitmask,0x00 ,MAX_APIC_WORDS *sizeof (uint32_t ));if (idx >=0 ) -set_bit (deliver_bitmask, idx); +apic_set_bit (deliver_bitmask, idx); } }else {/* XXX: cluster mode */
@@ -462,11 +462,11 @@ static void apic_get_delivery_bitmask(uint32_t *deliver_bitmask,if (apic_iter) {if (apic_iter->dest_mode ==0xf ) {if (dest & apic_iter->log_dest) -set_bit (deliver_bitmask, i); +apic_set_bit (deliver_bitmask, i); }else if (apic_iter->dest_mode ==0x0 ) {if ((dest &0xf0 ) == (apic_iter->log_dest &0xf0 ) && (dest & apic_iter->log_dest &0x0f )) { -set_bit (deliver_bitmask, i); +apic_set_bit (deliver_bitmask, i); } } }else {
@@ -509,14 +509,14 @@ static void apic_deliver(DeviceState *d, uint8_t dest, uint8_t dest_mode,break ;case 1 :memset (deliver_bitmask,0x00 ,sizeof (deliver_bitmask)); -set_bit (deliver_bitmask, s->idx); +apic_set_bit (deliver_bitmask, s->idx);break ;case 2 :memset (deliver_bitmask,0xff ,sizeof (deliver_bitmask));break ;case 3 :memset (deliver_bitmask,0xff ,sizeof (deliver_bitmask)); -reset_bit (deliver_bitmask, s->idx); +apic_reset_bit (deliver_bitmask, s->idx);break ; }
@@ -573,8 +573,8 @@ int apic_get_interrupt(DeviceState *d)apic_sync_vapic (s,SYNC_TO_VAPIC );return s->spurious_vec &0xff ; } -reset_bit (s->irr, intno); -set_bit (s->isr, intno); +apic_reset_bit (s->irr, intno); +apic_set_bit (s->isr, intno);apic_sync_vapic (s,SYNC_TO_VAPIC );/* re-inject if there is still a pending PIC interrupt */
Signature · 1 line
MST
Re: [Qemu-devel] [PATCH RFC 01/13] apic: rename apic specific bitopts
Quoted 3 lines · Michael S. Tsirkin
apic has its own version of bitops, with the
difference that it works on u32 and not long.
Addapic_prefix to avoid namespace clashes.
Wouldn't it be better to consolidate so we only have one set of bitops rather than a local set in this file?
thanks
-- PMM
Re: [Qemu-devel] [PATCH RFC 01/13] apic: rename apic specific bitopts
Quoted 10 lines · Peter Maydell
Quoted 3 lines · Michael S. Tsirkin
apic has its own version of bitops, with the
difference that it works on u32 and not long.
Addapic_prefix to avoid namespace clashes.Wouldn't it be better to consolidate so we only have one set of bitops rather than a local set in this file?
thanks
-- PMM
Yes but I'd like this patchset to focus on acpi. ATM including bitops in pc.h gives build errors.
Thus this trivial patch, can be tested by comparing binary. Consolidation is better done in a separate patchset, and would need more testing.
Any chance you can do this on top of this?
Signature · 1 line
MST
RFC PATCH 2/13 hw/i386/pc.c: move IO_APIC_DEFAULT_ADDRESS to include/hw/i386/apic.h
In reply to Michael S. Tsirkin--- hw/i386/pc.c | 2 -- include/hw/i386/apic.h | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-)
hw/i386/pc.c +0 -2
@@ -75,8 +75,6 @@#define FW_CFG_E820_TABLE (FW_CFG_ARCH_LOCAL + 3)#define FW_CFG_HPET (FW_CFG_ARCH_LOCAL + 4) -#define IO_APIC_DEFAULT_ADDRESS 0xfec00000 -#define E820_NR_ENTRIES 16struct e820_entry {
include/hw/i386/apic.h +2 -0
@@ -26,6 +26,8 @@ void apic_designate_bsp(DeviceState *d);/* pc.c */ DeviceState *cpu_get_current_apic (void ); +#define IO_APIC_DEFAULT_ADDRESS 0xfec00000 +/* cpu.c */ bool cpu_is_bsp (X86CPU *cpu);
Signature · 1 line
MST
Re: [Qemu-devel] [PATCH RFC 02/13] hw/i386/pc.c: move IO_APIC_DEFAULT_ADDRESS to include/hw/i386/apic.h
Quoted 3 lines · Michael S. Tsirkin
Signed-off-by Michael S. Tsirkin <[email protected]>Signed-off-by Laszlo Ersek <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>
Looks odd to see your sign-off twice :)
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
RFC PATCH 3/13 refer to FWCfgState explicitly
In reply to Michael S. TsirkinFrom: Laszlo Ersek <[email protected]>
Subject: refer to FWCfgState explicitly
Currently some places use pointer-to-void even though they mean pointer-to-FWCfgState. Clean them up.
--- hw/acpi/piix4.c | 2 +- hw/core/loader.c | 2 +- hw/i386/multiboot.c | 2 +- hw/i386/multiboot.h | 4 +++- hw/i386/pc.c | 24 ++++++++++++------------ hw/i386/pc_piix.c | 2 +- hw/sparc/sun4m.c | 6 +++--- hw/sparc64/sun4u.c | 2 +- include/hw/i386/pc.h | 19 ++++++++++--------- include/hw/loader.h | 3 ++- 10 files changed, 35 insertions(+), 31 deletions(-)
hw/acpi/piix4.c +1 -1
@@ -447,7 +447,7 @@ static int piix4_pm_initfn(PCIDevice *dev)i2c_bus *piix4_pm_init (PCIBus *bus,int devfn,uint32_t smb_io_base,qemu_irq sci_irq,qemu_irq smi_irq, -int kvm_enabled,void *fw_cfg) +int kvm_enabled,FWCfgState *fw_cfg) {PCIDevice *dev;PIIX4PMState *s;
hw/core/loader.c +1 -1
@@ -733,7 +733,7 @@ int rom_load_all(void)return 0 ; } -void rom_set_fw (void *f) +void rom_set_fw (FWCfgState *f) { fw_cfg = f; }
hw/i386/multiboot.c +1 -1
@@ -124,7 +124,7 @@ static void mb_add_mod(MultibootState *s, s->mb_mods_count++; } -int load_multiboot(void *fw_cfg, +int load_multiboot(FWCfgState *fw_cfg, FILE *f, const char *kernel_filename, const char *initrd_filename,
hw/i386/multiboot.h +3 -1
@@ -1,7 +1,9 @@#ifndef QEMU_MULTIBOOT_H #define QEMU_MULTIBOOT_H -int load_multiboot(void *fw_cfg, +#include "hw/nvram/fw_cfg.h" + +int load_multiboot(FWCfgState *fw_cfg, FILE *f, const char *kernel_filename, const char *initrd_filename,
hw/i386/pc.c +12 -12
@@ -593,9 +593,9 @@ static unsigned int pc_apic_id_limit(unsigned int max_cpus)return x86_cpu_apic_id_from_index (max_cpus -1 ) +1 ; } -static void *bochs_bios_init (void ) +static FWCfgState *bochs_bios_init (void ) { -void *fw_cfg; +FWCfgState *fw_cfg;uint8_t *smbios_table;size_t smbios_len;uint64_t *numa_fw_cfg;
@@ -672,7 +672,7 @@ static long get_file_size(FILE *f)return size; } -static void load_linux(void *fw_cfg, +static void load_linux(FWCfgState *fw_cfg, const char *kernel_filename, const char *initrd_filename, const char *kernel_cmdline,
@@ -1010,19 +1010,19 @@ void pc_acpi_init(const char *default_dsdt) } } -void *pc_memory_init (MemoryRegion *system_memory, -const char *kernel_filename, -const char *kernel_cmdline, -const char *initrd_filename, -ram_addr_t below_4g_mem_size, -ram_addr_t above_4g_mem_size, -MemoryRegion *rom_memory, -MemoryRegion **ram_memory) +FWCfgState *pc_memory_init (MemoryRegion *system_memory, +const char *kernel_filename, +const char *kernel_cmdline, +const char *initrd_filename, +ram_addr_t below_4g_mem_size, +ram_addr_t above_4g_mem_size, +MemoryRegion *rom_memory, +MemoryRegion **ram_memory) {int linux_boot, i;MemoryRegion *ram, *option_rom_mr;MemoryRegion *ram_below_4g, *ram_above_4g; -void *fw_cfg; +FWCfgState *fw_cfg; linux_boot = (kernel_filename !=NULL );
hw/i386/pc_piix.c +1 -1
@@ -89,7 +89,7 @@ static void pc_init1(MemoryRegion *system_memory,MemoryRegion *pci_memory;MemoryRegion *rom_memory;DeviceState *icc_bridge; -void *fw_cfg =NULL ; +FWCfgState *fw_cfg =NULL ; icc_bridge =qdev_create (NULL ,TYPE_ICC_BRIDGE ); object_property_add_child(qdev_get_machine(), "icc-bridge",
hw/sparc/sun4m.c +3 -3
@@ -873,7 +873,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,qemu_irq *cpu_halt;unsigned long kernel_size;DriveInfo *fd[MAX_FD ]; -void *fw_cfg; +FWCfgState *fw_cfg;unsigned int num_vsimms;/* init CPUs */
@@ -1591,7 +1591,7 @@ static void sun4d_hw_init(const struct sun4d_hwdef *hwdef, ram_addr_t RAM_size, espdma_irq, ledma_irq;qemu_irq esp_reset, dma_enable;unsigned long kernel_size; -void *fw_cfg; +FWCfgState *fw_cfg;DeviceState *dev;/* init CPUs */
@@ -1792,7 +1792,7 @@ static void sun4c_hw_init(const struct sun4c_hwdef *hwdef, ram_addr_t RAM_size,qemu_irq fdc_tc;unsigned long kernel_size;DriveInfo *fd[MAX_FD ]; -void *fw_cfg; +FWCfgState *fw_cfg;DeviceState *dev;unsigned int i;
hw/sparc64/sun4u.c +1 -1
@@ -818,7 +818,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,qemu_irq *ivec_irqs, *pbm_irqs;DriveInfo *hd[MAX_IDE_BUS *MAX_IDE_DEVS ];DriveInfo *fd[MAX_FD ]; -void *fw_cfg; +FWCfgState *fw_cfg;/* init CPUs */ cpu =cpu_devinit (cpu_model, hwdef);
include/hw/i386/pc.h +10 -9
@@ -9,6 +9,7 @@#include "net/net.h" #include "exec/memory.h" #include "hw/i386/ioapic.h" +#include "hw/nvram/fw_cfg.h" /* PC-style peripherals (also used by other machines). */
@@ -81,14 +82,14 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int level);void pc_cpus_init (const char *cpu_model,DeviceState *icc_bridge);void pc_hot_add_cpu (const int64_t id,Error **errp);void pc_acpi_init (const char *default_dsdt); -void *pc_memory_init (MemoryRegion *system_memory, -const char *kernel_filename, -const char *kernel_cmdline, -const char *initrd_filename, -ram_addr_t below_4g_mem_size, -ram_addr_t above_4g_mem_size, -MemoryRegion *rom_memory, -MemoryRegion **ram_memory); +FWCfgState *pc_memory_init (MemoryRegion *system_memory, +const char *kernel_filename, +const char *kernel_cmdline, +const char *initrd_filename, +ram_addr_t below_4g_mem_size, +ram_addr_t above_4g_mem_size, +MemoryRegion *rom_memory, +MemoryRegion **ram_memory);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,
@@ -112,7 +113,7 @@ void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name);i2c_bus *piix4_pm_init (PCIBus *bus,int devfn,uint32_t smb_io_base,qemu_irq sci_irq,qemu_irq smi_irq, -int kvm_enabled,void *fw_cfg); +int kvm_enabled,FWCfgState *fw_cfg);void piix4_smbus_register_device (SMBusDevice *dev,uint8_t addr);/* hpet.c */
include/hw/loader.h +2 -1
@@ -1,6 +1,7 @@#ifndef LOADER_H #define LOADER_H #include "qapi/qmp/qdict.h" +#include "hw/nvram/fw_cfg.h" /* loader.c */ int get_image_size (const char *filename);
@@ -30,7 +31,7 @@ int rom_add_blob(const char *name, const void *blob, size_t len,int rom_add_elf_program (const char *name,void *data,size_t datasize,size_t romsize,hwaddr addr);int rom_load_all (void ); -void rom_set_fw (void *f); +void rom_set_fw (FWCfgState *f);int rom_copy (uint8_t *dest,hwaddr addr,size_t size);void *rom_ptr (hwaddr addr);void do_info_roms (Monitor *mon,const QDict *qdict);
Signature · 1 line
MST
RFC PATCH 4/13 fw_cfg: move typedef to qemu/typedefs.h
In reply to Michael S. TsirkinLess header dependencies this way.
--- include/hw/i386/pc.h | 1 - include/hw/nvram/fw_cfg.h | 2 +- include/qemu/typedefs.h | 1 + 3 files changed, 2 insertions(+), 2 deletions(-)
include/hw/i386/pc.h +0 -1
@@ -9,7 +9,6 @@#include "net/net.h" #include "exec/memory.h" #include "hw/i386/ioapic.h" -#include "hw/nvram/fw_cfg.h" /* PC-style peripherals (also used by other machines). */
include/hw/nvram/fw_cfg.h +1 -1
@@ -6,6 +6,7 @@#include <stddef.h> #include "exec/hwaddr.h" +#include "qemu/typedefs.h" #endif #define FW_CFG_SIGNATURE 0x00
@@ -60,7 +61,6 @@ typedef struct FWCfgFiles {typedef void (*FWCfgCallback )(void *opaque,uint8_t *data); -typedef struct FWCfgState FWCfgState ;void fw_cfg_add_bytes (FWCfgState *s,uint16_t key,void *data,size_t len);void fw_cfg_add_string (FWCfgState *s,uint16_t key,const char *value);void fw_cfg_add_i16 (FWCfgState *s,uint16_t key,uint16_t value);
include/qemu/typedefs.h +1 -0
@@ -61,5 +61,6 @@ typedef struct EventNotifier EventNotifier;typedef struct VirtIODevice VirtIODevice ;typedef struct QEMUSGList QEMUSGList ;typedef struct SHPCDevice SHPCDevice ; +typedef struct FWCfgState FWCfgState ;#endif /* QEMU_TYPEDEFS_H */
Signature · 1 line
MST
RFC PATCH 5/13 i386: add ACPI table files from seabios
In reply to Michael S. TsirkinThis adds ASL code as well as scripts for processing it, imported from seabios git tree
commit 51684b7ced75fb76776e8ee84833fcfb6ecf12dd
Will be used for runtime acpi table generation.
Note:
This patch reuses some code from SeaBIOS, which was originally under LGPLv2 and then relicensed to GPLv3 or LGPLv3, in QEMU under GPLv2+. This relicensing has been acked by all contributors that had contributed to the code since the v2->v3 relicense. ACKs approving the v2+ relicensing are listed below. The list might include ACKs from people not holding copyright on any parts of the reused code, but it's better to err on the side of caution and include them.
Affected SeaBIOS files (GPLv2+ license headers added)
<http://thread.gmane.org/gmane.comp.bios.coreboot.seabios/5949>:
src/acpi-dsdt-cpu-hotplug.dsl | 15 +++++++++++++++ src/acpi-dsdt-dbug.dsl | 15 +++++++++++++++ src/acpi-dsdt-hpet.dsl | 15 +++++++++++++++ src/acpi-dsdt-isa.dsl | 15 +++++++++++++++ src/acpi-dsdt-pci-crs.dsl | 15 +++++++++++++++ src/acpi.c | 14 +++++++++++++- src/acpi.h | 14 ++++++++++++++ src/ssdt-misc.dsl | 15 +++++++++++++++ src/ssdt-pcihp.dsl | 15 +++++++++++++++ src/ssdt-proc.dsl | 15 +++++++++++++++ tools/acpi_extract.py | 13 ++++++++++++- tools/acpi_extract_preprocess.py | 13 ++++++++++++- 12 files changed, 171 insertions(+), 3 deletions(-)
Each one of the listed people agreed to the following:
Quoted 5 lines
If you allow the use of your contribution in QEMU under the terms of GPLv2 or later as proposed by this patch, please respond to this mail including the line:
Acked-by Name <email address>
--- hw/i386/acpi-dsdt-cpu-hotplug.dsl | 93 ++++++++ hw/i386/acpi-dsdt-dbug.dsl | 41 ++++ hw/i386/acpi-dsdt-hpet.dsl | 51 +++++ hw/i386/acpi-dsdt-isa.dsl | 117 ++++++++++ hw/i386/acpi-dsdt-pci-crs.dsl | 105 +++++++++ hw/i386/acpi-dsdt.dsl | 343 ++++++++++++++++++++++++++++ hw/i386/q35-acpi-dsdt.dsl | 452 +++++++++++++++++++++++++++++++++++++ hw/i386/ssdt-misc.dsl | 73 ++++++ hw/i386/ssdt-pcihp.dsl | 51 +++++ hw/i386/ssdt-proc.dsl | 63 ++++++ scripts/acpi_extract.py | 362 +++++++++++++++++++++++++++++ scripts/acpi_extract_preprocess.py | 52 +++++ 12 files changed, 1803 insertions(+) create mode 100644 hw/i386/acpi-dsdt-cpu-hotplug.dsl create mode 100644 hw/i386/acpi-dsdt-dbug.dsl create mode 100644 hw/i386/acpi-dsdt-hpet.dsl create mode 100644 hw/i386/acpi-dsdt-isa.dsl create mode 100644 hw/i386/acpi-dsdt-pci-crs.dsl create mode 100644 hw/i386/acpi-dsdt.dsl create mode 100644 hw/i386/q35-acpi-dsdt.dsl create mode 100644 hw/i386/ssdt-misc.dsl create mode 100644 hw/i386/ssdt-pcihp.dsl create mode 100644 hw/i386/ssdt-proc.dsl create mode 100755 scripts/acpi_extract.py create mode 100755 scripts/acpi_extract_preprocess.py
hw/i386/acpi-dsdt-cpu-hotplug.dsl new file +93 -0
@@ -0,0 +1,93 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License along + * with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +/**************************************************************** + * CPU hotplug + ****************************************************************/ + +Scope(\_SB) { + /* Objects filled in by run-time generated SSDT */ + External(NTFY, MethodObj) + External(CPON, PkgObj) + + /* Methods called by run-time generated SSDT Processor objects */ + Method(CPMA, 1, NotSerialized) { + // _MAT method - create an madt apic buffer + // Arg0 = Processor ID = Local APIC ID + // Local0 = CPON flag for this cpu + Store(DerefOf(Index(CPON, Arg0)), Local0) + // Local1 = Buffer (in madt apic form) to return + Store(Buffer(8) {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}, Local1) + // Update the processor id, lapic id, and enable/disable status + Store(Arg0, Index(Local1, 2)) + Store(Arg0, Index(Local1, 3)) + Store(Local0, Index(Local1, 4)) + Return (Local1) + } + Method(CPST, 1, NotSerialized) { + // _STA method - return ON status of cpu + // Arg0 = Processor ID = Local APIC ID + // Local0 = CPON flag for this cpu + Store(DerefOf(Index(CPON, Arg0)), Local0) + If (Local0) { + Return (0xF) + } Else { + Return (0x0) + } + } + Method(CPEJ, 2, NotSerialized) { + // _EJ0 method - eject callback + Sleep(200) + } + + /* CPU hotplug notify method */ + OperationRegion(PRST, SystemIO, 0xaf00, 32) + Field(PRST, ByteAcc, NoLock, Preserve) { + PRS, 256 + } + Method(PRSC, 0) { + // Local5 = active cpu bitmap + Store(PRS, Local5) + // Local2 = last read byte from bitmap + Store(Zero, Local2) + // Local0 = Processor ID / APIC ID iterator + Store(Zero, Local0) + While (LLess(Local0, SizeOf(CPON))) { + // Local1 = CPON flag for this cpu + Store(DerefOf(Index(CPON, Local0)), Local1) + If (And(Local0, 0x07)) { + // Shift down previously read bitmap byte + ShiftRight(Local2, 1, Local2) + } Else { + // Read next byte from cpu bitmap + Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2) + } + // Local3 = active state for this cpu + Store(And(Local2, 1), Local3) + + If (LNotEqual(Local1, Local3)) { + // State change - update CPON with new state + Store(Local3, Index(CPON, Local0)) + // Do CPU notify + If (LEqual(Local3, 1)) { + NTFY(Local0, 1) + } Else { + NTFY(Local0, 3) + } + } + Increment(Local0) + } + } +}
hw/i386/acpi-dsdt-dbug.dsl new file +41 -0
41 lines not on this page · raw message
hw/i386/acpi-dsdt-hpet.dsl new file +51 -0
51 lines not on this page · raw message
hw/i386/acpi-dsdt-isa.dsl new file +117 -0
117 lines not on this page · raw message
hw/i386/acpi-dsdt-pci-crs.dsl new file +105 -0
105 lines not on this page · raw message
hw/i386/acpi-dsdt.dsl new file +343 -0
343 lines not on this page · raw message
hw/i386/q35-acpi-dsdt.dsl new file +452 -0
452 lines not on this page · raw message
hw/i386/ssdt-misc.dsl new file +73 -0
73 lines not on this page · raw message
hw/i386/ssdt-pcihp.dsl new file +51 -0
51 lines not on this page · raw message
hw/i386/ssdt-proc.dsl new file +63 -0
63 lines not on this page · raw message
scripts/acpi_extract.py new file +362 -0
362 lines not on this page · raw message
scripts/acpi_extract_preprocess.py new file +52 -0
52 lines not on this page · raw message
Signature · 1 line
MST
RFC PATCH 6/13 acpi: add rules to compile ASL source
In reply to Michael S. TsirkinDetect presence of IASL compiler and use it to process ASL source. If not there, use pre-compiled files in-tree. Add script to update the in-tree files.
--- configure | 9 ++++++++- hw/i386/Makefile.objs | 22 ++++++++++++++++++++++ scripts/update-acpi.sh | 4 ++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 scripts/update-acpi.sh
configure +8 -1
@@ -119,6 +119,7 @@ path_of() { # default parameters source_path=`dirname "$0"` cpu="" +iasl="iasl" interp_prefix="/usr/gnemul/qemu-%M" static="no" cross_prefix=""
@@ -249,6 +250,8 @@ for opt do ;; --cc=*) CC="$optarg" ;; + --iasl=*) iasl="$optarg" + ;; --source-path=*) source_path="$optarg" ;; --cpu=*) cpu="$optarg"
@@ -1062,6 +1065,7 @@ echo "Advanced options (experts only):" echo " --source-path=PATH path of source code [$source_path]" echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" echo " --cc=CC use C compiler CC [$cc]" +echo " --iasl=IASL use ACPI compiler IASL [$iasl]" echo " --host-cc=CC use C compiler CC [$host_cc] for code run at" echo " build time" echo " --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]"
@@ -4053,6 +4057,9 @@ else fi echo "PYTHON=$python" >> $config_host_mak echo "CC=$cc" >> $config_host_mak +if $iasl -h > /dev/null 2>&1; then + echo "IASL=$iasl" >> $config_host_mak +fi echo "CC_I386=$cc_i386" >> $config_host_mak echo "HOST_CC=$host_cc" >> $config_host_mak echo "OBJCC=$objcc" >> $config_host_mak
@@ -4541,7 +4548,7 @@ for rom in seabios vgabios ; do echo "BCC=bcc" >> $config_mak echo "CPP=$cpp" >> $config_mak echo "OBJCOPY=objcopy" >> $config_mak - echo "IASL=iasl" >> $config_mak + echo "IASL=$iasl" >> $config_mak echo "LD=$ld" >> $config_mak done
hw/i386/Makefile.objs +22 -0
@@ -4,3 +4,25 @@ obj-y += pc.o pc_piix.o pc_q35.o obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o obj-y += kvmvapic.o + +iasl-option=$(shell if test -z "`$(1) $(2) 2>&1 > /dev/null`" \ + ; then echo "$(2)"; else echo "$(3)"; fi ;) + +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 + $(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") + $(call quiet-command, $(SRC_PATH)/scripts/acpi_extract.py $*.lst > $*.off, " ACPI_EXTRACT $(TARGET_DIR)$*.off") + $(call quiet-command, cat $*.off > $@, " CAT $(TARGET_DIR)$@") +else +#IASL Not present. Restore pre-generated hex files. +hw/i386/%.hex: $(SRC_PATH)/hw/i386/%.hex.generated + $(call quiet-command, cp -f $< $@, " CP $(TARGET_DIR)$@") +endif + +.PHONY: cleanhex +cleanhex: + rm -f hw/i386/*hex +clean: cleanhex
scripts/update-acpi.sh new file +4 -0
@@ -0,0 +1,4 @@ +cd x86_64-softmmu +for file in hw/i386/*.hex; do + cp -f $file ../$file.generated +done
Signature · 1 line
MST
RFC PATCH 7/13 acpi: pre-compiled ASL files
In reply to Michael S. TsirkinAdd pre-compiled ASL files. Useful for systems that do not have IASL.
--- hw/i386/acpi-dsdt.hex.generated | 4409 +++++++++++++++++++++ hw/i386/q35-acpi-dsdt.hex.generated | 7346 +++++++++++++++++++++++++++++++++++ hw/i386/ssdt-misc.hex.generated | 190 + hw/i386/ssdt-pcihp.hex.generated | 108 + hw/i386/ssdt-proc.hex.generated | 134 + 5 files changed, 12187 insertions(+) create mode 100644 hw/i386/acpi-dsdt.hex.generated create mode 100644 hw/i386/q35-acpi-dsdt.hex.generated create mode 100644 hw/i386/ssdt-misc.hex.generated create mode 100644 hw/i386/ssdt-pcihp.hex.generated create mode 100644 hw/i386/ssdt-proc.hex.generated
hw/i386/acpi-dsdt.hex.generated new file +4409 -0
@@ -0,0 +1,4409 @@ +static unsigned char AcpiDsdtAmlCode[] = { +0x44, +0x53, +0x44, +0x54, +0x37, +0x11, +0x0, +0x0, +0x1, +0xe1, +0x42, +0x58, +0x50, +0x43, +0x0, +0x0, +0x42, +0x58, +0x44, +0x53, +0x44, +0x54, +0x0, +0x0, +0x1, +0x0, +0x0, +0x0, +0x49, +0x4e, +0x54, +0x4c, +0x28, +0x5, +0x10, +0x20, +0x10, +0x49, +0x4, +0x5c, +0x0, +0x5b, +0x80, +0x44, +0x42, +0x47, +0x5f, +0x1, +0xb, +0x2, +0x4, +0x1, +0x5b, +0x81, +0xb, +0x44, +0x42, +0x47, +0x5f, +0x1, +0x44, +0x42, +0x47, +0x42, +0x8, +0x14, +0x2c, +0x44, +0x42, +0x55, +0x47, +0x1, +0x98, +0x68, +0x60, +0x96, +0x60, +0x60, +0x74, +0x87, +0x60, +0x1, +0x61, +0x70, +0x0, +0x62, +0xa2, +0x10, +0x95, +0x62, +0x61, +0x70, +0x83, +0x88, +0x60, +0x62, +0x0, +0x44, +0x42, +0x47, +0x42, +0x75, +0x62, +0x70, +0xa, +0xa, +0x44, +0x42, +0x47, +0x42, +0x10, +0x22, +0x5f, +0x53, +0x42, +0x5f, +0x5b, +0x82, +0x1b, +0x50, +0x43, +0x49, +0x30, +0x8, +0x5f, +0x48, +0x49, +0x44, +0xc, +0x41, +0xd0, +0xa, +0x3, +0x8, +0x5f, +0x41, +0x44, +0x52, +0x0, +0x8, +0x5f, +0x55, +0x49, +0x44, +0x1, +0x10, +0x4e, +0x15, +0x2e, +0x5f, +0x53, +0x42, +0x5f, +0x50, +0x43, +0x49, +0x30, +0x8, +0x43, +0x52, +0x45, +0x53, +0x11, +0x42, +0x7, +0xa, +0x6e, +0x88, +0xd, +0x0, +0x2, +0xc, +0x0, +0x0, +0x0, +0x0, +0x0, +0xff, +0x0, +0x0, +0x0, +0x0, +0x1, +0x47, +0x1, +0xf8, +0xc, +0xf8, +0xc, +0x1, +0x8, +0x88, +0xd, +0x0, +0x1, +0xc, +0x3, +0x0, +0x0, +0x0, +0x0, +0xf7, +0xc, +0x0, +0x0, +0xf8, +0xc, +0x88, +0xd, +0x0, +0x1, +0xc, +0x3, +0x0, +0x0, +0x0, +0xd, +0xff, +0xff, +0x0, +0x0, +0x0, +0xf3, +0x87, +0x17, +0x0, +0x0, +0xc, +0x3, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0xa, +0x0, +0xff, +0xff, +0xb, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0x2, +0x0, +0x87, +0x17, +0x0, +0x0, +0xc, +0x1, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0xe0, +0xff, +0xff, +0xbf, +0xfe, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0xc0, +0x1e, +0x79, +0x0, +0x8, +0x43, +0x52, +0x36, +0x34, +0x11, +0x33, +0xa, +0x30, +0x8a, +0x2b, +0x0, +0x0, +0xc, +0x3, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0x80, +0x0, +0x0, +0x0, +0xff, +0xff, +0xff, +0xff, +0xff, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0x0, +0x80, +0x0, +0x0, +0x0, +0x79, +0x0, +0x14, +0x41, +0xa, +0x5f, +0x43, +0x52, +0x53, +0x0, +0x8a, +0x43, +0x52, +0x45, +0x53, +0xa, +0x5c, +0x50, +0x53, +0x33, +0x32, +0x8a, +0x43, +0x52, +0x45, +0x53, +0xa, +0x60, +0x50, +0x45, +0x33, +0x32, +0x8a, +0x43, +0x52, +0x45, +0x53, +0xa, +0x68, +0x50, +0x4c, +0x33, +0x32, +0x70, +0x50, +0x30, +0x53, +0x5f, +0x50, +0x53, +0x33, +0x32, +0x70, +0x50, +0x30, +0x45, +0x5f, +0x50, +0x45, +0x33, +0x32, +0x70, +0x72, +0x74, +0x50, +0x30, +0x45, +0x5f, +0x50, +0x30, +0x53, +0x5f, +0x0, +0x1, +0x0, +0x50, +0x4c, +0x33, +0x32, +0xa0, +0xc, +0x93, +0x50, +0x31, +0x56, +0x5f, +0x0, +0xa4, +0x43, +0x52, +0x45, +0x53, +0x8f, +0x43, +0x52, +0x36, +0x34, +0xa, +0xe, +0x50, +0x53, +0x36, +0x34, +0x8f, +0x43, +0x52, +0x36, +0x34, +0xa, +0x16, +0x50, +0x45, +0x36, +0x34, +0x8f, +0x43, +0x52, +0x36, +0x34, +0xa, +0x26, +0x50, +0x4c, +0x36, +0x34, +0x70, +0x50, +0x31, +0x53, +0x5f, +0x50, +0x53, +0x36, +0x34, +0x70, +0x50, +0x31, +0x45, +0x5f, +0x50, +0x45, +0x36, +0x34, +0x70, +0x50, +0x31, +0x4c, +0x5f, +0x50, +0x4c, +0x36, +0x34, +0x84, +0x43, +0x52, +0x45, +0x53, +0x43, +0x52, +0x36, +0x34, +0x60, +0xa4, +0x60, +0x10, +0x4d, +0x8, +0x5f, +0x53, +0x42, +0x5f, +0x5b, +0x82, +0x45, +0x8, +0x48, +0x50, +0x45, +0x54, +0x8, +0x5f, +0x48, +0x49, +0x44, +0xc, +0x41, +0xd0, +0x1, +0x3, +0x8, +0x5f, +0x55, +0x49, +0x44, +0x0, +0x5b, +0x80, +0x48, +0x50, +0x54, +0x4d, +0x0, +0xc, +0x0, +0x0, +0xd0, +0xfe, +0xb, +0x0, +0x4, +0x5b, +0x81, +0x10, +0x48, +0x50, +0x54, +0x4d, +0x13, +0x56, +0x45, +0x4e, +0x44, +0x20, +0x50, +0x52, +0x44, +0x5f, +0x20, +0x14, +0x36, +0x5f, +0x53, +0x54, +0x41, +0x0, +0x70, +0x56, +0x45, +0x4e, +0x44, +0x60, +0x70, +0x50, +0x52, +0x44, +0x5f, +0x61, +0x7a, +0x60, +0xa, +0x10, +0x60, +0xa0, +0xc, +0x91, +0x93, +0x60, +0x0, +0x93, +0x60, +0xb, +0xff, +0xff, +0xa4, +0x0, +0xa0, +0xe, +0x91, +0x93, +0x61, +0x0, +0x94, +0x61, +0xc, +0x0, +0xe1, +0xf5, +0x5, +0xa4, +0x0, +0xa4, +0xa, +0xf, +0x8, +0x5f, +0x43, +0x52, +0x53, +0x11, +0x11, +0xa, +0xe, +0x86, +0x9, +0x0, +0x0, +0x0, +0x0, +0xd0, +0xfe, +0x0, +0x4, +0x0, +0x0, +0x79, +0x0, +0x10, +0x40, +0x6, +0x2e, +0x5f, +0x53, +0x42, +0x5f, +0x50, +0x43, +0x49, +0x30, +0x5b, +0x82, +0x43, +0x5, +0x56, +0x47, +0x41, +0x5f, +0x8, +0x5f, +0x41, +0x44, +0x52, +0xc, +0x0, +0x0, +0x2, +0x0, +0x5b, +0x80, +0x50, +0x43, +0x49, +0x43, +0x2, +0x0, +0xa, +0x4, +0x5b, +0x81, +0xb, +0x50, +0x43, +0x49, +0x43, +0x3, +0x56, +0x45, +0x4e, +0x44, +0x20, +0x14, +0x8, +0x5f, +0x53, +0x31, +0x44, +0x0, +0xa4, +0x0, +0x14, +0x8, +0x5f, +0x53, +0x32, +0x44, +0x0, +0xa4, +0x0, +0x14, +0x19, +0x5f, +0x53, +0x33, +0x44, +0x0, +0xa0, +0xe, +0x93, +0x56, +0x45, +0x4e, +0x44, +0xc, +0x36, +0x1b, +0x0, +0x1, +0xa4, +0xa, +0x3, +0xa1, +0x3, +0xa4, +0x0, +0x10, +0x25, +0x2e, +0x5f, +0x53, +0x42, +0x5f, +0x50, +0x43, +0x49, +0x30, +0x5b, +0x82, +0x19, +0x50, +0x58, +0x31, +0x33, +0x8, +0x5f, +0x41, +0x44, +0x52, +0xc, +0x3, +0x0, +0x1, +0x0, +0x5b, +0x80, +0x50, +0x31, +0x33, +0x43, +0x2, +0x0, +0xa, +0xff, +0x10, +0x46, +0x5, +0x2e, +0x5f, +0x53, +0x42, +0x5f, +0x50, +0x43, +0x49, +0x30, +0x5b, +0x82, +0x49, +0x4, +0x49, +0x53, +0x41, +0x5f, +0x8, +0x5f, +0x41, +0x44, +0x52, +0xc, +0x0, +0x0, +0x1, +0x0, +0x5b, +0x80, +0x50, +0x34, +0x30, +0x43, +0x2, +0xa, +0x60, +0xa, +0x4, +0x5b, +0x81, +0x26, +0x5e, +0x2e, +0x50, +0x58, +0x31, +0x33, +0x50, +0x31, +0x33, +0x43, +0x0, +0x0, +0x48, +0x2f, +0x0, +0x7, +0x4c, +0x50, +0x45, +0x4e, +0x1, +0x0, +0x38, +0x0, +0x3, +0x43, +0x41, +0x45, +0x4e, +0x1, +0x0, +0x3, +0x43, +0x42, +0x45, +0x4e, +0x1, +0x8, +0x46, +0x44, +0x45, +0x4e, +0x1, +0x10, +0x4c, +0x1b, +0x2f, +0x3, +0x5f, +0x53, +0x42, +0x5f, +0x50, +0x43, +0x49, +0x30, +0x49, +0x53, +0x41, +0x5f, +0x5b, +0x82, +0x2d, +0x52, +0x54, +0x43, +0x5f, +0x8, +0x5f, +0x48, +0x49, +0x44, +0xc, +0x41, +0xd0, +0xb, +0x0, +0x8, +0x5f, +0x43, +0x52, +0x53, +0x11, +0x18, +0xa, +0x15, +0x47, +0x1, +0x70, +0x0, +0x70, +0x0, +0x10, +0x2, +0x22, +0x0, +0x1, +0x47, +0x1, +0x72, +0x0, +0x72, +0x0, +0x2, +0x6, +0x79, +0x0, +0x5b, +0x82, +0x37, +0x4b, +0x42, +0x44, +0x5f, +0x8, +0x5f, +0x48, +0x49, +0x44, +0xc, +0x41, +0xd0, +0x3, +0x3, +0x14, +0x9, +0x5f, +0x53, +0x54, +0x41, +0x0, +0xa4, +0xa, +0xf, +0x8, +0x5f, +0x43, +0x52, +0x53, +0x11, +0x18, +0xa, +0x15, +0x47, +0x1, +0x60, +0x0, +0x60, +0x0, +0x1, +0x1, +0x47, +0x1, +0x64, +0x0, +0x64, +0x0, +0x1, +0x1, +0x22, +0x2, +0x0, +0x79, +0x0, +0x5b, +0x82, +0x27, +0x4d, +0x4f, +0x55, +0x5f, +0x8, +0x5f, +0x48, +0x49, +0x44, +0xc, +0x41, +0xd0, +0xf, +0x13, +0x14, +0x9, +0x5f, +0x53, +0x54, +0x41, +0x0, +0xa4, +0xa, +0xf, +0x8, +0x5f, +0x43, +0x52, +0x53, +0x11, +0x8, +0xa, +0x5, +0x22, +0x0, +0x10, +0x79, +0x0, +0x5b, +0x82, +0x4a, +0x4, +0x46, +0x44, +0x43, +0x30, +0x8, +0x5f, +0x48, +0x49, +0x44, +0xc, +0x41, +0xd0, +0x7, +0x0, +0x14, +0x18, +0x5f, +0x53, +0x54, +0x41, +0x0, +0x70, +0x46, +0x44, +0x45, +0x4e, +0x60, +0xa0, +0x6, +0x93, +0x60, +0x0, +0xa4, +0x0, +0xa1, +0x4, +0xa4, +0xa, +0xf, +0x8, +0x5f, +0x43, +0x52, +0x53, +0x11, +0x1b, +0xa, +0x18, +0x47, +0x1, +0xf2, +0x3, +0xf2, +0x3, +0x0, +0x4, +0x47, +0x1, +0xf7, +0x3, +0xf7, +0x3, +0x0, +0x1, +0x22, +0x40, +0x0, +0x2a, +0x4, +0x0, +0x79, +0x0, +0x5b, +0x82, +0x3e, +0x4c, +0x50, +0x54, +0x5f, +0x8, +0x5f, +0x48, +0x49, +0x44, +0xc, +0x41, +0xd0, +0x4, +0x0, +0x14, +0x18, +0x5f, +0x53, +0x54, +0x41, +0x0, +0x70, +0x4c, +0x50, +0x45, +0x4e, +0x60, +0xa0, +0x6, +0x93, +0x60, +0x0, +0xa4, +0x0, +0xa1, +0x4, +0xa4, +0xa, +0xf, +0x8, +0x5f, +0x43, +0x52, +0x53, +0x11, +0x10, +0xa, +0xd, +0x47, +0x1, +0x78, +0x3, +0x78, +0x3, +0x8, +0x8, +0x22, +0x80, +0x0, +0x79, +0x0, +0x5b, +0x82, +0x45, +0x4, +0x43, +0x4f, +0x4d, +0x31, +0x8, +0x5f, +0x48, +0x49, +0x44, +0xc, +0x41, +0xd0, +0x5, +0x1, +0x8, +0x5f, +0x55, +0x49, +0x44, +0x1, +0x14, +0x18, +0x5f, +0x53, +0x54, +0x41, +0x0, +0x70, +0x43, +0x41, +0x45, +0x4e, +0x60, +0xa0, +0x6, +0x93, +0x60, +0x0, +0xa4, +0x0, +0xa1, +0x4, +0xa4, +0xa, +0xf, +0x8, +0x5f, +0x43, +0x52, +0x53, +0x11, +0x10, +0xa, +0xd, +0x47, +0x1, +0xf8, +0x3, +0xf8, +0x3, +0x0, +0x8, +0x22, +0x10, +0x0, +0x79, +0x0, +0x5b, +0x82, +0x46, +0x4, +0x43, +0x4f, +0x4d, +0x32, +0x8, +0x5f, +0x48, +0x49, +0x44, +0xc, +0x41, +0xd0, +0x5, +0x1, +0x8, +0x5f, +0x55, +0x49, +0x44, +0xa, +0x2, +0x14, +0x18, +0x5f, +0x53, +0x54, +0x41, +0x0, +0x70, +0x43, +0x42, +0x45, +0x4e, +0x60, +0xa0, +0x6, +0x93, +0x60, +0x0, +0xa4, +0x0, +0xa1, +0x4, +0xa4, +0xa, +0xf, +0x8, +0x5f, +0x43, +0x52, +0x53, +0x11, +0x10, +0xa, +0xd, +0x47, +0x1, +0xf8, +0x2, +0xf8, +0x2, +0x0, +0x8, +0x22, +0x8, +0x0, +0x79, +0x0, +0x10, +0x4b, +0x8, +0x2e, +0x5f, +0x53, +0x42, +0x5f, +0x50, +0x43, +0x49, +0x30, +0x5b, +0x80, +0x50, +0x43, +0x53, +0x54, +0x1, +0xb, +0x0, +0xae, +0xa, +0x8, +0x5b, +0x81, +0x10, +0x50, +0x43, +0x53, +0x54, +0x43, +0x50, +0x43, +0x49, +0x55, +0x20, +0x50, +0x43, +0x49, +0x44, +0x20, +0x5b, +0x80, +0x53, +0x45, +0x4a, +0x5f, +0x1, +0xb, +0x8, +0xae, +0xa, +0x4, +0x5b, +0x81, +0xb, +0x53, +0x45, +0x4a, +0x5f, +0x43, +0x42, +0x30, +0x45, +0x4a, +0x20, +0x14, +0x11, +0x50, +0x43, +0x45, +0x4a, +0x1, +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, +0x79, +0x1, +0x60, +0x0, +0x0, +0x50, +0x43, +0x4e, +0x54, +0x60, +0x1, +0xa0, +0x12, +0x7b, +0x50, +0x43, +0x49, +0x44, +0x79, +0x1, +0x60, +0x0, +0x0, +0x50, +0x43, +0x4e, +0x54, +0x60, +0xa, +0x3, +0x10, +0x4a, +0xa0, +0x5f, +0x53, +0x42, +0x5f, +0x10, +0x47, +0x74, +0x50, +0x43, +0x49, +0x30, +0x8, +0x5f, +0x50, +0x52, +0x54, +0x12, +0x4b, +0x73, +0x80, +0x12, +0xb, +0x4, +0xb, +0xff, +0xff, +0x0, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xb, +0x4, +0xb, +0xff, +0xff, +0x1, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xc, +0x4, +0xb, +0xff, +0xff, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xc, +0x4, +0xb, +0xff, +0xff, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x1, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x53, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x1, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x1, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x1, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x2, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x2, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x2, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x2, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x3, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x3, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x3, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x3, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x4, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x4, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x4, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x4, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x5, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x5, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x5, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x5, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x6, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x6, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x6, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x6, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x7, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x7, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x7, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x7, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x8, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x8, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x8, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x8, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x9, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x9, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x9, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x9, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0xa, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0xa, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0xa, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0xa, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0xb, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0xb, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0xb, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0xb, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0xc, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0xc, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0xc, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0xc, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0xd, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0xd, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0xd, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0xd, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0xe, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0xe, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0xe, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0xe, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0xf, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0xf, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0xf, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0xf, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x10, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x10, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x10, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x10, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x11, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x11, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x11, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x11, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x12, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x12, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x12, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x12, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x13, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x13, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x13, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x13, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x14, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x14, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x14, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x14, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x15, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x15, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x15, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x15, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x16, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x16, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x16, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x16, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x17, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x17, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x17, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x17, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x18, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x18, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x18, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x18, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x19, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x41, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x19, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x19, +0x0, +0xa, +0x2, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xe, +0x4, +0xc, +0xff, +0xff, +0x19, +0x0, +0xa, +0x3, +0x4c, +0x4e, +0x4b, +0x44, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x1a, +0x0, +0x0, +0x4c, +0x4e, +0x4b, +0x42, +0x0, +0x12, +0xd, +0x4, +0xc, +0xff, +0xff, +0x1a, +0x0, +0x1, +0x4c, +0x4e, +0x4b, +0x43, +0x0, +0x12, +0xe, +0x4,
Lines of this file are not shown. View the raw message.
hw/i386/q35-acpi-dsdt.hex.generated new file +7346 -0
7,346 lines not on this page · raw message
hw/i386/ssdt-misc.hex.generated new file +190 -0
190 lines not on this page · raw message
hw/i386/ssdt-pcihp.hex.generated new file +108 -0
108 lines not on this page · raw message
hw/i386/ssdt-proc.hex.generated new file +134 -0
134 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
MST
Part of the diff is not shown here. View the raw message.
RFC PATCH 8/13 range: add Range structure
In reply to Michael S. TsirkinSometimes we need to pass ranges around, add a
handy structure for this purpose.
--- include/qemu/range.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
include/qemu/range.h +22 -0
@@ -1,6 +1,28 @@#ifndef QEMU_RANGE_H #define QEMU_RANGE_H +#include <inttypes.h> + +/* +* Operations on 64 address ranges. +* Notes: +* - ranges must not wrap around 0, but can include the last byte ~0x0LL. +* - this can not represent a full 0 to ~0x0LL range. +*/ + +/* A structure representing a range of addresses. */ +struct Range { +uint64_t begin;/* First byte of the range, or 0 if empty. */ +uint64_t end;/* 1 + the last byte. 0 if range empty or ends at ~0x0LL. */ +}; +typedef struct Range Range ; + +/* verify that range is not empty and does not overlap */ +static inline bool range_valid (struct Range *range) +{ +return range->begin +1 <= range->end; +} +/* Get last byte of a range from offset + length. * Undefined for ranges that wrap around 0. */ static inline uint64_t range_get_last (uint64_t offset,uint64_t len)
Signature · 1 line
MST
Re: [Qemu-devel] [PATCH RFC 08/13] range: add Range structure
Quoted 13 lines · Michael S. Tsirkin
Sometimes we need to pass ranges around, add a
handy structure for this purpose.Signed-off-by Michael S. Tsirkin <[email protected]>--- include/qemu/range.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)include/qemu/range.h +0
-0
include/qemu/range.h line 7
Quoted 7 lines
include/qemu/range.h +4
-0@@ -1,6 +1,28 @@#ifndef QEMU_RANGE_H #define QEMU_RANGE_H +#include <inttypes.h> + +/* +* Operations on 64 address ranges.
missing "bit" ?
include/qemu/range.h line 20
Quoted 13 lines
include/qemu/range.h +13
-0+* Notes: +* - ranges must not wrap around 0, but can include the last byte ~0x0LL. +* - this can not represent a full 0 to ~0x0LL range. +*/ + +/* A structure representing a range of addresses. */ +struct Range { +uint64_t begin;/* First byte of the range, or 0 if empty. */ +uint64_t end;/* 1 + the last byte. 0 if range empty or ends at ~0x0LL. */ +}; +typedef struct Range Range ; + +/* verify that range is not empty and does not overlap */
Doesn't overlap what? Why isn't an empty range valid? The struct definition above says it's OK.
include/qemu/range.h line 24
Quoted 4 lines
include/qemu/range.h +4
-0+static inline bool range_valid (struct Range *range) +{ +return range->begin +1 <= range->end; +}
I note that memory.c defines its own concept of an AddrRange.
thanks
-- PMM
Re: [Qemu-devel] [PATCH RFC 08/13] range: add Range structure
Quoted 24 lines · Peter Maydell
Quoted 13 lines · Michael S. Tsirkin
Sometimes we need to pass ranges around, add a
handy structure for this purpose.Signed-off-by Michael S. Tsirkin <[email protected]>--- include/qemu/range.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)include/qemu/range.h +0
-0include/qemu/range.h line 7
Quoted 7 lines
include/qemu/range.h +4
-0@@ -1,6 +1,28 @@#ifndef QEMU_RANGE_H #define QEMU_RANGE_H +#include <inttypes.h> + +/* +* Operations on 64 address ranges. missing "bit" ?
Quoted 15 lines
include/qemu/range.h line 20
Quoted 13 lines
include/qemu/range.h +13
-0+* Notes: +* - ranges must not wrap around 0, but can include the last byte ~0x0LL. +* - this can not represent a full 0 to ~0x0LL range. +*/ + +/* A structure representing a range of addresses. */ +struct Range { +uint64_t begin;/* First byte of the range, or 0 if empty. */ +uint64_t end;/* 1 + the last byte. 0 if range empty or ends at ~0x0LL. */ +}; +typedef struct Range Range ; + +/* verify that range is not empty and does not overlap */ Doesn't overlap what?
I meant wrap around there.
Quoted 2 lines
Why isn't an empty range valid?
The struct definition above says it's OK.
Yes it's a bad name. Should be range_non_empty or something.
Quoted 8 lines
include/qemu/range.h line 24
Quoted 3 lines
include/qemu/range.h +3
-0+{ +return range->begin +1 <= range->end; +}I note that
memory.cdefines its own concept of an AddrRange.thanks
-- PMM
Good point, maybe I'll reuse that or just use two 64 bit fields explicitly.
Signature · 1 line
MST
RFC PATCH 9/13 i386: add bios linker/loader
In reply to Michael S. TsirkinThis add a dynamic bios linker/loader.
This will be used by acpi table generation code to:
- load each table in the appropriate memory egment
- link tables to each other
- fix up checksums after said linking
--- hw/i386/Makefile.objs | 1 + hw/i386/bios-linker-loader.c | 155 +++++++++++++++++++++++++++++++++++ include/hw/i386/bios-linker-loader.h | 26 ++++++ 3 files changed, 182 insertions(+) create mode 100644 hw/i386/bios-linker-loader.c create mode 100644 include/hw/i386/bios-linker-loader.h
hw/i386/Makefile.objs +1 -0
@@ -4,6 +4,7 @@ obj-y += pc.o pc_piix.o pc_q35.o obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o obj-y += kvmvapic.o +obj-y += bios-linker-loader.o iasl-option=$(shell if test -z "`$(1) $(2) 2>&1 > /dev/null`" \ ; then echo "$(2)"; else echo "$(3)"; fi ;)
hw/i386/bios-linker-loader.c new file +155 -0
155 lines not on this page · raw message
include/hw/i386/bios-linker-loader.h new file +26 -0
@@ -0,0 +1,26 @@ +#ifndef BIOS_LINKER_LOADER_H +#define BIOS_LINKER_LOADER_H + +#include <glib.h> +#include <stdbool.h> +#include <inttypes.h> + +GArray *bios_linker_init (void ); + +void bios_linker_alloc (GArray *linker, +const char *file, +uint32_t alloc_align, +bool alloc_fseg); + +void bios_linker_add_checksum (GArray *linker,const char *file,void *table, +void *start,unsigned size,uint8_t *checksum); + + +void bios_linker_add_pointer (GArray *linker, +const char *dest_file, +const char *src_file, +GArray *table,void *pointer, +uint8_t pointer_size); + +void *bios_linker_cleanup (GArray *linker); +#endif
Signature · 1 line
MST
RFC PATCH 10/13 i386: generate pc guest info
In reply to Michael S. TsirkinThis fills in guest info table with misc
information of interest to the guest.
Will be used by ACPI table generation code.
--- hw/acpi/ich9.c | 7 ++++- hw/acpi/piix4.c | 44 +++++++++++++++++++++++++- hw/i386/Makefile.objs | 2 ++ hw/i386/pc.c | 80 +++++++++++++++++++++++++++++++++++++++++++++-- hw/i386/pc_piix.c | 26 +++++++++++++-- hw/i386/pc_q35.c | 14 +++++++-- hw/isa/lpc_ich9.c | 11 +++++-- hw/mips/mips_malta.c | 2 +- hw/pci-host/q35.c | 5 +++ include/hw/acpi/ich9.h | 2 +- include/hw/i386/ich9.h | 3 +- include/hw/i386/pc.h | 53 +++++++++++++++++++++++++++++-- include/hw/pci-host/q35.h | 2 ++ include/qemu/typedefs.h | 1 + 14 files changed, 233 insertions(+), 19 deletions(-)
hw/acpi/ich9.c +6 -1
@@ -203,7 +203,7 @@ static void pm_powerdown_req(Notifier *n, void *opaque) }void ich9_pm_init (PCIDevice *lpc_pci,ICH9LPCPMRegs *pm, -qemu_irq sci_irq) +qemu_irq sci_irq,PcGuestInfo *guest_info) {memory_region_init (&pm->io,"ich9-pm" ,ICH9_PMIO_SIZE );memory_region_set_enabled (&pm->io, false);
@@ -219,6 +219,11 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, ICH9_PMIO_GPE0_LEN);memory_region_add_subregion (&pm->io,ICH9_PMIO_GPE0_STS , &pm->io_gpe); + guest_info->gpe0_blk =PC_GUEST_PORT_ACPI_PM_BASE +ICH9_PMIO_GPE0_STS ; + guest_info->gpe0_blk_len =ICH9_PMIO_GPE0_LEN ; + guest_info->fix_rtc = true; + guest_info->platform_timer = false; +memory_region_init_io (&pm->io_smi, &ich9_smi_ops, pm,"apci-smi" ,8 );memory_region_add_subregion (&pm->io,ICH9_PMIO_SMI_EN , &pm->io_smi);
hw/acpi/piix4.c +43 -1
74 lines not on this page · raw message
hw/i386/Makefile.objs +2 -0
@@ -5,6 +5,8 @@ obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o obj-y += kvmvapic.o obj-y += bios-linker-loader.o +hw/i386/pc_piix.o: hw/i386/pc_piix.c hw/i386/acpi-dsdt.hex +hw/i386/pc_q35.o: hw/i386/pc_q35.c hw/i386/q35-acpi-dsdt.hex iasl-option=$(shell if test -z "`$(1) $(2) 2>&1 > /dev/null`" \ ; then echo "$(2)"; else echo "$(3)"; fi ;)
hw/i386/pc.c +77 -3
110 lines not on this page · raw message
hw/i386/pc_piix.c +23 -3
@@ -50,6 +50,8 @@# include <xen/hvm/hvm_info_table.h> #endif +#include "hw/i386/acpi-dsdt.hex" +#define MAX_IDE_BUS 2static const int ide_iobase[MAX_IDE_BUS ] = {0x1f0 ,0x170 };
@@ -90,6 +92,7 @@ static void pc_init1(MemoryRegion *system_memory,MemoryRegion *rom_memory;DeviceState *icc_bridge;FWCfgState *fw_cfg =NULL ; +PcGuestInfo *guest_info; icc_bridge =qdev_create (NULL ,TYPE_ICC_BRIDGE ); object_property_add_child(qdev_get_machine(), "icc-bridge",
@@ -119,12 +122,26 @@ static void pc_init1(MemoryRegion *system_memory, rom_memory = system_memory; } + guest_info =pc_guest_info_init (below_4g_mem_size, above_4g_mem_size); + + guest_info->dsdt_code = AcpiDsdtAmlCode; + guest_info->dsdt_size =sizeof AcpiDsdtAmlCode; + +/* Set PCI window size the way seabios has always done it. */ +/* TODO: consider just starting at below_4g_mem_size */ +if (ram_size <=0x80000000 ) + guest_info->pci_info.w32.begin =0x80000000 ; +else if (ram_size <=0xc0000000 ) + guest_info->pci_info.w32.begin =0xc0000000 ; +else + guest_info->pci_info.w32.begin =0xe0000000 ; +/* 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, - rom_memory, &ram_memory); + rom_memory, &ram_memory, guest_info); } gsi_state =g_malloc0 (sizeof (*gsi_state));
@@ -179,7 +196,8 @@ static void pc_init1(MemoryRegion *system_memory, }/* init basic PC hardware */ -pc_basic_device_init (isa_bus, gsi, &rtc_state, &floppy,xen_enabled ()); +pc_basic_device_init (isa_bus, gsi, &rtc_state, &floppy,xen_enabled (), + guest_info);pc_nic_init (isa_bus, pci_bus);
@@ -218,7 +236,9 @@ static void pc_init1(MemoryRegion *system_memory,/* TODO: Populate SPD eeprom data. */ smbus =piix4_pm_init (pci_bus, piix3_devfn +3 ,0xb100 , gsi[9 ], *smi_irq, -kvm_enabled (), fw_cfg); +kvm_enabled (), fw_cfg, + guest_info); + guest_info->sci_int =9 ;smbus_eeprom_init (smbus,8 ,NULL ,0 ); }
hw/i386/pc_q35.c +11 -3
@@ -43,6 +43,8 @@#include "hw/usb.h" #include "hw/cpu/icc_bus.h" +#include "hw/i386/q35-acpi-dsdt.hex" +/* ICH9 AHCI has 6 ports */ #define MAX_SATA_PORTS 6
@@ -77,6 +79,7 @@ static void pc_q35_init(QEMUMachineInitArgs *args)ICH9LPCState *ich9_lpc;PCIDevice *ahci;DeviceState *icc_bridge; +PcGuestInfo *guest_info; icc_bridge =qdev_create (NULL ,TYPE_ICC_BRIDGE ); object_property_add_child(qdev_get_machine(), "icc-bridge",
@@ -105,11 +108,15 @@ static void pc_q35_init(QEMUMachineInitArgs *args) rom_memory =get_system_memory (); } + guest_info =pc_guest_info_init (below_4g_mem_size, above_4g_mem_size); + guest_info->dsdt_code = Q35AcpiDsdtAmlCode; + guest_info->dsdt_size =sizeof Q35AcpiDsdtAmlCode; +/* allocate ram and load rom/bios */ if (!xen_enabled ()) {pc_memory_init (get_system_memory (), kernel_filename, kernel_cmdline, initrd_filename, below_4g_mem_size, above_4g_mem_size, - rom_memory, &ram_memory); + rom_memory, &ram_memory, guest_info); }/* irq lines */
@@ -131,6 +138,7 @@ static void pc_q35_init(QEMUMachineInitArgs *args) q35_host->mch.address_space_io =get_system_io ();; q35_host->mch.below_4g_mem_size = below_4g_mem_size; q35_host->mch.above_4g_mem_size = above_4g_mem_size; + q35_host->mch.guest_info = guest_info;/* pci */ qdev_init_nofail (DEVICE (q35_host)); host_bus = q35_host->host.pci.bus;
@@ -169,10 +177,10 @@ static void pc_q35_init(QEMUMachineInitArgs *args)pc_register_ferr_irq (gsi[13 ]);/* init basic PC hardware */ -pc_basic_device_init (isa_bus, gsi, &rtc_state, &floppy, false); +pc_basic_device_init (isa_bus, gsi, &rtc_state, &floppy, false, guest_info);/* connect pm stuff to lpc */ -ich9_lpc_pm_init (lpc); +ich9_lpc_pm_init (lpc, guest_info);/* ahci and SATA device, for q35 1 ahci controller is built-in */ ahci = pci_create_simple_multifunction(host_bus,
hw/isa/lpc_ich9.c +9 -2
@@ -312,6 +312,13 @@ PCIINTxRoute ich9_route_intx_pin_to_irq(void *opaque, int pirq_pin)return route; } +void ich9_lpc_set_guest_info (PcGuestInfo *guest_info) +{ + guest_info->sci_int =9 ; + guest_info->acpi_enable_cmd =ICH9_APM_ACPI_ENABLE ; + guest_info->acpi_disable_cmd =ICH9_APM_ACPI_DISABLE ; +} +static int ich9_lpc_sci_irq (ICH9LPCState *lpc) { switch (lpc->d.config[ICH9_LPC_ACPI_CTRL] &
@@ -356,13 +363,13 @@ static void ich9_set_sci(void *opaque, int irq_num, int level) } } -void ich9_lpc_pm_init (PCIDevice *lpc_pci) +void ich9_lpc_pm_init (PCIDevice *lpc_pci,PcGuestInfo *guest_info) {ICH9LPCState *lpc =ICH9_LPC_DEVICE (lpc_pci);qemu_irq *sci_irq; sci_irq =qemu_allocate_irqs (ich9_set_sci, lpc,1 ); -ich9_pm_init (lpc_pci, &lpc->pm, sci_irq[0 ]); +ich9_pm_init (lpc_pci, &lpc->pm, sci_irq[0 ], guest_info);ich9_lpc_reset (&lpc->d.qdev); }
hw/mips/mips_malta.c +1 -1
@@ -965,7 +965,7 @@ void mips_malta_init(QEMUMachineInitArgs *args)pci_piix4_ide_init (pci_bus, hd, piix4_devfn +1 );pci_create_simple (pci_bus, piix4_devfn +2 ,"piix4-usb-uhci" ); smbus =piix4_pm_init (pci_bus, piix4_devfn +3 ,0x1100 , -isa_get_irq (NULL ,9 ),NULL ,0 ,NULL ); +isa_get_irq (NULL ,9 ),NULL ,0 ,NULL ,NULL );/* TODO: Populate SPD eeprom data. */ smbus_eeprom_init (smbus,8 ,NULL ,0 ); pit =pit_init (isa_bus,0x40 ,0 ,NULL );
hw/pci-host/q35.c +5 -0
@@ -243,6 +243,11 @@ static int mch_init(PCIDevice *d)hwaddr pci_hole64_size;MCHPCIState *mch =MCH_PCI_DEVICE (d); + mch->guest_info->mcfg_base =MCH_HOST_BRIDGE_PCIEXBAR_DEFAULT ; +/* Leave enough space for the biggest MCFG BAR */ + mch->guest_info->pci_info.w32.begin = mch->guest_info->mcfg_base + +MCH_HOST_BRIDGE_PCIEXBAR_MAX ; +/* setup pci memory regions */ memory_region_init_alias(&mch->pci_hole, "pci-hole", mch->pci_address_space,
include/hw/acpi/ich9.h +1 -1
@@ -45,7 +45,7 @@ typedef struct ICH9LPCPMRegs { } ICH9LPCPMRegs;void ich9_pm_init (PCIDevice *lpc_pci,ICH9LPCPMRegs *pm, -qemu_irq sci_irq); +qemu_irq sci_irq,PcGuestInfo *guest_info);void ich9_pm_iospace_update (ICH9LPCPMRegs *pm,uint32_t pm_io_base);extern const VMStateDescription vmstate_ich9_pm;
include/hw/i386/ich9.h +2 -1
@@ -15,10 +15,11 @@#include "hw/acpi/ich9.h" #include "hw/pci/pci_bus.h" +void ich9_lpc_set_guest_info (PcGuestInfo *guest_info);void ich9_lpc_set_irq (void *opaque,int irq_num,int level);int ich9_lpc_map_irq (PCIDevice *pci_dev,int intx);PCIINTxRoute ich9_route_intx_pin_to_irq (void *opaque,int pirq_pin); -void ich9_lpc_pm_init (PCIDevice *pci_lpc); +void ich9_lpc_pm_init (PCIDevice *pci_lpc,PcGuestInfo *guest_info);PCIBus *ich9_d2pbr_init (PCIBus *bus,int devfn,int sec_bus);i2c_bus *ich9_smb_init (PCIBus *bus,int devfn,uint32_t smb_io_base);
include/hw/i386/pc.h +50 -3
84 lines not on this page · raw message
include/hw/pci-host/q35.h +2 -0
@@ -55,6 +55,7 @@ typedef struct MCHPCIState {uint8_t smm_enabled;ram_addr_t below_4g_mem_size;ram_addr_t above_4g_mem_size; +PcGuestInfo *guest_info; } MCHPCIState; typedef struct Q35PCIHost {
@@ -81,6 +82,7 @@ typedef struct Q35PCIHost {#define MCH_HOST_BRIDGE_PCIEXBAR 0x60/* 64bit register */ #define MCH_HOST_BRIDGE_PCIEXBAR_SIZE 8/* 64bit register */ #define MCH_HOST_BRIDGE_PCIEXBAR_DEFAULT 0xb0000000 +#define MCH_HOST_BRIDGE_PCIEXBAR_MAX (0x10000000)/* 256M */ #define MCH_HOST_BRIDGE_PCIEXBAR_ADMSK Q35_MASK(64, 35, 28)#define MCH_HOST_BRIDGE_PCIEXBAR_128ADMSK ((uint64_t)(1 << 26))#define MCH_HOST_BRIDGE_PCIEXBAR_64ADMSK ((uint64_t)(1 << 25))
include/qemu/typedefs.h +1 -0
@@ -62,5 +62,6 @@ typedef struct VirtIODevice VirtIODevice;typedef struct QEMUSGList QEMUSGList ;typedef struct SHPCDevice SHPCDevice ;typedef struct FWCfgState FWCfgState ; +typedef struct PcGuestInfo PcGuestInfo ;#endif /* QEMU_TYPEDEFS_H */
Signature · 1 line
MST
Re: [Qemu-devel] [PATCH RFC 10/13] i386: generate pc guest info
Quoted 3 lines · Michael S. Tsirkin
This fills in guest info table with misc
information of interest to the guest.
Will be used by ACPI table generation code.
Bunch of coding style violations in this patch which will need fixing at some point in the RFC->patch process.
thanks
-- PMM
Re: [Qemu-devel] [PATCH RFC 10/13] i386: generate pc guest info
Quoted 10 lines · Peter Maydell
Quoted 3 lines · Michael S. Tsirkin
This fills in guest info table with misc
information of interest to the guest.
Will be used by ACPI table generation code.Bunch of coding style violations in this patch which will need fixing at some point in the
RFC->patchprocess.thanks
-- PMM
I went over it again and found one:
+ if (ram_size <= 0x80000000)
+ guest_info->pci_info.w32.begin = 0x80000000;
+ else if (ram_size <= 0xc0000000)
+ guest_info->pci_info.w32.begin = 0xc0000000;
+ else
+ guest_info->pci_info.w32.begin = 0xe0000000;
should use {}.
One is not a bunch so I obviously missed some - it might be helpful if you pointed them out.
Thanks,
Signature · 1 line
MST
Re: [Qemu-devel] [PATCH RFC 10/13] i386: generate pc guest info
Quoted 8 lines · Michael S. Tsirkin
Quoted 2 lines · Peter Maydell
Bunch of coding style violations in this patch which will need fixing at some point in the
RFC->patchprocess.I went over it again and found one:
One is not a bunch so I obviously missed some - it might be helpful if you pointed them out.
Mmm, I only see one so I think that was just late night sloppy wording on my part; apologies. If checkpatch is happy then that's cool.
thanks
-- PMM
RFC PATCH 11/13 pc: pass PCI hole ranges to Guests
In reply to Michael S. TsirkinGuest currently has to jump through lots of hoops to guess the PCI hole ranges. It's fragile, and makes us change BIOS each time we add a new chipset. Let's report the window in a ROM file, to make BIOS do exactly what QEMU intends.
--- hw/i386/pc.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
hw/i386/pc.c +21 -0
@@ -997,6 +997,26 @@ static void pc_set_cpu_guest_info(CPUState *cpu, void *arg) } } +/* pci-info ROM file. Little endian format */ +typedef struct PcRomPciInfo { +uint64_t w32_min; +uint64_t w32_max; +uint64_t w64_min; +uint64_t w64_max; +}PcRomPciInfo ; + +static void pc_fw_cfg_guest_info (PcGuestInfo *guest_info) +{ +PcRomPciInfo *info =g_malloc (sizeof *info); + info->w32_min =cpu_to_le64 (guest_info->pci_info.w32.begin); + info->w32_max =cpu_to_le64 (guest_info->pci_info.w32.end); + info->w64_min =cpu_to_le64 (guest_info->pci_info.w64.begin); + info->w64_max =cpu_to_le64 (guest_info->pci_info.w64.end); +/* Pass PCI hole info to guest via a side channel. +* Required so guest PCI enumeration does the right thing. */ +fw_cfg_add_file (guest_info->fw_cfg,"etc/pci-info" , info,sizeof *info); +} + typedef struct PcGuestInfoState { PcGuestInfo info; Notifier machine_done;
@@ -1008,6 +1028,7 @@ void pc_guest_info_machine_done(Notifier *notifier, void *data)PcGuestInfoState *guest_info_state =container_of (notifier, PcGuestInfoState, machine_done); +pc_fw_cfg_guest_info (&guest_info_state->info); } PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size,
Signature · 1 line
MST
RFC PATCH 12/13 i386: ACPI table generation code from seabios
In reply to Michael S. TsirkinThis adds C code for generating ACPI tables at runtime, imported from seabios git tree
commit 51684b7ced75fb76776e8ee84833fcfb6ecf12dd
Although ACPI tables come from a system BIOS on real hw, it makes sense that the ACPI tables are coupled with the virtual machine, since they have to abstract the x86 machine to the OS's.
Several future developments that this will enable:
- describe a complex configuration
e.g. a bridged PCI topology to enable
acpi hotplug of devices behind a bridge,
or multi-root.
- make it easier to use alternative firmware:
any firmware can just load the ACPI tables from QEMU. case in point OVMF.
- make it easier to add more chipsets without bumping into fw_cfg boundaries.
Notes:
The code structure was intentionally kept as close to the seabios original as possible, to simplify comparison and making sure we didn't lose anything in translation.
Will be cleaned up and made closer to qemu style
in follow-up patches.
ACPI tables are exposed to guest as FW_CFG entries. This means that this patch breaks migration to older qemu revisions. This will be fixed by follow-up patches.
This patch reuses some code from SeaBIOS, which was originally under LGPLv2 and then relicensed to GPLv3 or LGPLv3, in QEMU under GPLv2+. This relicensing has been acked by all contributors that had contributed to the code since the v2->v3 relicense. ACKs approving the v2+ relicensing are listed below. The list might include ACKs from people not holding copyright on any parts of the reused code, but it's better to err on the side of caution and include them.
Affected SeaBIOS files (GPLv2+ license headers added)
<http://thread.gmane.org/gmane.comp.bios.coreboot.seabios/5949>:
src/acpi-dsdt-cpu-hotplug.dsl | 15 +++++++++++++++ src/acpi-dsdt-dbug.dsl | 15 +++++++++++++++ src/acpi-dsdt-hpet.dsl | 15 +++++++++++++++ src/acpi-dsdt-isa.dsl | 15 +++++++++++++++ src/acpi-dsdt-pci-crs.dsl | 15 +++++++++++++++ src/acpi.c | 14 +++++++++++++- src/acpi.h | 14 ++++++++++++++ src/ssdt-misc.dsl | 15 +++++++++++++++ src/ssdt-pcihp.dsl | 15 +++++++++++++++ src/ssdt-proc.dsl | 15 +++++++++++++++ tools/acpi_extract.py | 13 ++++++++++++- tools/acpi_extract_preprocess.py | 13 ++++++++++++- 12 files changed, 171 insertions(+), 3 deletions(-)
Each one of the listed people agreed to the following:
Quoted 5 lines
If you allow the use of your contribution in QEMU under the terms of GPLv2 or later as proposed by this patch, please respond to this mail including the line:
Acked-by Name <email address>
--- hw/i386/Makefile.objs | 2 + hw/i386/acpi-build.c | 685 +++++++++++++++++++++++++++++++++++++++++++ hw/i386/pc.c | 2 + include/hw/i386/acpi-build.h | 9 + 4 files changed, 698 insertions(+) create mode 100644 hw/i386/acpi-build.c create mode 100644 include/hw/i386/acpi-build.h
hw/i386/Makefile.objs +2 -0
@@ -4,7 +4,9 @@ obj-y += pc.o pc_piix.o pc_q35.o obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o obj-y += kvmvapic.o +obj-y += acpi-build.o obj-y += bios-linker-loader.o +hw/i386/acpi-build.o: hw/i386/acpi-build.c hw/i386/acpi-dsdt.hex hw/i386/ssdt-proc.hex hw/i386/ssdt-pcihp.hex hw/i386/ssdt-misc.hex hw/i386/q35-acpi-dsdt.hex hw/i386/pc_piix.o: hw/i386/pc_piix.c hw/i386/acpi-dsdt.hex hw/i386/pc_q35.o: hw/i386/pc_q35.c hw/i386/q35-acpi-dsdt.hex
hw/i386/acpi-build.c new file +685 -0
685 lines not on this page · raw message
hw/i386/pc.c +2 -0
@@ -55,6 +55,7 @@#include "hw/acpi/acpi.h" #include "hw/cpu/icc_bus.h" #include "hw/boards.h" +#include "hw/i386/acpi-build.h" /* debug PC/ISA interrupts */ //#define DEBUG_IRQ
@@ -1029,6 +1030,7 @@ void pc_guest_info_machine_done(Notifier *notifier, void *data) PcGuestInfoState, machine_done);pc_fw_cfg_guest_info (&guest_info_state->info); +acpi_setup (&guest_info_state->info); } PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size,
include/hw/i386/acpi-build.h new file +9 -0
@@ -0,0 +1,9 @@ + +#ifndef HW_I386_ACPI_BUILD_H +#define HW_I386_ACPI_BUILD_H + +#include "qemu/typedefs.h" + +void acpi_setup (PcGuestInfo *); + +#endif
Signature · 1 line
MST
Re: [Qemu-devel] [PATCH RFC 12/13] i386: ACPI table generation code from seabios
Quoted 1 line · Michael S. Tsirkin
hw/i386/acpi-build.c | 685 +++++++++++++++++++++++++++++++++++++++++++
I'm sitting here hoping nobody ever asks me to add ACPI support for ARM QEMU :-) [not totally impossible one day in the future...]
-- PMM
RFC PATCH 13/13 pc: reuse guest info for legacy fw cfg
In reply to Michael S. TsirkinReduce code duplication by getting legacy
fw cfg data from guest info structure.
--- hw/i386/pc.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-)
hw/i386/pc.c +14 -20
@@ -594,14 +594,13 @@ static unsigned int pc_apic_id_limit(unsigned int max_cpus)return x86_cpu_apic_id_from_index (max_cpus -1 ) +1 ; } -static FWCfgState *bochs_bios_init (void ) +static FWCfgState *bochs_bios_init (PcGuestInfo *guest_info) {FWCfgState *fw_cfg;uint8_t *smbios_table;size_t smbios_len;uint64_t *numa_fw_cfg; -int i, j; -unsigned int apic_id_limit =pc_apic_id_limit (max_cpus); +int i; fw_cfg =fw_cfg_init (BIOS_CFG_IOPORT ,BIOS_CFG_IOPORT +1 ,0 ,0 );/* FW_CFG_MAX_CPUS is a bit confusing/problematic on x86:
@@ -618,7 +617,7 @@ static FWCfgState *bochs_bios_init(void)* [1] The only kind of "CPU identifier" used between SeaBIOS and QEMU is * the APIC ID, not the "CPU index" */ -fw_cfg_add_i16 (fw_cfg,FW_CFG_MAX_CPUS , (uint16_t )apic_id_limit); +fw_cfg_add_i16 (fw_cfg,FW_CFG_MAX_CPUS , (uint16_t )guest_info->apic_id_limit);fw_cfg_add_i32 (fw_cfg,FW_CFG_ID ,1 );fw_cfg_add_i64 (fw_cfg,FW_CFG_RAM_SIZE , (uint64_t )ram_size); fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES,
@@ -637,24 +636,19 @@ static FWCfgState *bochs_bios_init(void)* of nodes, one word for each VCPU->node and one word for each node to * hold the amount of memory. */ - numa_fw_cfg =g_new0 (uint64_t,1 + apic_id_limit + nb_numa_nodes); - numa_fw_cfg[0 ] =cpu_to_le64 (nb_numa_nodes); -for (i =0 ; i < max_cpus; i++) { -unsigned int apic_id =x86_cpu_apic_id_from_index (i); -assert (apic_id < apic_id_limit); -for (j =0 ; j < nb_numa_nodes; j++) { -if (test_bit (i, node_cpumask[j])) { - numa_fw_cfg[apic_id +1 ] =cpu_to_le64 (j); -break ; - } - } + numa_fw_cfg =g_new0 (uint64_t,1 + guest_info->apic_id_limit + + guest_info->numa_nodes); + numa_fw_cfg[0 ] =cpu_to_le64 (guest_info->numa_nodes); +for (i =0 ; i < guest_info->apic_id_limit; i++) { + numa_fw_cfg[i +1 ] =cpu_to_le64 (guest_info->node_cpu[i]); } -for (i =0 ; i < nb_numa_nodes; i++) { - numa_fw_cfg[apic_id_limit +1 + i] =cpu_to_le64 (node_mem[i]); +for (i =0 ; i < guest_info->numa_nodes; i++) { + numa_fw_cfg[guest_info->apic_id_limit +1 + i] = +cpu_to_le64 (guest_info->node_mem[i]); }fw_cfg_add_bytes (fw_cfg,FW_CFG_NUMA , numa_fw_cfg, - (1 + apic_id_limit + nb_numa_nodes) * -sizeof (*numa_fw_cfg)); + (1 + guest_info->apic_id_limit + + guest_info->numa_nodes) *sizeof (*numa_fw_cfg));return fw_cfg; }
@@ -1151,7 +1145,7 @@ FWCfgState *pc_memory_init(MemoryRegion *system_memory, option_rom_mr, 1); - fw_cfg =bochs_bios_init (); + fw_cfg =bochs_bios_init (guest_info);rom_set_fw (fw_cfg);if (linux_boot) {
Signature · 1 line
MST
Quoted 8 lines · Michael S. Tsirkin
This patchset moves all generation of ACPI tables
from guest BIOS to the hypervisor.Although ACPI tables come from a system BIOS on real hw, it makes sense that the ACPI tables are coupled with the virtual machine, since they have to abstract the x86 machine to the OS's.
Quoted 4 lines
Several future developments that this will enable:
- make it easier to use alternative firmware:
any firmware can just load the ACPI tables from QEMU. case in point OVMF.
UEFI obviously can create ACPI tables already so I don't think this is a valid advantage.
You could use this argument to say that QEMU should implement int13 or int10 too...
Quoted 2 lines
- make it easier to add more chipsets without bumping into
fw_cfgboundaries.
But then you're just introducing a different boundary (the ACPI tables).
fw_cfg is a cross-platform interface so it makes a lot more sense to add more features to it to better enumerate the underlying platform.
Quoted 4 lines
- describe a complex configuration
e.g. a bridged PCI topology to enable
acpi hotplug of devices behind a PCI bridge,
or for multi-root topology.
This has strong analogies to generating device trees and is also a good reason why exposing this information via a common interface (fw_cfg) would be a good idea.
Quoted 42 lines
If you look at the actual code:
i386: imports ACPI table generation code from seabios
you will see that it's more complex than it needs to be, with lots of low level casts
and similar tricks.There's also a bit of duplication where we
already declare similar acpi structures in qemu.This is the result of code being a direct port from seabios. Laszlo's patch (build ACPI MADT (APIC) for
fw_cfg) shows how this will be cleaned up by follow-up work. I think it's best to do it in this order: port code directly, and apply cleanups and reduce duplication that results, on top.
This way it's much easier to see that we don't introduce regressions.In particular, for a simple VM with piix,
I booted a guest on qemu with and without the change, and verified that ACPI tables are unchanged except for trivial pointer address changes.Such binary compatibility makes it easier to be
confident that this change won't break things.So the idea is Laszlo's patchset (patches 2-7) will be rebased on top of this patchset, this way we'll get small cleanup changes, where each step is easy to verify as not changing anything from Guest POV.
One issue this patchset creates is cross-version migration. Specifically migration to qemu 1.5 will not work if it happens while bios is accessing
fw_cfgwhen we migrate.
This is a general problem of thefw_cfgimplementation, I plan to extendfw_cfgimplementation to address this.I plan to test q35 and numa setups before I submit this for inclusion, in a similar way.
Quoted 8 lines
git trees, for those interested in testing this:
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.gitacpi
git://git.kernel.org/pub/scm/virt/kvm/mst/seabios.gitacpibios patchset will be posted tomorrow (need to clean up the commit log a bit).
I don't think it's a good idea to move BIOS functionality in QEMU.
We don't frequently add firmware or chipsets so it seems like we're optimizing for an uncommon scenario here.
Regards,
Anthony Liguori
Quoted 90 lines
Laszlo Ersek (1):
refer to FWCfgState explicitlyMichael S. Tsirkin (12):
apic: rename apic specific bitopts
hw/i386/pc.c: moveIO_APIC_DEFAULT_ADDRESStoinclude/hw/i386/apic.h
fw_cfg: move typedef toqemu/typedefs.h
i386: add ACPI table files from seabios
acpi: add rules to compile ASL source
acpi: pre-compiled ASL files
range: add Range structure
i386: add bios linker/loader
i386: generate pc guest info
pc: pass PCI hole ranges to Guests
i386: ACPI table generation code from seabios
pc: reuse guest info for legacy fw cfgconfigure | 9 +- hw/acpi/ich9.c | 7 +- hw/acpi/piix4.c | 44 +- hw/core/loader.c | 2 +- hw/i386/Makefile.objs | 27 + hw/i386/acpi-build.c | 685 ++++ hw/i386/acpi-dsdt-cpu-hotplug.dsl | 93 + hw/i386/acpi-dsdt-dbug.dsl | 41 + hw/i386/acpi-dsdt-hpet.dsl | 51 + hw/i386/acpi-dsdt-isa.dsl | 117 + hw/i386/acpi-dsdt-pci-crs.dsl | 105 + hw/i386/acpi-dsdt.dsl | 343 ++ hw/i386/acpi-dsdt.hex.generated | 4409 ++++++++++++++++++++ hw/i386/bios-linker-loader.c | 155 + hw/i386/multiboot.c | 2 +- hw/i386/multiboot.h | 4 +- hw/i386/pc.c | 159 +- hw/i386/pc_piix.c | 28 +- hw/i386/pc_q35.c | 14 +- hw/i386/q35-acpi-dsdt.dsl | 452 +++ hw/i386/q35-acpi-dsdt.hex.generated | 7346 ++++++++++++++++++++++++++++++++++ hw/i386/ssdt-misc.dsl | 73 + hw/i386/ssdt-misc.hex.generated | 190 + hw/i386/ssdt-pcihp.dsl | 51 + hw/i386/ssdt-pcihp.hex.generated | 108 + hw/i386/ssdt-proc.dsl | 63 + hw/i386/ssdt-proc.hex.generated | 134 + hw/intc/apic.c | 42 +- hw/isa/lpc_ich9.c | 11 +- hw/mips/mips_malta.c | 2 +- hw/pci-host/q35.c | 5 + hw/sparc/sun4m.c | 6 +- hw/sparc64/sun4u.c | 2 +- include/hw/acpi/ich9.h | 2 +- include/hw/i386/acpi-build.h | 9 + include/hw/i386/apic.h | 2 + include/hw/i386/bios-linker-loader.h | 26 + include/hw/i386/ich9.h | 3 +- include/hw/i386/pc.h | 67 +- include/hw/loader.h | 3 +- include/hw/nvram/fw_cfg.h | 2 +- include/hw/pci-host/q35.h | 2 + include/qemu/range.h | 22 + include/qemu/typedefs.h | 2 + scripts/acpi_extract.py | 362 ++ scripts/acpi_extract_preprocess.py | 52 + scripts/update-acpi.sh | 4 + 47 files changed, 15248 insertions(+), 90 deletions(-) create mode 100644 hw/i386/acpi-build.c create mode 100644 hw/i386/acpi-dsdt-cpu-hotplug.dsl create mode 100644 hw/i386/acpi-dsdt-dbug.dsl create mode 100644 hw/i386/acpi-dsdt-hpet.dsl create mode 100644 hw/i386/acpi-dsdt-isa.dsl create mode 100644 hw/i386/acpi-dsdt-pci-crs.dsl create mode 100644 hw/i386/acpi-dsdt.dsl create mode 100644 hw/i386/acpi-dsdt.hex.generated create mode 100644 hw/i386/bios-linker-loader.c create mode 100644 hw/i386/q35-acpi-dsdt.dsl create mode 100644 hw/i386/q35-acpi-dsdt.hex.generated create mode 100644 hw/i386/ssdt-misc.dsl create mode 100644 hw/i386/ssdt-misc.hex.generated create mode 100644 hw/i386/ssdt-pcihp.dsl create mode 100644 hw/i386/ssdt-pcihp.hex.generated create mode 100644 hw/i386/ssdt-proc.dsl create mode 100644 hw/i386/ssdt-proc.hex.generated create mode 100644 include/hw/i386/acpi-build.h create mode 100644 include/hw/i386/bios-linker-loader.h create mode 100755 scripts/acpi_extract.py create mode 100755 scripts/acpi_extract_preprocess.py create mode 100644 scripts/update-acpi.shSignature · 1 line
MST
Quoted 7 lines · Anthony Liguori
Quoted 6 lines · Michael S. Tsirkin
git trees, for those interested in testing this:
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.gitacpi
git://git.kernel.org/pub/scm/virt/kvm/mst/seabios.gitacpi
Quoted 7 lines
Quoted 2 lines
bios patchset will be posted tomorrow (need to clean up the commit log a bit).
I don't think it's a good idea to move BIOS functionality in QEMU.
We don't frequently add firmware or chipsets so it seems like we're optimizing for an uncommon scenario here.
Your objection has come as a surprise to me. Are you stating that you don't think QEMU should generate the ACPI tables and pass them through to SeaBIOS via fw_cfg?
I do think it would be worthwhile to do the above. If we look at the ACPI tables that are currently generated in SeaBIOS, nearly every field describes the hardware. (I've described this in some detail at:
http://lists.gnu.org/archive/html/qemu-devel/2013-02/msg04417.html ) When generating ACPI tables, SeaBIOS can only guess at what the QEMU hardware is or it must receive the hardware details directly from QEMU.
When receiving hardware information from QEMU today, a one-off fw_cfg format is inevitably created. Currently there are seven different fw_cfg entries that control various "bios tables". (These are "irq0-override", "system-states", "numa-nodes", "acpi tables", "smbios tables", "pvpanic-port", and "max cpus".) Of these, only one has any use directly to SeaBIOS (max cpus) - the rest are purely pass through to one or more of the various guest visible bios tables.
The problem with generating custom fw_cfg structures to describe the hardware, is that it inevitably causes the creation of new (poorly documented) structures that serve only to pass the info so another program can create an industry standard structure with the info. A good example of this is the FW_CFG_NUMA entry. If one looks at the definition of this fw_cfg structure (see hw/i386/pc.c:bochs_bios_init) they will find a complex structure (it's actually two dynamically sized arrays of two different values with the size of the first dynamically sized array determined by the FW_CFG_MAX_CPUS fw_cfg entry). This undocumented fw_cfg structure serves no purpose other than to generate an ACPI SRAT table. Had QEMU just populated an SRAT table and put it into a fw_cfg entry then there would be a much better documented and understood interface. Had SeaBIOS wanted to know the numa information (it doesn't) it would be much easier for it to parse out the well documented ACPI SRAT table passed via fw_cfg then it would be for it to handle the cumbersome undocumented fw_cfg entry present today.
There have been several requests recently to add more enhanced and detailed ACPI tables to SeaBIOS that require new custom fw_cfg entries. I've been pushing back on them because I don't wish to invent new custom fw_cfg entries and propagate the code throughout QEMU and SeaBIOS, when the sole goal is to create an industry standard ACPI table. We're better off accepting that the goal is an ACPI table, that only QEMU has the knowledge to generate it, and that QEMU is the best place to generate it.
Hopefully I've misunderstood your objection or you will reconsider.
Cheers,
-Kevin
Hi,
Quoted 7 lines
Quoted 4 lines
Several future developments that this will enable:
- make it easier to use alternative firmware:
any firmware can just load the ACPI tables from QEMU. case in point OVMF.UEFI obviously can create ACPI tables already so I don't think this is a valid advantage.
Yea, but it doesn't do all the patching seabios does, so some features simply don't work. Generating the tables in qemu instead will zap those differnces and will make it alot easier to bring all firmware images (seabios, ovmf, coreboot, ...) to feature parity without duplicating the code needed for that in all firmwares.
Quoted 2 lines
You could use this argument to say that QEMU should implement int13 or int10 too...
This is comparing apples and oranges.
Quoted 1 line
This has strong analogies to generating device trees
Indeed, both acpi and device trees describe the hardware emulated by qemu. Comparing acpi + device trees makes alot more sense than comparing acpi with int10 ...
Quoted 3 lines
and is also a good
reason why exposing this information via a common interface (fw_cfg) would be a good idea.
Huh? As far I know we generate device trees in qemu instead of expecting pseries firmware compile them from fw_cfg information.
cheers,
Gerd
Quoted 6 lines · Gerd Hoffmann
Quoted 3 lines · Anthony
and is also a good
reason why exposing this information via a common interface (fw_cfg) would be a good idea.Huh? As far I know we generate device trees in qemu
It depends. For ARM we insist that the user provides the device tree that corresponds to the kernel they're going to run, and then we just tweak it a bit. (For the upcoming 'mach-virt' pure-virtual hardware we're going to end up generating a device tree completely from scratch, though.)
Not sure fw_cfg is particularly relevant though -- for device tree the obvious "nice" way to do it would be to have the device tree generating/modifying code able to walk the QOM object tree introspecting it to identify hardware presence and properties. That's probably not doable today though. (I need to look more closely at PPC device tree handling, really.)
thanks
-- PMM
Quoted 4 lines · Peter Maydell
It depends. For ARM we insist that the user provides the device tree that corresponds to the kernel they're going to run, and then we just tweak it a bit.
Um... device trees describe hardware, and should not be at all kernel-specific. Did you mean to say "the device tree that corresponds to the machine they're going to emulate"?
And I suppose you do have a kernel that corresponds to the machine it's going to run on, so what you say isn't *entirely* bogus. But it's just written in a way which makes it scary :)
Signature · 1 line
dwmw2
Quoted 8 lines · David Woodhouse
Quoted 3 lines · Peter Maydell
It depends. For ARM we insist that the user provides the device tree that corresponds to the kernel they're going to run, and then we just tweak it a bit.
Um... device trees describe hardware, and should not be at all kernel-specific. Did you mean to say "the device tree that corresponds to the machine they're going to emulate"?
No, I meant "corresponding to the kernel". (Qualifier to the following rant: I'm talking specifically about ARM; I understand PPC is different.)
In my experience if you try to use a device tree blob other than the one which you produce from the dts that is shipped with the exact revision of the kernel that you're booting, then it is likely to result in missing devices at best and quite likely random inexplicable crashes. ARM device trees are simply churning way too much at the moment (the usual failure behaviour is "device which was driven by board data gets a DT binding, so using an old DT means the kernel doesn't think the device exists at all", but I've seen crashes too). Maybe in a decade we'll be able to claim that device trees are a description of the hardware, but right now the fact is that this is a kernel specific data structure and it's not guaranteed to work with anything other than the kernel it goes with. If somebody reports a "this isn't booting" kind of bug, "are you using the right device tree blob for the kernel?" is among the first questions I ask (and I have zero interest in debugging cases where there's a mismatch.)
I make a very small exception for mach-virt, because it's entirely device tree driven and there's a very small set of things that appear in it. So we have a reasonable chance of holding kernel peoples' feet to the fire if they try to break existing device trees generated by QEMU or kvmtool. For anything else I am absolutely against having QEMU generate any ARM device tree blobs or do anything beyond the minimal modifications to them we absolutely must.
thanks
-- PMM
Quoted 7 lines · Gerd Hoffmann
Hi,
Quoted 5 lines
Quoted 4 lines
Several future developments that this will enable:
- make it easier to use alternative firmware:
any firmware can just load the ACPI tables from QEMU. case in point OVMF.
Quoted 8 lines
Quoted 2 lines
UEFI obviously can create ACPI tables already so I don't think this is a valid advantage.
Yea, but it doesn't do all the patching seabios does, so some features simply don't work. Generating the tables in qemu instead will zap those differnces and will make it alot easier to bring all firmware images (seabios, ovmf, coreboot, ...) to feature parity without duplicating the code needed for that in all firmwares.
The fact that different firmwares duplicate functionality is the based on the fact that the different firmwares inheritently duplication functionality by the virtue of being different projects.
Quoted 11 lines
Quoted 2 lines
You could use this argument to say that QEMU should implement int13 or int10 too...
This is comparing apples and oranges.
Quoted 1 line
This has strong analogies to generating device trees
Indeed, both acpi and device trees describe the hardware emulated by qemu. Comparing acpi + device trees makes alot more sense than comparing acpi with int10 ...
Quoted 6 lines
Quoted 3 lines
and is also a good
reason why exposing this information via a common interface (fw_cfg) would be a good idea.Huh? As far I know we generate device trees in qemu instead of expecting pseries firmware compile them from
fw_cfginformation.
It depends on what firmware you are using.
We don't really generate device trees in general in QEMU.
As Peter mentioned, in an ideal world we'd generate them from the QOM graph. That should happen in the firmware and it could be enabled by adding just a couple fw_cfg commands to navigate the QOM graph (analogs to qom-list and qom-get in QMP).
Regards,
Anthony Liguori
Quoted 3 lines
cheers,
Gerd
Hi,
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
and is also a good
reason why exposing this information via a common interface (fw_cfg) would be a good idea.Huh? As far I know we generate device trees in qemu instead of expecting pseries firmware compile them from
fw_cfginformation.It depends on what firmware you are using.
Of course. On archs which don't use device trees in the first place it doesn't make sense.
Quoted 1 line
We don't really generate device trees in general in QEMU.
pseries does (thats why the hard libfdt dependency if you want pseries support). arm wants move into that direction too.
Quoted 2 lines
As Peter mentioned, in an ideal world we'd generate them from the QOM graph.
Sure.
Quoted 3 lines
That should happen in the firmware and it could be enabled by adding just a couple
fw_cfgcommands to navigate the QOM graph (analogs to qom-list and qom-get in QMP).
I don't think Peter intended to imply *that* ...
cheers,
Gerd
Quoted 11 lines · Gerd Hoffmann
Hi,
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
and is also a good
reason why exposing this information via a common interface (fw_cfg) would be a good idea.Huh? As far I know we generate device trees in qemu instead of expecting pseries firmware compile them from
fw_cfginformation.It depends on what firmware you are using.
Quoted 7 lines
Of course. On archs which don't use device trees in the first place it doesn't make sense.
Quoted 1 line
We don't really generate device trees in general in QEMU.
pseries does (thats why the hard libfdt dependency if you want pseries support). arm wants move into that direction too.
pseries is a bad example because it's not a real hardware platform. It's emulating what PowerVM does. It's more akin to the xenpv machine than a real piece of hardware.
Quoted 11 lines
Quoted 3 lines
As Peter mentioned, in an ideal world we'd generate them from the QOM graph.
Sure.
Quoted 3 lines
That should happen in the firmware and it could be enabled by adding just a couple
fw_cfgcommands to navigate the QOM graph (analogs to qom-list and qom-get in QMP).I don't think Peter intended to imply *that* ...
Yes, this has been discussed dozens of times in the past. And as I've said in the past, generating device trees belongs in the firmware. It's a firmware/OS interface.
It's not just an academic argument though. We want to expose hardware interfaces that are rich enough for firmware to do whatever it needs to do to initialize the system. There are a lot of things that are normally only visible to firmware that we don't emulate today.
In exposing this information, we ought to attempt to do so in an architectural neutral way.
ACPI is not architectural neutral. You could argue that that's okay because we only need to support two things: ACPI and device trees. But that's not quite right.
Device trees very often have platform specific quirks so a generated device tree in common code is not going to have the right set of quirks for any given system.
Having a good interface for firmware to generate ACPI tables and device trees solves this problem in a much nicer way. It enables firmware to display whatever type of tree it wants (ACPI or device tree) and also provides the flexibility to implement the necessary quirks for that platform.
Regards,
Anthony Liguori
Quoted 3 lines
cheers,
Gerd
Quoted 1 line · Anthony Liguori
I don't think it's a good idea to move BIOS functionality in QEMU.
Just to clarify: generating ACPI tables is not BIOS functionality. It ended up in seabios for historical reasons.
A normal scenario for ACPI tables is that they are written in ASL and compiled with IASL. The tables are then stored in some ROM device - most of them, except FACP, can actually be mapped directly from ROM if necessary.
You won't normally find real BIOS probing PCI slots for hotplug support and writing EJ0 methods dynamically - instead the assumption is that hardware (in this case QEMU) supplies its own static description in form of ACPI tables.
My patchset uses FW_CFG as such a ROM device. It would be easy to switch to something else instead of FW_CFG. Is this what you are suggesting?
Signature · 1 line
MST
Quoted 9 lines · Michael S. Tsirkin
Quoted 1 line · Anthony Liguori
I don't think it's a good idea to move BIOS functionality in QEMU.
Just to clarify: generating ACPI tables is not BIOS functionality. It ended up in seabios for historical reasons.
A normal scenario for ACPI tables is that they are written in ASL and compiled with IASL.
I wouldn't call this the normal scenario. Some tables are static but more tables are dynamic than you'd think. If you're a firmware engineer and you have to support dozens of platforms, it's much easier to make the tables dynamic than attempt to maintain dozens of ASL descriptions.
A lot of what you'd consider to be static is actually dynamic in a multi-node system.
Quoted 8 lines
The tables are then stored
in some ROM device - most of them, except FACP, can actually be mapped directly from ROM if necessary.You won't normally find real BIOS probing PCI slots for hotplug support and writing EJ0 methods dynamically - instead the assumption is that hardware (in this case QEMU) supplies its own static description in form of ACPI tables.
Actually, this is a very good example. In more modern boxes like Flex, there's a PCI-Express backplane that all of the nodes are connected to with a common set of slots for all nodes. You can configure in firmware how the slots map to each node.
I can share an acpi dump from one of these systems when after I head into the office this morning.
This is what's nice about a switched PCI complex. You have tremendous amounts of flexibility in how you set things up.
Regards,
Anthony Liguori
Quoted 6 lines
My patchset uses
FW_CFGas such a ROM device. It would be easy to switch to something else instead ofFW_CFG. Is this what you are suggesting?Signature · 1 line
MST
Quoted 29 lines · Anthony Liguori
Quoted 9 lines · Michael S. Tsirkin
Quoted 1 line · Anthony Liguori
I don't think it's a good idea to move BIOS functionality in QEMU.
Just to clarify: generating ACPI tables is not BIOS functionality. It ended up in seabios for historical reasons.
A normal scenario for ACPI tables is that they are written in ASL and compiled with IASL.
I wouldn't call this the normal scenario. Some tables are static but more tables are dynamic than you'd think. If you're a firmware engineer and you have to support dozens of platforms, it's much easier to make the tables dynamic than attempt to maintain dozens of ASL descriptions.
A lot of what you'd consider to be static is actually dynamic in a multi-node system.
Quoted 8 lines
The tables are then stored
in some ROM device - most of them, except FACP, can actually be mapped directly from ROM if necessary.You won't normally find real BIOS probing PCI slots for hotplug support and writing EJ0 methods dynamically - instead the assumption is that hardware (in this case QEMU) supplies its own static description in form of ACPI tables.
Quoted 4 lines
Actually, this is a very good example. In more modern boxes like Flex, there's a PCI-Express backplane that all of the nodes are connected to with a common set of slots for all nodes. You can configure in firmware how the slots map to each node.
So if you tell BIOS how to map slots to nodes it can generate SRAT. Fine but it still never needs to discover which hardware is there.
Quoted 16 lines
I can share an acpi dump from one of these systems when after I head into the office this morning.
This is what's nice about a switched PCI complex. You have tremendous amounts of flexibility in how you set things up.
Regards,
Anthony Liguori
Quoted 6 lines
My patchset uses
FW_CFGas such a ROM device. It would be easy to switch to something else instead ofFW_CFG. Is this what you are suggesting?Signature · 1 line
MST
Hi,
Quoted 4 lines
Actually, this is a very good example. In more modern boxes like Flex, there's a PCI-Express backplane that all of the nodes are connected to with a common set of slots for all nodes. You can configure in firmware how the slots map to each node.
Well, we don't configure the dynamic things we have today (s3/s4 enable, numa nodes, pci hotplug, ...) using some firmware setup utility, but using qemu command line switches.
So we have no reason to generate acpi tables in the firmware, we can equally well do it in qemu.
The advantages of doing it in qemu:
(1) We don't have to create/extend fw_cfg interfaces to pass all sorts of config info.
(2) It decouples qemu and seabios; we don't have to touch seabios for every new feature which needs something acpi-ish. For example we could have done pvpanic support without touching seabios.
(3) We don't have to duplicate the logic which compiles acpi tables from fw_cfg in seabios & ovmf.
The advantages of doing it in seabios:
(*) Your list here, I don't see any.
cheers,
Gerd
Quoted 9 lines · Anthony Liguori
Quoted 7 lines · Michael S. Tsirkin
Quoted 1 line · Anthony Liguori
I don't think it's a good idea to move BIOS functionality in QEMU.
Just to clarify: generating ACPI tables is not BIOS functionality. It ended up in seabios for historical reasons.
Quoted 7 lines
Quoted 2 lines
A normal scenario for ACPI tables is that they are written in ASL and compiled with IASL.
I wouldn't call this the normal scenario. Some tables are static but more tables are dynamic than you'd think. If you're a firmware engineer and you have to support dozens of platforms, it's much easier to make the tables dynamic than attempt to maintain dozens of ASL descriptions.
Anthony is right. Firmware for "real" systems contains the tables as binary aml output from the asl compiler, but also goes through extensive hoops to tweak the ACPI information.
On the other hand, "real firmware" doesn't have the luxury of being able to just download the ACPI tables like fw-cfg might be able to offer.
I'm a little concerned that firmware might find a desire to still customize the tables, and thus the fw-cfg solution might be too restricting. It does seem to work out okay for other VMM projects though. (It does seem to be working for Xen in OVMF. But, I'm not certain how well it is working, since I don't have a Xen setup.)
I mentioned in the other thread that perhaps QEMU could also consider making the ACPI code available under some 'appropriate' license, which would allow firmware writers to leverage the code directly if desired. Perhaps a dual/multi license situation for the relevant files?
But, if the fw-cfg route works, then it seems the easiest option for firmware writers.
-Jordan
Quoted 32 lines · Jordan Justen
Quoted 9 lines · Anthony Liguori
Quoted 7 lines · Michael S. Tsirkin
Quoted 1 line · Anthony Liguori
I don't think it's a good idea to move BIOS functionality in QEMU.
Just to clarify: generating ACPI tables is not BIOS functionality. It ended up in seabios for historical reasons.
Quoted 7 lines
Quoted 2 lines
A normal scenario for ACPI tables is that they are written in ASL and compiled with IASL.
I wouldn't call this the normal scenario. Some tables are static but more tables are dynamic than you'd think. If you're a firmware engineer and you have to support dozens of platforms, it's much easier to make the tables dynamic than attempt to maintain dozens of ASL descriptions.
Anthony is right. Firmware for "real" systems contains the tables as binary aml output from the asl compiler, but also goes through extensive hoops to tweak the ACPI information.
On the other hand, "real firmware" doesn't have the luxury of being able to just download the ACPI tables like fw-cfg might be able to offer.
I'm a little concerned that firmware might find a desire to still customize the tables, and thus the fw-cfg solution might be too restricting. It does seem to work out okay for other VMM projects though. (It does seem to be working for Xen in OVMF. But, I'm not certain how well it is working, since I don't have a Xen setup.)
Quoted 4 lines
I mentioned in the other thread that perhaps QEMU could also consider making the ACPI code available under some 'appropriate' license, which would allow firmware writers to leverage the code directly if desired. Perhaps a dual/multi license situation for the relevant files?
Would the OVMF developers participate in a GPL version of OVMF that live outside of the EDK2 tree?
I think the only solution to the licensing problem is a GPL-friendly UEFI build...
Regards,
Anthony Liguori
Quoted 5 lines
But, if the fw-cfg route works, then it seems the easiest option for firmware writers.
-Jordan
Quoted 11 lines · Anthony Liguori
Quoted 4 lines · Jordan Justen
I mentioned in the other thread that perhaps QEMU could also consider making the ACPI code available under some 'appropriate' license, which would allow firmware writers to leverage the code directly if desired. Perhaps a dual/multi license situation for the relevant files?
Would the OVMF developers participate in a GPL version of OVMF that live outside of the EDK2 tree?
I think the only solution to the licensing problem is a GPL-friendly UEFI build...
Sounds like there is no chance for a multi-license scenario then? My idea here was that QEMU could consider what potential licensing situations alternative firmware writers might desire, and attempt to multi-license the code so it could be used as reference code for those potential consumers.
I guess if that is not possible and the fw-cfg method doesn't work out, then we'll probably need to keep doing our best in re-implementing the ASL/ACPI code.
OVMF is an important part of the EDK II project, and thus a viable OVMF within the EDK II tree is important. Therefore, we need BSD licensed code for the core pieces of OVMF. (Such as producing ACPI tables.)
You mentioned that FatBinPkg in the EDK II tree is a particular issue for some OVMF derivatives. To solve that (as I mentioned in the other thread) I'd be willing to publish a git-submodule version of OVMF. This would also allow OVMF derived projects to include other packages. (Potentially with different source licenses.)
Given that there are no FAT driver alternatives, the only purpose I could see for this anytime soon would be something that incorporates the seabios-csm.
-Jordan
Quoted 8 lines · Anthony Liguori
I don't think it's a good idea to move BIOS functionality in QEMU.
We don't frequently add firmware or chipsets so it seems like we're optimizing for an uncommon scenario here.
Regards,
Anthony Liguori
By the way, on x86 we already load some ACPI tables through fw_cfg:
hw/i386/pc_piix.c: pc_acpi_init("acpi-dsdt.aml");
hw/i386/pc_q35.c: pc_acpi_init("q35-acpi-dsdt.aml");so putting all other tables in one place will just make things more consistent.
Yes, ACPI is messy, and pc-specific, but IMO that's life: it's better to give guests as much help as we can if it's messy, not push the messiness out for guests to handle.
Signature · 1 line
MST