[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/4] x86/hvm: Remove cross-vendor checks from MSR handlers.


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
  • Date: Mon, 26 Jan 2026 12:32:21 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=citrix.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3WMYdXFpXMQhLLFRCp13w8dCirnyREJJcHw5TFRSLhM=; b=rKnORTah3hl+iKftXHvxPahMkK7hahpV11As+dR63kZFYejmXaS9QIAKxgDEmlSstvcCHrM6UP9Oj9s52ojX3Vrdje8g6e1UmICERLHvFJeV3q90LVRYxeuGWM4+HJOfWr2pwbqdO6Oe46ny88JKcoFoNNmz5Ud7Pi4+7+YuE0ueW3wC42Tvn5+lja7c87+Jbgda9hx1xwFS/WMsiEkiNZq0lKIDyfwpKyKoNHg9c1dSlu4xq+fzi4jGBwX9fv0iVW7BeEcs5wDaFVtGDMVdGixW5sJrp/XUHkFgSZX6mdOgMX2sdJmdf/k8U0WiLADsEXXPFqHAtDLVkAY657hrsQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IpfGH4R/5LvDHfCjJBGrHraACQiSkL5887w+V9H/iymVDrB7Hb2b1aeANTbhrdIAvRgKOkaNCXuq6zAPU+L5NAvg90O1Aqj1pMJT0RORVReAi5UB4krz6Wz2KAFHX3w+OVEfteZCW2y7qZM5zUJvky7Jd48FCZ+CoQ1OrJCJm/vADc3Dg2rjI82XCDqAgCdEv+HZALi7GcxmUThapCQ2ybfOOZ2Ymd/CngXfzsaZxDC7pxaEEWw2TCzRBwcFAdE3HEHYDGrwxV9fkn5GWwxkaNyPFIcOzecMM5v5FWx4/waXrmBVAwA01N5zQFarsk7dYvtDWiJHq0uW9rDUxi82BQ==
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 26 Jan 2026 11:32:45 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri Jan 23, 2026 at 7:35 PM CET, Andrew Cooper wrote:
> On 22/01/2026 4:49 pm, Alejandro Vallejo wrote:
>> Not a functional change now that cross-vendor guests are not launchable.
>>
>> Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
>> ---
>>  xen/arch/x86/msr.c | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
>> index ad75a2e108..c9cc4f0692 100644
>> --- a/xen/arch/x86/msr.c
>> +++ b/xen/arch/x86/msr.c
>> @@ -169,9 +169,9 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t 
>> *val)
>>          break;
>>  
>>      case MSR_IA32_PLATFORM_ID:
>> -        if ( !(cp->x86_vendor & X86_VENDOR_INTEL) ||
>> -             !(boot_cpu_data.x86_vendor & X86_VENDOR_INTEL) )
>> +        if ( cp->x86_vendor != X86_VENDOR_INTEL )
>>              goto gp_fault;
>> +
>>          rdmsrl(MSR_IA32_PLATFORM_ID, *val);
>>          break;
>>  
>> @@ -190,8 +190,6 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t 
>> *val)
>>           * the guest.
>>           */
>>          if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_AMD)) ||
>> -             !(boot_cpu_data.x86_vendor &
>> -               (X86_VENDOR_INTEL | X86_VENDOR_AMD)) ||
>>               rdmsr_safe(MSR_AMD_PATCHLEVEL, val) )
>>              goto gp_fault;
>>          break;
>
> Hmm.  Thinking about it, this would probably be cleaner to get rid of
> the cp->x86_vendor field entirely, and retain the boot_cpu_data side.
>
> Additionally, this would fix a minor problem I'm having cleaning up the
> CPUID code for XSAVE fixes, and provide better cache locality.
>
> ~Andrew

I'll replace it on the new version for consistency. I don't mind.

FYI, I'm planning to replace all occurences of this on a follow-up series with a
new cpu_vendor() helper (it's a simpler version evolved from the x86_vendor_is()
RFC I sent a while ago) to enhance DCE's ability to eliminate code. It is (I
hope) just a transient matter until all {x86_,}vendor field checks are replaced
by cpu_vendor().

Cheers,
Alejandro



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.