Skip to content

Commit a735099

Browse files
committed
tools headers UAPI: Sync kvm.h headers with the kernel sources
dd53f61 ("Merge tag 'kvmarm-for-v5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD") 59c5c58 ("Merge tag 'kvm-ppc-next-5.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc into HEAD") d7547c5 ("KVM: Introduce KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2") 6520ca6 ("KVM: PPC: Book3S HV: XIVE: Add a mapping for the source ESB pages") 39e9af3 ("KVM: PPC: Book3S HV: XIVE: Add a TIMA mapping") e4945b9 ("KVM: PPC: Book3S HV: XIVE: Add get/set accessors for the VP XIVE state") e6714bd ("KVM: PPC: Book3S HV: XIVE: Add a control to dirty the XIVE EQ pages") 7b46b61 ("KVM: PPC: Book3S HV: XIVE: Add a control to sync the sources") 5ca8064 ("KVM: PPC: Book3S HV: XIVE: Add a global reset control") 13ce329 ("KVM: PPC: Book3S HV: XIVE: Add controls for the EQ configuration") e8676ce ("KVM: PPC: Book3S HV: XIVE: Add a control to configure a source") 4131f83 ("KVM: PPC: Book3S HV: XIVE: add a control to initialize a source") eacc56b ("KVM: PPC: Book3S HV: XIVE: Introduce a new capability KVM_CAP_PPC_IRQ_XIVE") 90c7379 ("KVM: PPC: Book3S HV: Add a new KVM device for the XIVE native exploitation mode") 4f45b90 ("KVM: s390: add deflate conversion facilty to cpu model") a243c16 ("KVM: arm64: Add capability to advertise ptrauth for guest") a22fa32 ("KVM: arm64: Add userspace flag to enable pointer authentication") 4bd774e ("KVM: arm64/sve: Simplify KVM_REG_ARM64_SVE_VLS array sizing") 8ae6efd ("KVM: arm64/sve: Clean up UAPI register ID definitions") 173aec2 ("KVM: s390: add enhanced sort facilty to cpu model") 555f3d0 ("KVM: arm64: Add a capability to advertise SVE support") 9033bba ("KVM: arm64/sve: Add pseudo-register for the guest's vector lengths") 7dd32a0 ("KVM: arm/arm64: Add KVM_ARM_VCPU_FINALIZE ioctl") e1c9c98 ("KVM: arm64/sve: Add SVE support to register access ioctl interface") 2b953ea ("KVM: Allow 2048-bit register access via ioctl interface") None entails changes in tooling, the closest to that were some new arch specific ioctls, that are still not handled by the tools/perf/trace/beauty/ library, that needs to create per-arch tables to convert ioctl cmd->string (and back). From a quick look the arch specific kvm-stat.c files at: $ ls -1 tools/perf/arch/*/util/kvm-stat.c tools/perf/arch/powerpc/util/kvm-stat.c tools/perf/arch/s390/util/kvm-stat.c tools/perf/arch/x86/util/kvm-stat.c $ Are not affected. This silences these perf building 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/powerpc/include/uapi/asm/kvm.h' differs from latest version at 'arch/powerpc/include/uapi/asm/kvm.h' diff -u tools/arch/powerpc/include/uapi/asm/kvm.h arch/powerpc/include/uapi/asm/kvm.h Warning: Kernel ABI header at 'tools/arch/s390/include/uapi/asm/kvm.h' differs from latest version at 'arch/s390/include/uapi/asm/kvm.h' diff -u tools/arch/s390/include/uapi/asm/kvm.h arch/s390/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: Adrian Hunter <adrian.hunter@intel.com> Cc: Amit Daniel Kachhap <amit.kachhap@arm.com> Cc: Brendan Gregg <brendan.d.gregg@gmail.com> Cc: Cédric Le Goater <clg@kaod.org> Cc: Christian Borntraeger <borntraeger@de.ibm.com> Cc: Dave Martin <Dave.Martin@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com> Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Paul Mackerras <paulus@ozlabs.org> Cc: Peter Xu <peterx@redhat.com> Link: https://lkml.kernel.org/n/tip-3msmqjenlmb7eygcdnmlqaq1@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 6738028 commit a735099

4 files changed

Lines changed: 105 additions & 3 deletions

File tree

  • tools
    • arch
      • arm64/include/uapi/asm
      • powerpc/include/uapi/asm
      • s390/include/uapi/asm
    • include/uapi/linux

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

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include <linux/psci.h>
3636
#include <linux/types.h>
3737
#include <asm/ptrace.h>
38+
#include <asm/sve_context.h>
3839

3940
#define __KVM_HAVE_GUEST_DEBUG
4041
#define __KVM_HAVE_IRQ_LINE
@@ -102,6 +103,9 @@ struct kvm_regs {
102103
#define KVM_ARM_VCPU_EL1_32BIT 1 /* CPU running a 32bit VM */
103104
#define KVM_ARM_VCPU_PSCI_0_2 2 /* CPU uses PSCI v0.2 */
104105
#define KVM_ARM_VCPU_PMU_V3 3 /* Support guest PMUv3 */
106+
#define KVM_ARM_VCPU_SVE 4 /* enable SVE for this CPU */
107+
#define KVM_ARM_VCPU_PTRAUTH_ADDRESS 5 /* VCPU uses address authentication */
108+
#define KVM_ARM_VCPU_PTRAUTH_GENERIC 6 /* VCPU uses generic authentication */
105109

106110
struct kvm_vcpu_init {
107111
__u32 target;
@@ -226,6 +230,45 @@ struct kvm_vcpu_events {
226230
KVM_REG_ARM_FW | ((r) & 0xffff))
227231
#define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0)
228232

233+
/* SVE registers */
234+
#define KVM_REG_ARM64_SVE (0x15 << KVM_REG_ARM_COPROC_SHIFT)
235+
236+
/* Z- and P-regs occupy blocks at the following offsets within this range: */
237+
#define KVM_REG_ARM64_SVE_ZREG_BASE 0
238+
#define KVM_REG_ARM64_SVE_PREG_BASE 0x400
239+
#define KVM_REG_ARM64_SVE_FFR_BASE 0x600
240+
241+
#define KVM_ARM64_SVE_NUM_ZREGS __SVE_NUM_ZREGS
242+
#define KVM_ARM64_SVE_NUM_PREGS __SVE_NUM_PREGS
243+
244+
#define KVM_ARM64_SVE_MAX_SLICES 32
245+
246+
#define KVM_REG_ARM64_SVE_ZREG(n, i) \
247+
(KVM_REG_ARM64 | KVM_REG_ARM64_SVE | KVM_REG_ARM64_SVE_ZREG_BASE | \
248+
KVM_REG_SIZE_U2048 | \
249+
(((n) & (KVM_ARM64_SVE_NUM_ZREGS - 1)) << 5) | \
250+
((i) & (KVM_ARM64_SVE_MAX_SLICES - 1)))
251+
252+
#define KVM_REG_ARM64_SVE_PREG(n, i) \
253+
(KVM_REG_ARM64 | KVM_REG_ARM64_SVE | KVM_REG_ARM64_SVE_PREG_BASE | \
254+
KVM_REG_SIZE_U256 | \
255+
(((n) & (KVM_ARM64_SVE_NUM_PREGS - 1)) << 5) | \
256+
((i) & (KVM_ARM64_SVE_MAX_SLICES - 1)))
257+
258+
#define KVM_REG_ARM64_SVE_FFR(i) \
259+
(KVM_REG_ARM64 | KVM_REG_ARM64_SVE | KVM_REG_ARM64_SVE_FFR_BASE | \
260+
KVM_REG_SIZE_U256 | \
261+
((i) & (KVM_ARM64_SVE_MAX_SLICES - 1)))
262+
263+
#define KVM_ARM64_SVE_VQ_MIN __SVE_VQ_MIN
264+
#define KVM_ARM64_SVE_VQ_MAX __SVE_VQ_MAX
265+
266+
/* Vector lengths pseudo-register: */
267+
#define KVM_REG_ARM64_SVE_VLS (KVM_REG_ARM64 | KVM_REG_ARM64_SVE | \
268+
KVM_REG_SIZE_U512 | 0xffff)
269+
#define KVM_ARM64_SVE_VLS_WORDS \
270+
((KVM_ARM64_SVE_VQ_MAX - KVM_ARM64_SVE_VQ_MIN) / 64 + 1)
271+
229272
/* Device Control API: ARM VGIC */
230273
#define KVM_DEV_ARM_VGIC_GRP_ADDR 0
231274
#define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1

‎tools/arch/powerpc/include/uapi/asm/kvm.h‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,8 @@ struct kvm_ppc_cpu_char {
482482
#define KVM_REG_PPC_ICP_PPRI_SHIFT 16 /* pending irq priority */
483483
#define KVM_REG_PPC_ICP_PPRI_MASK 0xff
484484

485+
#define KVM_REG_PPC_VP_STATE (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x8d)
486+
485487
/* Device control API: PPC-specific devices */
486488
#define KVM_DEV_MPIC_GRP_MISC 1
487489
#define KVM_DEV_MPIC_BASE_ADDR 0 /* 64-bit */
@@ -677,4 +679,48 @@ struct kvm_ppc_cpu_char {
677679
#define KVM_XICS_PRESENTED (1ULL << 43)
678680
#define KVM_XICS_QUEUED (1ULL << 44)
679681

682+
/* POWER9 XIVE Native Interrupt Controller */
683+
#define KVM_DEV_XIVE_GRP_CTRL 1
684+
#define KVM_DEV_XIVE_RESET 1
685+
#define KVM_DEV_XIVE_EQ_SYNC 2
686+
#define KVM_DEV_XIVE_GRP_SOURCE 2 /* 64-bit source identifier */
687+
#define KVM_DEV_XIVE_GRP_SOURCE_CONFIG 3 /* 64-bit source identifier */
688+
#define KVM_DEV_XIVE_GRP_EQ_CONFIG 4 /* 64-bit EQ identifier */
689+
#define KVM_DEV_XIVE_GRP_SOURCE_SYNC 5 /* 64-bit source identifier */
690+
691+
/* Layout of 64-bit XIVE source attribute values */
692+
#define KVM_XIVE_LEVEL_SENSITIVE (1ULL << 0)
693+
#define KVM_XIVE_LEVEL_ASSERTED (1ULL << 1)
694+
695+
/* Layout of 64-bit XIVE source configuration attribute values */
696+
#define KVM_XIVE_SOURCE_PRIORITY_SHIFT 0
697+
#define KVM_XIVE_SOURCE_PRIORITY_MASK 0x7
698+
#define KVM_XIVE_SOURCE_SERVER_SHIFT 3
699+
#define KVM_XIVE_SOURCE_SERVER_MASK 0xfffffff8ULL
700+
#define KVM_XIVE_SOURCE_MASKED_SHIFT 32
701+
#define KVM_XIVE_SOURCE_MASKED_MASK 0x100000000ULL
702+
#define KVM_XIVE_SOURCE_EISN_SHIFT 33
703+
#define KVM_XIVE_SOURCE_EISN_MASK 0xfffffffe00000000ULL
704+
705+
/* Layout of 64-bit EQ identifier */
706+
#define KVM_XIVE_EQ_PRIORITY_SHIFT 0
707+
#define KVM_XIVE_EQ_PRIORITY_MASK 0x7
708+
#define KVM_XIVE_EQ_SERVER_SHIFT 3
709+
#define KVM_XIVE_EQ_SERVER_MASK 0xfffffff8ULL
710+
711+
/* Layout of EQ configuration values (64 bytes) */
712+
struct kvm_ppc_xive_eq {
713+
__u32 flags;
714+
__u32 qshift;
715+
__u64 qaddr;
716+
__u32 qtoggle;
717+
__u32 qindex;
718+
__u8 pad[40];
719+
};
720+
721+
#define KVM_XIVE_EQ_ALWAYS_NOTIFY 0x00000001
722+
723+
#define KVM_XIVE_TIMA_PAGE_OFFSET 0
724+
#define KVM_XIVE_ESB_PAGE_OFFSET 4
725+
680726
#endif /* __LINUX_KVM_POWERPC_H */

‎tools/arch/s390/include/uapi/asm/kvm.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ struct kvm_s390_vm_cpu_subfunc {
153153
__u8 ppno[16]; /* with MSA5 */
154154
__u8 kma[16]; /* with MSA8 */
155155
__u8 kdsa[16]; /* with MSA9 */
156-
__u8 reserved[1792];
156+
__u8 sortl[32]; /* with STFLE.150 */
157+
__u8 dfltcc[32]; /* with STFLE.151 */
158+
__u8 reserved[1728];
157159
};
158160

159161
/* kvm attributes for crypto */

‎tools/include/uapi/linux/kvm.h‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -986,8 +986,13 @@ struct kvm_ppc_resize_hpt {
986986
#define KVM_CAP_HYPERV_ENLIGHTENED_VMCS 163
987987
#define KVM_CAP_EXCEPTION_PAYLOAD 164
988988
#define KVM_CAP_ARM_VM_IPA_SIZE 165
989-
#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT 166
989+
#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT 166 /* Obsolete */
990990
#define KVM_CAP_HYPERV_CPUID 167
991+
#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 168
992+
#define KVM_CAP_PPC_IRQ_XIVE 169
993+
#define KVM_CAP_ARM_SVE 170
994+
#define KVM_CAP_ARM_PTRAUTH_ADDRESS 171
995+
#define KVM_CAP_ARM_PTRAUTH_GENERIC 172
991996

992997
#ifdef KVM_CAP_IRQ_ROUTING
993998

@@ -1145,6 +1150,7 @@ struct kvm_dirty_tlb {
11451150
#define KVM_REG_SIZE_U256 0x0050000000000000ULL
11461151
#define KVM_REG_SIZE_U512 0x0060000000000000ULL
11471152
#define KVM_REG_SIZE_U1024 0x0070000000000000ULL
1153+
#define KVM_REG_SIZE_U2048 0x0080000000000000ULL
11481154

11491155
struct kvm_reg_list {
11501156
__u64 n; /* number of regs */
@@ -1211,6 +1217,8 @@ enum kvm_device_type {
12111217
#define KVM_DEV_TYPE_ARM_VGIC_V3 KVM_DEV_TYPE_ARM_VGIC_V3
12121218
KVM_DEV_TYPE_ARM_VGIC_ITS,
12131219
#define KVM_DEV_TYPE_ARM_VGIC_ITS KVM_DEV_TYPE_ARM_VGIC_ITS
1220+
KVM_DEV_TYPE_XIVE,
1221+
#define KVM_DEV_TYPE_XIVE KVM_DEV_TYPE_XIVE
12141222
KVM_DEV_TYPE_MAX,
12151223
};
12161224

@@ -1434,12 +1442,15 @@ struct kvm_enc_region {
14341442
#define KVM_GET_NESTED_STATE _IOWR(KVMIO, 0xbe, struct kvm_nested_state)
14351443
#define KVM_SET_NESTED_STATE _IOW(KVMIO, 0xbf, struct kvm_nested_state)
14361444

1437-
/* Available with KVM_CAP_MANUAL_DIRTY_LOG_PROTECT */
1445+
/* Available with KVM_CAP_MANUAL_DIRTY_LOG_PROTECT_2 */
14381446
#define KVM_CLEAR_DIRTY_LOG _IOWR(KVMIO, 0xc0, struct kvm_clear_dirty_log)
14391447

14401448
/* Available with KVM_CAP_HYPERV_CPUID */
14411449
#define KVM_GET_SUPPORTED_HV_CPUID _IOWR(KVMIO, 0xc1, struct kvm_cpuid2)
14421450

1451+
/* Available with KVM_CAP_ARM_SVE */
1452+
#define KVM_ARM_VCPU_FINALIZE _IOW(KVMIO, 0xc2, int)
1453+
14431454
/* Secure Encrypted Virtualization command */
14441455
enum sev_cmd_id {
14451456
/* Guest initialization commands */

0 commit comments

Comments
 (0)