Skip to content

Commit 705049c

Browse files
Yanteng Siacmel
authored andcommitted
tools headers kvm: Sync uapi/{asm/linux} kvm.h headers with the kernel sources
Picking the changes from: e65733b ("KVM: x86: Redefine 'longmode' as a flag for KVM_EXIT_HYPERCALL") 30ec799 ("KVM: arm64: timers: Allow userspace to set the global counter offset") 821d935 ("KVM: arm64: Introduce support for userspace SMCCC filtering") 81dc950 ("KVM: arm64: nv: timers: Support hyp timer emulation") a8308b3 ("KVM: arm64: Refactor hvc filtering to support different actions") 0e5c9a9 ("KVM: arm64: Expose SMC/HVC width to userspace") Silencing 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 Signed-off-by: Yanteng Si <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/ac5adb58411d23b3360d436a65038fefe91c32a8.1683712945.git.siyanteng@loongson.cn Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 8d6a41c commit 705049c

File tree

3 files changed

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

3 files changed

+49
-2
lines changed

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,15 @@ struct kvm_arm_copy_mte_tags {
198198
__u64 reserved[2];
199199
};
200200

201+
/*
202+
* Counter/Timer offset structure. Describe the virtual/physical offset.
203+
* To be used with KVM_ARM_SET_COUNTER_OFFSET.
204+
*/
205+
struct kvm_arm_counter_offset {
206+
__u64 counter_offset;
207+
__u64 reserved;
208+
};
209+
201210
#define KVM_ARM_TAGS_TO_GUEST 0
202211
#define KVM_ARM_TAGS_FROM_GUEST 1
203212

@@ -372,6 +381,10 @@ enum {
372381
#endif
373382
};
374383

384+
/* Device Control API on vm fd */
385+
#define KVM_ARM_VM_SMCCC_CTRL 0
386+
#define KVM_ARM_VM_SMCCC_FILTER 0
387+
375388
/* Device Control API: ARM VGIC */
376389
#define KVM_DEV_ARM_VGIC_GRP_ADDR 0
377390
#define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1
@@ -411,6 +424,8 @@ enum {
411424
#define KVM_ARM_VCPU_TIMER_CTRL 1
412425
#define KVM_ARM_VCPU_TIMER_IRQ_VTIMER 0
413426
#define KVM_ARM_VCPU_TIMER_IRQ_PTIMER 1
427+
#define KVM_ARM_VCPU_TIMER_IRQ_HVTIMER 2
428+
#define KVM_ARM_VCPU_TIMER_IRQ_HPTIMER 3
414429
#define KVM_ARM_VCPU_PVTIME_CTRL 2
415430
#define KVM_ARM_VCPU_PVTIME_IPA 0
416431

@@ -469,6 +484,27 @@ enum {
469484
/* run->fail_entry.hardware_entry_failure_reason codes. */
470485
#define KVM_EXIT_FAIL_ENTRY_CPU_UNSUPPORTED (1ULL << 0)
471486

487+
enum kvm_smccc_filter_action {
488+
KVM_SMCCC_FILTER_HANDLE = 0,
489+
KVM_SMCCC_FILTER_DENY,
490+
KVM_SMCCC_FILTER_FWD_TO_USER,
491+
492+
#ifdef __KERNEL__
493+
NR_SMCCC_FILTER_ACTIONS
494+
#endif
495+
};
496+
497+
struct kvm_smccc_filter {
498+
__u32 base;
499+
__u32 nr_functions;
500+
__u8 action;
501+
__u8 pad[15];
502+
};
503+
504+
/* arm64-specific KVM_EXIT_HYPERCALL flags */
505+
#define KVM_HYPERCALL_EXIT_SMC (1U << 0)
506+
#define KVM_HYPERCALL_EXIT_16BIT (1U << 1)
507+
472508
#endif
473509

474510
#endif /* __ARM_KVM_H__ */

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,4 +559,7 @@ struct kvm_pmu_event_filter {
559559
#define KVM_VCPU_TSC_CTRL 0 /* control group for the timestamp counter (TSC) */
560560
#define KVM_VCPU_TSC_OFFSET 0 /* attribute for the TSC offset */
561561

562+
/* x86-specific KVM_EXIT_HYPERCALL flags. */
563+
#define KVM_EXIT_HYPERCALL_LONG_MODE BIT(0)
564+
562565
#endif /* _ASM_X86_KVM_H */

tools/include/uapi/linux/kvm.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,13 @@ struct kvm_run {
341341
__u64 nr;
342342
__u64 args[6];
343343
__u64 ret;
344-
__u32 longmode;
345-
__u32 pad;
344+
345+
union {
346+
#ifndef __KERNEL__
347+
__u32 longmode;
348+
#endif
349+
__u64 flags;
350+
};
346351
} hypercall;
347352
/* KVM_EXIT_TPR_ACCESS */
348353
struct {
@@ -1184,6 +1189,7 @@ struct kvm_ppc_resize_hpt {
11841189
#define KVM_CAP_S390_PROTECTED_ASYNC_DISABLE 224
11851190
#define KVM_CAP_DIRTY_LOG_RING_WITH_BITMAP 225
11861191
#define KVM_CAP_PMU_EVENT_MASKED_EVENTS 226
1192+
#define KVM_CAP_COUNTER_OFFSET 227
11871193

11881194
#ifdef KVM_CAP_IRQ_ROUTING
11891195

@@ -1543,6 +1549,8 @@ struct kvm_s390_ucas_mapping {
15431549
#define KVM_SET_PMU_EVENT_FILTER _IOW(KVMIO, 0xb2, struct kvm_pmu_event_filter)
15441550
#define KVM_PPC_SVM_OFF _IO(KVMIO, 0xb3)
15451551
#define KVM_ARM_MTE_COPY_TAGS _IOR(KVMIO, 0xb4, struct kvm_arm_copy_mte_tags)
1552+
/* Available with KVM_CAP_COUNTER_OFFSET */
1553+
#define KVM_ARM_SET_COUNTER_OFFSET _IOW(KVMIO, 0xb5, struct kvm_arm_counter_offset)
15461554

15471555
/* ioctl for vm fd */
15481556
#define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device)

0 commit comments

Comments
 (0)