From nobody Tue Feb 10 05:46:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.42 as permitted sender) client-ip=209.85.128.42; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f42.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.42 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1615573762; cv=none; d=zohomail.com; s=zohoarc; b=McKZsNkIPpR9t2cOODAvry6mIOvKVCoHjQUHuQFKInsI5+3LVARRPy6ZSNCoKR4iQBuzS5kGqQp0snJg7zbwQ1KrUjgeC3UCs7vaaueaVrxVmu/pPwLn8cnLkfx2AqicEBwX8Wn3DUU0ooYH3uRJC9FbtUiUVay3A85hyCcJDvM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615573762; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7eAW6nzndJ8SRLf0zYMWILankRA6VcV8J/YafiY9oXc=; b=OI1RX++DqzSeCmj4Qjr0DUSdug3DoJ8Xyq00OW/TZzr/erEtO2o3d3HJspwEZKFL+Y1pef9vaBYVj84vsN1nSfRLqakT2UMxQXW1k9rjmnCDntKSd+bGH7IXkSqo2kIgcnI3GhQqcKNyM//FKpULbPVqfwqz4zYEmZILo9tmj/g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.42 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by mx.zohomail.com with SMTPS id 16155737622911008.8569941145056; Fri, 12 Mar 2021 10:29:22 -0800 (PST) Received: by mail-wm1-f42.google.com with SMTP id y124-20020a1c32820000b029010c93864955so16365799wmy.5 for ; Fri, 12 Mar 2021 10:29:21 -0800 (PST) Return-Path: Return-Path: Received: from localhost.localdomain (17.red-88-21-201.staticip.rima-tde.net. [88.21.201.17]) by smtp.gmail.com with ESMTPSA id p14sm2968968wmc.30.2021.03.12.10.29.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Mar 2021 10:29:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7eAW6nzndJ8SRLf0zYMWILankRA6VcV8J/YafiY9oXc=; b=FI6l6XSJzAjCcMe7tv4CLouB+9PJdZqR0BUgFK+y7dF/knVZRKZCVtWZCXlCSXAbLK nBqQYZ2PPNWvIydrKFVEJAhCHB2djN6EpsdKjYf69NTyXcipOhV58PFrUkVSJs2G/jZB Bfrto53rudP4ooShM7hIxSPxuQTsImq7Wq11YfRWhy5VIQNiMIotDDqzcJb8n2lxapPW rXMhgUPqqfbT03pCtc+TwfnETgT5s0ZZuRVcZn+hbewT8ryoXTudb3Lm4Ox9XMixMrd3 f06eYAk+ylIAgv6M4Hmc3j/6cYLwlgYorL0Pw+nxxSacTV7CqdKgFeJRlL+gpJf7o6i/ eF8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=7eAW6nzndJ8SRLf0zYMWILankRA6VcV8J/YafiY9oXc=; b=leNoBX+ZVuub39bH4HOf+PczPVQTChxCF6gJ+cw9p9JZCBRZOvWGM31jPMRyNSy18n a67YMsaYQbXnEKuF3diP+78zAbHxik0eA90CpWl2zQXbCki7F1ZwJFxcDNINgOFRJMJM ZWvobFpuXIbD4U6VnStHI8BzgU/y3nIea8Q+Kodyv5NoSttmTZPPTKWBnyA3EB/6YK7X +8OG2fJeScZhm80lWQMFPAArrwG4GYNVXDosSjPkmNLlB91E6+PsGq4vwkMg/SHIE+iN da90lmS+Z3QwZ7thtTBfABfQigpHAFvoxmlLSpPSDL8GQWT3+0dE4YbuzJjEDgk0JU/1 X2aA== X-Gm-Message-State: AOAM5339pxpsZYJnjpUb5VC3yj3iPRUN7qhrqGR2vtFsZmWFzxTWrwVP LlpZQzGmtxiHg/LTsX+kTy8= X-Google-Smtp-Source: ABdhPJxtD4Q5mbcqFrFpTUAWmhr5KZnz9Cjo4IvOjeui6TuYcoX2s5UfUcgNaP7LHMxtNG9ha6vrCg== X-Received: by 2002:a1c:67d6:: with SMTP id b205mr14538656wmc.118.1615573760597; Fri, 12 Mar 2021 10:29:20 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Greg Kurz , qemu-arm@nongnu.org, Peter Xu , Andrew Jeffery , Alistair Francis , Joel Stanley , Paolo Bonzini , qemu-ppc@nongnu.org, David Gibson , Peter Maydell Subject: [PATCH 5/5] memory: Make sure root MR won't be added as subregion Date: Fri, 12 Mar 2021 19:28:51 +0100 Message-Id: <20210312182851.1922972-6-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210312182851.1922972-1-f4bug@amsat.org> References: <20210312182851.1922972-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Content-Type: text/plain; charset="utf-8" From: Peter Xu Add a bool for MR to mark whether this MR is a root MR of an AS. We bail o= ut asap if this MR is added as a subregion of another MR. Signed-off-by: Peter Xu --- 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 54ccf1a5f09..8137ad3a9f6 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 9db47b7db6b..ce322ff3d6e 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -2442,6 +2442,7 @@ static void memory_region_add_subregion_common(Memory= Region *mr, MemoryRegion *subregion) { assert(!subregion->container); + assert(!subregion->is_root_mr); subregion->container =3D mr; subregion->addr =3D offset; memory_region_update_container_subregions(subregion); @@ -2819,6 +2820,7 @@ void address_space_init(AddressSpace *as, MemoryRegio= n *root, const char *name) { memory_region_ref(root); as->root =3D root; + root->is_root_mr =3D true; as->current_map =3D NULL; as->ioeventfd_nb =3D 0; as->ioeventfds =3D NULL; --=20 2.26.2