Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3292999pxf; Mon, 22 Mar 2021 02:57:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKcRWUzRcOjx5RYi5DfTyCOo6LFAGPJiQqllbtFQ28QlMFcSLEB00+iyt3SpneuMXeEetb X-Received: by 2002:a17:907:6289:: with SMTP id nd9mr17688528ejc.384.1616407058672; Mon, 22 Mar 2021 02:57:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616407058; cv=none; d=google.com; s=arc-20160816; b=Rbpz5DxVWs+F8NnU2KVl3qlVMoPRYUy3dbD7Efkv3/E36v0hMVMtZhQh5UT3n+7LVE l50A+jm/kVyW/is7MKIKKnVveJiMnJRUKbgMJ0mdyeENlGWfvE6YODoLkG3P9PXS1XMa Fl/3j0PupPjIlENH2fT7X0STbg/nM+6iGC6CJtYGGbrYsn5EZPA/z6+IoC6WkHFReS43 aYCF8+jRGAh6MRLsp8i0pnM5xPLnPrpxElug7OOEFUr9b40YQFeqrZK5oAy1rOxVsGIV dK8PV0iHrR6lJEsFVfILN5uePQ/j884T/lXAQHyijUz2ihYnhff0zF5gMVAnXJqlQayO GsaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature; bh=QUufmyh3A4V077KACg1M3I/o1FkYLmY5QIZxvkVvBnY=; b=jqGyJOAWlHwhm/nVYBekemt1+tFmbAgtrCNByuGxXkF7vb6YkA1PEWhBS5qHw3mbup 6iX0dAumPmpViN2OCvO5x2QUqMnQP+ZtH+R0lJjO7lfSaN1revsWTZdig9d+Nv8PCwBP vn2X/9mGHYTvlMFJ7cRy2jO9gry75JEPDCHQVN8l1V8HC1SE+wxuqZXpfqKc1EY0nnEc 2HwGjE1hS6/pmNzrzZz4b/bwRRgD+/aXd0Wnj/fh2jnX0hf9cQhk0JUwRb4z2up0E9GV O4s4vGBzOe2cNNs1BFWMAASMurDSYExgfUmNwoGN8V1isyTaHGeqSBulhdfsKCQ0y/wa kmGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LWV3Gxlz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d2si10455781edx.95.2021.03.22.02.57.16; Mon, 22 Mar 2021 02:57:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LWV3Gxlz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230060AbhCVJ4K (ORCPT + 99 others); Mon, 22 Mar 2021 05:56:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:26850 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230001AbhCVJzz (ORCPT ); Mon, 22 Mar 2021 05:55:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616406952; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QUufmyh3A4V077KACg1M3I/o1FkYLmY5QIZxvkVvBnY=; b=LWV3GxlzhO2DGZhmJqEDtozPG727OvsdsGcTbG57Dd1fUC0WqsCwrBd/fLBa8X5NHY6E4N tXCHSYm/Rzz2Ud6eUD7ZEX7X/Cchx+5zWRq8IinT71jGo3LaZw1NjizOn/ll2KxD/PNwVg iThAewlxibEsRsZnPf87dqKWM7rVpYc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-574-ErAyjmyPMFCqQrecXqZX2g-1; Mon, 22 Mar 2021 05:55:50 -0400 X-MC-Unique: ErAyjmyPMFCqQrecXqZX2g-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E9AA48B5DC2; Mon, 22 Mar 2021 09:55:48 +0000 (UTC) Received: from [10.36.115.54] (ovpn-115-54.ams2.redhat.com [10.36.115.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3650521ECB; Mon, 22 Mar 2021 09:55:47 +0000 (UTC) Subject: Re: [PATCH v1 2/2] s390/kvm: VSIE: fix MVPG handling for prefixing and MSO To: Claudio Imbrenda , linux-kernel@vger.kernel.org Cc: borntraeger@de.ibm.com, frankja@linux.ibm.com, cohuck@redhat.com, kvm@vger.kernel.org, linux-s390@vger.kernel.org, stable@vger.kernel.org References: <20210319193354.399587-1-imbrenda@linux.ibm.com> <20210319193354.399587-3-imbrenda@linux.ibm.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: Date: Mon, 22 Mar 2021 10:55:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <20210319193354.399587-3-imbrenda@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19.03.21 20:33, Claudio Imbrenda wrote: > Prefixing needs to be applied to the guest real address to translate it > into a guest absolute address. > > The value of MSO needs to be added to a guest-absolute address in order to > obtain the host-virtual. > > Fixes: 223ea46de9e79 ("s390/kvm: VSIE: correctly handle MVPG when in VSIE") > Cc: stable@vger.kernel.org > Signed-off-by: Claudio Imbrenda > --- > arch/s390/kvm/vsie.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c > index 48aab6290a77..92864f9b3d84 100644 > --- a/arch/s390/kvm/vsie.c > +++ b/arch/s390/kvm/vsie.c > @@ -1002,7 +1002,7 @@ static u64 vsie_get_register(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page, > static int vsie_handle_mvpg(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) > { > struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s; > - unsigned long pei_dest, pei_src, src, dest, mask; > + unsigned long pei_dest, pei_src, r1, r2, src, dest, mask, mso, prefix; > u64 *pei_block = &vsie_page->scb_o->mcic; > int edat, rc_dest, rc_src; > union ctlreg0 cr0; > @@ -1010,9 +1010,13 @@ static int vsie_handle_mvpg(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) > cr0.val = vcpu->arch.sie_block->gcr[0]; > edat = cr0.edat && test_kvm_facility(vcpu->kvm, 8); > mask = _kvm_s390_logical_to_effective(&scb_s->gpsw, PAGE_MASK); > + mso = READ_ONCE(vsie_page->scb_o->mso) & ~(1UL << 20); I think we should use the one stored in the shadow page - this is what the SIE saw and will see when retrying. > + prefix = scb_s->prefix << GUEST_PREFIX_SHIFT; > > - dest = vsie_get_register(vcpu, vsie_page, scb_s->ipb >> 16) & mask; > - src = vsie_get_register(vcpu, vsie_page, scb_s->ipb >> 20) & mask; > + r1 = vsie_get_register(vcpu, vsie_page, scb_s->ipb >> 16); > + r2 = vsie_get_register(vcpu, vsie_page, scb_s->ipb >> 20); Just reuse dest and src here? > + dest = _kvm_s390_real_to_abs(prefix, r1 & mask) + mso; > + src = _kvm_s390_real_to_abs(prefix, r2 & mask) + mso; > > rc_dest = kvm_s390_shadow_fault(vcpu, vsie_page->gmap, dest, &pei_dest); > rc_src = kvm_s390_shadow_fault(vcpu, vsie_page->gmap, src, &pei_src); > Apart from that, looks good to me. -- Thanks, David / dhildenb