From patchwork Thu Sep 16 18:15:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Upton X-Patchwork-Id: 12499873 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BC61C433F5 for ; Thu, 16 Sep 2021 18:18:41 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 38A46611C4 for ; Thu, 16 Sep 2021 18:18:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 38A46611C4 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=YVz+pYp4bjZOIUChTcEl0Zx7D1yol92mOYqYGr5k79M=; b=kW3OuPPJy2RijtVzjHU3sCTvvO hCtgGreHQALNFOnDfKOq2bxk+bjO6V0SGQyePG04rpC+XGe8fy9lner0DyoMkrd/Dkh+yDFG6ozgu 8l4b30ZXR3Au32k7ZOKf+hkk7PS6q/+rRRPP3AcpbGez3afeEcwBHPh8x1KNG2kBhIKwGKYF8CDuB RKJHIGrG5QiJIxvc8dsPj73pKGtjrV9sl4+Dt5C2r6Ime39KuzMXU8HD1urjq0KTc6FRiPr050bG6 eZlV78NwnQf1VSZ8Qs4QcuFUVrnLQ6qhedrii/u/dVU2Ck35PCULDd6n8kKm3vSqMtovQuiXJJFn3 r8j3Athg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQvwG-00C2OB-Ug; Thu, 16 Sep 2021 18:16:49 +0000 Received: from mail-io1-xd49.google.com ([2607:f8b0:4864:20::d49]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQvv0-00C1tR-9v for linux-arm-kernel@lists.infradead.org; Thu, 16 Sep 2021 18:15:31 +0000 Received: by mail-io1-xd49.google.com with SMTP id o128-20020a6bbe86000000b005bd06eaeca6so13694951iof.22 for ; Thu, 16 Sep 2021 11:15:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=cEhucRmtScLoOKkKtz+kjGRHoUKux13Tg6JxfwC7i5M=; b=HV2MQTLtXFdc7iP17P6mtu+8Vde3/FS+kVARy2QXPbgRRHo/PT+peFbVCuiaH0L5hX gSyOjL5ewzJr4u8bsZbz32+QGydoZ5YuWBRsCNIry5m7huzZ+AbSGfdYoxN2H8aHJbXj 7G1zF3VnT84BPqUqiqGevGw+SQjR95LA/evNsHyqbSl1a71OYGwzy5hbxeovonQ8nWDT NmOu/+teU1YRy4QgHPRSPdwkcKDemlLDByX1iQlHdBdDXfAnRIE8/jmNRPEfzJgkNw/D RpAdtoNqtqAhzyrlabI1525AGpzYZ2bUogOFN3u0p5FmQ/P48kbO0hOfsdUlKlIAFS+t tYLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=cEhucRmtScLoOKkKtz+kjGRHoUKux13Tg6JxfwC7i5M=; b=rVSSqsgwNdrEuitM1q9dwwvWTIyIhyMBsldzs1nzOTGRDInQwlVgpQwcPD0SLh8I2+ 8KmgL9i58KxcYdzqJvvSWWAP+eg9Bk6o0v7jrF34IMUICxXRov9kcFaeLZlohSezhAZf 3PnDN4gipuizte5g2FkhwpUNaGEISurZax00jBjhULbfVGCopA6OFc2NL4kOuET5pE8P fMzFjNDuztq/NXx5Lf5xXOpGzgHMOwtEX2xZrLojVOs9QyilV07YFVbwmTDRLpA29FZI fGV0p3ZTl0eRltmvrFmJ3qhgop8Mh6hp/aFCPL1+/DvHnQqQOwhQbuoAXq306cBLJWie Sxqg== X-Gm-Message-State: AOAM530+36FV/IZeFZRZhTrKSvCRrKs3FIAXfz4FFyOzlXiozbA00HIh fc7CwORSht5bj+nwtc8l10B+wVDeqRM= X-Google-Smtp-Source: ABdhPJxCd+H8v05h4eupFeeC2qY4icp5YVNK41l2UrN+lmRvW+IkyY3ujFedG7GRyGUSTbLIM5HEy4qonJo= X-Received: from oupton.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:404]) (user=oupton job=sendgmr) by 2002:a92:3642:: with SMTP id d2mr4967295ilf.234.1631816128784; Thu, 16 Sep 2021 11:15:28 -0700 (PDT) Date: Thu, 16 Sep 2021 18:15:07 +0000 In-Reply-To: <20210916181510.963449-1-oupton@google.com> Message-Id: <20210916181510.963449-6-oupton@google.com> Mime-Version: 1.0 References: <20210916181510.963449-1-oupton@google.com> X-Mailer: git-send-email 2.33.0.464.g1972c5931b-goog Subject: [PATCH v8 5/8] arm64: cpufeature: Enumerate support for FEAT_ECV >= 0x2 From: Oliver Upton To: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu Cc: Paolo Bonzini , Sean Christopherson , Marc Zyngier , Peter Shier , Jim Mattson , David Matlack , Ricardo Koller , Jing Zhang , Raghavendra Rao Anata , James Morse , Alexandru Elisei , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, Andrew Jones , Will Deacon , Catalin Marinas , Oliver Upton X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210916_111530_389693_3EEA523E X-CRM114-Status: GOOD ( 11.16 ) 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 Introduce a new cpucap to indicate if the system supports full enhanced counter virtualization (i.e. ID_AA64MMFR0_EL1.ECV>=0x2). Signed-off-by: Oliver Upton Reviewed-by: Reiji Watanabe --- arch/arm64/include/asm/sysreg.h | 1 + arch/arm64/kernel/cpufeature.c | 10 ++++++++++ arch/arm64/tools/cpucaps | 1 + 3 files changed, 12 insertions(+) diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h index b268082d67ed..3fa6b091384d 100644 --- a/arch/arm64/include/asm/sysreg.h +++ b/arch/arm64/include/asm/sysreg.h @@ -849,6 +849,7 @@ #define ID_AA64MMFR0_ASID_8 0x0 #define ID_AA64MMFR0_ASID_16 0x2 +#define ID_AA64MMFR0_ECV_PHYS 0x2 #define ID_AA64MMFR0_TGRAN4_NI 0xf #define ID_AA64MMFR0_TGRAN4_SUPPORTED_MIN 0x0 #define ID_AA64MMFR0_TGRAN4_SUPPORTED_MAX 0x7 diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index f8a3067d10c6..2f5042bb107c 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -2328,6 +2328,16 @@ static const struct arm64_cpu_capabilities arm64_features[] = { .matches = has_cpuid_feature, .min_field_value = 1, }, + { + .desc = "Enhanced Counter Virtualization (Physical)", + .capability = ARM64_HAS_ECV2, + .type = ARM64_CPUCAP_SYSTEM_FEATURE, + .sys_reg = SYS_ID_AA64MMFR0_EL1, + .sign = FTR_UNSIGNED, + .field_pos = ID_AA64MMFR0_ECV_SHIFT, + .matches = has_cpuid_feature, + .min_field_value = ID_AA64MMFR0_ECV_PHYS, + }, {}, }; diff --git a/arch/arm64/tools/cpucaps b/arch/arm64/tools/cpucaps index 49305c2e6dfd..f73a30d5fb1c 100644 --- a/arch/arm64/tools/cpucaps +++ b/arch/arm64/tools/cpucaps @@ -18,6 +18,7 @@ HAS_CRC32 HAS_DCPODP HAS_DCPOP HAS_E0PD +HAS_ECV2 HAS_EPAN HAS_GENERIC_AUTH HAS_GENERIC_AUTH_ARCH