From patchwork Wed Mar 6 13:57:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10841151 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 A18CA14DE for ; Wed, 6 Mar 2019 13:58:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 816512DB7C for ; Wed, 6 Mar 2019 13:58:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 757602DB85; Wed, 6 Mar 2019 13:58:16 +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,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 1AF802DB7C for ; Wed, 6 Mar 2019 13:58:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 14059892C0; Wed, 6 Mar 2019 13:58:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.133]) by gabe.freedesktop.org (Postfix) with ESMTPS id 034FE892C0 for ; Wed, 6 Mar 2019 13:58:10 +0000 (UTC) Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1Mvbr4-1hHHSR1m8U-00sduC; Wed, 06 Mar 2019 14:58:01 +0100 From: Arnd Bergmann To: Thierry Reding , Mikko Perttunen Subject: [PATCH] [v2] gpu: host1x: avoid IOMMU_API build error Date: Wed, 6 Mar 2019 14:57:43 +0100 Message-Id: <20190306135800.3982681-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:xvKcHd6PvYh7acwo26CW8xOVhQciHOtPMkcgEiMsl2IH70PTok9 zok150Tb1Ztpp+YZF40KXv+SqMit6hh/mQ9/V8X2Pu7tkaxk8my2ejc5m1aDXulh1/xYNDb h4nzt9AXHKXxQv/YIDF7QbEiOWa8EKHtxwwCJSWttvTvNpUYogIOPtR1ko54QuxnS/Ch7QO MxfSIasYZvK1C9vO5zw3Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:zLwu35DqAgc=:m2Y5Jq0qxPPYcjka5jTums poo7bvG+WN8c3vENfefE6la4Ccm0+GLpZ9Flx4T3zd7TVAJkj7MaNUi9MjI8uIHfEdB4XPhss zCoX7C96trMQlVWAj1xTAbHLd1jeuPGreb6Lizl4tD3oWPjJQJWmZwJOuclt2JPFgYzNWcBZR 0PzE6fFtF7eTeqGyxX7vfGKtdC5HvA7EoLprHck/4N1Ui8m4aDgteKnTotgQ1ug7GMMKl8BUy Kcne9l/Anbuz4gGsyJoTc4ZkOvHGqXQITilybEYVZOJrWHpcbRw+iabRI7TE3zVGCydc7p9e8 lYR87TFc/DqPoF+HJtymPuZKqPsTIpINKdY1XsuIKiqcomSEtsg7nA9IEHlwgfNHk2OI0YxDM pX3gi896G7xNrX4Uvd4GmocI6M6+kFTGuy4fmZqwMobWSulG0OuF816b4hZbrBMAJz8LSbqpU LJNNnzFFW8cxKdQOnSKlGWMuQS9RNPcqxnIbjb+VS1QwnrGYj6YSsR0eZMyCTiQezyBGloszh CnHOFh2w2iddmV55g9MxlisUoHa55svJSJL17QL6GR4QxTVt8FpaRYes1jujVZ8iGu9CrBWIa HMqiU17fr3M/0FOxPLbZqA/DMSf/Ae7bfQ4/w0TNrd/nSS86bPrPDuQX5JyZ7+YklDpexomPM TxFBjcV1AQP9KusQYU0oUNc8ncQspNmputpHVzQKPXVdf1yoTgCEad58bIT8g/okZsy105jC5 eCQc47Lnex9XQXeTmwf5NEwte+KYSDEGuv6Olg== 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, Dmitry Osipenko , dri-devel@lists.freedesktop.org, Arnd Bergmann , linux-kernel@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP When the iommu API is disabled, the host1x driver fails to build: drivers/gpu/host1x/hw/channel_hw.c: In function 'host1x_channel_set_streamid': drivers/gpu/host1x/hw/channel_hw.c:118:30: error: implicit declaration of function 'dev_iommu_fwspec_get'; did you mean 'iommu_fwspec_free'? [-Werror=implicit-function-declaration] struct iommu_fwspec *spec = dev_iommu_fwspec_get(channel->dev->parent); ^~~~~~~~~~~~~~~~~~~~ iommu_fwspec_free drivers/gpu/host1x/hw/channel_hw.c:118:30: error: initialization of 'struct iommu_fwspec *' from 'int' makes pointer from integer without a cast [-Werror=int-conversion] drivers/gpu/host1x/hw/channel_hw.c:119:23: error: 'struct iommu_fwspec' has no member named 'ids' u32 sid = spec ? spec->ids[0] & 0xffff : 0x7f; ^~ cc1: all warnings being treated as errors As Mikko explains, we should program SMMU bypass (0x7f) if that happens. Fixes: de5469c21ff9 ("gpu: host1x: Program the channel stream ID") Suggested-by: Mikko Perttunen Signed-off-by: Arnd Bergmann ---- v2: fall back to 0x7f sid Reviewed-by: Mikko Perttunen --- drivers/gpu/host1x/hw/channel_hw.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/host1x/hw/channel_hw.c b/drivers/gpu/host1x/hw/channel_hw.c index 27101c04a827..0c0eb43abf65 100644 --- a/drivers/gpu/host1x/hw/channel_hw.c +++ b/drivers/gpu/host1x/hw/channel_hw.c @@ -115,8 +115,12 @@ static inline void synchronize_syncpt_base(struct host1x_job *job) static void host1x_channel_set_streamid(struct host1x_channel *channel) { #if HOST1X_HW >= 6 + u32 sid = 0x7f; +#ifdef CONFIG_IOMMU_API struct iommu_fwspec *spec = dev_iommu_fwspec_get(channel->dev->parent); - u32 sid = spec ? spec->ids[0] & 0xffff : 0x7f; + if (spec) + sid = spec->ids[0] & 0xffff; +#endif host1x_ch_writel(channel, sid, HOST1X_CHANNEL_SMMU_STREAMID); #endif