From patchwork Thu Jul 26 23:16:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 10546681 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 D5351180E for ; Fri, 27 Jul 2018 07:03:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C85DA2B4FF for ; Fri, 27 Jul 2018 07:03:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BCC202B508; Fri, 27 Jul 2018 07:03:01 +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 770CD2B4FF for ; Fri, 27 Jul 2018 07:03:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E4E4D6E91A; 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 6B9C66E34A; Thu, 26 Jul 2018 23:22:31 +0000 (UTC) Received: by mail-lf1-x143.google.com with SMTP id u14-v6so2324799lfu.0; Thu, 26 Jul 2018 16:22:31 -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; bh=ZdYIEyrIZl741x3N+P1wcgc/lwAS+OM52HOIIYQ4X64=; b=X7xWRdbkKJuqEd8YcA0m0m3Bd7cpSdTkguxfwa0aTGTDabSXy6KFaDPnjIIOZKWljH 783cs+YNwSbSNDoOH7RQZZ0J2yAWwFvqIvV7bJdsBgHC29bUdlzUT5T4FAzNTJDs3Mgy hRuB5siVc9KCvWjORyxP/X3DCqp53iFf3ZZcU4qAx7VOEb2BXgPCi1owPz/Zd4w3vVvb B2t/nentDSq6k37KQ7C/OngCtJ+fruCqhP8CtOdNYLpCB1Wr11hLrneN7RzXsDvPQDDY bTAI5uh6gLd+zEquusHHG9qdn5/yPkq49VVRMYsJRElYZcRUGXnR8mRtmEcc7/eWSG5e PNLA== X-Gm-Message-State: AOUpUlFt5/2ufE6qahz22bWh/Y1SQSGZNjuIzHc/OxVSdzaL4bylzj44 85hRUIknWDnuo9AWDJUamIY= X-Google-Smtp-Source: AAOMgpehgaYJ1xTq5qn0yQgJXn5QANyUJQ94R+Jt8JdowGIwBTLxttoSaZE6Dpg4EcWs6dlQ/4brlw== X-Received: by 2002:a19:1888:: with SMTP id 8-v6mr2399027lfy.121.1532647349859; Thu, 26 Jul 2018 16:22:29 -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.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 16:22:29 -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 0/6] Resolve unwanted DMA backing with IOMMU Date: Fri, 27 Jul 2018 02:16:18 +0300 Message-Id: <20180726231624.21084-1-digetx@gmail.com> X-Mailer: git-send-email 2.18.0 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 Hello, There is a trouble on ARM with DMA allocations made by device drivers, the trouble is that DMA allocations are getting implicitly backed with IOMMU mapping by the driver core if IOMMU presents in a system and IOMMU could handle device. This is an undesired behaviour for drivers that manage IOMMU by themselves, like NVIDIA Tegra GPU driver. On arm32 the implicit backing happens if CONFIG_ARM_DMA_USE_IOMMU=y (multiplatform kernel configuration), on arm64 it happens if IOMMU domain type for a device is equal to IOMMU_DOMAIN_DMA. The proposed solution adds a new option to the base device driver structure that allows device drivers to explicitly convey to the drivers core that the implicit IOMMU backing for devices must not happen. Dmitry Osipenko (6): driver core: Add option for disabling of backing devices DMA with IOMMU of/device: Don't back devices DMA with IOMMU if that's undesired by driver drm/tegra: Avoid implicit DMA backing with IOMMU gpu: host1x: Avoid implicit DMA backing with IOMMU drm/nouveau: tegra: Universally avoid implicit DMA backing with IOMMU Revert "drm/nouveau: tegra: Detach from ARM DMA/IOMMU mapping" drivers/gpu/drm/nouveau/nouveau_platform.c | 1 + drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c | 13 ------------- 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 + drivers/gpu/host1x/dev.c | 1 + drivers/of/device.c | 7 +++++++ include/linux/device.h | 2 ++ 9 files changed, 15 insertions(+), 13 deletions(-)