Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp349841rdf; Tue, 21 Nov 2023 04:43:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IEOrm5SCvXoFC1LC1sfHfApjONU6u1lk3o25fKjgTCjmKRI2K62SsusoRR3usG2R4DWRDr0 X-Received: by 2002:a05:6808:992:b0:3b2:e34f:349b with SMTP id a18-20020a056808099200b003b2e34f349bmr9095778oic.42.1700570612249; Tue, 21 Nov 2023 04:43:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700570612; cv=none; d=google.com; s=arc-20160816; b=fpEDUcqeoh26kaz5PKDUxmLzaXPEr6haIok3KzOM45T7D9+2JYvUFCaPlVGKOzEdco vFznxSLQmdch0sKxhA5DCimrFd0lamLQPfUav7BdJ6dCvQlOcB8jkde18QO96WnvT8Jd dv2/zLsrHvxsA4RrFCsll1pEetWA9UCUsOYmp3uzDS1mpbx/iG5emSGiHLpCurLfaSFV G1uKuUlSjfubr8TueZqYwwHIcWMbAGj58WKfm6mEIFnEIYtd85KQVKfL1scpDyEXUm1B N3TI/toa2x17h75lPltsF5FBtQTo5iIyStJ4j7sTsg6UyO+LiNVQDZN3RL3anuZAAt7r WFXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZcIUiVFJ9kNUHsMFbutrGQOUAvjm4DvZ3i9nKoJpoeY=; fh=sIMbrHW6XchtO8J++xKMvfnuMh37piioh5cqciNSK/o=; b=bnVQ+AXPO4rqIY8nr+RiUK6Z8JwbkL2iE8df3AnPenbNFv98czxwBC911R+8J1RDJV zhuA33Ex7bEzt73k8509XBwPLSodjcQjnjAfFhseGpMTy/leL8daJEW6wX5U5UGVgT99 L77oQiAvSHSUJwGV0cFLTKlIMkLreehc4PllBZNK9E0eeqeJYpSr00KLtZN2bBZ/MMWQ vjqsqnlKh864uDyAGHMO/y9F4ZG7iB1NUvoW5OQHWQhP80GlOXzy+Hqo+BFUrSPHWTvN y02qftZMEAvPp34uTocT67f2ZCcQ612w+NCe73k4Wj/WwvGfs2YKvNQdY7L72Osce1v9 g52A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZHQab0Dx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id k12-20020a6568cc000000b005be3117805esi8348678pgt.327.2023.11.21.04.43.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 04:43:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZHQab0Dx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 852BB811F123; Tue, 21 Nov 2023 04:43:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233570AbjKUMmy (ORCPT + 99 others); Tue, 21 Nov 2023 07:42:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234574AbjKULzq (ORCPT ); Tue, 21 Nov 2023 06:55:46 -0500 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 431C7121; Tue, 21 Nov 2023 03:55:43 -0800 (PST) Received: by mail-pl1-x644.google.com with SMTP id d9443c01a7336-1cc5b705769so48243745ad.0; Tue, 21 Nov 2023 03:55:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700567743; x=1701172543; darn=vger.kernel.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=ZcIUiVFJ9kNUHsMFbutrGQOUAvjm4DvZ3i9nKoJpoeY=; b=ZHQab0DxQkvijR8myKa62GvPPmtvhCNjI6tFcTMF/+ay2HwLWb6gnZJmdlyuV8lwCh mTFxzzJbxRVMo4Z48ChrJ4iy5yvGdCCefgYW/nU0zpThdh7MVAXJ5LlMyj9rWb5cIPvw Lgl2lD+o+KV15BJORAeWqqsWSkPgYD6+4Shdj7orAHKUpQJkmggVshGzr8uG0vDfIDON ad9cQXDfm7vPorFQ/omkehvs/uu/lR73WrOhMVNCR1VAxZ7JtBN1RbjTh388qBOHANpl Xlx4NF89wvUNCkB0f6KWRnkfGoiJw9VRqmuYZAxsIasvTHZN4SUTS2MX+gTVI1a+VVQO cITA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700567743; x=1701172543; 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=ZcIUiVFJ9kNUHsMFbutrGQOUAvjm4DvZ3i9nKoJpoeY=; b=bEceUq3yLmwhB/O6wueRKya0S/2D3jmREkbNNKOeQOpC4TPYTxxyArtWXhmqV81EhM KDHls3cdSRNDmCEzLazCjpQvoZuE9R301+BfoS5NH9Fu3h84jtRZOnKtbuHLzJu2ow3C 9+0MPvHSnMVnKccR32dM+W6/ftge2GcsDwKLvuZMhzNnCa6zhftA++8DbJitOxktSR46 b2Jpp6RrQqO0Wzj0Pu6E6ZTVU3bJ66i4ijKGuJZ9AyjIdfWEKC/rW5CrhVuIC4AOItrL Rl0jpSumUBuFYEJnQM4okWXHQyOEp74l3Ryft8okFEbelrzQBwP0DS8T+zQRhRmGxX59 McCg== X-Gm-Message-State: AOJu0YzpVADuv6FICXhxUHm0qNJLIGorKtehsgy5VTNfRg1Pfvv9+l89 Zc4Re4898HabrSky729QUpc= X-Received: by 2002:a17:902:7244:b0:1cf:665a:925 with SMTP id c4-20020a170902724400b001cf665a0925mr4132100pll.38.1700567742755; Tue, 21 Nov 2023 03:55:42 -0800 (PST) Received: from localhost.localdomain ([103.7.29.32]) by smtp.gmail.com with ESMTPSA id g10-20020a170902740a00b001cc1dff5b86sm7685431pll.244.2023.11.21.03.55.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 03:55:42 -0800 (PST) From: Jinrong Liang X-Google-Original-From: Jinrong Liang To: Sean Christopherson Cc: Paolo Bonzini , Like Xu , Jim Mattson , Aaron Lewis , Wanpeng Li , Jinrong Liang , Jinrong Liang , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/9] KVM: selftests: Add x86 feature and properties for AMD PMU in processor.h Date: Tue, 21 Nov 2023 19:54:52 +0800 Message-Id: <20231121115457.76269-5-cloudliang@tencent.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231121115457.76269-1-cloudliang@tencent.com> References: <20231121115457.76269-1-cloudliang@tencent.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 21 Nov 2023 04:43:17 -0800 (PST) From: Jinrong Liang Add x86 feature and properties for AMD PMU so that tests don't have to manually retrieve the correct CPUID leaf+register, and so that the resulting code is self-documenting. Signed-off-by: Jinrong Liang --- tools/testing/selftests/kvm/include/x86_64/processor.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h index ba16d714b451..250ace4f14b8 100644 --- a/tools/testing/selftests/kvm/include/x86_64/processor.h +++ b/tools/testing/selftests/kvm/include/x86_64/processor.h @@ -176,6 +176,7 @@ struct kvm_x86_cpu_feature { * Extended Leafs, a.k.a. AMD defined */ #define X86_FEATURE_SVM KVM_X86_CPU_FEATURE(0x80000001, 0, ECX, 2) +#define X86_FEATURE_PERFCTR_CORE KVM_X86_CPU_FEATURE(0x80000001, 0, ECX, 23) #define X86_FEATURE_NX KVM_X86_CPU_FEATURE(0x80000001, 0, EDX, 20) #define X86_FEATURE_GBPAGES KVM_X86_CPU_FEATURE(0x80000001, 0, EDX, 26) #define X86_FEATURE_RDTSCP KVM_X86_CPU_FEATURE(0x80000001, 0, EDX, 27) @@ -192,6 +193,7 @@ struct kvm_x86_cpu_feature { #define X86_FEATURE_VGIF KVM_X86_CPU_FEATURE(0x8000000A, 0, EDX, 16) #define X86_FEATURE_SEV KVM_X86_CPU_FEATURE(0x8000001F, 0, EAX, 1) #define X86_FEATURE_SEV_ES KVM_X86_CPU_FEATURE(0x8000001F, 0, EAX, 3) +#define X86_FEATURE_PERFMON_V2 KVM_X86_CPU_FEATURE(0x80000022, 0, EAX, 0) /* * KVM defined paravirt features. @@ -276,6 +278,7 @@ struct kvm_x86_cpu_property { #define X86_PROPERTY_MAX_PHY_ADDR KVM_X86_CPU_PROPERTY(0x80000008, 0, EAX, 0, 7) #define X86_PROPERTY_MAX_VIRT_ADDR KVM_X86_CPU_PROPERTY(0x80000008, 0, EAX, 8, 15) #define X86_PROPERTY_PHYS_ADDR_REDUCTION KVM_X86_CPU_PROPERTY(0x8000001F, 0, EBX, 6, 11) +#define X86_PROPERTY_PMU_NR_CORE_COUNTERS KVM_X86_CPU_PROPERTY(0x80000022, 0, EBX, 0, 3) #define X86_PROPERTY_MAX_CENTAUR_LEAF KVM_X86_CPU_PROPERTY(0xC0000000, 0, EAX, 0, 31) -- 2.39.3