qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Eduardo Habkost" <ehabkost@redhat.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Peter Xu" <peterx@redhat.com>,
	"Igor Mammedov" <imammedo@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [PATCH v1 1/2] machine: Use host_memory_backend_is_mapped() in machine_consume_memdev()
Date: Mon, 11 Oct 2021 19:45:20 +0200	[thread overview]
Message-ID: <20211011174522.14351-2-david@redhat.com> (raw)
In-Reply-To: <20211011174522.14351-1-david@redhat.com>

memory_region_is_mapped() is the wrong check, we actually want to check
whether the backend is already marked mapped.

For example, memory regions mapped via an alias, such as NVDIMMs,
currently don't make memory_region_is_mapped() return "true". As the
machine is initialized before any memory devices (and thereby before
NVDIMMs are initialized), this isn't a fix but merely a cleanup.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 hw/core/machine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/core/machine.c b/hw/core/machine.c
index b8d95eec32..a1db865939 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -1260,7 +1260,7 @@ MemoryRegion *machine_consume_memdev(MachineState *machine,
 {
     MemoryRegion *ret = host_memory_backend_get_memory(backend);
 
-    if (memory_region_is_mapped(ret)) {
+    if (host_memory_backend_is_mapped(backend)) {
         error_report("memory backend %s can't be used multiple times.",
                      object_get_canonical_path_component(OBJECT(backend)));
         exit(EXIT_FAILURE);
-- 
2.31.1



  reply	other threads:[~2021-10-11 17:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-11 17:45 [PATCH v1 0/2] memory: Update description of memory_region_is_mapped() David Hildenbrand
2021-10-11 17:45 ` David Hildenbrand [this message]
2021-10-11 21:16   ` [PATCH v1 1/2] machine: Use host_memory_backend_is_mapped() in machine_consume_memdev() Richard Henderson
2021-10-12  8:25   ` Igor Mammedov
2021-10-11 17:45 ` [PATCH v1 2/2] memory: Update description of memory_region_is_mapped() David Hildenbrand
2021-10-11 21:21   ` Richard Henderson
2021-10-11 22:17     ` Philippe Mathieu-Daudé
2021-10-12  6:50       ` David Hildenbrand
2021-10-12  8:53         ` Igor Mammedov
2021-10-12  9:28           ` David Hildenbrand
2021-10-12 10:00             ` Igor Mammedov
2021-10-12 10:09               ` David Hildenbrand
2021-10-13  7:14                 ` David Hildenbrand
2021-10-13  9:43                   ` Igor Mammedov

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=20211011174522.14351-2-david@redhat.com \
    --to=david@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=imammedo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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).