Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4582126pxj; Wed, 12 May 2021 08:38:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfOp6fIE45u9jGtffhAqzuB6YNkW6EBFiCAc0Y53L8HGaZWElKo2hxEtYsrMgWr6Xf9yUs X-Received: by 2002:a17:906:e08c:: with SMTP id gh12mr39314438ejb.115.1620833906603; Wed, 12 May 2021 08:38:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620833906; cv=none; d=google.com; s=arc-20160816; b=S1Pt3PGjN0zfQjfRvYTOy90CKaSWpdP9DDnFHj3YJou7i+VEu/6c9+4exay4gJVlJA EI8TfxUOJAnD8XjNrNzTvLC81M/zNBuHuQoRdulZdBGRn6IKt4NcAvStX+lIadU2CxaT N43J+I/C+jEh4JjUEctTgxY0L5TQiW1Qxmbc2IUXkIEy592qNBkxNTyF9K4JJwilJK5q Latvfl+y2/qonfy7eZAUw8JSYTUY3Rqlxrq+2T8AK2aNVcW77GrsW7SGMAg7S4ljSnE+ VOKIVLjRcsIVovN43dDvZILdtgDCC7It8W58mf7v5cC5TXyF29wYliYjxS0SG34DodnS 0nNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QBMvBpg9whMyM1MxtfYWCzdBaAyzxUEPM0OpBy6mxDs=; b=wH7HA+Rq14fhpw99yu4XiqRN3kupja4AGHepyTsFE8FoJVTixFrgBxl6FMdeLvxCyI WC/zZ1WVB1U0O4fT42JqdbVdmtCIHMjr+Ogisesn5cyavVxusbu2Zfjx3yzCDivh+dTa nMB8bCKsWimDPO9MNCKzl7kPpv5iRBiBXnqIqqABcgS7bD9DJbJrQkTxqnHd5tiQCOFk pDzm5GW+uappY1X+2/PMK+GPqw3RYWI8OOKZAd+MKt281K3c3lx2STAKo2ZJDbjOejV4 a6a+DxI+H9cSSDOPbJMR3T0fHaSq/vdPhFvFzfnyHs6qH3mlHT5HBtegwqC1FErTtWXs PSAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AwdS0jSo; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o6si20783edi.480.2021.05.12.08.38.02; Wed, 12 May 2021 08:38:26 -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=@linuxfoundation.org header.s=korg header.b=AwdS0jSo; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236024AbhELPgf (ORCPT + 99 others); Wed, 12 May 2021 11:36:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:47290 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234274AbhELPQX (ORCPT ); Wed, 12 May 2021 11:16:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D6DA56198F; Wed, 12 May 2021 15:06:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620831970; bh=uCDtPvIg+BF7+DW/tFxwiAw8EJ22Uf6nOmsMa7kCj8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AwdS0jSoq5jQ71K9aIIQ6t1k4sWgatG7A3D2ECobvWnzXcxv8wEbjIQQ+ZJsm1ess yXhqJ7ia0vbdwjH69fxGWWA2xhI42HtN5L+x7+oBbhoeRNSlGjKV6OxciClfXLKx7i w/og5XTnDlUSxq7K5wrsRshoGmE0KTvtnzAD50Qg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Janosch Frank , Claudio Imbrenda , David Hildenbrand , Christian Borntraeger Subject: [PATCH 5.10 088/530] KVM: s390: VSIE: fix MVPG handling for prefixing and MSO Date: Wed, 12 May 2021 16:43:18 +0200 Message-Id: <20210512144822.685236817@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Claudio Imbrenda commit c3171e94cc1cdcc3229565244112e869f052b8d9 upstream. 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: bdf7509bbefa ("s390/kvm: VSIE: correctly handle MVPG when in VSIE") Reported-by: Janosch Frank Signed-off-by: Claudio Imbrenda Reviewed-by: David Hildenbrand Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20210322140559.500716-3-imbrenda@linux.ibm.com [borntraeger@de.ibm.com simplify mso] Signed-off-by: Christian Borntraeger Signed-off-by: Greg Kroah-Hartman --- arch/s390/kvm/vsie.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/arch/s390/kvm/vsie.c +++ b/arch/s390/kvm/vsie.c @@ -1001,7 +1001,7 @@ static u64 vsie_get_register(struct kvm_ 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, src, dest, mask, prefix; u64 *pei_block = &vsie_page->scb_o->mcic; int edat, rc_dest, rc_src; union ctlreg0 cr0; @@ -1009,9 +1009,12 @@ static int vsie_handle_mvpg(struct kvm_v 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); + prefix = scb_s->prefix << GUEST_PREFIX_SHIFT; dest = vsie_get_register(vcpu, vsie_page, scb_s->ipb >> 20) & mask; + dest = _kvm_s390_real_to_abs(prefix, dest) + scb_s->mso; src = vsie_get_register(vcpu, vsie_page, scb_s->ipb >> 16) & mask; + src = _kvm_s390_real_to_abs(prefix, src) + scb_s->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);