[PATCH] arm64: KVM: export demux regids as KVM_REG_ARM64

2014-07-01 Thread Alex Bennée
x60xx... (i.e KVM_REG_ARM64). Signed-off-by: Alex Bennée Acked-by: Christoffer Dall --- arch/arm64/kvm/sys_regs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 0324458..5ee99e4 100644 --- a/arch/arm64/kvm/sys_regs.c

[PATCH] arm64: KVM: allow export and import of generic timer regs

2014-07-04 Thread Alex Bennée
n the common include/kvm/arm_arch_timer.h headers. Signed-off-by: Alex Bennée --- arch/arm/include/asm/kvm_host.h | 3 -- arch/arm/kvm/guest.c| 10 -- arch/arm64/kvm/guest.c | 68 - include/kvm/arm_arch_timer.h| 14 +++

[PATCH] arm64: KVM: export current vcpu->pause state via pseudo regs

2014-07-09 Thread Alex Bennée
ently only 1 bit used) via the GET/SET_ONE_REG logic to pass the state between KVM and the VM controller (e.g. QEMU). Signed-off-by: Alex Bennée --- arch/arm64/include/uapi/asm/kvm.h | 8 + arch/arm64/kvm/guest.c| 61 ++- 2 files change

[PATCH v2 09/10] target-arm/kvm.c: better error reporting

2014-07-10 Thread Alex Bennée
From: Alex Bennée When we have a problem syncing CP registers between kvm<->qemu it's a lot more useful to have the names of the registers in the log than just a random abort() and core dump. Signed-off-by: Alex Bennée --- v2 - less verbose log message - fix checkpatch war

[PATCH v2 10/10] target-arm/kvm: make reg sync code common between kvm32/64

2014-07-10 Thread Alex Bennée
=> exit). This list may well have more registers than are known by the TCG emulation which is not necessarily a problem but it does stop us from migrating between KVM and TCG hosted guests. I've added some additional checking to report those registers under -d unimp. Signed-off-by: Ale

Re: [PATCH] arm64: KVM: export current vcpu->pause state via pseudo regs

2014-07-31 Thread Alex Bennée
Christoffer Dall writes: > On Wed, Jul 09, 2014 at 02:55:12PM +0100, Alex Bennée wrote: >> To cleanly restore an SMP VM we need to ensure that the current pause >> state of each vcpu is correctly recorded. Things could get confused if >> the CPU starts running after migrat

Re: [PATCH] arm64: KVM: export current vcpu->pause state via pseudo regs

2014-08-01 Thread Alex Bennée
Christoffer Dall writes: > On Thu, Jul 31, 2014 at 04:14:51PM +0100, Alex Bennée wrote: >> >> Christoffer Dall writes: >> >> > On Wed, Jul 09, 2014 at 02:55:12PM +0100, Alex Bennée wrote: >> >> To cleanly restore an SMP VM we need to ensure that the

Re: [PATCH] arm64: KVM: export current vcpu->pause state via pseudo regs

2014-08-01 Thread Alex Bennée
; but keep the thread on a wake-queue, and then userspace has to send the > thread a signal of some sort to wake it up? Isn't the vCPU off the wait-queue by definition if the ioctl exits and you go through the KVM_SET_ONE_REG stuff? Once you re-enter the KVM_RUN ioctl it sees the pause_flag as cleared and falls straight through into kvm_guest_enter() otherwise it will again wait on wait_event_interruptible(*wq, !vcpu->arch.pause). -- Alex Bennée -- 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] arm64: KVM: export current vcpu->pause state via pseudo regs

2014-08-04 Thread Alex Bennée
Christoffer Dall writes: > On Thu, Jul 31, 2014 at 07:21:44PM +0200, Paolo Bonzini wrote: >> Il 31/07/2014 19:04, Peter Maydell ha scritto: >> > On 31 July 2014 17:57, Paolo Bonzini wrote: >> >> Il 09/07/2014 15:55, Alex Bennée ha scritto: >> >> No,

[PATCH 2/2] KVM: fix api documentation of KVM_GET_EMULATED_CPUID

2014-09-09 Thread Alex Bennée
It looks like when this was initially merged it got accidentally included in the following section. I've just moved it back in the correct section and re-numbered it as other ioctls have been added since. Signed-off-by: Alex Bennée diff --git a/Documentation/virtual/kvm/api.txt b/Document

[PATCH 0/2] KVM API documentation patches

2014-09-09 Thread Alex Bennée
#x27;ve actually done the various implementations who I hope can sanity check the write-up. The second is a trivial formatting fix for what looks like a minor merge trip-up. Alex Bennée (2): KVM: document KVM_SET_GUEST_DEBUG api KVM: fix api documentation of KVM_GET_EMULATED_CPUID Documentation/

[PATCH 1/2] KVM: document KVM_SET_GUEST_DEBUG api

2014-09-09 Thread Alex Bennée
In preparation for working on the ARM implementation I noticed the debug interface was missing from the API document. I've pieced together the expected behaviour from the code and commit messages written it up as best I can. Signed-off-by: Alex Bennée diff --git a/Documentation/virtua

Re: [PATCH 0/2] KVM API documentation patches

2014-09-15 Thread Alex Bennée
Christoffer Dall writes: > On Wed, Sep 10, 2014 at 11:34:53AM +0200, Paolo Bonzini wrote: >> Il 09/09/2014 18:27, Alex Bennée ha scritto: >> > Hi, >> > >> > I'm preparing to add ARM KVM GDB support and I went to read the API >> > documenta

Exposing host debug capabilities to userspace

2014-11-20 Thread Alex Bennée
n to any suggestions and look forward to your valued feedback ;-) -- Alex Bennée -- 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: Exposing host debug capabilities to userspace

2014-11-21 Thread Alex Bennée
Christoffer Dall writes: > On Thu, Nov 20, 2014 at 04:55:14PM +0000, Alex Bennée wrote: >> Hi, >> >> I've almost finished the ARMv8 guest debug support but I have one >> problem left to solve. userspace needs to know how many hardware debug >> registers

Re: Exposing host debug capabilities to userspace

2014-11-21 Thread Alex Bennée
Christoffer Dall writes: > On Thu, Nov 20, 2014 at 04:55:14PM +0000, Alex Bennée wrote: >> >> * ptrace(PTRACE_GETREGSET, NT_ARM_HW_WATCH) >> >> This is used by GDB to access the host details in debug-monitors. >> However the ptrace API really wants

Re: Exposing host debug capabilities to userspace

2014-11-24 Thread Alex Bennée
Fixed CC:kvmarm, Added: Alexander Graf, Fixed: my From: Replying to myself with additional information on each option Alex Bennée writes: > Hi, > > I've almost finished the ARMv8 guest debug support but I have one > problem left to solve. userspace needs to know how ma

Re: Exposing host debug capabilities to userspace

2014-11-24 Thread Alex Bennée
Alexander Graf writes: >> Am 24.11.2014 um 13:32 schrieb Peter Maydell : >> >>> On 24 November 2014 at 12:26, Alexander Graf wrote: >>> On 24.11.14 12:35, Alex Bennée wrote: >>>>> * KVM ioctl GET_ONE_REG(ID_AA64DFR0_EL1) >>>> Nop

Re: Exposing host debug capabilities to userspace

2014-11-24 Thread Alex Bennée
Alex Bennée writes: > Alex Bennée writes: > >> Hi, >> >> I've almost finished the ARMv8 guest debug support but I have one >> problem left to solve. userspace needs to know how many hardware debug >> registers are available for GDB to use.

[PATCH 0/7] KVM Guest Debug support for arm64

2014-11-25 Thread Alex Bennée
fit in with the formatting of the rest of the file. Alex Bennée (7): KVM: add commentary for kvm_debug_exit_arch struct KVM: arm: guest debug, define API headers KVM: arm: guest debug, add stub KVM_SET_GUEST_DEBUG ioctl KVM: arm64: guest debug, add SW break point support KVM: arm64: g

[PATCH 1/7] KVM: add commentary for kvm_debug_exit_arch struct

2014-11-25 Thread Alex Bennée
Bring into line with the commentary for the other structures and their KVM_EXIT_* cases. Signed-off-by: Alex Bennée diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 6076882..523f476 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -226,6 +226,7

[PATCH 7/7] KVM: arm64: guest debug, HW assisted debug support

2014-11-25 Thread Alex Bennée
nts available on the host hardware. Signed-off-by: Alex Bennée diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index 9383359..5e8c673 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt @@ -2593,7 +2593,7 @@ The top 16 bits of t

[PATCH 4/7] KVM: arm64: guest debug, add SW break point support

2014-11-25 Thread Alex Bennée
we have a guest inserted breakpoint and the hypervisor needs to start again and deliver the exception to guest. Signed-off-by: Alex Bennée diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index 2c6386e..9383359 100644 --- a/Documentation/virtual/kvm/api

[PATCH 3/7] KVM: arm: guest debug, add stub KVM_SET_GUEST_DEBUG ioctl

2014-11-25 Thread Alex Bennée
This commit adds a stub function to support the KVM_SET_GUEST_DEBUG ioctl. Currently any operation flag will return EINVAL. Actual functionality will be added with further patches. Signed-off-by: Alex Bennée . diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt

[PATCH 2/7] KVM: arm: guest debug, define API headers

2014-11-25 Thread Alex Bennée
architecture specific control bits of the kvm_guest_debug->control flags in the ioctl structure. Signed-off-by: Alex Bennée diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h index 8e38878..de2450c 100644 --- a/arch/arm64/include/uapi/asm/kvm.h +++ b/arch/ar

[PATCH 5/7] KVM: arm64: guest debug, add support for single-step

2014-11-25 Thread Alex Bennée
guest to single-step itself as we have no easy way of re-entering the guest after the exception has been delivered to the hypervisor. Signed-off-by: Alex Bennée diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index 48d26bb..a76daae 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c

[PATCH 6/7] KVM: arm64: re-factor hyp.S debug register code

2014-11-25 Thread Alex Bennée
. It does however rely on the debug registers being 64 bit aligned (as they happen to be in the hyp ABI). Signed-off-by: Alex Bennée diff --git a/arch/arm64/kvm/hyp.S b/arch/arm64/kvm/hyp.S index c0bc218..b38ce3d 100644 --- a/arch/arm64/kvm/hyp.S +++ b/arch/arm64/kvm/hyp.S @@ -490,65 +490,12

Re: Exposing host debug capabilities to userspace

2014-11-26 Thread Alex Bennée
_CAP_GUEST_DEBUG_HW_WPS); max_hw_bp = kvm_check_extension(cs->kvm_state, KVM_CAP_GUEST_DEBUG_HW_BPS); thanks to kvm_check_extension zeroing failure modes. And in it's defence it's a generic enough capability to be used across any other architectures that need to expose this i

Re: [PATCH 2/7] KVM: arm: guest debug, define API headers

2014-11-26 Thread Alex Bennée
f your happy to do that I'll include the change in my next version. I could also rationalise the exit handlers as they all pretty much do the same thing (save for the exit/syndrome related info). Again I was keeping things nicely separated in case any particular exception needed excessive sp

Re: [PATCH 2/7] KVM: arm: guest debug, define API headers

2014-11-26 Thread Alex Bennée
Andrew Jones writes: > On Tue, Nov 25, 2014 at 04:10:00PM +0000, Alex Bennée wrote: >> This commit defines the API headers for guest debugging. There are two >> architecture specific debug structures: >> +/* Architecture related debug defines - upper 16 bits of >> +

Re: [PATCH 3/7] KVM: arm: guest debug, add stub KVM_SET_GUEST_DEBUG ioctl

2014-11-26 Thread Alex Bennée
Andrew Jones writes: > On Tue, Nov 25, 2014 at 04:10:01PM +0000, Alex Bennée wrote: >> This commit adds a stub function to support the KVM_SET_GUEST_DEBUG >> ioctl. Currently any operation flag will return EINVAL. Actual >> functionality will be added with further patches

Re: [PATCH 2/7] KVM: arm: guest debug, define API headers

2014-11-26 Thread Alex Bennée
Peter Maydell writes: > On 25 November 2014 at 16:10, Alex Bennée wrote: >> +/* Exit types which define why we did a debug exit */ >> +#define KVM_DEBUG_EXIT_ERROR 0x0 >> +#define KVM_DEBUG_EXIT_SINGLE_STEP 0x1 >> +#define KVM_DEBUG_EXIT_SW_B

Re: [PATCH 5/7] KVM: arm64: guest debug, add support for single-step

2014-11-26 Thread Alex Bennée
Andrew Jones writes: > On Tue, Nov 25, 2014 at 04:10:03PM +0000, Alex Bennée wrote: >> This adds support for single-stepping the guest. As userspace can and >> will manipulate guest registers before restarting any tweaking of the >> registers has to occur just before cont

Re: [PATCH 2/7] KVM: arm: guest debug, define API headers

2014-12-01 Thread Alex Bennée
Christoffer Dall writes: > On Wed, Nov 26, 2014 at 03:04:10PM +0000, Alex Bennée wrote: >> >> Peter Maydell writes: >> >> > On 25 November 2014 at 16:10, Alex Bennée wrote: >> >> +/* Exit types which define why we did a debug exit */ >>

Re: [PATCH 4/7] KVM: arm64: guest debug, add SW break point support

2014-12-01 Thread Alex Bennée
Christoffer Dall writes: > On Tue, Nov 25, 2014 at 04:10:02PM +0000, Alex Bennée wrote: >> This adds support for SW breakpoints inserted by userspace. >> >> First we need to trap all BKPT exceptions in the hypervisor (ELS). This >> in controlled through the MDCR_EL2

Re: [PATCH 5/7] KVM: arm64: guest debug, add support for single-step

2014-12-01 Thread Alex Bennée
Christoffer Dall writes: > On Tue, Nov 25, 2014 at 04:10:03PM +0000, Alex Bennée wrote: >> This adds support for single-stepping the guest. As userspace can and >> will manipulate guest registers before restarting any tweaking of the >> registers has to occur just before c

Re: [PATCH 6/7] KVM: arm64: re-factor hyp.S debug register code

2014-12-01 Thread Alex Bennée
Christoffer Dall writes: > On Tue, Nov 25, 2014 at 04:10:04PM +0000, Alex Bennée wrote: >> 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 r

Re: [PATCH 7/7] KVM: arm64: guest debug, HW assisted debug support

2014-12-01 Thread Alex Bennée
Christoffer Dall writes: > On Tue, Nov 25, 2014 at 04:10:05PM +0000, Alex Bennée wrote: >> --- a/arch/arm64/kvm/hyp.S >> +++ b/arch/arm64/kvm/hyp.S >> @@ -18,6 +18,7 @@ >> #include >> #include >> >> +#include >> #include >> #

[PATCH v9 6/6] tests/guest-debug: introduce basic gdbstub tests

2015-11-12 Thread Alex Bennée
From: Alex Bennée The aim of these tests is to combine with an appropriate kernel image (with symbol-file vmlinux) and check it behaves as it should. Given a kernel it checks: - single step - software breakpoint - hardware breakpoint - access, read and write watchpoints On success it

[PATCH v9 4/6] target-arm: kvm - add support for HW assisted debug

2015-11-12 Thread Alex Bennée
is actually capable of more advanced matching but it is unclear if this expressiveness is available via the gdbstub protocol. Signed-off-by: Alex Bennée --- v2 - correct setting of PMC/BAS/MASK - improved commentary - added helper function to check watchpoint in range - fix find/deletion

[PATCH v9 3/6] target-arm: kvm - support for single step

2015-11-12 Thread Alex Bennée
This adds support for single-step. There isn't much to do on the QEMU side as after we set-up the request for single step via the debug ioctl it is all handled within the kernel. Signed-off-by: Alex Bennée --- v2 - convert to using HSR_EC v3 - use internals.h definitions --- targe

[PATCH v9 2/6] target-arm: kvm - implement software breakpoints

2015-11-12 Thread Alex Bennée
returns to userspace. Signed-off-by: Alex Bennée -- v2 - handle debug exit with new hsr exception info - add verbosity to UNIMP message v3 - sync with kvm_cpu_synchronize_state() before checking PC. - use internals.h defines - use env->pc - use proper format types v9 - add include for

[PATCH v9 5/6] target-arm: kvm - re-inject guest debug exceptions

2015-11-12 Thread Alex Bennée
From: Alex Bennée If we can't find details for the debug exception in our debug state then we can assume the exception is due to debugging inside the guest. To inject the exception into the guest state we re-use the TCG exception code (do_interupt). However while guest debugging is in effe

[PATCH v9 1/6] target-arm: kvm64 - introduce kvm_arm_init_debug()

2015-11-12 Thread Alex Bennée
As we haven't always had guest debug support we need to probe for it. Additionally we don't do this in the start-up capability code so we don't fall over on old kernels. Signed-off-by: Alex Bennée --- target-arm/kvm64.c | 18 ++ 1 file changed, 18 insertions(+

[PATCH v9 0/6] QEMU support for KVM Guest Debug on arm64

2015-11-12 Thread Alex Bennée
ch. GIT Repo: The patch series is based off a recent master and can be found at: https://github.com/stsquad/qemu branch: kvm/guest-debug-v9 Alex Bennée (6): target-arm: kvm64 - introduce kvm_arm_init_debug() target-arm: kvm - implement software breakpoints target-arm: kvm - support for

Re: [PATCH v9 1/6] target-arm: kvm64 - introduce kvm_arm_init_debug()

2015-11-20 Thread Alex Bennée
Peter Maydell writes: > On 20 November 2015 at 15:05, Peter Maydell wrote: >> On 12 November 2015 at 16:20, Alex Bennée wrote: >>> As we haven't always had guest debug support we need to probe for it. >>> Additionally we don't do this in the start-up capa

Re: [PATCH 11/21] arm64: KVM: Implement the core world switch

2015-11-24 Thread Alex Bennée
+ > + /* Jump in the fire! */ > + exit_code = __guest_enter(vcpu, host_ctxt); > + /* And we're baaack! */ > + > + __sysreg_save_state(guest_ctxt); > + __sysreg32_save_state(vcpu); > + __timer_save_state(vcpu); > + __vgic_save_state(vcpu); > + > + __deactivate_traps(vcpu); > + __deactivate_vm(vcpu); > + > + __sysreg_restore_state(host_ctxt); > + > + __debug_save_state(vcpu, &vcpu->arch.vcpu_debug_state, guest_ctxt); > + __debug_clear_restore_state(vcpu, &vcpu->arch.host_debug_state, > host_ctxt); > + > + return exit_code; > +} -- Alex Bennée -- 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 v2 04/21] arm64: KVM: Implement vgic-v3 save/restore

2015-11-30 Thread Alex Bennée
+ write_gicreg(cpu_if->vgic_lr[LR_OFFSET(5)], ICH_LR5_EL2); > + case 4: > + write_gicreg(cpu_if->vgic_lr[LR_OFFSET(4)], ICH_LR4_EL2); > + case 3: > + write_gicreg(cpu_if->vgic_lr[LR_OFFSET(3)], ICH_LR3_EL2); > + case 2: > +

Re: [PATCH v2 08/21] arm64: KVM: Implement debug save/restore

2015-11-30 Thread Alex Bennée
kvm_cpu_context *ctxt); > void __sysreg32_save_state(struct kvm_vcpu *vcpu); > void __sysreg32_restore_state(struct kvm_vcpu *vcpu); > > +void __debug_save_state(struct kvm_vcpu *vcpu, > + struct kvm_guest_debug_arch *dbg, > + struct k

Re: [PATCH 2/2] KVM: Create debugfs dir and stat files for each VM

2015-11-30 Thread Alex Bennée
he arch initialization indirectly > calls kvm_arm_create_scratch_host_vcpu and that's where the > trouble begins, as it also creates a VM. > > My assumption was, that nobody would create multiple VMs under > the same PID. Christian and I are working on a solution on kernel > si

Re: [PATCH v2 08/21] arm64: KVM: Implement debug save/restore

2015-12-01 Thread Alex Bennée
t; KVM_ARM64_DEBUG_DIRTY, just like we have skip_debug_state on all actions > involving the save/restore in the assembly version. > >> in any case, I feel some context is lost when this is moved away from >> assembly and understanding this patch would be easier if the semantics >

Re: [PATCH v9 3/6] target-arm: kvm - support for single step

2015-12-08 Thread Alex Bennée
Peter Maydell writes: > On 12 November 2015 at 16:20, Alex Bennée wrote: >> This adds support for single-step. There isn't much to do on the QEMU >> side as after we set-up the request for single step via the debug ioctl >> it is all handled within the kernel. >&g

Re: [PATCH v9 6/6] tests/guest-debug: introduce basic gdbstub tests

2015-12-08 Thread Alex Bennée
Peter Maydell writes: > On 12 November 2015 at 16:20, Alex Bennée wrote: >> From: Alex Bennée >> >> The aim of these tests is to combine with an appropriate kernel >> image (with symbol-file vmlinux) and check it behaves as it should. >> Given a kernel

[PATCH v10 0/6] QEMU support for KVM Guest Debug on arm64

2015-12-08 Thread Alex Bennée
ug capability checks - Whitespace and comment cleanups - Py2/3 cleanliness for test script More detailed changelogs are attached to each patch. GIT Repo: The patch series is based off a recent master and can be found at: https://github.com/stsquad/qemu branch: kvm/guest-debug-v10 Alex Benn

[PATCH v10 5/6] target-arm: kvm - re-inject guest debug exceptions

2015-12-08 Thread Alex Bennée
can't handle the guest using single step as we will keep trapping to back to userspace. GDB makes heavy use of single-step behind the scenes which effectively means the guests ability to debug itself is disabled while it is being debugged. Signed-off-by: Alex Bennée --- v5: - new for v5 v1

[PATCH v10 1/6] target-arm: kvm64 - introduce kvm_arm_init_debug()

2015-12-08 Thread Alex Bennée
As we haven't always had guest debug support we need to probe for it. Additionally we don't do this in the start-up capability code so we don't fall over on old kernels. Signed-off-by: Alex Bennée --- target-arm/kvm64.c | 18 ++ 1 file changed, 18 insertions(+

[PATCH v10 6/6] tests/guest-debug: introduce basic gdbstub tests

2015-12-08 Thread Alex Bennée
s architectures. Signed-off-by: Alex Bennée --- v10: - fixup for Py2/3 cleanliness - drop to shell on exception --- tests/guest-debug/test-gdbstub.py | 176 ++ 1 file changed, 176 insertions(+) create mode 100644 tests/guest-debug/test-gdbstub.py diff --git a/te

[PATCH v10 3/6] target-arm: kvm - support for single step

2015-12-08 Thread Alex Bennée
;t support guest debug the ioctl will simply error. Signed-off-by: Alex Bennée --- v2 - convert to using HSR_EC v3 - use internals.h definitions v10 - fix arm32 build - remove redundent flag setting (done in main kvm.c) - more words on fail case --- target-arm/kvm64.c | 7 +++ 1 file

[PATCH v10 2/6] target-arm: kvm - implement software breakpoints

2015-12-08 Thread Alex Bennée
returns to userspace. Signed-off-by: Alex Bennée -- v2 - handle debug exit with new hsr exception info - add verbosity to UNIMP message v3 - sync with kvm_cpu_synchronize_state() before checking PC. - use internals.h defines - use env->pc - use proper format types v9 - add include for

[PATCH v10 4/6] target-arm: kvm - add support for HW assisted debug

2015-12-08 Thread Alex Bennée
is actually capable of more advanced matching but it is unclear if this expressiveness is available via the gdbstub protocol. Signed-off-by: Alex Bennée --- v2 - correct setting of PMC/BAS/MASK - improved commentary - added helper function to check watchpoint in range - fix find/deletion

Re: [PATCH v3 1/4] VSOCK: Introduce virtio-vsock-common.ko

2015-12-10 Thread Alex Bennée
virtio_transport_send_reset(vsk, pkt); > + return -ENOMEM; > + } > + > + pr_debug("%s: create pending\n", __func__); > + child = __vsock_create(sock_net(sk), NULL, sk, GFP_KERNEL, > +sk->sk_type, 0); > +

Re: [PATCH v3 2/4] VSOCK: Introduce virtio-vsock.ko

2015-12-10 Thread Alex Bennée
virtio_transport_recv_pkt_work); > + INIT_WORK(&vsock->tx_work, virtio_transport_send_pkt_work); > + > + mutex_lock(&vsock->rx_lock); > + virtio_vsock_rx_fill(vsock); > + mutex_unlock(&vsock->rx_lock); > + > + mutex_unlock(&the_virti

Re: [PATCH v3 3/4] VSOCK: Introduce vhost-vsock.ko

2015-12-11 Thread Alex Bennée
et_init, > + .destruct = virtio_transport_destruct, > + .release = virtio_transport_release, > + .connect = virtio_transport_connect, > + .shutdown = virtio_transport_shutdown, > + > + .dgram_e

Re: [PATCH v3 4/4] VSOCK: Add Makefile and Kconfig

2015-12-11 Thread Alex Bennée
elp > + This module implements a virtio transport for Virtual Sockets. > + > + Enable this transport if your Virtual Machine runs on > Qemu/KVM. Is this better worded as: "Enable this transport if your Virtual Machine host supports vsockets over virtio.

Re: [PATCH] arm64: KVM: debug: Remove spurious inline attributes

2015-12-17 Thread Alex Bennée
ing verified that the output code is similar. > > Cc: Alex Bennée > Signed-off-by: Marc Zyngier > --- > arch/arm64/kvm/sys_regs.c | 58 > +++ > 1 file changed, 29 insertions(+), 29 deletions(-) > > diff --git a/arch/arm64/kvm

Re: [PATCH] arm64: KVM: debug: Remove spurious inline attributes

2015-12-17 Thread Alex Bennée
Marc Zyngier writes: > On 17/12/15 16:28, Alex Bennée wrote: >> >> Marc Zyngier writes: >> >>> The debug trapping code is pretty heavy on the "inline" attribute, >>> but most functions are actually referenced in the sysreg tables, >>> m

[PATCH v2 04/10] KVM: arm: guest debug, add stub KVM_SET_GUEST_DEBUG ioctl

2015-03-31 Thread Alex Bennée
This commit adds a stub function to support the KVM_SET_GUEST_DEBUG ioctl. Currently any operation flag will return EINVAL. Actual functionality will be added with further patches. Signed-off-by: Alex Bennée . --- v2 - simplified form of the ioctl (stuff will go into setup_debug) diff --git a

[PATCH v2 09/10] KVM: arm64: trap nested debug register access

2015-03-31 Thread Alex Bennée
in the mirror location - if we are using HW assisted debug we do the same with DBG[WB][CV]R There is one register (MDCCINT_EL1) which guest debug doesn't care about so this behaves as before. Signed-off-by: Alex Bennée diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/includ

[PATCH v2 05/10] KVM: arm: introduce kvm_arch_setup/clear_debug()

2015-03-31 Thread Alex Bennée
of the TDA bit from the hyp code into the C code. Signed-off-by: Alex Bennée create mode 100644 arch/arm64/kvm/debug.c diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h index 41008cd..8c01c97 100644 --- a/arch/arm/include/asm/kvm_host.h +++ b/arch/arm/include/

[PATCH v2 08/10] KVM: arm64: guest debug, HW assisted debug support

2015-03-31 Thread Alex Bennée
sed on the address and not the PC we also need to export the value of far_el2 to userspace. Signed-off-by: Alex Bennée --- v2 - switched to C setup - replace host debug registers directly into context - minor tweak to api docs - setup right register for debug - add FAR_EL2 to debug exit

[PATCH v2 02/10] KVM: define common __KVM_GUESTDBG_USE_SW/HW_BP values

2015-03-31 Thread Alex Bennée
-off-by: Alex Bennée diff --git a/arch/powerpc/include/uapi/asm/kvm.h b/arch/powerpc/include/uapi/asm/kvm.h index ab4d473..1731569 100644 --- a/arch/powerpc/include/uapi/asm/kvm.h +++ b/arch/powerpc/include/uapi/asm/kvm.h @@ -310,8 +310,8 @@ struct kvm_guest_debug_arch { * and upper 16 bits are

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

2015-03-31 Thread Alex Bennée
d the hypervisor needs to start again and deliver the exception to guest. Signed-off-by: Alex Bennée --- v2 - update to use new exit struct - tweak for C setup - do our setup in debug_setup/clear code - fixed up comments diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtua

[PATCH v2 00/10] KVM Guest Debug support for arm64

2015-03-31 Thread Alex Bennée
final patch may get dropped before up-streaming but it does provide useful trace points for anyone who want to track what is happening during guest debug. Alex Bennée (10): KVM: add commentary for kvm_debug_exit_arch struct KVM: define common __KVM_GUESTDBG_USE_SW/HW_BP values KVM: arm: guest

[PATCH v2 03/10] KVM: arm: guest debug, define API headers

2015-03-31 Thread Alex Bennée
architecture specific control bits of the kvm_guest_debug->control flags in the ioctl structure. Signed-off-by: Alex Bennée --- v2 - expose hsr and pc directly to user-space diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h index 3ef77a4..6ee70a0 100644 --- a/a

[PATCH v2 01/10] KVM: add commentary for kvm_debug_exit_arch struct

2015-03-31 Thread Alex Bennée
Bring into line with the commentary for the other structures and their KVM_EXIT_* cases. Signed-off-by: Alex Bennée --- v2 - add comments for other exit types diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 8055706..5eedf84 100644 --- a/include/uapi/linux/kvm.h +++ b

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

2015-03-31 Thread Alex Bennée
guest to single-step itself as we have no easy way of re-entering the guest after the exception has been delivered to the hypervisor. Signed-off-by: Alex Bennée --- v2 - Move pstate/mdscr manipulation into C - don't export guest_debug to assembly - add accessor for saved_debug regs -

[PATCH v2 10/10] KVM: arm64: add trace points for guest_debug debug

2015-03-31 Thread Alex Bennée
T and WPT registers. I've also added a #define trace_dreg to shorten some lines. Signed-off-by: Alex Bennée diff --git a/arch/arm64/kvm/debug.c b/arch/arm64/kvm/debug.c index 638c111..7c96288 100644 --- a/arch/arm64/kvm/debug.c +++ b/arch/arm64/kvm/debug.c @@ -25,12 +25,37 @@ #include

[PATCH v2 3/4] target-arm: kvm - support for single step

2015-03-31 Thread Alex Bennée
This adds support for single-step. There isn't much to do on the QEMU side as after we set-up the request for single step via the debug ioctl it is all handled within the kernel. Signed-off-by: Alex Bennée --- v2 - convert to using HSR_EC diff --git a/target-arm/kvm.c b/target-arm/

[PATCH v2 0/4] QEMU support for KVM Guest Debug on arm64

2015-03-31 Thread Alex Bennée
a v4.0-rc6 and can be found at: https://git.linaro.org/people/alex.bennee/linux.git branch: guest-debug/4.0-rc6-v2 Alex Bennée (4): linux-headers: partial sync from my kernel tree (DEV) target-arm: kvm - implement software breakpoints target-arm: kvm - support for single step target-arm:

[PATCH v2 4/4] target-arm: kvm - add support for HW assisted debug

2015-03-31 Thread Alex Bennée
From: Alex Bennée This adds basic support for HW assisted debug. The ioctl interface to KVM allows us to pass an implementation defined number of break and watch point registers. When KVM_GUESTDBG_USE_HW_BP is specified these debug registers will be installed in place on the world switch into

[PATCH v2 2/4] target-arm: kvm - implement software breakpoints

2015-03-31 Thread Alex Bennée
returns to userspace. Signed-off-by: Alex Bennée -- v2 - handle debug exit with new hsr exception info - add verbosity to UNIMP message diff --git a/target-arm/kvm.c b/target-arm/kvm.c index 72c1fa1..290c1fe 100644 --- a/target-arm/kvm.c +++ b/target-arm/kvm.c @@ -25,6 +25,7 @@ #include &qu

[PATCH v2 1/4] linux-headers: partial sync from my kernel tree (DEV)

2015-03-31 Thread Alex Bennée
I assume I'll properly merge the KVM Headers direct from Linux when done. These headers came from: https://git.linaro.org/people/alex.bennee/linux.git/shortlog/refs/heads/guest-debug/4.0-rc6-v2 Signed-off-by: Alex Bennée --- v2 - update ABI to include ->far diff --git a/linux-hea

[PATCH v6 2/5] target-arm: kvm: save/restore mp state

2015-04-01 Thread Alex Bennée
changing the serialisation format. Signed-off-by: Alex Bennée --- v2 - make mpstate field runtime dependant (kvm_enabled()) - drop initial KVM_CAP_MP_STATE requirement - re-use cpu_powered instead of new field v4 - s/HALTED/STOPPED/ - move code from machine.c to kvm. v6 - cache

Re: [PATCH v2 03/10] KVM: arm: guest debug, define API headers

2015-04-01 Thread Alex Bennée
ug exit and pc >> >> The type of debugging being used is control by the architecture specific > > s/control/controlled/ good catch > >> control bits of the kvm_guest_debug->control flags in the ioctl >> structure. >> >> Signed-off-by: Alex Bennée

Re: [PATCH v2 06/10] KVM: arm64: guest debug, add SW break point support

2015-04-02 Thread Alex Bennée
27;t know of the breakpoint then we >> have a guest inserted breakpoint and the hypervisor needs to start again >> and deliver the exception to guest. >> >> Signed-off-by: Alex Bennée >> >> --- >> v2 >> - update to use new exit struct >> -

Re: [PATCH v2 07/10] KVM: arm64: guest debug, add support for single-step

2015-04-09 Thread Alex Bennée
Andrew Jones writes: > On Tue, Mar 31, 2015 at 04:08:05PM +0100, Alex Bennée wrote: >> This adds support for single-stepping the guest. As userspace can and >> will manipulate guest registers before restarting any tweaking of the >> registers has to occur just before cont

Re: [PATCH v2 05/10] KVM: arm: introduce kvm_arch_setup/clear_debug()

2015-04-09 Thread Alex Bennée
etting mdcr_el2 has been moved out of hyp.S and now >> > uses the value kept in vcpu->arch.mdcr_el2. >> > >> > This also moves the conditional setting of the TDA bit from the hyp code >> > into the C code. >> > >> > Signed-off-by: Alex Bennée

Re: [PATCH v2 04/10] KVM: arm: guest debug, add stub KVM_SET_GUEST_DEBUG ioctl

2015-04-09 Thread Alex Bennée
n't return -EINVAL if you push in KVM_GUESTDBG_ENABLE or 0. >> >> "Any unsupported flag will return -EINVAL. For now, only KVM_GUESTDBG_ENABLE >> is >> supported, although it won't have any effects." >> >> > functionality will be added with further

Re: [PATCH v2 10/10] KVM: arm64: add trace points for guest_debug debug

2015-04-13 Thread Alex Bennée
Andrew Jones writes: > $SUBJECT | sed s/guest_debug debug/guest debug/ ? > > On Tue, Mar 31, 2015 at 04:08:08PM +0100, Alex Bennée wrote: >> This includes trace points for: >> kvm_arch_setup_guest_debug >> kvm_arch_clear_guest_debug >> kvm_handle_guest_

Re: [PATCH v2 09/10] KVM: arm64: trap nested debug register access

2015-04-13 Thread Alex Bennée
Andrew Jones writes: > On Tue, Mar 31, 2015 at 04:08:07PM +0100, Alex Bennée wrote: >> When we are using the hardware registers for guest debug we need to deal >> with the guests access to them. There is already a mechanism for dealing >> with these accesses so we

Re: [PATCH v2 08/10] KVM: arm64: guest debug, HW assisted debug support

2015-04-13 Thread Alex Bennée
Andrew Jones writes: > On Tue, Mar 31, 2015 at 04:08:06PM +0100, Alex Bennée wrote: >> This adds support for userspace to control the HW debug registers for >> guest debug. We'll only copy the $ARCH defined number across as that is >> all that hyp.S will use anyw

Re: [PATCH v2 02/10] KVM: define common __KVM_GUESTDBG_USE_SW/HW_BP values

2015-04-13 Thread Alex Bennée
Christoffer Dall writes: > On Tue, Mar 31, 2015 at 04:08:00PM +0100, Alex Bennée wrote: >> 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 e

Re: [PATCH v2 05/10] KVM: arm: introduce kvm_arch_setup/clear_debug()

2015-04-13 Thread Alex Bennée
Christoffer Dall writes: > On Tue, Mar 31, 2015 at 04:08:03PM +0100, Alex Bennée wrote: >> 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

Re: [PATCH v2 04/10] KVM: arm: guest debug, add stub KVM_SET_GUEST_DEBUG ioctl

2015-04-14 Thread Alex Bennée
David Hildenbrand writes: >> On Tue, Mar 31, 2015 at 04:08:02PM +0100, Alex Bennée wrote: >> > This commit adds a stub function to support the KVM_SET_GUEST_DEBUG >> > ioctl. Currently any operation flag will return EINVAL. Actual >> > functionality w

Re: [PATCH v2 0/4] QEMU support for KVM Guest Debug on arm64

2015-04-20 Thread Alex Bennée
Alex Bennée writes: > Hi, > > I thought I'd sent V1 to the list but apparently not. Anyway this > patch series provides the QEMU side of guest debug support for arm64. > I'm assuming the first patch will be dropped when a proper merge of > the linux-headers is

Re: [PATCH v2 3/4] target-arm: kvm - support for single step

2015-04-21 Thread Alex Bennée
Peter Maydell writes: > On 31 March 2015 at 16:40, Alex Bennée wrote: >> This adds support for single-step. There isn't much to do on the QEMU >> side as after we set-up the request for single step via the debug ioctl >> it is all handled within the kernel. >&g

Re: [PATCH v2 4/4] target-arm: kvm - add support for HW assisted debug

2015-04-21 Thread Alex Bennée
Peter Maydell writes: > On 31 March 2015 at 16:40, Alex Bennée wrote: >> From: Alex Bennée >> >> This adds basic support for HW assisted debug. The ioctl interface to >> KVM allows us to pass an implementation defined number of break and >> watch point regis

Re: [PATCH v2 06/10] KVM: arm64: guest debug, add SW break point support

2015-04-22 Thread Alex Bennée
Zhichao Huang writes: > On Tue, Mar 31, 2015 at 04:08:04PM +0100, Alex Bennée wrote: >> This adds support for SW breakpoints inserted by userspace. >> >> We do this by trapping all BKPT exceptions in the >> hypervisor (MDCR_EL2_TDE). > > why should we trap all d

Re: [PATCH v2 03/10] KVM: arm: guest debug, define API headers

2015-04-23 Thread Alex Bennée
Christoffer Dall writes: > On Tue, Mar 31, 2015 at 04:08:01PM +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

Re: [PATCH v2 06/10] KVM: arm64: guest debug, add SW break point support

2015-04-23 Thread Alex Bennée
Christoffer Dall writes: > On Tue, Mar 31, 2015 at 04:08:04PM +0100, Alex Bennée wrote: >> This adds support for SW breakpoints inserted by userspace. >> >> We do this by trapping all BKPT exceptions in the >> hypervisor (MDCR_EL2_TDE). > > you mean trapping a

  1   2   3   >