From patchwork Fri Jun 7 20:42:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 802346 Delivered-To: patch@linaro.org Received: by 2002:adf:f147:0:b0:35b:5a80:51b4 with SMTP id y7csp985947wro; Fri, 7 Jun 2024 13:43:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVJ4GpNhRy0Zu7IVpn0fTLL4INp8T5Dyfk8wixW0n2/m+RI9+9OXDkE9c8yWJn97NgMt4D65tCcQciIe8VyUE0s X-Google-Smtp-Source: AGHT+IGIPFkX7dB5n/g/1e3oCwNq70+Us/w83lfAMtn9AtcJ5rbpA6WTs0yfKGh8kPaFRsWAqPuN X-Received: by 2002:ac2:5610:0:b0:52b:bad2:b198 with SMTP id 2adb3069b0e04-52bbad2b29amr2180757e87.4.1717793010232; Fri, 07 Jun 2024 13:43:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717793010; cv=none; d=google.com; s=arc-20160816; b=h+7l02hUnHO9fzmJzsVcqB+NnTwk9Fs1NYcv7224WC0yS0oKeHk8OqdegYyPJCYIoM 5HhHiWvq9B3Ts4FgiTmEuyMuBqxuXBFioKVIWowni09D4NYMXvGaTj3LHgSICw6AJc34 DJxrTK8Y/nlhmHDAOIL7gmwQv7/fu/stLaYGGzGbhm716FErPYCZGBSdmuQC40SzGmiK EQv4t9XtT8XDecyYNR06q7LT7oj2SW/u4JQKTv3i/PlAPCFVPcB3yGCZU0y5ZrJUR+yj 1Ftu5RMyZGeYHjR+pIgnVSbsPv2s67NkrRgF+xvwXlbYtuB4h4zn4r+DUm29UAoB2lw8 gTNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=VFG4WdYnJXL1HIRac9zQBh+jJKA5eSiwDUsq05zXZ3I=; fh=WDxzchFVPLqtzRERkjLU8vs10HuwYjuragoetZvLqy0=; b=PU8GR22XjQhRY3qwx1PyT/M7i/HjBl2kLrDzzXhrz2HtRoSQmDmcJuX/xiJ4dX3D38 AWrqLvaxBxPJE2rB/6Uc9ixbmr3gWyMl61+wEdNf8sEYZijCwP2WwRw/pqICkNtyZ9Ag 6xkqdK/SiwxFxy/9xGuClwoysnO/MZqS56PbRAgMLAv32xLdGg9lJx5T6Tozl/Yg1X/N GIT8BveQJXo0ukkxrXg0EggY8QW5Gefb59XkenhfPfqo5QQwPcMzbknZYSraK0WmOipw 1EYbY68E2iq9zAjfmeiRvYU6UH3HifkTMeKVmYGKGa2qy37d11oi1UYRn959o3blVDJp pMkg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NVH+bqo0; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-a6c80727f83si215830266b.789.2024.06.07.13.43.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 13:43:30 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NVH+bqo0; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5C021884C6; Fri, 7 Jun 2024 22:43:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="NVH+bqo0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E6805884C5; Fri, 7 Jun 2024 22:43:00 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EFEB087F8C for ; Fri, 7 Jun 2024 22:42:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a68c5524086so297638066b.3 for ; Fri, 07 Jun 2024 13:42:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717792978; x=1718397778; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=VFG4WdYnJXL1HIRac9zQBh+jJKA5eSiwDUsq05zXZ3I=; b=NVH+bqo07ThD0ahpFr52lvc+LTAYVe/ykoMDVS7mwwcvn4fOLqQXdxkAtRP5SzOdDs Rs4x/iLfy+URz8oedVqth5wkZRSLnmrgeDwlskDSK4TWSXH0JaARmU1jLl5LEkVFjDaF VOm6l3t/ahICp+33Rbc5TT2Rn1Su3N8488Re80NL2OVyes7AbxG3whx3pUeGgWa2BG+z zvLSS+P6fICFzW3K9E2hOHKpP7I/aDFp+1pHlU+2OeFSckBweLrP0GfE0sOBP2J98hg2 U+DcJ4rsCcxENlN67S0yykYaxQ5zYcm+9j8eXiDDBfcT0XnrI8jBj5XKtiDtCUGU+ymo SSrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717792978; x=1718397778; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VFG4WdYnJXL1HIRac9zQBh+jJKA5eSiwDUsq05zXZ3I=; b=JIBJLCNzmOkbhSLOeLnJJiQIYGurQjWerdcg9sKtP9k8SiHIi72pzyKbc+N5YGKgx5 BDfT33LFAvYw4HODJpaeVwDWoRHDJZ8YzX5v+0IU2T9uihGbBD6YXg74ynyIBUCXgw4I PL5wr3KmmV5oovoFmr3d0Ivpcy7d9Tp2xPIQgkCrWllgGqEVdK87gcDbxIW7IRgC3uY5 HBapTE1MCc9ncqpvUps+7NtaExrcblsSEvVdewGNwiUGpmpBgBtDA1OIioFBNGTf9YQi 2Ts3jl1/nnDBq+8+DVW6u9wVQ/nski+k4wGi6zuaxxjDo5r/aUNMqPtOfBqM6dOrPTey O9Jw== X-Forwarded-Encrypted: i=1; AJvYcCVFp1amNKVo0glhK6cFfF39RQZKg3frYqTBjrjlUAAp8e/xOlKIQNlz3/x4IvLgNzlVO05pb1Ir+DwLgG5H3xCWVHCrRA== X-Gm-Message-State: AOJu0YwCykFIEJRd305x0Mt8/D9Ukk7iph+Z5CwsClNUwtS1H9LWg60H VozbdiDdskIdzhx4RvFvROAOK2hsbIeDu7UOpp7RyW2kTOYkOObzlsH4lRXmIxv/bOkrSFyVyNh KfBk= X-Received: by 2002:a17:906:d8bc:b0:a6e:f8d6:17e2 with SMTP id a640c23a62f3a-a6ef8d62328mr54442366b.40.1717792978445; Fri, 07 Jun 2024 13:42:58 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::8090]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6c80588851sm300766966b.29.2024.06.07.13.42.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 13:42:57 -0700 (PDT) From: Caleb Connolly Date: Fri, 07 Jun 2024 22:42:51 +0200 Subject: [PATCH v2 3/3] doc: arch: arm64: describe pagetable debugging MIME-Version: 1.0 Message-Id: <20240607-caleb-upstreaming-v2-3-bae407f51f22@linaro.org> References: <20240607-caleb-upstreaming-v2-0-bae407f51f22@linaro.org> In-Reply-To: <20240607-caleb-upstreaming-v2-0-bae407f51f22@linaro.org> To: Tom Rini Cc: Michal Simek , Ilias Apalodimas , Neil Armstrong , u-boot@lists.denx.de, Caleb Connolly X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2437; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=MTi4eb3QnNK3dMRRUrL76HdHjW1mfzW7AiL6LzWeZKg=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmY3DN6v4y/j4pAc7EZtiXICHxkTcTRzjmGysbG bov6sNmewqJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZmNwzQAKCRAFgzErGV9k trLpD/9xSY5gwpZqszdEVW10K3btClJ5kXysUZxDvK7QBFcOsnf3DLb48vddNW6VQztjgM2P/Cd BSYcTHmtYyuQsFR3txlADGfwIMZezdWGfvg/CqbthdaAGIA1zFV0dQpetdBrhBWmDYNEzDYFHN6 sB3+0J4orYsHLJkeBvR/LktAlkJbQoJf7ShoJLvH7N2Rwevhh8QPL4NnNJo2y1sto4LHT6zufbR o/3xfUU0jgw4Nj7BlNOqcShPvECPjc8iJY5Vu9dAYAnp0Vxko/Ld6A/RoinGs0pDcjiUu4LxO5T jSY0SjVDsqFZXgMBX7xD3+PfUnVjNzjzKmWqA0/6n9DtSk32IsJGfDD1zkgpBI7Ncxv3txPEVkR 8Ris2BgrD4ChgZk+b2ZKbNECT3AuQofSqDu4Vl52LPrIMmDCzCkk2Y3WCmDkNcyWVOKrNkLIzIn PQVxdcFVuY3LPNrHL07Ua3cjsSE4hWJEoBNIDQewyGpjXGfQlIM5Bwu1fWhx/HLNTserM4bBDMd i3288IU+cmD0YUgIKJy2Ml5Tbam/N2El7bj5dkitRujEEUk49tMdeooplljG2ForPiDRdJ7vjGi +q3gOjS3bBWniws5Y8QrO5nAsD8NDRMyWoVOg6Q5rhMPk2WwqRfvERfMsOuN7+4BIQTBP6QVdX9 iddAtgnAnUUlfyQ== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Add some brief documentation on using dump_pagetables() to print out U-Boot's pagetables during boot. Signed-off-by: Caleb Connolly --- doc/arch/arm64.rst | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/doc/arch/arm64.rst b/doc/arch/arm64.rst index 7c0713504c47..0c851304aad4 100644 --- a/doc/arch/arm64.rst +++ b/doc/arch/arm64.rst @@ -47,8 +47,45 @@ Notes 6. CONFIG_ARM64 instead of CONFIG_ARMV8 is used to distinguish aarch64 and aarch32 specific codes. +MMU +--- + +U-Boot uses a simple page table for MMU setup. It uses the smallest number of bits +possible for the virtual address based on the maximum memory address (see the logic +in ``get_tcr()``). + +As with all platforms, U-Boot on ARM64 uses a 1:1 mapping of virtual to physical addresses. +In general, the memory map is expected to remain static once the MMU is enabled. + +It is possible to debug the pagetable generated by U-Boot with the built in +``dump_pagetable()`` and ``walk_pagetable()`` functions (the former being a simple +wrapper for the latter). For example the following can be added to ``setup_all_pgtables()`` +after the first call to ``setup_pgtables()``: + +.. code-block:: c + + dump_pagetable(gd->arch.tlb_addr, get_tcr(NULL, NULL)); + +This will result in a print like the following: + +.. code-block:: text + + Walking pagetable at 000000017df90000, va_bits: 36. Using 3 levels + [0x17df91000] | Table | | + [0x17df92000] | Table | | + [0x000001000 - 0x000200000] | Pages | Device-nGnRnE | Non-shareable + [0x000200000 - 0x040000000] | Block | Device-nGnRnE | Non-shareable + [0x040000000 - 0x080000000] | Block | Device-nGnRnE | Non-shareable + [0x080000000 - 0x140000000] | Block | Normal | Inner-shareable + [0x17df93000] | Table | | + [0x140000000 - 0x17de00000] | Block | Normal | Inner-shareable + [0x17df94000] | Table | | + [0x17de00000 - 0x17dfa0000] | Pages | Normal | Inner-shareable + +For more information, please refer to the function documentation in +``arch/arm/include/asm/armv8/mmu.h``. Contributors ------------ * Tom Rini