Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5243194rwp; Sun, 16 Jul 2023 23:52:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlFS1AghnUdXeFn/ceUsHmf7+LSpD5h5d22tFIaFq/lSv8jISpCtL6AGyRmnwXLJEnREtOPd X-Received: by 2002:a17:906:749e:b0:994:539d:f98b with SMTP id e30-20020a170906749e00b00994539df98bmr4729864ejl.6.1689576728690; Sun, 16 Jul 2023 23:52:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689576728; cv=none; d=google.com; s=arc-20160816; b=wizlQWUxJTRO4vudA//vUeWP/wXzKaJL52fpDHlEg8p3qCFUPq2Duls0tdYIzoN1zi rUy1+mSfaWEYsNr6rvoPvZT5pTAk+n0jQ5HeDYCic5sFn5ABgee83bj/FFz0PD7bG1I0 kVrmpz0WUVkMn8UR35tiPeDRRhm9LTWci7FmdW5m+nBIGXirQOrcBO6cRIEDbsJQLanf LGfJlTyKrM7Inxjv1fV4GPHTWSlWUJ1jyxrlqfrjq0SJCrkwFAILuAaYH3qKLc/HDISU VtbENrHaeQFZgq61SqwGl7PTfD83nEJ1GlejEq2HAcHfXPt2Z0I7jwfHTxNeFfufD3DZ evmg== 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=stqHzkq7kigcMhRBDly6DL6DHAf258g1j0/ov6PXdGE=; fh=SfnR+hEar4DMYd5GG493Ok7TfL8izhLIRxGqKYi0i+0=; b=Kp5PX2ZhyNl+z+CXpybsKKtmsID458B3wL+dJ6MPJ3yOh89DJ+rvBHxTHPjctWYIBv PGYBY/CQc8GnKuDSv1+uyH61mrRZYwyp1BBSP2Rr7DfBLTrQsWQcf4wf0eCopKKFMsRZ a6ibAwFI+/uFXDo+FEbL+1J7lqIPc5nfS23p8EbwBXVV2z/5otg5XVeqDJw0HrGYuSfh 6xMLC6ru+N+qi6MKRAgyZsXVg4Bjip562HBtI0Q5Wk9KTnYQCrFkcxOMYSZW4c9j62LS 0j6T7WYKSiDL5+fhzzdu/lKL+664rQsm73M4FkKRIgMsWUSqaCTzdwBvirybWHR5hbs1 /2lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=SfpdvFol; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l17-20020a1709067d5100b009888ce5d3d4si12453446ejp.436.2023.07.16.23.51.44; Sun, 16 Jul 2023 23:52:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=SfpdvFol; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231531AbjGQGYL (ORCPT + 99 others); Mon, 17 Jul 2023 02:24:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231503AbjGQGYH (ORCPT ); Mon, 17 Jul 2023 02:24:07 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FAE510CC; Sun, 16 Jul 2023 23:24:02 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id d2e1a72fcca58-666e5f0d60bso2452516b3a.3; Sun, 16 Jul 2023 23:24:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689575041; x=1692167041; 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=stqHzkq7kigcMhRBDly6DL6DHAf258g1j0/ov6PXdGE=; b=SfpdvFolwH0JYP/J1qiauZHPhImaAXaGzYP/cc2qCXNmM+m4zuGijaCDU1/NWddsDD olUr7TqXnrHTaLPmkJ+bUFz+Y1A4WTPIr35BjuOpjxdVoxtOtiH6Blr2d+vUIjGYV9/L b1smx1lrM3jPyGvV3epCQwNIae50lE5rc+pxLsD6lS3i7lx746p3oAyJRy0iZAlfmSo6 uEXtVRepsdtaHm0C/FKIVIRmI48/q4laoJXriJO4xE14gL1g/QOAs3XhkbZVgmbSs9ii iB8rXVn/PArb9UAw0xNwhK5Qb/pKlEE6D8m+aAbdeUmCnTvhyaKM+EOHZe5VO+IwJPNz UJ7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689575041; x=1692167041; 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=stqHzkq7kigcMhRBDly6DL6DHAf258g1j0/ov6PXdGE=; b=kFCu7nAArgTaLcy5qeqYaUh0hSea+6zH9iHSHygfdQ/1l7r1OZeCVkX/WfYV0Pfzpn WC5veYvrNJv2bXrzqK7C/tE588cUDQ+y5NEymnm4G7H/pJqA5HiCiYkB/eXX3A7lbZEi CUqDNQKh3THhzyg3+3AC4INgseX5Rg2gLlJgMF59+ozIOrLRKPiVmdUahNivYRL0DsxB FbiXplWsyXpsrd9VSCGhKUxK37aZjDhWrstYAOCCcB6LSi6RCquQ1yk+JtGUTm2pw5eZ yk2OXk1SADzRSoIwKAp3dPppRl9ZSb560CUiRbgxtseHc3DZX5LrfgcmsdoUHt9exgEE 4RmA== X-Gm-Message-State: ABy/qLbPlrdqBzsxfX/lztflJfEWKuk62fzfS2zTXf+H6XxbJr0alE/v HrU4PzdaIrZ+XwqQwHec7Vg= X-Received: by 2002:a05:6a20:841a:b0:12c:f124:5b72 with SMTP id c26-20020a056a20841a00b0012cf1245b72mr10556237pzd.43.1689575041559; Sun, 16 Jul 2023 23:24:01 -0700 (PDT) Received: from CLOUDLIANG-MB2.tencent.com ([103.7.29.32]) by smtp.gmail.com with ESMTPSA id e4-20020a170902744400b001b9ff5aa2e7sm9555716plt.239.2023.07.16.23.23.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Jul 2023 23:24:01 -0700 (PDT) From: Jinrong Liang X-Google-Original-From: Jinrong Liang To: Sean Christopherson Cc: Paolo Bonzini , Jim Mattson , Shuah Khan , Aaron Lewis , David Matlack , Vishal Annapurve , Wanpeng Li , Like Xu , Jinrong Liang , linux-kselftest@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 1/6] KVM: selftests: Add macros for fixed counters in processor.h Date: Mon, 17 Jul 2023 14:23:38 +0800 Message-Id: <20230717062343.3743-2-cloudliang@tencent.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230717062343.3743-1-cloudliang@tencent.com> References: <20230717062343.3743-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_BLOCKED,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 From: Jinrong Liang Add x86 properties for the number of PMU fixed counters and the bitmask that allows for "discontiguous" fixed counters 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h index aa434c8f19c5..15331abf063b 100644 --- a/tools/testing/selftests/kvm/include/x86_64/processor.h +++ b/tools/testing/selftests/kvm/include/x86_64/processor.h @@ -240,6 +240,8 @@ struct kvm_x86_cpu_property { #define X86_PROPERTY_PMU_VERSION KVM_X86_CPU_PROPERTY(0xa, 0, EAX, 0, 7) #define X86_PROPERTY_PMU_NR_GP_COUNTERS KVM_X86_CPU_PROPERTY(0xa, 0, EAX, 8, 15) #define X86_PROPERTY_PMU_EBX_BIT_VECTOR_LENGTH KVM_X86_CPU_PROPERTY(0xa, 0, EAX, 24, 31) +#define X86_PROPERTY_PMU_FIXED_COUNTERS_BITMASK KVM_X86_CPU_PROPERTY(0xa, 0, ECX, 0, 31) +#define X86_PROPERTY_PMU_NR_FIXED_COUNTERS KVM_X86_CPU_PROPERTY(0xa, 0, EDX, 0, 4) #define X86_PROPERTY_SUPPORTED_XCR0_LO KVM_X86_CPU_PROPERTY(0xd, 0, EAX, 0, 31) #define X86_PROPERTY_XSTATE_MAX_SIZE_XCR0 KVM_X86_CPU_PROPERTY(0xd, 0, EBX, 0, 31) -- 2.39.3