[PATCH v1 8/8] DO NOT MERGE: Temporary EXTAPIC UAPI definitions

Manali Shukla posted 8 patches 1 month, 3 weeks ago
[PATCH v1 8/8] DO NOT MERGE: Temporary EXTAPIC UAPI definitions
Posted by Manali Shukla 1 month, 3 weeks ago
This patch adds the minimal UAPI definitions required for extended
LAPIC support. These definitions will be imported via the standard
scripts/update-linux-headers.sh process once the kernel patches are
merged.

This patch is provided only for testing and review purposes and
should NOT be merged.

Kernel patches: https://lore.kernel.org/kvm/...

Signed-off-by: Manali Shukla <manali.shukla@amd.com>

---
NOT-FOR-MERGE
---
---
 linux-headers/asm-x86/kvm.h | 7 +++++++
 linux-headers/linux/kvm.h   | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h
index f0c1a730d9..04d1a1a527 100644
--- a/linux-headers/asm-x86/kvm.h
+++ b/linux-headers/asm-x86/kvm.h
@@ -124,6 +124,13 @@ struct kvm_lapic_state {
 	char regs[KVM_APIC_REG_SIZE];
 };
 
+
+/* for KVM_GET_LAPIC2 and KVM_SET_LAPIC2 */
+#define KVM_APIC_EXT_REG_SIZE 0x1000
+struct kvm_lapic_state2 {
+	char regs[KVM_APIC_EXT_REG_SIZE];
+};
+
 struct kvm_segment {
 	__u64 base;
 	__u32 limit;
diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
index 32c5885a3c..4e67281e99 100644
--- a/linux-headers/linux/kvm.h
+++ b/linux-headers/linux/kvm.h
@@ -637,6 +637,10 @@ struct kvm_ioeventfd {
 #define KVM_X86_DISABLE_EXITS_PAUSE          (1 << 2)
 #define KVM_X86_DISABLE_EXITS_CSTATE         (1 << 3)
 
+#define KVM_X86_NR_EXTLVT_DEFAULT		4
+#define KVM_LAPIC2_DEFAULT			(1 << 0)
+#define KVM_LAPIC2_AMD_DEFAULT			(1 << 1)
+
 /* for KVM_ENABLE_CAP */
 struct kvm_enable_cap {
 	/* in */
@@ -952,6 +956,7 @@ struct kvm_enable_cap {
 #define KVM_CAP_ARM_EL2 240
 #define KVM_CAP_ARM_EL2_E2H0 241
 #define KVM_CAP_RISCV_MP_STATE_RESET 242
+#define KVM_CAP_LAPIC2 247
 
 struct kvm_irq_routing_irqchip {
 	__u32 irqchip;
@@ -1308,6 +1313,8 @@ struct kvm_vfio_spapr_tce {
 #define KVM_SET_FPU               _IOW(KVMIO,  0x8d, struct kvm_fpu)
 #define KVM_GET_LAPIC             _IOR(KVMIO,  0x8e, struct kvm_lapic_state)
 #define KVM_SET_LAPIC             _IOW(KVMIO,  0x8f, struct kvm_lapic_state)
+#define KVM_GET_LAPIC2            _IOR(KVMIO,  0x8e, struct kvm_lapic_state2)
+#define KVM_SET_LAPIC2            _IOW(KVMIO,  0x8f, struct kvm_lapic_state2)
 #define KVM_SET_CPUID2            _IOW(KVMIO,  0x90, struct kvm_cpuid2)
 #define KVM_GET_CPUID2            _IOWR(KVMIO, 0x91, struct kvm_cpuid2)
 /* Available with KVM_CAP_VAPIC */
-- 
2.43.0
Re: [PATCH v1 8/8] DO NOT MERGE: Temporary EXTAPIC UAPI definitions
Posted by Manali Shukla 1 month, 3 weeks ago
On 2/19/2026 11:12 AM, Manali Shukla wrote:
> This patch adds the minimal UAPI definitions required for extended
> LAPIC support. These definitions will be imported via the standard
> scripts/update-linux-headers.sh process once the kernel patches are
> merged.
> 
> This patch is provided only for testing and review purposes and
> should NOT be merged.
> 
> Kernel patches: https://lore.kernel.org/kvm/...

Sorry. I missed to add the correct link.
Kernel patches for this changes are available at:

https://lore.kernel.org/kvm/20260219054207.471303-9-manali.shukla@amd.com/T/#u

-Manali

> 
> Signed-off-by: Manali Shukla <manali.shukla@amd.com>
> 
> ---
> NOT-FOR-MERGE
> ---
> ---
>  linux-headers/asm-x86/kvm.h | 7 +++++++
>  linux-headers/linux/kvm.h   | 7 +++++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h
> index f0c1a730d9..04d1a1a527 100644
> --- a/linux-headers/asm-x86/kvm.h
> +++ b/linux-headers/asm-x86/kvm.h
> @@ -124,6 +124,13 @@ struct kvm_lapic_state {
>  	char regs[KVM_APIC_REG_SIZE];
>  };
>  
> +
> +/* for KVM_GET_LAPIC2 and KVM_SET_LAPIC2 */
> +#define KVM_APIC_EXT_REG_SIZE 0x1000
> +struct kvm_lapic_state2 {
> +	char regs[KVM_APIC_EXT_REG_SIZE];
> +};
> +
>  struct kvm_segment {
>  	__u64 base;
>  	__u32 limit;
> diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
> index 32c5885a3c..4e67281e99 100644
> --- a/linux-headers/linux/kvm.h
> +++ b/linux-headers/linux/kvm.h
> @@ -637,6 +637,10 @@ struct kvm_ioeventfd {
>  #define KVM_X86_DISABLE_EXITS_PAUSE          (1 << 2)
>  #define KVM_X86_DISABLE_EXITS_CSTATE         (1 << 3)
>  
> +#define KVM_X86_NR_EXTLVT_DEFAULT		4
> +#define KVM_LAPIC2_DEFAULT			(1 << 0)
> +#define KVM_LAPIC2_AMD_DEFAULT			(1 << 1)
> +
>  /* for KVM_ENABLE_CAP */
>  struct kvm_enable_cap {
>  	/* in */
> @@ -952,6 +956,7 @@ struct kvm_enable_cap {
>  #define KVM_CAP_ARM_EL2 240
>  #define KVM_CAP_ARM_EL2_E2H0 241
>  #define KVM_CAP_RISCV_MP_STATE_RESET 242
> +#define KVM_CAP_LAPIC2 247
>  
>  struct kvm_irq_routing_irqchip {
>  	__u32 irqchip;
> @@ -1308,6 +1313,8 @@ struct kvm_vfio_spapr_tce {
>  #define KVM_SET_FPU               _IOW(KVMIO,  0x8d, struct kvm_fpu)
>  #define KVM_GET_LAPIC             _IOR(KVMIO,  0x8e, struct kvm_lapic_state)
>  #define KVM_SET_LAPIC             _IOW(KVMIO,  0x8f, struct kvm_lapic_state)
> +#define KVM_GET_LAPIC2            _IOR(KVMIO,  0x8e, struct kvm_lapic_state2)
> +#define KVM_SET_LAPIC2            _IOW(KVMIO,  0x8f, struct kvm_lapic_state2)
>  #define KVM_SET_CPUID2            _IOW(KVMIO,  0x90, struct kvm_cpuid2)
>  #define KVM_GET_CPUID2            _IOWR(KVMIO, 0x91, struct kvm_cpuid2)
>  /* Available with KVM_CAP_VAPIC */
Re: [PATCH v1 8/8] DO NOT MERGE: Temporary EXTAPIC UAPI definitions
Posted by Manali Shukla 1 month, 3 weeks ago
On 2/19/2026 11:12 AM, Manali Shukla wrote:
> This patch adds the minimal UAPI definitions required for extended
> LAPIC support. These definitions will be imported via the standard
> scripts/update-linux-headers.sh process once the kernel patches are
> merged.
> 
> This patch is provided only for testing and review purposes and
> should NOT be merged.
> 
> Kernel patches: https://lore.kernel.org/kvm/...

Sorry. I missed to add correct link.
Kernel patches for this changes are available at:

https://lore.kernel.org/kvm/20260204074452.55453-1manali.shukla@amd.com/

-Manali

> 
> Signed-off-by: Manali Shukla <manali.shukla@amd.com>
> 
> ---
> NOT-FOR-MERGE
> ---
> ---
>  linux-headers/asm-x86/kvm.h | 7 +++++++
>  linux-headers/linux/kvm.h   | 7 +++++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h
> index f0c1a730d9..04d1a1a527 100644
> --- a/linux-headers/asm-x86/kvm.h
> +++ b/linux-headers/asm-x86/kvm.h
> @@ -124,6 +124,13 @@ struct kvm_lapic_state {
>  	char regs[KVM_APIC_REG_SIZE];
>  };
>  
> +
> +/* for KVM_GET_LAPIC2 and KVM_SET_LAPIC2 */
> +#define KVM_APIC_EXT_REG_SIZE 0x1000
> +struct kvm_lapic_state2 {
> +	char regs[KVM_APIC_EXT_REG_SIZE];
> +};
> +
>  struct kvm_segment {
>  	__u64 base;
>  	__u32 limit;
> diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
> index 32c5885a3c..4e67281e99 100644
> --- a/linux-headers/linux/kvm.h
> +++ b/linux-headers/linux/kvm.h
> @@ -637,6 +637,10 @@ struct kvm_ioeventfd {
>  #define KVM_X86_DISABLE_EXITS_PAUSE          (1 << 2)
>  #define KVM_X86_DISABLE_EXITS_CSTATE         (1 << 3)
>  
> +#define KVM_X86_NR_EXTLVT_DEFAULT		4
> +#define KVM_LAPIC2_DEFAULT			(1 << 0)
> +#define KVM_LAPIC2_AMD_DEFAULT			(1 << 1)
> +
>  /* for KVM_ENABLE_CAP */
>  struct kvm_enable_cap {
>  	/* in */
> @@ -952,6 +956,7 @@ struct kvm_enable_cap {
>  #define KVM_CAP_ARM_EL2 240
>  #define KVM_CAP_ARM_EL2_E2H0 241
>  #define KVM_CAP_RISCV_MP_STATE_RESET 242
> +#define KVM_CAP_LAPIC2 247
>  
>  struct kvm_irq_routing_irqchip {
>  	__u32 irqchip;
> @@ -1308,6 +1313,8 @@ struct kvm_vfio_spapr_tce {
>  #define KVM_SET_FPU               _IOW(KVMIO,  0x8d, struct kvm_fpu)
>  #define KVM_GET_LAPIC             _IOR(KVMIO,  0x8e, struct kvm_lapic_state)
>  #define KVM_SET_LAPIC             _IOW(KVMIO,  0x8f, struct kvm_lapic_state)
> +#define KVM_GET_LAPIC2            _IOR(KVMIO,  0x8e, struct kvm_lapic_state2)
> +#define KVM_SET_LAPIC2            _IOW(KVMIO,  0x8f, struct kvm_lapic_state2)
>  #define KVM_SET_CPUID2            _IOW(KVMIO,  0x90, struct kvm_cpuid2)
>  #define KVM_GET_CPUID2            _IOWR(KVMIO, 0x91, struct kvm_cpuid2)
>  /* Available with KVM_CAP_VAPIC */