On 11/2/19 7:10 PM, Laurent Vivier wrote:
Paolo,

the RFC was mainly for you:

Is this the good way to replicate 256 times a memory chunk containing a
bunch of different MMIO spaces?

I asked Richard about this and he said this is OK because this is
the FlatView memory tree. It is then optimized in AddressSpace
(see memory_region_transaction_commit). What matters in term of
performance are the AddressSpaces.

...
+    /*
+     * Memory from VIA_BASE to VIA_BASE + 0x40000 is repeated
+     * from VIA_BASE + 0x40000 to VIA_BASE + 0x4000000
+     */
+    for (i = 1; i < 256; i++) {
+        MemoryRegion *io = g_malloc(sizeof(*io));
+        char *name = g_strdup_printf("mac_m68k.io[%d]", i);
+
+        memory_region_init_alias(io, NULL, name, get_system_memory(),
+                                 VIA_BASE, 0x40000);
+        memory_region_add_subregion(get_system_memory(),
+                                    VIA_BASE + i * 0x40000, io);
+        g_free(name);
+    }
+
...
Thanks,
Laurent


Reply via email to