Hi Peter,

On 3/9/21 12:40 AM, Peter Xu wrote:> On Sat, Mar 06, 2021 at 12:54:13AM
+0100, Philippe Mathieu-Daudé wrote:
>> @@ -3188,14 +3188,15 @@ void mtree_info(bool flatview, bool dispatch_tree, 
>> bool owner, bool disabled)
>>  
>>      QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) {
>>          qemu_printf("address-space: %s\n", as->name);
>> -        mtree_print_mr(as->root, 1, 0, &ml_head, owner, disabled);
>> +        mtree_print_mr(as->root, 1, 0, as->root->addr,
> 
> Root MR of any address space should have mr->addr==0, right?
> 
> I'm slightly confused on what this patch wanted to do if so, since then "base"
> will always be zero..  Or am I wrong?

That is what I am expecting too... Maybe the problem is elsewhere
when I create the address space... The simpler way to
figure it out is add an assertion. I haven't figure out my
issue yet, I'll follow up later with a proof-of-concept series
which triggers the assertion.

FYI I also have to modify:

-- >8 --
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index e19bc9f1c19..41a77e15752 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -2889,7 +2889,7 @@ MemTxResult address_space_read_full(AddressSpace
*as, hwaddr addr,
     if (len > 0) {
         RCU_READ_LOCK_GUARD();
         fv = address_space_to_flatview(as);
-        result = flatview_read(fv, addr, attrs, buf, len);
+        result = flatview_read(fv, as->root->addr + addr, attrs, buf, len);
     }

     return result;
@@ -2905,7 +2905,7 @@ MemTxResult address_space_write(AddressSpace *as,
hwaddr addr,
     if (len > 0) {
         RCU_READ_LOCK_GUARD();
         fv = address_space_to_flatview(as);
-        result = flatview_write(fv, addr, attrs, buf, len);
+        result = flatview_write(fv, as->root->addr + addr, attrs, buf,
len);
     }

     return result;
@@ -3117,7 +3117,8 @@ bool address_space_access_valid(AddressSpace *as,
hwaddr addr,

     RCU_READ_LOCK_GUARD();
     fv = address_space_to_flatview(as);
-    result = flatview_access_valid(fv, addr, len, is_write, attrs);
+    result = flatview_access_valid(fv, as->root->addr + addr, len,
+                                   is_write, attrs);
     return result;
 }
---

Reply via email to