[PATCH 15/15] KVM: PPC: book3s_hv: Add support for PPC970-family processors

2011-06-18 Thread Paul Mackerras
l external interrupt pending but the guest has MSR[EE] = 0, we have to arrange to have an interrupt pending for it so that we can get control back once it re-enables interrupts. We do that by sending ourselves an IPI with smp_send_reschedule after hard-disabling interrupts. Signed-off-by: Paul

Re: [PATCH 0/15] Hypervisor-mode KVM on POWER7 and PPC970

2011-06-18 Thread Paul Mackerras
On Sat, Jun 18, 2011 at 04:34:14PM +0200, Alexander Graf wrote: > I just applied them on top of kvm-ppc-next and started compiling for > book3s_64_pr=M: > > arch/powerpc/kernel/exceptions-64s.S: Assembler messages: > arch/powerpc/kernel/exceptions-64s.S:314: Error: undefined symbol > `PACA_KVM_

[PATCH 08/15 revised] KVM: PPC: Split host-state fields out of kvmppc_book3s_shadow_vcpu

2011-06-18 Thread Paul Mackerras
te in and out on vcpu load/unload, and in future will mean that the book3s_hv code doesn't need a shadow_vcpu struct in the PACA at all. Signed-off-by: Paul Mackerras --- Fixed compilation with CONFIG_POWER4_ONLY=n arch/powerpc/include/asm/exception-64s.h | 10 ++-- arch/powerpc/i

[PATCH 06/17] KVM: PPC: Pass init/destroy vm and prepare/commit memory region ops down

2011-06-29 Thread Paul Mackerras
This arranges for the top-level arch/powerpc/kvm/powerpc.c file to pass down some of the calls it gets to the lower-level subarchitecture specific code. The lower-level implementations (in booke.c and book3s.c) are no-ops. The coming book3s_hv.c will need this. Signed-off-by: Paul Mackerras

[PATCH 04/17] powerpc, KVM: Rework KVM checks in first-level interrupt handlers

2011-06-29 Thread Paul Mackerras
. Because the first-level interrupt handlers are now larger, some things had to be move out of line in exceptions-64s.S. This all necessitated some minor changes to the interrupt entry code in KVM. This also streamlines the book3s_32 KVM test. Signed-off-by: Paul Mackerras --- arch/powerpc/include

[PATCH 07/17] KVM: PPC: Move guest enter/exit down into subarch-specific code

2011-06-29 Thread Paul Mackerras
hypervisor mode code. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_ppc.h |1 + arch/powerpc/kvm/book3s_interrupts.S |2 +- arch/powerpc/kvm/book3s_pr.c | 12 ++-- arch/powerpc/kvm/booke.c | 13 + arch/powerpc/kvm/powerpc.c

[PATCH 05/17] KVM: PPC: Deliver program interrupts right away instead of queueing them

2011-06-29 Thread Paul Mackerras
ts to the guest, but if we did, then we would need to make sure they got delivered rather than the program interrupt. The current code would be wrong in this situation anyway since it would deliver the program interrupt as well as the reset/machine check interrupt. Signed-off-by: Paul Mackerras --

[PATCH 11/17] KVM: PPC: Handle some PAPR hcalls in the kernel

2011-06-29 Thread Paul Mackerras
Register a virtual processor area (VPA) The code that runs in real mode has to be in the base kernel, not in the module, if KVM is compiled as a module. The real-mode code can only access the kernel linear mapping, not vmalloc or ioremap space. Signed-off-by: Paul Mackerras --- arch/powerpc/include

[PATCH 01/17] KVM: PPC: Fix machine checks on 32-bit Book3S

2011-06-29 Thread Paul Mackerras
ese addresses to physical addresses. Signed-off-by: Paul Mackerras --- arch/powerpc/kvm/book3s.c |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c index 73fdab8..83500fb 100644 --- a/arch/powerpc/kvm/book3s.c +++ b/

[PATCH 15/17] powerpc, KVM: Split HVMODE_206 cpu feature bit into separate HV and architecture bits

2011-06-29 Thread Paul Mackerras
running bare-metal, i.e. in hypervisor mode. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/cputable.h| 14 -- arch/powerpc/include/asm/reg.h | 16 arch/powerpc/kernel/cpu_setup_power7.S |4 ++-- arch/powerpc/kernel/cpu_setup_ppc970.S | 26

[RFC PATCH 17/17] KVM: PPC: Add an ioctl for userspace to select which platform to emulate

2011-06-29 Thread Paul Mackerras
201, and when running on a POWER7, it must contain 206. Signed-off-by: Paul Mackerras --- Documentation/virtual/kvm/api.txt | 35 +++ arch/powerpc/include/asm/kvm.h | 15 +++ arch/powerpc/include/asm/kvm_host.h |1 + arch/powerpc/kvm

[PATCH 08/17] powerpc: Set up LPCR for running guest partitions

2011-06-29 Thread Paul Mackerras
) composed of 16MB large pages, and hypervisor decrementer interrupts are disabled. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/reg.h |4 arch/powerpc/kernel/cpu_setup_power7.S | 18 +++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/arch

[PATCH 16/17] KVM: PPC: book3s_hv: Add support for PPC970-family processors

2011-06-29 Thread Paul Mackerras
l external interrupt pending but the guest has MSR[EE] = 0, we have to arrange to have an interrupt pending for it so that we can get control back once it re-enables interrupts. We do that by sending ourselves an IPI with smp_send_reschedule after hard-disabling interrupts. Signed-off-by: Paul

[PATCH 09/17] KVM: PPC: Split host-state fields out of kvmppc_book3s_shadow_vcpu

2011-06-29 Thread Paul Mackerras
preempted. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/exception-64s.h | 10 ++-- arch/powerpc/include/asm/kvm_book3s_asm.h | 27 ++--- arch/powerpc/include/asm/paca.h |1 + arch/powerpc/kernel/asm-offsets.c | 94 ++-- arch/powe

[PATCH 0/17] Hypervisor-mode KVM on POWER7 and PPC970

2011-06-29 Thread Paul Mackerras
The first patch of the following series is a pure bug-fix for 32-bit kernels. The remainder of the following series of patches enable KVM to exploit the hardware hypervisor mode on 64-bit Power ISA Book3S machines. At present, POWER7 and PPC970 processors are supported. (Note that the PPC970 pro

[PATCH 12/17] KVM: PPC: Accelerate H_PUT_TCE by implementing it in real mode

2011-06-29 Thread Paul Mackerras
most of the time. Specifically, allowing this will avoid awkwardness when we need to reset the table. More importantly, we will in the future need to write the table in order to restore its state after a checkpoint resume or migration. Signed-off-by: David Gibson Signed-off-by: Paul Mackerras

[PATCH 13/17] KVM: PPC: Allow book3s_hv guests to use SMT processor modes

2011-06-29 Thread Paul Mackerras
use the lower-numbered hardware threads in preference to higher-numbered threads if not all the vcpus in the vcore are runnable, regardless of which vcpus are runnable. Signed-off-by: Paul Mackerras --- Documentation/virtual/kvm/api.txt | 13 ++ arch/powerpc/include/asm/kvm.h

[PATCH 02/17] KVM: PPC: Move fields between struct kvm_vcpu_arch and kvmppc_vcpu_book3s

2011-06-29 Thread Paul Mackerras
state of the emulated CPU, and the kvmppc_vcpu_book3s struct holds the auxiliary data structures used in the emulation. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_book3s.h | 35 +--- arch/powerpc/include/asm/kvm_host.h | 34 +++- arch/powerpc/kvm

[PATCH 14/17] KVM: PPC: Allocate RMAs (Real Mode Areas) at boot for use by guests

2011-06-29 Thread Paul Mackerras
struct and arranges for the MER (mediated external request) bit, which is the only bit that varies between vcpus, to be set in assembly code when going into the guest if there is a pending external interrupt request. Signed-off-by: Paul Mackerras --- Documentation/virtual/kvm/api.txt |

Re: [PATCH 0/5] perf support for amd guest/host-only bits v2

2011-06-29 Thread Paul Mackerras
On Wed, Jun 29, 2011 at 11:02:54AM +0200, Peter Zijlstra wrote: > On Tue, 2011-06-28 at 18:10 +0200, Joerg Roedel wrote: > > On Fri, Jun 17, 2011 at 03:37:29PM +0200, Joerg Roedel wrote: > > > this is the second version of the patch-set to support the AMD > > > guest-/host only bits in the performa

Re: [RFC PATCH 17/17] KVM: PPC: Add an ioctl for userspace to select which platform to emulate

2011-07-01 Thread Paul Mackerras
On Thu, Jun 30, 2011 at 05:04:23PM +0200, Alexander Graf wrote: > On 06/29/2011 12:41 PM, Paul Mackerras wrote: > >+struct kvm_ppc_set_platform { > >+__u16 platform; /* defines the OS/hypervisor ABI */ > >+__u16 guest_arch; /* e.g. decimal 206 for v2.06 *

Re: [PATCH 10/17] KVM: PPC: Add support for Book3S processors in hypervisor mode

2011-07-04 Thread Paul Mackerras
On Fri, Jul 01, 2011 at 11:37:42AM -0700, Dave Hansen wrote: > On Wed, 2011-06-29 at 20:21 +1000, Paul Mackerras wrote: > > +struct kvmppc_pginfo { > > + unsigned long pfn; > > + atomic_t refcnt; > > +}; > > I only see this refcnt inc'd in one spot a

Re: [PATCH 10/10] KVM: PPC: Enable the PAPR CAP for Book3S

2011-08-09 Thread Paul Mackerras
On Tue, Aug 09, 2011 at 06:31:48PM +0200, Alexander Graf wrote: > Now that Book3S PV mode can also run PAPR guests, we can add a PAPR cap and > enable it for all Book3S targets. Enabling that CAP switches KVM into PAPR > mode. Don't we want to enable it only for 64-bit hosts? Trying to run a PAP

Re: [PATCH 10/10] KVM: PPC: Enable the PAPR CAP for Book3S

2011-08-10 Thread Paul Mackerras
On Wed, Aug 10, 2011 at 09:59:41AM +0200, Alexander Graf wrote: > > Am 10.08.2011 um 06:42 schrieb Paul Mackerras : > > > On Tue, Aug 09, 2011 at 06:31:48PM +0200, Alexander Graf wrote: > > > >> Now that Book3S PV mode can also run PAPR guests, we can add a PAPR

KVM: PPC: Book3S HV: Fix incorrect branch in H_CEDE code

2012-07-26 Thread Paul Mackerras
es the problem by using a textual label, 'kvm_cede_prodded'. It also changes the label for another longish branch from '2:' to 'kvm_cede_exit' to avoid a possible future problem if code modifications add another numeric '2:' label in between. Cc: sta...@vge

[PATCH] KVM: PPC: Quieten message about allocating linear regions

2012-07-26 Thread Paul Mackerras
This message is printed once for every RMA or HPT region that gets preallocated. If one preallocates hundreds of such regions (in order to run hundreds of KVM guests), that gets rather painful, so make it a bit quieter. Signed-off-by: Paul Mackerras --- arch/powerpc/kvm/book3s_hv_builtin.c

Re: [GIT PULL (PATCH 0/4)] VFIO driver for v3.6

2012-07-26 Thread Paul Mackerras
On Wed, Jul 25, 2012 at 08:53:06AM -0600, Alex Williamson wrote: > Hi Linus, > > This series includes the VFIO userspace driver interface for the > 3.6 kernel merge window. This driver is intended to provide a > secure interface for device access using IOMMU protection for > applications like ass

[PATCH] KVM: PPC: Book3S HV: Handle memory slot deletion and modification

2012-07-30 Thread Paul Mackerras
>From 4df5da62cb49b71c9a70072341dcb0557768c520 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Mon, 30 Jul 2012 16:40:54 +1000 Subject: [PATCH] KVM: PPC: Book3S HV: Handle memory slot deletion and modification correctly At present the HV style of KVM doesn't handle deletion or modi

Re: [RFC PATCH 3/3] KVM: Push rmap into kvm_arch_memory_slot

2012-08-02 Thread Paul Mackerras
VM, ppc'd > better restrict the allocation to Book3S HV. > > Signed-off-by: Takuya Yoshikawa > Cc: Paul Mackerras Looks like a worthwhile change. I do have some patches in preparation that will intersect with this, but I can manage that once these patches go upstream. Acked-by: Pau

Re: [PATCH 4/9] KVM: define kvm_bad_pfn statically

2012-08-02 Thread Paul Mackerras
On Thu, Aug 02, 2012 at 10:15:27AM -0300, Marcelo Tosatti wrote: > Remind me what is the guarantee that -Exxx does not clash with > a valid pfn number? A pfn number is an address >> PAGE_SHIFT, so it will have the top 12 (at least) bits clear, whereas -Exxx will have the top bit set. Paul. -- To

[PATCH 1/5] KVM: PPC: Book3S HV: Fix incorrect branch in H_CEDE code

2012-08-06 Thread Paul Mackerras
es the problem by using a textual label, 'kvm_cede_prodded'. It also changes the label for another longish branch from '2:' to 'kvm_cede_exit' to avoid a possible future problem if code modifications add another numeric '2:' label in between. Signed-off-by: Pau

[PATCH 4/5] KVM: PPC: Book3S HV: Take the SRCU read lock before looking up memslots

2012-08-06 Thread Paul Mackerras
ENTER/H_REMOVE/H_BULK_REMOVE are performance-critical hot paths. Signed-off-by: Paul Mackerras --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 17 + arch/powerpc/kvm/book3s_hv.c| 27 +++ 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a

[PATCH 0/5] Improve memory slot handling and other fixes

2012-08-06 Thread Paul Mackerras
This series of 5 patches starts off with two fixes that I have posted previously but not got any response to, and then has 3 patches to improve our handling of memory slots on PPC. The first of those 3 makes HV-style KVM able to handle deletion and modification of memory slots properly. The secon

[PATCH 2/5] KVM: PPC: Quieten message about allocating linear regions

2012-08-06 Thread Paul Mackerras
This is printed once for every RMA or HPT region that get preallocated. If one preallocates hundreds of such regions (in order to run hundreds of KVM guests), that gets rather painful, so make it a bit quieter. Signed-off-by: Paul Mackerras --- arch/powerpc/kvm/book3s_hv_builtin.c |4

[RFC PATCH 5/5] KVM: PPC: Take the SRCU lock around memslot use

2012-08-06 Thread Paul Mackerras
therefore adds srcu_read_lock/unlock pairs around code that accesses and uses memslots in the Book 3S PR code and the Book E (44x and e500) code. Signed-off-by: Paul Mackerras --- Compile-tested only. arch/powerpc/kvm/44x_tlb.c |6 ++ arch/powerpc/kvm/book3s_pr.c |6 ++ arch/powerpc

[PATCH 3/5] KVM: PPC: Book3S HV: Handle memory slot deletion and modification correctly

2012-08-06 Thread Paul Mackerras
>From 44067a8ee15021583636bea4cc1d47e5370b8397 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Mon, 30 Jul 2012 16:40:54 +1000 Subject: At present the HV style of KVM doesn't handle deletion or modification of memory slots correctly. Deletion occurs when userspace

Re: [PATCH 6/8] KVM: PPC: E500: Implement MMU notifiers

2012-08-08 Thread Paul Mackerras
On Tue, Aug 07, 2012 at 12:57:14PM +0200, Alexander Graf wrote: > The e500 target has lived without mmu notifiers ever since it got > introduced, but fails for the user space check on them with hugetlbfs. Ironically that user space check isn't necessary any more since David Gibson's fix for the hu

Re: [RFC PATCH 5/5] KVM: PPC: Take the SRCU lock around memslot use

2012-08-09 Thread Paul Mackerras
On Thu, Aug 09, 2012 at 03:27:17PM -0300, Marcelo Tosatti wrote: > On Mon, Aug 06, 2012 at 08:08:16PM +1000, Paul Mackerras wrote: > > The generic KVM code uses SRCU (sleeping RCU) to protect accesses > > to the memslots data structures against updates due to userspace > >

Re: [PATCH 4/5] KVM: PPC: Book3S HV: Take the SRCU read lock before looking up memslots

2012-08-09 Thread Paul Mackerras
On Thu, Aug 09, 2012 at 03:22:38PM -0300, Marcelo Tosatti wrote: > On Mon, Aug 06, 2012 at 08:06:55PM +1000, Paul Mackerras wrote: > > The generic KVM code uses SRCU (sleeping RCU) to protect accesses > > to the memslots data structures against updates due to userspace > >

Re: [PATCH 3/5] KVM: PPC: Book3S HV: Handle memory slot deletion and modification correctly

2012-08-09 Thread Paul Mackerras
On Thu, Aug 09, 2012 at 03:16:12PM -0300, Marcelo Tosatti wrote: > The !memslot->npages case is handled in __kvm_set_memory_region > (please read that part, before kvm_arch_prepare_memory_region() call). > > kvm_arch_flush_shadow should be implemented. Book3S HV doesn't have shadow page tables p

Re: [PATCH 3/5] KVM: PPC: Book3S HV: Handle memory slot deletion and modification correctly

2012-08-10 Thread Paul Mackerras
On Fri, Aug 10, 2012 at 03:35:53PM -0300, Marcelo Tosatti wrote: > There's no plan. I just wanted to confirm this before converting > to per-memslot flush. > > 1) __kvm_set_memory_region line 807: > > * - gfn_to_hva (kvm_read_guest, gfn_to_pfn) > * - k

Re: [PATCH 3/5] KVM: PPC: Book3S HV: Handle memory slot deletion and modification correctly

2012-08-14 Thread Paul Mackerras
On Mon, Aug 13, 2012 at 01:34:11PM -0300, Marcelo Tosatti wrote: > On Sat, Aug 11, 2012 at 10:37:54AM +1000, Paul Mackerras wrote: > > In fact I need to remove any translations in the old range *before* > > the new memslot gets committed, whereas this happens after that. > &

[PATCH] KVM: PPC: Book3S HV: Provide a way for userspace to get/set per-vCPU areas

2012-08-16 Thread Paul Mackerras
, leading to an oops when unregistering the VPA. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_ppc.h |2 ++ arch/powerpc/kvm/book3s_hv.c | 54 +++- arch/powerpc/kvm/powerpc.c | 23 +++ include/linux/kvm.h

Re: [PATCH 2/7] powerpc/kvm: Remove bogus update of thread IDs in HV KVM

2012-08-17 Thread Paul Mackerras
On Fri, Aug 17, 2012 at 06:38:29PM +1000, Benjamin Herrenschmidt wrote: > When making a vcpu non-runnable we incorrectly changed the > thread IDs of all other threads on the core, just remove that > code. > > Signed-off-by: Benjamin Herrenschmidt Acked-by: Paul Mackerras -- To u

Re: [PATCH 1/7] powerpc/kvm: Fix updates of vcpu->cpu on HV KVM

2012-08-17 Thread Paul Mackerras
gt; threads VCPUs when they are running (due to them sleeping on our > private waitqueue) causing unload to be called, potentially > clobbering the value. > > Signed-off-by: Benjamin Herrenschmidt Acked-by: Paul Mackerras -- To unsubscribe from this list: send the line "unsubsc

Re: [PATCH] kvm/book3s: fix build error caused by gfn_to_hva_memslot()

2012-08-24 Thread Paul Mackerras
On Thu, Aug 23, 2012 at 05:24:00PM +0900, Takuya Yoshikawa wrote: > On Thu, 23 Aug 2012 15:42:49 +0800 > Gavin Shan wrote: > > > The build error was caused by that builtin functions are calling > > the functions implemented in modules. That was introduced by the > > following commit. > > > > com

Re: [PATCH v2] kvm/book3s: fix build error caused by gfn_to_hva_memslot()

2012-08-24 Thread Paul Mackerras
patch fixes the build error by moving function __gfn_to_hva_memslot() > from kvm_main.c to kvm_host.h and making that "inline" so that the > builtin function (kvmppc_h_enter) can use that. > > Signed-off-by: Gavin Shan Acked-by: Paul Mackerras By the way, when you gi

Re: [PATCH 3/5] KVM: PPC: Book3S HV: Handle memory slot deletion and modification correctly

2012-08-24 Thread Paul Mackerras
On Thu, Aug 23, 2012 at 10:55:37AM -0300, Marcelo Tosatti wrote: > There are a number of options to consider: > > 1) Merge the current patchset from Paul, which has two downsides: > 1-1) It contains an unfixable race. The race being that new HTPEs using the old base address could get inser

Re: [patch 0/3] kvm: split kvm_arch_flush_shadow and move mmio spte invalidation to x86

2012-08-25 Thread Paul Mackerras
On Fri, Aug 24, 2012 at 03:54:56PM -0300, Marcelo Tosatti wrote: > Paul, does that work for you. Yes, looks great, thanks. Paul. -- 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/m

[PATCH RFC 2/2] KVM: PPC: Book3S HV: Handle memory slot deletion and modification correctly

2012-08-25 Thread Paul Mackerras
obviously don't care about the dirty bits any more. Signed-off-by: Paul Mackerras --- This is on top of Alex's kvm-ppc-next branch with the KVM tree's next branch merged in and then Marcelo's set of 3 patches on that. This needs more testing, but I thought I would get the

[PATCH RFC 1/2] KVM: PPC: Move kvm->arch.slot_phys into memslot.arch

2012-08-25 Thread Paul Mackerras
in to kvmppc_core_prepare_memory_region, since we need to initialize its arch.slot_phys member on Book3S HV. Signed-off-by: Paul Mackerras --- This is on top of Alex's kvm-ppc-next branch with the KVM tree's next branch merged in and then Marcelo's set of 3 patches on that. arch/powerpc/include/a

[PATCH 06/12] KVM: PPC: Book3S HV: Remove bogus update of thread IDs in HV KVM

2012-08-28 Thread Paul Mackerras
From: Benjamin Herrenschmidt When making a vcpu non-runnable we incorrectly changed the thread IDs of all other threads on the core, just remove that code. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Paul Mackerras --- arch/powerpc/kvm/book3s_hv.c |6 -- 1 file changed, 6

[PATCH 07/12] KVM: PPC: Book3S HV: Fix some races in starting secondary threads

2012-08-28 Thread Paul Mackerras
vcpu pointer before incrementing the nap count. It also removes unnecessary setting of the vcpu and vcore pointers in the paca in kvmppc_core_vcpu_load. Signed-off-by: Paul Mackerras --- arch/powerpc/kvm/book3s_hv.c| 41 ++- arch/powerpc/kvm/book3s_hv_rmhandl

[PATCH 04/12] KVM: PPC: Book3S HV: Allow KVM guests to stop secondary threads coming online

2012-08-28 Thread Paul Mackerras
nning. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/smp.h |8 arch/powerpc/kernel/smp.c | 44 arch/powerpc/kvm/book3s_hv.c | 12 +-- 3 files changed, 62 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/in

[PATCH 10/12] KVM: PPC: Book3S HV: Run virtual core whenever any vcpus in it can run

2012-08-28 Thread Paul Mackerras
state have been combined into a single KVMPPC_VCPU_NOTREADY state, since we no longer need to distinguish between them. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_host.h |5 +-- arch/powerpc/kvm/book3s_hv.c| 74 ++- 2 files changed

[PATCH 02/12] KVM: PPC: Book3S HV: Take the SRCU read lock before looking up memslots

2012-08-28 Thread Paul Mackerras
ENTER/H_REMOVE/H_BULK_REMOVE are performance-critical hot paths. Signed-off-by: Paul Mackerras --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 17 + arch/powerpc/kvm/book3s_hv.c| 27 +++ 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a

[PATCH 0/12] Sundry fixes for Book3S HV

2012-08-28 Thread Paul Mackerras
This set of 12 patches contains various fixes collected during the process of getting reboot of Book3S HV guests to work correctly, plus some needed for Ben H's forthcoming series to implement in-kernel XICS (interrupt controller) emulation, plus two patches around handling memslots properly. This

[PATCH 12/12] KVM: PPC: Book3S HV: Fix calculation of guest phys address for MMIO emulation

2012-08-28 Thread Paul Mackerras
the gpa right PAGE_SHIFT bits. Reported-by: Alexey Kardashevskiy Signed-off-by: Paul Mackerras --- arch/powerpc/kvm/book3s_64_mmu_hv.c |9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c index

[PATCH 09/12] KVM: PPC: Book3S HV: Fixes for late-joining threads

2012-08-28 Thread Paul Mackerras
st it, and therefore never increment the nap_count, leading to messages about wait_for_nap timeouts. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_host.h |7 --- arch/powerpc/kvm/book3s_hv.c| 14 +++--- 2 files changed, 15 insertions(+), 6 deletions(-)

[PATCH 11/12] KVM: PPC: Book3S HV: Fix accounting of stolen time

2012-08-28 Thread Paul Mackerras
could be genuinely stopped. Since we have no way of dividing up the time between these cases, we don't count any of it as stolen. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_host.h |5 ++ arch/powerpc/kvm/book3s_hv.c| 127 ++- 2

[PATCH 05/12] KVM: PPC: Fix updates of vcpu->cpu on HV KVM

2012-08-28 Thread Paul Mackerras
causing unload to be called, potentially clobbering the value. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Paul Mackerras --- arch/powerpc/kvm/book3s_pr.c |3 ++- arch/powerpc/kvm/booke.c |2 ++ arch/powerpc/kvm/powerpc.c |2 -- 3 files changed, 4 insertions(+), 3 deletions(-

[PATCH 03/12] KVM: PPC: Book3S HV: Provide a way for userspace to get/set per-vCPU areas

2012-08-28 Thread Paul Mackerras
, leading to an oops when unregistering the VPA. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_ppc.h |2 ++ arch/powerpc/kvm/book3s_hv.c | 54 +++- arch/powerpc/kvm/powerpc.c | 23 +++ include/linux/kvm.h

[PATCH 01/12] KVM: PPC: Move kvm->arch.slot_phys into memslot.arch

2012-08-28 Thread Paul Mackerras
in to kvmppc_core_prepare_memory_region, since we need to initialize its arch.slot_phys member on Book3S HV. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_host.h |9 +-- arch/powerpc/include/asm/kvm_ppc.h |5 ++ arch/powerpc/kvm/book3s_64_mmu_hv.c |6 +- arch/powerpc/kvm/book3s

[PATCH 08/12] KVM: PPC: Book3s HV: Don't access runnable threads list without vcore lock

2012-08-28 Thread Paul Mackerras
caller has already done that. The caller (kvmppc_run_vcpu) wasn't actually checking for pending exceptions, so we add that. The change of if to while in kvmppc_run_vcpu is to make sure that we never call kvmppc_remove_runnable() when the vcore state is RUNNING or EXITING. Signed-off-by: Pa

[PATCH v2 04/12] KVM: PPC: Book3S HV: Allow KVM guests to stop secondary threads coming online

2012-08-28 Thread Paul Mackerras
nning. Signed-off-by: Paul Mackerras --- v2: export {,un}inhibit_secondary_onlining for the case where KVM is a module. arch/powerpc/include/asm/smp.h |8 +++ arch/powerpc/kernel/smp.c | 46 arch/powerpc/kvm/book3s_hv.c | 12 +

[RFC PATCH 11/11] KVM: PPC: Eliminate global spinlock in kvmppc_h_enter

2011-11-16 Thread Paul Mackerras
>From dfd5bcfac841f8a36593edf60d9fb15e0d633287 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Mon, 14 Nov 2011 13:30:38 +1100 Subject: Currently, kvmppc_h_enter takes a spinlock that is global to the guest, kvm->mmu_lock, in order to check for pending PTE invalidations safely. O

Re: [RFC PATCH 0/11] KVM: PPC: Update Book3S HV memory handling

2011-11-18 Thread Paul Mackerras
On Fri, Nov 18, 2011 at 02:57:11PM +0100, Alexander Graf wrote: > > This touches areas that I'm sure non-PPC people would want to see as > well. Could you please CC kvm@vger too next time? > > Avi, Marcelo, mind to review some of the bits in this patch set? :) I did cc the last patch (the one th

[PATCH 11/13] KVM: Add barriers to allow mmu_notifier_retry to be used locklessly

2011-12-05 Thread Paul Mackerras
bal spinlock in order to improve the scalability of updates to the guest MMU hashed page table, and so needs this. Signed-off-by: Paul Mackerras --- include/linux/kvm_host.h | 14 +- virt/kvm/kvm_main.c |6 +++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --gi

[PATCH 0/13] KVM: PPC: Update Book3S HV memory handling

2011-12-05 Thread Paul Mackerras
This series of patches updates the Book3S-HV KVM code that manages the guest hashed page table (HPT) to enable several things: * MMIO emulation and MMIO pass-through * Use of small pages (4kB or 64kB, depending on config) to back the guest memory * Pageable guest memory - i.e. backing pages ca

[PATCH 06/13] KVM: PPC: Only get pages when actually needed, not in prepare_memory_region()

2011-12-05 Thread Paul Mackerras
s[] arrays from multiple vcpu threads, we now have a spinlock protecting those updates to ensure that we don't lose track of any references to pages. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_book3s.h|4 + arch/powerpc/include/asm/kvm_book3s_64.h | 12 ++ arch

[PATCH 02/13] KVM: PPC: Keep a record of HV guest view of hashed page table entries

2011-12-05 Thread Paul Mackerras
s of HPT_ORDER etc. to a header file and defining HPT_NPTE for HPT_NPTEG << 3. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_book3s_64.h |8 +++ arch/powerpc/include/asm/kvm_host.h | 10 arch/powerpc/kvm/book3s_64_mmu_hv.c | 44 +++ a

[PATCH 03/13] KVM: PPC: Keep page physical addresses in per-slot arrays

2011-12-05 Thread Paul Mackerras
l RMO regions. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_host.h |8 ++- arch/powerpc/kvm/book3s_64_mmu_hv.c | 18 +++--- arch/powerpc/kvm/book3s_hv.c| 114 +-- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 44 - 4 files changed

[PATCH 04/13] KVM: PPC: Add an interface for pinning guest pages in Book3s HV guests

2011-12-05 Thread Paul Mackerras
unpin them when they are no longer required. Although it is not strictly necessary to pin the pages at this point, since all guest pages are already pinned, later commits in this series will mean that guest pages aren't all pinned. Signed-off-by: Paul Mackerras --- arch/powerpc/includ

[PATCH 09/13] KVM: PPC: Maintain a doubly-linked list of guest HPTEs for each gfn

2011-12-05 Thread Paul Mackerras
lock bit. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_book3s_64.h | 18 ++ arch/powerpc/include/asm/kvm_host.h | 17 ++- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 84 +- 3 files changed, 117 insertions(+), 2 deletions(-) diff

[PATCH 08/13] KVM: PPC: Allow I/O mappings in memory slots

2011-12-05 Thread Paul Mackerras
ntries. Then, in kvmppc_h_enter() we check that the cache bits in the HPTE that the guest wants to insert match the cache bits in the slot_phys array entry. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_book3s_64.h | 26 +++ arch/powerpc/include/asm/kvm_host.h |2 +

[PATCH 10/13] KVM: PPC: Implement MMIO emulation support for Book3S HV guests

2011-12-05 Thread Paul Mackerras
, but since heavily reworked. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_book3s.h|5 + arch/powerpc/include/asm/kvm_book3s_64.h | 26 +++ arch/powerpc/include/asm/kvm_host.h |5 + arch/powerpc/include/asm/mmu-hash64.h|2 +- arch/powerpc/include/as

[PATCH 05/13] KVM: PPC: Make the H_ENTER hcall more reliable

2011-12-05 Thread Paul Mackerras
en we return H_PTEG_FULL. This also moves lock_hpte to a header file (since later commits in this series will need to use it from other source files) and renames it to try_lock_hpte, which is a somewhat less misleading name. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_book3s

[PATCH 01/13] KVM: PPC: Move kvm_vcpu_ioctl_[gs]et_one_reg down to platform-specific code

2011-12-05 Thread Paul Mackerras
memory, causing random crashes and file corruption. On Book3s HV we only accept setting the HIOR to zero, since the guest runs in supervisor mode and its vectors are never offset from zero. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_ppc.h |3 ++ arch/powerpc/kvm/book3s_hv.c

[PATCH 07/13] KVM: PPC: Allow use of small pages to back Book3S HV guests

2011-12-05 Thread Paul Mackerras
and use the low-order 5 bits of each entry to store the order of the enclosing page with respect to normal pages, i.e. log_2(enclosing_page_size / PAGE_SIZE). Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_book3s_64.h |8 ++ arch/powerpc/include/asm/kvm_host.h |3 +- a

[PATCH 12/13] KVM: PPC: Implement MMU notifiers for Book3S HV guests

2011-12-05 Thread Paul Mackerras
flag, kvm->arch.using_mmu_notifiers, that indicates whether we can page guest pages out. If it is not set, the MMU notifier callbacks do nothing and everything operates as before. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_book3s.h|4 + arch/powerpc/include/asm/kv

[PATCH 13/13] KVM: PPC: Allow for read-only pages backing a Book3S HV guest

2011-12-05 Thread Paul Mackerras
be reflected to the guest (e.g. because the guest HPTE didn't allow write access to usermode) or handled by switching to kernel context and calling kvmppc_book3s_hv_page_fault, which will then request write access to the page and update the actual HPTE. Signed-off-by: Paul Mackerras ---

Re: [PATCH 05/28] kvm tools: 64-bit tidy; use PRIx64 when printf'ing u64s and link appropriately

2011-12-06 Thread Paul Mackerras
On Tue, Dec 06, 2011 at 09:28:27AM +0100, Ingo Molnar wrote: > > * Sasha Levin wrote: > > > Ingo actually got us to remove all the PRI* specifiers, but > > that was back when we only did x86 :) > > > > Ingo, does it make sense to use them now when we support > > different architectures? > >

[PATCH v3 01/14] KVM: PPC: Make wakeups work again for Book3S HV guests

2011-12-12 Thread Paul Mackerras
re grouped together into virtual CPU cores that share a single waitqueue, so it's important to use vcpu->arch.wqp rather than &vcpu->wq. Signed-off-by: Paul Mackerras --- arch/powerpc/kvm/powerpc.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/pow

[PATCH v3 02/14] KVM: PPC: Move kvm_vcpu_ioctl_[gs]et_one_reg down to platform-specific code

2011-12-12 Thread Paul Mackerras
memory, causing random crashes and file corruption. On Book3s HV we only accept setting the HIOR to zero, since the guest runs in supervisor mode and its vectors are never offset from zero. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_ppc.h |3 ++ arch/powerpc/kvm/book3s_hv.c

[PATCH v3 08/14] KVM: PPC: Allow use of small pages to back Book3S HV guests

2011-12-12 Thread Paul Mackerras
and use the low-order 5 bits of each entry to store the order of the enclosing page with respect to normal pages, i.e. log_2(enclosing_page_size / PAGE_SIZE). Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_book3s_64.h | 10 +++ arch/powerpc/include/asm/kvm_host.h |3 +- a

[PATCH v3 04/14] KVM: PPC: Keep page physical addresses in per-slot arrays

2011-12-12 Thread Paul Mackerras
l RMO regions. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_host.h |9 ++- arch/powerpc/kvm/book3s_64_mmu_hv.c | 18 +++--- arch/powerpc/kvm/book3s_hv.c| 114 +-- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 41 +++- 4 files changed

[PATCH v3 14/14] KVM: PPC: Allow for read-only pages backing a Book3S HV guest

2011-12-12 Thread Paul Mackerras
be reflected to the guest (e.g. because the guest HPTE didn't allow write access to usermode) or handled by switching to kernel context and calling kvmppc_book3s_hv_page_fault, which will then request write access to the page and update the actual HPTE. Signed-off-by: Paul Mackerras ---

[PATCH v3 06/14] KVM: PPC: Make the H_ENTER hcall more reliable

2011-12-12 Thread Paul Mackerras
en we return H_PTEG_FULL. This also moves lock_hpte to a header file (since later commits in this series will need to use it from other source files) and renames it to try_lock_hpte, which is a somewhat less misleading name. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_book3s

[PATCH v3 11/14] KVM: PPC: Implement MMIO emulation support for Book3S HV guests

2011-12-12 Thread Paul Mackerras
, but since heavily reworked. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_book3s.h|5 + arch/powerpc/include/asm/kvm_book3s_64.h | 26 +++ arch/powerpc/include/asm/kvm_host.h |5 + arch/powerpc/include/asm/mmu-hash64.h|2 +- arch/powerpc/include/as

[PATCH v3 07/14] KVM: PPC: Only get pages when actually needed, not in prepare_memory_region()

2011-12-12 Thread Paul Mackerras
s[] arrays from multiple vcpu threads, we now have a spinlock protecting those updates to ensure that we don't lose track of any references to pages. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_book3s.h|4 + arch/powerpc/include/asm/kvm_book3s_64.h | 12 ++ arch

[PATCH v3 05/14] KVM: PPC: Add an interface for pinning guest pages in Book3s HV guests

2011-12-12 Thread Paul Mackerras
unpin them when they are no longer required. Although it is not strictly necessary to pin the pages at this point, since all guest pages are already pinned, later commits in this series will mean that guest pages aren't all pinned. Signed-off-by: Paul Mackerras --- arch/powerpc/includ

[PATCH v3 09/14] KVM: PPC: Allow I/O mappings in memory slots

2011-12-12 Thread Paul Mackerras
we can use normal system memory as part of an emulated device later on. In that case the actual HPTE we insert is a cacheable HPTE. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_book3s_64.h | 26 arch/powerpc/include/asm/kvm_host.h |2 + arch/power

[PATCH v3 12/14] KVM: Add barriers to allow mmu_notifier_retry to be used locklessly

2011-12-12 Thread Paul Mackerras
bal spinlock in order to improve the scalability of updates to the guest MMU hashed page table, and so needs this. Signed-off-by: Paul Mackerras --- include/linux/kvm_host.h | 14 +- virt/kvm/kvm_main.c |6 +++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --gi

[PATCH v3 03/14] KVM: PPC: Keep a record of HV guest view of hashed page table entries

2011-12-12 Thread Paul Mackerras
s of HPT_ORDER etc. to a header file and defining HPT_NPTE for HPT_NPTEG << 3. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_book3s_64.h |8 +++ arch/powerpc/include/asm/kvm_host.h | 10 arch/powerpc/kvm/book3s_64_mmu_hv.c | 44 +++ a

[PATCH v3 00/14] KVM: PPC: Update Book3S HV memory handling

2011-12-12 Thread Paul Mackerras
This series of patches updates the Book3S-HV KVM code that manages the guest hashed page table (HPT) to enable several things: * MMIO emulation and MMIO pass-through * Use of small pages (4kB or 64kB, depending on config) to back the guest memory * Pageable guest memory - i.e. backing pages ca

[PATCH v3 10/14] KVM: PPC: Maintain a doubly-linked list of guest HPTEs for each gfn

2011-12-12 Thread Paul Mackerras
lock bit. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_book3s_64.h | 18 ++ arch/powerpc/include/asm/kvm_host.h | 17 ++- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 84 +- 3 files changed, 117 insertions(+), 2 deletions(-) diff

[PATCH v3 13/14] KVM: PPC: Implement MMU notifiers for Book3S HV guests

2011-12-12 Thread Paul Mackerras
flag, kvm->arch.using_mmu_notifiers, that indicates whether we can page guest pages out. If it is not set, the MMU notifier callbacks do nothing and everything operates as before. Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_book3s.h|4 + arch/powerpc/include/asm/kv

[PATCH] KVM: Move gfn_to_memslot() to kvm_host.h

2011-12-20 Thread Paul Mackerras
real mode which needs to call gfn_to_memslot() and thus needs this. (Module code is allocated in the vmalloc region, which can't be accessed in real mode.) With this, we can remove builtin_gfn_to_memslot() from book3s_hv_rm_mmu.c and thus eliminate a little bit of duplication. Signed-off-by:

Re: [PATCH 07/28] kvm tools: Move 'kvm__recommended_cpus' to arch-specific code

2011-12-21 Thread Paul Mackerras
real mode magic again? No, I just hadn't realized it existed. This looks fine to me. Acked-by: Paul Mackerras Paul. -- 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 4/5] KVM: PPC: Book3s HV: Implement get_dirty_log using hardware changed bit

2011-12-25 Thread Paul Mackerras
On Fri, Dec 23, 2011 at 02:23:30PM +0100, Alexander Graf wrote: > So if I read things correctly, this is the only case you're setting > pages as dirty. What if you have the following: > > guest adds HTAB entry x > guest writes to page mapped by x > guest removes HTAB entry x > host fetche

  1   2   3   4   5   6   7   8   9   >