From patchwork Wed Aug 14 21:59:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 11094663 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7156F1395 for ; Wed, 14 Aug 2019 22:05:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6048F2880C for ; Wed, 14 Aug 2019 22:05:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54A8228892; Wed, 14 Aug 2019 22:05:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0D84928885 for ; Wed, 14 Aug 2019 22:05:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jFylpyQ2588ru+2Cf5f0cJ/vGxTQU+/tPL1xSgH0pfE=; b=U2MNQkGSd44Ele oBP62OIAFtqH41GLoexVC7MzR6/ddOd9AQPh7C1tziiqymjtmneSq4bcZF+vQ4tdiWO/6gVszwEdn oh1Auur2d8yzSMfIj0XW8S5pRU/9rhLFuEmQe9UUyJXZkV3I+/Ufgj/X3ZsN4UWuka4qkkjqTVXGs Cg72pXqz++sp8c17V3iC3hwHlPK08U81bPNhBAvoH0QzaUpHruy7Sa27d2tUTo4c2mLzWW0xZjJsx hCiAeEoSGURdBDhbEvtk7ykhd1UHZsFKai45poSQRFRDI3z5zIAAeCp1lV7kiwYZMH8rFl4o5kOT9 BkHQOIVrf44RTC1UgVXg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hy1OQ-0003RW-CI; Wed, 14 Aug 2019 22:05:18 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hy1OM-0003Qn-2u for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2019 22:05:15 +0000 Received: by mail-pg1-x543.google.com with SMTP id e11so288010pga.5 for ; Wed, 14 Aug 2019 15:05:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zGCahEylBwx9+hrUl6JBv64qJITZ7AIfmMEaH7B2Nfg=; b=KNxFr9QT2oHk0ee5GI2IjIkLTldwP57yZGwcnjUEsIx3OB6B0cmtOER71JKAynaxAl tI28WVuAQNFlKsPnyqKGlZnvq7stwRv5qOx8V+A8CfeEzpCSJrEDgGxpC76R/mjugfZV cfj3AMX5FF04HK8PouDp/LkA+AYBdKeqGW7mI9yywFHfFa+D9mW3dX3slJb9DT3Vb2nB z1VC/a8ZneW4oXJPYnEqJeDKPyPYqbkfh/2OJgcLihAGqC7Bk8dISekepsMevjddKfwG JwbAp2kne42JJ1D+FPohAKaeYVSHgGwpEG5iS4sn8vtrJGrv6DbWWHa+MfhexA3EwLHf RGjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zGCahEylBwx9+hrUl6JBv64qJITZ7AIfmMEaH7B2Nfg=; b=HyrhnNG4MifipjiYlB70N5mfPsYVq0iLkgGh/11KAepLVn/kdymPRxkbHOe0DPKDfE Ax8AEuVPrGN5zh8A8S7wEoGo5LQfLg/LcDq4PoHq2IDTM1PVppFAFt5DHR4XWfDz86gp jo+mcDbKQcMDHZ3vHuBBgNY9witWdiutB+dcXj8Ffxo4v4A/lKT3xrrIbzLYHYVuR4RK pHLHfJO9OkZ21+fz+WUgeXitaVrhnaBhSHlaUNKHiLHWgPlxjOPqs7ydk3e1vToXC9Yb Rs0c1QRQaPRnUSlSl2DMV38jPn/Ck/6hCYbIQV5oS7enu3mgEAQ+M57Sgd+6ayKMUTDW +O8g== X-Gm-Message-State: APjAAAWRmOVMCeDmqrkTcUVa/BTGWS2c+CkymWleci59ue82guVA0ilE p7RlGAxodkeftT1/AoeMJWs= X-Google-Smtp-Source: APXvYqwdj2exVMetPPaW54oofiik0neX5PkaF4gcffTO1xCR5P3KzJE/Uy1GZgX/vn90YM4nR9bKlw== X-Received: by 2002:a62:e901:: with SMTP id j1mr2192946pfh.189.1565820313296; Wed, 14 Aug 2019 15:05:13 -0700 (PDT) Received: from localhost ([100.118.89.196]) by smtp.gmail.com with ESMTPSA id g19sm968879pfk.0.2019.08.14.15.05.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2019 15:05:12 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/6] arm64: export arch_sync_dma_for_*() Date: Wed, 14 Aug 2019 14:59:56 -0700 Message-Id: <20190814220011.26934-2-robdclark@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190814220011.26934-1-robdclark@gmail.com> References: <20190814220011.26934-1-robdclark@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190814_150514_132183_A1042418 X-CRM114-Status: UNSURE ( 9.51 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , Masayoshi Mizuma , Joerg Roedel , Catalin Marinas , Robin Murphy , linux-kernel@vger.kernel.org, Jesper Dangaard Brouer , Will Deacon , Christoph Hellwig , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rob Clark Signed-off-by: Rob Clark --- arch/arm64/mm/dma-mapping.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index 1d3f0b5a9940..ea5ae11d07f7 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c @@ -24,12 +24,14 @@ void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr, { __dma_map_area(phys_to_virt(paddr), size, dir); } +EXPORT_SYMBOL_GPL(arch_sync_dma_for_device); void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr, size_t size, enum dma_data_direction dir) { __dma_unmap_area(phys_to_virt(paddr), size, dir); } +EXPORT_SYMBOL_GPL(arch_sync_dma_for_cpu); void arch_dma_prep_coherent(struct page *page, size_t size) { From patchwork Wed Aug 14 21:59:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 11094669 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4557A13AC for ; Wed, 14 Aug 2019 22:08:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33CDA28671 for ; Wed, 14 Aug 2019 22:08:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 270CE28684; Wed, 14 Aug 2019 22:08:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C33FB28802 for ; Wed, 14 Aug 2019 22:08:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=umQSr1hpTctkcvFF8TS9LnWJjXUiCTYpds7VW8vlpl0=; b=XWeESEY/tjBxop bW0cpfgg/1QvmlvPfpYRmXew9h8DMx0ul1m0cnzMOvAvDz9Xw5AmxsBbFZ1CSUzS/8W4CwqA7+I+R AKFoFG1ETAgPumjohO7wouxD1igqXr++RbKIib/vL/Jdp+hKTmXSAY1bT/ZImT5cPDVGKyEgYa1gb DAab03GMk1y3bCIVr9Axy24CseBGG0u8o8u0kMj0dqCvNwv38JjErXGo0Xmn/8PKj3z+vx+rWtBjH xcEomwSVyuh+xq3qS5ByOcTRrFujdXRfhhE/XPPIdE1/A6UkZuvXvzvVhk0Akv9cefT98u/BcJOqK N6O0zOldJFBiW0AntFmQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hy1R3-0004GK-8A; Wed, 14 Aug 2019 22:08:01 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hy1Qn-00047f-G2 for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2019 22:07:46 +0000 Received: by mail-pf1-x444.google.com with SMTP id 129so188706pfa.4 for ; Wed, 14 Aug 2019 15:07:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fm+XMGdKo1qLDwMEPJoOd+67atBUmC1hzfZly9LEwV0=; b=sgPCxVPDpH9l2X4SPUlx10kZFVi9IyEGQZCYZYSp7q2+1HYZUvT2BP02kXdHCDxuQe ovLGoEDRejVtZkJFak27XXUav3OaPEikhGNchX4l2i6fwcPxTxbG+IuniEBAnuJs1Wnn vE3XrY4NLX8lQ0cXESW4Dhc9SO9SwnUyFax0vMAwqj1rzBIWXFt0FeSvTdRUc4l3NpvN jX3+ZqLSgrLGCWOssPanOkD0fstz6U6ag9S/JUBDg1jCWNYg1kaWU8QYMgT+SvMMzzb2 dX82zkunQSsga8PbpkqwG1h5iYhdx/yxUvNXdd7H192iWYxzh/ZNrGhBHqmcDohBWF4H +wGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fm+XMGdKo1qLDwMEPJoOd+67atBUmC1hzfZly9LEwV0=; b=Sq+sp8v+HMlxZykwmqmQeQsMy2+TWRpJoCeDOvPq1sPkkRM3fs7cYeUMiUDjbwFtqL S+ipeeXu3xXYOkpSVxgp6nIzU9NzTVBGSIv8Ys5DQKKTepfyRVBk8p1lVSZRG5sLlAav h3rRFOowf/5/07Oz8bwIFR8XT1LRlETb9hcuMeEEGJX49TAiMv3R8QZj8uPgIGkRSsyh rbVa76sIkPfnzQIQ4GYQQu7V90oWAyrtxnuzYTmtlr8wkOvHKINQ/FiODtXMitJ16ZZ3 ij9xbpYGBQDcp1rxMSlQ2Vig29/p+kC9UxZD39HYzpKDLV/dvOXRRj85hew47EZfIvwJ ZXKg== X-Gm-Message-State: APjAAAWACXVL3rQb7sfSt+X8ltJTV0JYJX+Ti2P/bkHRNIorCW9tvJoQ JtOqZb3yi6aFUEp4JcQRTdk= X-Google-Smtp-Source: APXvYqxEANCpUtYQ+5OhPEAzs37rqT2wBBhN570Sw5KrEeNXbOBWwWt7Xo763dhxGWxso/PvNN7UjA== X-Received: by 2002:a17:90a:eb05:: with SMTP id j5mr87119pjz.102.1565820464819; Wed, 14 Aug 2019 15:07:44 -0700 (PDT) Received: from localhost ([100.118.89.196]) by smtp.gmail.com with ESMTPSA id i9sm659836pgo.46.2019.08.14.15.07.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2019 15:07:44 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/6] mips: export arch_sync_dma_for_*() Date: Wed, 14 Aug 2019 14:59:57 -0700 Message-Id: <20190814220011.26934-3-robdclark@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190814220011.26934-1-robdclark@gmail.com> References: <20190814220011.26934-1-robdclark@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190814_150745_582506_EA39D3F8 X-CRM114-Status: GOOD ( 13.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , "Maciej W. Rozycki" , Hauke Mehrtens , Greg Kroah-Hartman , Maxime Ripard , Catalin Marinas , David Airlie , Maarten Lankhorst , linux-kernel@vger.kernel.org, Ralf Baechle , linux-mips@vger.kernel.org, Sean Paul , Paul Burton , linux-arm-kernel@lists.infradead.org, Daniel Vetter , James Hogan , Thomas Gleixner , Will Deacon , Christoph Hellwig , Allison Randal Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rob Clark Signed-off-by: Rob Clark --- arch/arm64/mm/flush.c | 2 ++ arch/mips/mm/dma-noncoherent.c | 2 ++ drivers/gpu/drm/drm_cache.c | 20 +++++++++++++++++--- include/drm/drm_cache.h | 4 ++++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c index dc19300309d2..f0eb6320c979 100644 --- a/arch/arm64/mm/flush.c +++ b/arch/arm64/mm/flush.c @@ -93,3 +93,5 @@ void arch_invalidate_pmem(void *addr, size_t size) } EXPORT_SYMBOL_GPL(arch_invalidate_pmem); #endif + +EXPORT_SYMBOL_GPL(__flush_dcache_area); diff --git a/arch/mips/mm/dma-noncoherent.c b/arch/mips/mm/dma-noncoherent.c index ed56c6fa7be2..bd5debe1b423 100644 --- a/arch/mips/mm/dma-noncoherent.c +++ b/arch/mips/mm/dma-noncoherent.c @@ -131,6 +131,7 @@ void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr, { dma_sync_phys(paddr, size, dir); } +EXPORT_SYMBOL_GPL(arch_sync_dma_for_device); #ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr, @@ -139,6 +140,7 @@ void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr, if (cpu_needs_post_dma_flush(dev)) dma_sync_phys(paddr, size, dir); } +EXPORT_SYMBOL_GPL(arch_sync_dma_for_cpu); #endif void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size, diff --git a/drivers/gpu/drm/drm_cache.c b/drivers/gpu/drm/drm_cache.c index 3bd76e918b5d..90105c637797 100644 --- a/drivers/gpu/drm/drm_cache.c +++ b/drivers/gpu/drm/drm_cache.c @@ -69,6 +69,14 @@ static void drm_cache_flush_clflush(struct page *pages[], } #endif +#if defined(__powerpc__) +static void __flush_dcache_area(void *addr, size_t len) +{ + flush_dcache_range((unsigned long)addr, + (unsigned long)addr + PAGE_SIZE); +} +#endif + /** * drm_clflush_pages - Flush dcache lines of a set of pages. * @pages: List of pages to be flushed. @@ -90,7 +98,7 @@ drm_clflush_pages(struct page *pages[], unsigned long num_pages) if (wbinvd_on_all_cpus()) pr_err("Timed out waiting for cache flush\n"); -#elif defined(__powerpc__) +#elif defined(__powerpc__) || defined(CONFIG_ARM64) unsigned long i; for (i = 0; i < num_pages; i++) { struct page *page = pages[i]; @@ -100,8 +108,7 @@ drm_clflush_pages(struct page *pages[], unsigned long num_pages) continue; page_virtual = kmap_atomic(page); - flush_dcache_range((unsigned long)page_virtual, - (unsigned long)page_virtual + PAGE_SIZE); + __flush_dcache_area(page_virtual, PAGE_SIZE); kunmap_atomic(page_virtual); } #else @@ -135,6 +142,13 @@ drm_clflush_sg(struct sg_table *st) if (wbinvd_on_all_cpus()) pr_err("Timed out waiting for cache flush\n"); +#elif defined(CONFIG_ARM64) + struct sg_page_iter sg_iter; + + for_each_sg_page(st->sgl, &sg_iter, st->nents, 0) { + struct page *p = sg_page_iter_page(&sg_iter); + drm_clflush_pages(&p, 1); + } #else pr_err("Architecture has no drm_cache.c support\n"); WARN_ON_ONCE(1); diff --git a/include/drm/drm_cache.h b/include/drm/drm_cache.h index 987ff16b9420..f94e7bd3eca4 100644 --- a/include/drm/drm_cache.h +++ b/include/drm/drm_cache.h @@ -40,6 +40,10 @@ void drm_clflush_sg(struct sg_table *st); void drm_clflush_virt_range(void *addr, unsigned long length); bool drm_need_swiotlb(int dma_bits); +#if defined(CONFIG_X86) || defined(__powerpc__) || defined(CONFIG_ARM64) +#define HAS_DRM_CACHE 1 +#endif + static inline bool drm_arch_can_wc_memory(void) { From patchwork Wed Aug 14 21:59:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 11094675 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DD0EC1395 for ; Wed, 14 Aug 2019 22:13:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9B38286E0 for ; Wed, 14 Aug 2019 22:13:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD58D286FE; Wed, 14 Aug 2019 22:13:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 57046286F2 for ; Wed, 14 Aug 2019 22:13:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ayz0n6mw0ufVU42n9ICXEzcUBvwQX7NvU4BlndA0tWI=; b=MpzBUJETdKZj/T O9u08ROb/he9T1aYvmlLHW1eo2kAT5hnZof8T+Si/lh+HKZr7gdNad3M3P7Zmb1irZiXyhO+8b8kp WY1h+fAu3SK/jfnn2t15l/ahYQS7mdFJwpi+XXwzpk5tN0i6JqyMblzAhZ+haXYPF8eMUT3la84Aw 1LoZ+8CEWOSfk3Uu7qBqQEOXPbcEQb+CMWOht7qcGJniJgzDT6xvTwiXnMh2TvZHTGhrog+McdvIb 7oMd9Ld1ZKzlTIpW0NK1EU1uJeIV72G2VKAC5uhmQJmj1QJ+iqKZQGtgVAsCQSsjftvOCSjZFpYFS T/vSsrnf+WWO6hRr31VA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hy1WG-0006Sx-Rl; Wed, 14 Aug 2019 22:13:24 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hy1WD-0006Sb-JO for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2019 22:13:22 +0000 Received: by mail-pl1-x642.google.com with SMTP id y8so214549plr.12 for ; Wed, 14 Aug 2019 15:13:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=o3iTgpB3GXZ+kQcPnDKxJUeeBPOFZQS1HDP+dtSl8iI=; b=HEFmOTX7vqz6H06xnoRwJnyjwS4ngqlcblSxxBe9uJf91C2C3l3H3afY81WwkxEetJ EbUuQcyViX1xj4UfRyAAAdKQkMJMp+A+qWSGvq1zWUQw8DQ77jCsLpCgcMhfLo6nNVda wPT3QzNUctnrmjktXM3EnsOkJ9WFmmfmF6P3JP5768lVtArSlAJdr5XkaQydkdBmUDdH uDi58nt19hPwUpCeJaQPKGXa/z2gZnqlXC+ryopFfLScSWgENEVIXSevTZyjazE3ppis zLF2GWdAmdB59Sq/EJsbTmRz5IiKtqn37DU/qrZVhnWBWkDLht8AheY3rvNIjk4LdN7S 2yNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=o3iTgpB3GXZ+kQcPnDKxJUeeBPOFZQS1HDP+dtSl8iI=; b=Z2tbELAFr62/vc6nn/M94ozC6ystyHYzUxFoDYnoGJxy/q0XKKotOOLn1BSlTMSQkn NMOjig2iig2DmVlF0FzX0Wj3+k9ejchosSJaN3Zl7xwej9CLvS5pGJIANja8i0aV4XhS cHi3iSRRcEHPown4sLLzSchs2muJJ4bqvQgvdfLgrquLuJV2Rd8U+NczmXAEtPYWyeDj Ic4Mfw7zT0KnDgg4WyjpOIDOXXc9+dBPuJycMzbczK9F/GRjzKUXBbHxDHCH9OY85V5e 9Mr/8ZGud6EelAzfzYm72Hgb+ogHM6830zLIJkzrIOS+HzC/j0Dq+TXpUvAPTOw7C/RH EFxA== X-Gm-Message-State: APjAAAXtt7ns9DI68MA/1eAfxHnFOFmgL94ddBYfrPaDHqkXXHkluCym UNb4xd4WRPhLJO386NTrN5Y= X-Google-Smtp-Source: APXvYqyti+vq96Q0pE8Yd5FkzLw83ZjuNfSd6SNA8pgDAWZgNSvONObYFjog77tG3BgdbQT4MUollQ== X-Received: by 2002:a17:902:ac87:: with SMTP id h7mr1561600plr.36.1565820800768; Wed, 14 Aug 2019 15:13:20 -0700 (PDT) Received: from localhost ([100.118.89.196]) by smtp.gmail.com with ESMTPSA id g1sm633892pgg.27.2019.08.14.15.13.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2019 15:13:20 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [PATCH 4/6] arm: add arch_sync_dma_for_*() Date: Wed, 14 Aug 2019 14:59:59 -0700 Message-Id: <20190814220011.26934-5-robdclark@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190814220011.26934-1-robdclark@gmail.com> References: <20190814220011.26934-1-robdclark@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190814_151321_642676_B8AF44E2 X-CRM114-Status: GOOD ( 13.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kate Stewart , Wolfram Sang , Linus Walleij , "Wolfram Sang \(Renesas\)" , Benjamin Gaignard , Mauro Carvalho Chehab , Christoph Hellwig , Rob Clark , Russell King , Mike Rapoport , linux-arm-kernel@lists.infradead.org, Vladimir Murzin , Arnd Bergmann , Anshuman Khandual , Masahiro Yamada , Doug Anderson , Thomas Gleixner , Vlastimil Babka , Ard Biesheuvel , linux-kernel@vger.kernel.org, Paul Burton , Souptick Joarder , Andrew Morton , Robin Murphy Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rob Clark Signed-off-by: Rob Clark --- arch/arm/Kconfig | 2 ++ arch/arm/mm/dma-mapping-nommu.c | 14 ++++++++++++++ arch/arm/mm/dma-mapping.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 33b00579beff..a48a7263a2c1 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -18,6 +18,8 @@ config ARM select ARCH_HAS_SET_MEMORY select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL select ARCH_HAS_STRICT_MODULE_RWX if MMU + select ARCH_HAS_SYNC_DMA_FOR_DEVICE + select ARCH_HAS_SYNC_DMA_FOR_CPU select ARCH_HAS_TEARDOWN_DMA_OPS if MMU select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_HAVE_CUSTOM_GPIO_H diff --git a/arch/arm/mm/dma-mapping-nommu.c b/arch/arm/mm/dma-mapping-nommu.c index 52b82559d99b..4a3df952151f 100644 --- a/arch/arm/mm/dma-mapping-nommu.c +++ b/arch/arm/mm/dma-mapping-nommu.c @@ -84,6 +84,13 @@ static void __dma_page_cpu_to_dev(phys_addr_t paddr, size_t size, outer_clean_range(paddr, paddr + size); } +void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr, + size_t size, enum dma_data_direction dir) +{ + __dma_page_cpu_to_dev(paddr, size, dir); +} +EXPORT_SYMBOL_GPL(arch_sync_dma_for_device); + static void __dma_page_dev_to_cpu(phys_addr_t paddr, size_t size, enum dma_data_direction dir) { @@ -93,6 +100,13 @@ static void __dma_page_dev_to_cpu(phys_addr_t paddr, size_t size, } } +void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr, + size_t size, enum dma_data_direction dir) +{ + __dma_page_dev_to_cpu(paddr, size, dir); +} +EXPORT_SYMBOL_GPL(arch_sync_dma_for_cpu); + static dma_addr_t arm_nommu_dma_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction dir, diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 6774b03aa405..8ead93196194 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -979,6 +979,13 @@ static void __dma_page_cpu_to_dev(struct page *page, unsigned long off, /* FIXME: non-speculating: flush on bidirectional mappings? */ } +void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr, + size_t size, enum dma_data_direction dir) +{ + __dma_page_cpu_to_dev(phys_to_page(paddr), paddr % PAGE_SIZE, size, dir); +} +EXPORT_SYMBOL_GPL(arch_sync_dma_for_device); + static void __dma_page_dev_to_cpu(struct page *page, unsigned long off, size_t size, enum dma_data_direction dir) { @@ -1013,6 +1020,27 @@ static void __dma_page_dev_to_cpu(struct page *page, unsigned long off, } } +void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr, + size_t size, enum dma_data_direction dir) +{ + __dma_page_dev_to_cpu(phys_to_page(paddr), paddr % PAGE_SIZE, size, dir); +} +EXPORT_SYMBOL_GPL(arch_sync_dma_for_cpu); + +/* + * arch_dma_{alloc,free} fail-stubs needed to avoid link-errors in dma/direct.c + * (which is not actually used on arch/arm) + */ +void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle, + gfp_t flags, unsigned long attrs) +{ + return NULL; +} +void arch_dma_free(struct device *dev, size_t size, void *vaddr, + dma_addr_t dma_handle, unsigned long attrs) +{ +} + /** * arm_dma_map_sg - map a set of SG buffers for streaming mode DMA * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices