memory-region: Report if region is read-only on info mtree
PATCH 1/1 memory-region: Report if region is read-only on info mtree
Helpful to understand guest configurations of things like the i440FX's PAM.
--- memory.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
memory.c +4 -2
@@ -1608,23 +1608,25 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f, ml->printed = false;QTAILQ_INSERT_TAIL (alias_print_queue, ml, queue); } -mon_printf (f, TARGET_FMT_plx"-" TARGET_FMT_plx" (prio %d): alias %s @%s " +mon_printf (f, TARGET_FMT_plx"-" TARGET_FMT_plx" (prio %d, %s): alias %s @%s " TARGET_FMT_plx"-" TARGET_FMT_plx"\n" , base + mr->addr, base + mr->addr + (target_phys_addr_t )int128_get64 (mr->size) -1 , mr->priority, + mr->readonly ?"RO" :"RW" , mr->name, mr->alias->name, mr->alias_offset, mr->alias_offset + (target_phys_addr_t )int128_get64 (mr->size) -1 ); }else { -mon_printf (f, TARGET_FMT_plx"-" TARGET_FMT_plx" (prio %d): %s\n" , +mon_printf (f, TARGET_FMT_plx"-" TARGET_FMT_plx" (prio %d, %s): %s\n" , base + mr->addr, base + mr->addr + (target_phys_addr_t )int128_get64 (mr->size) -1 , mr->priority, + mr->readonly ?"RO" :"RW" , mr->name); }
Signature · 1 line
1.7.3.4
Quoted 20 lines · Jan Kiszka
Helpful to understand guest configurations of things like the i440FX's PAM.
Signed-off-by Jan Kiszka <[email protected]>---
memory.c | 6 ++++--1 files changed, 4 insertions(+), 2 deletions(-)memory.c +1
-1@@ -1608,23 +1608,25 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f, ml->printed = false; QTAILQ_INSERT_TAIL(alias_print_queue, ml, queue); } - mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d): alias %s @%s " + mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d, %s): alias %s @%s " TARGET_FMT_plx "-" TARGET_FMT_plx "\n", base + mr->addr,
Quoted 4 lines
base +
mr->addr
+ (target_phys_addr_t)int128_get64(mr->size) - 1,mr->priority,
+mr->readonly? "RO" : "RW",
I think the reserved regions which are unreadable and unwritable should be shown as well. Then the output should be a combination of 'R', 'W' or neither ('-').
Quoted 18 lines
mr->name,
mr->alias->name,
mr->alias_offset,
mr->alias_offset
+ (target_phys_addr_t)int128_get64(mr->size) - 1); } else {
- mon_printf(f,TARGET_FMT_plx"-"TARGET_FMT_plx" (prio %d): %s\n",
+ mon_printf(f,TARGET_FMT_plx"-"TARGET_FMT_plx" (prio %d, %s): %s\n", base +mr->addr,
base +mr->addr
+ (target_phys_addr_t)int128_get64(mr->size) - 1,mr->priority,
+mr->readonly? "RO" : "RW",
mr->name);
}--
1.7.3.4
Quoted 21 lines · Blue Swirl
Quoted 20 lines · Jan Kiszka
Helpful to understand guest configurations of things like the i440FX's PAM.
Signed-off-by Jan Kiszka <[email protected]>--- memory.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)memory.c +1
-1@@ -1608,23 +1608,25 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f, ml->printed = false;QTAILQ_INSERT_TAIL (alias_print_queue, ml, queue); } - mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d): alias %s @%s " + mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d, %s): alias %s @%s " TARGET_FMT_plx "-" TARGET_FMT_plx "\n", base + mr->addr,
Quoted 8 lines
memory.c static void mtree_print_mr(fprintf_function mon_printf, void *f, · line 1617
Quoted 4 lines
memory.c +1
-0base + mr->addr + (target_phys_addr_t )int128_get64 (mr->size) -1 , mr->priority, + mr->readonly ? "RO" : "RW",I think the reserved regions which are unreadable and unwritable should be shown as well. Then the output should be a combination of 'R', 'W' or neither ('-').
Reserved regions are in the hand of some other device model (so far only the KVM kernel). That says nothing about their R/W property. If we ever have a reserved region that is not writable, the owner could still set the corresponding flag for documentation purposes.
Jan
Quoted 31 lines · Jan Kiszka
Quoted 21 lines · Blue Swirl
Quoted 20 lines · Jan Kiszka
Helpful to understand guest configurations of things like the i440FX's PAM.
Signed-off-by Jan Kiszka <[email protected]>---
memory.c | 6 ++++--1 files changed, 4 insertions(+), 2 deletions(-)memory.c +1
-1@@ -1608,23 +1608,25 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f, ml->printed = false; QTAILQ_INSERT_TAIL(alias_print_queue, ml, queue); } - mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d): alias %s @%s " + mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d, %s): alias %s @%s " TARGET_FMT_plx "-" TARGET_FMT_plx "\n", base + mr->addr,Quoted 8 lines
Quoted 4 lines
base +
mr->addr
+ (target_phys_addr_t)int128_get64(mr->size) - 1,mr->priority,
+mr->readonly? "RO" : "RW",I think the reserved regions which are unreadable and unwritable should be shown as well. Then the output should be a combination of 'R', 'W' or neither ('-').
Quoted 4 lines
Reserved regions are in the hand of some other device model (so far only the KVM kernel). That says nothing about their R/W property. If we ever have a reserved region that is not writable, the owner could still set the corresponding flag for documentation purposes.
OK. But it's also possible for a region to have readable == false while readonly == false, which would imply 'WO' or '-W'. That also supports separate 'R', 'W' and '-' flags.
Quoted 32 lines · Blue Swirl
Quoted 31 lines · Jan Kiszka
Quoted 29 lines · Blue Swirl
Quoted 14 lines · Jan Kiszka
Helpful to understand guest configurations of things like the i440FX's PAM.
Signed-off-by Jan Kiszka <[email protected]>--- memory.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)memory.c +0
-0@@ -1608,23 +1608,25 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f, ml->printed = false;memory.c static void mtree_print_mr(fprintf_function mon_printf, void *f, · line 1617
Quoted 10 lines
memory.c +2
-1QTAILQ_INSERT_TAIL (alias_print_queue, ml, queue); } - mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d): alias %s @%s " + mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d, %s): alias %s @%s " TARGET_FMT_plx "-" TARGET_FMT_plx "\n", base + mr->addr, base + mr->addr + (target_phys_addr_t)int128_get64(mr->size) - 1, mr->priority, + mr->readonly ? "RO" : "RW",I think the reserved regions which are unreadable and unwritable should be shown as well. Then the output should be a combination of 'R', 'W' or neither ('-').
Quoted 8 lines
Quoted 4 lines
Reserved regions are in the hand of some other device model (so far only the KVM kernel). That says nothing about their R/W property. If we ever have a reserved region that is not writable, the owner could still set the corresponding flag for documentation purposes.
OK. But it's also possible for a region to have readable == false while readonly == false, which would imply 'WO' or '-W'. That also supports separate 'R', 'W' and '-' flags.
Yep, I encoded the ROM device state as well. And this revealed a regression of the memory region conversion of the cfi02. Gave up counting how often I fixed this type of bug in the flash code.
Jan
Quoted 38 lines · Jan Kiszka
Quoted 37 lines · Blue Swirl
Quoted 35 lines · Jan Kiszka
Quoted 21 lines · Blue Swirl
Quoted 20 lines · Jan Kiszka
Helpful to understand guest configurations of things like the i440FX's PAM.
Signed-off-by Jan Kiszka <[email protected]>--- memory.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)memory.c +1
-1@@ -1608,23 +1608,25 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f, ml->printed = false;QTAILQ_INSERT_TAIL (alias_print_queue, ml, queue); } - mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d): alias %s @%s " + mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d, %s): alias %s @%s " TARGET_FMT_plx "-" TARGET_FMT_plx "\n", base + mr->addr,Quoted 8 lines
memory.c static void mtree_print_mr(fprintf_function mon_printf, void *f, · line 1617
Quoted 4 lines
memory.c +1
-0base + mr->addr + (target_phys_addr_t )int128_get64 (mr->size) -1 , mr->priority, + mr->readonly ? "RO" : "RW",I think the reserved regions which are unreadable and unwritable should be shown as well. Then the output should be a combination of 'R', 'W' or neither ('-').
Reserved regions are in the hand of some other device model (so far only the KVM kernel). That says nothing about their R/W property. If we ever have a reserved region that is not writable, the owner could still set the corresponding flag for documentation purposes.
Quoted 7 lines
Quoted 3 lines
OK. But it's also possible for a region to have readable == false while readonly == false, which would imply 'WO' or '-W'. That also supports separate 'R', 'W' and '-' flags.
Yep, I encoded the ROM device state as well. And this revealed a regression of the memory region conversion of the cfi02. Gave up counting how often I fixed this type of bug in the flash code.
Is this patch ready to go? Seems fine to me but do you still want to add the 'WO' output that Blue Swirl suggested?
Stefan
Quoted 43 lines · Stefan Hajnoczi
Quoted 42 lines · Jan Kiszka
Quoted 40 lines · Blue Swirl
Quoted 31 lines · Jan Kiszka
Quoted 21 lines · Blue Swirl
Quoted 20 lines · Jan Kiszka
Helpful to understand guest configurations of things like the i440FX's PAM.
Signed-off-by Jan Kiszka <[email protected]>--- memory.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)memory.c +1
-1@@ -1608,23 +1608,25 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f, ml->printed = false;QTAILQ_INSERT_TAIL (alias_print_queue, ml, queue); } - mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d): alias %s @%s " + mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d, %s): alias %s @%s " TARGET_FMT_plx "-" TARGET_FMT_plx "\n", base + mr->addr,Quoted 8 lines
memory.c static void mtree_print_mr(fprintf_function mon_printf, void *f, · line 1617
Quoted 4 lines
memory.c +1
-0base + mr->addr + (target_phys_addr_t )int128_get64 (mr->size) -1 , mr->priority, + mr->readonly ? "RO" : "RW",I think the reserved regions which are unreadable and unwritable should be shown as well. Then the output should be a combination of 'R', 'W' or neither ('-').
Quoted 4 lines
Reserved regions are in the hand of some other device model (so far only the KVM kernel). That says nothing about their R/W property. If we ever have a reserved region that is not writable, the owner could still set the corresponding flag for documentation purposes.
OK. But it's also possible for a region to have readable == false while readonly == false, which would imply 'WO' or '-W'. That also supports separate 'R', 'W' and '-' flags.
Quoted 6 lines
Quoted 3 lines
Yep, I encoded the ROM device state as well. And this revealed a regression of the memory region conversion of the cfi02. Gave up counting how often I fixed this type of bug in the flash code.
Is this patch ready to go? Seems fine to me but do you still want to add the 'WO' output that Blue Swirl suggested?
There is v2 on the list, but I removed trival from CC due to the discussion. Needs an ack from Blue, I think.
Jan
Quoted 48 lines · Jan Kiszka
Quoted 47 lines · Stefan Hajnoczi
Quoted 45 lines · Jan Kiszka
Quoted 32 lines · Blue Swirl
Quoted 31 lines · Jan Kiszka
Quoted 29 lines · Blue Swirl
Quoted 20 lines · Jan Kiszka
Helpful to understand guest configurations of things like the i440FX's PAM.
Signed-off-by Jan Kiszka <[email protected]>---
memory.c | 6 ++++--1 files changed, 4 insertions(+), 2 deletions(-)memory.c +1
-1@@ -1608,23 +1608,25 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f, ml->printed = false; QTAILQ_INSERT_TAIL(alias_print_queue, ml, queue); } - mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d): alias %s @%s " + mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d, %s): alias %s @%s " TARGET_FMT_plx "-" TARGET_FMT_plx "\n", base + mr->addr,Quoted 4 lines
base +
mr->addr
+ (target_phys_addr_t)int128_get64(mr->size) - 1,mr->priority,
+mr->readonly? "RO" : "RW",I think the reserved regions which are unreadable and unwritable should be shown as well. Then the output should be a combination of 'R', 'W' or neither ('-').
Quoted 8 lines
Quoted 4 lines
Reserved regions are in the hand of some other device model (so far only the KVM kernel). That says nothing about their R/W property. If we ever have a reserved region that is not writable, the owner could still set the corresponding flag for documentation purposes.
OK. But it's also possible for a region to have readable == false while readonly == false, which would imply 'WO' or '-W'. That also supports separate 'R', 'W' and '-' flags.
Yep, I encoded the ROM device state as well. And this revealed a regression of the memory region conversion of the cfi02. Gave up counting how often I fixed this type of bug in the flash code.
Quoted 5 lines
Quoted 2 lines
Is this patch ready to go? Seems fine to me but do you still want to add the 'WO' output that Blue Swirl suggested?
There is v2 on the list, but I removed trival from CC due to the discussion. Needs an ack from Blue, I think.
Okay, I missed it. Thanks for the update!
Stefan
PATCH v2 1/1 memory-region: Report if region is read-only or write-only on info mtree
In reply to Jan KiszkaFrom: Jan Kiszka <[email protected]>
Helpful to understand guest configurations of things like the i440FX's PAM or the state of ROM devices.
---
Changes in v2:
- encode R and W separately
- print ROMD memory region state as well
memory.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-)
memory.c +11 -3
@@ -1609,23 +1609,31 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f, ml->printed = false;QTAILQ_INSERT_TAIL (alias_print_queue, ml, queue); } -mon_printf (f, TARGET_FMT_plx"-" TARGET_FMT_plx" (prio %d): alias %s @%s " - TARGET_FMT_plx"-" TARGET_FMT_plx"\n" , +mon_printf (f, TARGET_FMT_plx"-" TARGET_FMT_plx +" (prio %d, %c%c): alias %s @%s " TARGET_FMT_plx +"-" TARGET_FMT_plx"\n" , base + mr->addr, base + mr->addr + (target_phys_addr_t )int128_get64 (mr->size) -1 , mr->priority, + mr->readable ?'R' :'-' , + !mr->readonly && (!mr->rom_device || !mr->readable) ?'W' + :'-' , mr->name, mr->alias->name, mr->alias_offset, mr->alias_offset + (target_phys_addr_t )int128_get64 (mr->size) -1 ); }else { -mon_printf (f, TARGET_FMT_plx"-" TARGET_FMT_plx" (prio %d): %s\n" , +mon_printf (f, + TARGET_FMT_plx"-" TARGET_FMT_plx" (prio %d, %c%c): %s\n" , base + mr->addr, base + mr->addr + (target_phys_addr_t )int128_get64 (mr->size) -1 , mr->priority, + mr->readable ?'R' :'-' , + !mr->readonly && (!mr->rom_device || !mr->readable) ?'W' + :'-' , mr->name); }
Signature · 1 line
1.7.3.4
Re: [Qemu-devel] [PATCH v2] memory-region: Report if region is read-only or write-only on info mtree
Quoted 29 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
Helpful to understand guest configurations of things like the i440FX's PAM or the state of ROM devices.
Signed-off-by Jan Kiszka <[email protected]>---
Changes in v2:
- encode R and W separately
- print ROMD memory region state as wellmemory.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)memory.c +3
-2@@ -1609,23 +1609,31 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f, ml->printed = false; QTAILQ_INSERT_TAIL(alias_print_queue, ml, queue); } - mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d): alias %s @%s " - TARGET_FMT_plx "-" TARGET_FMT_plx "\n", + mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx + " (prio %d, %c%c): alias %s @%s " TARGET_FMT_plx + "-" TARGET_FMT_plx "\n", base + mr->addr,
Quoted 6 lines
base +
mr->addr
+ (target_phys_addr_t)int128_get64(mr->size) - 1,mr->priority,
+mr->readable? 'R' : '-',
+ !mr->readonly && (!mr->rom_device || !mr->readable) ? 'W'
+ : '-',
Why || !mr->readable? Applying de Morgan, this would equal to !mr->readonly && !(mr->rom_device && mr->readable) or by applying twice, !(mr->readonly || mr->rom_device && mr->readable), neither of which makes much sense.
Quoted 21 lines
mr->name,
mr->alias->name,
mr->alias_offset,
mr->alias_offset
+ (target_phys_addr_t)int128_get64(mr->size) - 1); } else {
- mon_printf(f,TARGET_FMT_plx"-"TARGET_FMT_plx" (prio %d): %s\n",
+ mon_printf(f,
+TARGET_FMT_plx"-"TARGET_FMT_plx" (prio %d, %c%c): %s\n", base +mr->addr,
base +mr->addr
+ (target_phys_addr_t)int128_get64(mr->size) - 1,mr->priority,
+mr->readable? 'R' : '-',
+ !mr->readonly && (!mr->rom_device || !mr->readable) ? 'W'
+ : '-',mr->name);
}--
1.7.3.4
PATCH v3 1/1 memory-region: Report if region is read-only or write-only on info mtree
From: Jan Kiszka <[email protected]>
Helpful to understand guest configurations of things like the i440FX's PAM or the state of ROM devices.
---
Changes in v3:
- refactored writable condition (which DO makes sense as a ROM device is either in ROM or in write mode. It's readable and writable in both modes, but only in special ways. So let's tag it abstractly.)
memory.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-)
memory.c +11 -3
@@ -1609,23 +1609,31 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f, ml->printed = false;QTAILQ_INSERT_TAIL (alias_print_queue, ml, queue); } -mon_printf (f, TARGET_FMT_plx"-" TARGET_FMT_plx" (prio %d): alias %s @%s " - TARGET_FMT_plx"-" TARGET_FMT_plx"\n" , +mon_printf (f, TARGET_FMT_plx"-" TARGET_FMT_plx +" (prio %d, %c%c): alias %s @%s " TARGET_FMT_plx +"-" TARGET_FMT_plx"\n" , base + mr->addr, base + mr->addr + (target_phys_addr_t )int128_get64 (mr->size) -1 , mr->priority, + mr->readable ?'R' :'-' , + !mr->readonly && !(mr->rom_device && mr->readable) ?'W' + :'-' , mr->name, mr->alias->name, mr->alias_offset, mr->alias_offset + (target_phys_addr_t )int128_get64 (mr->size) -1 ); }else { -mon_printf (f, TARGET_FMT_plx"-" TARGET_FMT_plx" (prio %d): %s\n" , +mon_printf (f, + TARGET_FMT_plx"-" TARGET_FMT_plx" (prio %d, %c%c): %s\n" , base + mr->addr, base + mr->addr + (target_phys_addr_t )int128_get64 (mr->size) -1 , mr->priority, + mr->readable ?'R' :'-' , + !mr->readonly && !(mr->rom_device && mr->readable) ?'W' + :'-' , mr->name); }
Signature · 1 line
1.7.3.4
Blue Swirl
AppliedRe: [Qemu-devel] [PATCH v3] memory-region: Report if region is read-only or write-only on info mtree
Thanks, applied.
Quoted 57 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
Helpful to understand guest configurations of things like the i440FX's PAM or the state of ROM devices.
Signed-off-by Jan Kiszka <[email protected]>---
Changes in v3:
- refactored writable condition (which DO makes sense as a ROM device is either in ROM or in write mode. It's readable and writable in both modes, but only in special ways. So let's tag it abstractly.)memory.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)memory.c +3
-2@@ -1609,23 +1609,31 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f, ml->printed = false; QTAILQ_INSERT_TAIL(alias_print_queue, ml, queue); } - mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d): alias %s @%s " - TARGET_FMT_plx "-" TARGET_FMT_plx "\n", + mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx + " (prio %d, %c%c): alias %s @%s " TARGET_FMT_plx + "-" TARGET_FMT_plx "\n", base + mr->addr,base +
mr->addr
+ (target_phys_addr_t)int128_get64(mr->size) - 1,mr->priority,
+mr->readable? 'R' : '-',
+ !mr->readonly && !(mr->rom_device &&mr->readable) ? 'W'
+ : '-',mr->name,
mr->alias->name,
mr->alias_offset,
mr->alias_offset
+ (target_phys_addr_t)int128_get64(mr->size) - 1); } else {
- mon_printf(f,TARGET_FMT_plx"-"TARGET_FMT_plx" (prio %d): %s\n",
+ mon_printf(f,
+TARGET_FMT_plx"-"TARGET_FMT_plx" (prio %d, %c%c): %s\n", base +mr->addr,
base +mr->addr
+ (target_phys_addr_t)int128_get64(mr->size) - 1,mr->priority,
+mr->readable? 'R' : '-',
+ !mr->readonly && !(mr->rom_device &&mr->readable) ? 'W'
+ : '-',mr->name);
}--
1.7.3.4