From patchwork Thu May 14 17:00:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 6408221 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F1796C0432 for ; Thu, 14 May 2015 17:24:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 20129203E9 for ; Thu, 14 May 2015 17:24:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3248520397 for ; Thu, 14 May 2015 17:24:17 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Yswos-0006C8-MH; Thu, 14 May 2015 17:21:14 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YswmB-0002tu-TI for linux-arm-kernel@lists.infradead.org; Thu, 14 May 2015 17:18:29 +0000 X-IronPort-AV: E=Sophos;i="5.13,430,1427760000"; d="scan'208";a="262772861" From: Julien Grall To: Subject: [RFC 12/23] xen: Extend page_to_mfn to take an offset in the page Date: Thu, 14 May 2015 18:00:52 +0100 Message-ID: <1431622863-28575-13-git-send-email-julien.grall@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1431622863-28575-1-git-send-email-julien.grall@citrix.com> References: <1431622863-28575-1-git-send-email-julien.grall@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150514_101828_145323_43C4D0A6 X-CRM114-Status: GOOD ( 10.78 ) X-Spam-Score: -5.0 (-----) Cc: ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, netdev@vger.kernel.org, Konrad Rzeszutek Wilk , tim@xen.org, linux-kernel@vger.kernel.org, Julien Grall , David Vrabel , Boris Ostrovsky , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With 64KB page granularity support in Linux, a page will be split accross multiple MFN (Xen is using 4KB page granularity). Thoses MFNs may not be contiguous. With the offset in the page, the helper will be able to know which MFN the driver needs to retrieve. Signed-off-by: Julien Grall Cc: Konrad Rzeszutek Wilk Cc: Boris Ostrovsky Cc: David Vrabel Cc: netdev@vger.kernel.org --- drivers/net/xen-netfront.c | 2 +- include/xen/page.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 381d38f..6a0e329 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -431,7 +431,7 @@ static struct xen_netif_tx_request *xennet_make_one_txreq( BUG_ON((signed short)ref < 0); gnttab_grant_foreign_access_ref(ref, queue->info->xbdev->otherend_id, - page_to_mfn(page), GNTMAP_readonly); + page_to_mfn(page, 0), GNTMAP_readonly); queue->tx_skbs[id].skb = skb; queue->grant_tx_page[id] = page; diff --git a/include/xen/page.h b/include/xen/page.h index 89ae01c..8848da1 100644 --- a/include/xen/page.h +++ b/include/xen/page.h @@ -20,9 +20,9 @@ #include -static inline unsigned long page_to_mfn(struct page *page) +static inline unsigned long page_to_mfn(struct page *page, unsigned int offset) { - return pfn_to_mfn(xen_page_to_pfn(page)); + return pfn_to_mfn(xen_page_to_pfn(page) + (offset >> XEN_PAGE_SHIFT)); } struct xen_memory_region {