|
@@ -733,12 +733,12 @@ void pc_machine_done(Notifier *notifier, void *data)
|
|
PCMachineState *pcms = container_of(notifier,
|
|
PCMachineState *pcms = container_of(notifier,
|
|
PCMachineState, machine_done);
|
|
PCMachineState, machine_done);
|
|
X86MachineState *x86ms = X86_MACHINE(pcms);
|
|
X86MachineState *x86ms = X86_MACHINE(pcms);
|
|
- MachineState *ms = MACHINE(pcms);
|
|
|
|
|
|
|
|
- if (ms->cxl_devices_state) {
|
|
|
|
- cxl_hook_up_pxb_registers(pcms->bus, ms->cxl_devices_state,
|
|
|
|
- &error_fatal);
|
|
|
|
- cxl_fmws_link_targets(ms->cxl_devices_state, &error_fatal);
|
|
|
|
|
|
+ cxl_hook_up_pxb_registers(pcms->bus, &pcms->cxl_devices_state,
|
|
|
|
+ &error_fatal);
|
|
|
|
+
|
|
|
|
+ if (pcms->cxl_devices_state.is_enabled) {
|
|
|
|
+ cxl_fmws_link_targets(&pcms->cxl_devices_state, &error_fatal);
|
|
}
|
|
}
|
|
|
|
|
|
/* set the number of CPUs */
|
|
/* set the number of CPUs */
|
|
@@ -908,8 +908,8 @@ void pc_memory_init(PCMachineState *pcms,
|
|
&machine->device_memory->mr);
|
|
&machine->device_memory->mr);
|
|
}
|
|
}
|
|
|
|
|
|
- if (machine->cxl_devices_state->is_enabled) {
|
|
|
|
- MemoryRegion *mr = &machine->cxl_devices_state->host_mr;
|
|
|
|
|
|
+ if (pcms->cxl_devices_state.is_enabled) {
|
|
|
|
+ MemoryRegion *mr = &pcms->cxl_devices_state.host_mr;
|
|
hwaddr cxl_size = MiB;
|
|
hwaddr cxl_size = MiB;
|
|
|
|
|
|
if (pcmc->has_reserved_memory && machine->device_memory->base) {
|
|
if (pcmc->has_reserved_memory && machine->device_memory->base) {
|
|
@@ -927,12 +927,12 @@ void pc_memory_init(PCMachineState *pcms,
|
|
memory_region_init(mr, OBJECT(machine), "cxl_host_reg", cxl_size);
|
|
memory_region_init(mr, OBJECT(machine), "cxl_host_reg", cxl_size);
|
|
memory_region_add_subregion(system_memory, cxl_base, mr);
|
|
memory_region_add_subregion(system_memory, cxl_base, mr);
|
|
cxl_resv_end = cxl_base + cxl_size;
|
|
cxl_resv_end = cxl_base + cxl_size;
|
|
- if (machine->cxl_devices_state->fixed_windows) {
|
|
|
|
|
|
+ if (pcms->cxl_devices_state.fixed_windows) {
|
|
hwaddr cxl_fmw_base;
|
|
hwaddr cxl_fmw_base;
|
|
GList *it;
|
|
GList *it;
|
|
|
|
|
|
cxl_fmw_base = ROUND_UP(cxl_base + cxl_size, 256 * MiB);
|
|
cxl_fmw_base = ROUND_UP(cxl_base + cxl_size, 256 * MiB);
|
|
- for (it = machine->cxl_devices_state->fixed_windows; it; it = it->next) {
|
|
|
|
|
|
+ for (it = pcms->cxl_devices_state.fixed_windows; it; it = it->next) {
|
|
CXLFixedWindow *fw = it->data;
|
|
CXLFixedWindow *fw = it->data;
|
|
|
|
|
|
fw->base = cxl_fmw_base;
|
|
fw->base = cxl_fmw_base;
|
|
@@ -974,7 +974,7 @@ void pc_memory_init(PCMachineState *pcms,
|
|
res_mem_end += memory_region_size(&machine->device_memory->mr);
|
|
res_mem_end += memory_region_size(&machine->device_memory->mr);
|
|
}
|
|
}
|
|
|
|
|
|
- if (machine->cxl_devices_state->is_enabled) {
|
|
|
|
|
|
+ if (pcms->cxl_devices_state.is_enabled) {
|
|
res_mem_end = cxl_resv_end;
|
|
res_mem_end = cxl_resv_end;
|
|
}
|
|
}
|
|
*val = cpu_to_le64(ROUND_UP(res_mem_end, 1 * GiB));
|
|
*val = cpu_to_le64(ROUND_UP(res_mem_end, 1 * GiB));
|
|
@@ -1010,12 +1010,12 @@ uint64_t pc_pci_hole64_start(void)
|
|
X86MachineState *x86ms = X86_MACHINE(pcms);
|
|
X86MachineState *x86ms = X86_MACHINE(pcms);
|
|
uint64_t hole64_start = 0;
|
|
uint64_t hole64_start = 0;
|
|
|
|
|
|
- if (ms->cxl_devices_state->host_mr.addr) {
|
|
|
|
- hole64_start = ms->cxl_devices_state->host_mr.addr +
|
|
|
|
- memory_region_size(&ms->cxl_devices_state->host_mr);
|
|
|
|
- if (ms->cxl_devices_state->fixed_windows) {
|
|
|
|
|
|
+ if (pcms->cxl_devices_state.host_mr.addr) {
|
|
|
|
+ hole64_start = pcms->cxl_devices_state.host_mr.addr +
|
|
|
|
+ memory_region_size(&pcms->cxl_devices_state.host_mr);
|
|
|
|
+ if (pcms->cxl_devices_state.fixed_windows) {
|
|
GList *it;
|
|
GList *it;
|
|
- for (it = ms->cxl_devices_state->fixed_windows; it; it = it->next) {
|
|
|
|
|
|
+ for (it = pcms->cxl_devices_state.fixed_windows; it; it = it->next) {
|
|
CXLFixedWindow *fw = it->data;
|
|
CXLFixedWindow *fw = it->data;
|
|
hole64_start = fw->mr.addr + memory_region_size(&fw->mr);
|
|
hole64_start = fw->mr.addr + memory_region_size(&fw->mr);
|
|
}
|
|
}
|
|
@@ -1691,7 +1691,6 @@ static void pc_machine_set_max_fw_size(Object *obj, Visitor *v,
|
|
static void pc_machine_initfn(Object *obj)
|
|
static void pc_machine_initfn(Object *obj)
|
|
{
|
|
{
|
|
PCMachineState *pcms = PC_MACHINE(obj);
|
|
PCMachineState *pcms = PC_MACHINE(obj);
|
|
- MachineState *ms = MACHINE(obj);
|
|
|
|
|
|
|
|
#ifdef CONFIG_VMPORT
|
|
#ifdef CONFIG_VMPORT
|
|
pcms->vmport = ON_OFF_AUTO_AUTO;
|
|
pcms->vmport = ON_OFF_AUTO_AUTO;
|
|
@@ -1716,7 +1715,7 @@ static void pc_machine_initfn(Object *obj)
|
|
pcms->pcspk = isa_new(TYPE_PC_SPEAKER);
|
|
pcms->pcspk = isa_new(TYPE_PC_SPEAKER);
|
|
object_property_add_alias(OBJECT(pcms), "pcspk-audiodev",
|
|
object_property_add_alias(OBJECT(pcms), "pcspk-audiodev",
|
|
OBJECT(pcms->pcspk), "audiodev");
|
|
OBJECT(pcms->pcspk), "audiodev");
|
|
- cxl_machine_init(obj, ms->cxl_devices_state);
|
|
|
|
|
|
+ cxl_machine_init(obj, &pcms->cxl_devices_state);
|
|
}
|
|
}
|
|
|
|
|
|
static void pc_machine_reset(MachineState *machine)
|
|
static void pc_machine_reset(MachineState *machine)
|