Re: [PATCH v5] KVM: s390: Add new reset vcpu API

Thomas Huth
2020-01-10T10:10:52Z

On 10/01/2020 10.46, Janosch Frank wrote:
> The architecture states that we need to reset local IRQs for all CPU
> resets. Because the old reset interface did not support the normal CPU
> reset we never did that on a normal reset.
>
> Let's implement an interface for the missing normal and clear resets
> and reset all local IRQs, registers and control structures as stated
> in the architecture.
>
> Userspace might already reset the registers via the vcpu run struct,
> but as we need the interface for the interrupt clearing part anyway,
> we implement the resets fully and don't rely on userspace to reset the
> rest.
>
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
> Documentation/virt/kvm/api.txt | 45 +++++++++++++
> arch/s390/kvm/kvm-s390.c | 111 +++++++++++++++++++++++----------
> include/uapi/linux/kvm.h | 5 ++
> 3 files changed, 127 insertions(+), 34 deletions(-)
>
> diff --git a/Documentation/virt/kvm/api.txt b/Documentation/virt/kvm/api.txt
> index ebb37b34dcfc..5203d95b1a21 100644
> --- a/Documentation/virt/kvm/api.txt
> +++ b/Documentation/virt/kvm/api.txt
> @@ -4168,6 +4168,44 @@ This ioctl issues an ultravisor call to terminate the secure guest,
> unpins the VPA pages and releases all the device pages that are used to
> track the secure pages by hypervisor.
>
> +4.122 KVM_S390_NORMAL_RESET
> +
> +Capability: KVM_CAP_S390_VCPU_RESETS
> +Architectures: s390
> +Type: vcpu ioctl
> +Parameters: none
> +Returns: 0
> +
> +This ioctl resets VCPU registers and control structures according to
> +the cpu reset definition in the POP (Principles Of Operation).
> +
> +4.123 KVM_S390_INITIAL_RESET
> +
> +Capability: none
> +Architectures: s390
> +Type: vcpu ioctl
> +Parameters: none
> +Returns: 0
> +
> +This ioctl resets VCPU registers and control structures according to
> +the initial cpu reset definition in the POP (Principles Of
> +Operation).

Nit: You "defined" POP already in the NORMAL_RESET section, so I'd
either only use the abbreviation here, or spell it out completely, but
not both again.

> However, the cpu is not put into ESA mode. This reset is a
> +superset of the normal reset.
> +
> +4.124 KVM_S390_CLEAR_RESET
> +
> +Capability: KVM_CAP_S390_VCPU_RESETS
> +Architectures: s390
> +Type: vcpu ioctl
> +Parameters: none
> +Returns: 0
> +
> +This ioctl resets VCPU registers and control structures according to
> +the clear cpu reset definition in the POP (Principles Of Operation).

dito

Thomas