From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-5.mta1.migadu.com (out-5.mta1.migadu.com [95.215.58.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA64D33F7 for ; Sun, 16 Jul 2023 14:44:35 +0000 (UTC) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1689518673; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=crG3C0qDP4G0RM14+DeSOt3TxPK55HPw9gV0Ao4/ndI=; b=UxLY1ZxIoEFZQlzQfhe2mdVKhyhF0P/D3GhgN1ZkGc0skNvLz7UPSNLslXkBHzyrlyC9/t HDX5RKunTlAoD4dHzsekxNSzrYdohDRr28FPfXJgdSecYQ5wtliFMieRtvsJKlOEMDo/Sn MHCN8bl+wxIxQBqevLPVAD13X3dQW+w= Date: Sun, 16 Jul 2023 22:44:01 +0800 Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v5 1/2] arm64: Add feature detection for fine grained traps To: Mark Brown , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon Cc: Joey Gouly , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev References: <20230712-kvm-arm64-fgt-v5-0-dae3ec236288@kernel.org> <20230712-kvm-arm64-fgt-v5-1-dae3ec236288@kernel.org> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Zenghui Yu In-Reply-To: <20230712-kvm-arm64-fgt-v5-1-dae3ec236288@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 2023/7/12 20:50, Mark Brown wrote: > In order to allow us to have shared code for managing fine grained traps > for KVM guests add it as a detected feature rather than relying on it > being a dependency of other features. > > Acked-by: Catalin Marinas > Signed-off-by: Mark Brown > --- > arch/arm64/kernel/cpufeature.c | 11 +++++++++++ > arch/arm64/tools/cpucaps | 1 + > 2 files changed, 12 insertions(+) > > diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c > index f9d456fe132d..0768f98c49cc 100644 > --- a/arch/arm64/kernel/cpufeature.c > +++ b/arch/arm64/kernel/cpufeature.c > @@ -2627,6 +2627,17 @@ static const struct arm64_cpu_capabilities arm64_features[] = { > .matches = has_cpuid_feature, > ARM64_CPUID_FIELDS(ID_AA64ISAR1_EL1, LRCPC, IMP) > }, > + { > + .desc = "Fine Grained Traps", > + .type = ARM64_CPUCAP_SYSTEM_FEATURE, > + .capability = ARM64_HAS_FGT, > + .sys_reg = SYS_ID_AA64MMFR0_EL1, > + .sign = FTR_UNSIGNED, > + .field_pos = ID_AA64MMFR0_EL1_FGT_SHIFT, > + .field_width = 4, > + .min_field_value = 1, > + .matches = has_cpuid_feature, > + }, Any reason not to use the ARM64_CPUID_FIELDS() helper? Zenghui From mboxrd@z Thu Jan 1 00:00:00 1970 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 out-13.mta1.migadu.com ([95.215.58.13]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qL2zO-00Bxn5-1h for linux-arm-kernel@lists.infradead.org; Sun, 16 Jul 2023 14:44:48 +0000 Message-ID: Date: Sun, 16 Jul 2023 22:44:01 +0800 MIME-Version: 1.0 Subject: Re: [PATCH v5 1/2] arm64: Add feature detection for fine grained traps References: <20230712-kvm-arm64-fgt-v5-0-dae3ec236288@kernel.org> <20230712-kvm-arm64-fgt-v5-1-dae3ec236288@kernel.org> Content-Language: en-US From: Zenghui Yu In-Reply-To: <20230712-kvm-arm64-fgt-v5-1-dae3ec236288@kernel.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+lwn-linux-arm-kernel=archive.lwn.net@lists.infradead.org List-Archive: To: Mark Brown , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon Cc: Joey Gouly , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev On 2023/7/12 20:50, Mark Brown wrote: > In order to allow us to have shared code for managing fine grained traps > for KVM guests add it as a detected feature rather than relying on it > being a dependency of other features. > > Acked-by: Catalin Marinas > Signed-off-by: Mark Brown > --- > arch/arm64/kernel/cpufeature.c | 11 +++++++++++ > arch/arm64/tools/cpucaps | 1 + > 2 files changed, 12 insertions(+) > > diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c > index f9d456fe132d..0768f98c49cc 100644 > --- a/arch/arm64/kernel/cpufeature.c > +++ b/arch/arm64/kernel/cpufeature.c > @@ -2627,6 +2627,17 @@ static const struct arm64_cpu_capabilities arm64_features[] = { > .matches = has_cpuid_feature, > ARM64_CPUID_FIELDS(ID_AA64ISAR1_EL1, LRCPC, IMP) > }, > + { > + .desc = "Fine Grained Traps", > + .type = ARM64_CPUCAP_SYSTEM_FEATURE, > + .capability = ARM64_HAS_FGT, > + .sys_reg = SYS_ID_AA64MMFR0_EL1, > + .sign = FTR_UNSIGNED, > + .field_pos = ID_AA64MMFR0_EL1_FGT_SHIFT, > + .field_width = 4, > + .min_field_value = 1, > + .matches = has_cpuid_feature, > + }, Any reason not to use the ARM64_CPUID_FIELDS() helper? Zenghui _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel