diff options
author | Alex Bennée <alex.bennee@linaro.org> | 2015-07-07 12:29:55 -0400 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2015-07-21 07:47:08 -0400 |
commit | 0e6f07f29cfb8d79dbbdb12560a73f7121ba324e (patch) | |
tree | 197742d8a93025972dd811b20d8e54da184a8a1b | |
parent | 21b6f32f9471284f6d4621fc8be71719266db557 (diff) |
KVM: arm: guest debug, add stub KVM_SET_GUEST_DEBUG ioctl
This commit adds a stub function to support the KVM_SET_GUEST_DEBUG
ioctl. Any unsupported flag will return -EINVAL. For now, only
KVM_GUESTDBG_ENABLE is supported, although it won't have any effects.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>.
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r-- | Documentation/virtual/kvm/api.txt | 2 | ||||
-rw-r--r-- | arch/arm/kvm/arm.c | 7 | ||||
-rw-r--r-- | arch/arm/kvm/guest.c | 6 | ||||
-rw-r--r-- | arch/arm64/kvm/guest.c | 27 |
4 files changed, 34 insertions, 8 deletions
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index 9f746eab333d..19adfd385882 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt | |||
@@ -2671,7 +2671,7 @@ handled. | |||
2671 | 4.87 KVM_SET_GUEST_DEBUG | 2671 | 4.87 KVM_SET_GUEST_DEBUG |
2672 | 2672 | ||
2673 | Capability: KVM_CAP_SET_GUEST_DEBUG | 2673 | Capability: KVM_CAP_SET_GUEST_DEBUG |
2674 | Architectures: x86, s390, ppc | 2674 | Architectures: x86, s390, ppc, arm64 |
2675 | Type: vcpu ioctl | 2675 | Type: vcpu ioctl |
2676 | Parameters: struct kvm_guest_debug (in) | 2676 | Parameters: struct kvm_guest_debug (in) |
2677 | Returns: 0 on success; -1 on error | 2677 | Returns: 0 on success; -1 on error |
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index bc738d2b8392..1b693cb2d5b2 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c | |||
@@ -301,13 +301,6 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) | |||
301 | kvm_arm_set_running_vcpu(NULL); | 301 | kvm_arm_set_running_vcpu(NULL); |
302 | } | 302 | } |
303 | 303 | ||
304 | int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu, | ||
305 | struct kvm_guest_debug *dbg) | ||
306 | { | ||
307 | return -EINVAL; | ||
308 | } | ||
309 | |||
310 | |||
311 | int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu, | 304 | int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu, |
312 | struct kvm_mp_state *mp_state) | 305 | struct kvm_mp_state *mp_state) |
313 | { | 306 | { |
diff --git a/arch/arm/kvm/guest.c b/arch/arm/kvm/guest.c index d503fbb787d3..96e935bbc38c 100644 --- a/arch/arm/kvm/guest.c +++ b/arch/arm/kvm/guest.c | |||
@@ -290,3 +290,9 @@ int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu, | |||
290 | { | 290 | { |
291 | return -EINVAL; | 291 | return -EINVAL; |
292 | } | 292 | } |
293 | |||
294 | int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu, | ||
295 | struct kvm_guest_debug *dbg) | ||
296 | { | ||
297 | return -EINVAL; | ||
298 | } | ||
diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index 9535bd555d1d..0ba86775235d 100644 --- a/arch/arm64/kvm/guest.c +++ b/arch/arm64/kvm/guest.c | |||
@@ -331,3 +331,30 @@ int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu, | |||
331 | { | 331 | { |
332 | return -EINVAL; | 332 | return -EINVAL; |
333 | } | 333 | } |
334 | |||
335 | #define KVM_GUESTDBG_VALID_MASK (KVM_GUESTDBG_ENABLE) | ||
336 | |||
337 | /** | ||
338 | * kvm_arch_vcpu_ioctl_set_guest_debug - set up guest debugging | ||
339 | * @kvm: pointer to the KVM struct | ||
340 | * @kvm_guest_debug: the ioctl data buffer | ||
341 | * | ||
342 | * This sets up and enables the VM for guest debugging. Userspace | ||
343 | * passes in a control flag to enable different debug types and | ||
344 | * potentially other architecture specific information in the rest of | ||
345 | * the structure. | ||
346 | */ | ||
347 | int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu, | ||
348 | struct kvm_guest_debug *dbg) | ||
349 | { | ||
350 | if (dbg->control & ~KVM_GUESTDBG_VALID_MASK) | ||
351 | return -EINVAL; | ||
352 | |||
353 | if (dbg->control & KVM_GUESTDBG_ENABLE) { | ||
354 | vcpu->guest_debug = dbg->control; | ||
355 | } else { | ||
356 | /* If not enabled clear all flags */ | ||
357 | vcpu->guest_debug = 0; | ||
358 | } | ||
359 | return 0; | ||
360 | } | ||