Browse Source
* cpu-exec, accel: remove BQL usage for interrupt_request != 0 * memory, hpet, pmtimer: introduce BQL-free PIO/MMIO -----BEGIN PGP SIGNATURE----- iQFIBAABCgAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmixiO4UHHBib256aW5p QHJlZGhhdC5jb20ACgkQv/vSX3jHroMTowf9EmIcSgFXrP8QR/rVQ+Z8+csR4md7 QDzQwoDHaP9F/J728AoT/nDwwlfiHRbcH8AQbzzMrsmMnqhaWCFWD5snGelzPJAo BPaOa4eYvwgssW1apfxGgzae71B3Hbx/sMYHdRcUvBnvS6cKEcOcgK8pANuZGzGQ uRquCMvk14WhnQV/NFqr2PmtmxXjdDNefdi1RfpaPDEt4VZsh4B3afU+I+L4LvIQ NOPh0PbDk+BLRt2fRPgdwF6KqS5ajPEzKnBlS0uxSXKxpLOLM/2SNDOGDDVUrAwV ILrnchZrpxHsHwBCjaBhKZDTTQUcH0HUrZhRJbUPsg5feHRs3KoaFJjmCQ== =RMLB -----END PGP SIGNATURE----- Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging * hw/i386: split isapc from PCI boards * cpu-exec, accel: remove BQL usage for interrupt_request != 0 * memory, hpet, pmtimer: introduce BQL-free PIO/MMIO # -----BEGIN PGP SIGNATURE----- # # iQFIBAABCgAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmixiO4UHHBib256aW5p # QHJlZGhhdC5jb20ACgkQv/vSX3jHroMTowf9EmIcSgFXrP8QR/rVQ+Z8+csR4md7 # QDzQwoDHaP9F/J728AoT/nDwwlfiHRbcH8AQbzzMrsmMnqhaWCFWD5snGelzPJAo # BPaOa4eYvwgssW1apfxGgzae71B3Hbx/sMYHdRcUvBnvS6cKEcOcgK8pANuZGzGQ # uRquCMvk14WhnQV/NFqr2PmtmxXjdDNefdi1RfpaPDEt4VZsh4B3afU+I+L4LvIQ # NOPh0PbDk+BLRt2fRPgdwF6KqS5ajPEzKnBlS0uxSXKxpLOLM/2SNDOGDDVUrAwV # ILrnchZrpxHsHwBCjaBhKZDTTQUcH0HUrZhRJbUPsg5feHRs3KoaFJjmCQ== # =RMLB # -----END PGP SIGNATURE----- # gpg: Signature made Fri 29 Aug 2025 09:03:10 PM AEST # gpg: using RSA key F13338574B662389866C7682BFFBD25F78C7AE83 # gpg: issuer "pbonzini@redhat.com" # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [unknown] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [unknown] # gpg: WARNING: The key's User ID is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * tag 'for-upstream' of https://gitlab.com/bonzini/qemu: (28 commits) tcg: move interrupt caching and single step masking closer to user kvm: i386: irqchip: take BQL only if there is an interrupt hpet: make main counter read lock-less hpet: move out main counter read into a separate block hpet: switch to fine-grained device locking acpi: mark PMTIMER as unlocked memory: reintroduce BQL-free fine-grained PIO/MMIO add cpu_test_interrupt()/cpu_set_interrupt() helpers and use them tree wide user-exec: ensure interrupt_request is not used hw/i386/isapc.c: replace rom_memory with system_memory hw/i386/pc_piix.c: replace rom_memory with pci_memory hw/i386/pc_piix.c: remove unused headers after isapc machine split hw/i386: move isapc machine to separate isapc.c file hw/i386/pc_piix.c: assume pcmc->pci_enabled is always true in pc_init1() hw/i386/pc_piix.c: always initialise ISA IDE drives in pc_init_isa() hw/i386/pc_piix.c: remove pc_system_flash_cleanup_unused() from pc_init_isa() hw/i386/pc_piix.c: hardcode hole64_size to 0 in pc_init_isa() hw/i386/pc_piix.c: simplify RAM size logic in pc_init_isa() hw/i386/pc_piix.c: remove nvdimm initialisation from pc_init_isa() hw/i386/pc_piix.c: remove SGX initialisation from pc_init_isa() ... Signed-off-by: Richard Henderson <richard.henderson@linaro.org>pull/299/head
44 changed files with 492 additions and 321 deletions
@ -0,0 +1,189 @@ |
|||
/*
|
|||
* QEMU PC System Emulator |
|||
* |
|||
* Copyright (c) 2003-2004 Fabrice Bellard |
|||
* |
|||
* SPDX-License-Identifier: MIT |
|||
*/ |
|||
|
|||
#include "qemu/osdep.h" |
|||
|
|||
#include "qemu/units.h" |
|||
#include "qemu/error-report.h" |
|||
#include "hw/char/parallel-isa.h" |
|||
#include "hw/dma/i8257.h" |
|||
#include "hw/i386/pc.h" |
|||
#include "hw/ide/isa.h" |
|||
#include "hw/ide/ide-bus.h" |
|||
#include "system/kvm.h" |
|||
#include "hw/i386/kvm/clock.h" |
|||
#include "hw/xen/xen-x86.h" |
|||
#include "system/xen.h" |
|||
#include "hw/rtc/mc146818rtc.h" |
|||
#include "target/i386/cpu.h" |
|||
|
|||
static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 }; |
|||
static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 }; |
|||
static const int ide_irq[MAX_IDE_BUS] = { 14, 15 }; |
|||
|
|||
|
|||
static void pc_init_isa(MachineState *machine) |
|||
{ |
|||
PCMachineState *pcms = PC_MACHINE(machine); |
|||
PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms); |
|||
X86MachineState *x86ms = X86_MACHINE(machine); |
|||
MemoryRegion *system_memory = get_system_memory(); |
|||
MemoryRegion *system_io = get_system_io(); |
|||
ISABus *isa_bus; |
|||
uint32_t irq; |
|||
GSIState *gsi_state; |
|||
MemoryRegion *ram_memory; |
|||
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; |
|||
int i; |
|||
|
|||
/*
|
|||
* There is a small chance that someone unintentionally passes "-cpu max" |
|||
* for the isapc machine, which will provide a much more modern 32-bit |
|||
* CPU than would be expected for an ISA-era PC. If the "max" cpu type has |
|||
* been specified, choose the "best" 32-bit cpu possible which we consider |
|||
* be the pentium3 (deliberately choosing an Intel CPU given that the |
|||
* default 486 CPU for the isapc machine is also an Intel CPU). |
|||
*/ |
|||
if (!strcmp(machine->cpu_type, X86_CPU_TYPE_NAME("max"))) { |
|||
machine->cpu_type = X86_CPU_TYPE_NAME("pentium3"); |
|||
warn_report("-cpu max is invalid for isapc machine, using pentium3"); |
|||
} |
|||
|
|||
/*
|
|||
* Similarly if someone unintentionally passes "-cpu host" for the isapc |
|||
* machine then display a warning and also switch to the "best" 32-bit |
|||
* cpu possible which we consider to be the pentium3. This is because any |
|||
* host CPU will already be modern than this, but it also ensures any |
|||
* newer CPU flags/features are filtered out for older guests. |
|||
*/ |
|||
if (!strcmp(machine->cpu_type, X86_CPU_TYPE_NAME("host"))) { |
|||
machine->cpu_type = X86_CPU_TYPE_NAME("pentium3"); |
|||
warn_report("-cpu host is invalid for isapc machine, using pentium3"); |
|||
} |
|||
|
|||
if (machine->ram_size > 3.5 * GiB) { |
|||
error_report("Too much memory for this machine: %" PRId64 " MiB, " |
|||
"maximum 3584 MiB", machine->ram_size / MiB); |
|||
exit(1); |
|||
} |
|||
|
|||
/*
|
|||
* There is no RAM split for the isapc machine |
|||
*/ |
|||
if (xen_enabled()) { |
|||
xen_hvm_init_pc(pcms, &ram_memory); |
|||
} else { |
|||
ram_memory = machine->ram; |
|||
|
|||
pcms->max_ram_below_4g = 3.5 * GiB; |
|||
x86ms->above_4g_mem_size = 0; |
|||
x86ms->below_4g_mem_size = machine->ram_size; |
|||
} |
|||
|
|||
x86_cpus_init(x86ms, pcmc->default_cpu_version); |
|||
|
|||
if (kvm_enabled()) { |
|||
kvmclock_create(pcmc->kvmclock_create_always); |
|||
} |
|||
|
|||
/* allocate ram and load rom/bios */ |
|||
if (!xen_enabled()) { |
|||
pc_memory_init(pcms, system_memory, system_memory, 0); |
|||
} else { |
|||
assert(machine->ram_size == x86ms->below_4g_mem_size + |
|||
x86ms->above_4g_mem_size); |
|||
|
|||
if (machine->kernel_filename != NULL) { |
|||
/* For xen HVM direct kernel boot, load linux here */ |
|||
xen_load_linux(pcms); |
|||
} |
|||
} |
|||
|
|||
gsi_state = pc_gsi_create(&x86ms->gsi, false); |
|||
|
|||
isa_bus = isa_bus_new(NULL, system_memory, system_io, |
|||
&error_abort); |
|||
isa_bus_register_input_irqs(isa_bus, x86ms->gsi); |
|||
|
|||
x86ms->rtc = isa_new(TYPE_MC146818_RTC); |
|||
qdev_prop_set_int32(DEVICE(x86ms->rtc), "base_year", 2000); |
|||
isa_realize_and_unref(x86ms->rtc, isa_bus, &error_fatal); |
|||
irq = object_property_get_uint(OBJECT(x86ms->rtc), "irq", |
|||
&error_fatal); |
|||
isa_connect_gpio_out(ISA_DEVICE(x86ms->rtc), 0, irq); |
|||
|
|||
i8257_dma_init(OBJECT(machine), isa_bus, 0); |
|||
pcms->hpet_enabled = false; |
|||
|
|||
if (x86ms->pic == ON_OFF_AUTO_ON || x86ms->pic == ON_OFF_AUTO_AUTO) { |
|||
pc_i8259_create(isa_bus, gsi_state->i8259_irq); |
|||
} |
|||
|
|||
if (tcg_enabled()) { |
|||
x86_register_ferr_irq(x86ms->gsi[13]); |
|||
} |
|||
|
|||
pc_vga_init(isa_bus, NULL); |
|||
|
|||
/* init basic PC hardware */ |
|||
pc_basic_device_init(pcms, isa_bus, x86ms->gsi, x86ms->rtc, |
|||
!MACHINE_CLASS(pcmc)->no_floppy, 0x4); |
|||
|
|||
pc_nic_init(pcmc, isa_bus, NULL); |
|||
|
|||
ide_drive_get(hd, ARRAY_SIZE(hd)); |
|||
for (i = 0; i < MAX_IDE_BUS; i++) { |
|||
ISADevice *dev; |
|||
char busname[] = "ide.0"; |
|||
dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i], |
|||
ide_irq[i], |
|||
hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); |
|||
/*
|
|||
* The ide bus name is ide.0 for the first bus and ide.1 for the |
|||
* second one. |
|||
*/ |
|||
busname[4] = '0' + i; |
|||
pcms->idebus[i] = qdev_get_child_bus(DEVICE(dev), busname); |
|||
} |
|||
} |
|||
|
|||
static void isapc_machine_options(MachineClass *m) |
|||
{ |
|||
static const char * const valid_cpu_types[] = { |
|||
X86_CPU_TYPE_NAME("486"), |
|||
X86_CPU_TYPE_NAME("athlon"), |
|||
X86_CPU_TYPE_NAME("kvm32"), |
|||
X86_CPU_TYPE_NAME("pentium"), |
|||
X86_CPU_TYPE_NAME("pentium2"), |
|||
X86_CPU_TYPE_NAME("pentium3"), |
|||
X86_CPU_TYPE_NAME("qemu32"), |
|||
X86_CPU_TYPE_NAME("max"), |
|||
X86_CPU_TYPE_NAME("host"), |
|||
NULL |
|||
}; |
|||
PCMachineClass *pcmc = PC_MACHINE_CLASS(m); |
|||
|
|||
m->desc = "ISA-only PC"; |
|||
m->max_cpus = 1; |
|||
m->option_rom_has_mr = true; |
|||
m->rom_file_has_mr = false; |
|||
pcmc->pci_enabled = false; |
|||
pcmc->has_acpi_build = false; |
|||
pcmc->smbios_defaults = false; |
|||
pcmc->gigabyte_align = false; |
|||
pcmc->smbios_legacy_mode = true; |
|||
pcmc->has_reserved_memory = false; |
|||
m->default_nic = "ne2k_isa"; |
|||
m->default_cpu_type = X86_CPU_TYPE_NAME("486"); |
|||
m->valid_cpu_types = valid_cpu_types; |
|||
m->no_floppy = !module_object_class_by_name(TYPE_ISA_FDC); |
|||
m->no_parallel = !module_object_class_by_name(TYPE_ISA_PARALLEL); |
|||
} |
|||
|
|||
DEFINE_PC_MACHINE(isapc, "isapc", pc_init_isa, |
|||
isapc_machine_options); |
|||
Loading…
Reference in new issue