From patchwork Fri Feb 1 13:28:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 1034758 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="MRz/5cnL"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43rdGj4K8mz9sDX for ; Sat, 2 Feb 2019 00:28:45 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726639AbfBAN2o (ORCPT ); Fri, 1 Feb 2019 08:28:44 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:37854 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726486AbfBAN2o (ORCPT ); Fri, 1 Feb 2019 08:28:44 -0500 Received: by mail-wm1-f67.google.com with SMTP id g67so6207006wmd.2 for ; Fri, 01 Feb 2019 05:28:43 -0800 (PST) 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=wg0iGgLOgi0k9FT0008tiI43lGVn8Oxp/Ocf45x21Qo=; b=MRz/5cnL8oYbdtlUm3JDbmCALXwkQrLHDa05GSRNEz+mjIRADSspaydGU5qT5nRil4 Wdr9nITb5fHfuo7bdLd/bDxPwajYG9MIwqm084m5HkNTAirPt1YIbREUMU5feLqWEqyG +UMMt3o0/36JHvi1e9KJanl0kQoQnybu8iinrXvQ2ED8OOMEHkd5azKzg/Js6VlZv1bI G2A03VepH+/go7BSB7HRoQ4bUFYBznoxhOXfWSu/YWnQ/je93Nn4X21xylrIX4hngr79 UEjMpVMY2bWYkKRC4N95oc1OXHRUPKh4FdbiPMQORVXbtSuuSwgeNudMtoee/1Namn9E PCYw== 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=wg0iGgLOgi0k9FT0008tiI43lGVn8Oxp/Ocf45x21Qo=; b=o6fdiE0GQ8wOaXIKSxAT/ztIfLHDmP7hFqUo7LqbtHCvShaiaCQlrWrKxQzfh8nhI5 yBMUaK/Prb+JzcWrkoBgq9G0daG+2l2sPGzHH5nWng9nVRZRZIY5vBGC+kumFR//cMP0 ERFknBvsAn0W24/9KRqyQuYHICnbJCbwOxeyU641MsPdPGKQTaEgDtTGrgH2UZdgD4tB mkUY7NCQcO86XQpQVazn++42Fw8NHbUOdH2znIUE76lyAZACfSfdG2l5lWntiUCvbH6G P8DJHaOG58w0D4zw1bTKRluuSb72SJBcoAJ6U+sF3jl0NI3ndmr5aqRSW49HyTEgkxm2 /T1Q== X-Gm-Message-State: AHQUAuZkT+eR60RlzmznpUUe1YFOMFH64sCYx0fR2nPAUYLCISy6gZqs 225f1eejhEiHHkGI1j3qLdo= X-Google-Smtp-Source: AHgI3IZUHdPXfMRaVyXdUgmfOGt77mMo84q0IhBkw8WWczgm2twvLpyT9TEG5j/Diis8RtASXYbVWA== X-Received: by 2002:a1c:5dd1:: with SMTP id r200mr2542841wmb.93.1549027722627; Fri, 01 Feb 2019 05:28:42 -0800 (PST) Received: from localhost (pD9E51040.dip0.t-ipconnect.de. [217.229.16.64]) by smtp.gmail.com with ESMTPSA id p5sm1195324wmh.16.2019.02.01.05.28.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Feb 2019 05:28:42 -0800 (PST) From: Thierry Reding To: Thierry Reding Cc: Mikko Perttunen , Dmitry Osipenko , dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org Subject: [PATCH v3 02/16] gpu: host1x: Program the channel stream ID Date: Fri, 1 Feb 2019 14:28:23 +0100 Message-Id: <20190201132837.12327-3-thierry.reding@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190201132837.12327-1-thierry.reding@gmail.com> References: <20190201132837.12327-1-thierry.reding@gmail.com> MIME-Version: 1.0 Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org From: Thierry Reding When processing command streams, make sure the host1x's stream ID is programmed for the channel so that addresses are properly translated through the SMMU. Signed-off-by: Thierry Reding --- drivers/gpu/host1x/hw/channel_hw.c | 12 ++++++++++++ drivers/gpu/host1x/hw/host1x06_hardware.h | 1 + drivers/gpu/host1x/hw/host1x07_hardware.h | 1 + drivers/gpu/host1x/hw/hw_host1x06_channel.h | 11 +++++++++++ drivers/gpu/host1x/hw/hw_host1x07_channel.h | 11 +++++++++++ 5 files changed, 36 insertions(+) create mode 100644 drivers/gpu/host1x/hw/hw_host1x06_channel.h create mode 100644 drivers/gpu/host1x/hw/hw_host1x07_channel.h diff --git a/drivers/gpu/host1x/hw/channel_hw.c b/drivers/gpu/host1x/hw/channel_hw.c index 95ea81172a83..384f6ac91afa 100644 --- a/drivers/gpu/host1x/hw/channel_hw.c +++ b/drivers/gpu/host1x/hw/channel_hw.c @@ -89,6 +89,16 @@ static inline void synchronize_syncpt_base(struct host1x_job *job) HOST1X_UCLASS_LOAD_SYNCPT_BASE_VALUE_F(value)); } +static void host1x_channel_set_streamid(struct host1x_channel *channel) +{ +#if HOST1X_HW >= 6 + struct iommu_fwspec *spec = dev_iommu_fwspec_get(channel->dev->parent); + u32 sid = spec->ids[0] & 0xffff; + + host1x_ch_writel(channel, sid, HOST1X_CHANNEL_SMMU_STREAMID); +#endif +} + static int channel_submit(struct host1x_job *job) { struct host1x_channel *ch = job->channel; @@ -120,6 +130,8 @@ static int channel_submit(struct host1x_job *job) goto error; } + host1x_channel_set_streamid(ch); + /* begin a CDMA submit */ err = host1x_cdma_begin(&ch->cdma, job); if (err) { diff --git a/drivers/gpu/host1x/hw/host1x06_hardware.h b/drivers/gpu/host1x/hw/host1x06_hardware.h index 3039c92ea605..eab753b91f24 100644 --- a/drivers/gpu/host1x/hw/host1x06_hardware.h +++ b/drivers/gpu/host1x/hw/host1x06_hardware.h @@ -22,6 +22,7 @@ #include #include +#include "hw_host1x06_channel.h" #include "hw_host1x06_uclass.h" #include "hw_host1x06_vm.h" #include "hw_host1x06_hypervisor.h" diff --git a/drivers/gpu/host1x/hw/host1x07_hardware.h b/drivers/gpu/host1x/hw/host1x07_hardware.h index 1353e7ab71dd..a79f57dc87bb 100644 --- a/drivers/gpu/host1x/hw/host1x07_hardware.h +++ b/drivers/gpu/host1x/hw/host1x07_hardware.h @@ -22,6 +22,7 @@ #include #include +#include "hw_host1x07_channel.h" #include "hw_host1x07_uclass.h" #include "hw_host1x07_vm.h" #include "hw_host1x07_hypervisor.h" diff --git a/drivers/gpu/host1x/hw/hw_host1x06_channel.h b/drivers/gpu/host1x/hw/hw_host1x06_channel.h new file mode 100644 index 000000000000..18ae1c57bbea --- /dev/null +++ b/drivers/gpu/host1x/hw/hw_host1x06_channel.h @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2019 NVIDIA Corporation. + */ + +#ifndef HOST1X_HW_HOST1X06_CHANNEL_H +#define HOST1X_HW_HOST1X06_CHANNEL_H + +#define HOST1X_CHANNEL_SMMU_STREAMID 0x084 + +#endif diff --git a/drivers/gpu/host1x/hw/hw_host1x07_channel.h b/drivers/gpu/host1x/hw/hw_host1x07_channel.h new file mode 100644 index 000000000000..96fa72bbd7ab --- /dev/null +++ b/drivers/gpu/host1x/hw/hw_host1x07_channel.h @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2019 NVIDIA Corporation. + */ + +#ifndef HOST1X_HW_HOST1X07_CHANNEL_H +#define HOST1X_HW_HOST1X07_CHANNEL_H + +#define HOST1X_CHANNEL_SMMU_STREAMID 0x084 + +#endif