@@ -705,14 +705,14 @@ static void pc_get_device_memory_range(PCMachineState *pcms,
*device_mem_size = size;
}
-static uint64_t pc_get_cxl_range_start(PCMachineState *pcms)
+static uint64_t pc_get_cxl_range_start(PcPciMachineState *ppms)
{
+ PCMachineState *pcms = PC_MACHINE(ppms);
MachineState *ms = MACHINE(pcms);
hwaddr cxl_base;
ram_addr_t size;
- if (has_reserved_memory(pcms) &&
- (ms->ram_size < ms->maxram_size)) {
+ if ((ms->ram_size < ms->maxram_size)) {
pc_get_device_memory_range(pcms, &cxl_base, &size);
cxl_base += size;
} else {
@@ -722,10 +722,9 @@ static uint64_t pc_get_cxl_range_start(PCMachineState *pcms)
return cxl_base;
}
-static uint64_t pc_get_cxl_range_end(PCMachineState *pcms)
+static uint64_t pc_get_cxl_range_end(PcPciMachineState *ppms)
{
- PcPciMachineState *ppms = PC_PCI_MACHINE(pcms);
- uint64_t start = pc_get_cxl_range_start(pcms) + MiB;
+ uint64_t start = pc_get_cxl_range_start(ppms) + MiB;
if (ppms->cxl_devices_state.fixed_windows) {
GList *it;
@@ -937,7 +936,7 @@ void pc_memory_init(PCMachineState *pcms,
MemoryRegion *mr = &ppms->cxl_devices_state.host_mr;
hwaddr cxl_size = MiB;
- cxl_base = pc_get_cxl_range_start(pcms);
+ cxl_base = pc_get_cxl_range_start(ppms);
memory_region_init(mr, OBJECT(machine), "cxl_host_reg", cxl_size);
memory_region_add_subregion(system_memory, cxl_base, mr);
cxl_resv_end = cxl_base + cxl_size;
@@ -1027,7 +1026,7 @@ uint64_t pc_pci_hole64_start(void)
ram_addr_t size = 0;
if (ppms->cxl_devices_state.is_enabled) {
- hole64_start = pc_get_cxl_range_end(pcms);
+ hole64_start = pc_get_cxl_range_end(ppms);
} else if (has_reserved_memory(pcms) && (ms->ram_size < ms->maxram_size)) {
pc_get_device_memory_range(pcms, &hole64_start, &size);
if (!pcmc->broken_reserved_end) {
Since CXL helpers expect a PCI-based machine, we can directly pass them a PcPciMachineState argument. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/i386/pc.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)