From nobody Thu Oct 30 22:49:04 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=1760519635; cv=none; d=zohomail.com; s=zohoarc; b=Sjup3v2rqLgrWzAntjUmnlhrbwRmmmzhy+qcFok8EfVjFzjjca0lDzIX58J2lCQ80o5JIpOH9FOt6e2QbOFb51jL4orogor49fYBdFr3iNcADk3wEsFoKAkifv3WAtwUAzG3fbljGmQWP7Q6UHEqnyZE7lgI4IUjbiaIv3WaRY0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1760519635; h=Content-Type: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=4bgfPlYm5NnLREwcTJMCLZzRzJFsxcYwx/hKPzErniI=; b=kHCiDQF5qQYAXKjcwFXk/VcZEwm26WHCreLmVwXd046invgeY1MA099l4V6wqAbEXoPDw0xtJN8WMGFDYeXZntYlzR7n7cqt21ZNaGZ1EJ0xI1Q6z+59qa9plfLJr7qzgC6ss6NN35Q7AcW0lNZkdpHKfjqBRInhJPi3SWTS8+g= 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 1760519635938502.27178158670563; Wed, 15 Oct 2025 02:13:55 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1143410.1477170 (Exim 4.92) (envelope-from ) id 1v8xZi-00057h-Iw; Wed, 15 Oct 2025 09:13:38 +0000 Received: by outflank-mailman (output) from mailman id 1143410.1477170; Wed, 15 Oct 2025 09:13:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1v8xZi-00057O-Ff; Wed, 15 Oct 2025 09:13:38 +0000 Received: by outflank-mailman (input) for mailman id 1143410; Wed, 15 Oct 2025 09:13:37 +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 1v8xZh-0002lL-3v for xen-devel@lists.xenproject.org; Wed, 15 Oct 2025 09:13:37 +0000 Received: from tor.source.kernel.org (tor.source.kernel.org [2600:3c04:e001:324:0:1991:8:25]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 39aab269-a9a7-11f0-980a-7dc792cee155; Wed, 15 Oct 2025 11:13:34 +0200 (CEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id C98CB63BF7; Wed, 15 Oct 2025 09:13:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CED5FC4CEF9; Wed, 15 Oct 2025 09:13:32 +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: 39aab269-a9a7-11f0-980a-7dc792cee155 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760519613; bh=20pkhPTluVu52SbPzmxmrTfHrn6yEtG7pWga+DsrWIc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ig53rDzt8hiBzZZ+zdzkS7cx6K4XFlPakt74zliZ2VuFOxA/v+TKFBvFTWoou1sUN q53E6CiOe35aym9Eqm8SnAer8W1OFJFVkHe3wWEFH4Ithjt31CpiK1AAPn+wYcvsWw LMgdDn2fvxI1mJluK4lYZ292gEC9pr+xl8CZRpwwmz64D7xTeEPTRhwbKU6VeCcRVk LtLSCMxyCZQlEPmtLI/pgkfz+kbl+r9ceDLpdIznTuwex+mPkjdDZ9f8md8PKxM9C4 eroP4W9zJU2vT9cO8vlBtQn8KWZOrYYGD9/qePUDi07GGe7B84+AoJ0M7EyrOLjuu+ lNptFD7tgV7qw== From: Leon Romanovsky To: Marek Szyprowski , Robin Murphy , Russell King , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Richard Henderson , Matt Turner , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Geoff Levand , "David S. Miller" , Andreas Larsson , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, xen-devel@lists.xenproject.org, linux-alpha@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org, Jason Gunthorpe , Jason Gunthorpe Subject: [PATCH v5 08/14] MIPS/jazzdma: Provide physical address directly Date: Wed, 15 Oct 2025 12:12:54 +0300 Message-ID: <20251015-remove-map-page-v5-8-3bbfe3a25cdf@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251015-remove-map-page-v5-0-3bbfe3a25cdf@kernel.org> References: <20251015-remove-map-page-v5-0-3bbfe3a25cdf@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.15-dev Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1760519637605158500 From: Leon Romanovsky MIPS jazz uses physical addresses for mapping pages, so convert it to get them directly from DMA mapping routine. Reviewed-by: Jason Gunthorpe Signed-off-by: Leon Romanovsky --- arch/mips/jazz/jazzdma.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/arch/mips/jazz/jazzdma.c b/arch/mips/jazz/jazzdma.c index c97b089b9902..eb9fb2f2a720 100644 --- a/arch/mips/jazz/jazzdma.c +++ b/arch/mips/jazz/jazzdma.c @@ -521,18 +521,24 @@ static void jazz_dma_free(struct device *dev, size_t = size, void *vaddr, __free_pages(virt_to_page(vaddr), get_order(size)); } =20 -static dma_addr_t jazz_dma_map_page(struct device *dev, struct page *page, - unsigned long offset, size_t size, enum dma_data_direction dir, - unsigned long attrs) +static dma_addr_t jazz_dma_map_phys(struct device *dev, phys_addr_t phys, + size_t size, enum dma_data_direction dir, unsigned long attrs) { - phys_addr_t phys =3D page_to_phys(page) + offset; + if (unlikely(attrs & DMA_ATTR_MMIO)) + /* + * This check is included because older versions of the code lacked + * MMIO path support, and my ability to test this path is limited. + * However, from a software technical standpoint, there is no restrictio= n, + * as the following code operates solely on physical addresses. + */ + return DMA_MAPPING_ERROR; =20 if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC)) arch_sync_dma_for_device(phys, size, dir); return vdma_alloc(phys, size); } =20 -static void jazz_dma_unmap_page(struct device *dev, dma_addr_t dma_addr, +static void jazz_dma_unmap_phys(struct device *dev, dma_addr_t dma_addr, size_t size, enum dma_data_direction dir, unsigned long attrs) { if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC)) @@ -607,8 +613,8 @@ static void jazz_dma_sync_sg_for_cpu(struct device *dev, const struct dma_map_ops jazz_dma_ops =3D { .alloc =3D jazz_dma_alloc, .free =3D jazz_dma_free, - .map_page =3D jazz_dma_map_page, - .unmap_page =3D jazz_dma_unmap_page, + .map_phys =3D jazz_dma_map_phys, + .unmap_phys =3D jazz_dma_unmap_phys, .map_sg =3D jazz_dma_map_sg, .unmap_sg =3D jazz_dma_unmap_sg, .sync_single_for_cpu =3D jazz_dma_sync_single_for_cpu, --=20 2.51.0