mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 17:23:56 -06:00
hw/cxl/component: Implement host bridge MMIO (8.2.5, table 142)
CXL host bridges themselves may have MMIO. Since host bridges don't have a BAR they are treated as special for MMIO. This patch includes i386/pc support. Also hook up the device reset now that we have have the MMIO space in which the results are visible. Note that we duplicate the PCI express case for the aml_build but the implementations will diverge when the CXL specific _OSC is introduced. Signed-off-by: Ben Widawsky <ben.widawsky@intel.com> Co-developed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20220429144110.25167-24-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
92fd46b68a
commit
6e4e3ae936
4 changed files with 122 additions and 10 deletions
27
hw/i386/pc.c
27
hw/i386/pc.c
|
@ -75,6 +75,7 @@
|
|||
#include "acpi-build.h"
|
||||
#include "hw/mem/pc-dimm.h"
|
||||
#include "hw/mem/nvdimm.h"
|
||||
#include "hw/cxl/cxl.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qapi-visit-common.h"
|
||||
#include "qapi/qapi-visit-machine.h"
|
||||
|
@ -816,6 +817,7 @@ void pc_memory_init(PCMachineState *pcms,
|
|||
MachineClass *mc = MACHINE_GET_CLASS(machine);
|
||||
PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
|
||||
X86MachineState *x86ms = X86_MACHINE(pcms);
|
||||
hwaddr cxl_base;
|
||||
|
||||
assert(machine->ram_size == x86ms->below_4g_mem_size +
|
||||
x86ms->above_4g_mem_size);
|
||||
|
@ -905,6 +907,26 @@ void pc_memory_init(PCMachineState *pcms,
|
|||
&machine->device_memory->mr);
|
||||
}
|
||||
|
||||
if (machine->cxl_devices_state->is_enabled) {
|
||||
MemoryRegion *mr = &machine->cxl_devices_state->host_mr;
|
||||
hwaddr cxl_size = MiB;
|
||||
|
||||
if (pcmc->has_reserved_memory && machine->device_memory->base) {
|
||||
cxl_base = machine->device_memory->base;
|
||||
if (!pcmc->broken_reserved_end) {
|
||||
cxl_base += memory_region_size(&machine->device_memory->mr);
|
||||
}
|
||||
} else if (pcms->sgx_epc.size != 0) {
|
||||
cxl_base = sgx_epc_above_4g_end(&pcms->sgx_epc);
|
||||
} else {
|
||||
cxl_base = 0x100000000ULL + x86ms->above_4g_mem_size;
|
||||
}
|
||||
|
||||
e820_add_entry(cxl_base, cxl_size, E820_RESERVED);
|
||||
memory_region_init(mr, OBJECT(machine), "cxl_host_reg", cxl_size);
|
||||
memory_region_add_subregion(system_memory, cxl_base, mr);
|
||||
}
|
||||
|
||||
/* Initialize PC system firmware */
|
||||
pc_system_firmware_init(pcms, rom_memory);
|
||||
|
||||
|
@ -965,7 +987,10 @@ uint64_t pc_pci_hole64_start(void)
|
|||
X86MachineState *x86ms = X86_MACHINE(pcms);
|
||||
uint64_t hole64_start = 0;
|
||||
|
||||
if (pcmc->has_reserved_memory && ms->device_memory->base) {
|
||||
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);
|
||||
} else if (pcmc->has_reserved_memory && ms->device_memory->base) {
|
||||
hole64_start = ms->device_memory->base;
|
||||
if (!pcmc->broken_reserved_end) {
|
||||
hole64_start += memory_region_size(&ms->device_memory->mr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue