[PATCH 4/6] KVM: Move irq notifier implementation into eventfd.c

2014-06-30 Thread Paul Mackerras
This moves the functions kvm_irq_has_notifier(), kvm_notify_acked_irq(), kvm_register_irq_ack_notifier() and kvm_unregister_irq_ack_notifier() from irqchip.c to eventfd.c. The reason for doing this is that those functions are used in connection with IRQFDs, which are implemented in eventfd.c. In

[PATCH 1/6] KVM: Don't keep reference to irq routing table in irqfd struct

2014-06-30 Thread Paul Mackerras
This makes the irqfd code keep a copy of the irq routing table entry for each irqfd, rather than a reference to the copy in the actual irq routing table maintained in kvm/virt/irqchip.c. This will enable us to change the routing table structure in future, or even not have a routing table at all on

[PATCH 2/6] KVM: irqchip: Provide and use accessors for irq routing table

2014-06-30 Thread Paul Mackerras
This provides accessor functions for the KVM interrupt mappings, in order to reduce the amount of code that accesses the fields of the kvm_irq_routing_table struct, and restrict that code to one file, virt/kvm/irqchip.c. The new functions are kvm_irq_map_gsi(), which maps from a global interrupt n

[PATCH 3/6] KVM: Move all accesses to kvm::irq_routing into irqchip.c

2014-06-30 Thread Paul Mackerras
Now that struct _irqfd does not keep a reference to storage pointed to by the irq_routing field of struct kvm, we can move the statement that updates it out from under the irqfds.lock and put it in kvm_set_irq_routing() instead. That means we then have to take a srcu_read_lock on kvm->irq_srcu aro

[PATCH 6/6] KVM: PPC: Enable IRQFD support for the XICS interrupt controller

2014-06-30 Thread Paul Mackerras
This makes it possible to use IRQFDs on platforms that use the XICS interrupt controller. To do this we implement kvm_irq_map_gsi() and kvm_irq_map_chip_pin() in book3s_xics.c, so as to provide a 1-1 mapping between global interrupt numbers and XICS interrupt source numbers. For now, all interrupt

[PATCH 0/6] IRQFD without IRQ routing, enabled for XICS

2014-06-30 Thread Paul Mackerras
This series of patches provides a way to implement IRQFD support without having to implement IRQ routing, and adds IRQFD support for the XICS interrupt controller emulation. (XICS is the interrupt controller defined for the pSeries machine type, used on IBM POWER servers). The basic approach is t

[PATCH 5/6] KVM: Give IRQFD its own separate enabling Kconfig option

2014-06-30 Thread Paul Mackerras
Currently, the IRQFD code is conditional on CONFIG_HAVE_KVM_IRQ_ROUTING. So that we can have the IRQFD code compiled in without having the IRQ routing code, this creates a new CONFIG_HAVE_KVM_IRQFD, makes the IRQFD code conditional on it instead of CONFIG_HAVE_KVM_IRQ_ROUTING, and makes all the pla

Re: [PATCH 0/6] IRQFD without IRQ routing, enabled for XICS

2014-06-30 Thread Alexander Graf
On 30.06.14 12:51, Paul Mackerras wrote: This series of patches provides a way to implement IRQFD support without having to implement IRQ routing, and adds IRQFD support for the XICS interrupt controller emulation. (XICS is the interrupt controller defined for the pSeries machine type, used on

[PATCH] KVM: PPC: e500: Fix default tlb for victim hint

2014-06-30 Thread Mihai Caraman
Tlb search operation used for victim hint relies on the default tlb set by the host. When hardware tablewalk support is enabled in the host, the default tlb is TLB1 which leads KVM to evict the bolted entry. Set and restore the default tlb when searching for victim hint. Signed-off-by: Mihai Caram

[PATCH] KVM: PPC: e500: Emulate power management control SPR

2014-06-30 Thread Mihai Caraman
For FSL e6500 core the kernel uses power management SPR register (PWRMGTCR0) to enable idle power down for cores and devices by setting up the idle count period at boot time. With the host already controlling the power management configuration the guest could simply benefit from it, so emulate gues

[PATCH 6/6 v2] KVM: PPC: Book3E: Enable e6500 core

2014-06-30 Thread Mihai Caraman
Now that AltiVec support is in place enable e6500 core. Signed-off-by: Mihai Caraman --- v2: - no changes arch/powerpc/kvm/e500mc.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c index c60b653..0bc9684 100644 --- a/arch/pow

[PATCH 5/6 v2] KVM: PPC: Book3E: Add ONE_REG AltiVec support

2014-06-30 Thread Mihai Caraman
Add ONE_REG support for AltiVec on Book3E. Signed-off-by: Mihai Caraman --- v2: - add comment describing VCSR register representation in KVM vs kernel arch/powerpc/include/uapi/asm/kvm.h | 5 + arch/powerpc/kvm/booke.c| 34 ++ 2 files changed, 3

[PATCH 2/6 v2] KVM: PPC: Book3E: Refactor SPE/FP exit handling

2014-06-30 Thread Mihai Caraman
SPE/FP/AltiVec interrupts share the same numbers. Refactor SPE/FP exit handling to accommodate AltiVec later on the same flow. Add kvmppc_supports_spe() to detect suport for the unit at runtime since it can be configured in the kernel but not featured on hardware and vice versa. Signed-off-by: Mi

[PATCH 1/6 v2] KVM: PPC: Book3E: Use common defines for SPE/FP/AltiVec int numbers

2014-06-30 Thread Mihai Caraman
Use common BOOKE_IRQPRIO and BOOKE_INTERRUPT defines for SPE/FP/AltiVec which share the same interrupt numbers. Signed-off-by: Mihai Caraman --- v2: - remove outdated definitions arch/powerpc/include/asm/kvm_asm.h| 8 arch/powerpc/kvm/booke.c | 17 +

[PATCH 4/6 v2] KVM: PPC: Book3E: Add AltiVec support

2014-06-30 Thread Mihai Caraman
Add KVM Book3E AltiVec support. KVM Book3E FPU support gracefully reuse host infrastructure so follow the same approach for AltiVec. Signed-off-by: Mihai Caraman --- v2: - integrate Paul's FP/VMX/VSX changes arch/powerpc/kvm/booke.c | 67 ++-- 1 file

[PATCH 0/6 v2] KVM: PPC: Book3e: AltiVec support

2014-06-30 Thread Mihai Caraman
Add KVM Book3E AltiVec support and enable e6500 core. Integrates Paul's FP/VMX/VSX changes that landed in kvm-ppc-queue in January and take into account feedback. Mihai Caraman (6): KVM: PPC: Book3E: Use common defines for SPE/FP/AltiVec int numbers KVM: PPC: Book3E: Refactor SPE/FP exit hand

[PATCH 3/6 v2] KVM: PPC: Book3E: Increase FPU laziness

2014-06-30 Thread Mihai Caraman
Increase FPU laziness by calling kvmppc_load_guest_fp() just before returning to guest instead of each sched in. Without this improvement an interrupt may also claim floting point corrupting guest state. Signed-off-by: Mihai Caraman --- v2: - remove fpu_active - add descriptive comments arch/

Re: [PATCH] KVM: PPC: e500: Fix default tlb for victim hint

2014-06-30 Thread Scott Wood
On Mon, 2014-06-30 at 15:54 +0300, Mihai Caraman wrote: > Tlb search operation used for victim hint relies on the default tlb set by the > host. When hardware tablewalk support is enabled in the host, the default tlb > is > TLB1 which leads KVM to evict the bolted entry. Set and restore the defaul

Re: [PATCH] KVM: PPC: e500: Emulate power management control SPR

2014-06-30 Thread Scott Wood
On Mon, 2014-06-30 at 15:55 +0300, Mihai Caraman wrote: > For FSL e6500 core the kernel uses power management SPR register (PWRMGTCR0) > to enable idle power down for cores and devices by setting up the idle count > period at boot time. With the host already controlling the power management > confi

Re: [PATCH 2/2] KVM : powerpc/booke: Allow debug interrupt injection to guest

2014-06-30 Thread Scott Wood
On Sun, 2014-06-29 at 23:38 -0500, Bhushan Bharat-R65777 wrote: > > > -Original Message- > > From: Wood Scott-B07421 > > Sent: Friday, June 27, 2014 11:53 PM > > To: Bhushan Bharat-R65777 > > Cc: ag...@suse.de; kvm-ppc@vger.kernel.org; k...@vger.kernel.org > > Subject: Re: [PATCH 2/2] KVM

Re: [PATCH 0/6] IRQFD without IRQ routing, enabled for XICS

2014-06-30 Thread Paul Mackerras
On Mon, Jun 30, 2014 at 02:43:56PM +0200, Alexander Graf wrote: > > On 30.06.14 12:51, Paul Mackerras wrote: > >This series of patches provides a way to implement IRQFD support > >without having to implement IRQ routing, and adds IRQFD support for > >the XICS interrupt controller emulation. (XICS

RE: [PATCH 2/2] KVM : powerpc/booke: Allow debug interrupt injection to guest

2014-06-30 Thread bharat.bhus...@freescale.com
> -Original Message- > From: Wood Scott-B07421 > Sent: Tuesday, July 01, 2014 1:56 AM > To: Bhushan Bharat-R65777 > Cc: ag...@suse.de; kvm-ppc@vger.kernel.org; k...@vger.kernel.org > Subject: Re: [PATCH 2/2] KVM : powerpc/booke: Allow debug interrupt injection > to > guest > > On Sun, 2

Re: [PATCH 2/2] KVM : powerpc/booke: Allow debug interrupt injection to guest

2014-06-30 Thread Alexander Graf
> Am 30.06.2014 um 22:25 schrieb Scott Wood : > >> On Sun, 2014-06-29 at 23:38 -0500, Bhushan Bharat-R65777 wrote: >> >>> -Original Message- >>> From: Wood Scott-B07421 >>> Sent: Friday, June 27, 2014 11:53 PM >>> To: Bhushan Bharat-R65777 >>> Cc: ag...@suse.de; kvm-ppc@vger.kernel.org;