In the case we will enter QEMU through interception of instructions, we will need to retrieve the AP devices. The base device is the AP bridge.
Let us implement a way to retrieve the AP Bridge from qtree. Signed-off-by: Pierre Morel <pmo...@linux.ibm.com> --- hw/s390x/ap-bridge.c | 12 ++++++++++++ include/hw/s390x/ap-bridge.h | 1 + 2 files changed, 13 insertions(+) diff --git a/hw/s390x/ap-bridge.c b/hw/s390x/ap-bridge.c index 3795d30..831ad5d 100644 --- a/hw/s390x/ap-bridge.c +++ b/hw/s390x/ap-bridge.c @@ -14,6 +14,18 @@ #include "hw/s390x/ap-bridge.h" #include "cpu.h" +DeviceState *s390_get_ap_bridge(void) +{ + static DeviceState *apb; + + if (!apb) { + apb = DEVICE(object_resolve_path(TYPE_AP_BRIDGE, NULL)); + assert(apb != NULL); + } + + return apb; +} + static char *ap_bus_get_dev_path(DeviceState *dev) { /* at most one */ diff --git a/include/hw/s390x/ap-bridge.h b/include/hw/s390x/ap-bridge.h index 470e439..dacb877 100644 --- a/include/hw/s390x/ap-bridge.h +++ b/include/hw/s390x/ap-bridge.h @@ -15,5 +15,6 @@ #define TYPE_AP_BUS "ap-bus" void s390_init_ap(void); +DeviceState *s390_get_ap_bridge(void); #endif -- 2.7.4