Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp62093pxj; Thu, 20 May 2021 04:37:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhUKYmySnU7KsG9UT/YZnOrcIcp/6j1sEi5Lpwv5XhsVCSrJPnYog6sjAR16GamksjwCEc X-Received: by 2002:aa7:d5cf:: with SMTP id d15mr4488483eds.153.1621510630958; Thu, 20 May 2021 04:37:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621510630; cv=none; d=google.com; s=arc-20160816; b=GkRTnVW8RF4riCADVnmpBVbZheD6RICoEIxwV/AfwI9JYRGcNSaYioZCewZCWVVZbv vrc1I/RM1iu0ajis7OWrtUxE8+Y0LhH9p8IQmhp7LbA2liBVrB/xlBAhuOoZBhqkQYNO qGhx+Nu4VWU3KXP3NW67TB95EM5QRrqmS7KEBv7CsC95J9JnXp/YPOIG2ZsyBhp89T4k anX0+EEFG+bcZ0M9A24INo1sG4O/BGV5m/05g/pkAexo8G1GvJ/4f569WWWYGXfdGxzv TDSAHG87FIpKa/PIjNajTREv32aikgM1tWFW3KD07A61CRWw4qB0F3ZEsdcnrmL3zS/s L98A== 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=LuXe0c+WmilovWI+ZXVwJcNE169WXbXq+SxwbxEWzFU=; b=ZxDKXLQk6ZvEDZ2WivQiMZROeXKmrptaMnLaK5eTHMUhArXtdP3lKq1fCmlk+Ew4hr ueIbvvVdiP1CYGV8Pk5SJqgg+udSDTVqnF0Z4mKYcF8u90PSRvldRmq0lNKhI3Ya2c9N lv9VAtmOVJM/XMW7YL12mGBO36MVwJkbdiNXOUenRJM9pAxZiSesnTfUFXivcfKKirkP QpS1nyjEbML6w3mO+9wBKAX/I5R+ACgJRvCpmezr+P41Nc1GNK6g+uPSNAYllE3x3NX9 ucdEGFXCp1zhXJfw0EaYPMvFaaUSo4rdd4OaA+bjyCmGSV5VNitSXBQtQpm1SwSxFNZm 6/ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nGBBwU9I; 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 e24si2196697edj.337.2021.05.20.04.36.47; Thu, 20 May 2021 04:37:10 -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=nGBBwU9I; 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 S242544AbhETLfg (ORCPT + 99 others); Thu, 20 May 2021 07:35:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:38286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239968AbhETLPS (ORCPT ); Thu, 20 May 2021 07:15:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E5CA061D60; Thu, 20 May 2021 10:09:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505342; bh=0IPhRDTX+qYV434FG0p+AicINTSDH8pdhGNikNitOQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nGBBwU9IOXxi3l5Jr7MvUZD7EtXrUF1WC0hLMxT25YKHD+W2ucgMzVam+/ZPpHZlD 9f+R9LWQ1J70OVs21tnXXpd0OHUU4k6nMJS39F6nXxoK6IwuAs8lQNHvxVaofIeLIH 8WkPyBg1FuV7TbXDR5uFEfBVGhwZ8uK2T3zgH8XQ= 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.4 074/190] KVM: s390: split kvm_s390_real_to_abs Date: Thu, 20 May 2021 11:22:18 +0200 Message-Id: <20210520092104.636289067@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@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 * @vcpu: guest virtual cpu * @ga: guest logical address