From patchwork Tue Oct 22 01:57:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 13844993 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C1ACBD17159 for ; Tue, 22 Oct 2024 02:12:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=559wueV0PG6xFm1m5EmJll56/fKSQJhn2CptHQFJIX4=; b=NRyiQkGxZ5QzeA1BU1UOsHNrwo Lq2hhQe1XfLXovlXghUVmWFLQTRHInYYOUbZH8CVyQ7ZIB+dx9Dvx9uWKVz7hWdTsBVM5BYfzrRgR pyukUQVuqsuM9LqbgsySzbmZT7WhcRT4A/agsBzKshzVj8PVbTY+jo2h7mExTnPVpECEsRUjP/z+x vF9zfqUeYJYdznCEC3/vTl86B8OfwgfuaToW0BAKyGSLwbxGENX4KLU4YU933ucNB19y3XvIQf5bx pYmOGLOoYMiFkSWExmylH5q6adadOkvtZZnb2MU4scuPpd5xfx0ycLmZ/LUe/cRJDDk6EGpe/7ay+ 5ZGypX1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t34Nn-00000009ITt-1LfO; Tue, 22 Oct 2024 02:12:27 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t34BP-00000009FyU-24le for linux-arm-kernel@bombadil.infradead.org; Tue, 22 Oct 2024 01:59:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=559wueV0PG6xFm1m5EmJll56/fKSQJhn2CptHQFJIX4=; b=o/lTLAq8qYOjGTMS6mBUbtTDLX CryYKwcsw/KUYIr+XchkAKxeVhnWVEJr2aKbjFaUiFNoQl3dwLPv3B4so9r+fkQkWGGYjvvKqIpHo G5scXxN6mEcCNyydhcTy8KoCYQIwjUYPAO/gCoiYj7YsNCRa8DKwqvYvRMuNyyslOXh16pWIsXkSu rlWNNDa/LK/QQrEb+L04+39ip9d60zXR8tyDOlipzzDWpsBG4htSv7yLbOCr+F2WhUi7E+gLK6XMy YMfPhAowQ66ZlHTBWtbAEQEvaJH/ZAIHPz2QfZSkPgp/gvvVjbTRfE0AWhYCKcLvdalIAhK+VODsC tdrWOBgw==; Received: from mail-oa1-x36.google.com ([2001:4860:4864:20::36]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t34BK-000000085OM-30Mr for linux-arm-kernel@lists.infradead.org; Tue, 22 Oct 2024 01:59:37 +0000 Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-2891055c448so1883995fac.0 for ; Mon, 21 Oct 2024 18:59:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1729562368; x=1730167168; darn=lists.infradead.org; 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=559wueV0PG6xFm1m5EmJll56/fKSQJhn2CptHQFJIX4=; b=fOkES0EpzB6Ws7ZmIHr75OtpsKOOHrDJvKY/ye1Y7eqolDMW8RBZgPLVivEjCG8H+l LcgNS8zMYji24Zn3qejheS/O8+AEV/CsKMuYFTxysh0gVSrJ7ytt1kslSgRldluzMnhF lsnYUM9MtRTEakKlIPhEeWa+gvdMKr426Q+I3j+cOXol+tgd1jiUZgNru6QgxtgrePDI pW+tSIcaambaGfGC+yupiFsqPO7A6KvAaZ+3vRpFlSKoo19LD6sYlOdIkJkaybl69KVq G/4U20WrotkBdQqJlbYuAyxJhsmUjFvSYR1vahnSUbOU2FhljwPpxC7sOtkrE/5wk57L +wyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729562368; x=1730167168; 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=559wueV0PG6xFm1m5EmJll56/fKSQJhn2CptHQFJIX4=; b=bLBeRDSgZJ10DIWI7lJ3q7weG1hGf7vax7GyxEvoiDXNZON3FRuL9FRF2pq5P4+/28 N+xmewsBGF0TuWx3btLu5Avvy1BHaE578HUa9OFcJTfpIgQYYjlThFlM2pe+1eJwoJdt iB0XQSOlV8KfklqpaobatMZ7AZmGuZyUYd6+25zqSxik8cIBKOrpf8UiDNmjSSDX6PGQ WyvTO5fXClO6x4nzZ7hh0glmc38ODs5fjidSX3dyrKVeoLD78+KWW8cuw+569vC2ocVU mEaXGhyix1KOrFhiLP9qH1Kd5hN8r32ZARcsS4cqQcgleAXriYBFA4BxeVWUvgdTWg2k IuTA== X-Forwarded-Encrypted: i=1; AJvYcCX9POxgf9H9+pZGq3Hkiv+2jQGk+OPfMHS2FGSQjlhht4j4i2Od5Imu4/2LSog9Z2zWrgj/bFofg4s5Sp9CHz7X@lists.infradead.org X-Gm-Message-State: AOJu0Yz3GE/m7k/p2LWzis4Jqnyot0DO9hiuvzmtJvMHbQvW/mbeefK0 N/moGL5e0+QClBBQLm2wksd1lAvRW0mSSvqUkH4CQi+LtzWQSOzYGqY27dmzaHg= X-Google-Smtp-Source: AGHT+IEp2UA/bF+2FyY3t++ENshpm/xo2VESMIC3hEEwlJcPqi8vvi8Dyd6MCRyyBM+qcOZbinhyoQ== X-Received: by 2002:a05:6870:95aa:b0:277:a43a:dac2 with SMTP id 586e51a60fabf-2892c2df34amr10113787fac.17.1729562368580; Mon, 21 Oct 2024 18:59:28 -0700 (PDT) Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71ec132ffdcsm3600710b3a.46.2024.10.21.18.59.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2024 18:59:28 -0700 (PDT) From: Samuel Holland To: Palmer Dabbelt , linux-riscv@lists.infradead.org, Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , kasan-dev@googlegroups.com Cc: llvm@lists.linux.dev, Catalin Marinas , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Alexandre Ghiti , Will Deacon , Evgenii Stepanov , Andrew Morton , linux-arm-kernel@lists.infradead.org, Samuel Holland Subject: [PATCH v2 7/9] riscv: Align the sv39 linear map to 16 GiB Date: Mon, 21 Oct 2024 18:57:15 -0700 Message-ID: <20241022015913.3524425-8-samuel.holland@sifive.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20241022015913.3524425-1-samuel.holland@sifive.com> References: <20241022015913.3524425-1-samuel.holland@sifive.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241022_025935_004767_59A26E90 X-CRM114-Status: GOOD ( 13.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The KASAN implementation on RISC-V requires the shadow memory for the vmemmap and linear map regions to be aligned to a PMD boundary (1 GiB). For KASAN_GENERIC (KASAN_SHADOW_SCALE_SHIFT == 3), this enforces 8 GiB alignment for the memory regions themselves. KASAN_SW_TAGS uses 16-byte granules (KASAN_SHADOW_SCALE_SHIFT == 4), so now the memory regions must be aligned to a 16 GiB boundary. Signed-off-by: Samuel Holland Reviewed-by: Alexandre Ghiti --- (no changes since v1) Documentation/arch/riscv/vm-layout.rst | 10 +++++----- arch/riscv/include/asm/page.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Documentation/arch/riscv/vm-layout.rst b/Documentation/arch/riscv/vm-layout.rst index eabec99b5852..c0778c421b34 100644 --- a/Documentation/arch/riscv/vm-layout.rst +++ b/Documentation/arch/riscv/vm-layout.rst @@ -47,11 +47,11 @@ RISC-V Linux Kernel SV39 | Kernel-space virtual memory, shared between all processes: ____________________________________________________________|___________________________________________________________ | | | | - ffffffc4fea00000 | -236 GB | ffffffc4feffffff | 6 MB | fixmap - ffffffc4ff000000 | -236 GB | ffffffc4ffffffff | 16 MB | PCI io - ffffffc500000000 | -236 GB | ffffffc5ffffffff | 4 GB | vmemmap - ffffffc600000000 | -232 GB | ffffffd5ffffffff | 64 GB | vmalloc/ioremap space - ffffffd600000000 | -168 GB | fffffff5ffffffff | 128 GB | direct mapping of all physical memory + ffffffc2fea00000 | -244 GB | ffffffc2feffffff | 6 MB | fixmap + ffffffc2ff000000 | -244 GB | ffffffc2ffffffff | 16 MB | PCI io + ffffffc300000000 | -244 GB | ffffffc3ffffffff | 4 GB | vmemmap + ffffffc400000000 | -240 GB | ffffffd3ffffffff | 64 GB | vmalloc/ioremap space + ffffffd400000000 | -176 GB | fffffff3ffffffff | 128 GB | direct mapping of all physical memory | | | | fffffff700000000 | -36 GB | fffffffeffffffff | 32 GB | kasan __________________|____________|__________________|_________|____________________________________________________________ diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h index 32d308a3355f..6e2f79cf77c5 100644 --- a/arch/riscv/include/asm/page.h +++ b/arch/riscv/include/asm/page.h @@ -37,7 +37,7 @@ * define the PAGE_OFFSET value for SV48 and SV39. */ #define PAGE_OFFSET_L4 _AC(0xffffaf8000000000, UL) -#define PAGE_OFFSET_L3 _AC(0xffffffd600000000, UL) +#define PAGE_OFFSET_L3 _AC(0xffffffd400000000, UL) #else #define PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL) #endif /* CONFIG_64BIT */