On 07/02/19 12:49, Dr. David Alan Gilbert wrote: > //#define DEBUG_UNASSIGNED > @@ -2924,6 +2926,8 @@ struct FlatViewInfo { > int counter; > bool dispatch_tree; > bool owner; > + AccelClass *ac; > + const char *ac_name; > }; > > static void mtree_print_flatview(gpointer key, gpointer value, > @@ -2939,6 +2943,7 @@ static void mtree_print_flatview(gpointer key, gpointer > value, > int n = view->nr; > int i; > AddressSpace *as; > + bool system_as = false; > > p(f, "FlatView #%d\n", fvi->counter); > ++fvi->counter; > @@ -2950,6 +2955,9 @@ static void mtree_print_flatview(gpointer key, gpointer > value, > p(f, ", alias %s", memory_region_name(as->root->alias)); > } > p(f, "\n"); > + if (as == &address_space_memory) { > + system_as = true; > + } > } > > p(f, " Root memory region: %s\n", > @@ -2985,6 +2993,13 @@ static void mtree_print_flatview(gpointer key, > gpointer value, > if (fvi->owner) { > mtree_print_mr_owner(p, f, mr); > } > + > + if (system_as && fvi->ac && > + fvi->ac->has_memory(current_machine, > + int128_get64(range->addr.start), > + MR_SIZE(range->addr.size) + 1)) { > + p(f, " %s", fvi->ac_name);
I don't understand this. This doesn't check that the memory range actually matches the memory registered with the accelerator, only that there is something in that range. Why isn't it enough to use "info mtree" and look at the KVM address space? Perhaps you could add instead an argument to "info mtree" that prints only the AddressSpace with a given name? Paolo