Re: [Qemu-devel] [RFC/RFT PATCH v2 0/3] KVM: Introduce KVM_MEM_UNCACHED

2015-05-15 Thread Ard Biesheuvel
On 14 May 2015 at 16:41, Michael S. Tsirkin m...@redhat.com wrote: On Thu, May 14, 2015 at 04:19:23PM +0200, Laszlo Ersek wrote: On 05/14/15 15:48, Michael S. Tsirkin wrote: On Thu, May 14, 2015 at 03:32:10PM +0200, Laszlo Ersek wrote: On 05/14/15 15:00, Andrew Jones wrote: On Thu, May 14,

Re: [PATCH 5/5] VFIO: platform: VFIO platform Calxeda xgmac reset module

2015-05-15 Thread Eric Auger
On 05/14/2015 05:14 PM, Alex Williamson wrote: On Thu, 2015-05-14 at 11:06 +0200, Eric Auger wrote: Alex, On 05/13/2015 08:33 PM, Alex Williamson wrote: On Thu, 2015-05-07 at 16:27 +0200, Eric Auger wrote: This patch introduces a module that registers and implements a basic reset function

Re: [PATCH v4 03/12] KVM: arm64: guest debug, define API headers

2015-05-15 Thread Peter Maydell
On 15 May 2015 at 16:14, Alex Bennée alex.ben...@linaro.org wrote: Mark Rutland mark.rutl...@arm.com writes: On Fri, May 15, 2015 at 03:27:06PM +0100, Alex Bennée wrote: +/* + * See v8 ARM ARM D7.3: Debug Registers + * + * The control registers are architecturally defined as 32 bits but

Re: [PATCH v4 03/12] KVM: arm64: guest debug, define API headers

2015-05-15 Thread Alex Bennée
Peter Maydell peter.mayd...@linaro.org writes: On 15 May 2015 at 16:14, Alex Bennée alex.ben...@linaro.org wrote: Mark Rutland mark.rutl...@arm.com writes: On Fri, May 15, 2015 at 03:27:06PM +0100, Alex Bennée wrote: +/* + * See v8 ARM ARM D7.3: Debug Registers + * + * The control

Re: [Qemu-devel] [RFC/RFT PATCH v2 0/3] KVM: Introduce KVM_MEM_UNCACHED

2015-05-15 Thread Christoffer Dall
On Thu, May 14, 2015 at 03:36:37PM +0200, Andrew Jones wrote: On Thu, May 14, 2015 at 02:11:59PM +0100, Peter Maydell wrote: On 14 May 2015 at 14:03, Andrew Jones drjo...@redhat.com wrote: On Thu, May 14, 2015 at 11:37:46AM +0100, Peter Maydell wrote: On 14 May 2015 at 11:31, Andrew Jones

Re: [PATCH v4 10/12] KVM: arm64: guest debug, HW assisted debug support

2015-05-15 Thread Alex Bennée
Mark Rutland mark.rutl...@arm.com writes: Hi Alex, On Fri, May 15, 2015 at 03:27:13PM +0100, Alex Bennée wrote: This adds support for userspace to control the HW debug registers for guest debug. In the debug ioctl we copy the IMPDEF defined number of registers into a new register set

Re: [PATCH v4 02/12] KVM: define common KVM_GUESTDBG_USE_SW/HW_BP bits

2015-05-15 Thread Christian Borntraeger
Am 15.05.2015 um 16:27 schrieb Alex Bennée: index ef1a5fc..aca4f86 100644 --- a/arch/s390/include/uapi/asm/kvm.h +++ b/arch/s390/include/uapi/asm/kvm.h @@ -114,8 +114,6 @@ struct kvm_fpu { __u64 fprs[16]; }; -#define KVM_GUESTDBG_USE_HW_BP 0x0001 - diff --git

Re: [PATCH v4 03/12] KVM: arm64: guest debug, define API headers

2015-05-15 Thread Mark Rutland
On Fri, May 15, 2015 at 03:27:06PM +0100, Alex Bennée wrote: This commit defines the API headers for guest debugging. There are two architecture specific debug structures: - kvm_guest_debug_arch, allows us to pass in HW debug registers - kvm_debug_exit_arch, signals exception and

[PATCH v4 12/12] KVM: arm64: add trace points for guest_debug debug

2015-05-15 Thread Alex Bennée
This includes trace points for: kvm_arch_setup_guest_debug kvm_arch_clear_guest_debug I've also added some generic register setting trace events and also a trace point to dump the array of hardware registers. Signed-off-by: Alex Bennée alex.ben...@linaro.org --- v3 - add trace event for

[PATCH v4 11/12] KVM: arm64: enable KVM_CAP_SET_GUEST_DEBUG

2015-05-15 Thread Alex Bennée
Finally advertise the KVM capability for SET_GUEST_DEBUG. Once arm support is added this check can be moved to the common kvm_vm_ioctl_check_extension() code. Signed-off-by: Alex Bennée alex.ben...@linaro.org Acked-by: Christoffer Dall christoffer.d...@linaro.org --- v3: - separated capability

Re: [RFC/RFT PATCH v2 1/3] arm/arm64: pageattr: add set_memory_nc

2015-05-15 Thread Christoffer Dall
On Thu, May 14, 2015 at 03:46:44PM +0200, Andrew Jones wrote: On Thu, May 14, 2015 at 01:05:09PM +0200, Christoffer Dall wrote: On Wed, May 13, 2015 at 01:31:52PM +0200, Andrew Jones wrote: Provide a method to change normal, cacheable memory to non-cacheable. KVM will make use of this to

Re: [Qemu-devel] [RFC/RFT PATCH v2 3/3] arm/arm64: KVM: implement 'uncached' mem coherency

2015-05-15 Thread Christoffer Dall
On Thu, May 14, 2015 at 03:32:13PM +0200, Andrew Jones wrote: On Thu, May 14, 2015 at 12:55:49PM +0200, Christoffer Dall wrote: On Wed, May 13, 2015 at 01:31:54PM +0200, Andrew Jones wrote: When S1 and S2 memory attributes combine wrt to caching policy, non-cacheable types take

[PATCH v4 08/12] KVM: arm64: re-factor hyp.S debug register code

2015-05-15 Thread Alex Bennée
This is a pre-cursor to sharing the code with the guest debug support. This replaces the big macro that fishes data out of a fixed location with a more general helper macro to restore a set of debug registers. It uses macro substitution so it can be re-used for debug control and value registers.

[PATCH v4 02/12] KVM: define common KVM_GUESTDBG_USE_SW/HW_BP bits

2015-05-15 Thread Alex Bennée
Currently x86, powerpc and soon arm64 use the same two architecture specific bits for guest debug support for software and hardware breakpoints. This makes the shared values explicit. Signed-off-by: Alex Bennée alex.ben...@linaro.org Reviewed-by: Andrew Jones drjo...@redhat.com - v4 - claim

[PATCH v4 09/12] KVM: arm64: introduce vcpu-arch.debug_ptr

2015-05-15 Thread Alex Bennée
This introduces a level of indirection for the debug registers. Instead of using the sys_regs[] directly we store registers in a structure in the vcpu. As we are no longer tied to the layout of the sys_regs[] we can make the copies size appropriate for control and value registers. This also

[PATCH v4 06/12] KVM: arm64: guest debug, add SW break point support

2015-05-15 Thread Alex Bennée
This adds support for SW breakpoints inserted by userspace. We do this by trapping all guest software debug exceptions to the hypervisor (MDCR_EL2.TDE). The exit handler sets an exit reason of KVM_EXIT_DEBUG with the kvm_debug_exit_arch structure holding the exception syndrome information. It

[PATCH v4 07/12] KVM: arm64: guest debug, add support for single-step

2015-05-15 Thread Alex Bennée
This adds support for single-stepping the guest. To do this we need to manipulate the guests PSTATE.SS and MDSCR_EL1.SS bits which we do in the kvm_arm_setup/clear_debug() so we don't affect the apparent state of the guest. Additionally while the host is debugging the guest we suppress the ability

[PATCH v4 05/12] KVM: arm: introduce kvm_arm_init/setup/clear_debug

2015-05-15 Thread Alex Bennée
This is a precursor for later patches which will need to do more to setup debug state before entering the hyp.S switch code. The existing functionality for setting mdcr_el2 has been moved out of hyp.S and now uses the value kept in vcpu-arch.mdcr_el2. As the assembler used to previously mask and

[PATCH v4 03/12] KVM: arm64: guest debug, define API headers

2015-05-15 Thread Alex Bennée
This commit defines the API headers for guest debugging. There are two architecture specific debug structures: - kvm_guest_debug_arch, allows us to pass in HW debug registers - kvm_debug_exit_arch, signals exception and possible faulting address The type of debugging being used is controlled

[PATCH v4 01/12] KVM: add comments for kvm_debug_exit_arch struct

2015-05-15 Thread Alex Bennée
Bring into line with the comments for the other structures and their KVM_EXIT_* cases. Also update api.txt to reflect use in kvm_run documentation. Signed-off-by: Alex Bennée alex.ben...@linaro.org Reviewed-by: David Hildenbrand d...@linux.vnet.ibm.com Reviewed-by: Andrew Jones drjo...@redhat.com

[PATCH 06/10] KVM: arm: add trap handlers for 32-bit debug registers

2015-05-15 Thread Zhichao Huang
Add handlers for all the 32-bit debug registers. Signed-off-by: Zhichao Huang zhichao.hu...@linaro.org --- arch/arm/include/asm/kvm_asm.h | 12 arch/arm/include/asm/kvm_host.h | 3 + arch/arm/kernel/asm-offsets.c | 1 + arch/arm/kvm/coproc.c | 122

[PATCH 07/10] KVM: arm: add trap handlers for 64-bit debug registers

2015-05-15 Thread Zhichao Huang
Add handlers for all the 64-bit debug registers. There is an overlap between 32 and 64bit registers. Make sure that 64-bit registers preceding 32-bit ones. Signed-off-by: Zhichao Huang zhichao.hu...@linaro.org --- arch/arm/kvm/coproc.c | 12 1 file changed, 12 insertions(+) diff

[PATCH 05/10] KVM: arm: check ordering of all system register tables

2015-05-15 Thread Zhichao Huang
We now have multiple tables for the various system registers we trap. Make sure we check the order of all of them, as it is critical that we get the order right (been there, done that...). Signed-off-by: Zhichao Huang zhichao.hu...@linaro.org --- arch/arm/kvm/coproc.c | 26

[PATCH 04/10] KVM: arm: common infrastructure for handling AArch32 CP14/CP15

2015-05-15 Thread Zhichao Huang
As we're about to trap a bunch of CP14 registers, let's rework the CP15 handling so it can be generalized and work with multiple tables. Signed-off-by: Zhichao Huang zhichao.hu...@linaro.org --- arch/arm/kvm/coproc.c | 176 ++---

[PATCH 02/10] KVM: arm: rename pm_fake handler to trap_raz_wi

2015-05-15 Thread Zhichao Huang
pm_fake doesn't quite describe what the handler does (ignoring writes and returning 0 for reads). As we're about to use it (a lot) in a different context, rename it with a (admitedly cryptic) name that make sense for all users. Signed-off-by: Zhichao Huang zhichao.hu...@linaro.org ---

[PATCH 01/10] KVM: arm: plug guest debug exploit

2015-05-15 Thread Zhichao Huang
Hardware debugging in guests is not intercepted currently, it means that a malicious guest can bring down the entire machine by writing to the debug registers. This patch enable trapping of all debug registers, preventing the guests to mess with the host state. However, it is a precursor for

[PATCH 00/10] KVM: arm: debug infrastructure support

2015-05-15 Thread Zhichao Huang
This patch series adds debug support, a key feature missing from the KVM/armv7 port. The main idea is borrowed from armv8, which is to keep track of whether the debug registers are dirty (changed by the guest) or not. In this case, perform the usual save/restore dance, for one run only. It

Re: [PATCH v4 10/12] KVM: arm64: guest debug, HW assisted debug support

2015-05-15 Thread Peter Maydell
On 15 May 2015 at 17:16, Alex Bennée alex.ben...@linaro.org wrote: Mark Rutland mark.rutl...@arm.com writes: This gets more fun when you consider the context-aware breakpoints are the highest numbered. So the set of (context-aware) breakpoints might not intersect across all CPUs. I didn't

Re: [PATCH v4 02/12] KVM: define common KVM_GUESTDBG_USE_SW/HW_BP bits

2015-05-15 Thread David Hildenbrand
Am 15.05.2015 um 16:27 schrieb Alex Bennée: +++ b/arch/s390/include/uapi/asm/kvm.h @@ -114,8 +114,6 @@ struct kvm_fpu { __u64 fprs[16]; }; -#define KVM_GUESTDBG_USE_HW_BP 0x0001 [...] +++ b/include/uapi/linux/kvm.h [...] +#define KVM_GUESTDBG_USE_SW_BP