Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp395784rwr; Thu, 27 Apr 2023 02:59:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ewoCdr84yJN0u6tuCvbuLnJw8aCuPPj95boVykpaGtxacQHHUz3V4YoEwU4BSq3J3ZLWJ X-Received: by 2002:a05:6a20:7f99:b0:f6:d60d:dbc8 with SMTP id d25-20020a056a207f9900b000f6d60ddbc8mr994949pzj.2.1682589559919; Thu, 27 Apr 2023 02:59:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682589559; cv=none; d=google.com; s=arc-20160816; b=MRVgRqlt8LbuJkaPZDUsCNl0mqvAamGqRCSKrsjnP6QOljRGKeIoowlpUmQDCdAa7W /CgMCyoDwEBW/9whHKU9+t2imshSjvTjl5cm7MWf1dVIjbqsgqoQwWO1jF5qhefVudvG Sr4GSsDpBj8NEcuLh713fcXd+6DCCu+t+Foh+xTYgOpALxzveQ1nrx03xThV7wxVE3GP xnIrbTGPcmorg6t9YNLGM/AvzudU/P722tYi9fOEFPbsiqF2XciqhrdBUj/ZCqgMFEm9 8u1HWRpPVhhRDWKrwMoEBhLhsxgFEgunW8gFMLplOkOd2a+sIStL1BoiAeYbvYVNwV5z S0bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=rVn2ZiVnq8csV2fs4smsTIN5Y9o8VV3U1LDwNb4K/fA=; b=vcU8JMS32xnpte0ayAUvPknpZq8BKRqjkGaDryXc8hbgbG6GDPLEEtP0XIBKIIS6SX u758+UhwjxiPIJJcDDi73sUMCC5simfCaufV1cBt8d8RDWSQ/IJWv/HQYpy5Uo+4i8kA e0oXe3tQid2ImJalN8gW8iIigyKnFjNVv6g2mRrwnvVPqb3JTZmq0TdR3a2kqDzwVoaB vgOS7pgStUkQsxW9ybUTGBeLYInIpfh5PhE/aaWgv+XLk4QivCqvxwCI4vUEm52vJwgL 3XL0aXOxyUZyYqzSDsWs81WWHNzFCIXFxFmfHcYJ8tPR/lzc3mDqi46556ej6aOsJBbB tgEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@amazon.com header.s=amazon201209 header.b=CWzdeMBm; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u184-20020a6385c1000000b00524fcd54553si11903374pgd.485.2023.04.27.02.59.06; Thu, 27 Apr 2023 02:59:19 -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=fail header.i=@amazon.com header.s=amazon201209 header.b=CWzdeMBm; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243340AbjD0J4U (ORCPT + 99 others); Thu, 27 Apr 2023 05:56:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242993AbjD0J4S (ORCPT ); Thu, 27 Apr 2023 05:56:18 -0400 Received: from smtp-fw-2101.amazon.com (smtp-fw-2101.amazon.com [72.21.196.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 794842684; Thu, 27 Apr 2023 02:56:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1682589377; x=1714125377; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=rVn2ZiVnq8csV2fs4smsTIN5Y9o8VV3U1LDwNb4K/fA=; b=CWzdeMBmCxKj3Tw6tDbqc3TGh25KV+eeHTGG5yq2h8rGLdHcy09BuZTZ UAC4eCTuOG5IX0GWFfZFPrHnhOPKCcs8cmqGSVAMwL36eYWQFRJyXf2hL SgNIBYIjIIOGtWx9aLwZhmrIRoQydsHX/oObz7I7E45S/H/2WFN7UbhsC A=; X-IronPort-AV: E=Sophos;i="5.99,230,1677542400"; d="scan'208";a="319019086" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-pdx-2b-m6i4x-7fa2de02.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-2101.iad2.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2023 09:56:12 +0000 Received: from EX19MTAUEB001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-pdx-2b-m6i4x-7fa2de02.us-west-2.amazon.com (Postfix) with ESMTPS id 0910A40E62; Thu, 27 Apr 2023 09:56:09 +0000 (UTC) Received: from EX19D008UEA004.ant.amazon.com (10.252.134.191) by EX19MTAUEB001.ant.amazon.com (10.252.135.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Thu, 27 Apr 2023 09:56:01 +0000 Received: from EX19MTAUEC001.ant.amazon.com (10.252.135.222) by EX19D008UEA004.ant.amazon.com (10.252.134.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Thu, 27 Apr 2023 09:56:01 +0000 Received: from dev-dsk-abusse-1c-9fba1bbe.eu-west-1.amazon.com (10.13.253.110) by mail-relay.amazon.com (10.252.135.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26 via Frontend Transport; Thu, 27 Apr 2023 09:56:00 +0000 From: Anselm Busse CC: , , , "Anselm Busse" , Sean Christopherson , "Paolo Bonzini" , Thomas Gleixner , "Ingo Molnar" , Borislav Petkov , Dave Hansen , , "H. Peter Anvin" , , Subject: [PATCH 0/2] KVM support for Intel PMU v5 fixed function PMC bitmap Date: Thu, 27 Apr 2023 09:53:31 +0000 Message-ID: <20230427095333.35038-1-abusse@amazon.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE,T_SPF_PERMERROR autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Starting with v5, the Intel PMU allows to indicate the available fixed function PMCs not only through CPUID.0AH.EDX[4:0] but also through a bit mask in CPUID.0AH.ECX. According to the SDM the OS can consider a fix function PMC i supported for: CPUID.0AH.ECX[i] || (CPUID.0AH.EDX[4:0] > i) This behavior is already supported by the Intel PMU driver. However, KVM support is missing. This patch series add the support by first refactoring the tracking of available fixed function PMCs in KVM from a number to a bitmap in the frist patch. The second patch populates the bitmap accoring to the rule given by the SDM mentioned above. Regards, Anselm Anselm Busse (2): KVM: vmx/pmu: Indicate available fixed function PMCs through a bitmap KVM: vmx/pmu: Add support for selected fixed vPMU enablement for PMU v5 arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/pmu.h | 6 ++--- arch/x86/kvm/svm/pmu.c | 2 +- arch/x86/kvm/vmx/pmu_intel.c | 40 ++++++++++++++++++++------------- 4 files changed, 30 insertions(+), 20 deletions(-) base-commit: 0cfd8703e7da687924371e9bc77a025bdeba9637 -- 2.39.2 Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879