From nobody Wed Nov 27 11:37:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1699284911; cv=none; d=zohomail.com; s=zohoarc; b=cCISN3WdVTI94QLqFURF0DFl7nzhpsmYhx5dfP2vThkO6hqYzyGqMmP/wKIpuxGN9p3O5vF/dOPVVF0OB9BnVHUei5US0/B1r8n3B/fHAG7YVhPNfqknaPNMqc0gfQVc20gEQxg5bko2MxYKmASLYSecE2lnPwG4yFnauVgAg9E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1699284911; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=813QsleyMqyhS0dbJ++cZmaNQq8ezRMtCTKDgM9WCS0=; b=lsDKaksz60/qrV5Hvqr7lueSaIOI5anDOSgVFRZehLUDuJa52SsQGVPUYuuvSFUyBT+X7qyMnJhmrHs0euZYRZZZyMznOR92xLPDMF1bbTKS2/V8cMw/XLdCfZipnQoh+SumFmKw9hkct0c9P4j2vP7PJ9Zlvi9VaRq057iUX3k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1699284911862251.3127323781415; Mon, 6 Nov 2023 07:35:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r01b6-0008L3-1L; Mon, 06 Nov 2023 10:33:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r01aw-00082Q-Pd for qemu-devel@nongnu.org; Mon, 06 Nov 2023 10:32:57 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r01ao-0004Oa-Ka for qemu-devel@nongnu.org; Mon, 06 Nov 2023 10:32:53 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-32f87b1c725so3257980f8f.3 for ; Mon, 06 Nov 2023 07:32:45 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d5-20020adff2c5000000b0032da6f17ffdsm9752176wrp.38.2023.11.06.07.32.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 07:32:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699284765; x=1699889565; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=813QsleyMqyhS0dbJ++cZmaNQq8ezRMtCTKDgM9WCS0=; b=v1mEVIvUTJfMi/gBhbyuiQjp+iLFCr4T4CA50SmS5k/YNC4i/D4YzQAX/MN5pTi3HZ So+GyChJtjOjZUDHARF8T2RWqK99yQJ1Wpz/tQWJfpAHjvyeGVQEXO6a5X3KcrmOO6cw Cyb0ZKYL5pixyP78oEmANMwB4qtKODie+F58Q5KRwrKms7wOrdE3NsDodkfSB3f/O9o7 l1cVO3GAwYRy+18I7vyY9BvSBH4HkADaLd1xJk8TLJ1XpSUsEbObCDIdPnypSfgMbReV x8jC8pYyFcD0f5Ws4YuhCMZPUUq5WN8P81KrVuIBJjuztlZAHZxmLIaWsOuBsuGjpBor VkXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699284765; x=1699889565; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=813QsleyMqyhS0dbJ++cZmaNQq8ezRMtCTKDgM9WCS0=; b=LU6VlwZXUQwhZu6a06+U6a58cdI9KOCMVDGJtxqsfLHBrM3MBVmJ14fMg+jv1ZTaEy a59J+Dr2y2tOTCKNqJk4amvRWqfrHxV9+nXKS6tsPqbqLm07X5rcoBfLIQQYpumAVegm zxn8HBi8bQ9d7LscZkrUhcHbbrG5GJDv3aKQe6DX0nLrr8RKyfhqb91HCCOzU18q/dZS Q8+GkuYggFemg+Ay3mN/vetrc9AuNYJW0twcZhltVnXKRIEUjwVVkKuSMzmJV6kLruDv jjznBZRq255OfB7duGxdQXhCeMAwkwe829KScvRw2hBeYa/iVAUQqxi+hsNO1EQ/rwfx 0kPg== X-Gm-Message-State: AOJu0YyElP4OTMvB/y3qDhr7sIfyPYTjqwo29WDzDQaGQH5c+RF4ZfjC 8EMONbz14DHswW3kmCVGE4B1Q5wFFzhmFST64pY= X-Google-Smtp-Source: AGHT+IFOyQDOFZtMqNAqYumZY2BuHp8KU7WT35Hg+Pps/dDbKSM21RAhTTMM0npRRblQcfyB42t5Dg== X-Received: by 2002:adf:d1c9:0:b0:32d:8505:b9d7 with SMTP id b9-20020adfd1c9000000b0032d8505b9d7mr24715508wrd.43.1699284764920; Mon, 06 Nov 2023 07:32:44 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/12] hw/arm/vexpress-a9: Remove useless mapping of RAM at address 0 Date: Mon, 6 Nov 2023 15:32:37 +0000 Message-Id: <20231106153238.1426649-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231106153238.1426649-1-peter.maydell@linaro.org> References: <20231106153238.1426649-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1699284912969100003 On the vexpress-a9 board we try to map both RAM and flash to address 0, as seen in "info mtree": address-space: memory 0000000000000000-ffffffffffffffff (prio 0, i/o): system 0000000000000000-0000000003ffffff (prio 0, romd): alias vexpress.flasha= lias @vexpress.flash0 0000000000000000-0000000003ffffff 0000000000000000-0000000003ffffff (prio 0, ram): alias vexpress.lowmem = @vexpress.highmem 0000000000000000-0000000003ffffff 0000000010000000-0000000010000fff (prio 0, i/o): arm-sysctl 0000000010004000-0000000010004fff (prio 0, i/o): pl041 (etc) The flash "wins" and the RAM mapping is useless (but also harmless). This happened as a result of commit 6ec1588e in 2014, which changed "we always map the RAM to the low addresses for vexpress-a9" to "we always map flash in the low addresses", but forgot to stop mapping the RAM. In real hardware, this low part of memory is remappable, both at runtime by the guest writing to a control register, and configurably as to what you get out of reset -- you can have the first flash device, or the second, or the DDR2 RAM, or the external AXI bus (which for QEMU means "nothing there"). In an ideal world we would support that remapping both at runtime and via a machine property to select the out-of-reset behaviour. Pending anybody caring enough to implement the full remapping behaviour: * remove the useless mapped-but-inaccessible lowram MR * document that QEMU doesn't support remapping of low memory Fixes: 6ec1588e ("hw/arm/vexpress: Alias NOR flash at 0 for vexpress-a9") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1761 Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-id: 20231103185602.875849-1-peter.maydell@linaro.org --- docs/system/arm/vexpress.rst | 3 +++ hw/arm/vexpress.c | 14 +++----------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/docs/system/arm/vexpress.rst b/docs/system/arm/vexpress.rst index 3e3839e9231..38f29c73e71 100644 --- a/docs/system/arm/vexpress.rst +++ b/docs/system/arm/vexpress.rst @@ -58,6 +58,9 @@ Other differences between the hardware and the QEMU model: ``vexpress-a15``, and have IRQs from 40 upwards. If a dtb is provided on the command line then QEMU will edit it to include suitable entries describing these transports for the guest. +- QEMU does not currently support either dynamic or static remapping + of the area of memory at address 0: it is always mapped to alias + the first flash bank =20 Booting a Linux kernel ---------------------- diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index 8ff37f52ca1..c08ea34e924 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -177,7 +177,6 @@ struct VexpressMachineState { MemoryRegion vram; MemoryRegion sram; MemoryRegion flashalias; - MemoryRegion lowram; MemoryRegion a15sram; bool secure; bool virt; @@ -276,7 +275,6 @@ static void a9_daughterboard_init(VexpressMachineState = *vms, { MachineState *machine =3D MACHINE(vms); MemoryRegion *sysmem =3D get_system_memory(); - ram_addr_t low_ram_size; =20 if (ram_size > 0x40000000) { /* 1GB is the maximum the address space permits */ @@ -284,17 +282,11 @@ static void a9_daughterboard_init(VexpressMachineStat= e *vms, exit(1); } =20 - low_ram_size =3D ram_size; - if (low_ram_size > 0x4000000) { - low_ram_size =3D 0x4000000; - } - /* RAM is from 0x60000000 upwards. The bottom 64MB of the + /* + * RAM is from 0x60000000 upwards. The bottom 64MB of the * address space should in theory be remappable to various - * things including ROM or RAM; we always map the RAM there. + * things including ROM or RAM; we always map the flash there. */ - memory_region_init_alias(&vms->lowram, NULL, "vexpress.lowmem", - machine->ram, 0, low_ram_size); - memory_region_add_subregion(sysmem, 0x0, &vms->lowram); memory_region_add_subregion(sysmem, 0x60000000, machine->ram); =20 /* 0x1e000000 A9MPCore (SCU) private memory region */ --=20 2.34.1