On 22/09/20 22:11, Ashish Kalra wrote: > This internally invokes the address_space_rw() accessor functions > which we had "fixed" internally (as part of the earlier patch) to > invoke memory region specific debug ops. In our earlier approach we > were adding debug ops/callbacks to memory regions and as per comments > on our earlier patches, Paolo was not happy with this debug API for > MemoryRegions and hence the SEV support for Qemu was merged without > the debug support.
My complaint was only about hooking into address_space_read and address_space_write; I think the hook should not touch general-purpose (non-debug) code if possible, so something like this: typedef struct MemoryDebugOps { hwaddr (*translate)(CPUState *cpu, target_ulong addr, MemTxAttrs *attrs); MemTxResult (*read)(AddressSpace *as, hwaddr phys_addr, MemTxAttrs attrs, void *buf, hwaddr len); MemTxResult (*write)(AddressSpace *as, hwaddr phys_addr, MemTxAttrs attrs, const void *buf, hwaddr len); } MemoryDebugOps; These ops would be used only by cpu_memory_rw_debug and would default to static const MemoryDebugOps default_debug_ops = { .translate = cpu_get_phys_page_attrs_debug, .read = address_space_read, .write = address_space_write_rom }; static const MemoryDebugOps *debug_ops = &default_debug_ops; Paolo