Re: [PATCH 6/7] ARM: KVM: switch to a dual-step HYP init code

2013-04-05 Thread Geoff Levand
Hi Marc,

On Fri, 2013-04-05 at 10:08 +0100, Marc Zyngier wrote:
 On 04/04/13 23:10, Geoff Levand wrote:
  On Tue, 2013-04-02 at 14:25 +0100, Marc Zyngier wrote:
  +  @ Jump to the trampoline page
  +  ldr r2, =#PAGE_MASK
  +  adr r3, target
  +  bic r3, r3, r2
  +  ldr r2, =#TRAMPOLINE_VA
  +  add r3, r3, r2
  +  mov pc, r3
  
  I guess you need 'ldr r2, =PAGE_MASK'.
  
arch/arm/kvm/init.S:114: Error: bad expression -- `ldr 
  r2,=#(~((112)-1))'
arch/arm/kvm/init.S:117: Error: bad expression -- `ldr r2,=#0x'
 
 Oddly enough, this code compiles perfectly fine on my box.
 What's your compiler/binutils versions?

I thought # was for an immediate value in instructions.  This
is an assembler pseudo-instruction, and based on the ARM manual
here I would think your coding should fail:

  
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0473i/Chdcegci.html

I use the current arm-linux-gnueabihf cross toolchain packages from
Ubuntu 12.04:

  arm-linux-gnueabihf-gcc-4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
  GNU assembler (GNU Binutils for Ubuntu) 2.22

-Geoff


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 0/4] KVM minor fixups

2013-04-05 Thread Geoff Levand
Hi Paolo,

I fixed up the series as requested.

-Geoff

V2:
o Removed arm patches.
o Moved kvm_spurious_fault to arch/x86/kvm/x86.c.
o Fixed commit comments.


The following changes since commit 07961ac7c0ee8b546658717034fe692fd12eefa9:

  Linux 3.9-rc5 (2013-03-31 15:12:43 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/geoff/kvm.git for-kvm

for you to fetch changes up to 753c819ec3c3c55d6ca0eeddb4c6c2a32be7219b:

  KVM: Move vm_list kvm_lock declarations out of x86 (2013-04-05 11:43:22 -0700)

Geoff Levand (4):
  KVM: Make local routines static
  KVM: Move kvm_spurious_fault to x86.c
  KVM: Move kvm_rebooting declaration out of x86
  KVM: Move vm_list kvm_lock declarations out of x86

 arch/x86/include/asm/kvm_host.h |4 
 arch/x86/kvm/x86.c  |7 +++
 include/linux/kvm_host.h|5 +
 virt/kvm/kvm_main.c |   16 
 4 files changed, 16 insertions(+), 16 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] KVM: Move vm_list kvm_lock declarations out of x86

2013-04-05 Thread Geoff Levand
The variables vm_list and kvm_lock are common to all architectures, so
move the declarations from arch/x86/include/asm/kvm_host.h to
include/linux/kvm_host.h.

Fixes sparse warnings like these when building for arm64:

  virt/kvm/kvm_main.c: warning: symbol 'kvm_lock' was not declared. Should it 
be static?
  virt/kvm/kvm_main.c: warning: symbol 'vm_list' was not declared. Should it be 
static?

Signed-off-by: Geoff Levand ge...@infradead.org
---
 arch/x86/include/asm/kvm_host.h |3 ---
 include/linux/kvm_host.h|3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 8578da4..e91b5ef 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -94,9 +94,6 @@
 
 #define ASYNC_PF_PER_VCPU 64
 
-extern raw_spinlock_t kvm_lock;
-extern struct list_head vm_list;
-
 struct kvm_vcpu;
 struct kvm;
 struct kvm_async_pf;
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 19855c2..9dd3e31 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -133,6 +133,9 @@ struct kvm;
 struct kvm_vcpu;
 extern struct kmem_cache *kvm_vcpu_cache;
 
+extern raw_spinlock_t kvm_lock;
+extern struct list_head vm_list;
+
 struct kvm_io_range {
gpa_t addr;
int len;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] KVM: Make local routines static

2013-04-05 Thread Geoff Levand
The routines get_user_page_nowait(), kvm_io_bus_sort_cmp(), 
kvm_io_bus_insert_dev()
and kvm_io_bus_get_first_dev() are only referenced within kvm_main.c, so give 
them
static linkage.

Fixes sparse warnings like these:

  virt/kvm/kvm_main.c: warning: symbol 'get_user_page_nowait' was not declared. 
Should it be static?

Signed-off-by: Geoff Levand ge...@infradead.org
---
 virt/kvm/kvm_main.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index adc68fe..82ca8e2 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1099,7 +1099,7 @@ static int kvm_read_hva_atomic(void *data, void __user 
*hva, int len)
return __copy_from_user_inatomic(data, hva, len);
 }
 
-int get_user_page_nowait(struct task_struct *tsk, struct mm_struct *mm,
+static int get_user_page_nowait(struct task_struct *tsk, struct mm_struct *mm,
unsigned long start, int write, struct page **page)
 {
int flags = FOLL_TOUCH | FOLL_NOWAIT | FOLL_HWPOISON | FOLL_GET;
@@ -2631,7 +2631,7 @@ static void kvm_io_bus_destroy(struct kvm_io_bus *bus)
kfree(bus);
 }
 
-int kvm_io_bus_sort_cmp(const void *p1, const void *p2)
+static int kvm_io_bus_sort_cmp(const void *p1, const void *p2)
 {
const struct kvm_io_range *r1 = p1;
const struct kvm_io_range *r2 = p2;
@@ -2643,7 +2643,7 @@ int kvm_io_bus_sort_cmp(const void *p1, const void *p2)
return 0;
 }
 
-int kvm_io_bus_insert_dev(struct kvm_io_bus *bus, struct kvm_io_device *dev,
+static int kvm_io_bus_insert_dev(struct kvm_io_bus *bus, struct kvm_io_device 
*dev,
  gpa_t addr, int len)
 {
bus-range[bus-dev_count++] = (struct kvm_io_range) {
@@ -2658,7 +2658,7 @@ int kvm_io_bus_insert_dev(struct kvm_io_bus *bus, struct 
kvm_io_device *dev,
return 0;
 }
 
-int kvm_io_bus_get_first_dev(struct kvm_io_bus *bus,
+static int kvm_io_bus_get_first_dev(struct kvm_io_bus *bus,
 gpa_t addr, int len)
 {
struct kvm_io_range *range, key;
-- 
1.7.9.5


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] KVM: Move kvm_spurious_fault to x86.c

2013-04-05 Thread Geoff Levand
The routine kvm_spurious_fault() is an x86 specific routine, so
move it from virt/kvm/kvm_main.c to arch/x86/kvm/x86.c.

Fixes this sparse warning when building on arm64:

  virt/kvm/kvm_main.c:warning: symbol 'kvm_spurious_fault' was not declared. 
Should it be static?

Signed-off-by: Geoff Levand ge...@infradead.org
---
 arch/x86/kvm/x86.c  |7 +++
 virt/kvm/kvm_main.c |8 
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index f19ac0a..87a8536 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -263,6 +263,13 @@ void kvm_set_apic_base(struct kvm_vcpu *vcpu, u64 data)
 }
 EXPORT_SYMBOL_GPL(kvm_set_apic_base);
 
+asmlinkage void kvm_spurious_fault(void)
+{
+   /* Fault while not rebooting.  We want the trace. */
+   BUG();
+}
+EXPORT_SYMBOL_GPL(kvm_spurious_fault);
+
 #define EXCPT_BENIGN   0
 #define EXCPT_CONTRIBUTORY 1
 #define EXCPT_PF   2
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 82ca8e2..4000427 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2591,14 +2591,6 @@ static int kvm_cpu_hotplug(struct notifier_block 
*notifier, unsigned long val,
return NOTIFY_OK;
 }
 
-
-asmlinkage void kvm_spurious_fault(void)
-{
-   /* Fault while not rebooting.  We want the trace. */
-   BUG();
-}
-EXPORT_SYMBOL_GPL(kvm_spurious_fault);
-
 static int kvm_reboot(struct notifier_block *notifier, unsigned long val,
  void *v)
 {
-- 
1.7.9.5


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] KVM: Move kvm_rebooting declaration out of x86

2013-04-05 Thread Geoff Levand
The variable kvm_rebooting is a common kvm variable, so move its
declaration from arch/x86/include/asm/kvm_host.h to
include/asm/kvm_host.h.

Fixes this sparse warning when building on arm64:

  virt/kvm/kvm_main.c:warning: symbol 'kvm_rebooting' was not declared. Should 
it be static?

Signed-off-by: Geoff Levand ge...@infradead.org
---
 arch/x86/include/asm/kvm_host.h |1 -
 include/linux/kvm_host.h|2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 4979778..8578da4 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -973,7 +973,6 @@ enum {
  * Trap the fault and ignore the instruction if that happens.
  */
 asmlinkage void kvm_spurious_fault(void);
-extern bool kvm_rebooting;
 
 #define kvm_handle_fault_on_reboot(insn, cleanup_insn) \
666:  insn \n\t \
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index cad77fe..19855c2 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -1028,6 +1028,8 @@ static inline bool kvm_check_request(int req, struct 
kvm_vcpu *vcpu)
}
 }
 
+extern bool kvm_rebooting;
+
 #ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT
 
 static inline void kvm_vcpu_set_in_spin_loop(struct kvm_vcpu *vcpu, bool val)
-- 
1.7.9.5


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 6/7] ARM: KVM: switch to a dual-step HYP init code

2013-04-04 Thread Geoff Levand
Hi,

On Tue, 2013-04-02 at 14:25 +0100, Marc Zyngier wrote:
 + @ Jump to the trampoline page
 + ldr r2, =#PAGE_MASK
 + adr r3, target
 + bic r3, r3, r2
 + ldr r2, =#TRAMPOLINE_VA
 + add r3, r3, r2
 + mov pc, r3

I guess you need 'ldr r2, =PAGE_MASK'.

  arch/arm/kvm/init.S:114: Error: bad expression -- `ldr r2,=#(~((112)-1))'
  arch/arm/kvm/init.S:117: Error: bad expression -- `ldr r2,=#0x'

-Geoff


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/7] kvm/arm: Fix missing include build error

2013-04-04 Thread Geoff Levand
Include linux/cpu.h in kvm/arm.c.  Fixes build errors like
these with ARCH=arm64:

arch/arm/kvm/arm.c: error: ‘CPU_STARTING_FROZEN’ undeclared

Signed-off-by: Geoff Levand ge...@infradead.org
---
 arch/arm/kvm/arm.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index 5a93698..49b4bc6 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -24,6 +24,7 @@
 #include linux/fs.h
 #include linux/mman.h
 #include linux/sched.h
+#include linux/cpu.h
 #include linux/kvm.h
 #include trace/events/kvm.h
 
-- 
1.7.9.5


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/7] kvm/arm: Remove unused kvm_arch_set_memory_region

2013-04-04 Thread Geoff Levand
Remove the unused and empty routine kvm_arch_set_memory_region().

Signed-off-by: Geoff Levand ge...@infradead.org
---
 arch/arm/kvm/arm.c |8 
 1 file changed, 8 deletions(-)

diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index 86becdc..a67b798 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -221,14 +221,6 @@ long kvm_arch_dev_ioctl(struct file *filp,
return -EINVAL;
 }
 
-int kvm_arch_set_memory_region(struct kvm *kvm,
-  struct kvm_userspace_memory_region *mem,
-  struct kvm_memory_slot old,
-  int user_alloc)
-{
-   return 0;
-}
-
 int kvm_arch_prepare_memory_region(struct kvm *kvm,
   struct kvm_memory_slot *memslot,
   struct kvm_memory_slot old,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/7] KVM minor fixups

2013-04-04 Thread Geoff Levand
Hi Marcelo,

These are a few fixups I found when running sparse and building Marc's 64 bit
ARM tree.  Please consider for 3.10.

-Geoff

The following changes since commit 07961ac7c0ee8b546658717034fe692fd12eefa9:

  Linux 3.9-rc5 (2013-03-31 15:12:43 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/geoff/kvm.git for-kvm

for you to fetch changes up to 5d9e775fd2d7c9ab03d70175610a5d8cedcc3799:

  kvm/arm: Remove unused kvm_arch_set_memory_region (2013-04-04 16:08:28 -0700)


Geoff Levand (7):
  kvm: Make local routines static
  kvm: Move vm_list, kvm_lock dec's out of x86
  kvm: Move kvm_spurious_fault dec out of x86
  kvm: Move kvm_rebooting dec out of x86
  kvm/arm: Fix missing include build error
  kvm/arm: Make force_vm_exit static
  kvm/arm: Remove unused kvm_arch_set_memory_region

 arch/arm/include/asm/kvm_host.h |1 -
 arch/arm/kvm/arm.c  |   11 ++-
 arch/x86/include/asm/kvm_host.h |   11 ---
 include/linux/kvm_host.h|   11 +++
 virt/kvm/kvm_main.c |8 
 5 files changed, 17 insertions(+), 25 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/7] kvm: Move kvm_rebooting dec out of x86

2013-04-04 Thread Geoff Levand
The variable kvm_rebooting is a common kvm variable, so move
its declaration from arch/x86/include/asm/kvm_host.h to
arch/arm/include/asm/kvm_host.h.

Fixes sparse warning when building on arm64:

  virt/kvm/kvm_main.c:warning: symbol 'kvm_rebooting' was not declared. Should 
it be static?

Signed-off-by: Geoff Levand ge...@infradead.org
---
 arch/x86/include/asm/kvm_host.h |2 --
 include/linux/kvm_host.h|1 +
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index da7c126..225139a 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -964,8 +964,6 @@ enum {
 #define HF_IRET_MASK   (1  4)
 #define HF_GUEST_MASK  (1  5) /* VCPU is in guest-mode */
 
-extern bool kvm_rebooting;
-
 #define kvm_handle_fault_on_reboot(insn, cleanup_insn) \
666:  insn \n\t \
668: \n\t   \
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 4bfb062..7165bd8 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -1037,6 +1037,7 @@ static inline bool kvm_check_request(int req, struct 
kvm_vcpu *vcpu)
  * Trap the fault and ignore the instruction if that happens.
  */
 asmlinkage void kvm_spurious_fault(void);
+extern bool kvm_rebooting;
 
 #ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT
 
-- 
1.7.9.5


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/7] kvm: Move kvm_spurious_fault dec out of x86

2013-04-04 Thread Geoff Levand
The routine kvm_spurious_fault() is a common kvm routine, so
move its declaration from arch/x86/include/asm/kvm_host.h to
arch/arm/include/asm/kvm_host.h.

Fixes sparse warning when building on arm64:

  virt/kvm/kvm_main.c:warning: symbol 'kvm_spurious_fault' was not declared. 
Should it be static?

Signed-off-by: Geoff Levand ge...@infradead.org
---
 arch/x86/include/asm/kvm_host.h |6 --
 include/linux/kvm_host.h|7 +++
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 40fc39f..da7c126 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -964,12 +964,6 @@ enum {
 #define HF_IRET_MASK   (1  4)
 #define HF_GUEST_MASK  (1  5) /* VCPU is in guest-mode */
 
-/*
- * Hardware virtualization extension instructions may fault if a
- * reboot turns off virtualization while processes are running.
- * Trap the fault and ignore the instruction if that happens.
- */
-asmlinkage void kvm_spurious_fault(void);
 extern bool kvm_rebooting;
 
 #define kvm_handle_fault_on_reboot(insn, cleanup_insn) \
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 8ef2212..4bfb062 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -1031,6 +1031,13 @@ static inline bool kvm_check_request(int req, struct 
kvm_vcpu *vcpu)
}
 }
 
+/*
+ * Hardware virtualization extension instructions may fault if a
+ * reboot turns off virtualization while processes are running.
+ * Trap the fault and ignore the instruction if that happens.
+ */
+asmlinkage void kvm_spurious_fault(void);
+
 #ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT
 
 static inline void kvm_vcpu_set_in_spin_loop(struct kvm_vcpu *vcpu, bool val)
-- 
1.7.9.5


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/7] kvm/arm: Make force_vm_exit static

2013-04-04 Thread Geoff Levand
The routine force_vm_exit() is not referenced outside kvm/arm.c,
so make it have static linkage.

Signed-off-by: Geoff Levand ge...@infradead.org
---
 arch/arm/include/asm/kvm_host.h |1 -
 arch/arm/kvm/arm.c  |2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
index d1736a5..1e93cef 100644
--- a/arch/arm/include/asm/kvm_host.h
+++ b/arch/arm/include/asm/kvm_host.h
@@ -149,7 +149,6 @@ struct kvm_one_reg;
 int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
 int kvm_arm_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
 u64 kvm_call_hyp(void *hypfn, ...);
-void force_vm_exit(const cpumask_t *mask);
 
 #define KVM_ARCH_WANT_MMU_NOTIFIER
 struct kvm;
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index 49b4bc6..86becdc 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -400,7 +400,7 @@ static void exit_vm_noop(void *info)
 {
 }
 
-void force_vm_exit(const cpumask_t *mask)
+static void force_vm_exit(const cpumask_t *mask)
 {
smp_call_function_many(mask, exit_vm_noop, NULL, true);
 }
-- 
1.7.9.5


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/7] kvm: Move vm_list, kvm_lock dec's out of x86

2013-04-04 Thread Geoff Levand
The variables vm_list and kvm_lock are common to all architectures, so move
the declarations from arch/x86/include/asm/kvm_host.h to
include/linux/kvm_host.h.

Fixes sparse warnings like these when building for arm64:

  virt/kvm/kvm_main.c: warning: symbol 'kvm_lock' was not declared. Should it 
be static?
  virt/kvm/kvm_main.c: warning: symbol 'vm_list' was not declared. Should it be 
static?

Signed-off-by: Geoff Levand ge...@infradead.org
---
 arch/x86/include/asm/kvm_host.h |3 ---
 include/linux/kvm_host.h|3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 4979778..40fc39f 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -94,9 +94,6 @@
 
 #define ASYNC_PF_PER_VCPU 64
 
-extern raw_spinlock_t kvm_lock;
-extern struct list_head vm_list;
-
 struct kvm_vcpu;
 struct kvm;
 struct kvm_async_pf;
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index cad77fe..8ef2212 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -133,6 +133,9 @@ struct kvm;
 struct kvm_vcpu;
 extern struct kmem_cache *kvm_vcpu_cache;
 
+extern raw_spinlock_t kvm_lock;
+extern struct list_head vm_list;
+
 struct kvm_io_range {
gpa_t addr;
int len;
-- 
1.7.9.5


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/7] kvm: Make local routines static

2013-04-04 Thread Geoff Levand
The routines get_user_page_nowait(), kvm_io_bus_sort_cmp(), 
kvm_io_bus_insert_dev()
and kvm_io_bus_get_first_dev()  are only referenced within kvm_main.c, so give 
them
static linkage.

Fixes sparse warnings like these:

  virt/kvm/kvm_main.c: warning: symbol 'get_user_page_nowait' was not declared. 
Should it be static?

Signed-off-by: Geoff Levand ge...@infradead.org
---
 virt/kvm/kvm_main.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index adc68fe..82ca8e2 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1099,7 +1099,7 @@ static int kvm_read_hva_atomic(void *data, void __user 
*hva, int len)
return __copy_from_user_inatomic(data, hva, len);
 }
 
-int get_user_page_nowait(struct task_struct *tsk, struct mm_struct *mm,
+static int get_user_page_nowait(struct task_struct *tsk, struct mm_struct *mm,
unsigned long start, int write, struct page **page)
 {
int flags = FOLL_TOUCH | FOLL_NOWAIT | FOLL_HWPOISON | FOLL_GET;
@@ -2631,7 +2631,7 @@ static void kvm_io_bus_destroy(struct kvm_io_bus *bus)
kfree(bus);
 }
 
-int kvm_io_bus_sort_cmp(const void *p1, const void *p2)
+static int kvm_io_bus_sort_cmp(const void *p1, const void *p2)
 {
const struct kvm_io_range *r1 = p1;
const struct kvm_io_range *r2 = p2;
@@ -2643,7 +2643,7 @@ int kvm_io_bus_sort_cmp(const void *p1, const void *p2)
return 0;
 }
 
-int kvm_io_bus_insert_dev(struct kvm_io_bus *bus, struct kvm_io_device *dev,
+static int kvm_io_bus_insert_dev(struct kvm_io_bus *bus, struct kvm_io_device 
*dev,
  gpa_t addr, int len)
 {
bus-range[bus-dev_count++] = (struct kvm_io_range) {
@@ -2658,7 +2658,7 @@ int kvm_io_bus_insert_dev(struct kvm_io_bus *bus, struct 
kvm_io_device *dev,
return 0;
 }
 
-int kvm_io_bus_get_first_dev(struct kvm_io_bus *bus,
+static int kvm_io_bus_get_first_dev(struct kvm_io_bus *bus,
 gpa_t addr, int len)
 {
struct kvm_io_range *range, key;
-- 
1.7.9.5


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/7] KVM minor fixups

2013-04-04 Thread Geoff Levand
Hi Christoffer,

On Thu, 2013-04-04 at 16:53 -0700, Christoffer Dall wrote:
 On Thu, Apr 4, 2013 at 4:33 PM, Geoff Levand ge...@infradead.org wrote:
  Hi Marcelo,
 
  These are a few fixups I found when running sparse and building Marc's 64 
  bit
  ARM tree.  Please consider for 3.10.
 
 running sparse - what does this mean?

make C=1.  It runs the checker, by default, sparse.

http://en.wikipedia.org/wiki/Sparse

-Geoff

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/7] kvm/arm: Fix missing include build error

2013-04-04 Thread Geoff Levand
Hi Christoffer,

On Thu, 2013-04-04 at 16:51 -0700, Christoffer Dall wrote:
 On Thu, Apr 4, 2013 at 4:33 PM, Geoff Levand ge...@infradead.org wrote:
  Include linux/cpu.h in kvm/arm.c.  Fixes build errors like
  these with ARCH=arm64:
 
  arch/arm/kvm/arm.c: error: ‘CPU_STARTING_FROZEN’ undeclared
 
  Signed-off-by: Geoff Levand ge...@infradead.org
  ---
   arch/arm/kvm/arm.c |1 +
   1 file changed, 1 insertion(+)
 
  diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
  index 5a93698..49b4bc6 100644
  --- a/arch/arm/kvm/arm.c
  +++ b/arch/arm/kvm/arm.c
  @@ -24,6 +24,7 @@
   #include linux/fs.h
   #include linux/mman.h
   #include linux/sched.h
  +#include linux/cpu.h
   #include linux/kvm.h
   #include trace/events/kvm.h
 
  --
 
 
 I'm confused, I don't see this symbol in arm.c - against which tree do
 these patches apply exactly? If this is something introduced by arm64,
 then it's premature, and should be added to that series.

Sorry, this one is from Marc's kvm-for-next branch.  I'll send it
to him to include, unless you just want to take it in preparation.

-Geoff

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/7] kvm/arm: Fix missing include build error

2013-04-04 Thread Geoff Levand
Hi,

On Thu, 2013-04-04 at 17:15 -0700, Christoffer Dall wrote:
 On Thu, Apr 4, 2013 at 5:04 PM, Geoff Levand ge...@infradead.org wrote:
 
  Sorry, this one is from Marc's kvm-for-next branch.  I'll send it
  to him to include, unless you just want to take it in preparation.
 
 Hmm, not sure what the status of his branch is exactly. Does it
 contain the arm64 stuff?

Yes, it is pretty much his most recent.

 I don't really want to merge this before it's needed.

OK, that's fine.  I'll just add it to a few other 64 bit specific
fixups I'll be sending to Marc.

-Geoff




--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 23/29] arm64: KVM: 32bit GP register access

2013-03-15 Thread Geoff Levand
Hi Marc,

On Tue, 2013-03-05 at 03:47 +, Marc Zyngier wrote:
 diff --git a/arch/arm64/kvm/regmap.c b/arch/arm64/kvm/regmap.c
 new file mode 100644
 index 000..f8d4a0c
 --- /dev/null
 +++ b/arch/arm64/kvm/regmap.c

...

 + switch (mode) {
 + case COMPAT_PSR_MODE_USR...COMPAT_PSR_MODE_SVC:

I think it would be safer to have this with spaces in case someone
changes the macro defs or copies this to make some new code and screws
up their defs:

  case COMPAT_PSR_MODE_USR ... COMPAT_PSR_MODE_SVC:

See: http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Case-Ranges.html

-Geoff

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/29] arm64: KVM: Basic ESR_EL2 helpers and vcpu register access

2013-03-15 Thread Geoff Levand
Hi Marc,

On Tue, 2013-03-05 at 03:47 +, Marc Zyngier wrote:
 --- /dev/null
 +++ b/arch/arm64/include/asm/kvm_emulate.h
...

 +static inline bool vcpu_mode_is_32bit(struct kvm_vcpu *vcpu)
 +{
 + return false;   /* 32bit? Bahhh... */
 +}
 +
 +static inline bool kvm_condition_valid(struct kvm_vcpu *vcpu)
 +{
 + return true;/* No conditionals on arm64 */
 +}


Does it make sense to have these routines take a const object?

  static inline bool vcpu_mode_is_32bit(struct kvm_vcpu const *vcpu)

-Geoff

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 06/29] arm64: KVM: fault injection into a guest

2013-03-15 Thread Geoff Levand
Hi Marc,

On Tue, 2013-03-05 at 03:47 +, Marc Zyngier wrote:
 --- /dev/null
 +++ b/arch/arm64/kvm/inject_fault.c
 @@ -0,0 +1,117 @@

...

 + * kvm_inject_undefined - inject a undefined instruction into the guest

s/ a undefined/ an undefined/

-Geoff

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] KVM: Remove duplicate text in api.txt

2013-01-31 Thread Geoff Levand
Signed-off-by: Geoff Levand ge...@infradead.org
---

Saw this in v3.8-rc5, please apply.

 Documentation/virtual/kvm/api.txt |   13 -
 1 file changed, 13 deletions(-)

diff --git a/Documentation/virtual/kvm/api.txt 
b/Documentation/virtual/kvm/api.txt
index a4df553..a65a6b3 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -212,33 +212,20 @@ hardware requires all the hardware threads in a CPU core 
to be in the
 same partition.)  The KVM_CAP_PPC_SMT capability indicates the number
 of vcpus per virtual core (vcore).  The vcore id is obtained by
 dividing the vcpu id by the number of vcpus per vcore.  The vcpus in a
 given vcore will always be in the same physical core as each other
 (though that might be a different physical core from time to time).
 Userspace can control the threading (SMT) mode of the guest by its
 allocation of vcpu ids.  For example, if userspace wants
 single-threaded guest vcpus, it should make all vcpu ids be a multiple
 of the number of vcpus per vcore.
 
-On powerpc using book3s_hv mode, the vcpus are mapped onto virtual
-threads in one or more virtual CPU cores.  (This is because the
-hardware requires all the hardware threads in a CPU core to be in the
-same partition.)  The KVM_CAP_PPC_SMT capability indicates the number
-of vcpus per virtual core (vcore).  The vcore id is obtained by
-dividing the vcpu id by the number of vcpus per vcore.  The vcpus in a
-given vcore will always be in the same physical core as each other
-(though that might be a different physical core from time to time).
-Userspace can control the threading (SMT) mode of the guest by its
-allocation of vcpu ids.  For example, if userspace wants
-single-threaded guest vcpus, it should make all vcpu ids be a multiple
-of the number of vcpus per vcore.
-
 For virtual cpus that have been created with S390 user controlled virtual
 machines, the resulting vcpu fd can be memory mapped at page offset
 KVM_S390_SIE_PAGE_OFFSET in order to obtain a memory map of the virtual
 cpu's hardware control block.
 
 
 4.8 KVM_GET_DIRTY_LOG (vm ioctl)
 
 Capability: basic
 Architectures: x86


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html