From patchwork Mon Mar 27 09:31:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 9645847 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C511E602D6 for ; Mon, 27 Mar 2017 09:34:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C480127F81 for ; Mon, 27 Mar 2017 09:34:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B844828236; Mon, 27 Mar 2017 09:34:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6B46027F81 for ; Mon, 27 Mar 2017 09:34:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=TUicoysD1dhCd/chJRfTNrqlgzwq5d6OzD7OJ429vAs=; b=Dsmcmu7moalmd7UYZhdcZ0By/8 pSgyBUvSuvw9RXHllmGvAJcqYeVv2I0kEwuEvRXLMGa4P+6Xn8Yck+9X7Ai+J82tWpM09Zyr7DhKd NnYlXoTV8Jcshy8eW0rdgHYnNUgXbcBze5SbAK07kMzlDO3NEdS4U4W2SLrI+xZaaEm7S/HVUR8UQ Hdffk0Omn32kfTrPsyTCQte1g1LXZeoULm+YvVn5ZiOBkrd3RZq2qIMumBM1FdCymmnqJzpKVAx3h OLYvERb7Q6d8UG/szP8hI2PNenBMUpnVN4PTC//hQH6ZdBDgNhGPVbPtuP+pUxmN1GHthJVVE7ye/ 9zBbhH1g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1csR3A-0001J6-MK; Mon, 27 Mar 2017 09:34:57 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1csR1K-0007p5-W8 for linux-arm-kernel@lists.infradead.org; Mon, 27 Mar 2017 09:33:25 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 576271555C; Mon, 27 Mar 2017 09:32:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 576271555C Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=eric.auger@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 576271555C Received: from localhost.localdomain.com (ovpn-117-27.ams2.redhat.com [10.36.117.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 70F3517C46; Mon, 27 Mar 2017 09:32:36 +0000 (UTC) From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, marc.zyngier@arm.com, christoffer.dall@linaro.org, andre.przywara@arm.com, vijayak@caviumnetworks.com, Vijaya.Kumar@cavium.com, peter.maydell@linaro.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Subject: [PATCH v4 16/22] KVM: expose next_segment() Date: Mon, 27 Mar 2017 11:31:06 +0200 Message-Id: <1490607072-21610-17-git-send-email-eric.auger@redhat.com> In-Reply-To: <1490607072-21610-1-git-send-email-eric.auger@redhat.com> References: <1490607072-21610-1-git-send-email-eric.auger@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 27 Mar 2017 09:32:42 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170327_023303_998125_41F32CC9 X-CRM114-Status: GOOD ( 11.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Prasun.Kapoor@cavium.com, drjones@redhat.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Expose next_segment() as we would like to reuse this routine in ARM vgic-its code. Signed-off-by: Eric Auger --- include/linux/kvm_host.h | 8 ++++++++ virt/kvm/kvm_main.c | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 2c14ad9..b4b5d82 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -92,6 +92,14 @@ static inline bool is_noslot_pfn(kvm_pfn_t pfn) return pfn == KVM_PFN_NOSLOT; } +static inline int next_segment(unsigned long len, int offset) +{ + if (len > PAGE_SIZE - offset) + return PAGE_SIZE - offset; + else + return len; +} + /* * architectures with KVM_HVA_ERR_BAD other than PAGE_OFFSET (e.g. s390) * provide own defines and kvm_is_error_hva diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index a17d787..b825e86 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1738,14 +1738,6 @@ void kvm_get_pfn(kvm_pfn_t pfn) } EXPORT_SYMBOL_GPL(kvm_get_pfn); -static int next_segment(unsigned long len, int offset) -{ - if (len > PAGE_SIZE - offset) - return PAGE_SIZE - offset; - else - return len; -} - static int __kvm_read_guest_page(struct kvm_memory_slot *slot, gfn_t gfn, void *data, int offset, int len) {