mirror of
https://github.com/qemu/qemu.git
synced 2025-08-13 18:46:38 +00:00

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>
26 lines
623 B
C
26 lines
623 B
C
/*
|
|
* QEMU CXL Host Setup
|
|
*
|
|
* Copyright (c) 2022 Huawei
|
|
*
|
|
* This work is licensed under the terms of the GNU GPL, version 2. See the
|
|
* COPYING file in the top-level directory.
|
|
*/
|
|
|
|
#include "hw/cxl/cxl.h"
|
|
#include "hw/boards.h"
|
|
|
|
#ifndef CXL_HOST_H
|
|
#define CXL_HOST_H
|
|
|
|
void cxl_machine_init(Object *obj, CXLState *state);
|
|
void cxl_fmws_link_targets(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;
|
|
|
|
#endif
|