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: 13844969 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0D60D17157 for ; Tue, 22 Oct 2024 01:59:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E81AF6B0082; Mon, 21 Oct 2024 21:59:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DE1696B00A1; Mon, 21 Oct 2024 21:59:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C36316B00A3; Mon, 21 Oct 2024 21:59:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 9E2D26B0082 for ; Mon, 21 Oct 2024 21:59:31 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 4B8DF1C76DC for ; Tue, 22 Oct 2024 01:59:13 +0000 (UTC) X-FDA: 82699581006.16.1E6D246 Received: from mail-oa1-f46.google.com (mail-oa1-f46.google.com [209.85.160.46]) by imf05.hostedemail.com (Postfix) with ESMTP id 32DD5100004 for ; Tue, 22 Oct 2024 01:59:00 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=sifive.com header.s=google header.b=Z6f2RpYI; spf=pass (imf05.hostedemail.com: domain of samuel.holland@sifive.com designates 209.85.160.46 as permitted sender) smtp.mailfrom=samuel.holland@sifive.com; dmarc=pass (policy=reject) header.from=sifive.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729562218; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=559wueV0PG6xFm1m5EmJll56/fKSQJhn2CptHQFJIX4=; b=L1Ol6mUC4EwvaabojlMUFysdk39JlUiRV/fvKyHw4FlSi8kbpXrsxkW5k0N2JmkQGFW2GF mH3PIq0ZFXTkFzJckDdVTkVIUDWqAK4FacV/6LIMY5d/1RgmSfZNZS7DL4Q5bm9AwFZGvt UPjVRBRdpHyOQmRsz9anvRMXunSngac= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729562218; a=rsa-sha256; cv=none; b=VwvEzhoC5TuBvpAdQDrM4lxT8Rj1nfalDTH74es/1g+VBCeUZSepO17tfb3Rg9/mv/K5ZV oLIq1zM4yfqve/G4pbW+T2UHXbq4js9DWrAD3FyIEb5EL+BZ7h/yyi+XuLSg82jMvWu+25 XfBQEIlEf0uS4SKVHAsXg4EmZ2urlYM= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=sifive.com header.s=google header.b=Z6f2RpYI; spf=pass (imf05.hostedemail.com: domain of samuel.holland@sifive.com designates 209.85.160.46 as permitted sender) smtp.mailfrom=samuel.holland@sifive.com; dmarc=pass (policy=reject) header.from=sifive.com Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-2872134c806so1562408fac.3 for ; Mon, 21 Oct 2024 18:59:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1729562368; x=1730167168; darn=kvack.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=Z6f2RpYIi8WhRYSekycCvz4U0u0e8zxlQ2fxVZ25fThhXWD/OEJh+xVg1U7b7LN3Il Rx/8S74SI/zSL/Bkvs/gHrVTRPX5vWF3p1JBdwXHrya8OnRFXef2r54KGHDAJuFGQkby strXr5FAkvN5LLBRIwpMa5Wd3jFA2daTnX9KuR5w+w//h7/8AfuWuXa+eEEGzeljG2fL 5nixM7yXdUiMNu9OwJeg0midylRMbJ7Vp+tb8Qa+X6fvSsA6YDR15KF1jfj9bK9/AUEA IlF/C6odwF3moAbbLUg+tvOGT5URtQJL0gQKasglXdh4KR8IBMediYJeaW42PJIvCck8 /xWQ== 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=FOWSGT/57vmkdSQ76BFaarOtSNMniwrA/wiWaAiPj2rqmvoZvVpw+NY3YBogUutl90 N1sMehcuMXbucrfxgBxkPPK0+kZOKQIHPqBfdk//QI6WmzCXaMQ9J1gd0qSXMkZdKaJO aT0dhsvzLd6PO/YiX0aeXuw3xbckeF7iBF+0vNttfnbawyVbXes1sSzHhyaXutn1nehc Jp+FpqARRQwOb/KvWzp7zVjGYwB8BeJgasQNig68mWIWSWqm5JsNGmFTqFaQMGUHGraT n9Xauoq+jYZOjl3vb75K231YgI+ePs0QZljZ0fdgfEz9WB3miWwxU9ZnOYiLIjSdyfYg r+nA== X-Forwarded-Encrypted: i=1; AJvYcCXV4t5EdVMzvVDctfvvejWjVdIzuErAHD0R8/3KDZY/SYyq6GIqifvly85+tikv+GfA3xzmhGdXDw==@kvack.org X-Gm-Message-State: AOJu0YxeP1Zk+9DEAWjCUJ4mIzt+7zJfp0rCC6Znxup85kcNlwbNcyWe YE9F6dkCXnw47J74iAW0TIQa+NOk/o8keuzZfxtuzAMzudQ7aH3uN4UMDGRg0GU= 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-Stat-Signature: htnbux9zyys4hkx5maopdsbgagcb9o86 X-Rspamd-Queue-Id: 32DD5100004 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1729562340-765758 X-HE-Meta: U2FsdGVkX19FDceqCXNaVG7Rtnn6r3MuARobZ9lwMVQPYl0omNNc+O1PLKpvMQAF1n2sRAn3/n8OA1v5cUoyASds2uNMidias4lMxVkjZXhhj0Fw2J6sqqATqxPPEL+PMB053eSL35Au5lQIiAF7YtFAD9+ky6NRBjsBPiP7Y6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iuSP7+LVQyIiQZsOO6jpKmEckAvgpavYZrGDxXFjYAZJocQQvkHwpjuf5/SkJnL0oXEdapG5iCCWl9z3wliNaF1BHwIAGUtkCH5CWwALNRlWwF+kB+ORqPfi0nR2WfgfKfc+Mg+UsWBF80WFzd++5w== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 */