aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-04 11:47:12 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-04 11:47:12 -0400
commitb05d59dfceaea72565b1648af929b037b0f96d7f (patch)
treebbe92714be468ed8783bce6ac2c305c0aedf8eb5 /include
parentdaf342af2f7856fd2f5c66b9fb39a8f24986ca53 (diff)
parent820b3fcdeb80d30410f4427d2cbf9161c35fdeef (diff)
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm into next
Pull KVM updates from Paolo Bonzini: "At over 200 commits, covering almost all supported architectures, this was a pretty active cycle for KVM. Changes include: - a lot of s390 changes: optimizations, support for migration, GDB support and more - ARM changes are pretty small: support for the PSCI 0.2 hypercall interface on both the guest and the host (the latter acked by Catalin) - initial POWER8 and little-endian host support - support for running u-boot on embedded POWER targets - pretty large changes to MIPS too, completing the userspace interface and improving the handling of virtualized timer hardware - for x86, a larger set of changes is scheduled for 3.17. Still, we have a few emulator bugfixes and support for running nested fully-virtualized Xen guests (para-virtualized Xen guests have always worked). And some optimizations too. The only missing architecture here is ia64. It's not a coincidence that support for KVM on ia64 is scheduled for removal in 3.17" * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (203 commits) KVM: add missing cleanup_srcu_struct KVM: PPC: Book3S PR: Rework SLB switching code KVM: PPC: Book3S PR: Use SLB entry 0 KVM: PPC: Book3S HV: Fix machine check delivery to guest KVM: PPC: Book3S HV: Work around POWER8 performance monitor bugs KVM: PPC: Book3S HV: Make sure we don't miss dirty pages KVM: PPC: Book3S HV: Fix dirty map for hugepages KVM: PPC: Book3S HV: Put huge-page HPTEs in rmap chain for base address KVM: PPC: Book3S HV: Fix check for running inside guest in global_invalidates() KVM: PPC: Book3S: Move KVM_REG_PPC_WORT to an unused register number KVM: PPC: Book3S: Add ONE_REG register names that were missed KVM: PPC: Add CAP to indicate hcall fixes KVM: PPC: MPIC: Reset IRQ source private members KVM: PPC: Graciously fail broken LE hypercalls PPC: ePAPR: Fix hypercall on LE guest KVM: PPC: BOOK3S: Remove open coded make_dsisr in alignment handler KVM: PPC: BOOK3S: Always use the saved DAR value PPC: KVM: Make NX bit available with magic page KVM: PPC: Disable NX for old magic page using guests KVM: PPC: BOOK3S: HV: Add mixed page-size support for guest ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/kvm_host.h15
-rw-r--r--include/uapi/linux/Kbuild1
-rw-r--r--include/uapi/linux/kvm.h17
-rw-r--r--include/uapi/linux/psci.h90
4 files changed, 119 insertions, 4 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 7d21cf9f4380..970c68197c69 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -134,6 +134,8 @@ static inline bool is_error_page(struct page *page)
134#define KVM_REQ_EPR_EXIT 20 134#define KVM_REQ_EPR_EXIT 20
135#define KVM_REQ_SCAN_IOAPIC 21 135#define KVM_REQ_SCAN_IOAPIC 21
136#define KVM_REQ_GLOBAL_CLOCK_UPDATE 22 136#define KVM_REQ_GLOBAL_CLOCK_UPDATE 22
137#define KVM_REQ_ENABLE_IBS 23
138#define KVM_REQ_DISABLE_IBS 24
137 139
138#define KVM_USERSPACE_IRQ_SOURCE_ID 0 140#define KVM_USERSPACE_IRQ_SOURCE_ID 0
139#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1 141#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1
@@ -163,6 +165,7 @@ enum kvm_bus {
163 KVM_MMIO_BUS, 165 KVM_MMIO_BUS,
164 KVM_PIO_BUS, 166 KVM_PIO_BUS,
165 KVM_VIRTIO_CCW_NOTIFY_BUS, 167 KVM_VIRTIO_CCW_NOTIFY_BUS,
168 KVM_FAST_MMIO_BUS,
166 KVM_NR_BUSES 169 KVM_NR_BUSES
167}; 170};
168 171
@@ -367,6 +370,7 @@ struct kvm {
367 struct mm_struct *mm; /* userspace tied to this vm */ 370 struct mm_struct *mm; /* userspace tied to this vm */
368 struct kvm_memslots *memslots; 371 struct kvm_memslots *memslots;
369 struct srcu_struct srcu; 372 struct srcu_struct srcu;
373 struct srcu_struct irq_srcu;
370#ifdef CONFIG_KVM_APIC_ARCHITECTURE 374#ifdef CONFIG_KVM_APIC_ARCHITECTURE
371 u32 bsp_vcpu_id; 375 u32 bsp_vcpu_id;
372#endif 376#endif
@@ -410,9 +414,7 @@ struct kvm {
410 unsigned long mmu_notifier_seq; 414 unsigned long mmu_notifier_seq;
411 long mmu_notifier_count; 415 long mmu_notifier_count;
412#endif 416#endif
413 /* Protected by mmu_lock */ 417 long tlbs_dirty;
414 bool tlbs_dirty;
415
416 struct list_head devices; 418 struct list_head devices;
417}; 419};
418 420
@@ -879,6 +881,13 @@ static inline hpa_t pfn_to_hpa(pfn_t pfn)
879 return (hpa_t)pfn << PAGE_SHIFT; 881 return (hpa_t)pfn << PAGE_SHIFT;
880} 882}
881 883
884static inline bool kvm_is_error_gpa(struct kvm *kvm, gpa_t gpa)
885{
886 unsigned long hva = gfn_to_hva(kvm, gpa_to_gfn(gpa));
887
888 return kvm_is_error_hva(hva);
889}
890
882static inline void kvm_migrate_timers(struct kvm_vcpu *vcpu) 891static inline void kvm_migrate_timers(struct kvm_vcpu *vcpu)
883{ 892{
884 set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests); 893 set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests);
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index 6929571b79b0..24e9033f8b3f 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -317,6 +317,7 @@ header-y += ppp-ioctl.h
317header-y += ppp_defs.h 317header-y += ppp_defs.h
318header-y += pps.h 318header-y += pps.h
319header-y += prctl.h 319header-y += prctl.h
320header-y += psci.h
320header-y += ptp_clock.h 321header-y += ptp_clock.h
321header-y += ptrace.h 322header-y += ptrace.h
322header-y += qnx4_fs.h 323header-y += qnx4_fs.h
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index a8f4ee5d2e82..e11d8f170a62 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -171,6 +171,7 @@ struct kvm_pit_config {
171#define KVM_EXIT_WATCHDOG 21 171#define KVM_EXIT_WATCHDOG 21
172#define KVM_EXIT_S390_TSCH 22 172#define KVM_EXIT_S390_TSCH 22
173#define KVM_EXIT_EPR 23 173#define KVM_EXIT_EPR 23
174#define KVM_EXIT_SYSTEM_EVENT 24
174 175
175/* For KVM_EXIT_INTERNAL_ERROR */ 176/* For KVM_EXIT_INTERNAL_ERROR */
176/* Emulate instruction failed. */ 177/* Emulate instruction failed. */
@@ -301,6 +302,13 @@ struct kvm_run {
301 struct { 302 struct {
302 __u32 epr; 303 __u32 epr;
303 } epr; 304 } epr;
305 /* KVM_EXIT_SYSTEM_EVENT */
306 struct {
307#define KVM_SYSTEM_EVENT_SHUTDOWN 1
308#define KVM_SYSTEM_EVENT_RESET 2
309 __u32 type;
310 __u64 flags;
311 } system_event;
304 /* Fix the size of the union. */ 312 /* Fix the size of the union. */
305 char padding[256]; 313 char padding[256];
306 }; 314 };
@@ -416,6 +424,8 @@ struct kvm_s390_psw {
416#define KVM_S390_INT_PFAULT_INIT 0xfffe0004u 424#define KVM_S390_INT_PFAULT_INIT 0xfffe0004u
417#define KVM_S390_INT_PFAULT_DONE 0xfffe0005u 425#define KVM_S390_INT_PFAULT_DONE 0xfffe0005u
418#define KVM_S390_MCHK 0xfffe1000u 426#define KVM_S390_MCHK 0xfffe1000u
427#define KVM_S390_INT_CLOCK_COMP 0xffff1004u
428#define KVM_S390_INT_CPU_TIMER 0xffff1005u
419#define KVM_S390_INT_VIRTIO 0xffff2603u 429#define KVM_S390_INT_VIRTIO 0xffff2603u
420#define KVM_S390_INT_SERVICE 0xffff2401u 430#define KVM_S390_INT_SERVICE 0xffff2401u
421#define KVM_S390_INT_EMERGENCY 0xffff1201u 431#define KVM_S390_INT_EMERGENCY 0xffff1201u
@@ -515,6 +525,7 @@ enum {
515 kvm_ioeventfd_flag_nr_pio, 525 kvm_ioeventfd_flag_nr_pio,
516 kvm_ioeventfd_flag_nr_deassign, 526 kvm_ioeventfd_flag_nr_deassign,
517 kvm_ioeventfd_flag_nr_virtio_ccw_notify, 527 kvm_ioeventfd_flag_nr_virtio_ccw_notify,
528 kvm_ioeventfd_flag_nr_fast_mmio,
518 kvm_ioeventfd_flag_nr_max, 529 kvm_ioeventfd_flag_nr_max,
519}; 530};
520 531
@@ -529,7 +540,7 @@ enum {
529struct kvm_ioeventfd { 540struct kvm_ioeventfd {
530 __u64 datamatch; 541 __u64 datamatch;
531 __u64 addr; /* legal pio/mmio address */ 542 __u64 addr; /* legal pio/mmio address */
532 __u32 len; /* 1, 2, 4, or 8 bytes */ 543 __u32 len; /* 1, 2, 4, or 8 bytes; or 0 to ignore length */
533 __s32 fd; 544 __s32 fd;
534 __u32 flags; 545 __u32 flags;
535 __u8 pad[36]; 546 __u8 pad[36];
@@ -743,6 +754,10 @@ struct kvm_ppc_smmu_info {
743#define KVM_CAP_IOAPIC_POLARITY_IGNORED 97 754#define KVM_CAP_IOAPIC_POLARITY_IGNORED 97
744#define KVM_CAP_ENABLE_CAP_VM 98 755#define KVM_CAP_ENABLE_CAP_VM 98
745#define KVM_CAP_S390_IRQCHIP 99 756#define KVM_CAP_S390_IRQCHIP 99
757#define KVM_CAP_IOEVENTFD_NO_LENGTH 100
758#define KVM_CAP_VM_ATTRIBUTES 101
759#define KVM_CAP_ARM_PSCI_0_2 102
760#define KVM_CAP_PPC_FIXUP_HCALL 103
746 761
747#ifdef KVM_CAP_IRQ_ROUTING 762#ifdef KVM_CAP_IRQ_ROUTING
748 763
diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h
new file mode 100644
index 000000000000..310d83e0a91b
--- /dev/null
+++ b/include/uapi/linux/psci.h
@@ -0,0 +1,90 @@
1/*
2 * ARM Power State and Coordination Interface (PSCI) header
3 *
4 * This header holds common PSCI defines and macros shared
5 * by: ARM kernel, ARM64 kernel, KVM ARM/ARM64 and user space.
6 *
7 * Copyright (C) 2014 Linaro Ltd.
8 * Author: Anup Patel <anup.patel@linaro.org>
9 */
10
11#ifndef _UAPI_LINUX_PSCI_H
12#define _UAPI_LINUX_PSCI_H
13
14/*
15 * PSCI v0.1 interface
16 *
17 * The PSCI v0.1 function numbers are implementation defined.
18 *
19 * Only PSCI return values such as: SUCCESS, NOT_SUPPORTED,
20 * INVALID_PARAMS, and DENIED defined below are applicable
21 * to PSCI v0.1.
22 */
23
24/* PSCI v0.2 interface */
25#define PSCI_0_2_FN_BASE 0x84000000
26#define PSCI_0_2_FN(n) (PSCI_0_2_FN_BASE + (n))
27#define PSCI_0_2_64BIT 0x40000000
28#define PSCI_0_2_FN64_BASE \
29 (PSCI_0_2_FN_BASE + PSCI_0_2_64BIT)
30#define PSCI_0_2_FN64(n) (PSCI_0_2_FN64_BASE + (n))
31
32#define PSCI_0_2_FN_PSCI_VERSION PSCI_0_2_FN(0)
33#define PSCI_0_2_FN_CPU_SUSPEND PSCI_0_2_FN(1)
34#define PSCI_0_2_FN_CPU_OFF PSCI_0_2_FN(2)
35#define PSCI_0_2_FN_CPU_ON PSCI_0_2_FN(3)
36#define PSCI_0_2_FN_AFFINITY_INFO PSCI_0_2_FN(4)
37#define PSCI_0_2_FN_MIGRATE PSCI_0_2_FN(5)
38#define PSCI_0_2_FN_MIGRATE_INFO_TYPE PSCI_0_2_FN(6)
39#define PSCI_0_2_FN_MIGRATE_INFO_UP_CPU PSCI_0_2_FN(7)
40#define PSCI_0_2_FN_SYSTEM_OFF PSCI_0_2_FN(8)
41#define PSCI_0_2_FN_SYSTEM_RESET PSCI_0_2_FN(9)
42
43#define PSCI_0_2_FN64_CPU_SUSPEND PSCI_0_2_FN64(1)
44#define PSCI_0_2_FN64_CPU_ON PSCI_0_2_FN64(3)
45#define PSCI_0_2_FN64_AFFINITY_INFO PSCI_0_2_FN64(4)
46#define PSCI_0_2_FN64_MIGRATE PSCI_0_2_FN64(5)
47#define PSCI_0_2_FN64_MIGRATE_INFO_UP_CPU PSCI_0_2_FN64(7)
48
49/* PSCI v0.2 power state encoding for CPU_SUSPEND function */
50#define PSCI_0_2_POWER_STATE_ID_MASK 0xffff
51#define PSCI_0_2_POWER_STATE_ID_SHIFT 0
52#define PSCI_0_2_POWER_STATE_TYPE_SHIFT 16
53#define PSCI_0_2_POWER_STATE_TYPE_MASK \
54 (0x1 << PSCI_0_2_POWER_STATE_TYPE_SHIFT)
55#define PSCI_0_2_POWER_STATE_AFFL_SHIFT 24
56#define PSCI_0_2_POWER_STATE_AFFL_MASK \
57 (0x3 << PSCI_0_2_POWER_STATE_AFFL_SHIFT)
58
59/* PSCI v0.2 affinity level state returned by AFFINITY_INFO */
60#define PSCI_0_2_AFFINITY_LEVEL_ON 0
61#define PSCI_0_2_AFFINITY_LEVEL_OFF 1
62#define PSCI_0_2_AFFINITY_LEVEL_ON_PENDING 2
63
64/* PSCI v0.2 multicore support in Trusted OS returned by MIGRATE_INFO_TYPE */
65#define PSCI_0_2_TOS_UP_MIGRATE 0
66#define PSCI_0_2_TOS_UP_NO_MIGRATE 1
67#define PSCI_0_2_TOS_MP 2
68
69/* PSCI version decoding (independent of PSCI version) */
70#define PSCI_VERSION_MAJOR_SHIFT 16
71#define PSCI_VERSION_MINOR_MASK \
72 ((1U << PSCI_VERSION_MAJOR_SHIFT) - 1)
73#define PSCI_VERSION_MAJOR_MASK ~PSCI_VERSION_MINOR_MASK
74#define PSCI_VERSION_MAJOR(ver) \
75 (((ver) & PSCI_VERSION_MAJOR_MASK) >> PSCI_VERSION_MAJOR_SHIFT)
76#define PSCI_VERSION_MINOR(ver) \
77 ((ver) & PSCI_VERSION_MINOR_MASK)
78
79/* PSCI return values (inclusive of all PSCI versions) */
80#define PSCI_RET_SUCCESS 0
81#define PSCI_RET_NOT_SUPPORTED -1
82#define PSCI_RET_INVALID_PARAMS -2
83#define PSCI_RET_DENIED -3
84#define PSCI_RET_ALREADY_ON -4
85#define PSCI_RET_ON_PENDING -5
86#define PSCI_RET_INTERNAL_FAILURE -6
87#define PSCI_RET_NOT_PRESENT -7
88#define PSCI_RET_DISABLED -8
89
90#endif /* _UAPI_LINUX_PSCI_H */