Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp2114769lkv; Thu, 20 May 2021 03:45:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJpM4D4a7V/TkDz6bk0TeYFW7dU8tiu0oKWKKVZchyUh3/grFKItZPRPPku58wx6ifZSv7 X-Received: by 2002:a05:6638:155:: with SMTP id y21mr5587726jao.62.1621507533393; Thu, 20 May 2021 03:45:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621507533; cv=none; d=google.com; s=arc-20160816; b=UzhRjmJkhuDUHDPjYnHAS62s6/3740h9AVQHgUS2v7z5qV29DYde42clDo+azLRc0t WcJXBTEmSHSzXRZj8UpdCpDS4LnddzqF9+Ac2s05vW67/FP3Yuz9cNHJK5MRpVULujcK kFlyyROh99Pn+tmHnruRMcca0w3uprbktiM/vsqSMQ38I0FPb+YOjGM+Bve3t/+1Rqsk EPXMv3L/665h0cpCqMuSeNhXdCB55JBCBSHSDvmT45YFkZ8JukbmP8oye17iANsIeamo gYMswJy9o/o3Me/hsZDyvO0ocBHY0Bo59YuoJxGHuqpIDxhssVsWx8OrbPbqfgBbbQUN TEQA== 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=5/+NaE4235BI330qYFLr2795QCkdazY/l7atQV5AMtI=; b=fXHrsPSCcw+KSBrG32FZxVBgY9RVvT7uddKI0PQ8lcMuvKSMmFjDBiiFGBYVxGeeEx WR8iwwAc5L4NCdZruHFSHGSh9qk4y9wl8ZDeqbgabDFMd0tEQz/kX3sEDT3wyuouvR+T 6ZnjSQafyX0qzgylbDv7HT6EDYG4+Ex5/eHGCaAhC3YdxRZqZwGLr/NoU3Qac1vRhqIH zL4NZwk1H0ItbR3ZzGtbnwgjg5QLeVJy6BwMFZCif1i2M+ieSXOfecmm+NP9ANQnzpRe +hnVgknlM6UncNyi7XOHWJ62Og+mTVACO7kj1Np5hbERug5DfjEoUYtRdKGlghRc/eiK MgoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rcPaY2Te; 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 f4si2209920ilj.107.2021.05.20.03.45.19; Thu, 20 May 2021 03:45:33 -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=rcPaY2Te; 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 S236356AbhETKo7 (ORCPT + 99 others); Thu, 20 May 2021 06:44:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:58796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236710AbhETK3K (ORCPT ); Thu, 20 May 2021 06:29:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4A81C61C39; Thu, 20 May 2021 09:51:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504272; bh=fqrFbHHzdvlgvnbgbARC1NT1zjgNGeEmN5nv+rov27I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rcPaY2Te0PJV8dNMmwwaWT2TzA1u89z03iQyg9XT7s06WLYqXhLQehJylshaVk42y qwAbYbCxvbWK0Ke/YqSgGVwTeSOs6nIKNoFdYM2DnrUMAHvrPL8GjNWRVEHvgtk8by icfz7BMlZKfeCOZvO+z3rner+rL2Bqe/xmk2M3l4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudio Imbrenda , David Hildenbrand , Thomas Huth , Christian Borntraeger Subject: [PATCH 4.14 136/323] KVM: s390: split kvm_s390_real_to_abs Date: Thu, 20 May 2021 11:20:28 +0200 Message-Id: <20210520092124.775856807@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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 c5d1f6b531e68888cbe6718b3f77a60115d58b9c upstream. A new function _kvm_s390_real_to_abs will apply prefixing to a real address with a given prefix value. The old kvm_s390_real_to_abs becomes now a wrapper around the new function. This is needed to avoid code duplication in vSIE. Signed-off-by: Claudio Imbrenda Reviewed-by: David Hildenbrand Reviewed-by: Thomas Huth Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20210322140559.500716-2-imbrenda@linux.ibm.com Signed-off-by: Christian Borntraeger Signed-off-by: Greg Kroah-Hartman --- arch/s390/kvm/gaccess.h | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) --- a/arch/s390/kvm/gaccess.h +++ b/arch/s390/kvm/gaccess.h @@ -21,17 +21,14 @@ /** * kvm_s390_real_to_abs - convert guest real address to guest absolute address - * @vcpu - guest virtual cpu + * @prefix - guest prefix * @gra - guest real address * * Returns the guest absolute address that corresponds to the passed guest real - * address @gra of a virtual guest cpu by applying its prefix. + * address @gra of by applying the given prefix. */ -static inline unsigned long kvm_s390_real_to_abs(struct kvm_vcpu *vcpu, - unsigned long gra) +static inline unsigned long _kvm_s390_real_to_abs(u32 prefix, unsigned long gra) { - unsigned long prefix = kvm_s390_get_prefix(vcpu); - if (gra < 2 * PAGE_SIZE) gra += prefix; else if (gra >= prefix && gra < prefix + 2 * PAGE_SIZE) @@ -40,6 +37,20 @@ static inline unsigned long kvm_s390_rea } /** + * kvm_s390_real_to_abs - convert guest real address to guest absolute address + * @vcpu - guest virtual cpu + * @gra - guest real address + * + * Returns the guest absolute address that corresponds to the passed guest real + * address @gra of a virtual guest cpu by applying its prefix. + */ +static inline unsigned long kvm_s390_real_to_abs(struct kvm_vcpu *vcpu, + unsigned long gra) +{ + return _kvm_s390_real_to_abs(kvm_s390_get_prefix(vcpu), gra); +} + +/** * _kvm_s390_logical_to_effective - convert guest logical to effective address * @psw: psw of the guest * @ga: guest logical address