From nobody Thu Oct 2 10:58:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1758221153; cv=none; d=zohomail.com; s=zohoarc; b=WhWGvdZaIldnXWXJAv6LKyKLpGWssp7CF6bAXRqkv5eoWwqaYC2P1MDSqnDtE/TgjiAHayAM2uzaWysji6MZTaY41I84IInw8RDFtHJtnEhcmd9YsG9RBGdElZtFLPR6LmxjN2fQ3YIPL52RGpb5kfqELNcVsetNy/aXEda3BaI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758221153; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zuA2/EbjAjP+IDiVRg8tCpvb0l3w5/9bBHRhhMxW4Wg=; b=nhmbdOvELwjkJM7ZQk74OTAdnDFFAUg1M3qVG325c7VuI7FrWtSuv9niqDTm4gkD3G9R34hUl/m7WUo3sO9gSU8C0zTRB+EfMOmOhaHhNAbc4WMvrHeaL5JsqAbwKoDa2hXPt7EGot0OpTjer26eEeMVUdeZJvsDJbn4UfWYW40= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1758221153941421.91591826067247; Thu, 18 Sep 2025 11:45:53 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1126434.1468009 (Exim 4.92) (envelope-from ) id 1uzJdX-0003a2-0J; Thu, 18 Sep 2025 18:45:43 +0000 Received: by outflank-mailman (output) from mailman id 1126434.1468009; Thu, 18 Sep 2025 18:45:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uzJdW-0003Yy-Oz; Thu, 18 Sep 2025 18:45:42 +0000 Received: by outflank-mailman (input) for mailman id 1126434; Thu, 18 Sep 2025 18:45:42 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uzJdW-0003Vt-66 for xen-devel@lists.xenproject.org; Thu, 18 Sep 2025 18:45:42 +0000 Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ac2cde88-94bf-11f0-9809-7dc792cee155; Thu, 18 Sep 2025 20:45:40 +0200 (CEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 6D84660211; Thu, 18 Sep 2025 18:45:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E3E1C4CEE7; Thu, 18 Sep 2025 18:45:38 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ac2cde88-94bf-11f0-9809-7dc792cee155 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758221139; bh=lYina26sWVeUcMXQiYVzGEsG3s2F3WRjYogRL1Hc1Kg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nmeOm+sqpgOPQj79lggvc1K6wpDOki3X4yJuxCb2vpWB7Yrit2zqRh0RiDIvOfhbE evc12i0uWXAtIGkWhu78jwz295HLWPOAaZO6IZ/cviymzjBAJS/z9YITfLbhvXtCFj ky8D8HIF4+CT3b196kV7uzpo4mZHe5HQ3Dm4EG7bvT2H0SCDQYzaGQ0o23uNJgkbi+ 6aZi+d9itiPvwVg22aSegOmezzgMa5H8zXDrUjIenHJYjuH2xplO3ZAhthDLRLlTV2 U0DeJS9SxdDkBapfGs1dH8YVifrYc3iq4bbDeAIVs7BBOR9OCRgcGcxYPk4A43PYIU SJ9lnFSV8Evzw== From: Leon Romanovsky To: Marek Szyprowski Cc: Leon Romanovsky , Jason Gunthorpe , Andreas Larsson , Borislav Petkov , Dave Hansen , "David S. Miller" , Geoff Levand , Helge Deller , Ingo Molnar , iommu@lists.linux.dev, "James E.J. Bottomley" , Jason Wang , Juergen Gross , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Madhavan Srinivasan , Matt Turner , Michael Ellerman , "Michael S. Tsirkin" , Richard Henderson , sparclinux@vger.kernel.org, Stefano Stabellini , Thomas Bogendoerfer , Thomas Gleixner , virtualization@lists.linux.dev, x86@kernel.org, xen-devel@lists.xenproject.org Subject: [PATCH 3/9] parisc: Convert DMA map_page to map_phys interface Date: Thu, 18 Sep 2025 21:45:03 +0300 Message-ID: <56c4c3b14f46c0a785f196315b673b0b1bcfb3b1.1758219787.git.leon@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1758221155273116600 Content-Type: text/plain; charset="utf-8" From: Leon Romanovsky Perform mechanical conversion from .map_page to .map_phys callback. Signed-off-by: Leon Romanovsky --- drivers/parisc/ccio-dma.c | 25 +++++++++++++------------ drivers/parisc/sba_iommu.c | 23 ++++++++++++----------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c index feef537257d05..d45f3634f8270 100644 --- a/drivers/parisc/ccio-dma.c +++ b/drivers/parisc/ccio-dma.c @@ -773,17 +773,18 @@ ccio_map_single(struct device *dev, void *addr, size_= t size, =20 =20 static dma_addr_t -ccio_map_page(struct device *dev, struct page *page, unsigned long offset, - size_t size, enum dma_data_direction direction, - unsigned long attrs) +ccio_map_phys(struct device *dev, phys_addr_t phys, size_t size, + enum dma_data_direction direction, unsigned long attrs) { - return ccio_map_single(dev, page_address(page) + offset, size, - direction); + if (attrs & DMA_ATTR_MMIO) + return DMA_MAPPING_ERROR; + + return ccio_map_single(dev, phys_to_virt(phys), size, direction); } =20 =20 /** - * ccio_unmap_page - Unmap an address range from the IOMMU. + * ccio_unmap_phys - Unmap an address range from the IOMMU. * @dev: The PCI device. * @iova: The start address of the DMA region. * @size: The length of the DMA region. @@ -791,7 +792,7 @@ ccio_map_page(struct device *dev, struct page *page, un= signed long offset, * @attrs: attributes */ static void=20 -ccio_unmap_page(struct device *dev, dma_addr_t iova, size_t size, +ccio_unmap_phys(struct device *dev, dma_addr_t iova, size_t size, enum dma_data_direction direction, unsigned long attrs) { struct ioc *ioc; @@ -873,7 +874,7 @@ static void ccio_free(struct device *dev, size_t size, void *cpu_addr, dma_addr_t dma_handle, unsigned long attrs) { - ccio_unmap_page(dev, dma_handle, size, 0, 0); + ccio_unmap_phys(dev, dma_handle, size, 0, 0); free_pages((unsigned long)cpu_addr, get_order(size)); } =20 @@ -1004,7 +1005,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist = *sglist, int nents, #ifdef CCIO_COLLECT_STATS ioc->usg_pages +=3D sg_dma_len(sglist) >> PAGE_SHIFT; #endif - ccio_unmap_page(dev, sg_dma_address(sglist), + ccio_unmap_phys(dev, sg_dma_address(sglist), sg_dma_len(sglist), direction, 0); ++sglist; nents--; @@ -1017,8 +1018,8 @@ static const struct dma_map_ops ccio_ops =3D { .dma_supported =3D ccio_dma_supported, .alloc =3D ccio_alloc, .free =3D ccio_free, - .map_page =3D ccio_map_page, - .unmap_page =3D ccio_unmap_page, + .map_phys =3D ccio_map_phys, + .unmap_phys =3D ccio_unmap_phys, .map_sg =3D ccio_map_sg, .unmap_sg =3D ccio_unmap_sg, .get_sgtable =3D dma_common_get_sgtable, @@ -1072,7 +1073,7 @@ static int ccio_proc_info(struct seq_file *m, void *p) ioc->msingle_calls, ioc->msingle_pages, (int)((ioc->msingle_pages * 1000)/ioc->msingle_calls)); =20 - /* KLUGE - unmap_sg calls unmap_page for each mapped page */ + /* KLUGE - unmap_sg calls unmap_phys for each mapped page */ min =3D ioc->usingle_calls - ioc->usg_calls; max =3D ioc->usingle_pages - ioc->usg_pages; seq_printf(m, "pci_unmap_single: %8ld calls %8ld pages (avg %d/1000)\n", diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c index fc3863c09f83d..8040aa4e6ff42 100644 --- a/drivers/parisc/sba_iommu.c +++ b/drivers/parisc/sba_iommu.c @@ -778,17 +778,18 @@ sba_map_single(struct device *dev, void *addr, size_t= size, =20 =20 static dma_addr_t -sba_map_page(struct device *dev, struct page *page, unsigned long offset, - size_t size, enum dma_data_direction direction, - unsigned long attrs) +sba_map_phys(struct device *dev, phys_addr_t phys, size_t size, + enum dma_data_direction direction, unsigned long attrs) { - return sba_map_single(dev, page_address(page) + offset, size, - direction); + if (attrs & DMA_ATTR_MMIO) + return DMA_MAPPING_ERROR; + + return sba_map_single(dev, phys_to_virt(phys), size, direction); } =20 =20 /** - * sba_unmap_page - unmap one IOVA and free resources + * sba_unmap_phys - unmap one IOVA and free resources * @dev: instance of PCI owned by the driver that's asking. * @iova: IOVA of driver buffer previously mapped. * @size: number of bytes mapped in driver buffer. @@ -798,7 +799,7 @@ sba_map_page(struct device *dev, struct page *page, uns= igned long offset, * See Documentation/core-api/dma-api-howto.rst */ static void -sba_unmap_page(struct device *dev, dma_addr_t iova, size_t size, +sba_unmap_phys(struct device *dev, dma_addr_t iova, size_t size, enum dma_data_direction direction, unsigned long attrs) { struct ioc *ioc; @@ -914,7 +915,7 @@ static void sba_free(struct device *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle, unsigned long attrs) { - sba_unmap_page(hwdev, dma_handle, size, 0, 0); + sba_unmap_phys(hwdev, dma_handle, size, 0, 0); free_pages((unsigned long) vaddr, get_order(size)); } =20 @@ -1061,7 +1062,7 @@ sba_unmap_sg(struct device *dev, struct scatterlist *= sglist, int nents, =20 while (nents && sg_dma_len(sglist)) { =20 - sba_unmap_page(dev, sg_dma_address(sglist), sg_dma_len(sglist), + sba_unmap_phys(dev, sg_dma_address(sglist), sg_dma_len(sglist), direction, 0); #ifdef SBA_COLLECT_STATS ioc->usg_pages +=3D ((sg_dma_address(sglist) & ~IOVP_MASK) + sg_dma_len(= sglist) + IOVP_SIZE - 1) >> PAGE_SHIFT; @@ -1085,8 +1086,8 @@ static const struct dma_map_ops sba_ops =3D { .dma_supported =3D sba_dma_supported, .alloc =3D sba_alloc, .free =3D sba_free, - .map_page =3D sba_map_page, - .unmap_page =3D sba_unmap_page, + .map_phys =3D sba_map_phys, + .unmap_phys =3D sba_unmap_phys, .map_sg =3D sba_map_sg, .unmap_sg =3D sba_unmap_sg, .get_sgtable =3D dma_common_get_sgtable, --=20 2.51.0