From patchwork Thu Jul 26 23:16:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 10546647 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 7E09C180E for ; Fri, 27 Jul 2018 07:01:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F5552B4C9 for ; Fri, 27 Jul 2018 07:01:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 625E82B4CC; Fri, 27 Jul 2018 07:01:27 +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, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 18C802B4C9 for ; Fri, 27 Jul 2018 07:01:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6D27C6E8EE; Fri, 27 Jul 2018 07:01:21 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by gabe.freedesktop.org (Postfix) with ESMTPS id 98C466E34A; Thu, 26 Jul 2018 23:22:32 +0000 (UTC) Received: by mail-lf1-x144.google.com with SMTP id l16-v6so2319926lfc.13; Thu, 26 Jul 2018 16:22:32 -0700 (PDT) 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; bh=ZzKlBfHITiaIhtCR4V6lsjIteXVyc3M0dFCxH8acLzM=; b=l6f9JYDNXVsqEBS5AUnsQHSzwsIj+OHFK06KGklVDzN3tvvhzXpcPjm2CSGOUDyuia jMHaZgIlG8CBKmmIB5Nd0cTtNc1fB9N9FAaryIHmG8vjeVq/DZxzamYGDTPlN2S835Fl y7yEjN/Ic0dQR4AIyK/ITcaQSbUeUn38ybhaMxJVJvvM6Ycxd8c2J5qoi46c9br9iAnR FeVTbC517Z9HjJlt1aB+9w0jXMy77Wm7RTMI2EhGejGqM6Eg4Vxkr0F5h7DMCREphHPv TzmpkBbycqUK0aILuXTmAk9ftD6WQ89iK6Cf//j2trb9el6jxQfukXWWl01Ff8kuFAeA FOUA== X-Gm-Message-State: AOUpUlHwaZoK8qojPNmPwoGrQqERZNAld2XCOzGu8WH0qxRu9PKDv8DR GiWtc6f6MWoihnIOtkWv3o8= X-Google-Smtp-Source: AAOMgpeZ8ThHp5dveQGg7S7v+EtCA82C+70lNknFeTUoQIbF+mooW1gljvR35DN7sxYDiv2telrhfA== X-Received: by 2002:a19:9646:: with SMTP id y67-v6mr2420505lfd.130.1532647351075; Thu, 26 Jul 2018 16:22:31 -0700 (PDT) Received: from localhost.localdomain (109-252-90-13.nat.spd-mgts.ru. [109.252.90.13]) by smtp.gmail.com with ESMTPSA id q15-v6sm411541ljg.62.2018.07.26.16.22.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 16:22:30 -0700 (PDT) From: Dmitry Osipenko To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Thierry Reding , Jonathan Hunter , Mikko Perttunen , Rob Herring , Frank Rowand , Ben Skeggs , Russell King , Catalin Marinas , Will Deacon , Joerg Roedel , Nicolas Chauvet Subject: [RFC PATCH v1 1/6] driver core: Add option for disabling of backing devices DMA with IOMMU Date: Fri, 27 Jul 2018 02:16:19 +0300 Message-Id: <20180726231624.21084-2-digetx@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180726231624.21084-1-digetx@gmail.com> References: <20180726231624.21084-1-digetx@gmail.com> X-Mailman-Approved-At: Fri, 27 Jul 2018 07:01:20 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linux-tegra@vger.kernel.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This allows device drivers to convey the drivers core that implicit IOMMU backing for devices DMA shouldn't happen. It is needed for drivers that manage IOMMU by themselves, like for example it is needed by the NVIDIA Tegra GPU driver. Signed-off-by: Dmitry Osipenko --- include/linux/device.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/device.h b/include/linux/device.h index ad43a97b50c8..f9e3c1d42abd 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -244,6 +244,7 @@ enum probe_type { * @bus: The bus which the device of this driver belongs to. * @owner: The module owner. * @mod_name: Used for built-in modules. + * @no_implicit_iommu: Disables backing DMA allocations with IOMMU mapping. * @suppress_bind_attrs: Disables bind/unbind via sysfs. * @probe_type: Type of the probe (synchronous or asynchronous) to use. * @of_match_table: The open firmware table. @@ -281,6 +282,7 @@ struct device_driver { struct module *owner; const char *mod_name; /* used for built-in modules */ + bool no_implicit_iommu; /* disables implicit IOMMU for DMA */ bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ enum probe_type probe_type; From patchwork Thu Jul 26 23:16:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 10546659 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 3E038174A for ; Fri, 27 Jul 2018 07:02:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F0932B4C9 for ; Fri, 27 Jul 2018 07:02:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20D9D2B4CC; Fri, 27 Jul 2018 07:02:00 +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, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DB42F2B4C9 for ; Fri, 27 Jul 2018 07:01:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F31A56E8F9; Fri, 27 Jul 2018 07:01:22 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by gabe.freedesktop.org (Postfix) with ESMTPS id BFB046E865; Thu, 26 Jul 2018 23:22:33 +0000 (UTC) Received: by mail-lf1-x144.google.com with SMTP id a134-v6so2326207lfe.6; Thu, 26 Jul 2018 16:22:33 -0700 (PDT) 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; bh=O+e/im9YZ70ju1A0neTQHuRteCq93hPLVv7chPKaQl4=; b=RHZUZoyIfW+6Qi9XkMY9tinRV5ZqnvU1lWcmfD46m2gaBudjClA+sQuOnoQT3uAkzZ CbPV6fKoNbvCDVUvcV8Q2WnVsQcobxEHVF8bOEIR7tzzzFpLxpqQaLbCVWV+ETjqzpBP CLURZylhJAox11G6mHVBPF9saQU6V76hnJFZSMXsTE7WLh8jBQoJ/FevqMVVgxtIpkA2 zIdjNzsNYpQL/heyoQAWWQpdrXZGTqtmSuVyNhDHtvTxUV3tyXgfivh93NojrAQDxUrL /orvKUHtKOcJDSj8ca7/9QX/IFZvEqBoUV0ZuRzfafF0niZMgvogy92pNFBQYIW/RFRE MfEA== X-Gm-Message-State: AOUpUlFtPQ2tXNu0FOafh18W1pwVZMYEmCB8rItBCTiwPFthNs+y0qN5 NyGgX6hUNlNzx04UnFDrdUFOl8XW X-Google-Smtp-Source: AAOMgpd7uptmuOgsvdEPcDNF4IVTY06fwQllp60hnf+Dybs7iMhg02K5qeaQ33WLchf2Rb1Tqsod+w== X-Received: by 2002:a19:4ecd:: with SMTP id u74-v6mr2410628lfk.57.1532647352254; Thu, 26 Jul 2018 16:22:32 -0700 (PDT) Received: from localhost.localdomain (109-252-90-13.nat.spd-mgts.ru. [109.252.90.13]) by smtp.gmail.com with ESMTPSA id q15-v6sm411541ljg.62.2018.07.26.16.22.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 16:22:31 -0700 (PDT) From: Dmitry Osipenko To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Thierry Reding , Jonathan Hunter , Mikko Perttunen , Rob Herring , Frank Rowand , Ben Skeggs , Russell King , Catalin Marinas , Will Deacon , Joerg Roedel , Nicolas Chauvet Subject: [RFC PATCH v1 2/6] of/device: Don't back devices DMA with IOMMU if that's undesired by driver Date: Fri, 27 Jul 2018 02:16:20 +0300 Message-Id: <20180726231624.21084-3-digetx@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180726231624.21084-1-digetx@gmail.com> References: <20180726231624.21084-1-digetx@gmail.com> X-Mailman-Approved-At: Fri, 27 Jul 2018 07:01:20 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linux-tegra@vger.kernel.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Respect device driver requirement for device DMA not to be implicitly backed with IOMMU by skipping the backing setup for drivers that do not want that. Signed-off-by: Dmitry Osipenko --- drivers/of/device.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/of/device.c b/drivers/of/device.c index 33d85511d790..e70b7a886875 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -163,6 +163,13 @@ int of_dma_configure(struct device *dev, struct device_node *np, bool force_dma) dev_dbg(dev, "device is%sbehind an iommu\n", iommu ? " " : " not "); + /* + * Respect device driver requirement for device DMA not to be + * implicitly backed with IOMMU. + */ + if (iommu && dev->driver->no_implicit_iommu) + iommu = NULL; + arch_setup_dma_ops(dev, dma_addr, size, iommu, coherent); return 0; From patchwork Thu Jul 26 23:16:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 10546661 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 EC3CF180E for ; Fri, 27 Jul 2018 07:02:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFE142B4C9 for ; Fri, 27 Jul 2018 07:02:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D374D2B4CC; Fri, 27 Jul 2018 07:02:08 +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, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D7C8B2B4C9 for ; Fri, 27 Jul 2018 07:02:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5036E6E906; Fri, 27 Jul 2018 07:01:24 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by gabe.freedesktop.org (Postfix) with ESMTPS id F08876E865; Thu, 26 Jul 2018 23:22:34 +0000 (UTC) Received: by mail-lf1-x141.google.com with SMTP id u14-v6so2324865lfu.0; Thu, 26 Jul 2018 16:22:34 -0700 (PDT) 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; bh=gWulCqaqXR15Jcn4BTz7nY1Dimo7wlyI3fOTGoNV13g=; b=csvB9KrtTgofTQaVM9Lv7zvvg78VTgiyX/1i1JmT2x73aXQpAJ6ZVqMnvt1Bncb/IU 0oTTFsgFxpsfUg5dqjw3yM6KNkyM8fwR20S4IUP1XRQTOv0nJfEOpywNvr0YqA2QebFe Tm2tGadtsJzbwIrRN2hFLKyBU40aKG0fkocWMidfbkyejxVM6lOkRusYN2Tbs9W9CfDa gtHb/sAu0B2ONSCgkQYiCoaBzcMUh159gUG0PzPEv3nDOr+GWhg1xA3nVlBODwcXhm8g QdbUCGsHNW6cGrY95fR+DHDapVoRYeeLnm1imz3N3wfpjIQ+6ri9JGTHFE/seV/Yv9qx LbQg== X-Gm-Message-State: AOUpUlFi5tJid5+XILvNBN07fC/bVp0G5NFMtANhocPEZoQnmqocBkrQ g9lDG18G6tZXhbWk28+BDaU= X-Google-Smtp-Source: AAOMgpdsARcWGyY3rphCjfZTnRFuC/De1O2rpsI6GtgezCrd4WZFT4r0IMyB5kZY06je67KyodA0Zw== X-Received: by 2002:a19:501e:: with SMTP id e30-v6mr2449667lfb.71.1532647353445; Thu, 26 Jul 2018 16:22:33 -0700 (PDT) Received: from localhost.localdomain (109-252-90-13.nat.spd-mgts.ru. [109.252.90.13]) by smtp.gmail.com with ESMTPSA id q15-v6sm411541ljg.62.2018.07.26.16.22.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 16:22:32 -0700 (PDT) From: Dmitry Osipenko To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Thierry Reding , Jonathan Hunter , Mikko Perttunen , Rob Herring , Frank Rowand , Ben Skeggs , Russell King , Catalin Marinas , Will Deacon , Joerg Roedel , Nicolas Chauvet Subject: [RFC PATCH v1 3/6] drm/tegra: Avoid implicit DMA backing with IOMMU Date: Fri, 27 Jul 2018 02:16:21 +0300 Message-Id: <20180726231624.21084-4-digetx@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180726231624.21084-1-digetx@gmail.com> References: <20180726231624.21084-1-digetx@gmail.com> X-Mailman-Approved-At: Fri, 27 Jul 2018 07:01:20 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linux-tegra@vger.kernel.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Tegra DRM manages IOMMU by itself, backing DMA with IOMMU by the drivers core breaks the Tegra driver. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/tegra/dc.c | 1 + drivers/gpu/drm/tegra/gr2d.c | 1 + drivers/gpu/drm/tegra/gr3d.c | 1 + drivers/gpu/drm/tegra/vic.c | 1 + 4 files changed, 4 insertions(+) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index eb9bb83f8f5d..4827770939e3 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -2675,6 +2675,7 @@ static const struct dev_pm_ops tegra_dc_pm_ops = { struct platform_driver tegra_dc_driver = { .driver = { .name = "tegra-dc", + .no_implicit_iommu = true, .of_match_table = tegra_dc_of_match, .pm = &tegra_dc_pm_ops, }, diff --git a/drivers/gpu/drm/tegra/gr2d.c b/drivers/gpu/drm/tegra/gr2d.c index 3c5503f1bf3d..e427585ef5cc 100644 --- a/drivers/gpu/drm/tegra/gr2d.c +++ b/drivers/gpu/drm/tegra/gr2d.c @@ -327,6 +327,7 @@ static int gr2d_remove(struct platform_device *pdev) struct platform_driver tegra_gr2d_driver = { .driver = { .name = "tegra-gr2d", + .no_implicit_iommu = true, .of_match_table = gr2d_match, }, .probe = gr2d_probe, diff --git a/drivers/gpu/drm/tegra/gr3d.c b/drivers/gpu/drm/tegra/gr3d.c index 651e697ccbba..f54710c36afb 100644 --- a/drivers/gpu/drm/tegra/gr3d.c +++ b/drivers/gpu/drm/tegra/gr3d.c @@ -481,6 +481,7 @@ static int gr3d_remove(struct platform_device *pdev) struct platform_driver tegra_gr3d_driver = { .driver = { .name = "tegra-gr3d", + .no_implicit_iommu = true, .of_match_table = tegra_gr3d_match, }, .probe = gr3d_probe, diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c index 0e6642bb8524..4ecc466ee490 100644 --- a/drivers/gpu/drm/tegra/vic.c +++ b/drivers/gpu/drm/tegra/vic.c @@ -402,6 +402,7 @@ static const struct dev_pm_ops vic_pm_ops = { struct platform_driver tegra_vic_driver = { .driver = { .name = "tegra-vic", + .no_implicit_iommu = true, .of_match_table = vic_match, .pm = &vic_pm_ops }, From patchwork Thu Jul 26 23:16:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 10546655 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 A453A180E for ; Fri, 27 Jul 2018 07:01:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 979B12B4C9 for ; Fri, 27 Jul 2018 07:01:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8BAA52B4CC; Fri, 27 Jul 2018 07:01:43 +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, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 74BE02B4C9 for ; Fri, 27 Jul 2018 07:01:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 682D66E8F1; Fri, 27 Jul 2018 07:01:22 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1C8776E872; Thu, 26 Jul 2018 23:22:36 +0000 (UTC) Received: by mail-lf1-x143.google.com with SMTP id b22-v6so2332822lfa.3; Thu, 26 Jul 2018 16:22:36 -0700 (PDT) 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; bh=jpJjsYXIvl23bc0ZxhI6uH2ME068VxWOkU6fnQDiSwM=; b=YCkUxQmmqYelutSSaVH0zUoKSidsyLjn9AmWm6/Wg+2bKeMFanMLvpfTJ/b5y5FI5Z Y+hf5+W8jOv2/n6wgoFWPHtVxNGHi339FDfGt7OzVZQvkUGJvkWFtBj1d9RQkdHLSfRw TYVWkmNSbGdhh2WoUW3Uce2RCco3+751Afl2MmVAQCjJRWIONjToaPSYqb2zmg5inVrZ 9NZRWpuO1igMVsVdz8h6LmdPv3wy7wsxLbHKgd34CYGjy8VeLRIGbCr6zhnzy2NULZ1X OCkibFxW50kY8zHK/QwDXQqhWTB8XAbQSIpgq5cusYo6nqyNLOqFiqQVi5k+J2OMY5g8 ByDg== X-Gm-Message-State: AOUpUlETOScZfWnyLnm7409DbbWO4YEHszaJR5YQNQZiLjeeoNCl91BA MUSExmM7+Nc6WkbEdK2tJGo= X-Google-Smtp-Source: AAOMgpcsBbd+MaQyBLzVEe83DBbkinhMexhJe9u+Bx9P7RrJyyzwBvqtqnGJ2nS4uArkAk5ITFdW+Q== X-Received: by 2002:a19:a5c5:: with SMTP id o188-v6mr2651924lfe.149.1532647354626; Thu, 26 Jul 2018 16:22:34 -0700 (PDT) Received: from localhost.localdomain (109-252-90-13.nat.spd-mgts.ru. [109.252.90.13]) by smtp.gmail.com with ESMTPSA id q15-v6sm411541ljg.62.2018.07.26.16.22.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 16:22:34 -0700 (PDT) From: Dmitry Osipenko To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Thierry Reding , Jonathan Hunter , Mikko Perttunen , Rob Herring , Frank Rowand , Ben Skeggs , Russell King , Catalin Marinas , Will Deacon , Joerg Roedel , Nicolas Chauvet Subject: [RFC PATCH v1 4/6] gpu: host1x: Avoid implicit DMA backing with IOMMU Date: Fri, 27 Jul 2018 02:16:22 +0300 Message-Id: <20180726231624.21084-5-digetx@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180726231624.21084-1-digetx@gmail.com> References: <20180726231624.21084-1-digetx@gmail.com> X-Mailman-Approved-At: Fri, 27 Jul 2018 07:01:20 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linux-tegra@vger.kernel.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Host1x driver manages IOMMU by itself, backing DMA with IOMMU by the drivers core breaks the Host1x driver. Signed-off-by: Dmitry Osipenko --- drivers/gpu/host1x/dev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c index afabd33a48d9..0966415d4ccd 100644 --- a/drivers/gpu/host1x/dev.c +++ b/drivers/gpu/host1x/dev.c @@ -361,6 +361,7 @@ static int host1x_remove(struct platform_device *pdev) static struct platform_driver tegra_host1x_driver = { .driver = { .name = "tegra-host1x", + .no_implicit_iommu = true, .of_match_table = host1x_of_match, }, .probe = host1x_probe, From patchwork Thu Jul 26 23:16:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 10546675 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 E274A174A for ; Fri, 27 Jul 2018 07:02:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4BA32B4FF for ; Fri, 27 Jul 2018 07:02:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C60B22B508; Fri, 27 Jul 2018 07:02:50 +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, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8C8112B4FF for ; Fri, 27 Jul 2018 07:02:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 350726E916; Fri, 27 Jul 2018 07:02:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by gabe.freedesktop.org (Postfix) with ESMTPS id 628CD6E87B; Thu, 26 Jul 2018 23:22:37 +0000 (UTC) Received: by mail-lf1-x143.google.com with SMTP id a4-v6so2323482lff.5; Thu, 26 Jul 2018 16:22:37 -0700 (PDT) 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; bh=o9Z7QKLTcb40+ogX2Dsf/MKtwd7NgHqBZYO0RNQo0gA=; b=DSP0CpsftwtOm5KofeflAsoGyMrKqWy5XmuOceZfM4hDhDXZoQBiZA1f84znXADAh6 X2fqYQKPuXXNjK2ohI2zeArgZ5Pkpo1SHqBw7J1izQRVAXFGKTvK+5YXShjgtto4xQ8r dKSidReYcvka2CRaV6taCtwPSCFv1b40dDppu8dDHC+X1b7lepMGBQzxl4Bvq6SO8v/D r+tUyvYXCMMdD7hlyc+422IxlJxEJY7Dky4ow8vJLUivcyaMuOmK2tnxwpfcmyKNrLaS vpU+FSc/cj03m8OwsQmxq43Dqx/dy+F5yjtYGL5mYUsEdtqZ0rAshBr83A6eIFgfITnz P3CQ== X-Gm-Message-State: AOUpUlFu1TkY3IyPrAPknbGmmmLWaeLkpYOy8MW43X5FN6M1P6yXyv+b bHuo+LoICfAJzYSWePj2vl4= X-Google-Smtp-Source: AAOMgpdu9glh1S2y4M2AZlthDNe+19L4fyzG3DPMmUo+QfPi4+hJ3wYbwCQ2EgKuE4tKOYoHFiN+6g== X-Received: by 2002:a19:9fc8:: with SMTP id i191-v6mr2411611lfe.79.1532647355840; Thu, 26 Jul 2018 16:22:35 -0700 (PDT) Received: from localhost.localdomain (109-252-90-13.nat.spd-mgts.ru. [109.252.90.13]) by smtp.gmail.com with ESMTPSA id q15-v6sm411541ljg.62.2018.07.26.16.22.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 16:22:35 -0700 (PDT) From: Dmitry Osipenko To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Thierry Reding , Jonathan Hunter , Mikko Perttunen , Rob Herring , Frank Rowand , Ben Skeggs , Russell King , Catalin Marinas , Will Deacon , Joerg Roedel , Nicolas Chauvet Subject: [RFC PATCH v1 5/6] drm/nouveau: tegra: Universally avoid implicit DMA backing with IOMMU Date: Fri, 27 Jul 2018 02:16:23 +0300 Message-Id: <20180726231624.21084-6-digetx@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180726231624.21084-1-digetx@gmail.com> References: <20180726231624.21084-1-digetx@gmail.com> X-Mailman-Approved-At: Fri, 27 Jul 2018 07:01:20 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linux-tegra@vger.kernel.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Implicit backing DMA with IOMMU breaks Nouveau on Tegra, the current approach with detaching device from IOMMU that was added in commit b59fb482b522 ("drm/nouveau: tegra: Detach from ARM DMA/IOMMU mapping") works only for arm32 which has the CONFIG_ARM_DMA_USE_IOMMU, but not for arm64 which doesn't have that config option. Drivers core now allows to avoid the implicit backing, that is a universal solution unlike the current variant with the detaching. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/nouveau/nouveau_platform.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_platform.c b/drivers/gpu/drm/nouveau/nouveau_platform.c index 039e23548e08..0b57f4f9b638 100644 --- a/drivers/gpu/drm/nouveau/nouveau_platform.c +++ b/drivers/gpu/drm/nouveau/nouveau_platform.c @@ -90,6 +90,7 @@ MODULE_DEVICE_TABLE(of, nouveau_platform_match); struct platform_driver nouveau_platform_driver = { .driver = { .name = "nouveau", + .no_implicit_iommu = true, .of_match_table = of_match_ptr(nouveau_platform_match), }, .probe = nouveau_platform_probe, From patchwork Thu Jul 26 23:16:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 10546691 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 CEBA5180E for ; Fri, 27 Jul 2018 07:03:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C2DCC2B4FF for ; Fri, 27 Jul 2018 07:03:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6D282B508; Fri, 27 Jul 2018 07:03: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, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 721992B4FF for ; Fri, 27 Jul 2018 07:03:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1F1E66E922; Fri, 27 Jul 2018 07:02:14 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7C4536E87F; Thu, 26 Jul 2018 23:22:38 +0000 (UTC) Received: by mail-lf1-x141.google.com with SMTP id j8-v6so2327297lfb.4; Thu, 26 Jul 2018 16:22:38 -0700 (PDT) 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; bh=YsF1u6cwuswajjItOnEio+bYuXWqZ7MdrcNXfIyrhOQ=; b=CCxJvtGBrS8jg506ZhzKcSNUOYHf5c1oGa219Yjz7WG61D0CVGrRLzfBqOx1e1jRCp drhongbepkWa08kBFefsJ0fVJbRW2Ta9IDfdUpVJds9M5zNcaLvV3LDjLPQ9G+gUTVS5 az+UzMJx55HvajF6ta7x4CgqdBYpB0cTe7teDPIwVXG8yreIoMDhZCg+LfxXnNUpVDBr XKW15JXXh0VwFlIzc52AMPKz7ORg1t/trL+9Wd4s6u9o7sg44++N9v+0Z6W7OkQfVb7d XhH7Kvmd0yHlVLLXKZX8cYFKDAUucbfYRmnpUASP+zE5NGpZPU77sj0xT9M52T+u4D6s DK6Q== X-Gm-Message-State: AOUpUlEwzEuLGIwetzA1ev3jgxoQ1IzXDD45Ptqfk+tgKAPwCPAYo2Em hYJtUSjr3WNUA1dFN/qAglc= X-Google-Smtp-Source: AAOMgpe/Gc024UMbZEYD3WzKRM4xr9za3LAVRiDjLr1q7WjgxjWy/in+ICNoR8al4smefmWWOCFSzA== X-Received: by 2002:a19:f70d:: with SMTP id z13-v6mr2490269lfe.33.1532647357016; Thu, 26 Jul 2018 16:22:37 -0700 (PDT) Received: from localhost.localdomain (109-252-90-13.nat.spd-mgts.ru. [109.252.90.13]) by smtp.gmail.com with ESMTPSA id q15-v6sm411541ljg.62.2018.07.26.16.22.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 16:22:36 -0700 (PDT) From: Dmitry Osipenko To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Thierry Reding , Jonathan Hunter , Mikko Perttunen , Rob Herring , Frank Rowand , Ben Skeggs , Russell King , Catalin Marinas , Will Deacon , Joerg Roedel , Nicolas Chauvet Subject: [RFC PATCH v1 6/6] Revert "drm/nouveau: tegra: Detach from ARM DMA/IOMMU mapping" Date: Fri, 27 Jul 2018 02:16:24 +0300 Message-Id: <20180726231624.21084-7-digetx@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180726231624.21084-1-digetx@gmail.com> References: <20180726231624.21084-1-digetx@gmail.com> X-Mailman-Approved-At: Fri, 27 Jul 2018 07:01:20 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linux-tegra@vger.kernel.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Improper DMA backing with IOMMU has been resolved now using the new drivers core option that allows to avoid the implicit backing, hence detaching isn't necessary anymore. This reverts commit b59fb482b52269977ee5de205308e5b236a03917. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c index 0e372a190d3f..78597da6313a 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c @@ -23,10 +23,6 @@ #ifdef CONFIG_NOUVEAU_PLATFORM_DRIVER #include "priv.h" -#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) -#include -#endif - static int nvkm_device_tegra_power_up(struct nvkm_device_tegra *tdev) { @@ -109,15 +105,6 @@ nvkm_device_tegra_probe_iommu(struct nvkm_device_tegra *tdev) unsigned long pgsize_bitmap; int ret; -#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) - if (dev->archdata.mapping) { - struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); - - arm_iommu_detach_device(dev); - arm_iommu_release_mapping(mapping); - } -#endif - if (!tdev->func->iommu_bit) return;