Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 66cdd0ce authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull KVM updates from Marcelo Tosatti:
 "Considerable KVM/PPC work, x86 kvmclock vsyscall support,
  IA32_TSC_ADJUST MSR emulation, amongst others."

Fix up trivial conflict in kernel/sched/core.c due to cross-cpu
migration notifier added next to rq migration call-back.

* tag 'kvm-3.8-1' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (156 commits)
  KVM: emulator: fix real mode segment checks in address linearization
  VMX: remove unneeded enable_unrestricted_guest check
  KVM: VMX: fix DPL during entry to protected mode
  x86/kexec: crash_vmclear_local_vmcss needs __rcu
  kvm: Fix irqfd resampler list walk
  KVM: VMX: provide the vmclear function and a bitmap to support VMCLEAR in kdump
  x86/kexec: VMCLEAR VMCSs loaded on all cpus if necessary
  KVM: MMU: optimize for set_spte
  KVM: PPC: booke: Get/set guest EPCR register using ONE_REG interface
  KVM: PPC: bookehv: Add EPCR support in mtspr/mfspr emulation
  KVM: PPC: bookehv: Add guest computation mode for irq delivery
  KVM: PPC: Make EPCR a valid field for booke64 and bookehv
  KVM: PPC: booke: Extend MAS2 EPN mask for 64-bit
  KVM: PPC: e500: Mask MAS2 EPN high 32-bits in 32/64 tlbwe emulation
  KVM: PPC: Mask ea's high 32-bits in 32/64 instr emulation
  KVM: PPC: e500: Add emulation helper for getting instruction ea
  KVM: PPC: bookehv64: Add support for interrupt handling
  KVM: PPC: bookehv: Remove GET_VCPU macro from exception handler
  KVM: PPC: booke: Fix get_tb() compile error on 64-bit
  KVM: PPC: e500: Silence bogus GCC warning in tlb code
  ...
parents 896ea17d 58b7825b
Loading
Loading
Loading
Loading
+135 −5
Original line number Original line Diff line number Diff line
@@ -1194,12 +1194,15 @@ struct kvm_ppc_pvinfo {
This ioctl fetches PV specific information that need to be passed to the guest
This ioctl fetches PV specific information that need to be passed to the guest
using the device tree or other means from vm context.
using the device tree or other means from vm context.


For now the only implemented piece of information distributed here is an array
The hcall array defines 4 instructions that make up a hypercall.
of 4 instructions that make up a hypercall.


If any additional field gets added to this structure later on, a bit for that
If any additional field gets added to this structure later on, a bit for that
additional piece of information will be set in the flags bitmap.
additional piece of information will be set in the flags bitmap.


The flags bitmap is defined as:

   /* the host supports the ePAPR idle hcall
   #define KVM_PPC_PVINFO_FLAGS_EV_IDLE   (1<<0)


4.48 KVM_ASSIGN_PCI_DEVICE
4.48 KVM_ASSIGN_PCI_DEVICE


@@ -1731,7 +1734,46 @@ registers, find a list below:
  Arch  |       Register        | Width (bits)
  Arch  |       Register        | Width (bits)
        |                       |
        |                       |
  PPC   | KVM_REG_PPC_HIOR      | 64
  PPC   | KVM_REG_PPC_HIOR      | 64

  PPC   | KVM_REG_PPC_IAC1      | 64
  PPC   | KVM_REG_PPC_IAC2      | 64
  PPC   | KVM_REG_PPC_IAC3      | 64
  PPC   | KVM_REG_PPC_IAC4      | 64
  PPC   | KVM_REG_PPC_DAC1      | 64
  PPC   | KVM_REG_PPC_DAC2      | 64
  PPC   | KVM_REG_PPC_DABR      | 64
  PPC   | KVM_REG_PPC_DSCR      | 64
  PPC   | KVM_REG_PPC_PURR      | 64
  PPC   | KVM_REG_PPC_SPURR     | 64
  PPC   | KVM_REG_PPC_DAR       | 64
  PPC   | KVM_REG_PPC_DSISR     | 32
  PPC   | KVM_REG_PPC_AMR       | 64
  PPC   | KVM_REG_PPC_UAMOR     | 64
  PPC   | KVM_REG_PPC_MMCR0     | 64
  PPC   | KVM_REG_PPC_MMCR1     | 64
  PPC   | KVM_REG_PPC_MMCRA     | 64
  PPC   | KVM_REG_PPC_PMC1      | 32
  PPC   | KVM_REG_PPC_PMC2      | 32
  PPC   | KVM_REG_PPC_PMC3      | 32
  PPC   | KVM_REG_PPC_PMC4      | 32
  PPC   | KVM_REG_PPC_PMC5      | 32
  PPC   | KVM_REG_PPC_PMC6      | 32
  PPC   | KVM_REG_PPC_PMC7      | 32
  PPC   | KVM_REG_PPC_PMC8      | 32
  PPC   | KVM_REG_PPC_FPR0      | 64
          ...
  PPC   | KVM_REG_PPC_FPR31     | 64
  PPC   | KVM_REG_PPC_VR0       | 128
          ...
  PPC   | KVM_REG_PPC_VR31      | 128
  PPC   | KVM_REG_PPC_VSR0      | 128
          ...
  PPC   | KVM_REG_PPC_VSR31     | 128
  PPC   | KVM_REG_PPC_FPSCR     | 64
  PPC   | KVM_REG_PPC_VSCR      | 32
  PPC   | KVM_REG_PPC_VPA_ADDR  | 64
  PPC   | KVM_REG_PPC_VPA_SLB   | 128
  PPC   | KVM_REG_PPC_VPA_DTL   | 128
  PPC   | KVM_REG_PPC_EPCR	| 32


4.69 KVM_GET_ONE_REG
4.69 KVM_GET_ONE_REG


@@ -1747,7 +1789,7 @@ kvm_one_reg struct passed in. On success, the register value can be found
at the memory location pointed to by "addr".
at the memory location pointed to by "addr".


The list of registers accessible using this interface is identical to the
The list of registers accessible using this interface is identical to the
list in 4.64.
list in 4.68.




4.70 KVM_KVMCLOCK_CTRL
4.70 KVM_KVMCLOCK_CTRL
@@ -1997,6 +2039,93 @@ return the hash table order in the parameter. (If the guest is using
the virtualized real-mode area (VRMA) facility, the kernel will
the virtualized real-mode area (VRMA) facility, the kernel will
re-create the VMRA HPTEs on the next KVM_RUN of any vcpu.)
re-create the VMRA HPTEs on the next KVM_RUN of any vcpu.)


4.77 KVM_S390_INTERRUPT

Capability: basic
Architectures: s390
Type: vm ioctl, vcpu ioctl
Parameters: struct kvm_s390_interrupt (in)
Returns: 0 on success, -1 on error

Allows to inject an interrupt to the guest. Interrupts can be floating
(vm ioctl) or per cpu (vcpu ioctl), depending on the interrupt type.

Interrupt parameters are passed via kvm_s390_interrupt:

struct kvm_s390_interrupt {
	__u32 type;
	__u32 parm;
	__u64 parm64;
};

type can be one of the following:

KVM_S390_SIGP_STOP (vcpu) - sigp restart
KVM_S390_PROGRAM_INT (vcpu) - program check; code in parm
KVM_S390_SIGP_SET_PREFIX (vcpu) - sigp set prefix; prefix address in parm
KVM_S390_RESTART (vcpu) - restart
KVM_S390_INT_VIRTIO (vm) - virtio external interrupt; external interrupt
			   parameters in parm and parm64
KVM_S390_INT_SERVICE (vm) - sclp external interrupt; sclp parameter in parm
KVM_S390_INT_EMERGENCY (vcpu) - sigp emergency; source cpu in parm
KVM_S390_INT_EXTERNAL_CALL (vcpu) - sigp external call; source cpu in parm

Note that the vcpu ioctl is asynchronous to vcpu execution.

4.78 KVM_PPC_GET_HTAB_FD

Capability: KVM_CAP_PPC_HTAB_FD
Architectures: powerpc
Type: vm ioctl
Parameters: Pointer to struct kvm_get_htab_fd (in)
Returns: file descriptor number (>= 0) on success, -1 on error

This returns a file descriptor that can be used either to read out the
entries in the guest's hashed page table (HPT), or to write entries to
initialize the HPT.  The returned fd can only be written to if the
KVM_GET_HTAB_WRITE bit is set in the flags field of the argument, and
can only be read if that bit is clear.  The argument struct looks like
this:

/* For KVM_PPC_GET_HTAB_FD */
struct kvm_get_htab_fd {
	__u64	flags;
	__u64	start_index;
	__u64	reserved[2];
};

/* Values for kvm_get_htab_fd.flags */
#define KVM_GET_HTAB_BOLTED_ONLY	((__u64)0x1)
#define KVM_GET_HTAB_WRITE		((__u64)0x2)

The `start_index' field gives the index in the HPT of the entry at
which to start reading.  It is ignored when writing.

Reads on the fd will initially supply information about all
"interesting" HPT entries.  Interesting entries are those with the
bolted bit set, if the KVM_GET_HTAB_BOLTED_ONLY bit is set, otherwise
all entries.  When the end of the HPT is reached, the read() will
return.  If read() is called again on the fd, it will start again from
the beginning of the HPT, but will only return HPT entries that have
changed since they were last read.

Data read or written is structured as a header (8 bytes) followed by a
series of valid HPT entries (16 bytes) each.  The header indicates how
many valid HPT entries there are and how many invalid entries follow
the valid entries.  The invalid entries are not represented explicitly
in the stream.  The header format is:

struct kvm_get_htab_header {
	__u32	index;
	__u16	n_valid;
	__u16	n_invalid;
};

Writes to the fd create HPT entries starting at the index given in the
header; first `n_valid' valid entries with contents from the data
written, then `n_invalid' invalid entries, invalidating any previously
valid entries found.



5. The kvm_run structure
5. The kvm_run structure
------------------------
------------------------
@@ -2109,7 +2238,8 @@ executed a memory-mapped I/O instruction which could not be satisfied
by kvm.  The 'data' member contains the written data if 'is_write' is
by kvm.  The 'data' member contains the written data if 'is_write' is
true, and should be filled by application code otherwise.
true, and should be filled by application code otherwise.


NOTE: For KVM_EXIT_IO, KVM_EXIT_MMIO and KVM_EXIT_OSI, the corresponding
NOTE: For KVM_EXIT_IO, KVM_EXIT_MMIO, KVM_EXIT_OSI, KVM_EXIT_DCR
      and KVM_EXIT_PAPR the corresponding
operations are complete (and guest state is consistent) only after userspace
operations are complete (and guest state is consistent) only after userspace
has re-entered the kernel with KVM_RUN.  The kernel side will first finish
has re-entered the kernel with KVM_RUN.  The kernel side will first finish
incomplete operations and then check for pending signals.  Userspace
incomplete operations and then check for pending signals.  Userspace
+3 −2
Original line number Original line Diff line number Diff line
@@ -4314,10 +4314,10 @@ F: include/linux/kvm*
F:	virt/kvm/
F:	virt/kvm/


KERNEL VIRTUAL MACHINE (KVM) FOR AMD-V
KERNEL VIRTUAL MACHINE (KVM) FOR AMD-V
M:	Joerg Roedel <joerg.roedel@amd.com>
M:	Joerg Roedel <joro@8bytes.org>
L:	kvm@vger.kernel.org
L:	kvm@vger.kernel.org
W:	http://kvm.qumranet.com
W:	http://kvm.qumranet.com
S:	Supported
S:	Maintained
F:	arch/x86/include/asm/svm.h
F:	arch/x86/include/asm/svm.h
F:	arch/x86/kvm/svm.c
F:	arch/x86/kvm/svm.c


@@ -4325,6 +4325,7 @@ KERNEL VIRTUAL MACHINE (KVM) FOR POWERPC
M:	Alexander Graf <agraf@suse.de>
M:	Alexander Graf <agraf@suse.de>
L:	kvm-ppc@vger.kernel.org
L:	kvm-ppc@vger.kernel.org
W:	http://kvm.qumranet.com
W:	http://kvm.qumranet.com
T:	git git://github.com/agraf/linux-2.6.git
S:	Supported
S:	Supported
F:	arch/powerpc/include/asm/kvm*
F:	arch/powerpc/include/asm/kvm*
F:	arch/powerpc/kvm/
F:	arch/powerpc/kvm/
+5 −2
Original line number Original line Diff line number Diff line
@@ -1330,6 +1330,11 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
	return 0;
	return 0;
}
}


int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
{
	return 0;
}

int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
{
{
	return -EINVAL;
	return -EINVAL;
@@ -1362,11 +1367,9 @@ static void kvm_release_vm_pages(struct kvm *kvm)
	struct kvm_memslots *slots;
	struct kvm_memslots *slots;
	struct kvm_memory_slot *memslot;
	struct kvm_memory_slot *memslot;
	int j;
	int j;
	unsigned long base_gfn;


	slots = kvm_memslots(kvm);
	slots = kvm_memslots(kvm);
	kvm_for_each_memslot(memslot, slots) {
	kvm_for_each_memslot(memslot, slots) {
		base_gfn = memslot->base_gfn;
		for (j = 0; j < memslot->npages; j++) {
		for (j = 0; j < memslot->npages; j++) {
			if (memslot->rmap[j])
			if (memslot->rmap[j])
				put_page((struct page *)memslot->rmap[j]);
				put_page((struct page *)memslot->rmap[j]);
+0 −1
Original line number Original line Diff line number Diff line



generic-y += clkdev.h
generic-y += clkdev.h
generic-y += rwsem.h
generic-y += rwsem.h
generic-y += trace_clock.h
generic-y += trace_clock.h
+16 −67
Original line number Original line Diff line number Diff line
@@ -50,64 +50,13 @@
#ifndef _EPAPR_HCALLS_H
#ifndef _EPAPR_HCALLS_H
#define _EPAPR_HCALLS_H
#define _EPAPR_HCALLS_H


#include <uapi/asm/epapr_hcalls.h>

#ifndef __ASSEMBLY__
#include <linux/types.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/errno.h>
#include <asm/byteorder.h>
#include <asm/byteorder.h>


#define EV_BYTE_CHANNEL_SEND		1
#define EV_BYTE_CHANNEL_RECEIVE		2
#define EV_BYTE_CHANNEL_POLL		3
#define EV_INT_SET_CONFIG		4
#define EV_INT_GET_CONFIG		5
#define EV_INT_SET_MASK			6
#define EV_INT_GET_MASK			7
#define EV_INT_IACK			9
#define EV_INT_EOI			10
#define EV_INT_SEND_IPI			11
#define EV_INT_SET_TASK_PRIORITY	12
#define EV_INT_GET_TASK_PRIORITY	13
#define EV_DOORBELL_SEND		14
#define EV_MSGSND			15
#define EV_IDLE				16

/* vendor ID: epapr */
#define EV_LOCAL_VENDOR_ID		0	/* for private use */
#define EV_EPAPR_VENDOR_ID		1
#define EV_FSL_VENDOR_ID		2	/* Freescale Semiconductor */
#define EV_IBM_VENDOR_ID		3	/* IBM */
#define EV_GHS_VENDOR_ID		4	/* Green Hills Software */
#define EV_ENEA_VENDOR_ID		5	/* Enea */
#define EV_WR_VENDOR_ID			6	/* Wind River Systems */
#define EV_AMCC_VENDOR_ID		7	/* Applied Micro Circuits */
#define EV_KVM_VENDOR_ID		42	/* KVM */

/* The max number of bytes that a byte channel can send or receive per call */
#define EV_BYTE_CHANNEL_MAX_BYTES	16


#define _EV_HCALL_TOKEN(id, num) (((id) << 16) | (num))
#define EV_HCALL_TOKEN(hcall_num) _EV_HCALL_TOKEN(EV_EPAPR_VENDOR_ID, hcall_num)

/* epapr error codes */
#define EV_EPERM		1	/* Operation not permitted */
#define EV_ENOENT		2	/*  Entry Not Found */
#define EV_EIO			3	/* I/O error occured */
#define EV_EAGAIN		4	/* The operation had insufficient
					 * resources to complete and should be
					 * retried
					 */
#define EV_ENOMEM		5	/* There was insufficient memory to
					 * complete the operation */
#define EV_EFAULT		6	/* Bad guest address */
#define EV_ENODEV		7	/* No such device */
#define EV_EINVAL		8	/* An argument supplied to the hcall
					   was out of range or invalid */
#define EV_INTERNAL		9	/* An internal error occured */
#define EV_CONFIG		10	/* A configuration error was detected */
#define EV_INVALID_STATE	11	/* The object is in an invalid state */
#define EV_UNIMPLEMENTED	12	/* Unimplemented hypercall */
#define EV_BUFFER_OVERFLOW	13	/* Caller-supplied buffer too small */

/*
/*
 * Hypercall register clobber list
 * Hypercall register clobber list
 *
 *
@@ -193,7 +142,7 @@ static inline unsigned int ev_int_set_config(unsigned int interrupt,
	r5  = priority;
	r5  = priority;
	r6  = destination;
	r6  = destination;


	__asm__ __volatile__ ("sc 1"
	asm volatile("bl	epapr_hypercall_start"
		: "+r" (r11), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6)
		: "+r" (r11), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6)
		: : EV_HCALL_CLOBBERS4
		: : EV_HCALL_CLOBBERS4
	);
	);
@@ -222,7 +171,7 @@ static inline unsigned int ev_int_get_config(unsigned int interrupt,
	r11 = EV_HCALL_TOKEN(EV_INT_GET_CONFIG);
	r11 = EV_HCALL_TOKEN(EV_INT_GET_CONFIG);
	r3 = interrupt;
	r3 = interrupt;


	__asm__ __volatile__ ("sc 1"
	asm volatile("bl	epapr_hypercall_start"
		: "+r" (r11), "+r" (r3), "=r" (r4), "=r" (r5), "=r" (r6)
		: "+r" (r11), "+r" (r3), "=r" (r4), "=r" (r5), "=r" (r6)
		: : EV_HCALL_CLOBBERS4
		: : EV_HCALL_CLOBBERS4
	);
	);
@@ -252,7 +201,7 @@ static inline unsigned int ev_int_set_mask(unsigned int interrupt,
	r3 = interrupt;
	r3 = interrupt;
	r4 = mask;
	r4 = mask;


	__asm__ __volatile__ ("sc 1"
	asm volatile("bl	epapr_hypercall_start"
		: "+r" (r11), "+r" (r3), "+r" (r4)
		: "+r" (r11), "+r" (r3), "+r" (r4)
		: : EV_HCALL_CLOBBERS2
		: : EV_HCALL_CLOBBERS2
	);
	);
@@ -277,7 +226,7 @@ static inline unsigned int ev_int_get_mask(unsigned int interrupt,
	r11 = EV_HCALL_TOKEN(EV_INT_GET_MASK);
	r11 = EV_HCALL_TOKEN(EV_INT_GET_MASK);
	r3 = interrupt;
	r3 = interrupt;


	__asm__ __volatile__ ("sc 1"
	asm volatile("bl	epapr_hypercall_start"
		: "+r" (r11), "+r" (r3), "=r" (r4)
		: "+r" (r11), "+r" (r3), "=r" (r4)
		: : EV_HCALL_CLOBBERS2
		: : EV_HCALL_CLOBBERS2
	);
	);
@@ -305,7 +254,7 @@ static inline unsigned int ev_int_eoi(unsigned int interrupt)
	r11 = EV_HCALL_TOKEN(EV_INT_EOI);
	r11 = EV_HCALL_TOKEN(EV_INT_EOI);
	r3 = interrupt;
	r3 = interrupt;


	__asm__ __volatile__ ("sc 1"
	asm volatile("bl	epapr_hypercall_start"
		: "+r" (r11), "+r" (r3)
		: "+r" (r11), "+r" (r3)
		: : EV_HCALL_CLOBBERS1
		: : EV_HCALL_CLOBBERS1
	);
	);
@@ -344,7 +293,7 @@ static inline unsigned int ev_byte_channel_send(unsigned int handle,
	r7 = be32_to_cpu(p[2]);
	r7 = be32_to_cpu(p[2]);
	r8 = be32_to_cpu(p[3]);
	r8 = be32_to_cpu(p[3]);


	__asm__ __volatile__ ("sc 1"
	asm volatile("bl	epapr_hypercall_start"
		: "+r" (r11), "+r" (r3),
		: "+r" (r11), "+r" (r3),
		  "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7), "+r" (r8)
		  "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7), "+r" (r8)
		: : EV_HCALL_CLOBBERS6
		: : EV_HCALL_CLOBBERS6
@@ -383,7 +332,7 @@ static inline unsigned int ev_byte_channel_receive(unsigned int handle,
	r3 = handle;
	r3 = handle;
	r4 = *count;
	r4 = *count;


	__asm__ __volatile__ ("sc 1"
	asm volatile("bl	epapr_hypercall_start"
		: "+r" (r11), "+r" (r3), "+r" (r4),
		: "+r" (r11), "+r" (r3), "+r" (r4),
		  "=r" (r5), "=r" (r6), "=r" (r7), "=r" (r8)
		  "=r" (r5), "=r" (r6), "=r" (r7), "=r" (r8)
		: : EV_HCALL_CLOBBERS6
		: : EV_HCALL_CLOBBERS6
@@ -421,7 +370,7 @@ static inline unsigned int ev_byte_channel_poll(unsigned int handle,
	r11 = EV_HCALL_TOKEN(EV_BYTE_CHANNEL_POLL);
	r11 = EV_HCALL_TOKEN(EV_BYTE_CHANNEL_POLL);
	r3 = handle;
	r3 = handle;


	__asm__ __volatile__ ("sc 1"
	asm volatile("bl	epapr_hypercall_start"
		: "+r" (r11), "+r" (r3), "=r" (r4), "=r" (r5)
		: "+r" (r11), "+r" (r3), "=r" (r4), "=r" (r5)
		: : EV_HCALL_CLOBBERS3
		: : EV_HCALL_CLOBBERS3
	);
	);
@@ -454,7 +403,7 @@ static inline unsigned int ev_int_iack(unsigned int handle,
	r11 = EV_HCALL_TOKEN(EV_INT_IACK);
	r11 = EV_HCALL_TOKEN(EV_INT_IACK);
	r3 = handle;
	r3 = handle;


	__asm__ __volatile__ ("sc 1"
	asm volatile("bl	epapr_hypercall_start"
		: "+r" (r11), "+r" (r3), "=r" (r4)
		: "+r" (r11), "+r" (r3), "=r" (r4)
		: : EV_HCALL_CLOBBERS2
		: : EV_HCALL_CLOBBERS2
	);
	);
@@ -478,7 +427,7 @@ static inline unsigned int ev_doorbell_send(unsigned int handle)
	r11 = EV_HCALL_TOKEN(EV_DOORBELL_SEND);
	r11 = EV_HCALL_TOKEN(EV_DOORBELL_SEND);
	r3 = handle;
	r3 = handle;


	__asm__ __volatile__ ("sc 1"
	asm volatile("bl	epapr_hypercall_start"
		: "+r" (r11), "+r" (r3)
		: "+r" (r11), "+r" (r3)
		: : EV_HCALL_CLOBBERS1
		: : EV_HCALL_CLOBBERS1
	);
	);
@@ -498,12 +447,12 @@ static inline unsigned int ev_idle(void)


	r11 = EV_HCALL_TOKEN(EV_IDLE);
	r11 = EV_HCALL_TOKEN(EV_IDLE);


	__asm__ __volatile__ ("sc 1"
	asm volatile("bl	epapr_hypercall_start"
		: "+r" (r11), "=r" (r3)
		: "+r" (r11), "=r" (r3)
		: : EV_HCALL_CLOBBERS1
		: : EV_HCALL_CLOBBERS1
	);
	);


	return r3;
	return r3;
}
}

#endif /* !__ASSEMBLY__ */
#endif
#endif /* _EPAPR_HCALLS_H */
Loading