Skip to content

Commit 33c53f9

Browse files
committed
tools headers kvm: Sync uapi/{asm/linux} kvm.h headers with the kernel sources
To pick up the changes in: 89b0e7d ("KVM: arm64: nv: Introduce nested virtualization VCPU feature") 14329b8 ("KVM: x86/pmu: Introduce masked events to the pmu event filter") 6213b70 ("KVM: x86: Replace 0-length arrays with flexible arrays") 3fd4980 ("KVM: s390: Extend MEM_OP ioctl by storage key checked cmpxchg") 14329b8 ("KVM: x86/pmu: Introduce masked events to the pmu event filter") That don't change functionality in tools/perf, as no new ioctl is added for the 'perf trace' scripts to harvest. This addresses these perf build warnings: Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h' diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/kvm.h' differs from latest version at 'arch/x86/include/uapi/asm/kvm.h' diff -u tools/arch/x86/include/uapi/asm/kvm.h arch/x86/include/uapi/asm/kvm.h Warning: Kernel ABI header at 'tools/arch/arm64/include/uapi/asm/kvm.h' differs from latest version at 'arch/arm64/include/uapi/asm/kvm.h' diff -u tools/arch/arm64/include/uapi/asm/kvm.h arch/arm64/include/uapi/asm/kvm.h Cc: Aaron Lewis <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Christoffer Dall <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Janis Schoetterl-Glausch <[email protected]> Cc: Janosch Frank <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kees Kook <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Oliver Upton <[email protected]> Cc: Sean Christopherson <[email protected]> Link: https://lore.kernel.org/lkml/ZAJlg7%[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 5f80038 commit 33c53f9

File tree

3 files changed

+42
-2
lines changed
  • tools
    • arch
      • arm64/include/uapi/asm
      • x86/include/uapi/asm
    • include/uapi/linux

3 files changed

+42
-2
lines changed

tools/arch/arm64/include/uapi/asm/kvm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ struct kvm_regs {
109109
#define KVM_ARM_VCPU_SVE 4 /* enable SVE for this CPU */
110110
#define KVM_ARM_VCPU_PTRAUTH_ADDRESS 5 /* VCPU uses address authentication */
111111
#define KVM_ARM_VCPU_PTRAUTH_GENERIC 6 /* VCPU uses generic authentication */
112+
#define KVM_ARM_VCPU_HAS_EL2 7 /* Support nested virtualization */
112113

113114
struct kvm_vcpu_init {
114115
__u32 target;

tools/arch/x86/include/uapi/asm/kvm.h

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <linux/types.h>
1111
#include <linux/ioctl.h>
12+
#include <linux/stddef.h>
1213

1314
#define KVM_PIO_PAGE_OFFSET 1
1415
#define KVM_COALESCED_MMIO_PAGE_OFFSET 2
@@ -507,8 +508,8 @@ struct kvm_nested_state {
507508
* KVM_{GET,PUT}_NESTED_STATE ioctl values.
508509
*/
509510
union {
510-
struct kvm_vmx_nested_state_data vmx[0];
511-
struct kvm_svm_nested_state_data svm[0];
511+
__DECLARE_FLEX_ARRAY(struct kvm_vmx_nested_state_data, vmx);
512+
__DECLARE_FLEX_ARRAY(struct kvm_svm_nested_state_data, svm);
512513
} data;
513514
};
514515

@@ -525,6 +526,35 @@ struct kvm_pmu_event_filter {
525526
#define KVM_PMU_EVENT_ALLOW 0
526527
#define KVM_PMU_EVENT_DENY 1
527528

529+
#define KVM_PMU_EVENT_FLAG_MASKED_EVENTS BIT(0)
530+
#define KVM_PMU_EVENT_FLAGS_VALID_MASK (KVM_PMU_EVENT_FLAG_MASKED_EVENTS)
531+
532+
/*
533+
* Masked event layout.
534+
* Bits Description
535+
* ---- -----------
536+
* 7:0 event select (low bits)
537+
* 15:8 umask match
538+
* 31:16 unused
539+
* 35:32 event select (high bits)
540+
* 36:54 unused
541+
* 55 exclude bit
542+
* 63:56 umask mask
543+
*/
544+
545+
#define KVM_PMU_ENCODE_MASKED_ENTRY(event_select, mask, match, exclude) \
546+
(((event_select) & 0xFFULL) | (((event_select) & 0XF00ULL) << 24) | \
547+
(((mask) & 0xFFULL) << 56) | \
548+
(((match) & 0xFFULL) << 8) | \
549+
((__u64)(!!(exclude)) << 55))
550+
551+
#define KVM_PMU_MASKED_ENTRY_EVENT_SELECT \
552+
(GENMASK_ULL(7, 0) | GENMASK_ULL(35, 32))
553+
#define KVM_PMU_MASKED_ENTRY_UMASK_MASK (GENMASK_ULL(63, 56))
554+
#define KVM_PMU_MASKED_ENTRY_UMASK_MATCH (GENMASK_ULL(15, 8))
555+
#define KVM_PMU_MASKED_ENTRY_EXCLUDE (BIT_ULL(55))
556+
#define KVM_PMU_MASKED_ENTRY_UMASK_MASK_SHIFT (56)
557+
528558
/* for KVM_{GET,SET,HAS}_DEVICE_ATTR */
529559
#define KVM_VCPU_TSC_CTRL 0 /* control group for the timestamp counter (TSC) */
530560
#define KVM_VCPU_TSC_OFFSET 0 /* attribute for the TSC offset */

tools/include/uapi/linux/kvm.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,8 @@ struct kvm_s390_mem_op {
583583
struct {
584584
__u8 ar; /* the access register number */
585585
__u8 key; /* access key, ignored if flag unset */
586+
__u8 pad1[6]; /* ignored */
587+
__u64 old_addr; /* ignored if cmpxchg flag unset */
586588
};
587589
__u32 sida_offset; /* offset into the sida */
588590
__u8 reserved[32]; /* ignored */
@@ -595,11 +597,17 @@ struct kvm_s390_mem_op {
595597
#define KVM_S390_MEMOP_SIDA_WRITE 3
596598
#define KVM_S390_MEMOP_ABSOLUTE_READ 4
597599
#define KVM_S390_MEMOP_ABSOLUTE_WRITE 5
600+
#define KVM_S390_MEMOP_ABSOLUTE_CMPXCHG 6
601+
598602
/* flags for kvm_s390_mem_op->flags */
599603
#define KVM_S390_MEMOP_F_CHECK_ONLY (1ULL << 0)
600604
#define KVM_S390_MEMOP_F_INJECT_EXCEPTION (1ULL << 1)
601605
#define KVM_S390_MEMOP_F_SKEY_PROTECTION (1ULL << 2)
602606

607+
/* flags specifying extension support via KVM_CAP_S390_MEM_OP_EXTENSION */
608+
#define KVM_S390_MEMOP_EXTENSION_CAP_BASE (1 << 0)
609+
#define KVM_S390_MEMOP_EXTENSION_CAP_CMPXCHG (1 << 1)
610+
603611
/* for KVM_INTERRUPT */
604612
struct kvm_interrupt {
605613
/* in */
@@ -1175,6 +1183,7 @@ struct kvm_ppc_resize_hpt {
11751183
#define KVM_CAP_DIRTY_LOG_RING_ACQ_REL 223
11761184
#define KVM_CAP_S390_PROTECTED_ASYNC_DISABLE 224
11771185
#define KVM_CAP_DIRTY_LOG_RING_WITH_BITMAP 225
1186+
#define KVM_CAP_PMU_EVENT_MASKED_EVENTS 226
11781187

11791188
#ifdef KVM_CAP_IRQ_ROUTING
11801189

0 commit comments

Comments
 (0)