Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4581679pxj; Wed, 12 May 2021 08:37:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnmLhbYu5ERGvvoAoWGU0ZmrQa/Tc22TwXjD1gwljutC+KxRdLHP/Md1ZUQsc/fTBhVXwR X-Received: by 2002:a05:6830:1293:: with SMTP id z19mr30179956otp.160.1620833871908; Wed, 12 May 2021 08:37:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620833871; cv=none; d=google.com; s=arc-20160816; b=IbHP4LkBGSxzlZinp3G9/x9w4BuGzO24P0TIkKsEaWaB06ZHRc6fFIV8fAzeIwsgYI 3o4c4dhgRYPiPyacBNmK7MHxAF3t15X0DUetT60+E7LDqulDKrx3f17euow1Un3fVIb1 60RwkbYfP9mIrWZsRP3beySYX9SsIeELd7jk/A6EyqYGhzPkx1b45boETaPCmjnCQigC TD5nuQ/u1sUPvgtsQtnk81+qFxMveWC58Q/qFii8X3OGZpYxyOfSI5iYkA92VG4C4xCB UIffJ+1ezInXTpQGI3HKdbL3bWFtNz4CAm/Um4hl/6/dbajsKRMouVk7xKsFIEyh2VTk 3lKw== 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=DjwAkLA06N5aAMstb6jOLRdm8MbD9hM9QkXtTOSEkbE=; b=hTH6Yo6BPPg0jpxp/XjSr0CivfeDItmIIBqZSieb7CI3Ej43rxSTtU4DqyJSoOEjkF uiHxyF/W+nEKbp2IgwtBDIhfKDuk2g9qhFOlfuigdW6nPnWhlT41sEZLrX9ECGrGFOpP cD0K0i7AwYAAMvhSTcwMUdC1/FT4QYDVV4/BWfMSFBWpOi6TmU8QYFQZAQIsEuYHn15T YSs762/h2Z/8UNHKCB+3xKjdH3ptMhAW1BXCV7E2r/86ZbNMvkRPUx/6+8E8E6ZUzPAY 3pC+O6AsoYt7LB4FxsOIXnNHWQLZvgtjQGk0tcYNlXE2wIOCvWlZrlM43ftpY/7+R71d ++4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lRYnRoTX; 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 p19si221611oto.21.2021.05.12.08.37.38; Wed, 12 May 2021 08:37:51 -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=lRYnRoTX; 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 S235991AbhELPgW (ORCPT + 99 others); Wed, 12 May 2021 11:36:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:50812 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234265AbhELPQU (ORCPT ); Wed, 12 May 2021 11:16:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4AE9B61952; Wed, 12 May 2021 15:06:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620831972; bh=w0ODjGif2rcoZGNVI2RJdhui/zw658jsUrjRas3821E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lRYnRoTXtxH2TwhcA0xyn3nGn8olkoEbDveCfKi9nvKNoX0CQGWIeN9D9te6+1Lkr yRj2ElngYtRRbQNit3Rwn4jbj+jziFlYRguOtoxgLIzNXhggBHdwlzpckGBK11FkLE 1g6kH5sYpFXMcK8neacB1T2XxjFr5ZW8Gp32GHRs= 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 5.10 089/530] KVM: s390: split kvm_s390_real_to_abs Date: Wed, 12 May 2021 16:43:19 +0200 Message-Id: <20210512144822.717866727@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 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 @@ -18,17 +18,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) @@ -37,6 +34,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