Skip to content
Snippets Groups Projects
Commit c48eb7a4 authored by Joao Martins's avatar Joao Martins Committed by Michael S. Tsirkin
Browse files

i386/pc: pass pci_hole64_size to pc_memory_init()


Use the pre-initialized pci-host qdev and fetch the
pci-hole64-size into pc_memory_init() newly added argument.
Use PCI_HOST_PROP_PCI_HOLE64_SIZE pci-host property for
fetching pci-hole64-size.

This is in preparation to determine that host-phys-bits are
enough and for pci-hole64-size to be considered to relocate
ram-above-4g to be at 1T (on AMD platforms).

Signed-off-by: default avatarJoao Martins <joao.m.martins@oracle.com>
Reviewed-by: default avatarIgor Mammedov <imammedo@redhat.com>
Message-Id: <20220719170014.27028-4-joao.m.martins@oracle.com>
Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 48767787
No related branches found
No related tags found
No related merge requests found
...@@ -817,7 +817,8 @@ void xen_load_linux(PCMachineState *pcms) ...@@ -817,7 +817,8 @@ void xen_load_linux(PCMachineState *pcms)
void pc_memory_init(PCMachineState *pcms, void pc_memory_init(PCMachineState *pcms,
MemoryRegion *system_memory, MemoryRegion *system_memory,
MemoryRegion *rom_memory, MemoryRegion *rom_memory,
MemoryRegion **ram_memory) MemoryRegion **ram_memory,
uint64_t pci_hole64_size)
{ {
int linux_boot, i; int linux_boot, i;
MemoryRegion *option_rom_mr; MemoryRegion *option_rom_mr;
......
...@@ -91,6 +91,7 @@ static void pc_init1(MachineState *machine, ...@@ -91,6 +91,7 @@ static void pc_init1(MachineState *machine,
MemoryRegion *pci_memory; MemoryRegion *pci_memory;
MemoryRegion *rom_memory; MemoryRegion *rom_memory;
ram_addr_t lowmem; ram_addr_t lowmem;
uint64_t hole64_size;
DeviceState *i440fx_host; DeviceState *i440fx_host;
/* /*
...@@ -166,10 +167,14 @@ static void pc_init1(MachineState *machine, ...@@ -166,10 +167,14 @@ static void pc_init1(MachineState *machine,
memory_region_init(pci_memory, NULL, "pci", UINT64_MAX); memory_region_init(pci_memory, NULL, "pci", UINT64_MAX);
rom_memory = pci_memory; rom_memory = pci_memory;
i440fx_host = qdev_new(host_type); i440fx_host = qdev_new(host_type);
hole64_size = object_property_get_uint(OBJECT(i440fx_host),
PCI_HOST_PROP_PCI_HOLE64_SIZE,
&error_abort);
} else { } else {
pci_memory = NULL; pci_memory = NULL;
rom_memory = system_memory; rom_memory = system_memory;
i440fx_host = NULL; i440fx_host = NULL;
hole64_size = 0;
} }
pc_guest_info_init(pcms); pc_guest_info_init(pcms);
...@@ -186,7 +191,7 @@ static void pc_init1(MachineState *machine, ...@@ -186,7 +191,7 @@ static void pc_init1(MachineState *machine,
/* allocate ram and load rom/bios */ /* allocate ram and load rom/bios */
if (!xen_enabled()) { if (!xen_enabled()) {
pc_memory_init(pcms, system_memory, pc_memory_init(pcms, system_memory,
rom_memory, &ram_memory); rom_memory, &ram_memory, hole64_size);
} else { } else {
pc_system_flash_cleanup_unused(pcms); pc_system_flash_cleanup_unused(pcms);
if (machine->kernel_filename != NULL) { if (machine->kernel_filename != NULL) {
......
...@@ -138,6 +138,7 @@ static void pc_q35_init(MachineState *machine) ...@@ -138,6 +138,7 @@ static void pc_q35_init(MachineState *machine)
MachineClass *mc = MACHINE_GET_CLASS(machine); MachineClass *mc = MACHINE_GET_CLASS(machine);
bool acpi_pcihp; bool acpi_pcihp;
bool keep_pci_slot_hpc; bool keep_pci_slot_hpc;
uint64_t pci_hole64_size = 0;
/* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory
* and 256 Mbytes for PCI Express Enhanced Configuration Access Mapping * and 256 Mbytes for PCI Express Enhanced Configuration Access Mapping
...@@ -206,8 +207,15 @@ static void pc_q35_init(MachineState *machine) ...@@ -206,8 +207,15 @@ static void pc_q35_init(MachineState *machine)
/* create pci host bus */ /* create pci host bus */
q35_host = Q35_HOST_DEVICE(qdev_new(TYPE_Q35_HOST_DEVICE)); q35_host = Q35_HOST_DEVICE(qdev_new(TYPE_Q35_HOST_DEVICE));
if (pcmc->pci_enabled) {
pci_hole64_size = object_property_get_uint(OBJECT(q35_host),
PCI_HOST_PROP_PCI_HOLE64_SIZE,
&error_abort);
}
/* allocate ram and load rom/bios */ /* allocate ram and load rom/bios */
pc_memory_init(pcms, get_system_memory(), rom_memory, &ram_memory); pc_memory_init(pcms, get_system_memory(), rom_memory, &ram_memory,
pci_hole64_size);
object_property_add_child(qdev_get_machine(), "q35", OBJECT(q35_host)); object_property_add_child(qdev_get_machine(), "q35", OBJECT(q35_host));
object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_RAM_MEM, object_property_set_link(OBJECT(q35_host), MCH_HOST_PROP_RAM_MEM,
......
...@@ -162,7 +162,8 @@ void xen_load_linux(PCMachineState *pcms); ...@@ -162,7 +162,8 @@ void xen_load_linux(PCMachineState *pcms);
void pc_memory_init(PCMachineState *pcms, void pc_memory_init(PCMachineState *pcms,
MemoryRegion *system_memory, MemoryRegion *system_memory,
MemoryRegion *rom_memory, MemoryRegion *rom_memory,
MemoryRegion **ram_memory); MemoryRegion **ram_memory,
uint64_t pci_hole64_size);
uint64_t pc_pci_hole64_start(void); uint64_t pc_pci_hole64_start(void);
DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus); DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus);
void pc_basic_device_init(struct PCMachineState *pcms, void pc_basic_device_init(struct PCMachineState *pcms,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment