qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
	"Andrew Jeffery" <andrew@aj.id.au>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	qemu-devel@nongnu.org, "Laurent Vivier" <laurent@vivier.eu>,
	"Alexander Bulekov" <alxndr@bu.edu>,
	"Hervé Poussineau" <hpoussin@reactos.org>,
	"Cédric Le Goater" <clg@kaod.org>,
	"Edgar E . Iglesias" <edgar.iglesias@gmail.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	"Joel Stanley" <joel@jms.id.au>
Subject: Re: [PATCH 1/2] hw/mips/jazz: Use generic I/O bus via get_system_io()
Date: Thu, 11 Mar 2021 12:27:44 -0500	[thread overview]
Message-ID: <20210311172744.GI194839@xz-x1> (raw)
In-Reply-To: <a64ff8f0-5db1-c338-b99b-7a74a150a770@amsat.org>

[-- Attachment #1: Type: text/plain, Size: 760 bytes --]

On Thu, Mar 11, 2021 at 05:21:49PM +0100, Philippe Mathieu-Daudé wrote:
> So using:
> 
> -- >8 --
> diff --git a/softmmu/memory.c b/softmmu/memory.c
> index 874a8fccdee..8ce2d7f83b9 100644
> --- a/softmmu/memory.c
> +++ b/softmmu/memory.c
> @@ -713,6 +713,12 @@ static MemoryRegion
> *memory_region_get_flatview_root(MemoryRegion *mr)
>                  continue;
>              }
>          }
> +        if (mr && mr->addr) {
> +            error_report("Detected flatview root memory region '%s' with"
> +                         " non-zero base address (0x%"HWADDR_PRIx"):
> aborting",
> +                         memory_region_name(mr), mr->addr);
> +            abort();
> +        }
> 
>          return mr;
>      }

(Attaching again...)

-- 
Peter Xu

[-- Attachment #2: 0001-memory-Make-sure-root-MR-won-t-be-added-as-subregion.patch --]
[-- Type: text/plain, Size: 1658 bytes --]

From 4fe7614f2087117aa912fd3d33d43ba02f2b50b1 Mon Sep 17 00:00:00 2001
From: Peter Xu <peterx@redhat.com>
Date: Thu, 11 Mar 2021 11:40:21 -0500
Subject: [PATCH] memory: Make sure root MR won't be added as subregion

Add a bool for MR to mark whether this MR is a root MR of an AS.  We bail out
asap if this MR is added as a subregion of another MR.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 include/exec/memory.h | 1 +
 softmmu/memory.c      | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/include/exec/memory.h b/include/exec/memory.h
index c6fb714e499..211f10e877e 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -477,6 +477,7 @@ struct MemoryRegion {
     bool ram_device;
     bool enabled;
     bool warning_printed; /* For reservations */
+    bool is_root_mr;
     uint8_t vga_logging_count;
     MemoryRegion *alias;
     hwaddr alias_offset;
diff --git a/softmmu/memory.c b/softmmu/memory.c
index 874a8fccdee..aebaa956258 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -2442,6 +2442,7 @@ static void memory_region_add_subregion_common(MemoryRegion *mr,
                                                MemoryRegion *subregion)
 {
     assert(!subregion->container);
+    assert(!subregion->is_root_mr);
     subregion->container = mr;
     subregion->addr = offset;
     memory_region_update_container_subregions(subregion);
@@ -2819,6 +2820,7 @@ void address_space_init(AddressSpace *as, MemoryRegion *root, const char *name)
 {
     memory_region_ref(root);
     as->root = root;
+    root->is_root_mr = true;
     as->current_map = NULL;
     as->ioeventfd_nb = 0;
     as->ioeventfds = NULL;
-- 
2.26.2


  parent reply	other threads:[~2021-03-11 17:34 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05 23:54 [PATCH 0/3] memory: Display AddressSpace zero-based in 'info mtree' Philippe Mathieu-Daudé
2021-03-05 23:54 ` [PATCH 1/3] memory: Better name 'offset' argument in mtree_print_mr() Philippe Mathieu-Daudé
2021-03-05 23:54 ` [PATCH 2/3] memory: Provide 'base address' argument to mtree_print_mr() Philippe Mathieu-Daudé
2021-03-08 23:40   ` Peter Xu
2021-03-09  9:39     ` Philippe Mathieu-Daudé
2021-03-09 21:54       ` Philippe Mathieu-Daudé
2021-03-10 17:06         ` Peter Xu
2021-03-10 19:09           ` Philippe Mathieu-Daudé
2021-03-10 19:12             ` [PATCH 1/2] hw/mips/jazz: Use generic I/O bus via get_system_io() Philippe Mathieu-Daudé
2021-03-10 19:12               ` [PATCH 2/2] NOTFORMERGE memory: Ensure AddressSpace physical base address is zero Philippe Mathieu-Daudé
2021-03-10 19:49               ` [PATCH 1/2] hw/mips/jazz: Use generic I/O bus via get_system_io() Peter Xu
2021-03-10 20:11                 ` Philippe Mathieu-Daudé
2021-03-10 20:29                   ` Peter Xu
2021-03-11 12:18                     ` Philippe Mathieu-Daudé
2021-03-11 16:21                       ` Philippe Mathieu-Daudé
2021-03-11 17:27                         ` Peter Xu
2021-03-11 17:59                           ` Philippe Mathieu-Daudé
2021-03-12  9:08                           ` Cédric Le Goater
2021-03-11 17:27                         ` Peter Xu [this message]
2021-03-11 17:41                         ` Philippe Mathieu-Daudé
2021-03-11  0:48               ` Jiaxun Yang
2021-03-10 19:31             ` [PATCH 2/3] memory: Provide 'base address' argument to mtree_print_mr() Peter Xu
2021-03-10 22:00         ` Mark Cave-Ayland
2021-03-05 23:54 ` [PATCH 3/3] memory: Make memory_region_to_absolute_addr() take a const MemoryRegion Philippe Mathieu-Daudé
2021-03-11 12:19   ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210311172744.GI194839@xz-x1 \
    --to=peterx@redhat.com \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=alxndr@bu.edu \
    --cc=andrew@aj.id.au \
    --cc=aurelien@aurel32.net \
    --cc=clg@kaod.org \
    --cc=edgar.iglesias@gmail.com \
    --cc=f4bug@amsat.org \
    --cc=hpoussin@reactos.org \
    --cc=joel@jms.id.au \
    --cc=laurent@vivier.eu \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).