|
From: | Pierre Morel |
Subject: | Re: [qemu-s390x] [PATCH v3 6/7] s390x/kvm: handle AP instruction interception |
Date: | Mon, 26 Mar 2018 11:03:22 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
On 26/03/2018 10:32, David Hildenbrand wrote:
On 16.03.2018 00:24, Tony Krowiak wrote:If the CPU model indicates that AP facility is installed on the guest (i.e., -cpu xxxx,ap=on), then the expectation is that the AP bus running in the guest will initialize; however, if the AP instructions are not being interpreted by the firmware, then they will be intercepted and routed back to QEMU for handling. If a handler is not defined to process the intercepted instruciton, t
...snip...
+int ap_device_handle_nqap(S390CPU *cpu) +{ + CPUS390XState *env = &cpu->env; + + if (s390_has_feat(S390_FEAT_AP)) { + env->regs[1] = 0x10000; + + return 0; + } + + return -EOPNOTSUPP; +} + +int ap_device_handle_dqap(S390CPU *cpu) +{ + CPUS390XState *env = &cpu->env; + + if (s390_has_feat(S390_FEAT_AP)) { + env->regs[1] = 0x10000; + + return 0; + } + + return -EOPNOTSUPP; +} + +int ap_device_handle_pqap(S390CPU *cpu) +{ + CPUS390XState *env = &cpu->env; + int fc = 4 & (env->regs[0] >> 24); + + /* + * The Query Configuration Information (QCI) function (fc == 4) does not + * set a response code in reg 1, so check for that along with the + * AP feature. + */ + if ((fc != 4) && s390_has_feat(S390_FEAT_AP)) { + env->regs[1] = 0x10000; + + return 0; + }This would imply an operation exception in case fc==4, which sounds very wrong.
It depends but I think that the S390_FEAT_AP_QUERY_CONFIG_INFO must be tested
to know what to answer. If the feature is there, QCI must be answered correctly. there are also some error situations to handle in all three functions.
Hard to review without access to documentation. (hard to understand why such stuff is to be kept confidential for decades)+ + return -EOPNOTSUPP; +} + static Property vfio_ap_properties[] = { DEFINE_PROP_STRING("sysfsdev", VFIOAPDevice, vdev.sysfsdev), DEFINE_PROP_END_OF_LIST(), diff --git a/include/hw/s390x/ap-device.h b/include/hw/s390x/ap-device.h index 693df90..d45ae38 100644 --- a/include/hw/s390x/ap-device.h +++ b/include/hw/s390x/ap-device.h @@ -11,6 +11,8 @@ #ifndef HW_S390X_AP_DEVICE_H #define HW_S390X_AP_DEVICE_H
-- Pierre Morel Linux/KVM/QEMU in Böblingen - Germany
[Prev in Thread] | Current Thread | [Next in Thread] |