[PATCH 11/14] KVM: PPC: Book3S HV: Tunable to disable KVM IRQ bypass

2016-02-26 Thread Suresh Warrier
Add a module parameter kvm_irq_bypass for kvm_hv.ko to disable IRQ bypass for passthrough interrupts. The default value of this tunable is 1 - that is enable the feature. Since the tunable is used by built-in kernel code, we use the module_param_cb macro to achieve this. Signed-off-by: Suresh

[PATCH 14/14] KVM: PPC: Book3S HV: Counters for passthrough IRQ stats

2016-02-26 Thread Suresh Warrier
through kvm_set_irq. pthru_bad_aff: Counts how many cached passthrough interrupts have bad affinity (receiving CPU is not running VCPU that is the target of the virtual interrupt in the guest). Signed-off-by: Suresh Warrier --- arch/powerpc/include/asm/kvm_host.h

[PATCH 13/14] KVM: PPC: Book3S HV: Change affinity for passthrough IRQ

2016-02-26 Thread Suresh Warrier
ad in its core. This is only done for IRQs that have been mapped for IRQ bypass since in this case if the interrupt occurs while the core is in the guest, the real mode KVM will be able to simply redirect the interrupt to the appropriate sibling hardware thread. Signed-off-by: Suresh Warrier ---

[PATCH 12/14] KVM: PPC: Book3S HV: Update irq stats for IRQs handled in real mode

2016-02-26 Thread Suresh Warrier
. The function this_cpu_inc_rm() is introduced to safely increment per CPU fields (currently coded for unsigned integers only) that are allocated and could thus be vmalloced also. Signed-off-by: Suresh Warrier --- arch/powerpc/kvm/book3s_hv_rm_xics.c | 50 1

[PATCH 10/14] KVM: PPC: Book3S HV: Dump irqmap in debugfs

2016-02-26 Thread Suresh Warrier
Dump the passthrough irqmap structure associated with a guest as part of /sys/kernel/debug/powerpc/kvm-xics-*. Signed-off-by: Suresh Warrier --- arch/powerpc/kvm/book3s_xics.c | 17 + 1 file changed, 17 insertions(+) diff --git a/arch/powerpc/kvm/book3s_xics.c b/arch/powerpc

[PATCH 09/14] KVM: PPC: Book3S HV: Enable KVM real mode handling of passthrough IRQs

2016-02-26 Thread Suresh Warrier
r VMs with small number of passthrough adapters or SRIOV VFs. In the future, we can increase the number of cached entries, but we would then need to come up with faster search/filtering mechanisms for an IRQ in the map of cached passthrough IRQs. Signed-off-by: Suresh Warrier --- arch/powerpc/i

[PATCH 07/14] KVM: PPC: Book3S HV: Handle passthrough interrupts in guest

2016-02-26 Thread Suresh Warrier
real mode handlers do not read a stale value for this case, we call kick_all_cpus_sync() after unmapping which does not return until every vcpu executing in the guest has come back to the host at least once. Signed-off-by: Suresh Warrier --- arch/powerpc/include/asm/kvm_ppc.h| 3 ++

[PATCH 08/14] KVM: PPC: Book3S HV: Complete passthrough interrupt in host

2016-02-26 Thread Suresh Warrier
interrupt condition and calls into the kvmppc_xics_rm_complete, which is made an exported function for this reason. Signed-off-by: Suresh Warrier --- arch/powerpc/include/asm/kvm_asm.h | 10 ++ arch/powerpc/include/asm/kvm_ppc.h | 3 +++ arch/powerpc/kvm/book3s_hv.c| 8

[PATCH 03/14] KVM: PPC: select IRQ_BYPASS_MANAGER

2016-02-26 Thread Suresh Warrier
Select IRQ_BYPASS_MANAGER for PPC when CONFIG_KVM is set. Add the PPC producer functions for add and del producer. Signed-off-by: Suresh Warrier --- arch/powerpc/include/asm/kvm_ppc.h | 4 arch/powerpc/kvm/Kconfig | 2 ++ arch/powerpc/kvm/book3s.c | 32

[PATCH 04/14] KVM: PPC: Book3S HV: Introduce kvmppc_passthru_irqmap

2016-02-26 Thread Suresh Warrier
for each guest. Each kvmppc_passthru_irqmap has two mapping arrays, the mapped array contains all defined real<->virtual IRQs, the cached array can be used to limit the real<->virtual IRQs to a smaller subset, like a cache of the most frequently used mappings. Signed-off-by: Su

[PATCH 02/14] KVM: PPC: Book3S HV: Convert kvmppc_read_intr to a C function

2016-02-26 Thread Suresh Warrier
Modify kvmppc_read_intr to make it a C function. This also adds in the optimization of clearing saved_xirr in the case where we completely handle and EOI an IPI. Without this, the next device interrupt will require two trips through the host interrupt handling code. Signed-off-by: Suresh

[PATCH 00/14] PCI Passthrough Interrupt Optimizations

2016-02-26 Thread Suresh Warrier
- switch back to host and run the VFIO interrupt handler. This is based on 4.5-rc1 plus the patch set in http://www.spinics.net/lists/kvm-ppc/msg11131.html since it has dependencies on vmalloc_to_phys() being public. Suresh Warrier (14): powerpc: Add simple cache inhibited MMIO accessors KVM: PPC

[PATCH 06/14] KVM: PPC: Book3S HV: Caching for passthrough IRQ map

2016-02-26 Thread Suresh Warrier
. There is no support to just uncache an entry. Signed-off-by: Suresh Warrier --- arch/powerpc/include/asm/kvm_ppc.h | 1 + arch/powerpc/kvm/book3s_hv.c | 97 ++ 2 files changed, 98 insertions(+) diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch

[PATCH 05/14] KVM: PPC: Book3S HV: Enable IRQ bypass

2016-02-26 Thread Suresh Warrier
structure is not freed even when the number of mapped entries goes to zero. It is only freed when the VM is destroyed. Signed-off-by: Suresh Warrier --- arch/powerpc/kvm/book3s_hv.c | 158 ++- 1 file changed, 157 insertions(+), 1 deletion(-) diff --git a

[PATCH 01/14] powerpc: Add simple cache inhibited MMIO accessors

2016-02-26 Thread Suresh Warrier
Add simple cache inhibited accessors for memory mapped I/O. Unlike the accessors built from the DEF_MMIO_* macros, these don't include any hardware memory barriers, callers need to manage memory barriers on their own. These can only be called in hypervisor mode. Signed-off-by: Suresh Wa

[PATCH v3 2/9] powerpc/smp: Add smp_muxed_ipi_set_message

2015-12-17 Thread Suresh Warrier
all smp_muxed_ipi_set_message to set the message instead of doing it directly inside the routine. Signed-off-by: Suresh Warrier --- arch/powerpc/include/asm/smp.h | 1 + arch/powerpc/kernel/smp.c | 9 - 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/smp.h b/a

[PATCH v3 0/9] KVM: PPC: Book3S HV: Optimize wakeup VCPU from H_IPI

2015-12-17 Thread Suresh Warrier
. * Broke up real mode IPI messaging function into two pieces - one to set the message and one to cause the IPI. New function icp_native_cause_ipi_rm added to arch/powerpc/sysdev/xics/icp-native.c Suresh Warrier (9): powerpc/smp: Support more IPI messages powerpc/smp: Add

[PATCH v3 5/9] KVM: PPC: Book3S HV: Manage core host state

2015-12-17 Thread Suresh Warrier
Update the core host state in kvmppc_host_rm_ops whenever the primary thread of the core enters the guest or returns back. Signed-off-by: Suresh Warrier --- arch/powerpc/kvm/book3s_hv.c | 44 1 file changed, 44 insertions(+) diff --git a/arch

[PATCH v3 9/9] KVM: PPC: Book3S HV: Add tunable to control H_IPI redirection

2015-12-17 Thread Suresh Warrier
control this feature. The default value for this tunable is 1 - that is enable the feature. Signed-off-by: Suresh Warrier --- arch/powerpc/include/asm/kvm_ppc.h | 1 + arch/powerpc/kvm/book3s_hv.c | 11 +++ arch/powerpc/kvm/book3s_hv_rm_xics.c | 5 - 3 files changed, 16

[PATCH v3 8/9] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU

2015-12-17 Thread Suresh Warrier
-off-by: Suresh Warrier --- arch/powerpc/kernel/smp.c| 11 + arch/powerpc/kvm/book3s_hv_rm_xics.c | 81 ++-- arch/powerpc/kvm/powerpc.c | 10 + 3 files changed, 99 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/smp.c b

[PATCH v3 7/9] KVM: PPC: Book3S HV: Host side kick VCPU when poked by real-mode KVM

2015-12-17 Thread Suresh Warrier
-off-by: Suresh Warrier --- arch/powerpc/include/asm/kvm_ppc.h | 1 + arch/powerpc/kvm/book3s_hv.c | 2 ++ arch/powerpc/kvm/book3s_hv_rm_xics.c | 36 3 files changed, 39 insertions(+) diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc

[PATCH v3 6/9] KVM: PPC: Book3S HV: kvmppc_host_rm_ops - handle offlining CPUs

2015-12-17 Thread Suresh Warrier
The kvmppc_host_rm_ops structure keeps track of which cores are are in the host by maintaining a bitmask of active/runnable online CPUs that have not entered the guest. This patch adds support to manage the bitmask when a CPU is offlined or onlined in the host. Signed-off-by: Suresh Warrier

[PATCH v3 3/9] powerpc/xics: Add icp_native_cause_ipi_rm

2015-12-17 Thread Suresh Warrier
ing smp_muxed_ipi_message_pass and then invoke icp_native_cause_ipi_rm to cause the actual IPI. The function requires kvm_hstate.xics_phys to have been initialized with the physical address of XICS. Signed-off-by: Suresh Warrier --- arch/powerpc/include/asm/xics.h | 1 + arch/powerpc/sysdev/xics/

[PATCH v3 4/9] KVM: PPC: Book3S HV: Host-side RM data structures

2015-12-17 Thread Suresh Warrier
ned-off-by: Suresh Warrier --- arch/powerpc/include/asm/kvm_ppc.h | 31 arch/powerpc/kvm/book3s_hv.c | 70 arch/powerpc/kvm/book3s_hv_builtin.c | 3 ++ 3 files changed, 104 insertions(+) diff --git a/arch/powerpc/include/asm/kvm_ppc

[PATCH v3 1/9] powerpc/smp: Support more IPI messages

2015-12-17 Thread Suresh Warrier
support 4 messages and all 4 are already taken. Define a fifth message PPC_MSG_RM_HOST_ACTION for this purpose. Signed-off-by: Suresh Warrier --- arch/powerpc/include/asm/smp.h | 3 +++ arch/powerpc/kernel/smp.c | 8 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/arch

[PATCH v2 9/9] KVM: PPC: Book3S HV: Add tunable to control H_IPI redirection

2015-11-25 Thread Suresh Warrier
control this feature. The default value for this tunable is 1 - that is enable the feature. Signed-off-by: Suresh Warrier --- arch/powerpc/include/asm/kvm_ppc.h | 1 + arch/powerpc/kvm/book3s_hv.c | 11 +++ arch/powerpc/kvm/book3s_hv_rm_xics.c | 5 - 3 files changed, 16

[PATCH v2 7/9] KVM: PPC: Book3S HV: Host side kick VCPU when poked by real-mode KVM

2015-11-25 Thread Suresh Warrier
-off-by: Suresh Warrier --- arch/powerpc/include/asm/kvm_ppc.h | 1 + arch/powerpc/kvm/book3s_hv.c | 2 ++ arch/powerpc/kvm/book3s_hv_rm_xics.c | 36 3 files changed, 39 insertions(+) diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc

[PATCH v2 8/9] KVM: PPC: Book3S HV: Send IPI to host core to wake VCPU

2015-11-25 Thread Suresh Warrier
-off-by: Suresh Warrier --- arch/powerpc/kernel/smp.c| 11 + arch/powerpc/kvm/book3s_hv_rm_xics.c | 81 ++-- arch/powerpc/kvm/powerpc.c | 10 + 3 files changed, 99 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/smp.c b

[PATCH v2 6/9] KVM: PPC: Book3S HV: kvmppc_host_rm_ops - handle offlining CPUs

2015-11-25 Thread Suresh Warrier
The kvmppc_host_rm_ops structure keeps track of which cores are are in the host by maintaining a bitmask of active/runnable online CPUs that have not entered the guest. This patch adds support to manage the bitmask when a CPU is offlined or onlined in the host. Signed-off-by: Suresh Warrier

[PATCH v2 5/9] KVM: PPC: Book3S HV: Manage core host state

2015-11-25 Thread Suresh Warrier
Update the core host state in kvmppc_host_rm_ops whenever the primary thread of the core enters the guest or returns back. Signed-off-by: Suresh Warrier --- arch/powerpc/kvm/book3s_hv.c | 44 1 file changed, 44 insertions(+) diff --git a/arch

[PATCH v2 4/9] KVM: PPC: Book3S HV: Host-side RM data structures

2015-11-25 Thread Suresh Warrier
ned-off-by: Suresh Warrier --- arch/powerpc/include/asm/kvm_ppc.h | 31 arch/powerpc/kvm/book3s_hv.c | 70 arch/powerpc/kvm/book3s_hv_builtin.c | 3 ++ 3 files changed, 104 insertions(+) diff --git a/arch/powerpc/include/asm/kvm_ppc

[PATCH v2 3/9] powerpc/powernv: Add icp_native_cause_ipi_rm

2015-11-25 Thread Suresh Warrier
Function to cause an IPI. Requires kvm_hstate.xics_phys to be initialized with physical address of XICS. Signed-off-by: Suresh Warrier --- arch/powerpc/include/asm/xics.h | 1 + arch/powerpc/sysdev/xics/icp-native.c | 19 +++ 2 files changed, 20 insertions(+) diff --git

[PATCH v2 2/9] powerpc/smp: Add smp_muxed_ipi_set_message

2015-11-25 Thread Suresh Warrier
ide the routine. Signed-off-by: Suresh Warrier --- arch/powerpc/include/asm/smp.h | 1 + arch/powerpc/kernel/smp.c | 9 - 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h index 9ef9c37..78083ed 100644 --- a/a

[PATCH v2 1/9] powerpc/smp: Support more IPI messages

2015-11-25 Thread Suresh Warrier
support 4 messages and all 4 are already taken. Define a fifth message PPC_MSG_RM_HOST_ACTION for this purpose. Signed-off-by: Suresh Warrier --- arch/powerpc/include/asm/smp.h | 3 +++ arch/powerpc/kernel/smp.c | 8 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/arch

[PATCH v2 0/9] KVM: PPC: Book3S HV: Optimize wakeup VCPU from H_IPI

2015-11-25 Thread Suresh Warrier
and one to cause the IPI. New function icp_native_cause_ipi_rm added to arch/powerpc/sysdev/xics/icp-native.c Suresh Warrier (9): powerpc/smp: Support more IPI messages powerpc/smp: Add smp_muxed_ipi_set_message powerpc/powernv: Add icp_native_cause_ipi_rm KVM: PPC: Book3S HV: Host-side RM

[PATCH 2/2] powerpc/smp: Add smp_muxed_ipi_rm_message_pass

2015-10-29 Thread Suresh Warrier
This function supports IPI message passing for real mode callers. Signed-off-by: Suresh Warrier --- arch/powerpc/include/asm/smp.h | 1 + arch/powerpc/kernel/smp.c | 30 ++ 2 files changed, 31 insertions(+) diff --git a/arch/powerpc/include/asm/smp.h b/arch

[PATCH 1/2] powerpc/smp: Support more IPI messages

2015-10-29 Thread Suresh Warrier
support 4 messages and all 4 are already taken. Define a fifth message PPC_MSG_RM_HOST_ACTION for this purpose. Signed-off-by: Suresh Warrier --- arch/powerpc/include/asm/smp.h | 3 +++ arch/powerpc/kernel/smp.c | 8 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/arch

[PATCH 0/2] Increase number of supported IPI messages

2015-10-29 Thread Suresh Warrier
switch to host to do the VCPU wakeup. Suresh Warrier (2): powerpc/smp: Support more IPI messages powerpc/smp: Add smp_muxed_ipi_rm_message_pass arch/powerpc/include/asm/smp.h | 4 arch/powerpc/kernel/smp.c | 38 ++ 2 files changed, 38 insert