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

Re: [PATCH 1/2] x86/svm: Add infrastructure for Bus Lock Threshold


  • To: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Tue, 20 Jan 2026 13:12:08 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • 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=DyCajYi4UBGlA1x2vDE96X+W3jTH9wnPpNGsALWMpe0=; b=oC5JQ5FgA+uoK/4K99dT4/5pfbX8lpFV/XdXtaZ1YRZxPCNmWlltEo4D1saMeJax79h5fgPv6YpcSaBFj/qZZqlO1p6KzCM6fHVgNCU4sWnnOVpMLMhnDjAy8h6XShSJw8QUZTwy9UHJ0xt/HjEf7x9WIoO2uVaeZE+/bmmSWhONR/6fJuyy45Yt5ihCHLaoyhpMq4+nzn1rMIRxBAiXve96RA4uWZAhUPibbwsFevZodtYxO7eLsYfuFhCx4AixNFtYGJsosk91Rq1efgeB6bjvjCS6SWztQp3504BhI+bZdI6+ZQ+Sy2hnMWXHulDI/t45wHvs4EzhZu1hAcI38w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DNO2obZ4s+NF1tgTiqrYQo7qGkHVB1ZdBiIsrKVXmUEHT84OZsRVjafNeu6POUfNy942owf+F/cJVAi4aKsSWFiw0dFqbcouxIGfEseUZUFSB3n/3/qWorUoAKnobTgNpBQG5yaIKPqfpDbadA9BI/0jUFknAvinRVvMkBUDydBIqUT8b9A1fl3hB4cURJN20BE0dCZFDzY1aJ5KttmvvyEEM6XV0MtyGLhuMsF1ML/4j823rfEi3GFVWN2puL7EaH4ziHeO/OAi2TwW7KmwKf2rGRIbjRHym0hXbPleo8TJpFUV/f1O6kxTTUPYg461Fz+WnH5dACzyEwLoiF7qfw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Jason Andryuk <jason.andryuk@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Tue, 20 Jan 2026 13:12:19 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 20/01/2026 9:53 am, Alejandro Vallejo wrote:
> diff --git a/xen/arch/x86/hvm/svm/vmcb.h b/xen/arch/x86/hvm/svm/vmcb.h
> index ba554a9644..85e194f247 100644
> --- a/xen/arch/x86/hvm/svm/vmcb.h
> +++ b/xen/arch/x86/hvm/svm/vmcb.h
> @@ -65,6 +65,11 @@ enum GenericIntercept2bits
>      GENERAL2_INTERCEPT_RDPRU   = 1 << 14,
>  };
>  
> +/* general 2 intercepts */
> +enum GenericIntercept3bits
> +{
> +    GENERAL3_INTERCEPT_BUS_LOCK_THRESH = 1 << 5,
> +};

Abbreviating thresh like this not great.

For the intercept, it can probably just be called BUS_LOCK.  There's no
other form of such intercept.

>  
>  /* control register intercepts */
>  enum CRInterceptBits
> @@ -289,6 +294,7 @@ enum VMEXIT_EXITCODE
>      VMEXIT_MWAIT_CONDITIONAL= 140, /* 0x8c */
>      VMEXIT_XSETBV           = 141, /* 0x8d */
>      VMEXIT_RDPRU            = 142, /* 0x8e */
> +    VMEXIT_BUSLOCK          = 165, /* 0xa5 */

VMEXIT_BUS_LOCK for consistency.

>      /* Remember to also update VMEXIT_NPF_PERFC! */
>      VMEXIT_NPF              = 1024, /* 0x400, nested paging fault */
>      /* Remember to also update SVM_PERF_EXIT_REASON_SIZE! */
> @@ -405,7 +411,8 @@ struct vmcb_struct {
>      u32 _exception_intercepts;  /* offset 0x08 - cleanbit 0 */
>      u32 _general1_intercepts;   /* offset 0x0C - cleanbit 0 */
>      u32 _general2_intercepts;   /* offset 0x10 - cleanbit 0 */
> -    u32 res01[10];
> +    u32 _general3_intercepts;   /* offset 0x14 - cleanbit 0 */
> +    u32 res01[9];
>      u16 _pause_filter_thresh;   /* offset 0x3C - cleanbit 0 */
>      u16 _pause_filter_count;    /* offset 0x3E - cleanbit 0 */
>      u64 _iopm_base_pa;          /* offset 0x40 - cleanbit 1 */
> @@ -489,7 +496,10 @@ struct vmcb_struct {
>      u64 nextrip;                /* offset 0xC8 */
>      u8  guest_ins_len;          /* offset 0xD0 */
>      u8  guest_ins[15];          /* offset 0xD1 */
> -    u64 res10a[100];            /* offset 0xE0 pad to save area */
> +    u64 res10a[8];              /* offset 0xE0 */
> +    u16 bus_lock_thresh;        /* offset 0x120 */

bus_lock_count, which is basically it's APM name anyway.

> diff --git a/xen/arch/x86/include/asm/hvm/svm.h 
> b/xen/arch/x86/include/asm/hvm/svm.h
> index a6d7e4aed3..14fe4abf96 100644
> --- a/xen/arch/x86/include/asm/hvm/svm.h
> +++ b/xen/arch/x86/include/asm/hvm/svm.h
> @@ -37,6 +37,7 @@ extern u32 svm_feature_flags;
>  #define SVM_FEATURE_VGIF          16 /* Virtual GIF */
>  #define SVM_FEATURE_SSS           19 /* NPT Supervisor Shadow Stacks */
>  #define SVM_FEATURE_SPEC_CTRL     20 /* MSR_SPEC_CTRL virtualisation */
> +#define SVM_FEATURE_BUS_LOCK_THRESH 29 /* Bus Lock Threshold */
>  
>  static inline bool cpu_has_svm_feature(unsigned int feat)
>  {
> @@ -56,6 +57,7 @@ static inline bool cpu_has_svm_feature(unsigned int feat)
>  #define cpu_has_svm_vloadsave cpu_has_svm_feature(SVM_FEATURE_VLOADSAVE)
>  #define cpu_has_svm_sss       cpu_has_svm_feature(SVM_FEATURE_SSS)
>  #define cpu_has_svm_spec_ctrl cpu_has_svm_feature(SVM_FEATURE_SPEC_CTRL)
> +#define cpu_has_bus_lock_thresh 
> cpu_has_svm_feature(SVM_FEATURE_BUS_LOCK_THRESH)

We actually discussed this on the x86 call just yesterday.  This wants
an svm infix to match the others, and the thresh suffix can be dropped.

I can fix all of these on commit.

~Andrew



 


Rackspace

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