[PATCH 6/6] x86/vpmu: Allow PMU version 6

Teddy Astie posted 6 patches 4 weeks ago
[PATCH 6/6] x86/vpmu: Allow PMU version 6
Posted by Teddy Astie 4 weeks ago
PMU version 6 (notably implemented in Intel Core Ultra) is backward compatible
with older versions, as we're exposing version 2 to the guest, it is not
expected not try using PMU version 6 features.

Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
---
I don't have the hardware to test vPMU on Intel Core Ultra, but I guess it's
supposed to work, as it only introduces new features and doesn't disable
existing ones.

That could want a changelog entry regarding vPMU support on Intel Core Ultra 
and alike ?

 xen/arch/x86/cpu/vpmu_intel.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/vpmu_intel.c b/xen/arch/x86/cpu/vpmu_intel.c
index 0871795218..9c8802b285 100644
--- a/xen/arch/x86/cpu/vpmu_intel.c
+++ b/xen/arch/x86/cpu/vpmu_intel.c
@@ -819,7 +819,7 @@ static int cf_check core2_vpmu_initialise(struct vcpu *v)
     static bool ds_warned;
 
     if ( v->domain->arch.cpuid->basic.pmu.version <= 1 ||
-         v->domain->arch.cpuid->basic.pmu.version >= 6 )
+         v->domain->arch.cpuid->basic.pmu.version >= 7 )
         return -EINVAL;
 
     if ( (arch_pmc_cnt + fixed_pmc_cnt) == 0 )
@@ -904,6 +904,7 @@ const struct arch_vpmu_ops *__init core2_vpmu_init(void)
     case 3:
     case 4:
     case 5:
+    case 6:
         printk(XENLOG_INFO "VPMU: PMU version %u is not fully supported. "
                "Emulating version 2\n", version);
         /* FALLTHROUGH */
-- 
2.53.0



--
Teddy Astie | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech
Re: [PATCH 6/6] x86/vpmu: Allow PMU version 6
Posted by Jan Beulich 2 weeks ago
On 10.03.2026 17:44, Teddy Astie wrote:
> PMU version 6 (notably implemented in Intel Core Ultra) is backward compatible
> with older versions, as we're exposing version 2 to the guest, it is not
> expected not try using PMU version 6 features.
> 
> Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
> ---
> I don't have the hardware to test vPMU on Intel Core Ultra, but I guess it's
> supposed to work, as it only introduces new features and doesn't disable
> existing ones.
> 
> That could want a changelog entry regarding vPMU support on Intel Core Ultra 
> and alike ?

Perhaps.

> --- a/xen/arch/x86/cpu/vpmu_intel.c
> +++ b/xen/arch/x86/cpu/vpmu_intel.c
> @@ -819,7 +819,7 @@ static int cf_check core2_vpmu_initialise(struct vcpu *v)
>      static bool ds_warned;
>  
>      if ( v->domain->arch.cpuid->basic.pmu.version <= 1 ||
> -         v->domain->arch.cpuid->basic.pmu.version >= 6 )
> +         v->domain->arch.cpuid->basic.pmu.version >= 7 )
>          return -EINVAL;
>  
>      if ( (arch_pmc_cnt + fixed_pmc_cnt) == 0 )
> @@ -904,6 +904,7 @@ const struct arch_vpmu_ops *__init core2_vpmu_init(void)
>      case 3:
>      case 4:
>      case 5:
> +    case 6:

This is getting a little unwieldy imo - can we switch to "case 3 ... 6:"?

Jan

>          printk(XENLOG_INFO "VPMU: PMU version %u is not fully supported. "
>                 "Emulating version 2\n", version);
>          /* FALLTHROUGH */