From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:57198 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726298AbgBRJUs (ORCPT ); Tue, 18 Feb 2020 04:20:48 -0500 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01I9Jajh135606 for ; Tue, 18 Feb 2020 04:20:47 -0500 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2y6bun8qba-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 18 Feb 2020 04:20:47 -0500 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 18 Feb 2020 09:20:45 -0000 Subject: Re: [PATCH v2 26/42] KVM: s390: protvirt: Do only reset registers that are accessible References: <20200214222658.12946-1-borntraeger@de.ibm.com> <20200214222658.12946-27-borntraeger@de.ibm.com> <9b66eb07-9755-4afe-6837-6197acd5fa09@redhat.com> From: Christian Borntraeger Date: Tue, 18 Feb 2020 10:20:37 +0100 MIME-Version: 1.0 In-Reply-To: <9b66eb07-9755-4afe-6837-6197acd5fa09@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Message-Id: <1893c520-165d-6006-47cd-0e7498f39188@de.ibm.com> Sender: linux-s390-owner@vger.kernel.org List-ID: To: David Hildenbrand , Janosch Frank Cc: KVM , Cornelia Huck , Thomas Huth , Ulrich Weigand , Claudio Imbrenda , linux-s390 , Michael Mueller , Vasily Gorbik , Janosch Frank On 18.02.20 09:42, David Hildenbrand wrote: > On 14.02.20 23:26, Christian Borntraeger wrote: >> From: Janosch Frank >> >> For protected VMs the hypervisor can not access guest breaking event >> address, program parameter, bpbc and todpr. Do not reset those fields >> as the control block does not provide access to these fields. >> >> Signed-off-by: Janosch Frank >> [borntraeger@de.ibm.com: patch merging, splitting, fixing] >> Signed-off-by: Christian Borntraeger >> --- >> arch/s390/kvm/kvm-s390.c | 10 ++++++---- >> 1 file changed, 6 insertions(+), 4 deletions(-) >> >> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c >> index d20a7fa9d480..5b551cc73540 100644 >> --- a/arch/s390/kvm/kvm-s390.c >> +++ b/arch/s390/kvm/kvm-s390.c >> @@ -3442,14 +3442,16 @@ static void kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu) >> kvm_s390_set_prefix(vcpu, 0); >> kvm_s390_set_cpu_timer(vcpu, 0); >> vcpu->arch.sie_block->ckc = 0; >> - vcpu->arch.sie_block->todpr = 0; >> memset(vcpu->arch.sie_block->gcr, 0, sizeof(vcpu->arch.sie_block->gcr)); >> vcpu->arch.sie_block->gcr[0] = CR0_INITIAL_MASK; >> vcpu->arch.sie_block->gcr[14] = CR14_INITIAL_MASK; >> vcpu->run->s.regs.fpc = 0; >> - vcpu->arch.sie_block->gbea = 1; >> - vcpu->arch.sie_block->pp = 0; >> - vcpu->arch.sie_block->fpf &= ~FPF_BPBC; >> + if (!kvm_s390_pv_handle_cpu(vcpu)) { > > Shouldn't we instead check if the VM is in PV mode? (with changed > lifecycle handling). Easier to understand. No. these ioctls are under the vcpu->mutex, so I am going to compare against the per cpu variant. I will use kvm_s390_pv_cpu_is_protected instead to have the lockdep assertion. > > (side not: the name kvm_s390_pv_handle_cpu() is very confusing. I'd > suggest kvm_s390_pv_cpu_get_handle(). Will reply to the other patch) > >> + vcpu->arch.sie_block->gbea = 1; >> + vcpu->arch.sie_block->pp = 0; >> + vcpu->arch.sie_block->fpf &= ~FPF_BPBC; >> + vcpu->arch.sie_block->todpr = 0; >> + } >> } >> >> static void kvm_arch_vcpu_ioctl_clear_reset(struct kvm_vcpu *vcpu) >> > >