|
From: | Thomas Huth |
Subject: | Re: [PATCH v3 2/4] s390x: kvm: topology: interception of PTF instruction |
Date: | Wed, 13 Oct 2021 11:11:30 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 |
On 13/10/2021 09.55, Pierre Morel wrote:
On 10/13/21 09:25, Thomas Huth wrote:On 16/09/2021 15.50, Pierre Morel wrote:When the host supports the CPU topology facility, the PTF instruction with function code 2 is interpreted by the SIE, provided that the userland hypervizor activates the interpretation by using the KVM_CAP_S390_CPU_TOPOLOGY KVM extension. The PTF instructions with function code 0 and 1 are intercepted and must be emulated by the userland hypervizor. Signed-off-by: Pierre Morel <pmorel@linux.ibm.com> ---
...
diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c index 5b1fdb55c4..dd036961fe 100644 --- a/target/s390x/kvm/kvm.c +++ b/target/s390x/kvm/kvm.c @@ -97,6 +97,7 @@ #define PRIV_B9_EQBS 0x9c #define PRIV_B9_CLP 0xa0 +#define PRIV_B9_PTF 0xa2 #define PRIV_B9_PCISTG 0xd0 #define PRIV_B9_PCILG 0xd2 #define PRIV_B9_RPCIT 0xd3 @@ -362,6 +363,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) kvm_vm_enable_cap(s, KVM_CAP_S390_USER_SIGP, 0); kvm_vm_enable_cap(s, KVM_CAP_S390_VECTOR_REGISTERS, 0); kvm_vm_enable_cap(s, KVM_CAP_S390_USER_STSI, 0); + kvm_vm_enable_cap(s, KVM_CAP_S390_CPU_TOPOLOGY, 0);Should this maybe rather be done in the last patch, to avoid a state where PTF is available, but STSI 15 is not implemented yet (when bisecting through these commits later)?ThomasYes you are right, thanks.
I'm also still a little bit surprised that there is really no migration code involved here yet. What if a guest gets started on a system with KVM_CAP_S390_CPU_TOPOLOGY support and later migrated to a system without KVM_CAP_S390_CPU_TOPOLOGY support? Is there already some magic in place that rejects such a migration? If not, the guest might first learn that it could use the PTF instruction, but suddenly it is then not available anymore? Does Linux cope right with PTF becoming unavailable during runtime? But even if it does, I think it's likely not in the sense of the architecture if certain instructions might disappear during runtime? Or do I miss something?
Thomas
[Prev in Thread] | Current Thread | [Next in Thread] |