Subject: Re: linux-next: manual merge of the kvm-x86 tree with the tip tree

From: "Aithal, Srikanth" <[email-masked]>
Date: Mon, 22 Sep 2025 16:57:39 +0530

Hello,

Todays linux-next build fails with below error on AMD x86:

arch/x86/kvm/emulate.c:4091:9: error: implicit declaration of function 
‘F’ [-Werror=implicit-function-declaration]
  4091 |         F(DstMem | SrcNone | Lock,              em_inc),
       |         ^
arch/x86/kvm/emulate.c:4091:9: error: initializer element is not constant
arch/x86/kvm/emulate.c:4091:9: note: (near initialization for 
‘group5[0].flags’)
arch/x86/kvm/emulate.c:4092:9: error: initializer element is not constant
  4092 |         F(DstMem | SrcNone | Lock,              em_dec),
       |         ^
arch/x86/kvm/emulate.c:4092:9: note: (near initialization for 
‘group5[0].intercept’)
arch/x86/kvm/emulate.c:3993:21: error: field name not in record or union 
initializer
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                     ^
arch/x86/kvm/emulate.c:4093:9: note: in expansion of macro ‘I’
  4093 |         I(SrcMem | NearBranch | IsBranch | ShadowStack, 
em_call_near_abs),
       |         ^
arch/x86/kvm/emulate.c:3993:21: note: (near initialization for 
‘group5[0].pad’)
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                     ^
arch/x86/kvm/emulate.c:4093:9: note: in expansion of macro ‘I’
  4093 |         I(SrcMem | NearBranch | IsBranch | ShadowStack, 
em_call_near_abs),
       |         ^
arch/x86/kvm/emulate.c:3993:30: error: conversion from ‘long long 
unsigned int’ to ‘unsigned char’ changes value from ‘220676381741154496’ 
to ‘192’ [-Werror=overflow]
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                              ^
arch/x86/kvm/emulate.c:4093:9: note: in expansion of macro ‘I’
  4093 |         I(SrcMem | NearBranch | IsBranch | ShadowStack, 
em_call_near_abs),
       |         ^
arch/x86/kvm/emulate.c:3993:36: error: field name not in record or union 
initializer
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                                    ^
arch/x86/kvm/emulate.c:4093:9: note: in expansion of macro ‘I’
  4093 |         I(SrcMem | NearBranch | IsBranch | ShadowStack, 
em_call_near_abs),
       |         ^
arch/x86/kvm/emulate.c:3993:36: note: (near initialization for 
‘group5[0].pad’)
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                                    ^
arch/x86/kvm/emulate.c:4093:9: note: in expansion of macro ‘I’
  4093 |         I(SrcMem | NearBranch | IsBranch | ShadowStack, 
em_call_near_abs),
       |         ^
arch/x86/kvm/emulate.c:3993:49: error: initialization of ‘unsigned char’ 
from ‘int (*)(struct x86_emulate_ctxt *)’ makes integer from pointer 
without a cast [-Werror=int-conversion]
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                                                 ^
arch/x86/kvm/emulate.c:4093:9: note: in expansion of macro ‘I’
  4093 |         I(SrcMem | NearBranch | IsBranch | ShadowStack, 
em_call_near_abs),
       |         ^
arch/x86/kvm/emulate.c:3993:49: note: (near initialization for 
‘group5[0].pad[1]’)
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                                                 ^
arch/x86/kvm/emulate.c:4093:9: note: in expansion of macro ‘I’
  4093 |         I(SrcMem | NearBranch | IsBranch | ShadowStack, 
em_call_near_abs),
       |         ^
arch/x86/kvm/emulate.c:3993:49: error: initializer element is not 
computable at load time
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                                                 ^
arch/x86/kvm/emulate.c:4093:9: note: in expansion of macro ‘I’
  4093 |         I(SrcMem | NearBranch | IsBranch | ShadowStack, 
em_call_near_abs),
       |         ^
arch/x86/kvm/emulate.c:3993:49: note: (near initialization for 
‘group5[0].pad[1]’)
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                                                 ^
arch/x86/kvm/emulate.c:4093:9: note: in expansion of macro ‘I’
  4093 |         I(SrcMem | NearBranch | IsBranch | ShadowStack, 
em_call_near_abs),
       |         ^
arch/x86/kvm/emulate.c:4090:39: error: missing braces around initializer 
[-Werror=missing-braces]
  4090 | static const struct opcode group5[] = {
       |                                       ^
  4091 |         F(DstMem | SrcNone | Lock,              em_inc),
       |         {
arch/x86/kvm/emulate.c:3993:22: error: ‘union <anonymous>’ has no member 
named ‘flags’
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                      ^~~~~
arch/x86/kvm/emulate.c:4094:9: note: in expansion of macro ‘I’
  4094 |         I(SrcMemFAddr | ImplicitOps | IsBranch | ShadowStack, 
em_call_far),
       |         ^
arch/x86/kvm/emulate.c:3993:30: error: initialization of ‘int (*)(struct 
x86_emulate_ctxt *)’ from ‘long long unsigned int’ makes pointer from 
integer without a cast [-Werror=int-conversion]
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                              ^
arch/x86/kvm/emulate.c:4094:9: note: in expansion of macro ‘I’
  4094 |         I(SrcMemFAddr | ImplicitOps | IsBranch | ShadowStack, 
em_call_far),
       |         ^
arch/x86/kvm/emulate.c:3993:30: note: (near initialization for 
‘group5[0].u.execute’)
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                              ^
arch/x86/kvm/emulate.c:4094:9: note: in expansion of macro ‘I’
  4094 |         I(SrcMemFAddr | ImplicitOps | IsBranch | ShadowStack, 
em_call_far),
       |         ^
arch/x86/kvm/emulate.c:3993:37: error: ‘union <anonymous>’ has no member 
named ‘u’
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                                     ^
arch/x86/kvm/emulate.c:4094:9: note: in expansion of macro ‘I’
  4094 |         I(SrcMemFAddr | ImplicitOps | IsBranch | ShadowStack, 
em_call_far),
       |         ^
arch/x86/kvm/emulate.c:3993:49: error: excess elements in union 
initializer [-Werror]
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                                                 ^
arch/x86/kvm/emulate.c:4094:9: note: in expansion of macro ‘I’
  4094 |         I(SrcMemFAddr | ImplicitOps | IsBranch | ShadowStack, 
em_call_far),
       |         ^
arch/x86/kvm/emulate.c:3993:49: note: (near initialization for 
‘group5[0].u’)
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                                                 ^
arch/x86/kvm/emulate.c:4094:9: note: in expansion of macro ‘I’
  4094 |         I(SrcMemFAddr | ImplicitOps | IsBranch | ShadowStack, 
em_call_far),
       |         ^
arch/x86/kvm/emulate.c:4090:39: error: missing braces around initializer 
[-Werror=missing-braces]
  4090 | static const struct opcode group5[] = {
       |                                       ^
  4091 |         F(DstMem | SrcNone | Lock,              em_inc),
       |         {
arch/x86/kvm/emulate.c:4095:9: error: braces around scalar initializer 
[-Werror]
  4095 |         I(SrcMem | NearBranch | IsBranch,       em_jmp_abs),
       |         ^
arch/x86/kvm/emulate.c:4095:9: note: (near initialization for 
‘group5[0].check_perm’)
arch/x86/kvm/emulate.c:3993:21: error: field name not in record or union 
initializer
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                     ^
arch/x86/kvm/emulate.c:4095:9: note: in expansion of macro ‘I’
  4095 |         I(SrcMem | NearBranch | IsBranch,       em_jmp_abs),
       |         ^
arch/x86/kvm/emulate.c:3993:21: note: (near initialization for 
‘group5[0].check_perm’)
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                     ^
arch/x86/kvm/emulate.c:4095:9: note: in expansion of macro ‘I’
  4095 |         I(SrcMem | NearBranch | IsBranch,       em_jmp_abs),
       |         ^
arch/x86/kvm/emulate.c:3993:30: error: initialization of ‘int (*)(struct 
x86_emulate_ctxt *)’ from ‘long long unsigned int’ makes pointer from 
integer without a cast [-Werror=int-conversion]
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                              ^
arch/x86/kvm/emulate.c:4095:9: note: in expansion of macro ‘I’
  4095 |         I(SrcMem | NearBranch | IsBranch,       em_jmp_abs),
       |         ^
arch/x86/kvm/emulate.c:3993:30: note: (near initialization for 
‘group5[0].check_perm’)
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                              ^
arch/x86/kvm/emulate.c:4095:9: note: in expansion of macro ‘I’
  4095 |         I(SrcMem | NearBranch | IsBranch,       em_jmp_abs),
       |         ^
arch/x86/kvm/emulate.c:3993:36: error: field name not in record or union 
initializer
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                                    ^
arch/x86/kvm/emulate.c:4095:9: note: in expansion of macro ‘I’
  4095 |         I(SrcMem | NearBranch | IsBranch,       em_jmp_abs),
       |         ^
arch/x86/kvm/emulate.c:3993:36: note: (near initialization for 
‘group5[0].check_perm’)
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                                    ^
arch/x86/kvm/emulate.c:4095:9: note: in expansion of macro ‘I’
  4095 |         I(SrcMem | NearBranch | IsBranch,       em_jmp_abs),
       |         ^
arch/x86/kvm/emulate.c:3993:49: error: excess elements in scalar 
initializer [-Werror]
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                                                 ^
arch/x86/kvm/emulate.c:4095:9: note: in expansion of macro ‘I’
  4095 |         I(SrcMem | NearBranch | IsBranch,       em_jmp_abs),
       |         ^
arch/x86/kvm/emulate.c:3993:49: note: (near initialization for 
‘group5[0].check_perm’)
  3993 | #define I(_f, _e) { .flags = (_f), .u.execute = (_e) }
       |                                                 ^
arch/x86/kvm/emulate.c:4095:9: note: in expansion of macro ‘I’
  4095 |         I(SrcMem | NearBranch | IsBranch,       em_jmp_abs),
       |         ^
arch/x86/kvm/emulate.c:4090:39: error: missing braces around initializer 
[-Werror=missing-braces]
  4090 | static const struct opcode group5[] = {
       |                                       ^
  4091 |         F(DstMem | SrcNone | Lock,              em_inc),
       |         {
arch/x86/kvm/emulate.c:4090:39: error: missing braces around initializer 
[-Werror=missing-braces]
arch/x86/kvm/emulate.c:4090:39: error: missing braces around initializer 
[-Werror=missing-braces]
arch/x86/kvm/emulate.c:4090:39: error: missing braces around initializer 
[-Werror=missing-braces]
cc1: all warnings being treated as errors
make[4]: *** [scripts/Makefile.build:287: arch/x86/kvm/emulate.o] Error 1
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [scripts/Makefile.build:556: arch/x86/kvm] Error 2

Attaching the config used.

On 9/22/2025 3:20 PM, Mark Brown wrote:
> Hi all,
> 
> Today's linux-next merge of the kvm-x86 tree got a conflict in:
> 
>    arch/x86/kvm/emulate.c
> 
> between commit:
> 
>    6204aea36b74c ("KVM: x86: Introduce EM_ASM_1")
> 
> from the tip tree and commit:
> 
>    f8457615b71c6 ("KVM: x86: Don't emulate instructions affected by CET features")
> 
> from the kvm-x86 tree.
> 
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
> 
> diff --cc arch/x86/kvm/emulate.c
> index 796d0c64f9baf,5c5fb6a6f7f92..0000000000000
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@@ -4001,11 -4153,11 +4088,11 @@@ static const struct opcode group4[] =
>    };
>    
>    static const struct opcode group5[] = {
>   -	F(DstMem | SrcNone | Lock,		em_inc),
>   -	F(DstMem | SrcNone | Lock,		em_dec),
>   +	I(DstMem | SrcNone | Lock,		em_inc),
>   +	I(DstMem | SrcNone | Lock,		em_dec),
> - 	I(SrcMem | NearBranch | IsBranch,       em_call_near_abs),
> - 	I(SrcMemFAddr | ImplicitOps | IsBranch, em_call_far),
> + 	I(SrcMem | NearBranch | IsBranch | ShadowStack, em_call_near_abs),
> + 	I(SrcMemFAddr | ImplicitOps | IsBranch | ShadowStack, em_call_far),
>   -	I(SrcMem | NearBranch | IsBranch, em_jmp_abs),
>   +	I(SrcMem | NearBranch | IsBranch,       em_jmp_abs),
>    	I(SrcMemFAddr | ImplicitOps | IsBranch, em_jmp_far),
>    	I(SrcMem | Stack | TwoMemOp,		em_push), D(Undefined),
>    };
> diff --cc arch/x86/include/asm/cpufeatures.h
> index b2a562217d3ff,8738bd783de22..0000000000000
> --- a/arch/x86/include/asm/cpufeatures.h
> +++ b/arch/x86/include/asm/cpufeatures.h
> @@@ -495,8 -496,7 +496,9 @@@
>    #define X86_FEATURE_TSA_SQ_NO		(21*32+11) /* AMD CPU not vulnerable to TSA-SQ */
>    #define X86_FEATURE_TSA_L1_NO		(21*32+12) /* AMD CPU not vulnerable to TSA-L1 */
>    #define X86_FEATURE_CLEAR_CPU_BUF_VM	(21*32+13) /* Clear CPU buffers using VERW before VMRUN */
>   -#define X86_FEATURE_MSR_IMM		(21*32+14) /* MSR immediate form instructions */
>   +#define X86_FEATURE_IBPB_EXIT_TO_USER	(21*32+14) /* Use IBPB on exit-to-userspace, see VMSCAPE bug */
>   +#define X86_FEATURE_ABMC		(21*32+15) /* Assignable Bandwidth Monitoring Counters */
> ++#define X86_FEATURE_MSR_IMM		(21*32+16) /* MSR immediate form instructions */
>    
>    /*
>     * BUG word(s)
> diff --cc arch/x86/include/asm/msr-index.h
> index 718a55d82fe45,717baeba6db3c..0000000000000
> --- a/arch/x86/include/asm/msr-index.h
> +++ b/arch/x86/include/asm/msr-index.h
> @@@ -315,14 -315,15 +315,16 @@@
>    #define PERF_CAP_PT_IDX			16
>    
>    #define MSR_PEBS_LD_LAT_THRESHOLD	0x000003f6
>   -
> + #define PERF_CAP_LBR_FMT		0x3f
>    #define PERF_CAP_PEBS_TRAP		BIT_ULL(6)
>    #define PERF_CAP_ARCH_REG		BIT_ULL(7)
>    #define PERF_CAP_PEBS_FORMAT		0xf00
> + #define PERF_CAP_FW_WRITES		BIT_ULL(13)
>    #define PERF_CAP_PEBS_BASELINE		BIT_ULL(14)
>   +#define PERF_CAP_PEBS_TIMING_INFO	BIT_ULL(17)
>    #define PERF_CAP_PEBS_MASK		(PERF_CAP_PEBS_TRAP | PERF_CAP_ARCH_REG | \
>   -					 PERF_CAP_PEBS_FORMAT | PERF_CAP_PEBS_BASELINE)
>   +					 PERF_CAP_PEBS_FORMAT | PERF_CAP_PEBS_BASELINE | \
>   +					 PERF_CAP_PEBS_TIMING_INFO)
>    
>    #define MSR_IA32_RTIT_CTL		0x00000570
>    #define RTIT_CTL_TRACEEN		BIT(0)
> diff --cc arch/x86/kvm/emulate.c
> index 796d0c64f9baf,5c5fb6a6f7f92..0000000000000
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@@ -4001,11 -4153,11 +4088,11 @@@ static const struct opcode group4[] =
>    };
>    
>    static const struct opcode group5[] = {
>    	F(DstMem | SrcNone | Lock,		em_inc),
>    	F(DstMem | SrcNone | Lock,		em_dec),
> - 	I(SrcMem | NearBranch | IsBranch,       em_call_near_abs),
> - 	I(SrcMemFAddr | ImplicitOps | IsBranch, em_call_far),
> + 	I(SrcMem | NearBranch | IsBranch | ShadowStack, em_call_near_abs),
> + 	I(SrcMemFAddr | ImplicitOps | IsBranch | ShadowStack, em_call_far),
>   -	I(SrcMem | NearBranch | IsBranch, em_jmp_abs),
>   +	I(SrcMem | NearBranch | IsBranch,       em_jmp_abs),
>    	I(SrcMemFAddr | ImplicitOps | IsBranch, em_jmp_far),
>    	I(SrcMem | Stack | TwoMemOp,		em_push), D(Undefined),
>    };