From patchwork Tue Sep 15 17:10:56 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: 518039 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 87636140157 for ; Wed, 16 Sep 2015 03:11:45 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751567AbbIORLo (ORCPT ); Tue, 15 Sep 2015 13:11:44 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:12021 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751074AbbIORLo (ORCPT ); Tue, 15 Sep 2015 13:11:44 -0400 Received: from hqnvupgp08.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com id ; Tue, 15 Sep 2015 10:11:15 -0700 Received: from HQMAIL101.nvidia.com ([172.20.187.10]) by hqnvupgp08.nvidia.com (PGP Universal service); Tue, 15 Sep 2015 10:11:30 -0700 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Tue, 15 Sep 2015 10:11:30 -0700 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Tue, 15 Sep 2015 17:11:43 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server id 15.0.1044.25 via Frontend Transport; Tue, 15 Sep 2015 17:11:43 +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:43 -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 11/22] swiotlb: Add map_peer_resource stub Date: Tue, 15 Sep 2015 12:10:56 -0500 Message-ID: <1442337067-22964-12-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 swiotlb stub of the 'map_peer_resource' DMA operation. Signed-off-by: Will Davis --- include/linux/swiotlb.h | 8 ++++++++ lib/swiotlb.c | 17 +++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h index e7a018e..872463a 100644 --- a/include/linux/swiotlb.h +++ b/include/linux/swiotlb.h @@ -87,6 +87,14 @@ swiotlb_unmap_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems, enum dma_data_direction dir, struct dma_attrs *attrs); +#ifdef CONFIG_HAS_DMA_P2P +extern dma_peer_addr_t +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); +#endif + extern void swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr, size_t size, enum dma_data_direction dir); diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 76f29ec..61522a7 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c @@ -945,6 +945,23 @@ swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sgl, int nelems, } EXPORT_SYMBOL(swiotlb_unmap_sg); +#ifdef CONFIG_HAS_DMA_P2P +/* + * Maps a single region from a peer device's resource for DMA streaming. This + * is currently unimplemented because there's no bounce buffer abstraction for + * peer mappings. + */ +dma_peer_addr_t +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 phys_to_dma(hwdev, io_tlb_overflow_buffer); +} +EXPORT_SYMBOL(swiotlb_map_peer_resource); +#endif + /* * Make physical memory consistent for a set of streaming mode DMA translations * after a transfer.