mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
acpi,pci,pc,fedora,virtio fixes and enhancements
This includes some Preparatory patches for cpu hotplug for q25 and memory hotplug by Igor, tests and memory mapping change by Laszlo and pci reset cleanup by Paolo. There are also some fixes for fedora and virtio: included here since they are test blockers for me. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) iQEcBAABAgAGBQJSuF+2AAoJECgfDbjSjVRpTz0IAJhNCC8L2GVt+pm1RAt6lbqZ u9bCrqfThDORN2mUTEuLu4ZpZC0DYc7d0Jjr5NPesC5G/Afzi5/to6+l7nNZneU3 OdBPglXCCfU/cRaLu7JG2akpha0GVU0tsSCoWIYa6mwlWA4/DXVMgeKg/bh/EgfM B1w4fE2RgRM9bEqWmX4+tZw8dgk7uVJhu95HCDnb5eikaKlFzwuOlvexrDV3KbPc bkJe35zbGrKOws93tiSeoqcDx2dcYSzecPoJ0jiCY0KXJ17PBWAvuLTtYqkwwe9J 2FEnTslQJ3Rc8jTFiOPWx2pGaejG4y7Tnk6uuzW6fbbSLOQDPJy3KgmutJFMt1A= =ShCj -----END PGP SIGNATURE----- Merge remote-tracking branch 'mst/tags/for_anthony' into staging acpi,pci,pc,fedora,virtio fixes and enhancements This includes some Preparatory patches for cpu hotplug for q25 and memory hotplug by Igor, tests and memory mapping change by Laszlo and pci reset cleanup by Paolo. There are also some fixes for fedora and virtio: included here since they are test blockers for me. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Mon 23 Dec 2013 08:07:18 AM PST using RSA key ID D28D5469 # gpg: Can't check signature: public key not found * mst/tags/for_anthony: target-arm: fix build with gcc 4.8.2 virtio: add back call to virtio_bus_device_unplugged piix: fix 32bit pci hole qdev: switch reset to post-order qdev: allow both pre- and post-order vists in qdev walking functions pci: clean up resetting of IRQs pci: do not export pci_bus_reset ACPI/DSDT-CPU: cleanup bogus comment ACPI: Q35 DSDT: fix CPU hotplug GPE0.2 handler acpi: ich9: allow guest to clear SCI rised by GPE acpi: factor out common pm_update_sci() into acpi core acpi: piix4: remove not needed GPE0 mask i440fx-test: verify firmware under 4G and 1M, both -bios and -pflash i440fx-test: generate temporary firmware blob i440fx-test: give each GTest case its own qtest i440fx-test: qtest_start() should be paired with qtest_end() hw/i386/pc_sysfw: support two flash drives pc_piix: document gigabyte_align piix: gigabyte alignment for ram Message-id: 1387815007-1272-1-git-send-email-mst@redhat.com Signed-off-by: Anthony Liguori <aliguori@amazon.com>
This commit is contained in:
commit
d1819762fc
18 changed files with 363 additions and 144 deletions
|
@ -52,7 +52,6 @@ Scope(\_SB) {
|
|||
Sleep(200)
|
||||
}
|
||||
|
||||
/* CPU hotplug notify method */
|
||||
OperationRegion(PRST, SystemIO, 0xaf00, 32)
|
||||
Field(PRST, ByteAcc, NoLock, Preserve) {
|
||||
PRS, 256
|
||||
|
|
|
@ -61,6 +61,11 @@ static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
|
|||
static bool has_pci_info;
|
||||
static bool has_acpi_build = true;
|
||||
static bool smbios_type1_defaults = true;
|
||||
/* Make sure that guest addresses aligned at 1Gbyte boundaries get mapped to
|
||||
* host addresses aligned at 1Gbyte boundaries. This way we can use 1GByte
|
||||
* pages in the host.
|
||||
*/
|
||||
static bool gigabyte_align = true;
|
||||
|
||||
/* PC hardware initialisation */
|
||||
static void pc_init1(QEMUMachineInitArgs *args,
|
||||
|
@ -106,9 +111,17 @@ static void pc_init1(QEMUMachineInitArgs *args,
|
|||
kvmclock_create();
|
||||
}
|
||||
|
||||
/* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory).
|
||||
* If it doesn't, we need to split it in chunks below and above 4G.
|
||||
* In any case, try to make sure that guest addresses aligned at
|
||||
* 1G boundaries get mapped to host addresses aligned at 1G boundaries.
|
||||
* For old machine types, use whatever split we used historically to avoid
|
||||
* breaking migration.
|
||||
*/
|
||||
if (args->ram_size >= 0xe0000000) {
|
||||
above_4g_mem_size = args->ram_size - 0xe0000000;
|
||||
below_4g_mem_size = 0xe0000000;
|
||||
ram_addr_t lowmem = gigabyte_align ? 0xc0000000 : 0xe0000000;
|
||||
above_4g_mem_size = args->ram_size - lowmem;
|
||||
below_4g_mem_size = lowmem;
|
||||
} else {
|
||||
above_4g_mem_size = 0;
|
||||
below_4g_mem_size = args->ram_size;
|
||||
|
@ -157,6 +170,7 @@ static void pc_init1(QEMUMachineInitArgs *args,
|
|||
if (pci_enabled) {
|
||||
pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi,
|
||||
system_memory, system_io, args->ram_size,
|
||||
below_4g_mem_size,
|
||||
above_4g_mem_size,
|
||||
pci_memory, ram_memory);
|
||||
} else {
|
||||
|
@ -245,6 +259,7 @@ static void pc_init_pci(QEMUMachineInitArgs *args)
|
|||
static void pc_compat_1_7(QEMUMachineInitArgs *args)
|
||||
{
|
||||
smbios_type1_defaults = false;
|
||||
gigabyte_align = false;
|
||||
}
|
||||
|
||||
static void pc_compat_1_6(QEMUMachineInitArgs *args)
|
||||
|
|
|
@ -72,35 +72,102 @@ static void pc_isa_bios_init(MemoryRegion *rom_memory,
|
|||
memory_region_set_readonly(isa_bios, true);
|
||||
}
|
||||
|
||||
static void pc_system_flash_init(MemoryRegion *rom_memory,
|
||||
DriveInfo *pflash_drv)
|
||||
#define FLASH_MAP_UNIT_MAX 2
|
||||
|
||||
/* We don't have a theoretically justifiable exact lower bound on the base
|
||||
* address of any flash mapping. In practice, the IO-APIC MMIO range is
|
||||
* [0xFEE00000..0xFEE01000[ -- see IO_APIC_DEFAULT_ADDRESS --, leaving free
|
||||
* only 18MB-4KB below 4G. For now, restrict the cumulative mapping to 8MB in
|
||||
* size.
|
||||
*/
|
||||
#define FLASH_MAP_BASE_MIN ((hwaddr)(0x100000000ULL - 8*1024*1024))
|
||||
|
||||
/* This function maps flash drives from 4G downward, in order of their unit
|
||||
* numbers. The mapping starts at unit#0, with unit number increments of 1, and
|
||||
* stops before the first missing flash drive, or before
|
||||
* unit#FLASH_MAP_UNIT_MAX, whichever is reached first.
|
||||
*
|
||||
* Addressing within one flash drive is of course not reversed.
|
||||
*
|
||||
* An error message is printed and the process exits if:
|
||||
* - the size of the backing file for a flash drive is non-positive, or not a
|
||||
* multiple of the required sector size, or
|
||||
* - the current mapping's base address would fall below FLASH_MAP_BASE_MIN.
|
||||
*
|
||||
* The drive with unit#0 (if available) is mapped at the highest address, and
|
||||
* it is passed to pc_isa_bios_init(). Merging several drives for isa-bios is
|
||||
* not supported.
|
||||
*/
|
||||
static void pc_system_flash_init(MemoryRegion *rom_memory)
|
||||
{
|
||||
int unit;
|
||||
DriveInfo *pflash_drv;
|
||||
BlockDriverState *bdrv;
|
||||
int64_t size;
|
||||
hwaddr phys_addr;
|
||||
char *fatal_errmsg = NULL;
|
||||
hwaddr phys_addr = 0x100000000ULL;
|
||||
int sector_bits, sector_size;
|
||||
pflash_t *system_flash;
|
||||
MemoryRegion *flash_mem;
|
||||
char name[64];
|
||||
|
||||
bdrv = pflash_drv->bdrv;
|
||||
size = bdrv_getlength(pflash_drv->bdrv);
|
||||
sector_bits = 12;
|
||||
sector_size = 1 << sector_bits;
|
||||
|
||||
if ((size % sector_size) != 0) {
|
||||
fprintf(stderr,
|
||||
"qemu: PC system firmware (pflash) must be a multiple of 0x%x\n",
|
||||
sector_size);
|
||||
exit(1);
|
||||
for (unit = 0;
|
||||
(unit < FLASH_MAP_UNIT_MAX &&
|
||||
(pflash_drv = drive_get(IF_PFLASH, 0, unit)) != NULL);
|
||||
++unit) {
|
||||
bdrv = pflash_drv->bdrv;
|
||||
size = bdrv_getlength(bdrv);
|
||||
if (size < 0) {
|
||||
fatal_errmsg = g_strdup_printf("failed to get backing file size");
|
||||
} else if (size == 0) {
|
||||
fatal_errmsg = g_strdup_printf("PC system firmware (pflash) "
|
||||
"cannot have zero size");
|
||||
} else if ((size % sector_size) != 0) {
|
||||
fatal_errmsg = g_strdup_printf("PC system firmware (pflash) "
|
||||
"must be a multiple of 0x%x", sector_size);
|
||||
} else if (phys_addr < size || phys_addr - size < FLASH_MAP_BASE_MIN) {
|
||||
fatal_errmsg = g_strdup_printf("oversized backing file, pflash "
|
||||
"segments cannot be mapped under "
|
||||
TARGET_FMT_plx, FLASH_MAP_BASE_MIN);
|
||||
}
|
||||
if (fatal_errmsg != NULL) {
|
||||
Location loc;
|
||||
|
||||
/* push a new, "none" location on the location stack; overwrite its
|
||||
* contents with the location saved in the option; print the error
|
||||
* (includes location); pop the top
|
||||
*/
|
||||
loc_push_none(&loc);
|
||||
if (pflash_drv->opts != NULL) {
|
||||
qemu_opts_loc_restore(pflash_drv->opts);
|
||||
}
|
||||
error_report("%s", fatal_errmsg);
|
||||
loc_pop(&loc);
|
||||
g_free(fatal_errmsg);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
phys_addr -= size;
|
||||
|
||||
/* pflash_cfi01_register() creates a deep copy of the name */
|
||||
snprintf(name, sizeof name, "system.flash%d", unit);
|
||||
system_flash = pflash_cfi01_register(phys_addr, NULL /* qdev */, name,
|
||||
size, bdrv, sector_size,
|
||||
size >> sector_bits,
|
||||
1 /* width */,
|
||||
0x0000 /* id0 */,
|
||||
0x0000 /* id1 */,
|
||||
0x0000 /* id2 */,
|
||||
0x0000 /* id3 */,
|
||||
0 /* be */);
|
||||
if (unit == 0) {
|
||||
flash_mem = pflash_cfi01_get_memory(system_flash);
|
||||
pc_isa_bios_init(rom_memory, flash_mem, size);
|
||||
}
|
||||
}
|
||||
|
||||
phys_addr = 0x100000000ULL - size;
|
||||
system_flash = pflash_cfi01_register(phys_addr, NULL, "system.flash", size,
|
||||
bdrv, sector_size, size >> sector_bits,
|
||||
1, 0x0000, 0x0000, 0x0000, 0x0000, 0);
|
||||
flash_mem = pflash_cfi01_get_memory(system_flash);
|
||||
|
||||
pc_isa_bios_init(rom_memory, flash_mem, size);
|
||||
}
|
||||
|
||||
static void old_pc_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
|
||||
|
@ -181,5 +248,5 @@ void pc_system_firmware_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
pc_system_flash_init(rom_memory, pflash_drv);
|
||||
pc_system_flash_init(rom_memory);
|
||||
}
|
||||
|
|
|
@ -417,11 +417,11 @@ DefinitionBlock (
|
|||
Method(_L00) {
|
||||
}
|
||||
Method(_L01) {
|
||||
}
|
||||
Method(_E02) {
|
||||
// CPU hotplug event
|
||||
\_SB.PRSC()
|
||||
}
|
||||
Method(_L02) {
|
||||
}
|
||||
Method(_L03) {
|
||||
}
|
||||
Method(_L04) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue