mirror of
https://github.com/qemu/qemu.git
synced 2025-08-09 01:50:43 +00:00
hw/cxl: Make the CXL fixed memory windows devices.
Previously these somewhat device like structures were tracked using a list in the CXLState in each machine. This is proving restrictive in a few cases where we need to iterate through these without being aware of the machine type. Just make them sysbus devices. Restrict them to not user created as they need to be visible to early stages of machine init given effects on the memory map. This change both simplifies state tracking and enables features needed for performance optimization and hotness tracking by making it possible to retrieve the fixed memory window on actions elsewhere in the topology. In some cases the ordering of the Fixed Memory Windows matters. For those utility functions provide a GSList sorted by the window index. This ensures that we get consistency across: - ordering in the command line - ordering of the host PA ranges - ordering of ACPI CEDT structures describing the CFMWS. Other aspects don't have this constraint. For those direct iteration of the underlying hash structures is fine. In the setup path for the memory map in pc_memory_init() split the operations into two calls. The first, cxl_fmws_set_mmemap(), loops over fixed memory windows in order and assigns their addresses. The second, cxl_fmws_update_mmio() actually sets up the mmio for each window. This is obviously less efficient than a single loop but this split design is needed to put the logic in two different places in the arm64 support and it is not a hot enough path to justify an x86 only implementation. Reviewed-by: Li Zhijian <lizhijian@fujitsu.com> Tested-by: Li Zhijian <lizhijian@fujitsu.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Tested-by: Itaru Kitayama <itaru.kitayama@fujitsu.com> Message-id: 20250703104110.992379-3-Jonathan.Cameron@huawei.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
35566583d8
commit
584f722eb3
@ -22,6 +22,7 @@
|
|||||||
#include "hw/pci/pci_bridge.h"
|
#include "hw/pci/pci_bridge.h"
|
||||||
#include "hw/pci/pci_host.h"
|
#include "hw/pci/pci_host.h"
|
||||||
#include "hw/cxl/cxl.h"
|
#include "hw/cxl/cxl.h"
|
||||||
|
#include "hw/cxl/cxl_host.h"
|
||||||
#include "hw/mem/memory-device.h"
|
#include "hw/mem/memory-device.h"
|
||||||
#include "hw/acpi/acpi.h"
|
#include "hw/acpi/acpi.h"
|
||||||
#include "hw/acpi/aml-build.h"
|
#include "hw/acpi/aml-build.h"
|
||||||
@ -135,55 +136,52 @@ static void cedt_build_chbs(GArray *table_data, PXBCXLDev *cxl)
|
|||||||
* Interleave ways encoding in CXL 2.0 ECN: 3, 6, 12 and 16-way memory
|
* Interleave ways encoding in CXL 2.0 ECN: 3, 6, 12 and 16-way memory
|
||||||
* interleaving.
|
* interleaving.
|
||||||
*/
|
*/
|
||||||
static void cedt_build_cfmws(GArray *table_data, CXLState *cxls)
|
static void cedt_build_cfmws(CXLFixedWindow *fw, Aml *cedt)
|
||||||
{
|
{
|
||||||
GList *it;
|
GArray *table_data = cedt->buf;
|
||||||
|
int i;
|
||||||
|
|
||||||
for (it = cxls->fixed_windows; it; it = it->next) {
|
/* Type */
|
||||||
CXLFixedWindow *fw = it->data;
|
build_append_int_noprefix(table_data, 1, 1);
|
||||||
int i;
|
|
||||||
|
|
||||||
/* Type */
|
/* Reserved */
|
||||||
build_append_int_noprefix(table_data, 1, 1);
|
build_append_int_noprefix(table_data, 0, 1);
|
||||||
|
|
||||||
/* Reserved */
|
/* Record Length */
|
||||||
build_append_int_noprefix(table_data, 0, 1);
|
build_append_int_noprefix(table_data, 36 + 4 * fw->num_targets, 2);
|
||||||
|
|
||||||
/* Record Length */
|
/* Reserved */
|
||||||
build_append_int_noprefix(table_data, 36 + 4 * fw->num_targets, 2);
|
build_append_int_noprefix(table_data, 0, 4);
|
||||||
|
|
||||||
/* Reserved */
|
/* Base HPA */
|
||||||
build_append_int_noprefix(table_data, 0, 4);
|
build_append_int_noprefix(table_data, fw->mr.addr, 8);
|
||||||
|
|
||||||
/* Base HPA */
|
/* Window Size */
|
||||||
build_append_int_noprefix(table_data, fw->mr.addr, 8);
|
build_append_int_noprefix(table_data, fw->size, 8);
|
||||||
|
|
||||||
/* Window Size */
|
/* Host Bridge Interleave Ways */
|
||||||
build_append_int_noprefix(table_data, fw->size, 8);
|
build_append_int_noprefix(table_data, fw->enc_int_ways, 1);
|
||||||
|
|
||||||
/* Host Bridge Interleave Ways */
|
/* Host Bridge Interleave Arithmetic */
|
||||||
build_append_int_noprefix(table_data, fw->enc_int_ways, 1);
|
build_append_int_noprefix(table_data, 0, 1);
|
||||||
|
|
||||||
/* Host Bridge Interleave Arithmetic */
|
/* Reserved */
|
||||||
build_append_int_noprefix(table_data, 0, 1);
|
build_append_int_noprefix(table_data, 0, 2);
|
||||||
|
|
||||||
/* Reserved */
|
/* Host Bridge Interleave Granularity */
|
||||||
build_append_int_noprefix(table_data, 0, 2);
|
build_append_int_noprefix(table_data, fw->enc_int_gran, 4);
|
||||||
|
|
||||||
/* Host Bridge Interleave Granularity */
|
/* Window Restrictions */
|
||||||
build_append_int_noprefix(table_data, fw->enc_int_gran, 4);
|
build_append_int_noprefix(table_data, 0x0f, 2);
|
||||||
|
|
||||||
/* Window Restrictions */
|
/* QTG ID */
|
||||||
build_append_int_noprefix(table_data, 0x0f, 2); /* No restrictions */
|
build_append_int_noprefix(table_data, 0, 2);
|
||||||
|
|
||||||
/* QTG ID */
|
/* Host Bridge List (list of UIDs - currently bus_nr) */
|
||||||
build_append_int_noprefix(table_data, 0, 2);
|
for (i = 0; i < fw->num_targets; i++) {
|
||||||
|
g_assert(fw->target_hbs[i]);
|
||||||
/* Host Bridge List (list of UIDs - currently bus_nr) */
|
build_append_int_noprefix(table_data,
|
||||||
for (i = 0; i < fw->num_targets; i++) {
|
PXB_DEV(fw->target_hbs[i])->bus_nr, 4);
|
||||||
g_assert(fw->target_hbs[i]);
|
|
||||||
build_append_int_noprefix(table_data, PXB_DEV(fw->target_hbs[i])->bus_nr, 4);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,6 +200,7 @@ void cxl_build_cedt(GArray *table_offsets, GArray *table_data,
|
|||||||
BIOSLinker *linker, const char *oem_id,
|
BIOSLinker *linker, const char *oem_id,
|
||||||
const char *oem_table_id, CXLState *cxl_state)
|
const char *oem_table_id, CXLState *cxl_state)
|
||||||
{
|
{
|
||||||
|
GSList *cfmws_list, *iter;
|
||||||
Aml *cedt;
|
Aml *cedt;
|
||||||
AcpiTable table = { .sig = "CEDT", .rev = 1, .oem_id = oem_id,
|
AcpiTable table = { .sig = "CEDT", .rev = 1, .oem_id = oem_id,
|
||||||
.oem_table_id = oem_table_id };
|
.oem_table_id = oem_table_id };
|
||||||
@ -213,7 +212,12 @@ void cxl_build_cedt(GArray *table_offsets, GArray *table_data,
|
|||||||
/* reserve space for CEDT header */
|
/* reserve space for CEDT header */
|
||||||
|
|
||||||
object_child_foreach_recursive(object_get_root(), cxl_foreach_pxb_hb, cedt);
|
object_child_foreach_recursive(object_get_root(), cxl_foreach_pxb_hb, cedt);
|
||||||
cedt_build_cfmws(cedt->buf, cxl_state);
|
|
||||||
|
cfmws_list = cxl_fmws_get_all_sorted();
|
||||||
|
for (iter = cfmws_list; iter; iter = iter->next) {
|
||||||
|
cedt_build_cfmws(CXL_FMW(iter->data), cedt);
|
||||||
|
}
|
||||||
|
g_slist_free(cfmws_list);
|
||||||
|
|
||||||
/* copy AML table into ACPI tables blob and patch header there */
|
/* copy AML table into ACPI tables blob and patch header there */
|
||||||
g_array_append_vals(table_data, cedt->buf->data, cedt->buf->len);
|
g_array_append_vals(table_data, cedt->buf->data, cedt->buf->len);
|
||||||
|
@ -8,8 +8,13 @@
|
|||||||
#include "hw/cxl/cxl.h"
|
#include "hw/cxl/cxl.h"
|
||||||
#include "hw/cxl/cxl_host.h"
|
#include "hw/cxl/cxl_host.h"
|
||||||
|
|
||||||
void cxl_fmws_link_targets(CXLState *stat, Error **errp) {};
|
void cxl_fmws_link_targets(Error **errp) {};
|
||||||
void cxl_machine_init(Object *obj, CXLState *state) {};
|
void cxl_machine_init(Object *obj, CXLState *state) {};
|
||||||
void cxl_hook_up_pxb_registers(PCIBus *bus, CXLState *state, Error **errp) {};
|
void cxl_hook_up_pxb_registers(PCIBus *bus, CXLState *state, Error **errp) {};
|
||||||
|
hwaddr cxl_fmws_set_memmap(hwaddr base, hwaddr max_addr)
|
||||||
|
{
|
||||||
|
return base;
|
||||||
|
};
|
||||||
|
void cxl_fmws_update_mmio(void) {};
|
||||||
|
|
||||||
const MemoryRegionOps cfmws_ops;
|
const MemoryRegionOps cfmws_ops;
|
||||||
|
@ -22,12 +22,12 @@
|
|||||||
#include "hw/pci/pcie_port.h"
|
#include "hw/pci/pcie_port.h"
|
||||||
#include "hw/pci-bridge/pci_expander_bridge.h"
|
#include "hw/pci-bridge/pci_expander_bridge.h"
|
||||||
|
|
||||||
static void cxl_fixed_memory_window_config(CXLState *cxl_state,
|
static void cxl_fixed_memory_window_config(CXLFixedMemoryWindowOptions *object,
|
||||||
CXLFixedMemoryWindowOptions *object,
|
|
||||||
int index, Error **errp)
|
int index, Error **errp)
|
||||||
{
|
{
|
||||||
ERRP_GUARD();
|
ERRP_GUARD();
|
||||||
g_autofree CXLFixedWindow *fw = g_malloc0(sizeof(*fw));
|
DeviceState *dev = qdev_new(TYPE_CXL_FMW);
|
||||||
|
CXLFixedWindow *fw = CXL_FMW(dev);
|
||||||
strList *target;
|
strList *target;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -67,35 +67,39 @@ static void cxl_fixed_memory_window_config(CXLState *cxl_state,
|
|||||||
fw->targets[i] = g_strdup(target->value);
|
fw->targets[i] = g_strdup(target->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
cxl_state->fixed_windows = g_list_append(cxl_state->fixed_windows,
|
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), errp);
|
||||||
g_steal_pointer(&fw));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cxl_fmws_link_targets(CXLState *cxl_state, Error **errp)
|
static int cxl_fmws_link(Object *obj, void *opaque)
|
||||||
{
|
{
|
||||||
if (cxl_state && cxl_state->fixed_windows) {
|
struct CXLFixedWindow *fw;
|
||||||
GList *it;
|
int i;
|
||||||
|
|
||||||
for (it = cxl_state->fixed_windows; it; it = it->next) {
|
if (!object_dynamic_cast(obj, TYPE_CXL_FMW)) {
|
||||||
CXLFixedWindow *fw = it->data;
|
return 0;
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < fw->num_targets; i++) {
|
|
||||||
Object *o;
|
|
||||||
bool ambig;
|
|
||||||
|
|
||||||
o = object_resolve_path_type(fw->targets[i],
|
|
||||||
TYPE_PXB_CXL_DEV,
|
|
||||||
&ambig);
|
|
||||||
if (!o) {
|
|
||||||
error_setg(errp, "Could not resolve CXLFM target %s",
|
|
||||||
fw->targets[i]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fw->target_hbs[i] = PXB_CXL_DEV(o);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
fw = CXL_FMW(obj);
|
||||||
|
|
||||||
|
for (i = 0; i < fw->num_targets; i++) {
|
||||||
|
Object *o;
|
||||||
|
bool ambig;
|
||||||
|
|
||||||
|
o = object_resolve_path_type(fw->targets[i], TYPE_PXB_CXL_DEV,
|
||||||
|
&ambig);
|
||||||
|
if (!o) {
|
||||||
|
error_setg(&error_fatal, "Could not resolve CXLFM target %s",
|
||||||
|
fw->targets[i]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
fw->target_hbs[i] = PXB_CXL_DEV(o);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cxl_fmws_link_targets(Error **errp)
|
||||||
|
{
|
||||||
|
/* Order doesn't matter for this, so no need to build list */
|
||||||
|
object_child_foreach_recursive(object_get_root(), cxl_fmws_link, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool cxl_hdm_find_target(uint32_t *cache_mem, hwaddr addr,
|
static bool cxl_hdm_find_target(uint32_t *cache_mem, hwaddr addr,
|
||||||
@ -335,7 +339,7 @@ static void machine_set_cfmw(Object *obj, Visitor *v, const char *name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (it = cfmw_list, index = 0; it; it = it->next, index++) {
|
for (it = cfmw_list, index = 0; it; it = it->next, index++) {
|
||||||
cxl_fixed_memory_window_config(state, it->value, index, errp);
|
cxl_fixed_memory_window_config(it->value, index, errp);
|
||||||
}
|
}
|
||||||
state->cfmw_list = cfmw_list;
|
state->cfmw_list = cfmw_list;
|
||||||
}
|
}
|
||||||
@ -373,3 +377,110 @@ void cxl_hook_up_pxb_registers(PCIBus *bus, CXLState *state, Error **errp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int cxl_fmws_find(Object *obj, void *opaque)
|
||||||
|
{
|
||||||
|
GSList **list = opaque;
|
||||||
|
|
||||||
|
if (!object_dynamic_cast(obj, TYPE_CXL_FMW)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
*list = g_slist_prepend(*list, obj);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GSList *cxl_fmws_get_all(void)
|
||||||
|
{
|
||||||
|
GSList *list = NULL;
|
||||||
|
|
||||||
|
object_child_foreach_recursive(object_get_root(), cxl_fmws_find, &list);
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gint cfmws_cmp(gconstpointer a, gconstpointer b, gpointer d)
|
||||||
|
{
|
||||||
|
const struct CXLFixedWindow *ap = a;
|
||||||
|
const struct CXLFixedWindow *bp = b;
|
||||||
|
|
||||||
|
return ap->index > bp->index;
|
||||||
|
}
|
||||||
|
|
||||||
|
GSList *cxl_fmws_get_all_sorted(void)
|
||||||
|
{
|
||||||
|
return g_slist_sort_with_data(cxl_fmws_get_all(), cfmws_cmp, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int cxl_fmws_mmio_map(Object *obj, void *opaque)
|
||||||
|
{
|
||||||
|
struct CXLFixedWindow *fw;
|
||||||
|
|
||||||
|
if (!object_dynamic_cast(obj, TYPE_CXL_FMW)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
fw = CXL_FMW(obj);
|
||||||
|
sysbus_mmio_map(SYS_BUS_DEVICE(fw), 0, fw->base);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cxl_fmws_update_mmio(void)
|
||||||
|
{
|
||||||
|
/* Ordering is not required for this */
|
||||||
|
object_child_foreach_recursive(object_get_root(), cxl_fmws_mmio_map, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
hwaddr cxl_fmws_set_memmap(hwaddr base, hwaddr max_addr)
|
||||||
|
{
|
||||||
|
GSList *cfmws_list, *iter;
|
||||||
|
CXLFixedWindow *fw;
|
||||||
|
|
||||||
|
cfmws_list = cxl_fmws_get_all_sorted();
|
||||||
|
for (iter = cfmws_list; iter; iter = iter->next) {
|
||||||
|
fw = CXL_FMW(iter->data);
|
||||||
|
if (base + fw->size <= max_addr) {
|
||||||
|
fw->base = base;
|
||||||
|
base += fw->size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g_slist_free(cfmws_list);
|
||||||
|
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void cxl_fmw_realize(DeviceState *dev, Error **errp)
|
||||||
|
{
|
||||||
|
CXLFixedWindow *fw = CXL_FMW(dev);
|
||||||
|
|
||||||
|
memory_region_init_io(&fw->mr, OBJECT(dev), &cfmws_ops, fw,
|
||||||
|
"cxl-fixed-memory-region", fw->size);
|
||||||
|
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &fw->mr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note: Fixed memory windows represent fixed address decoders on the host and
|
||||||
|
* as such have no dynamic state to reset or migrate
|
||||||
|
*/
|
||||||
|
static void cxl_fmw_class_init(ObjectClass *klass, const void *data)
|
||||||
|
{
|
||||||
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
|
||||||
|
dc->desc = "CXL Fixed Memory Window";
|
||||||
|
dc->realize = cxl_fmw_realize;
|
||||||
|
/* Reason - created by machines as tightly coupled to machine memory map */
|
||||||
|
dc->user_creatable = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const TypeInfo cxl_fmw_info = {
|
||||||
|
.name = TYPE_CXL_FMW,
|
||||||
|
.parent = TYPE_SYS_BUS_DEVICE,
|
||||||
|
.instance_size = sizeof(CXLFixedWindow),
|
||||||
|
.class_init = cxl_fmw_class_init,
|
||||||
|
};
|
||||||
|
|
||||||
|
static void cxl_host_register_types(void)
|
||||||
|
{
|
||||||
|
type_register_static(&cxl_fmw_info);
|
||||||
|
}
|
||||||
|
type_init(cxl_host_register_types)
|
||||||
|
50
hw/i386/pc.c
50
hw/i386/pc.c
@ -609,7 +609,7 @@ void pc_machine_done(Notifier *notifier, void *data)
|
|||||||
&error_fatal);
|
&error_fatal);
|
||||||
|
|
||||||
if (pcms->cxl_devices_state.is_enabled) {
|
if (pcms->cxl_devices_state.is_enabled) {
|
||||||
cxl_fmws_link_targets(&pcms->cxl_devices_state, &error_fatal);
|
cxl_fmws_link_targets(&error_fatal);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set the number of CPUs */
|
/* set the number of CPUs */
|
||||||
@ -718,20 +718,28 @@ static uint64_t pc_get_cxl_range_start(PCMachineState *pcms)
|
|||||||
return cxl_base;
|
return cxl_base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int cxl_get_fmw_end(Object *obj, void *opaque)
|
||||||
|
{
|
||||||
|
struct CXLFixedWindow *fw;
|
||||||
|
uint64_t *start = opaque;
|
||||||
|
|
||||||
|
if (!object_dynamic_cast(obj, TYPE_CXL_FMW)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
fw = CXL_FMW(obj);
|
||||||
|
|
||||||
|
*start += fw->size;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static uint64_t pc_get_cxl_range_end(PCMachineState *pcms)
|
static uint64_t pc_get_cxl_range_end(PCMachineState *pcms)
|
||||||
{
|
{
|
||||||
uint64_t start = pc_get_cxl_range_start(pcms) + MiB;
|
uint64_t start = pc_get_cxl_range_start(pcms) + MiB;
|
||||||
|
|
||||||
if (pcms->cxl_devices_state.fixed_windows) {
|
/* Ordering doesn't matter so no need to build a sorted list */
|
||||||
GList *it;
|
object_child_foreach_recursive(object_get_root(), cxl_get_fmw_end,
|
||||||
|
&start);
|
||||||
start = ROUND_UP(start, 256 * MiB);
|
|
||||||
for (it = pcms->cxl_devices_state.fixed_windows; it; it = it->next) {
|
|
||||||
CXLFixedWindow *fw = it->data;
|
|
||||||
start += fw->size;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -933,23 +941,9 @@ void pc_memory_init(PCMachineState *pcms,
|
|||||||
cxl_base = pc_get_cxl_range_start(pcms);
|
cxl_base = pc_get_cxl_range_start(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_base = ROUND_UP(cxl_base + cxl_size, 256 * MiB);
|
||||||
if (pcms->cxl_devices_state.fixed_windows) {
|
cxl_resv_end = cxl_fmws_set_memmap(cxl_base, maxphysaddr);
|
||||||
hwaddr cxl_fmw_base;
|
cxl_fmws_update_mmio();
|
||||||
GList *it;
|
|
||||||
|
|
||||||
cxl_fmw_base = ROUND_UP(cxl_base + cxl_size, 256 * MiB);
|
|
||||||
for (it = pcms->cxl_devices_state.fixed_windows; it; it = it->next) {
|
|
||||||
CXLFixedWindow *fw = it->data;
|
|
||||||
|
|
||||||
fw->base = cxl_fmw_base;
|
|
||||||
memory_region_init_io(&fw->mr, OBJECT(machine), &cfmws_ops, fw,
|
|
||||||
"cxl-fixed-memory-region", fw->size);
|
|
||||||
memory_region_add_subregion(system_memory, fw->base, &fw->mr);
|
|
||||||
cxl_fmw_base += fw->size;
|
|
||||||
cxl_resv_end = cxl_fmw_base;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize PC system firmware */
|
/* Initialize PC system firmware */
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
typedef struct PXBCXLDev PXBCXLDev;
|
typedef struct PXBCXLDev PXBCXLDev;
|
||||||
|
|
||||||
typedef struct CXLFixedWindow {
|
typedef struct CXLFixedWindow {
|
||||||
|
SysBusDevice parent_obj;
|
||||||
int index;
|
int index;
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
char **targets;
|
char **targets;
|
||||||
@ -38,12 +39,13 @@ typedef struct CXLFixedWindow {
|
|||||||
MemoryRegion mr;
|
MemoryRegion mr;
|
||||||
hwaddr base;
|
hwaddr base;
|
||||||
} CXLFixedWindow;
|
} CXLFixedWindow;
|
||||||
|
#define TYPE_CXL_FMW "cxl-fmw"
|
||||||
|
OBJECT_DECLARE_SIMPLE_TYPE(CXLFixedWindow, CXL_FMW)
|
||||||
|
|
||||||
typedef struct CXLState {
|
typedef struct CXLState {
|
||||||
bool is_enabled;
|
bool is_enabled;
|
||||||
MemoryRegion host_mr;
|
MemoryRegion host_mr;
|
||||||
unsigned int next_mr_idx;
|
unsigned int next_mr_idx;
|
||||||
GList *fixed_windows;
|
|
||||||
CXLFixedMemoryWindowOptionsList *cfmw_list;
|
CXLFixedMemoryWindowOptionsList *cfmw_list;
|
||||||
} CXLState;
|
} CXLState;
|
||||||
|
|
||||||
|
@ -14,8 +14,11 @@
|
|||||||
#define CXL_HOST_H
|
#define CXL_HOST_H
|
||||||
|
|
||||||
void cxl_machine_init(Object *obj, CXLState *state);
|
void cxl_machine_init(Object *obj, CXLState *state);
|
||||||
void cxl_fmws_link_targets(CXLState *stat, Error **errp);
|
void cxl_fmws_link_targets(Error **errp);
|
||||||
void cxl_hook_up_pxb_registers(PCIBus *bus, CXLState *state, Error **errp);
|
void cxl_hook_up_pxb_registers(PCIBus *bus, CXLState *state, Error **errp);
|
||||||
|
hwaddr cxl_fmws_set_memmap(hwaddr base, hwaddr max_addr);
|
||||||
|
void cxl_fmws_update_mmio(void);
|
||||||
|
GSList *cxl_fmws_get_all_sorted(void);
|
||||||
|
|
||||||
extern const MemoryRegionOps cfmws_ops;
|
extern const MemoryRegionOps cfmws_ops;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user