From patchwork Fri Oct 27 18:08:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 13438774 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 15087C25B6F for ; Fri, 27 Oct 2023 18:09:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9E4896B03DA; Fri, 27 Oct 2023 14:09:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 946666B03DB; Fri, 27 Oct 2023 14:09:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 797386B03DC; Fri, 27 Oct 2023 14:09:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 696416B03DA for ; Fri, 27 Oct 2023 14:09:14 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 39D2440AE3 for ; Fri, 27 Oct 2023 18:09:14 +0000 (UTC) X-FDA: 81392028228.03.D66574A Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf06.hostedemail.com (Postfix) with ESMTP id 94128180029 for ; Fri, 27 Oct 2023 18:09:12 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf06.hostedemail.com: domain of joey.gouly@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=joey.gouly@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1698430152; 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; bh=JScmRTdrcAD9DyytEES0iUW70C7QDtzE3aPxCH3mhAA=; b=2V88bTQAFOlKAp79pNaTvF1pL1bDdkTftcZh5sDSa3kDPQc/ByqdTfX+tbEVjnZ+8DJD0n NVAFVotpc5g338/GvJ3AI8u+sF0OdKZ51JrONBLSDCTwFIG43aWjk82BkRg8szn8G5S1rx CeGILUab7zYzuW/akQI6FoOs/H8jXDM= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf06.hostedemail.com: domain of joey.gouly@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=joey.gouly@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1698430152; a=rsa-sha256; cv=none; b=nyprjGVDUOm8Z/rDYVHDor7+xJ1eG0cuy/NKlAditm21kqvhJY8vn5i9pk8VJ71pkU/TVr kSYB3lqAGDEZcxWwMu8Ml0ptw3GcSPffsFSNEPPhKpEGBEB8cpSMwbbBaqN390wrpM7tAR 2DhET7xv3vx31eV2CLL2B6nifdSC3Lw= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 37C331570; Fri, 27 Oct 2023 11:09:53 -0700 (PDT) Received: from e124191.cambridge.arm.com (e124191.cambridge.arm.com [10.1.197.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 69FAF3F64C; Fri, 27 Oct 2023 11:09:09 -0700 (PDT) From: Joey Gouly To: linux-arm-kernel@lists.infradead.org Cc: akpm@linux-foundation.org, aneesh.kumar@linux.ibm.com, broonie@kernel.org, catalin.marinas@arm.com, dave.hansen@linux.intel.com, joey.gouly@arm.com, maz@kernel.org, oliver.upton@linux.dev, shuah@kernel.org, will@kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, James Morse , Suzuki K Poulose , Zenghui Yu Subject: [PATCH v2 03/24] arm64: cpufeature: add Permission Overlay Extension cpucap Date: Fri, 27 Oct 2023 19:08:29 +0100 Message-Id: <20231027180850.1068089-4-joey.gouly@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231027180850.1068089-1-joey.gouly@arm.com> References: <20231027180850.1068089-1-joey.gouly@arm.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 94128180029 X-Stat-Signature: xtkqoeoc65rsy8g63apxnao8c5roddz7 X-HE-Tag: 1698430152-437988 X-HE-Meta: U2FsdGVkX1/7e4bsGaFFfVxV35aEnhvWafTDAC8iOttC2wu5sK78tgVTD6qwkXi/LRqAXKcL0/Ui2zp6EcY1uZptO7xYcjYVxO6P9iOBGAbz/48bkpDwxEDWImkBbzW8hXEY/0l0sUuETmxKeMmBkEwSpIfdwXrVwlYpoe7FO92FKBK3pHVT5ry7BiKFkVbC0kI2TJz1wOVXfMKlCnku28uqsu7zyvginwPFyaXZNrZrXtGEy+DzMrcRMec+EB/5yTVai+t5Drz9rKUByxwtYGsHMAJX0KZw1cNK1hlbXgSq9YAvCNPR9sDqIdge3UVSACupGPb/3TvvINtHQwdzWzBvUYXSWT0dX/zi2nG8BDKl43+Via5mnzbDcH+IAET1RTbzDuow8gcKeDiNWbU8mg/JRAn8+ph4p528rvcGPR29+yvTuFJ3OIA3kYF00/lfTjojJpVGa853UH+WtOWjPey6LCFZlFaoFFNMbYbNEMFENEQz8xUx/7DDF55LtNHhUsmrx1kg7SjuNsnNeGFyLL4CYvNm1QpxHK3en/hzm91remaKePnzs2ptbFPT3ZI6951ZGlu2D3HNHXNSGaCyBnEoR+OZpeGH1R/9K3ZNPE7pFMbkJelAzr81hsZHudkleG3xAg1RydpI1+NKRWkXRfitvQgJ99rPqtYNodb7+vFj9zWr4xMftyH2Wb6T/M3/orgMBe7d2vx2vde3bGziD2w7RIO7VSvfRyX/Nw5uUlA//MqdLjsAjzysQx3RoeUu26vZTGcee4qJER29FyVumra3CcbxI9Y4TlKp16UD86SCwIc+A0Mdkwi3yPn/RyFBUQcwGVn63Iym190Nlcxmwn7JVXwbfvKdSzATQU5cOV7UULrHU8fB3u8OFT6B3h4RjSeZ+QaRFDn5xzVJpGdOV57xUMbyWuXitLOJ4Yp/gZLUFRI/b/md5E/wjmnu/aj4El0gyUTIGhSeduV2DM0 0l/BXqAS +UrbaIDWt7YVMvAMQDcfz1D+p93YARrHDNIp4E3NVMAMyS+8XKwz9izLKcjkkUvW+lQ8wyxDAjwo/fFPMv56Qv+cxRFkJA3pursBSk/pRY0ZO6jpMoj3+6NNbSF7PrNezp5MY9fc9HH3FHYF2bqQJpB1Up/eKcOab7Kf+eG/5aOnnrEjji2lGdMbQrP6pLpVHrPRCnVPMrFFjVQaNcuFpmDCs5A== 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: This indicates if the system supports POE. This is a CPUCAP_BOOT_CPU_FEATURE as the boot CPU will enable POE if it has it, so secondary CPUs must also have this feature. Add a new config option: ARM64_POE Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/Kconfig | 16 ++++++++++++++++ arch/arm64/kernel/cpufeature.c | 9 +++++++++ arch/arm64/tools/cpucaps | 1 + 3 files changed, 26 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index b10515c0200b..1f1a12e28c3f 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -2060,6 +2060,22 @@ config ARM64_EPAN if the cpu does not implement the feature. endmenu # "ARMv8.7 architectural features" +menu "ARMv8.9 architectural features" +config ARM64_POE + prompt "Permission Overlay Extension" + def_bool y + help + The Permission Overlay Extension is used to implement Memory + Protection Keys. Memory Protection Keys provides a mechanism for + enforcing page-based protections, but without requiring modification + of the page tables when an application changes protection domains. + + For details, see Documentation/core-api/protection-keys.rst + + If unsure, say y. + +endmenu # "ARMv8.9 architectural features" + config ARM64_SVE bool "ARM Scalable Vector Extension support" default y diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 444a73c2e638..f1c1f348a31d 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -2719,6 +2719,15 @@ static const struct arm64_cpu_capabilities arm64_features[] = { .matches = has_cpuid_feature, ARM64_CPUID_FIELDS(ID_AA64MMFR2_EL1, EVT, IMP) }, +#ifdef CONFIG_ARM64_POE + { + .desc = "Stage-1 Permission Overlay Extension (S1POE)", + .capability = ARM64_HAS_S1POE, + .type = ARM64_CPUCAP_BOOT_CPU_FEATURE, + .matches = has_cpuid_feature, + ARM64_CPUID_FIELDS(ID_AA64MMFR3_EL1, S1POE, IMP) + }, +#endif {}, }; diff --git a/arch/arm64/tools/cpucaps b/arch/arm64/tools/cpucaps index c3f06fdef609..b8348e40f6d9 100644 --- a/arch/arm64/tools/cpucaps +++ b/arch/arm64/tools/cpucaps @@ -43,6 +43,7 @@ HAS_NO_FPSIMD HAS_NO_HW_PREFETCH HAS_PAN HAS_S1PIE +HAS_S1POE HAS_RAS_EXTN HAS_RNG HAS_SB