[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH-for-9.1 20/29] hw/i386/pc: Pass PcPciMachineState argument to
From: |
Philippe Mathieu-Daudé |
Subject: |
[RFC PATCH-for-9.1 20/29] hw/i386/pc: Pass PcPciMachineState argument to pc_pci_hole64_start() |
Date: |
Thu, 28 Mar 2024 16:54:28 +0100 |
pc_pci_hole64_start() is only used by PCI-based
machines. Pass it a PcPciMachineState argument,
removing a qdev_get_machine() call.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/i386/pc.h | 2 +-
hw/i386/pc.c | 8 ++++----
hw/pci-host/i440fx.c | 2 +-
hw/pci-host/q35.c | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index df4c813854..7da0bc8aa4 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -157,7 +157,7 @@ void pc_memory_init(PCMachineState *pcms,
MemoryRegion *system_memory,
MemoryRegion *rom_memory,
uint64_t pci_hole64_size);
-uint64_t pc_pci_hole64_start(void);
+uint64_t pc_pci_hole64_start(PcPciMachineState *ppms);
DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus);
void pc_basic_device_init(struct PCMachineState *pcms,
ISABus *isa_bus, qemu_irq *gsi,
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index d8e91d18b8..b83abee8e9 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -747,7 +747,8 @@ static hwaddr pc_max_used_gpa(PCMachineState *pcms,
uint64_t pci_hole64_size)
if (cpu->env.features[FEAT_8000_0001_EDX] & CPUID_EXT2_LM) {
/* 64-bit systems */
- return pc_pci_hole64_start() + pci_hole64_size - 1;
+ PcPciMachineState *ppms = PC_PCI_MACHINE(pcms);
+ return pc_pci_hole64_start(ppms) + pci_hole64_size - 1;
}
/* 32-bit systems */
@@ -1016,11 +1017,10 @@ void pc_memory_init(PCMachineState *pcms,
* The 64bit pci hole starts after "above 4G RAM" and
* potentially the space reserved for memory hotplug.
*/
-uint64_t pc_pci_hole64_start(void)
+uint64_t pc_pci_hole64_start(PcPciMachineState *ppms)
{
- PCMachineState *pcms = PC_MACHINE(qdev_get_machine());
+ PCMachineState *pcms = PC_MACHINE(ppms);
PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
- PcPciMachineState *ppms = PC_PCI_MACHINE(pcms);
MachineState *ms = MACHINE(pcms);
uint64_t hole64_start = 0;
ram_addr_t size = 0;
diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c
index 4f0a0438d7..add99e4f76 100644
--- a/hw/pci-host/i440fx.c
+++ b/hw/pci-host/i440fx.c
@@ -180,7 +180,7 @@ static uint64_t
i440fx_pcihost_get_pci_hole64_start_value(Object *obj)
pci_bus_get_w64_range(h->bus, &w64);
value = range_is_empty(&w64) ? 0 : range_lob(&w64);
if (!value && s->pci_hole64_fix) {
- value = pc_pci_hole64_start();
+ value = pc_pci_hole64_start(PC_PCI_MACHINE(qdev_get_machine()));
}
return value;
}
diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index 0d7d4e3f08..baf55897b2 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -123,7 +123,7 @@ static uint64_t q35_host_get_pci_hole64_start_value(Object
*obj)
pci_bus_get_w64_range(h->bus, &w64);
value = range_is_empty(&w64) ? 0 : range_lob(&w64);
if (!value && s->pci_hole64_fix) {
- value = pc_pci_hole64_start();
+ value = pc_pci_hole64_start(PC_PCI_MACHINE(qdev_get_machine()));
}
return value;
}
--
2.41.0
- [RFC PATCH-for-9.1 10/29] hw/i386/pc: Remove PCMachineClass::has_acpi_build field, (continued)
- [RFC PATCH-for-9.1 10/29] hw/i386/pc: Remove PCMachineClass::has_acpi_build field, Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 11/29] hw/i386/pc: Move acpi_setup() call to pc_pci_machine_done(), Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 12/29] hw/i386/pc: Move acpi_build_enabled to PcPciMachineState, Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 13/29] hw/i386/pc: Remove non-PCI code from pc_system_firmware_init(), Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 14/29] hw/i386/pc: Move pc_system_flash_create() to pc_pci_machine_initfn(), Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 19/29] hw/i386/pc: Pass PcPciMachineState argument to CXL helpers, Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 15/29] hw/i386/pc: Move FW/pflash related fields to PcPciMachineState, Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 17/29] hw/i386/pc: Inline gigabyte_align(), Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 18/29] hw/i386/pc: Inline has_reserved_memory(), Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 16/29] hw/i386/pc: Move south-bridge related fields to PcPciMachine, Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 20/29] hw/i386/pc: Pass PcPciMachineState argument to pc_pci_hole64_start(),
Philippe Mathieu-Daudé <=
- [RFC PATCH-for-9.1 21/29] hw/i386/fw_cfg: Include missing 'qapi-types-machine.h' header, Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 22/29] hw/i386/fw_cfg: Define fw_cfg_build_smbios() stub, Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 23/29] hw/i386/fw_cfg: Inline smbios_defaults(), Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 24/29] hw/i386/fw_cfg: Inline smbios_legacy_mode(), Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 25/29] hw/i386/fw_cfg: Replace smbios_defaults() by !smbios_legacy_mode(), Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 26/29] hw/i386/fw_cfg: Factor fw_cfg_build_smbios_legacy() out, Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 27/29] hw/i386/pc: Call fw_cfg_build_smbios_legacy() in pc_machine_done(), Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 28/29] hw/i386/pc: Rename pc_init1() -> pc_piix_init(), Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 29/29] hw/i386/pc: Move ISA-only PC machine to pc_isa.c, Philippe Mathieu-Daudé, 2024/03/28