> > > + cpu_address_space_init(cpu, 1, "cpu-smm", &smram_as_root); > > > > It is worth mentioning in the commit message that directly sharing > > MemoryRegion in CPUAddressSpace is safe. > > It's unnecessary to me. It's common that different Address space share the > same (root) memory region. e.g., for address space 0 for the cpu, though > what passed in is cpu->memory, they all point to system_memory.
For cpu->memory, there's the "object_ref(OBJECT(cpu->memory))" in cpu_exec_initfn(). But this case doesn't need to increase ref count like cpu->memory, since memory_region_ref() provides protection and it's enough. This is the difference. So it sounds like now it's more necessary to clarify this, no?