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

Commit 597b0d21 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'kvm-updates/2.6.29' of git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm

* 'kvm-updates/2.6.29' of git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm: (140 commits)
  KVM: MMU: handle large host sptes on invlpg/resync
  KVM: Add locking to virtual i8259 interrupt controller
  KVM: MMU: Don't treat a global pte as such if cr4.pge is cleared
  MAINTAINERS: Maintainership changes for kvm/ia64
  KVM: ia64: Fix kvm_arch_vcpu_ioctl_[gs]et_regs()
  KVM: x86: Rework user space NMI injection as KVM_CAP_USER_NMI
  KVM: VMX: Fix pending NMI-vs.-IRQ race for user space irqchip
  KVM: fix handling of ACK from shared guest IRQ
  KVM: MMU: check for present pdptr shadow page in walk_shadow
  KVM: Consolidate userspace memory capability reporting into common code
  KVM: Advertise the bug in memory region destruction as fixed
  KVM: use cpumask_var_t for cpus_hardware_enabled
  KVM: use modern cpumask primitives, no cpumask_t on stack
  KVM: Extract core of kvm_flush_remote_tlbs/kvm_reload_remote_mmus
  KVM: set owner of cpu and vm file operations
  anon_inodes: use fops->owner for module refcount
  x86: KVM guest: kvm_get_tsc_khz: return khz, not lpj
  KVM: MMU: prepopulate the shadow on invlpg
  KVM: MMU: skip global pgtables on sync due to cr3 switch
  KVM: MMU: collapse remote TLB flushes on root sync
  ...
parents 2640c9a9 87917239
Loading
Loading
Loading
Loading
+0 −2
Original line number Original line Diff line number Diff line
@@ -2542,8 +2542,6 @@ W: http://kvm.qumranet.com
S:	Supported
S:	Supported


KERNEL VIRTUAL MACHINE For Itanium (KVM/IA64)
KERNEL VIRTUAL MACHINE For Itanium (KVM/IA64)
P:	Anthony Xu
M:	anthony.xu@intel.com
P:	Xiantao Zhang
P:	Xiantao Zhang
M:	xiantao.zhang@intel.com
M:	xiantao.zhang@intel.com
L:	kvm-ia64@vger.kernel.org
L:	kvm-ia64@vger.kernel.org
+4 −2
Original line number Original line Diff line number Diff line
@@ -166,8 +166,6 @@ struct saved_vpd {
};
};


struct kvm_regs {
struct kvm_regs {
	char *saved_guest;
	char *saved_stack;
	struct saved_vpd vpd;
	struct saved_vpd vpd;
	/*Arch-regs*/
	/*Arch-regs*/
	int mp_state;
	int mp_state;
@@ -200,6 +198,10 @@ struct kvm_regs {
	unsigned long fp_psr;       /*used for lazy float register */
	unsigned long fp_psr;       /*used for lazy float register */
	unsigned long saved_gp;
	unsigned long saved_gp;
	/*for phycial  emulation */
	/*for phycial  emulation */

	union context saved_guest;

	unsigned long reserved[64];	/* for future use */
};
};


struct kvm_sregs {
struct kvm_sregs {
+124 −72
Original line number Original line Diff line number Diff line
@@ -23,17 +23,6 @@
#ifndef __ASM_KVM_HOST_H
#ifndef __ASM_KVM_HOST_H
#define __ASM_KVM_HOST_H
#define __ASM_KVM_HOST_H



#include <linux/types.h>
#include <linux/mm.h>
#include <linux/kvm.h>
#include <linux/kvm_para.h>
#include <linux/kvm_types.h>

#include <asm/pal.h>
#include <asm/sal.h>

#define KVM_MAX_VCPUS 4
#define KVM_MEMORY_SLOTS 32
#define KVM_MEMORY_SLOTS 32
/* memory slots that does not exposed to userspace */
/* memory slots that does not exposed to userspace */
#define KVM_PRIVATE_MEM_SLOTS 4
#define KVM_PRIVATE_MEM_SLOTS 4
@@ -50,70 +39,132 @@
#define EXIT_REASON_EXTERNAL_INTERRUPT	6
#define EXIT_REASON_EXTERNAL_INTERRUPT	6
#define EXIT_REASON_IPI			7
#define EXIT_REASON_IPI			7
#define EXIT_REASON_PTC_G		8
#define EXIT_REASON_PTC_G		8
#define EXIT_REASON_DEBUG		20


/*Define vmm address space and vm data space.*/
/*Define vmm address space and vm data space.*/
#define KVM_VMM_SIZE (16UL<<20)
#define KVM_VMM_SIZE (__IA64_UL_CONST(16)<<20)
#define KVM_VMM_SHIFT 24
#define KVM_VMM_SHIFT 24
#define KVM_VMM_BASE 0xD000000000000000UL
#define KVM_VMM_BASE 0xD000000000000000
#define VMM_SIZE (8UL<<20)
#define VMM_SIZE (__IA64_UL_CONST(8)<<20)


/*
/*
 * Define vm_buffer, used by PAL Services, base address.
 * Define vm_buffer, used by PAL Services, base address.
 * Note: vmbuffer is in the VMM-BLOCK, the size must be < 8M
 * Note: vm_buffer is in the VMM-BLOCK, the size must be < 8M
 */
 */
#define KVM_VM_BUFFER_BASE (KVM_VMM_BASE + VMM_SIZE)
#define KVM_VM_BUFFER_BASE (KVM_VMM_BASE + VMM_SIZE)
#define KVM_VM_BUFFER_SIZE (8UL<<20)
#define KVM_VM_BUFFER_SIZE (__IA64_UL_CONST(8)<<20)


/*Define Virtual machine data layout.*/
/*
#define KVM_VM_DATA_SHIFT  24
 * kvm guest's data area looks as follow:
#define KVM_VM_DATA_SIZE (1UL << KVM_VM_DATA_SHIFT)
 *
#define KVM_VM_DATA_BASE (KVM_VMM_BASE + KVM_VMM_SIZE)
 *            +----------------------+	-------	KVM_VM_DATA_SIZE
 *	      |	    vcpu[n]'s data   |	 |     ___________________KVM_STK_OFFSET
 *     	      |			     |	 |    /			  |
 *     	      |	       ..........    |	 |   /vcpu's struct&stack |
 *     	      |	       ..........    |	 |  /---------------------|---- 0
 *	      |	    vcpu[5]'s data   |	 | /	   vpd		  |
 *	      |	    vcpu[4]'s data   |	 |/-----------------------|
 *	      |	    vcpu[3]'s data   |	 /	   vtlb		  |
 *	      |	    vcpu[2]'s data   |	/|------------------------|
 *	      |	    vcpu[1]'s data   |/  |	   vhpt		  |
 *	      |	    vcpu[0]'s data   |____________________________|
 *            +----------------------+	 |
 *	      |	   memory dirty log  |	 |
 *            +----------------------+	 |
 *	      |	   vm's data struct  |	 |
 *            +----------------------+	 |
 *	      |			     |	 |
 *	      |			     |	 |
 *	      |			     |	 |
 *	      |			     |	 |
 *	      |			     |	 |
 *	      |			     |	 |
 *	      |			     |	 |
 *	      |	  vm's p2m table  |	 |
 *	      |			     |	 |
 *            |			     |	 |
 *	      |			     |	 |  |
 * vm's data->|			     |   |  |
 *	      +----------------------+ ------- 0
 * To support large memory, needs to increase the size of p2m.
 * To support more vcpus, needs to ensure it has enough space to
 * hold vcpus' data.
 */


#define KVM_VM_DATA_SHIFT	26
#define KVM_VM_DATA_SIZE	(__IA64_UL_CONST(1) << KVM_VM_DATA_SHIFT)
#define KVM_VM_DATA_BASE	(KVM_VMM_BASE + KVM_VM_DATA_SIZE)


#define KVM_P2M_BASE		KVM_VM_DATA_BASE
#define KVM_P2M_BASE		KVM_VM_DATA_BASE
#define KVM_P2M_OFS     0
#define KVM_P2M_SIZE		(__IA64_UL_CONST(24) << 20)
#define KVM_P2M_SIZE    (8UL << 20)


#define VHPT_SHIFT		16
#define KVM_VHPT_BASE   (KVM_P2M_BASE + KVM_P2M_SIZE)
#define VHPT_SIZE		(__IA64_UL_CONST(1) << VHPT_SHIFT)
#define KVM_VHPT_OFS    KVM_P2M_SIZE
#define VHPT_NUM_ENTRIES	(__IA64_UL_CONST(1) << (VHPT_SHIFT-5))
#define KVM_VHPT_BLOCK_SIZE   (2UL << 20)

#define VHPT_SHIFT      18
#define VTLB_SHIFT		16
#define VHPT_SIZE       (1UL << VHPT_SHIFT)
#define VTLB_SIZE		(__IA64_UL_CONST(1) << VTLB_SHIFT)
#define VHPT_NUM_ENTRIES (1<<(VHPT_SHIFT-5))
#define VTLB_NUM_ENTRIES	(1UL << (VHPT_SHIFT-5))


#define KVM_VTLB_BASE   (KVM_VHPT_BASE+KVM_VHPT_BLOCK_SIZE)
#define KVM_VTLB_OFS    (KVM_VHPT_OFS+KVM_VHPT_BLOCK_SIZE)
#define KVM_VTLB_BLOCK_SIZE   (1UL<<20)
#define VTLB_SHIFT      17
#define VTLB_SIZE       (1UL<<VTLB_SHIFT)
#define VTLB_NUM_ENTRIES (1<<(VTLB_SHIFT-5))

#define KVM_VPD_BASE   (KVM_VTLB_BASE+KVM_VTLB_BLOCK_SIZE)
#define KVM_VPD_OFS    (KVM_VTLB_OFS+KVM_VTLB_BLOCK_SIZE)
#define KVM_VPD_BLOCK_SIZE   (2UL<<20)
#define VPD_SHIFT		16
#define VPD_SHIFT		16
#define VPD_SIZE        (1UL<<VPD_SHIFT)
#define VPD_SIZE		(__IA64_UL_CONST(1) << VPD_SHIFT)

#define VCPU_STRUCT_SHIFT	16
#define VCPU_STRUCT_SIZE	(__IA64_UL_CONST(1) << VCPU_STRUCT_SHIFT)

#define KVM_STK_OFFSET		VCPU_STRUCT_SIZE

#define KVM_VM_STRUCT_SHIFT	19
#define KVM_VM_STRUCT_SIZE	(__IA64_UL_CONST(1) << KVM_VM_STRUCT_SHIFT)


#define KVM_VCPU_BASE   (KVM_VPD_BASE+KVM_VPD_BLOCK_SIZE)
#define KVM_MEM_DIRY_LOG_SHIFT	19
#define KVM_VCPU_OFS    (KVM_VPD_OFS+KVM_VPD_BLOCK_SIZE)
#define KVM_MEM_DIRTY_LOG_SIZE (__IA64_UL_CONST(1) << KVM_MEM_DIRY_LOG_SHIFT)
#define KVM_VCPU_BLOCK_SIZE   (2UL<<20)
#define VCPU_SHIFT 18
#define VCPU_SIZE (1UL<<VCPU_SHIFT)
#define MAX_VCPU_NUM KVM_VCPU_BLOCK_SIZE/VCPU_SIZE


#define KVM_VM_BASE     (KVM_VCPU_BASE+KVM_VCPU_BLOCK_SIZE)
#ifndef __ASSEMBLY__
#define KVM_VM_OFS      (KVM_VCPU_OFS+KVM_VCPU_BLOCK_SIZE)
#define KVM_VM_BLOCK_SIZE     (1UL<<19)


#define KVM_MEM_DIRTY_LOG_BASE (KVM_VM_BASE+KVM_VM_BLOCK_SIZE)
/*Define the max vcpus and memory for Guests.*/
#define KVM_MEM_DIRTY_LOG_OFS  (KVM_VM_OFS+KVM_VM_BLOCK_SIZE)
#define KVM_MAX_VCPUS	(KVM_VM_DATA_SIZE - KVM_P2M_SIZE - KVM_VM_STRUCT_SIZE -\
#define KVM_MEM_DIRTY_LOG_SIZE (1UL<<19)
			KVM_MEM_DIRTY_LOG_SIZE) / sizeof(struct kvm_vcpu_data)
#define KVM_MAX_MEM_SIZE (KVM_P2M_SIZE >> 3 << PAGE_SHIFT)


/* Get vpd, vhpt, tlb, vcpu, base*/
#define VMM_LOG_LEN 256
#define VPD_ADDR(n) (KVM_VPD_BASE+n*VPD_SIZE)

#define VHPT_ADDR(n) (KVM_VHPT_BASE+n*VHPT_SIZE)
#include <linux/types.h>
#define VTLB_ADDR(n) (KVM_VTLB_BASE+n*VTLB_SIZE)
#include <linux/mm.h>
#define VCPU_ADDR(n) (KVM_VCPU_BASE+n*VCPU_SIZE)
#include <linux/kvm.h>
#include <linux/kvm_para.h>
#include <linux/kvm_types.h>

#include <asm/pal.h>
#include <asm/sal.h>
#include <asm/page.h>

struct kvm_vcpu_data {
	char vcpu_vhpt[VHPT_SIZE];
	char vcpu_vtlb[VTLB_SIZE];
	char vcpu_vpd[VPD_SIZE];
	char vcpu_struct[VCPU_STRUCT_SIZE];
};

struct kvm_vm_data {
	char kvm_p2m[KVM_P2M_SIZE];
	char kvm_vm_struct[KVM_VM_STRUCT_SIZE];
	char kvm_mem_dirty_log[KVM_MEM_DIRTY_LOG_SIZE];
	struct kvm_vcpu_data vcpu_data[KVM_MAX_VCPUS];
};

#define VCPU_BASE(n)	KVM_VM_DATA_BASE + \
				offsetof(struct kvm_vm_data, vcpu_data[n])
#define VM_BASE		KVM_VM_DATA_BASE + \
				offsetof(struct kvm_vm_data, kvm_vm_struct)
#define KVM_MEM_DIRTY_LOG_BASE	KVM_VM_DATA_BASE + \
				offsetof(struct kvm_vm_data, kvm_mem_dirty_log)

#define VHPT_BASE(n) (VCPU_BASE(n) + offsetof(struct kvm_vcpu_data, vcpu_vhpt))
#define VTLB_BASE(n) (VCPU_BASE(n) + offsetof(struct kvm_vcpu_data, vcpu_vtlb))
#define VPD_BASE(n)  (VCPU_BASE(n) + offsetof(struct kvm_vcpu_data, vcpu_vpd))
#define VCPU_STRUCT_BASE(n)	(VCPU_BASE(n) + \
				offsetof(struct kvm_vcpu_data, vcpu_struct))


/*IO section definitions*/
/*IO section definitions*/
#define IOREQ_READ      1
#define IOREQ_READ      1
@@ -389,6 +440,7 @@ struct kvm_vcpu_arch {


	unsigned long opcode;
	unsigned long opcode;
	unsigned long cause;
	unsigned long cause;
	char log_buf[VMM_LOG_LEN];
	union context host;
	union context host;
	union context guest;
	union context guest;
};
};
@@ -403,14 +455,13 @@ struct kvm_sal_data {
};
};


struct kvm_arch {
struct kvm_arch {
	spinlock_t dirty_log_lock;

	unsigned long	vm_base;
	unsigned long	vm_base;
	unsigned long	metaphysical_rr0;
	unsigned long	metaphysical_rr0;
	unsigned long	metaphysical_rr4;
	unsigned long	metaphysical_rr4;
	unsigned long	vmm_init_rr;
	unsigned long	vmm_init_rr;
	unsigned long	vhpt_base;

	unsigned long	vtlb_base;
	unsigned long 	vpd_base;
	spinlock_t dirty_log_lock;
	struct kvm_ioapic *vioapic;
	struct kvm_ioapic *vioapic;
	struct kvm_vm_stat stat;
	struct kvm_vm_stat stat;
	struct kvm_sal_data rdv_sal_data;
	struct kvm_sal_data rdv_sal_data;
@@ -512,7 +563,7 @@ struct kvm_pt_regs {


static inline struct kvm_pt_regs *vcpu_regs(struct kvm_vcpu *v)
static inline struct kvm_pt_regs *vcpu_regs(struct kvm_vcpu *v)
{
{
	return (struct kvm_pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
	return (struct kvm_pt_regs *) ((unsigned long) v + KVM_STK_OFFSET) - 1;
}
}


typedef int kvm_vmm_entry(void);
typedef int kvm_vmm_entry(void);
@@ -531,5 +582,6 @@ int kvm_pal_emul(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run);
void kvm_sal_emul(struct kvm_vcpu *vcpu);
void kvm_sal_emul(struct kvm_vcpu *vcpu);


static inline void kvm_inject_nmi(struct kvm_vcpu *vcpu) {}
static inline void kvm_inject_nmi(struct kvm_vcpu *vcpu) {}
#endif /* __ASSEMBLY__*/


#endif
#endif
+1 −1
Original line number Original line Diff line number Diff line
@@ -60,7 +60,7 @@ obj-$(CONFIG_KVM) += kvm.o


CFLAGS_vcpu.o += -mfixed-range=f2-f5,f12-f127
CFLAGS_vcpu.o += -mfixed-range=f2-f5,f12-f127
kvm-intel-objs = vmm.o vmm_ivt.o trampoline.o vcpu.o optvfault.o mmio.o \
kvm-intel-objs = vmm.o vmm_ivt.o trampoline.o vcpu.o optvfault.o mmio.o \
	vtlb.o process.o
	vtlb.o process.o kvm_lib.o
#Add link memcpy and memset to avoid possible structure assignment error
#Add link memcpy and memset to avoid possible structure assignment error
kvm-intel-objs += memcpy.o memset.o
kvm-intel-objs += memcpy.o memset.o
obj-$(CONFIG_KVM_INTEL) += kvm-intel.o
obj-$(CONFIG_KVM_INTEL) += kvm-intel.o
+1 −10
Original line number Original line Diff line number Diff line
@@ -24,19 +24,10 @@


#include <linux/autoconf.h>
#include <linux/autoconf.h>
#include <linux/kvm_host.h>
#include <linux/kvm_host.h>
#include <linux/kbuild.h>


#include "vcpu.h"
#include "vcpu.h"


#define task_struct kvm_vcpu

#define DEFINE(sym, val) \
	asm volatile("\n->" #sym " (%0) " #val : : "i" (val))

#define BLANK() asm volatile("\n->" : :)

#define OFFSET(_sym, _str, _mem) \
    DEFINE(_sym, offsetof(_str, _mem));

void foo(void)
void foo(void)
{
{
	DEFINE(VMM_TASK_SIZE, sizeof(struct kvm_vcpu));
	DEFINE(VMM_TASK_SIZE, sizeof(struct kvm_vcpu));
Loading