From patchwork Mon Nov 20 12:37:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13461192 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 31B89C5AE5E for ; Mon, 20 Nov 2023 12:40:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=E9zlsSdPmw+cgNOCwVnYoanzrq0pmmD2obiZzeOaDzQ=; b=ljMlL1iayKojGH gZm8IsJcp8/oMy9ZS3KMvH74Qr4rF5VJnoWJUoBCqcoy1f/syAQAzgpKQvYzwn3fJh0M6SJoU2EwU EXYpo3oblZEt2Mdro+EELEurpTIpt6ZO+rADGPyJgSfhdC6Gf5gtSDMa1EeQvoMxfSYvGnP2aS5EG J+eOZyWJYj9oquVIcYVfJApnOwjT6zkr/bcTvSwlDeB3igjDIHhUB/BsHtS92w3h9558yoteuHmUN nisDDi+xfPN99g5SI2md3EGSUiI3H1QHGyue2Jn/5DrmJjeBqdXBfdSB4Z9jP1KFl5N3hcTCsGM2s wWQ+Wx3Qf1YGTfYghqGg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r53Yy-00C1NH-37; Mon, 20 Nov 2023 12:39:41 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r53XB-00C0y2-1g for linux-arm-kernel@lists.infradead.org; Mon, 20 Nov 2023 12:37:54 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 2A5C4B8169C; Mon, 20 Nov 2023 12:37:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21AECC433BD; Mon, 20 Nov 2023 12:37:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700483867; bh=FnZ4kYwF2iimP4yf8r3esEh3L5uELbTgTCOPS2apUzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ur9Wtmc1leGWlau75pkRFwrcU6d2xUpjyK3iGKMdOzG/h2RF7Wn5nFsREn86UaL81 Evd3x2PmbAqQ6Kzo/z/nLEJFjHugW25EI/bVHYFaa0Z1Nm/1rfoxlSFJuIo70oHSlL poqu3oi4Ex4U8IUKitA9G63TJZwSdA7QDvefaS2x+utLjKRWqP7juG13llAlX0rJ9O fu0uOgauA0EC45DL8+0doihTOmjLqsLCBYEWePvr9ZBJng5NqxOpphvc8ru/KC2r5t 8IYUT382/xg8zB/Qj+HNMvSETAVlVh10FwwxgNJWMYO50cgh0odYV0kfmx4BttBL35 Sz6XTQNNk3kHA== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1r53X7-00EjJv-68; Mon, 20 Nov 2023 12:37:45 +0000 From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev Cc: Catalin Marinas , Will Deacon , Mark Rutland , Ard Biesheuvel , James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu Subject: [PATCH v2 07/13] arm64: cpufeature: Detect HCR_EL2.NV1 being RES0 Date: Mon, 20 Nov 2023 12:37:15 +0000 Message-Id: <20231120123721.851738-8-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231120123721.851738-1-maz@kernel.org> References: <20231120123721.851738-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, ardb@kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_043749_800037_152C43CB X-CRM114-Status: GOOD ( 11.97 ) 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 A variant of FEAT_E2H0 not being implemented exists in the form of HCR_EL2.E2H being RES1 *and* HCR_EL2.NV1 being RES0 (indicating that only VHE is supported on the host and nested guests). Add the necessary infrastructure for this new CPU capability. Signed-off-by: Marc Zyngier Reviewed-by: Suzuki K Poulose --- arch/arm64/kernel/cpufeature.c | 7 +++++++ arch/arm64/tools/cpucaps | 1 + 2 files changed, 8 insertions(+) diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index e0d64e8b4851..a733c9a83f83 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -2794,6 +2794,13 @@ static const struct arm64_cpu_capabilities arm64_features[] = { .matches = has_cpuid_feature, ARM64_CPUID_FIELDS_NEG(ID_AA64MMFR4_EL1, E2H0, NI) }, + { + .desc = "FEAT_E2H0 not implemented (NV1 RES0)", + .capability = ARM64_HCR_NV1_RES0, + .type = ARM64_CPUCAP_SYSTEM_FEATURE, + .matches = has_cpuid_feature, + ARM64_CPUID_FIELDS_NEG(ID_AA64MMFR4_EL1, E2H0, NI_NV1) + }, {}, }; diff --git a/arch/arm64/tools/cpucaps b/arch/arm64/tools/cpucaps index 8866ea9bf995..fea24bcd6252 100644 --- a/arch/arm64/tools/cpucaps +++ b/arch/arm64/tools/cpucaps @@ -53,6 +53,7 @@ HAS_TLB_RANGE HAS_VIRT_HOST_EXTN HAS_WFXT HCR_E2H_RES1 +HCR_NV1_RES0 HW_DBM KVM_HVHE KVM_PROTECTED_MODE