KVM: s390x: changes for v6.11
Subsystems (4)
Janosch Frank
maintainerA couple of minor changes/fixes for 6.11 which aren't time critical.
Christoph's ucontrol selftests are on the list but might need another round or two so they are not included but will be in 6.12.
Please pull:
The following changes since commit c3f38fa61af77b49866b006939479069cd451173:
Linux 6.10-rc2 (2024-06-02 15:44:56 -0700)
are available in the Git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git tags/kvm-s390-next-6.11-1
for you to fetch changes up to 7816e58967d0e6cadce05c8540b47ed027dc2499:
kvm: s390: Reject memory region operations for ucontrol VMs (2024-07-04 09:07:24 +0200)
----------------------------------------------------------------
Assortment of tiny fixes which are not time critical:
- Rejecting memory region operations for ucontrol mode VMs
- Rewind the PSW on host intercepts for VSIE
- Remove unneeded include
----------------------------------------------------------------
Christoph Schlameuss (1):
kvm: s390: Reject memory region operations for ucontrol VMs
Claudio Imbrenda (1):
KVM: s390: remove useless include
Eric Farman (1):
KVM: s390: vsie: retry SIE instruction on host intercepts
Documentation/virt/kvm/api.rst | 12 ++++++++++++ arch/s390/include/asm/kvm_host.h | 1 - arch/s390/kvm/kvm-s390.c | 3 +++ arch/s390/kvm/vsie.c | 24 ++++++++++++++++++++---- 4 files changed, 35 insertions(+), 5 deletions(-)
Signature · 1 line
2.45.2
Janosch Frank
maintainer[GIT PULL 1/3] KVM: s390: remove useless include
From: Claudio Imbrenda <[email protected]>
arch/s390/include/asm/kvm_host.h includes linux/kvm_host.h, but linux/kvm_host.h includes asm/kvm_host.h .
It turns out that arch/s390/include/asm/kvm_host.h only needs linux/kvm_types.h, which it already includes.
Stop including linux/kvm_host.h from arch/s390/include/asm/kvm_host.h .
Due to the #ifdef guards, the code works as it is today, but it's ugly and it will get in the way of future patches.
Message-ID: <[email protected]>
--- arch/s390/include/asm/kvm_host.h | 1 - 1 file changed, 1 deletion(-)
arch/s390/include/asm/kvm_host.h +0 -1
@@ -15,7 +15,6 @@#include <linux/hrtimer.h> #include <linux/interrupt.h> #include <linux/kvm_types.h> -#include <linux/kvm_host.h> #include <linux/kvm.h> #include <linux/seqlock.h> #include <linux/module.h>
Signature · 1 line
2.45.2
Janosch Frank
maintainer[GIT PULL 2/3] KVM: s390: vsie: retry SIE instruction on host intercepts
In reply to Janosch FrankFrom: Eric Farman <[email protected]>
It's possible that SIE exits for work that the host needs to perform rather than something that is intended for the guest.
A Linux guest will ignore this intercept code since there is nothing for it to do, but a more robust solution would rewind the PSW back to the SIE instruction. This will transparently resume the guest once the host completes its work, without the guest needing to process what is effectively a NOP and re-issue SIE itself.
Message-ID: <[email protected]>
--- arch/s390/kvm/vsie.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
arch/s390/kvm/vsie.c +20 -4
@@ -1304,10 +1304,24 @@ static int vsie_run(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)if (rc == -EAGAIN ) rc =0 ; -if (rc || scb_s->icptcode ||signal_pending (current) || -kvm_s390_vcpu_has_irq (vcpu,0 ) || -kvm_s390_vcpu_sie_inhibited (vcpu)) + +/* +* Exit the loop if the guest needs to process the intercept +*/ +if (rc || scb_s->icptcode)break ; + +/* +* Exit the loop if the host needs to process an intercept, +* but rewind the PSW to re-enter SIE once that's completed +* instead of passing a "no action" intercept to the guest. +*/ +if (signal_pending (current) || +kvm_s390_vcpu_has_irq (vcpu,0 ) || +kvm_s390_vcpu_sie_inhibited (vcpu)) { +kvm_s390_rewind_psw (vcpu,4 ); +break ; + }cond_resched (); }
@@ -1426,8 +1440,10 @@ int kvm_s390_handle_vsie(struct kvm_vcpu *vcpu)return kvm_s390_inject_program_int (vcpu,PGM_SPECIFICATION );if (signal_pending (current) ||kvm_s390_vcpu_has_irq (vcpu,0 ) || -kvm_s390_vcpu_sie_inhibited (vcpu)) +kvm_s390_vcpu_sie_inhibited (vcpu)) { +kvm_s390_rewind_psw (vcpu,4 );return 0 ; + } vsie_page =get_vsie_page (vcpu->kvm, scb_addr);if (IS_ERR (vsie_page))
Signature · 1 line
2.45.2
Janosch Frank
maintainer[GIT PULL 3/3] kvm: s390: Reject memory region operations for ucontrol VMs
In reply to Janosch FrankFrom: Christoph Schlameuss <[email protected]>
This change rejects the KVM_SET_USER_MEMORY_REGION and KVM_SET_USER_MEMORY_REGION2 ioctls when called on a ucontrol VM. This is necessary since ucontrol VMs have kvm->arch.gmap set to 0 and would thus result in a null pointer dereference further in. Memory management needs to be performed in userspace and using the ioctls KVM_S390_UCAS_MAP and KVM_S390_UCAS_UNMAP.
Also improve s390 specific documentation for KVM_SET_USER_MEMORY_REGION and KVM_SET_USER_MEMORY_REGION2.
Message-ID: <[email protected]>
--- Documentation/virt/kvm/api.rst | 12 ++++++++++++ arch/s390/kvm/kvm-s390.c | 3 +++ 2 files changed, 15 insertions(+)
Documentation/virt/kvm/api.rst +12 -0
@@ -1403,6 +1403,12 @@ Instead, an abort (data abort if the cause of the page-table update was a load or a store, instruction abort if it was an instruction fetch) is injected in the guest. +S390: +^^^^^ + +Returns -EINVAL if the VM has the KVM_VM_S390_UCONTROL flag set. +Returns -EINVAL if called on a protected VM. + 4.36 KVM_SET_TSS_ADDR ---------------------
@@ -6273,6 +6279,12 @@ state. At VM creation time, all memory is shared, i.e. the PRIVATE attribute is '0' for all gfns. Userspace can control whether memory is shared/private by toggling KVM_MEMORY_ATTRIBUTE_PRIVATE via KVM_SET_MEMORY_ATTRIBUTES as needed. +S390: +^^^^^ + +Returns -EINVAL if the VM has the KVM_VM_S390_UCONTROL flag set. +Returns -EINVAL if called on a protected VM. + 4.141 KVM_SET_MEMORY_ATTRIBUTES -------------------------------
arch/s390/kvm/kvm-s390.c +3 -0
@@ -5748,6 +5748,9 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, {gpa_t size; +if (kvm_is_ucontrol (kvm)) +return -EINVAL ; +/* When we are protected, we should not change the memory slots */ if (kvm_s390_pv_get_handle (kvm))return -EINVAL ;
Signature · 1 line
2.45.2
Paolo Bonzini
maintainerQuoted 18 lines · Janosch Frank
A couple of minor changes/fixes for 6.11 which aren't time critical.
Christoph's ucontrol selftests are on the list but might need another round or two so they are not included but will be in 6.12.
Please pull:
The following changes since commit
c3f38fa61af77b49866b006939479069cd451173:Linux 6.10-rc2 (2024-06-02 15:44:56 -0700)
are available in the Git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git tags/kvm-s390-next-6.11-1
for you to fetch changes up to
7816e58967d0e6cadce05c8540b47ed027dc2499:
Quoted 8 lines
kvm: s390: Reject memory region operations for ucontrol VMs (2024-07-04 09:07:24 +0200)
----------------------------------------------------------------
Assortment of tiny fixes which are not time critical:
- Rejecting memory region operations for ucontrol mode VMs
- Rewind the PSW on host intercepts for VSIE
- Remove unneeded include
--------------------------------------
Done, thanks.
Paolo