From patchwork Tue Sep 15 17:10:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wdavis@nvidia.com X-Patchwork-Id: 518042 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id CF96914017E for ; Wed, 16 Sep 2015 03:12:00 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751693AbbIORLx (ORCPT ); Tue, 15 Sep 2015 13:11:53 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:7915 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751673AbbIORLw (ORCPT ); Tue, 15 Sep 2015 13:11:52 -0400 Received: from hqnvupgp07.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com id ; Tue, 15 Sep 2015 10:11:59 -0700 Received: from HQMAIL103.nvidia.com ([172.20.187.11]) by hqnvupgp07.nvidia.com (PGP Universal service); Tue, 15 Sep 2015 10:06:39 -0700 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Tue, 15 Sep 2015 10:06:39 -0700 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL103.nvidia.com (172.20.187.11) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Tue, 15 Sep 2015 17:11:51 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server id 15.0.1044.25 via Frontend Transport; Tue, 15 Sep 2015 17:11:51 +0000 Received: from wdavis-lt.nvidia.com (Not Verified[10.20.168.59]) by hqnvemgw01.nvidia.com with MailMarshal (v7, 1, 2, 5326) id ; Tue, 15 Sep 2015 10:11:51 -0700 From: Will Davis To: Bjorn Helgaas CC: Alex Williamson , Joerg Roedel , , , Konrad Wilk , Mark Hounschell , "David S. Miller" , Jonathan Corbet , Terence Ripperda , John Hubbard , Jerome Glisse , Will Davis Subject: [PATCH 14/22] swiotlb-xen: add map_peer_resource stub Date: Tue, 15 Sep 2015 12:10:59 -0500 Message-ID: <1442337067-22964-15-git-send-email-wdavis@nvidia.com> X-Mailer: git-send-email 2.5.1 In-Reply-To: <1442337067-22964-1-git-send-email-wdavis@nvidia.com> References: <1442337067-22964-1-git-send-email-wdavis@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Add Xen stub of the map_peer_resource DMA API. Return an error to indicate no bounce-buffer implementation is available yet. Signed-off-by: Will Davis --- drivers/xen/swiotlb-xen.c | 20 ++++++++++++++++++++ include/xen/swiotlb-xen.h | 11 +++++++++++ 2 files changed, 31 insertions(+) diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index 4c54932..b9879dc 100644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c @@ -475,6 +475,26 @@ void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr, } EXPORT_SYMBOL_GPL(xen_swiotlb_unmap_page); +#ifdef CONFIG_HAS_DMA_P2P +/* + * Maps a single region from a peer device's resource for DMA streaming. This is + * currently unimplemented for Xen because the only peer DMA mappings we're + * capable of creating are direct mappings with no explicit synchronization, + * e.g., there's no bounce buffer abstraction for peer mappings. + */ +dma_peer_addr_t xen_swiotlb_map_peer_resource(struct device *hwdev, + struct device *hwpeer, + struct resource *res, + unsigned long offset, + size_t size, + enum dma_data_direction dir, + struct dma_attrs *attrs) +{ + return DMA_ERROR_CODE; +} +EXPORT_SYMBOL_GPL(xen_swiotlb_map_peer_resource); +#endif + /* * Make physical memory consistent for a single streaming mode DMA translation * after a transfer. diff --git a/include/xen/swiotlb-xen.h b/include/xen/swiotlb-xen.h index 8b2eb93..dc08a4f 100644 --- a/include/xen/swiotlb-xen.h +++ b/include/xen/swiotlb-xen.h @@ -24,6 +24,17 @@ extern dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page, extern void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr, size_t size, enum dma_data_direction dir, struct dma_attrs *attrs); + +#ifdef CONFIG_HAS_DMA_P2P +extern dma_peer_addr_t xen_swiotlb_map_peer(struct device *hwdev, + struct device *hwpeer, + struct resource *res, + unsigned long offset, + size_t size, + enum dma_data_direction dir, + struct dma_attrs *attrs); +#endif + extern int xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems, enum dma_data_direction dir,