From nobody Sun Feb 8 15:08:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=cloud.com ARC-Seal: i=1; a=rsa-sha256; t=1698262788; cv=none; d=zohomail.com; s=zohoarc; b=IxaDnCmxc3A8D/VWAUXHInD5eK78queqOfWNKPira41l6mNsHy6e8DXXSzfEffA8BXgtST+p1gApatAT/FGLvLHsL9B/9h3mQPWebhgS7fniXlqJdNj1b3U4Ekpnf98UuLiyj+oiCFXUdx0+m1rd/tkfm3b3gxq45jmRRpWz4mU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698262788; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Nd+293SHW4v/x+H7sqG2NMYgcbXBrCZIg35fi93FtdA=; b=d4oux/fCJU1v9rLXqd+V93PR41PJ2nopob2fwzPn901m+sewLB8sc+vh9h4EGT9m1WlOqFRCyJiDmUr1OoTJtf4X4dzBVLSXojdnYkHsSDLgOPpYALM38PbR5RHUatND7XqGfoz7j7theEZeVGzy47Ez/tc1IofMc6+58r7XuAc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1698262788164853.692675872405; Wed, 25 Oct 2023 12:39:48 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.623276.971004 (Exim 4.92) (envelope-from ) id 1qvjiv-0007ZC-1t; Wed, 25 Oct 2023 19:39:25 +0000 Received: by outflank-mailman (output) from mailman id 623276.971004; Wed, 25 Oct 2023 19:39:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qvjiu-0007Yc-To; Wed, 25 Oct 2023 19:39:24 +0000 Received: by outflank-mailman (input) for mailman id 623276; Wed, 25 Oct 2023 19:39:23 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qvja4-0001Lv-Kk for xen-devel@lists.xenproject.org; Wed, 25 Oct 2023 19:30:16 +0000 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [2a00:1450:4864:20::636]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ec1f6471-736c-11ee-9b0e-b553b5be7939; Wed, 25 Oct 2023 21:30:15 +0200 (CEST) Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-99de884ad25so19229566b.3 for ; Wed, 25 Oct 2023 12:30:15 -0700 (PDT) Received: from edvint-x-u.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id hv6-20020a17090760c600b00985ed2f1584sm10408710ejc.187.2023.10.25.12.30.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 12:30:13 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ec1f6471-736c-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1698262214; x=1698867014; darn=lists.xenproject.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=Nd+293SHW4v/x+H7sqG2NMYgcbXBrCZIg35fi93FtdA=; b=D5fnzjtpQWFqO+0CA8rszIYI8IYs00KdGENmFC67mNIHQzPA0spSKbRMR8xvslPCb1 3WlvmsjDBUdU+ikzkmGKHXQPG1l2BvDWLS1YaEwyQysHDs2ePLlXhr9ihMh8vaERXIGq u9JMe+hwio76ueyjeR64v/QcjE2tDIh23sO8U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698262214; x=1698867014; 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=Nd+293SHW4v/x+H7sqG2NMYgcbXBrCZIg35fi93FtdA=; b=TtpEfkx9lCUxK2EL907JDjgg7RN5EOXFOJ0eRlHIRQszysEYxqDu6z7TWEypPqvi7U yIMRvGfnKHxg6y3EfTPDOj08NoDnVeUEBufceQJt7IxWRXdzL9loJFuHjWBI+X6Z9cSj cRkcyxQTTlduKRiD0Zki2ETIGOjicFBdHtn4j+XArHh4kzol27i4FHLRfWeSaJfMRQbg JDOX419n7ltTQpAfkuSIGlLA5T65zFhJhhDAH0RRplV4GIAISgm4a8w+hf3lb6hY3Kik zmiH3MTnsFB4aaDIJhRx9R87CWCNBYmaX2WEJHUUSen37sKfOdWgR2U1ojAzBfHHXJFO GBhA== X-Gm-Message-State: AOJu0YwTj03qtGW6+l314O31HSpq5O0Fmmqsedd6nPrTLP5RK6Dga9Tm HAoyMPolwPl2ETWRbjYOxtXDiAoDeNEJ9nHYZsRCEg== X-Google-Smtp-Source: AGHT+IHxj7lbSTjwVtjs1SNZl18dayBq8u7zBAbJVtzmUE5dKOwN0q93kJch17zKul0wjS72MB5pTA== X-Received: by 2002:a17:907:97d2:b0:9ae:7206:963c with SMTP id js18-20020a17090797d200b009ae7206963cmr15122803ejc.15.1698262214513; Wed, 25 Oct 2023 12:30:14 -0700 (PDT) From: =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu Subject: [RFC PATCH 20/22] x86/PMUv5: limit available fixed PMCs and enable support Date: Wed, 25 Oct 2023 20:29:50 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @cloud.com) X-ZM-MESSAGEID: 1698262790006100001 From: Edwin T=C3=B6r=C3=B6k AnyThread deprecation means a bit in 0xa edx, which we pass through. (we could also avoid doing the anythread masking, but we need that for version <=3D 4 support). Fixed Counter enumeration means we need to limit fixed counters if we hide any. Domain separation needs no action from the hypervisor AFAICT. Signed-off-by: Edwin T=C3=B6r=C3=B6k --- xen/arch/x86/cpuid.c | 3 ++- xen/arch/x86/include/asm/vpmu.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c index 12e768ae87..8900943bcd 100644 --- a/xen/arch/x86/cpuid.c +++ b/xen/arch/x86/cpuid.c @@ -338,7 +338,8 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf, res->a =3D u.eax; =20 /* We only implement 3 fixed function counters */ - if ( (res->d & 0x1f) > fixed_pmc_cnt ) + res->c &=3D ~((1 << fixed_pmc_cnt) - 1); + if ( (res->d & 0x1f) > fixed_pmc_cnt) res->d =3D (res->d & ~0x1f) | fixed_pmc_cnt; } break; diff --git a/xen/arch/x86/include/asm/vpmu.h b/xen/arch/x86/include/asm/vpm= u.h index eaededadb5..f066b17e45 100644 --- a/xen/arch/x86/include/asm/vpmu.h +++ b/xen/arch/x86/include/asm/vpmu.h @@ -74,7 +74,7 @@ struct vpmu_struct { #define VPMU_CPU_HAS_DS 0x1000 /* Has Debug Store */ #define VPMU_CPU_HAS_BTS 0x2000 /* Has Branch Trace Sto= re */ =20 -#define VPMU_VERSION_MAX 0x4 +#define VPMU_VERSION_MAX 0x5 #define VPMU_VERSION_MAX_SUPPORTED 0x5 =20 static inline void vpmu_set(struct vpmu_struct *vpmu, const u32 mask) --=20 2.41.0