]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/cxl: Make the CXL fixed memory windows devices.
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Thu, 3 Jul 2025 10:41:07 +0000 (11:41 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 8 Jul 2025 19:27:09 +0000 (20:27 +0100)
commit584f722eb3ab4896ce9e3913c49f4f22e8b51f2b
tree468fdcedd07437e37d429c8925e89e95f0544d70
parent35566583d86e167b617f0b55e485fc4ef1ae5dc3
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>
hw/acpi/cxl.c
hw/cxl/cxl-host-stubs.c
hw/cxl/cxl-host.c
hw/i386/pc.c
include/hw/cxl/cxl.h
include/hw/cxl/cxl_host.h