From patchwork Thu Jan 30 07:20:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 860845 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp17948wrr; Wed, 29 Jan 2025 23:21:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVg7aO/CmmjnGKuhSo/A7axbs6viEaCLMIZP5Fd5yWF6gcssq5DCMS2A2aSO8/2gzBMpS7f4A==@linaro.org X-Google-Smtp-Source: AGHT+IFrbVDg0E+ugU6dl30zLcnQuQMFp5jKoWzsUhe896y7f434Po3/XVfdhiWCQPncH6omYuni X-Received: by 2002:a17:907:c22:b0:ab6:58e4:4fe7 with SMTP id a640c23a62f3a-ab6e0c25408mr197274066b.11.1738221705908; Wed, 29 Jan 2025 23:21:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738221705; cv=none; d=google.com; s=arc-20240605; b=djaoZrNwvoridPR+J/h3WdIW9oBTuJfG92suz5irIhtlFSl4QJH17ccDDmns+bsHhN 7Q2s8Xm29xdN46WjqBO61FxcBBphwa45Hi/Hg5jeSnvjgnDUmV/5VAuv5+hFXEZa9KXU kPz9B56uXqmHM+/c1mEN37DUiinWjE5+zKi4Nx5CNjAU7HNQN9mNVb0IMMJneq4H2B8B 6T+mVv6qf5VNkx6LEyxZJ2NCCeB3suxOGo48TQlY8M10Y2Ny/IaSzh3CaxuFtZmU0Nn0 Zr0W0jJxe+dUpLa6EMXh0IeqDftaBD9xIhFGMktYrHR8PcN+A+D0pJ9N6dS1bdfOQe9u 9SNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TYut4AQRW/HlcPcpg6ffEWgueoLjAyxY6Wo9r/v5isE=; fh=61aVoFddovrl0Dv7zveEiPhPod8Wx6flbDuFhsEbdtg=; b=LqO28sdo88rYljym6dEXBvNPKRnYhcByGIvE/0ubdqRmXBlNip74W1h34i+F4pjpyZ 6/Ro9mZ7/bQ+eZ5siYJtsua779pAzV0RDzcpHLg33cNyt3G/zlQH3nL9oRZOpZDvY4Gn QJIWr7SgqwYHLmw0TcUQSkeah6fia9h6ilmkxflwns/gSnFPF+ux2gdvCcNq9m1zF+A7 TJd9i9gvTozCVutqs+6SvLxWjVAo+AXMGEWwuZoB6c8Zv/REtw2E/uGnpv10qqgaeJ6W gsWEbUb2XL4ZbvY6KjbP2uVXZCcmOKbxYaUp0VDui6VNXZcYgbbsdxswetpOTwtomyJL wkyg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DyYAkigw; 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; dara=neutral header.i=@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-ab6e4a32436si72131766b.582.2025.01.29.23.21.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2025 23:21:45 -0800 (PST) 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=DyYAkigw; 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; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BF6EA8203B; Thu, 30 Jan 2025 08:21:41 +0100 (CET) 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="DyYAkigw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 431958201E; Thu, 30 Jan 2025 08:21:41 +0100 (CET) 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,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (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 69AA681F0D for ; Thu, 30 Jan 2025 08:21:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-43635796b48so2290205e9.0 for ; Wed, 29 Jan 2025 23:21:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738221699; x=1738826499; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TYut4AQRW/HlcPcpg6ffEWgueoLjAyxY6Wo9r/v5isE=; b=DyYAkigw4+zoT3dLcSVJQt4hGNiWwu7fQCT2wr58VyCDGeRVHNyDlh8u9FAUW84ZFB XLLW/pvisqU2jM/zbVrxzGYJhv+bTyPWctxthDAgQ9l/j5OcHFpS3s99l14oOSbIodFS C3zW5JdhFzRYruUBI0G4p0+IDJq7ot24Ley15natdy9LOS/yY+0YtT5yRuaQU2D/vrQQ vm15Y3zDAOZsK7KWFeAA/ch7/D4tV1mHSe7OUg9AKygBaABBKTTWL/ckw6YgTG4RCVwO W4ccu7DpD8HqTZKkGGT33xj232PEFXmDCFH7vGU+0HKY5aERjGlT9DLIGTRutcfIxORM 0yzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738221699; x=1738826499; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TYut4AQRW/HlcPcpg6ffEWgueoLjAyxY6Wo9r/v5isE=; b=lNQza3Gs3A60i9roTkrhXi2LVqAaG5Sb7wJdkVdq7sH7NjdYGPBsupQzKNLLqujUdD 9AAN8qP2ymlOsiQYIENV6gtxSrvnGbz5Og3c2ioRcmDUdGc3sqh8ruP0Adc2SP/2dW2Z 04JMMIcqIkyYb40fNP+wSokVTDKcMKPqyVhMpo+MU8i97Bt+5OZPBVUA4ocepXDA1Prk kspbXQXoWBW+eHHDcXpQ+PaPM9ZJDREs8PlsNQZU5eKKuxU6Ul8wsBDzuKS067H64TFB Ouj/LZAMO9FDYt3DDANnEGoqmbY9Msdwfy4yXh7SLuOmcC1ydqfI7Ei2hgKIfVXz6vCr 1McQ== X-Forwarded-Encrypted: i=1; AJvYcCXwSCXENWbNgXrkHYEqcmQ7fT5AVOw6tm/su0TWD2q357glzT+E1GmjxfGiy4Kl2xbHgrSMTlw=@lists.denx.de X-Gm-Message-State: AOJu0Yw1XyZCDAiSre5/P8e5AgbQsZOwECE5mfeacaKfX1Saml9LyjIQ TSnDb6j/ZpeNGthdacWI3SXaGyfFNX3XirVhwj+TJpTFFpUfrfkDvSqlVf/Mba8= X-Gm-Gg: ASbGncucaSFX9YhBPd+U/SUj7wAvMPCcT86ypU0WG20XHvYF2wnMltm/1/ewrd/D+n3 /i/0zUtNrPKMznQn6y4yf0LCBtIyn4Dm+PF6ANA7Ar2gcq6MfRvFgX3CEBXK1ybPVVEFdh4tpEs zoB5gxvgm1s5kpOLUXVlKmu7dmF9wrVDwnGm8ldZcZbba/SfzFdTQnkjRWQsRxHh/gq8VWdPVnU /fUZ5q93soa6uGAjCJPOoGkECUZFd0ByFMUtxRSKZvKU4C0vt2JCS6Olzvd/7Ej5gL8FwqAaT3C rB9+dFZdP50dPTU0or3PEbQPlKVjNGRsC/Avl3zohTVaQmCkIA== X-Received: by 2002:a05:600c:1f8c:b0:434:ffb2:f9cf with SMTP id 5b1f17b1804b1-438e1708a35mr15653435e9.14.1738221698884; Wed, 29 Jan 2025 23:21:38 -0800 (PST) Received: from hades.. (ppp176092181030.access.hol.gr. [176.92.181.30]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438dcc6df2asm48076345e9.29.2025.01.29.23.21.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2025 23:21:38 -0800 (PST) From: Ilias Apalodimas To: maz@kernel.org, trini@konsulko.com, CFSworks@gmail.com Cc: Ilias Apalodimas , Caleb Connolly , Neil Armstrong , Sumit Garg , Heinrich Schuchardt , Simon Glass , Marek Vasut , =?utf-8?q?Pierre-Cl=C3=A9men?= =?utf-8?q?t_Tosi?= , Sam Protsenko , Sughosh Ganu , Peng Fan , Richard Henderson , Peter Hoyes , Andre Przywara , Patrick Rudolph , Sam Day , Evgeny Bachinin , Michal Simek , Jerome Forissier , Christian Marangi , Rasmus Villemoes , u-boot@lists.denx.de, u-boot-qcom@groups.io Subject: [RFC PATCH 4/4] arm64: Change mapping for data/rodata/text Date: Thu, 30 Jan 2025 09:20:29 +0200 Message-ID: <20250130072100.27297-5-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250130072100.27297-1-ilias.apalodimas@linaro.org> References: <20250130072100.27297-1-ilias.apalodimas@linaro.org> MIME-Version: 1.0 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 Now that we have everything in place switch the page permissions for .rodata, .text and .data just after we relocate everything in top of the RAM. Signed-off-by: Ilias Apalodimas --- common/board_r.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/board_r.c b/common/board_r.c index 179259b00de8..38944f600fd6 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -170,6 +170,13 @@ static int initr_reloc_global_data(void) efi_save_gd(); efi_runtime_relocate(gd->relocaddr, NULL); + +#if (IS_ENABLED(CONFIG_ARM64)) + mmu_set_attrs((u64)(__start_rodata), (u64)(__end_rodata - __start_rodata), 1); + mmu_set_attrs((u64)(__start_data), (u64)(__end_data - __start_data), 3); + mmu_set_attrs((u64)(__text_start), (u64)(__text_end - __text_start), 2); +#endif + #endif return 0;