ppc: Add hw breakpoint watchpoint support
commit88365d17d586bcf0d9f4432447db345f72278a2a
authorBharat Bhushan <Bharat.Bhushan@freescale.com>
Mon, 14 Jul 2014 09:15:37 +0000 (14 14:45 +0530)
committerAlexander Graf <agraf@suse.de>
Mon, 8 Sep 2014 10:50:49 +0000 (8 12:50 +0200)
tree70e7c797d00082b9d926ddee0d274dbbff85ea29
parent8a0548f94edecb96acb9b7fb9106ccc821c4996f
ppc: Add hw breakpoint watchpoint support

This patch adds hardware breakpoint and hardware watchpoint support
for ppc.

On BOOKE architecture we cannot share debug resources between QEMU
and guest because:
    When QEMU is using debug resources then debug exception must
    be always enabled. To achieve this we set MSR_DE and also set
    MSRP_DEP so guest cannot change MSR_DE.

    When emulating debug resource for guest we want guest
    to control MSR_DE (enable/disable debug interrupt on need).

    So above mentioned two configuration cannot be supported
    at the same time. So the result is that we cannot share
    debug resources between QEMU and Guest on BOOKE architecture.

In the current design QEMU gets priority over guest,
this means that if QEMU is using debug resources then guest
cannot use them and if guest is using debug resource then
qemu can overwrite them.

When QEMU is not able to handle debug exception then we inject program
exception to guest. Yes program exception NOT debug exception and the
reason is:
 1) QEMU and guest not sharing debug resources
 2) For software breakpoint QEMU uses a ehpriv-1 instruction;

 So there cannot be any reason that we are in qemu with exit reason
 KVM_EXIT_DEBUG  for guest set debug exception, only possibility is
 guest executed ehpriv-1 privilege instruction and that's why we are
 injecting program exception.

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
target-ppc/kvm.c