Patchwork [v3] memory-region: Report if region is read-only or write-only on info mtree

login
register
mail settings
Submitter Jan Kiszka
Date Feb. 4, 2012, 3:25 p.m.
Message ID <4F2D4DF6.4090502@web.de>
Download mbox | patch
Permalink /patch/139582/
State New
Headers show

Comments

Jan Kiszka - Feb. 4, 2012, 3:25 p.m.
From: Jan Kiszka <jan.kiszka@siemens.com>

Helpful to understand guest configurations of things like the i440FX's
PAM or the state of ROM devices.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

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(-)
Blue Swirl - Feb. 11, 2012, 11:09 a.m.
Thanks, applied.

On Sat, Feb 4, 2012 at 15:25, Jan Kiszka <jan.kiszka@web.de> wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> Helpful to understand guest configurations of things like the i440FX's
> PAM or the state of ROM devices.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>
> 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(-)
>
> diff --git a/memory.c b/memory.c
> index 5e77d8a..22816e2 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -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

Patch

diff --git a/memory.c b/memory.c
index 5e77d8a..22816e2 100644
--- a/memory.c
+++ b/memory.c
@@ -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);
     }