Skip to content

Commit

Permalink
Merge branch 'kvm-updates-2.6.27' of git://git.kernel.org/pub/scm/lin…
Browse files Browse the repository at this point in the history
…ux/kernel/git/avi/kvm

* 'kvm-updates-2.6.27' of git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm: (70 commits)
  KVM: Adjust smp_call_function_mask() callers to new requirements
  KVM: MMU: Fix potential race setting upper shadow ptes on nonpae hosts
  KVM: x86 emulator: emulate clflush
  KVM: MMU: improve invalid shadow root page handling
  KVM: MMU: nuke shadowed pgtable pages and ptes on memslot destruction
  KVM: Prefix some x86 low level function with kvm_, to avoid namespace issues
  KVM: check injected pic irq within valid pic irqs
  KVM: x86 emulator: Fix HLT instruction
  KVM: Apply the kernel sigmask to vcpus blocked due to being uninitialized
  KVM: VMX: Add ept_sync_context in flush_tlb
  KVM: mmu_shrink: kvm_mmu_zap_page requires slots_lock to be held
  x86: KVM guest: make kvm_smp_prepare_boot_cpu() static
  KVM: SVM: fix suspend/resume support
  KVM: s390: rename private structures
  KVM: s390: Set guest storage limit and offset to sane values
  KVM: Fix memory leak on guest exit
  KVM: s390: dont allocate dirty bitmap
  KVM: move slots_lock acquision down to vapic_exit
  KVM: VMX: Fake emulate Intel perfctr MSRs
  KVM: VMX: Fix a wrong usage of vmcs_config
  ...
  • Loading branch information
Linus Torvalds committed Jul 21, 2008
2 parents db6d8c7 + 597a5f5 commit f076ab8
Show file tree
Hide file tree
Showing 37 changed files with 1,215 additions and 520 deletions.
3 changes: 2 additions & 1 deletion arch/ia64/kvm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ $(obj)/$(offsets-file): arch/ia64/kvm/asm-offsets.s
EXTRA_CFLAGS += -Ivirt/kvm -Iarch/ia64/kvm/
EXTRA_AFLAGS += -Ivirt/kvm -Iarch/ia64/kvm/

common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o)
common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o \
coalesced_mmio.o)

kvm-objs := $(common-objs) kvm-ia64.o kvm_fw.o
obj-$(CONFIG_KVM) += kvm.o
Expand Down
20 changes: 9 additions & 11 deletions arch/ia64/kvm/kvm-ia64.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ int kvm_dev_ioctl_check_extension(long ext)

r = 1;
break;
case KVM_CAP_COALESCED_MMIO:
r = KVM_COALESCED_MMIO_PAGE_OFFSET;
break;
default:
r = 0;
}
Expand All @@ -195,11 +198,11 @@ int kvm_dev_ioctl_check_extension(long ext)
}

static struct kvm_io_device *vcpu_find_mmio_dev(struct kvm_vcpu *vcpu,
gpa_t addr)
gpa_t addr, int len, int is_write)
{
struct kvm_io_device *dev;

dev = kvm_io_bus_find_dev(&vcpu->kvm->mmio_bus, addr);
dev = kvm_io_bus_find_dev(&vcpu->kvm->mmio_bus, addr, len, is_write);

return dev;
}
Expand Down Expand Up @@ -231,7 +234,7 @@ static int handle_mmio(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
kvm_run->exit_reason = KVM_EXIT_MMIO;
return 0;
mmio:
mmio_dev = vcpu_find_mmio_dev(vcpu, p->addr);
mmio_dev = vcpu_find_mmio_dev(vcpu, p->addr, p->size, !p->dir);
if (mmio_dev) {
if (!p->dir)
kvm_iodevice_write(mmio_dev, p->addr, p->size,
Expand Down Expand Up @@ -1035,14 +1038,6 @@ static void kvm_free_vmm_area(void)
}
}

/*
* Make sure that a cpu that is being hot-unplugged does not have any vcpus
* cached on it. Leave it as blank for IA64.
*/
void decache_vcpus_on_cpu(int cpu)
{
}

static void vti_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
{
}
Expand Down Expand Up @@ -1460,6 +1455,9 @@ int kvm_arch_set_memory_region(struct kvm *kvm,
return 0;
}

void kvm_arch_flush_shadow(struct kvm *kvm)
{
}

long kvm_arch_dev_ioctl(struct file *filp,
unsigned int ioctl, unsigned long arg)
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kvm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

EXTRA_CFLAGS += -Ivirt/kvm -Iarch/powerpc/kvm

common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o)
common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o coalesced_mmio.o)

kvm-objs := $(common-objs) powerpc.o emulate.o booke_guest.o
obj-$(CONFIG_KVM) += kvm.o
Expand Down
11 changes: 7 additions & 4 deletions arch/powerpc/kvm/powerpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ int kvm_dev_ioctl_check_extension(long ext)
case KVM_CAP_USER_MEMORY:
r = 1;
break;
case KVM_CAP_COALESCED_MMIO:
r = KVM_COALESCED_MMIO_PAGE_OFFSET;
break;
default:
r = 0;
break;
Expand All @@ -167,6 +170,10 @@ int kvm_arch_set_memory_region(struct kvm *kvm,
return 0;
}

void kvm_arch_flush_shadow(struct kvm *kvm)
{
}

struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
{
struct kvm_vcpu *vcpu;
Expand Down Expand Up @@ -240,10 +247,6 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
{
}

void decache_vcpus_on_cpu(int cpu)
{
}

int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu,
struct kvm_debug_guest *dbg)
{
Expand Down
32 changes: 16 additions & 16 deletions arch/s390/kvm/interrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static int psw_interrupts_disabled(struct kvm_vcpu *vcpu)
}

static int __interrupt_is_deliverable(struct kvm_vcpu *vcpu,
struct interrupt_info *inti)
struct kvm_s390_interrupt_info *inti)
{
switch (inti->type) {
case KVM_S390_INT_EMERGENCY:
Expand Down Expand Up @@ -91,7 +91,7 @@ static void __set_cpuflag(struct kvm_vcpu *vcpu, u32 flag)
}

static void __set_intercept_indicator(struct kvm_vcpu *vcpu,
struct interrupt_info *inti)
struct kvm_s390_interrupt_info *inti)
{
switch (inti->type) {
case KVM_S390_INT_EMERGENCY:
Expand All @@ -111,7 +111,7 @@ static void __set_intercept_indicator(struct kvm_vcpu *vcpu,
}

static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
struct interrupt_info *inti)
struct kvm_s390_interrupt_info *inti)
{
const unsigned short table[] = { 2, 4, 4, 6 };
int rc, exception = 0;
Expand Down Expand Up @@ -290,9 +290,9 @@ static int __try_deliver_ckc_interrupt(struct kvm_vcpu *vcpu)

int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu)
{
struct local_interrupt *li = &vcpu->arch.local_int;
struct float_interrupt *fi = vcpu->arch.local_int.float_int;
struct interrupt_info *inti;
struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int;
struct kvm_s390_float_interrupt *fi = vcpu->arch.local_int.float_int;
struct kvm_s390_interrupt_info *inti;
int rc = 0;

if (atomic_read(&li->active)) {
Expand Down Expand Up @@ -408,9 +408,9 @@ void kvm_s390_idle_wakeup(unsigned long data)

void kvm_s390_deliver_pending_interrupts(struct kvm_vcpu *vcpu)
{
struct local_interrupt *li = &vcpu->arch.local_int;
struct float_interrupt *fi = vcpu->arch.local_int.float_int;
struct interrupt_info *n, *inti = NULL;
struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int;
struct kvm_s390_float_interrupt *fi = vcpu->arch.local_int.float_int;
struct kvm_s390_interrupt_info *n, *inti = NULL;
int deliver;

__reset_intercept_indicators(vcpu);
Expand Down Expand Up @@ -465,8 +465,8 @@ void kvm_s390_deliver_pending_interrupts(struct kvm_vcpu *vcpu)

int kvm_s390_inject_program_int(struct kvm_vcpu *vcpu, u16 code)
{
struct local_interrupt *li = &vcpu->arch.local_int;
struct interrupt_info *inti;
struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int;
struct kvm_s390_interrupt_info *inti;

inti = kzalloc(sizeof(*inti), GFP_KERNEL);
if (!inti)
Expand All @@ -487,9 +487,9 @@ int kvm_s390_inject_program_int(struct kvm_vcpu *vcpu, u16 code)
int kvm_s390_inject_vm(struct kvm *kvm,
struct kvm_s390_interrupt *s390int)
{
struct local_interrupt *li;
struct float_interrupt *fi;
struct interrupt_info *inti;
struct kvm_s390_local_interrupt *li;
struct kvm_s390_float_interrupt *fi;
struct kvm_s390_interrupt_info *inti;
int sigcpu;

inti = kzalloc(sizeof(*inti), GFP_KERNEL);
Expand Down Expand Up @@ -544,8 +544,8 @@ int kvm_s390_inject_vm(struct kvm *kvm,
int kvm_s390_inject_vcpu(struct kvm_vcpu *vcpu,
struct kvm_s390_interrupt *s390int)
{
struct local_interrupt *li;
struct interrupt_info *inti;
struct kvm_s390_local_interrupt *li;
struct kvm_s390_interrupt_info *inti;

inti = kzalloc(sizeof(*inti), GFP_KERNEL);
if (!inti)
Expand Down
21 changes: 14 additions & 7 deletions arch/s390/kvm/kvm-s390.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ void kvm_arch_hardware_disable(void *garbage)
{
}

void decache_vcpus_on_cpu(int cpu)
{
}

int kvm_arch_hardware_setup(void)
{
return 0;
Expand Down Expand Up @@ -198,6 +194,7 @@ struct kvm *kvm_arch_create_vm(void)
void kvm_arch_destroy_vm(struct kvm *kvm)
{
debug_unregister(kvm->arch.dbf);
kvm_free_physmem(kvm);
free_page((unsigned long)(kvm->arch.sca));
kfree(kvm);
module_put(THIS_MODULE);
Expand Down Expand Up @@ -250,11 +247,16 @@ static void kvm_s390_vcpu_initial_reset(struct kvm_vcpu *vcpu)
vcpu->arch.sie_block->gbea = 1;
}

/* The current code can have up to 256 pages for virtio */
#define VIRTIODESCSPACE (256ul * 4096ul)

int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
{
atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH);
vcpu->arch.sie_block->gmslm = 0xffffffffffUL;
vcpu->arch.sie_block->gmsor = 0x000000000000;
vcpu->arch.sie_block->gmslm = vcpu->kvm->arch.guest_memsize +
vcpu->kvm->arch.guest_origin +
VIRTIODESCSPACE - 1ul;
vcpu->arch.sie_block->gmsor = vcpu->kvm->arch.guest_origin;
vcpu->arch.sie_block->ecb = 2;
vcpu->arch.sie_block->eca = 0xC1002001U;
setup_timer(&vcpu->arch.ckc_timer, kvm_s390_idle_wakeup,
Expand All @@ -273,7 +275,8 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
if (!vcpu)
goto out_nomem;

vcpu->arch.sie_block = (struct sie_block *) get_zeroed_page(GFP_KERNEL);
vcpu->arch.sie_block = (struct kvm_s390_sie_block *)
get_zeroed_page(GFP_KERNEL);

if (!vcpu->arch.sie_block)
goto out_free_cpu;
Expand Down Expand Up @@ -672,6 +675,10 @@ int kvm_arch_set_memory_region(struct kvm *kvm,
return 0;
}

void kvm_arch_flush_shadow(struct kvm *kvm)
{
}

gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn)
{
return gfn;
Expand Down
2 changes: 1 addition & 1 deletion arch/s390/kvm/priv.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ static int handle_stidp(struct kvm_vcpu *vcpu)

static void handle_stsi_3_2_2(struct kvm_vcpu *vcpu, struct sysinfo_3_2_2 *mem)
{
struct float_interrupt *fi = &vcpu->kvm->arch.float_int;
struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int;
int cpus = 0;
int n;

Expand Down
20 changes: 10 additions & 10 deletions arch/s390/kvm/sigp.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

static int __sigp_sense(struct kvm_vcpu *vcpu, u16 cpu_addr, u64 *reg)
{
struct float_interrupt *fi = &vcpu->kvm->arch.float_int;
struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int;
int rc;

if (cpu_addr >= KVM_MAX_VCPUS)
Expand All @@ -71,9 +71,9 @@ static int __sigp_sense(struct kvm_vcpu *vcpu, u16 cpu_addr, u64 *reg)

static int __sigp_emergency(struct kvm_vcpu *vcpu, u16 cpu_addr)
{
struct float_interrupt *fi = &vcpu->kvm->arch.float_int;
struct local_interrupt *li;
struct interrupt_info *inti;
struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int;
struct kvm_s390_local_interrupt *li;
struct kvm_s390_interrupt_info *inti;
int rc;

if (cpu_addr >= KVM_MAX_VCPUS)
Expand Down Expand Up @@ -108,9 +108,9 @@ static int __sigp_emergency(struct kvm_vcpu *vcpu, u16 cpu_addr)

static int __sigp_stop(struct kvm_vcpu *vcpu, u16 cpu_addr, int store)
{
struct float_interrupt *fi = &vcpu->kvm->arch.float_int;
struct local_interrupt *li;
struct interrupt_info *inti;
struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int;
struct kvm_s390_local_interrupt *li;
struct kvm_s390_interrupt_info *inti;
int rc;

if (cpu_addr >= KVM_MAX_VCPUS)
Expand Down Expand Up @@ -169,9 +169,9 @@ static int __sigp_set_arch(struct kvm_vcpu *vcpu, u32 parameter)
static int __sigp_set_prefix(struct kvm_vcpu *vcpu, u16 cpu_addr, u32 address,
u64 *reg)
{
struct float_interrupt *fi = &vcpu->kvm->arch.float_int;
struct local_interrupt *li;
struct interrupt_info *inti;
struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int;
struct kvm_s390_local_interrupt *li;
struct kvm_s390_interrupt_info *inti;
int rc;
u8 tmp;

Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/kvmclock.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static void kvm_setup_secondary_clock(void)
#endif

#ifdef CONFIG_SMP
void __init kvm_smp_prepare_boot_cpu(void)
static void __init kvm_smp_prepare_boot_cpu(void)
{
WARN_ON(kvm_register_clock("primary cpu clock"));
native_smp_prepare_boot_cpu();
Expand Down
3 changes: 2 additions & 1 deletion arch/x86/kvm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# Makefile for Kernel-based Virtual Machine module
#

common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o)
common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o \
coalesced_mmio.o)
ifeq ($(CONFIG_KVM_TRACE),y)
common-objs += $(addprefix ../../../virt/kvm/, kvm_trace.o)
endif
Expand Down
Loading

0 comments on commit f076ab8

Please sign in to comment.