[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 38/42] RFC: softmmu/memory: Add ops to memory_region_ram_init_
From: |
Jonathan Cameron |
Subject: |
[PATCH v4 38/42] RFC: softmmu/memory: Add ops to memory_region_ram_init_from_file |
Date: |
Mon, 24 Jan 2022 17:17:01 +0000 |
From: Jonathan Cameron <jonathan.cameron@huawei.com>
Inorder to implement memory interleaving we need a means to proxy
the calls. Adding mem_ops allows such proxying.
Note should have no impact on use cases not using _dispatch_read/write.
For now, only file backed hostmem is considered to seek feedback on
the approach before considering other hostmem backends.
Signed-off-by: Jonathan Cameron <jonathan.cameron@huawei.com>
---
softmmu/memory.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/softmmu/memory.c b/softmmu/memory.c
index 678dc62f06..d537091c63 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -1606,6 +1606,15 @@ void memory_region_init_ram_from_file(MemoryRegion *mr,
Error *err = NULL;
memory_region_init(mr, owner, name, size);
mr->ram = true;
+
+ /*
+ * ops used only when directly accessing via
+ * - memory_region_dispatch_read()
+ * - memory_region_dispatch_write()
+ */
+ mr->ops = &ram_device_mem_ops;
+ mr->opaque = mr;
+
mr->readonly = readonly;
mr->terminates = true;
mr->destructor = memory_region_destructor_ram;
--
2.32.0
- [PATCH v4 30/42] acpi/cxl: Introduce CFMWS structures in CEDT, (continued)
- [PATCH v4 32/42] pci/pcie_port: Add pci_find_port_by_pn(), Jonathan Cameron, 2022/01/24
- [PATCH v4 33/42] CXL/cxl_component: Add cxl_get_hb_cstate(), Jonathan Cameron, 2022/01/24
- [PATCH v4 34/42] mem/cxl_type3: Add read and write functions for associated hostmem., Jonathan Cameron, 2022/01/24
- [PATCH v4 35/42] cxl/cxl-host: Add memops for CFMWS region., Jonathan Cameron, 2022/01/24
- [PATCH v4 36/42] arm/virt: Allow virt/CEDT creation, Jonathan Cameron, 2022/01/24
- [PATCH v4 38/42] RFC: softmmu/memory: Add ops to memory_region_ram_init_from_file,
Jonathan Cameron <=
- [PATCH v4 37/42] hw/arm/virt: Basic CXL enablement on pci_expander_bridge instances pxb-cxl, Jonathan Cameron, 2022/01/24
- [PATCH v4 39/42] hw/cxl/component Add a dumb HDM decoder handler, Jonathan Cameron, 2022/01/24
- [PATCH v4 40/42] i386/pc: Enable CXL fixed memory windows, Jonathan Cameron, 2022/01/24
- [PATCH v4 41/42] qtest/acpi: Add reference CEDT tables., Jonathan Cameron, 2022/01/24
- [PATCH v4 42/42] qtest/cxl: Add very basic sanity tests, Jonathan Cameron, 2022/01/24
- Re: [PATCH v4 00/42] CXl 2.0 emulation Support, Jonathan Cameron, 2022/01/24
- Re: [PATCH v4 00/42] CXl 2.0 emulation Support, Alex Bennée, 2022/01/25
- Re: [PATCH v4 00/42] CXl 2.0 emulation Support, Ben Widawsky, 2022/01/25