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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DCC5C77B73 for ; Thu, 27 Apr 2023 09:56:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243249AbjD0J4U (ORCPT ); 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 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: kvm@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