From patchwork Sun Jun 23 17:37:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11011903 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 B90F6112C for ; Sun, 23 Jun 2019 18:32:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABA5528A89 for ; Sun, 23 Jun 2019 18:32:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A046B28A91; Sun, 23 Jun 2019 18:32:28 +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 5A62328A89 for ; Sun, 23 Jun 2019 18:32:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DC62F89932; Sun, 23 Jun 2019 18:32:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt1-x843.google.com (mail-qt1-x843.google.com [IPv6:2607:f8b0:4864:20::843]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9687E89824 for ; Sun, 23 Jun 2019 17:38:01 +0000 (UTC) Received: by mail-qt1-x843.google.com with SMTP id s15so12120976qtk.9 for ; Sun, 23 Jun 2019 10:38:01 -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:mime-version :content-transfer-encoding; bh=AJTlfv60mIEZXwta292fwI2V+CViZ4EgWCofxKK0NGs=; b=EUw1hzzfX12J47byoBV3yznSq14sBRMJj9gXouRFf2FyU+uHRrgFMW1AMYwoegHQq7 h7QQ5Enae/Aj8GHThFNbpuyXLvDXOroBiPubRVwZRUHJyNL8KOni4s73w9nqNUkcb4Pz 09JOOMusTsUJZzmYyjcFCKyfp273DOox4z36LmEac83tE2t2NKt/6vs2RmPQeIaldsE+ kUq1XEeEzx299utr/4IG7rRHJAMtKGeadX7kF5izHPsGlEt6qtzxHsuYRSvuMA/O0nOr JZ47lhumBnP0ZAg/WDBTCcisxRYKdYoU0Zq1Bi7yycIy9VtfGnB7KEsFjlz4B7eoqo3s 0h1A== X-Gm-Message-State: APjAAAUn3ytnj7tgUI/WtzSJRg85HekaS3xypAlhqxisrlLmQseKVvJI smdEzf5eOUvNDdFpJhdtQbY= X-Google-Smtp-Source: APXvYqwH+yYOfjzCW3mL/GB1bTYbCEj4p34EhH/Z+ZuKtywHkF9tf6qNfNiRq4tv8gn+Hit+u1OaYg== X-Received: by 2002:a0c:8a26:: with SMTP id 35mr53756993qvt.158.1561311480668; Sun, 23 Jun 2019 10:38:00 -0700 (PDT) Received: from localhost.localdomain (ppp91-79-162-197.pppoe.mtu-net.ru. [91.79.162.197]) by smtp.gmail.com with ESMTPSA id c55sm5342498qtk.53.2019.06.23.10.37.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Jun 2019 10:38:00 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding Subject: [PATCH v1 1/3] gpu: host1x: Remove implicit IOMMU backing on client's registration Date: Sun, 23 Jun 2019 20:37:41 +0300 Message-Id: <20190623173743.24088-1-digetx@gmail.com> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 23 Jun 2019 18:32:00 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=AJTlfv60mIEZXwta292fwI2V+CViZ4EgWCofxKK0NGs=; b=iHScT30IUVlaqkLW9FzbhYmfsFdewA8sA9/jGO9fvv1CFkFaapyfjhYtPMDxpx7WzW peqA+Lbd+lGEDDlqc6bhpxo2vtxdqvAwXeMOqsDC2yrpiAkRZjv2rcfPUkk2fjeKgEty szZyXIM8vQcvDG6q7WfuEpa176sKGTPoGYenic5rMIk3Tgbw5tirSkXh0MgHcgK2gnfR yN6aB0oK2XUHb+7RdXbtjOaUTw1695sjBrVwyUu1wpwri23zr5KCh2FEwx+UmHNTrjxI u+lknBsrwiTYVIenkHVmcRK4yo1NQt5uk/PGhOZs00HokqYuB889l04tD33hRIM6SMh6 LuTA== 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: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP On ARM32 we don't want any of the clients device to be backed by the implicit domain, simply because we can't afford such a waste on older Tegra SoCs that have very few domains available in total. The recent IOMMU support addition for the Video Decoder hardware uncovered the problem that an unfortunate drivers probe order results in the DRM driver probe failure if CONFIG_ARM_DMA_USE_IOMMU=y due to a shortage of IOMMU domains caused by the implicit backing. The host1x_client_register() is a common function that is invoked by all of the relevant DRM drivers during theirs probe and hence it is convenient to remove the implicit backing there, resolving the problem. Signed-off-by: Dmitry Osipenko --- drivers/gpu/host1x/bus.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c index 742aa9ff21b8..559df3974afb 100644 --- a/drivers/gpu/host1x/bus.c +++ b/drivers/gpu/host1x/bus.c @@ -14,6 +14,10 @@ #include "bus.h" #include "dev.h" +#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) +#include +#endif + static DEFINE_MUTEX(clients_lock); static LIST_HEAD(clients); @@ -710,6 +714,21 @@ int host1x_client_register(struct host1x_client *client) struct host1x *host1x; int err; +#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) + /* + * The client's driver could be backed by implicit IOMMU mapping + * and we don't want to have that because all of current Tegra + * drivers are managing IOMMU by themselves. This is a convenient + * place for unmapping of the implicit mapping because this function + * is called by all host1x drivers during theirs probe. + */ + if (client->dev->archdata.mapping) { + struct dma_iommu_mapping *mapping = + to_dma_iommu_mapping(client->dev); + arm_iommu_detach_device(client->dev); + arm_iommu_release_mapping(mapping); + } +#endif mutex_lock(&devices_lock); list_for_each_entry(host1x, &devices, list) {