From patchwork Mon Oct 14 12:50:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11188685 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 330B8912 for ; Mon, 14 Oct 2019 12:50:59 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1A45C20673 for ; Mon, 14 Oct 2019 12:50:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1A45C20673 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 533CF6E2A9; Mon, 14 Oct 2019 12:50:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 02E5489BD5 for ; Mon, 14 Oct 2019 12:50:54 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id o18so19545732wrv.13 for ; Mon, 14 Oct 2019 05:50:54 -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:mime-version:content-transfer-encoding; bh=U877RE9c/tuFkeDa8v12pt9kVRahnNgSg6kH2NT2zSs=; b=uc3fnZ6HfRoDrfX9AwuY67wq+2wEeYLHJP2fQzO1qYZS+kTGljlkxR1exYrtDfUGZo v/Xy52S2VhTVc6oiD/UMr//1lD554T0zSfW/i8IvJWHwCZ63iuRLe7QS9s6dSD4XEjGu D5tXOQelm/VthsW66oWAt+OUArZ3pvBX+hV8rG0CtK8z3t3zCk0vifPHE3OML1cersVQ tMT7KS4XJ21p8YhrUm3fQcblOn020QFMkJ6BaieJyoSE5hMFkWCe8xb3fo1CTp3kKyei CaaQGdidFjj60tHBN7FRHwoJOhAfid04YoJka+0xwj019n7AYzUfsyly6FaFXJpyz8Q+ Y5bw== X-Gm-Message-State: APjAAAVw+5Bmrkr/d+6U7BPlyxsueE9RWGbay/PWsHYlKsXllKnXicLu ELjy16MPqBN+x7ZAB0uMymIFrWYS X-Google-Smtp-Source: APXvYqwfjKsVR1no+BarpMeGzjtK/HnAt0suBKZXNFZWdLRdCg0+nhRxmDXpRahIEnbM95s89flPsQ== X-Received: by 2002:a5d:4ed2:: with SMTP id s18mr24739914wrv.52.1571057453478; Mon, 14 Oct 2019 05:50:53 -0700 (PDT) Received: from localhost (p2E5BE2CE.dip0.t-ipconnect.de. [46.91.226.206]) by smtp.gmail.com with ESMTPSA id f9sm21850054wre.74.2019.10.14.05.50.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 05:50:52 -0700 (PDT) From: Thierry Reding To: Thierry Reding Subject: [PATCH 01/14] gpu: host1x: Do not limit DMA segment size Date: Mon, 14 Oct 2019 14:50:36 +0200 Message-Id: <20191014125049.425101-2-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191014125049.425101-1-thierry.reding@gmail.com> References: <20191014125049.425101-1-thierry.reding@gmail.com> MIME-Version: 1.0 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:in-reply-to:references :mime-version:content-transfer-encoding; bh=U877RE9c/tuFkeDa8v12pt9kVRahnNgSg6kH2NT2zSs=; b=K97DT+yhhip/zZqEwHem79zj/NHw61NIZ+WziLtr+XxhQm1OkuQ8Ibea0bKc9JWxKI tq/Buap1GcrVaM/kLNKwmAJY45Bp9flBI7Ydq5cYH+ai6FkYDCK9/MoEIPGNly5eOlZ4 wOMuYsyAjDh4uIJXfkYISBt/0yo09cxQNs2lYrLq9g2CJEjnT6wGNFoBe2ZUygzbylmP xfCwk6jALMbNAtlDwwWLQIQIfbtRQ1jm+0cja+O7RX+jZFkly2F1A2Ju1kh0HZ4s/t5i rZBImKJLH919yYKcMHxRQpWm8dby0J509aWZLuk47zwZcFVfxwgHZ3BTfB3Zdgtc29sa mrFg== 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, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding None of the host1x clients have any limitations on the DMA segment size, so don't pretend that they do. Signed-off-by: Thierry Reding --- drivers/gpu/host1x/bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c index 742aa9ff21b8..2c8559ff3481 100644 --- a/drivers/gpu/host1x/bus.c +++ b/drivers/gpu/host1x/bus.c @@ -445,7 +445,7 @@ static int host1x_device_add(struct host1x *host1x, of_dma_configure(&device->dev, host1x->dev->of_node, true); device->dev.dma_parms = &device->dma_parms; - dma_set_max_seg_size(&device->dev, SZ_4M); + dma_set_max_seg_size(&device->dev, UINT_MAX); err = host1x_device_parse_dt(device, driver); if (err < 0) { From patchwork Mon Oct 14 12:50:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11188687 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9344C1575 for ; Mon, 14 Oct 2019 12:51:01 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7B46520673 for ; Mon, 14 Oct 2019 12:51:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7B46520673 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 68E4C89BD5; Mon, 14 Oct 2019 12:51:00 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3C84E89BD5 for ; Mon, 14 Oct 2019 12:50:57 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id j18so19578754wrq.10 for ; Mon, 14 Oct 2019 05:50:57 -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:mime-version:content-transfer-encoding; bh=yr6ddMFHeDLCntvNYa+hL2al/dJdqvTJul7jaQ0EH5g=; b=ouhD4s7ryig+p+HTnoGendKBWn6bDlkpJbjQv9I7/F8AFzp70NYvchWdb//miWeL5q Oupw+TJA/LAOldxST4193zkZF7a1X8KNG1S8l+44n32qrooWSSaqj3jw6dUS+RMvAXci 7WyIKJFIFckFPrm0zTbcRnjqR5ksIS7mNF7MhNcH2MyHr4dwQy80/YyXccYd9dggPO+A pkpDjKvG6v4yfaAYFCFDBQkmjrUavxCRSc2euteXPM+qms3P0gd/MCs1WYPhaqysWodx 8NoWDGBm09jD0SK/WEN2hiQDpdxN/ReGjkeCzTNbC6HyTvKdrwqUwth6fvIJnBRa3Pcc MS6g== X-Gm-Message-State: APjAAAVp6Wwue+SN0/AB+0Mo6NiKpnsuuIgC678R+KJh5xSKzbwoR9Dd /ixy2Rfx0DnyzVVDxRuUbIw= X-Google-Smtp-Source: APXvYqyBSiiaVUDINZz+bSWf6iQAgcfMBJ6K0a+ZRqvzYxwc7kK/NvnWt5L+YEufAc/q3Wmf5asHnA== X-Received: by 2002:a5d:4dd2:: with SMTP id f18mr6981953wru.4.1571057455717; Mon, 14 Oct 2019 05:50:55 -0700 (PDT) Received: from localhost (p2E5BE2CE.dip0.t-ipconnect.de. [46.91.226.206]) by smtp.gmail.com with ESMTPSA id c9sm17126565wrt.7.2019.10.14.05.50.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 05:50:54 -0700 (PDT) From: Thierry Reding To: Thierry Reding Subject: [PATCH 02/14] gpu: host1x: Remove gratuitous blank line Date: Mon, 14 Oct 2019 14:50:37 +0200 Message-Id: <20191014125049.425101-3-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191014125049.425101-1-thierry.reding@gmail.com> References: <20191014125049.425101-1-thierry.reding@gmail.com> MIME-Version: 1.0 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:in-reply-to:references :mime-version:content-transfer-encoding; bh=yr6ddMFHeDLCntvNYa+hL2al/dJdqvTJul7jaQ0EH5g=; b=U9lvx1cbTYbWS657zE2Tc9rYiIa1XQ1MvK29kpBkr6JoqEsLqBqomo1yYxydjNwu7o 6ZFzChng8BZsMFQZlg0FYo2GZMKXp/45qGER/86iJjzyeao7kxsVVIyRuH9CUQJRRWi8 7H/VSXdvlfmp+uVSLHPEiA2qdufh04/Bri8Fuit1+Goi+qmOpRk+Hm1vsv/tKTV01bPl Un91kXK9s5IN0rodlhj3N/01UIh/yKqCX2pMoIT43SOxPB2N8YZRlrwoJO0kn2bXAwBD gsCV4id8CQlLe6Iw095eUS+JNpglhZvEPaXyR+M7t9xgmTsE4RaYH5muI31iES5Y/K/j fi6Q== 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, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Signed-off-by: Thierry Reding --- drivers/gpu/host1x/intr.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/host1x/intr.c b/drivers/gpu/host1x/intr.c index 26f3c741d085..9245add23b5d 100644 --- a/drivers/gpu/host1x/intr.c +++ b/drivers/gpu/host1x/intr.c @@ -105,7 +105,6 @@ static void action_submit_complete(struct host1x_waitlist *waiter) /* Add nr_completed to trace */ trace_host1x_channel_submit_complete(dev_name(channel->dev), waiter->count, waiter->thresh); - } static void action_wakeup(struct host1x_waitlist *waiter) From patchwork Mon Oct 14 12:50:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11188689 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CEED81575 for ; Mon, 14 Oct 2019 12:51:03 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B755021744 for ; Mon, 14 Oct 2019 12:51:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B755021744 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3AAD86E2B6; Mon, 14 Oct 2019 12:51:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id 432C389BD5 for ; Mon, 14 Oct 2019 12:50:59 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id b9so19627698wrs.0 for ; Mon, 14 Oct 2019 05:50:59 -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:mime-version:content-transfer-encoding; bh=rq1ZF1nsTPYlmvvsNxuE1omhCQpXv2Uc5EavmJCLVho=; b=SoFPQcqZSZWKYO9GMuFLc+D1jEP5cg8lbz/eW1zrWt3gp+Q/OpNjDtDauH0KBXdKxF 3gv//Qb/nsVMLyzj1BaINijZdnlKpJBhvQ3evzFPM2o7A65/Vr5pSztCWk5csmv3VzjB dXtPVaAIljDEP5zuCwcq65tegHUIdmyLg5x9RGmtKXsw8ZGdiONQPJ6SKtUT8/Uz3BSl wjCgQZI+msW+zo0nkm9ruFOXgX1a33IbDkJjwlDVxli4srZkXfnkKHkOD9QIoeTa2zZI P2UVDw4vagl76ZcpMItd2/MgendpEr1gRnUdfES7UgxCJDanbNaEhmS7QwmPRbdjG+qO Ngpg== X-Gm-Message-State: APjAAAXiTPz3I58zpma6A+iG5VdQ+gtPA0+yR348RDPR6w24zi0JVQev PveFN3Vz9N+CJfIY/kVCrFA= X-Google-Smtp-Source: APXvYqyu8+tLAbFH3kbSjwHQedeUmmjLCm8Od7hF49MjagwlGdOGH44d2h92tCDjtljnP8K7vWmZDA== X-Received: by 2002:adf:8296:: with SMTP id 22mr24599649wrc.255.1571057457725; Mon, 14 Oct 2019 05:50:57 -0700 (PDT) Received: from localhost (p2E5BE2CE.dip0.t-ipconnect.de. [46.91.226.206]) by smtp.gmail.com with ESMTPSA id y19sm16741436wmi.13.2019.10.14.05.50.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 05:50:56 -0700 (PDT) From: Thierry Reding To: Thierry Reding Subject: [PATCH 03/14] gpu: host1x: Explicitly initialize host1x_info structures Date: Mon, 14 Oct 2019 14:50:38 +0200 Message-Id: <20191014125049.425101-4-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191014125049.425101-1-thierry.reding@gmail.com> References: <20191014125049.425101-1-thierry.reding@gmail.com> MIME-Version: 1.0 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:in-reply-to:references :mime-version:content-transfer-encoding; bh=rq1ZF1nsTPYlmvvsNxuE1omhCQpXv2Uc5EavmJCLVho=; b=roXeX3ZabUr/G5JLWSmiWtysvCekVmBgZnQSLwfNQbFZqAEaNWu58tWzTqYhBbXEpT xRsReujN/yxxI+N0AeMSh8rZ6OuN4RnNjyQgiWFP7ngOh8o1XJUH2Ma70CqFtA39oYyw bxrzDuSvZUdHCUbV/WBzyaaQck4UNiOCs5qqVPPJlptHX1DQCDbXrbgSqPrdw56vMh6B KvPOfm4c4RUk5FT7RL45hRBsUEoAnnKachEDbkk7HN+9pdiYg5Pk/8VcpevlSKfJNy1o acyPEUAAY6nGWoZwoQdq9GExxQC9XfYd6rqTY/WtOs9EsAJBrkZmiMMIucCx0BPR2vgJ VHcA== 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, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding It's technically not required to explicitly initialize the fields that will be zero by default, but it's easier to read these structures if they are all initialized uniformly. Signed-off-by: Thierry Reding --- drivers/gpu/host1x/dev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c index 5a3f797240d4..e8ab4d0c5091 100644 --- a/drivers/gpu/host1x/dev.c +++ b/drivers/gpu/host1x/dev.c @@ -77,6 +77,9 @@ static const struct host1x_info host1x01_info = { .init = host1x01_init, .sync_offset = 0x3000, .dma_mask = DMA_BIT_MASK(32), + .has_hypervisor = false, + .num_sid_entries = 0, + .sid_table = NULL, }; static const struct host1x_info host1x02_info = { @@ -87,6 +90,9 @@ static const struct host1x_info host1x02_info = { .init = host1x02_init, .sync_offset = 0x3000, .dma_mask = DMA_BIT_MASK(32), + .has_hypervisor = false, + .num_sid_entries = 0, + .sid_table = NULL, }; static const struct host1x_info host1x04_info = { @@ -97,6 +103,9 @@ static const struct host1x_info host1x04_info = { .init = host1x04_init, .sync_offset = 0x2100, .dma_mask = DMA_BIT_MASK(34), + .has_hypervisor = false, + .num_sid_entries = 0, + .sid_table = NULL, }; static const struct host1x_info host1x05_info = { @@ -107,6 +116,9 @@ static const struct host1x_info host1x05_info = { .init = host1x05_init, .sync_offset = 0x2100, .dma_mask = DMA_BIT_MASK(34), + .has_hypervisor = false, + .num_sid_entries = 0, + .sid_table = NULL, }; static const struct host1x_sid_entry tegra186_sid_table[] = { From patchwork Mon Oct 14 12:50:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11188691 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D97E6912 for ; Mon, 14 Oct 2019 12:51:05 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C1F0720673 for ; Mon, 14 Oct 2019 12:51:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C1F0720673 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D6D816E2B8; Mon, 14 Oct 2019 12:51:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id 172896E2B2 for ; Mon, 14 Oct 2019 12:51:02 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id v17so16626384wml.4 for ; Mon, 14 Oct 2019 05:51: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:in-reply-to :references:mime-version:content-transfer-encoding; bh=xXohOh2PNnJ9mf9YhRZwip9mBy/jBn3bFjciUpmeUw4=; b=cYq86FuQU8eyxds/0Bw9s7VTfVcCgpkgSDo0eG+8EVuCTUhjfGhigDNOKzuQ0ZODs3 FVdl3bbY/Qi77XVH3nqaxKi5sNhRhCLyRujkOzm3DtPpSlDHjmdYkmy1pmxIg2Soeeuq 8HtaV1lUgrtlg0wKivK4fkVhvxMPyR0ZV6vBH9NSvG173L2Fh1dWksJ5PdPKKguMpNT+ 641LNnJ/wrhrEbKzsyI/UG2Qb9MaklaZ5GMf0kmwI9/O4CeyaXVhTnnLBDzkXypJUCEF Jdj03orAeySBPGGoF7j/bPnPVmf+lLz0Ye53Veje6prA0js2/R54Fr06DPn7xv4/m2ko FqMw== X-Gm-Message-State: APjAAAW+d71Ecw7Q7Pwi2ycoDItBj/3O+Qj4SSSZcUgyZ2SU+8y/hgac w/vgWLm4UUu6x1+Yg3x2bYg= X-Google-Smtp-Source: APXvYqzTwE5O9n8rJ9WGhkeHV5xRAZeMlsQ8CheFaxYiNfkPbL/58F5cNEHWnAoT0s/oSzkIM0NdxQ== X-Received: by 2002:a1c:444:: with SMTP id 65mr15464247wme.84.1571057460214; Mon, 14 Oct 2019 05:51:00 -0700 (PDT) Received: from localhost (p2E5BE2CE.dip0.t-ipconnect.de. [46.91.226.206]) by smtp.gmail.com with ESMTPSA id z142sm28384710wmc.24.2019.10.14.05.50.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 05:50:59 -0700 (PDT) From: Thierry Reding To: Thierry Reding Subject: [PATCH 04/14] gpu: host1x: Request channels for clients, not devices Date: Mon, 14 Oct 2019 14:50:39 +0200 Message-Id: <20191014125049.425101-5-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191014125049.425101-1-thierry.reding@gmail.com> References: <20191014125049.425101-1-thierry.reding@gmail.com> MIME-Version: 1.0 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:in-reply-to:references :mime-version:content-transfer-encoding; bh=xXohOh2PNnJ9mf9YhRZwip9mBy/jBn3bFjciUpmeUw4=; b=KPpOwIQJCJ/ifOquBzI/rkkIhBfyPSn3Xrf5co8hRO4y6AhugJc5FSEci2erN/IVsX YmtK/lOh1oJdzNY4r8SJyTs+Z68b/uXeX6RA3958EWxYqb8jr0d6a/a6wUsgfTJWxb+H nCjvRoQxT2YzHt195lsXp+/sI+LQySt1kBX420UXTGz8fowz7BX3++U4GnhJl/lJjCj7 TpPrsWMR349iXic1FEwtrTK1h7w0opSi1PVdFoZtRR2bqbb2WY33xk9mGK7cYP3Jvt1s CtKLE1rhPzv+PbGqVbENyqhz4AXLP5bl3jYF9+6X0qQVkAUcnVbKLpTspwG/zetvCs6L WzwA== 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, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding A struct device doesn't carry much information that a channel might be interested in, but the client very much does. Request channels for the clients rather than their parent devices and store a pointer to them in order to have that information available when needed. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/gr2d.c | 2 +- drivers/gpu/drm/tegra/gr3d.c | 2 +- drivers/gpu/drm/tegra/vic.c | 2 +- drivers/gpu/host1x/channel.c | 13 +++++++------ drivers/gpu/host1x/channel.h | 1 + include/linux/host1x.h | 2 +- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/tegra/gr2d.c b/drivers/gpu/drm/tegra/gr2d.c index 641299cc85b8..3cbb4a029c41 100644 --- a/drivers/gpu/drm/tegra/gr2d.c +++ b/drivers/gpu/drm/tegra/gr2d.c @@ -40,7 +40,7 @@ static int gr2d_init(struct host1x_client *client) struct gr2d *gr2d = to_gr2d(drm); int err; - gr2d->channel = host1x_channel_request(client->dev); + gr2d->channel = host1x_channel_request(client); if (!gr2d->channel) return -ENOMEM; diff --git a/drivers/gpu/drm/tegra/gr3d.c b/drivers/gpu/drm/tegra/gr3d.c index 8b9a35b1cbb3..87a386134cc4 100644 --- a/drivers/gpu/drm/tegra/gr3d.c +++ b/drivers/gpu/drm/tegra/gr3d.c @@ -49,7 +49,7 @@ static int gr3d_init(struct host1x_client *client) struct gr3d *gr3d = to_gr3d(drm); int err; - gr3d->channel = host1x_channel_request(client->dev); + gr3d->channel = host1x_channel_request(client); if (!gr3d->channel) return -ENOMEM; diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c index cd0399fd8c63..c97a61c877af 100644 --- a/drivers/gpu/drm/tegra/vic.c +++ b/drivers/gpu/drm/tegra/vic.c @@ -198,7 +198,7 @@ static int vic_init(struct host1x_client *client) vic->domain = tegra->domain; } - vic->channel = host1x_channel_request(client->dev); + vic->channel = host1x_channel_request(client); if (!vic->channel) { err = -ENOMEM; goto detach; diff --git a/drivers/gpu/host1x/channel.c b/drivers/gpu/host1x/channel.c index 1436295aa450..4cd212bb570d 100644 --- a/drivers/gpu/host1x/channel.c +++ b/drivers/gpu/host1x/channel.c @@ -115,14 +115,14 @@ static struct host1x_channel *acquire_unused_channel(struct host1x *host) /** * host1x_channel_request() - Allocate a channel - * @device: Host1x unit this channel will be used to send commands to + * @client: Host1x client this channel will be used to send commands to * - * Allocates a new host1x channel for @device. May return NULL if CDMA + * Allocates a new host1x channel for @client. May return NULL if CDMA * initialization fails. */ -struct host1x_channel *host1x_channel_request(struct device *dev) +struct host1x_channel *host1x_channel_request(struct host1x_client *client) { - struct host1x *host = dev_get_drvdata(dev->parent); + struct host1x *host = dev_get_drvdata(client->dev->parent); struct host1x_channel_list *chlist = &host->channel_list; struct host1x_channel *channel; int err; @@ -133,7 +133,8 @@ struct host1x_channel *host1x_channel_request(struct device *dev) kref_init(&channel->refcount); mutex_init(&channel->submitlock); - channel->dev = dev; + channel->client = client; + channel->dev = client->dev; err = host1x_hw_channel_init(host, channel, channel->id); if (err < 0) @@ -148,7 +149,7 @@ struct host1x_channel *host1x_channel_request(struct device *dev) fail: clear_bit(channel->id, chlist->allocated_channels); - dev_err(dev, "failed to initialize channel\n"); + dev_err(client->dev, "failed to initialize channel\n"); return NULL; } diff --git a/drivers/gpu/host1x/channel.h b/drivers/gpu/host1x/channel.h index 4fd694834f74..39044ff6c3aa 100644 --- a/drivers/gpu/host1x/channel.h +++ b/drivers/gpu/host1x/channel.h @@ -26,6 +26,7 @@ struct host1x_channel { unsigned int id; struct mutex submitlock; void __iomem *regs; + struct host1x_client *client; struct device *dev; struct host1x_cdma cdma; }; diff --git a/include/linux/host1x.h b/include/linux/host1x.h index e6eea45e1154..4396cd566a33 100644 --- a/include/linux/host1x.h +++ b/include/linux/host1x.h @@ -158,7 +158,7 @@ u32 host1x_syncpt_base_id(struct host1x_syncpt_base *base); struct host1x_channel; struct host1x_job; -struct host1x_channel *host1x_channel_request(struct device *dev); +struct host1x_channel *host1x_channel_request(struct host1x_client *client); struct host1x_channel *host1x_channel_get(struct host1x_channel *channel); void host1x_channel_put(struct host1x_channel *channel); int host1x_job_submit(struct host1x_job *job); From patchwork Mon Oct 14 12:50:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11188693 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8A6A5912 for ; Mon, 14 Oct 2019 12:51:08 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 724A720673 for ; Mon, 14 Oct 2019 12:51:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 724A720673 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 65DCF6E2BC; Mon, 14 Oct 2019 12:51:07 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id BC0196E2B2 for ; Mon, 14 Oct 2019 12:51:03 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id 7so17171898wme.1 for ; Mon, 14 Oct 2019 05:51:03 -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:mime-version:content-transfer-encoding; bh=G8Ip/N74ctxJJIwGKeqriyFtdTULY1VY4q99IhD7qRM=; b=Mkd3Qhc8Wh47FOs/jUSI+oovkpEfaWNixyzlS+iEtOKzP+NDCrwWVU265pFC3gU1ic GDTWQX+c7CE05c+XmESPnO1tQZJvAxsd4sk2EMMXordMm+1ehnkNRfOA0riSkKVkCh2C 8MCJ3hGlBz/PyCkFBhe5gbzIMR6tz9YgnPEHVv7IwqDO9WTpFguFa1RpnyTqMcswEZ22 CT+wRaQ5xilAzoGxWBda9qPHsWjw15GcAxXjRWp3BsDRP0d/STJHTIiCTv//eQSs7QPt cWpiJ1G8dd1f0CV4mu5M9qgvdYOOj5IVyymZhhRgqNUlWyrSmvqZ+ys4BK5Szp1wPdGP lIeA== X-Gm-Message-State: APjAAAUhJe6JFwW16a281P4lT1f5h38RfSL7SZdd8MlNviz48XVRnbml ub1z+v3Mjf3Y1alGDAN9DFkTKZIs X-Google-Smtp-Source: APXvYqwy8ad1by41Gb786EPOSxMUzFJ4fHUkh7WWE+RcLVZpFH7w5ydP5oTR7CWjvEhiKXk3grAFmQ== X-Received: by 2002:a1c:ac02:: with SMTP id v2mr11162902wme.85.1571057462130; Mon, 14 Oct 2019 05:51:02 -0700 (PDT) Received: from localhost (p2E5BE2CE.dip0.t-ipconnect.de. [46.91.226.206]) by smtp.gmail.com with ESMTPSA id l7sm18312749wrv.77.2019.10.14.05.51.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 05:51:01 -0700 (PDT) From: Thierry Reding To: Thierry Reding Subject: [PATCH 05/14] drm/tegra: Inherit device DMA parameters from host1x Date: Mon, 14 Oct 2019 14:50:40 +0200 Message-Id: <20191014125049.425101-6-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191014125049.425101-1-thierry.reding@gmail.com> References: <20191014125049.425101-1-thierry.reding@gmail.com> MIME-Version: 1.0 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:in-reply-to:references :mime-version:content-transfer-encoding; bh=G8Ip/N74ctxJJIwGKeqriyFtdTULY1VY4q99IhD7qRM=; b=a6UPelncewmDN9UTVzqDbpUmI9eu9bTh6bxy9nRXld4JwG3EVLAm3e06C3HA577Sv1 QHP5J78GPFogvs6g3WMyHnKzY9Oqw94QVzNn1g9OrBs3Oj07LAkxqz5I8WNR5ZZi8MHR iLsysrgZLneZNwqixOsZUzJaKfimn+4au/Ai31U/WASpDeF9WweuGelfgEN4OvxznALR lTR5/bvHA824s1VLAWOzUWEvLosCs/f8LeECsUD2aQTrR+61yvSqi+Q3OyQw4nYhtybO Act5WdkDXd+GYETwDO+CWFi2NiopIvXTHNJKkZstRgJQulH4eHae5YnT717G65LEiWLH Itpw== 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, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding The display controllers and VIC don't have any limitations on the DMA segment size. Inherit the DMA parameters from the parent device, which also doesn't have any such limitations. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 9 +++++++++ drivers/gpu/drm/tegra/vic.c | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index fbf57bc3cdab..f7f7984bb749 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -2074,6 +2074,12 @@ static int tegra_dc_init(struct host1x_client *client) goto cleanup; } + /* + * Inherit the DMA parameters (such as maximum segment size) from the + * parent device. + */ + client->dev->dma_parms = client->parent->dma_parms; + return 0; cleanup: @@ -2097,6 +2103,9 @@ static int tegra_dc_exit(struct host1x_client *client) if (!tegra_dc_has_window_groups(dc)) return 0; + /* avoid a dangling pointer just in case this disappears */ + client->dev->dma_parms = NULL; + devm_free_irq(dc->dev, dc->irq, dc); err = tegra_dc_rgb_exit(dc); diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c index c97a61c877af..8d98b0cfc47b 100644 --- a/drivers/gpu/drm/tegra/vic.c +++ b/drivers/gpu/drm/tegra/vic.c @@ -214,6 +214,12 @@ static int vic_init(struct host1x_client *client) if (err < 0) goto free_syncpt; + /* + * Inherit the DMA parameters (such as maximum segment size) from the + * parent device. + */ + client->dev->dma_parms = client->parent->dma_parms; + return 0; free_syncpt: @@ -236,6 +242,9 @@ static int vic_exit(struct host1x_client *client) struct vic *vic = to_vic(drm); int err; + /* avoid a dangling pointer just in case this disappears */ + client->dev->dma_parms = NULL; + err = tegra_drm_unregister_client(tegra, drm); if (err < 0) return err; From patchwork Mon Oct 14 12:50:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11188699 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 24973912 for ; Mon, 14 Oct 2019 12:51:15 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D06920673 for ; Mon, 14 Oct 2019 12:51:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D06920673 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5A7566E2C7; Mon, 14 Oct 2019 12:51:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id D7BF96E2B2 for ; Mon, 14 Oct 2019 12:51:05 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id o18so19546427wrv.13 for ; Mon, 14 Oct 2019 05:51:05 -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:mime-version:content-transfer-encoding; bh=hANW8n51/2TerGmbLCgZv/CuSuRXQd643gepZFK9hnc=; b=RfJAhGIBb9zYZRc9pKD4+6tjJduH4ON/y4nBavFKmSzBuI/6fB8cO3FFFfYb9NlUCl ARNJGBMTzfpG1vUt11bdcCjDPSPd6s6UMmRPgbghlPDDU8DiTRuU8PtavgcTj+ILOkp0 rZNKIIV/Myl94nY+7LGp/42TrKRIhfaIix1SmKFdCEMnZ/z9cNoKZpu8j1s3xK7kCgak QvJ3b/zqbxoT1wjOfrbTSFkofP9DqNmwzA21EdaO0hXG+4gbJ/ucQVTcxe0yeOkLGuDc fkB9GVUt2OS8dbpLnNRtZ3p5mJ/sTfmjRNXBuzthNPZnj9foJD/x8DemSzr5tmBvFswJ cv3A== X-Gm-Message-State: APjAAAW1b6tfJaFLX6gxRouuHuOR2VjYGrF0JSszdnaKxi9xKYv3TYx2 HRNkptKRdUmJQyJ3ynnN27GrVbYu X-Google-Smtp-Source: APXvYqybmot/4ZJNgw6ylAiNa+i9nfpB1OEZUQ+aZJOVklE7DDa43GuKJsTwPpS6ZdV8c+Sq1irO7Q== X-Received: by 2002:adf:e705:: with SMTP id c5mr24803233wrm.375.1571057464290; Mon, 14 Oct 2019 05:51:04 -0700 (PDT) Received: from localhost (p2E5BE2CE.dip0.t-ipconnect.de. [46.91.226.206]) by smtp.gmail.com with ESMTPSA id n18sm15138096wmi.20.2019.10.14.05.51.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 05:51:03 -0700 (PDT) From: Thierry Reding To: Thierry Reding Subject: [PATCH 06/14] drm/tegra: Use DRM_DEBUG_DRIVER for driver messages Date: Mon, 14 Oct 2019 14:50:41 +0200 Message-Id: <20191014125049.425101-7-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191014125049.425101-1-thierry.reding@gmail.com> References: <20191014125049.425101-1-thierry.reding@gmail.com> MIME-Version: 1.0 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:in-reply-to:references :mime-version:content-transfer-encoding; bh=hANW8n51/2TerGmbLCgZv/CuSuRXQd643gepZFK9hnc=; b=FH9GU5LIfYrvKMM0VQueVtxsk2INkBq+qpUi/rO8dShCffTYMsqbyIsBc0RZYEFlQa S2PL1z4hHISnNlRIeTHqfdHwzlR2DLrKWQ4CjBiqrSinZ+jHc0DTXjSjFKYQe2kYxA6b UAgfZHe6cKBwp3ZoketphiL8GAL6MrZgOWOPE+lrOa3gYgw1MSli3+czinyu9UE+tdiI Lm6xyR1KCsKAphTiq78PcI5DKXCdn7ImtaRiq5Na4yJOenpszLme6hcCq0ftlh4FdgWP gYNRHFn1ZwwcE6JtneCyAhE2YcSBqT9Yk5+yuywj5PYO8nsUBi2pU7ZKupMHBzxAwZjn ey4A== 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, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding The driver-specific messages should use the DRM_UT_DRIVER category so that they can be properly filtered. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/drm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index bc7cc32140f8..498d22a65616 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -163,10 +163,10 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags) drm_mm_init(&tegra->mm, gem_start, gem_end - gem_start + 1); mutex_init(&tegra->mm_lock); - DRM_DEBUG("IOMMU apertures:\n"); - DRM_DEBUG(" GEM: %#llx-%#llx\n", gem_start, gem_end); - DRM_DEBUG(" Carveout: %#llx-%#llx\n", carveout_start, - carveout_end); + DRM_DEBUG_DRIVER("IOMMU apertures:\n"); + DRM_DEBUG_DRIVER(" GEM: %#llx-%#llx\n", gem_start, gem_end); + DRM_DEBUG_DRIVER(" Carveout: %#llx-%#llx\n", carveout_start, + carveout_end); } if (tegra->hub) { From patchwork Mon Oct 14 12:50:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11188695 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8DFD81575 for ; Mon, 14 Oct 2019 12:51:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 76A0820673 for ; Mon, 14 Oct 2019 12:51:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 76A0820673 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5A0F46E2BD; Mon, 14 Oct 2019 12:51:09 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id A523C6E2BD for ; Mon, 14 Oct 2019 12:51:07 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id y19so19619830wrd.3 for ; Mon, 14 Oct 2019 05:51:07 -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:mime-version:content-transfer-encoding; bh=u6qXD9rn/OIy+Nv0WvvLjXj4OfQZfi5fmj38Q+4+iVI=; b=dEnBmAw6zQ+KdZ6tHE92oBI0UxMtfUfyxyjDXKsmQSi6DRY/JF8isNuxlcSaG0/2tp iNhKVAREBfIeyRUWD+iRknw0+hgOmPiL++oit392LvnW6aB3ldEteeOOfEDKDy04MHj9 jSY8vegj/XJK40CbbcrzzRKL+x47CXwDgFSh+9YL3tjU+sGg+8yc4oWMReKbrJOYkY/A f1CnQ7T21xc3sbMW6BNUR0hLHMaDA8unZeXEz44Ne3lhQLobcwfh/DOyQcr9L9wNJOam fsblTJrk/zPSvCD+TO8TytRQxPvuhb818YFnbnLmDjL4I1ih5/BLZRtPCjP6ryIKu5fm Kqcw== X-Gm-Message-State: APjAAAVmU30ptbn90H+MueR8OVVvG9+57bTsr4I0NNrrTYXESMH2yYlL y+NFFFxcbEfQNr/hNYw08oU//mOD X-Google-Smtp-Source: APXvYqymrU0rKN/GipYYJ9TGISsRaOYzVUz0m6AnXs9Fgc/t+zqFjgMgQcdHtPBjQDSRGhmrzFxnfw== X-Received: by 2002:a5d:460a:: with SMTP id t10mr26759965wrq.13.1571057466179; Mon, 14 Oct 2019 05:51:06 -0700 (PDT) Received: from localhost (p2E5BE2CE.dip0.t-ipconnect.de. [46.91.226.206]) by smtp.gmail.com with ESMTPSA id z125sm20917675wme.37.2019.10.14.05.51.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 05:51:05 -0700 (PDT) From: Thierry Reding To: Thierry Reding Subject: [PATCH 07/14] drm/tegra: vic: Skip stream ID programming without IOMMU Date: Mon, 14 Oct 2019 14:50:42 +0200 Message-Id: <20191014125049.425101-8-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191014125049.425101-1-thierry.reding@gmail.com> References: <20191014125049.425101-1-thierry.reding@gmail.com> MIME-Version: 1.0 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:in-reply-to:references :mime-version:content-transfer-encoding; bh=u6qXD9rn/OIy+Nv0WvvLjXj4OfQZfi5fmj38Q+4+iVI=; b=FmdjeQnyIcA69WMoPZKySboMFynXrM36qbqu913EAvyYOjBAnTnyNyYyCH7nDBCelC hftfthY/SOB5KOggPuk+SFkQvcxPuvRnQE13sde1PO0VAZLQQcQiwEFt4PBRw0nVoG53 tZrFqhe9mvXc3RyFGtktUIdFJ2LqTlvSnxwBeB5f2KOGihpjJQbKiN1q9RzsHzAXV7s+ KAlzlQSW32DQUZECKvO5NgLR2T2fJ1b3cGSDG5OVb5hResG00vVxjMHWWMvQWWXXjC3T NH7PF4LMvO0AwLomX320ZH/0RNnK3fev9VuqpiqBvZxyglrdynAscQp8UEvO0ACehJ9v DcOg== 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, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding If VIC is not behind an IOMMU, don't touch any of the registers related to stream ID programming. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/vic.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c index 8d98b0cfc47b..748798f2cdc8 100644 --- a/drivers/gpu/drm/tegra/vic.c +++ b/drivers/gpu/drm/tegra/vic.c @@ -97,6 +97,9 @@ static int vic_runtime_suspend(struct device *dev) static int vic_boot(struct vic *vic) { +#ifdef CONFIG_IOMMU_API + struct iommu_fwspec *spec = dev_iommu_fwspec_get(vic->dev); +#endif u32 fce_ucode_size, fce_bin_data_offset; void *hdr; int err = 0; @@ -105,15 +108,14 @@ static int vic_boot(struct vic *vic) return 0; #ifdef CONFIG_IOMMU_API - if (vic->config->supports_sid) { - struct iommu_fwspec *spec = dev_iommu_fwspec_get(vic->dev); + if (vic->config->supports_sid && spec) { u32 value; value = TRANSCFG_ATT(1, TRANSCFG_SID_FALCON) | TRANSCFG_ATT(0, TRANSCFG_SID_HW); vic_writel(vic, value, VIC_TFBIF_TRANSCFG); - if (spec && spec->num_ids > 0) { + if (spec->num_ids > 0) { value = spec->ids[0] & 0xffff; vic_writel(vic, value, VIC_THI_STREAMID0); From patchwork Mon Oct 14 12:50:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11188697 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 543A11575 for ; Mon, 14 Oct 2019 12:51:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3AC8B20673 for ; Mon, 14 Oct 2019 12:51:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3AC8B20673 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 052896E2BE; Mon, 14 Oct 2019 12:51:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id EBBFA6E2BE for ; Mon, 14 Oct 2019 12:51:09 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id 3so16642412wmi.3 for ; Mon, 14 Oct 2019 05:51:09 -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:mime-version:content-transfer-encoding; bh=FwBg+ebSJP5mRjr900RF+E/RqOvjOLM24+kI7t4VvUg=; b=W7TSqNSQGooR9UfpXzx0ErKRfVaorgOS0eKSr6hY+K28v1Gk1BuXX7OSy+IqRYRehf mStEFV9D1D80xeO5aoqTJ79eSJRdUlaJXBAIRA97jXAAXTvDi2upCnxip8iy1os3OsPP BmKvsjanpebsERn0YN4MIOutg5BQ5ZQvmqJ3xqqElLSs7RfsRHdniMG4Wgtm2dVhpNzs WZsa3/uLHnSZed218fyJpJquZbkgi4oLNKDyIZaQYKL/ek404Wc5B1oG1hu4+l8UKMCE IW4ATuUbN8nt3qXK218a976PRey38OvPQSm6pudePKYh7PYOaodjE5ez+9QjsY5J49Dk EL+g== X-Gm-Message-State: APjAAAU+wGuJ8o2ty5p7K3pnEX+ZcYGXoncz6XhFdzzTHwNZqFBxmK6c hHf7p2KXS+dcbrCiDtla5mk= X-Google-Smtp-Source: APXvYqzXG6B2Rb+gy/AW++lSmQzs70JeEvfgo03vNOj77BcGg0/KS5QnmwfcvAVFWiTYXiMXWp9RYw== X-Received: by 2002:a1c:f011:: with SMTP id a17mr14486354wmb.18.1571057468225; Mon, 14 Oct 2019 05:51:08 -0700 (PDT) Received: from localhost (p2E5BE2CE.dip0.t-ipconnect.de. [46.91.226.206]) by smtp.gmail.com with ESMTPSA id x5sm23902742wrt.75.2019.10.14.05.51.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 05:51:07 -0700 (PDT) From: Thierry Reding To: Thierry Reding Subject: [PATCH 08/14] drm/tegra: vic: Inherit DMA mask from host1x Date: Mon, 14 Oct 2019 14:50:43 +0200 Message-Id: <20191014125049.425101-9-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191014125049.425101-1-thierry.reding@gmail.com> References: <20191014125049.425101-1-thierry.reding@gmail.com> MIME-Version: 1.0 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:in-reply-to:references :mime-version:content-transfer-encoding; bh=FwBg+ebSJP5mRjr900RF+E/RqOvjOLM24+kI7t4VvUg=; b=DOlLanNaCmwuTEm1kbAzhv1PC8LkEv4wn3LmSmiRgU3vG4Zq6lTTq3lyOHwRdqjBTc cJKq6Q+3ujIHy9JzOxO9uocKYFPbl3Qjr3mowd4Xd5ArqjQOj4KWpEzp1AZD6OpieOVz /teKSxf4EUaDQqHGV7XcG8d6oC1CHCUlXZtKRni9c/6S8tlm/T65HnODIvS3hF/hNWUy bs0U5xLavIhEF0B9SUJq+Q4Di9V3SmjB/BfazUpyM5D2tZRduplXBsAGrLFoWyD1Kcii IEOMTliZ+HpghdKrlwru4q2t2jEKiAFt57B41S1GL0679eNejylsL2Ht1DKfYYs8rSkX 9xLw== 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, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding VIC, just like all other host1x clients, has the same addressing range as its parent host1x device. Inherit the DMA mask to reflect that. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/vic.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c index 748798f2cdc8..d60e479cde92 100644 --- a/drivers/gpu/drm/tegra/vic.c +++ b/drivers/gpu/drm/tegra/vic.c @@ -385,6 +385,13 @@ static int vic_probe(struct platform_device *pdev) struct vic *vic; int err; + /* inherit DMA mask from host1x parent */ + err = dma_coerce_mask_and_coherent(dev, *dev->parent->dma_mask); + if (err < 0) { + dev_err(&pdev->dev, "failed to set DMA mask: %d\n", err); + return err; + } + vic = devm_kzalloc(dev, sizeof(*vic), GFP_KERNEL); if (!vic) return -ENOMEM; From patchwork Mon Oct 14 12:50:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11188701 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9DB061575 for ; Mon, 14 Oct 2019 12:51:17 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 85D6721835 for ; Mon, 14 Oct 2019 12:51:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 85D6721835 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 77A896E2C0; Mon, 14 Oct 2019 12:51:16 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by gabe.freedesktop.org (Postfix) with ESMTPS id 383656E2C0 for ; Mon, 14 Oct 2019 12:51:12 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id p7so17157896wmp.4 for ; Mon, 14 Oct 2019 05:51:12 -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:mime-version:content-transfer-encoding; bh=B5fuJB7QmtV9h7aBVewhTK71Ks0pgNS4kdo609/xFbo=; b=LLREryzL7B+3EGPYryJAuGJsjaOKnIOKd7PGEeOHWpielP9nrp526ZW927GsmRFGfl turZlTP5kxZSM1XlboGA3BcmXQisqAeiKw/HN/38qti2QriSs86Q88l7CG3Dmh7TpjRZ eRMWa5n1rJN1dLaF9BngI2xvVTFtcUC2qh6uBbbf9iSwdCLWVWERodBc+QS+rA+z6MeH WYymjXJXG90Jwlcbur8j95DGM3EKRO7ODEwk+OJHNtjfuIKZwGMFCzJNVnIljvVdNgaT T0jE84jDsn7sF/I8g9Odkq8hl+OXRomaru8SOcGgGGtpyZNuFbBSy5ulFhowRbCkB2Ti kpyg== X-Gm-Message-State: APjAAAXsQacAOCWVOYaBy+edKkE1Pd6N97VJ5250n60mipQcIxGhYeu+ Xlc1Lkko5LNhM466hSGURWs= X-Google-Smtp-Source: APXvYqxCDvHffZXht1XHuIbS0QlRApgWVwhVUWF+hNratzEVbOVK6iZZnoRmz0hhM8KUZR4o03xguA== X-Received: by 2002:a1c:1dc9:: with SMTP id d192mr15685966wmd.51.1571057470705; Mon, 14 Oct 2019 05:51:10 -0700 (PDT) Received: from localhost (p2E5BE2CE.dip0.t-ipconnect.de. [46.91.226.206]) by smtp.gmail.com with ESMTPSA id a192sm16440048wma.1.2019.10.14.05.51.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 05:51:09 -0700 (PDT) From: Thierry Reding To: Thierry Reding Subject: [PATCH 09/14] drm/tegra: vic: Use common IOMMU attach/detach code Date: Mon, 14 Oct 2019 14:50:44 +0200 Message-Id: <20191014125049.425101-10-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191014125049.425101-1-thierry.reding@gmail.com> References: <20191014125049.425101-1-thierry.reding@gmail.com> MIME-Version: 1.0 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:in-reply-to:references :mime-version:content-transfer-encoding; bh=B5fuJB7QmtV9h7aBVewhTK71Ks0pgNS4kdo609/xFbo=; b=uD7vU7d6OrpaUKwtuchmc0iH50x9zTlPXy7BcOJu4sWXI/SQQ2woE6sEm/DEqC7p1n t5RF6Jo+hCWPcJVl5l8AhEWEcVivkgdqVVEgZl1TPZtN2Kx/S4HwH+tkhkBRiTDZxPyo VYa2q0F7wCEf3x4dgzkS2OLKnCm22IAZEqDJEZNO+3Yp35cLQQwGwJGDk03BmvH3MKXi tuXsqzpUDTXvjtqu7+i3CkiuEV084bh/2vQxvncSjNbE0v+Pc1mwcPAyhhxY+zWcSod1 syAETGIUdShjefqAwdh5yi085uQ/gOMEIyVZiu+dn1vJIkF8VN+cLxY1fdsa+4Fwokub 5FgA== 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, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Reuse common code to attach to or detach from an IOMMU domain. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/vic.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c index d60e479cde92..e4b17c7ce708 100644 --- a/drivers/gpu/drm/tegra/vic.c +++ b/drivers/gpu/drm/tegra/vic.c @@ -34,7 +34,7 @@ struct vic { void __iomem *regs; struct tegra_drm_client client; struct host1x_channel *channel; - struct iommu_domain *domain; + struct iommu_group *group; struct device *dev; struct clk *clk; struct reset_control *rst; @@ -183,21 +183,16 @@ static const struct falcon_ops vic_falcon_ops = { static int vic_init(struct host1x_client *client) { struct tegra_drm_client *drm = host1x_to_drm_client(client); - struct iommu_group *group = iommu_group_get(client->dev); struct drm_device *dev = dev_get_drvdata(client->parent); struct tegra_drm *tegra = dev->dev_private; struct vic *vic = to_vic(drm); int err; - if (group && tegra->domain) { - err = iommu_attach_group(tegra->domain, group); - if (err < 0) { - dev_err(vic->dev, "failed to attach to domain: %d\n", - err); - return err; - } - - vic->domain = tegra->domain; + vic->group = host1x_client_iommu_attach(client, false); + if (IS_ERR(vic->group)) { + err = PTR_ERR(vic->group); + dev_err(vic->dev, "failed to attach to domain: %d\n", err); + return err; } vic->channel = host1x_channel_request(client); @@ -229,8 +224,7 @@ static int vic_init(struct host1x_client *client) free_channel: host1x_channel_put(vic->channel); detach: - if (group && tegra->domain) - iommu_detach_group(tegra->domain, group); + host1x_client_iommu_detach(client, vic->group); return err; } @@ -238,7 +232,6 @@ static int vic_init(struct host1x_client *client) static int vic_exit(struct host1x_client *client) { struct tegra_drm_client *drm = host1x_to_drm_client(client); - struct iommu_group *group = iommu_group_get(client->dev); struct drm_device *dev = dev_get_drvdata(client->parent); struct tegra_drm *tegra = dev->dev_private; struct vic *vic = to_vic(drm); @@ -253,11 +246,7 @@ static int vic_exit(struct host1x_client *client) host1x_syncpt_free(client->syncpts[0]); host1x_channel_put(vic->channel); - - if (vic->domain) { - iommu_detach_group(vic->domain, group); - vic->domain = NULL; - } + host1x_client_iommu_detach(client, vic->group); return 0; } From patchwork Mon Oct 14 12:50:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11188703 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D47CB1575 for ; Mon, 14 Oct 2019 12:51:19 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BC3E620673 for ; Mon, 14 Oct 2019 12:51:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BC3E620673 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E97066E2CF; Mon, 14 Oct 2019 12:51:17 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by gabe.freedesktop.org (Postfix) with ESMTPS id E3E046E2C0 for ; Mon, 14 Oct 2019 12:51:14 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id r17so14435540wme.0 for ; Mon, 14 Oct 2019 05:51:14 -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:mime-version:content-transfer-encoding; bh=ByOD/URUTplb+5mvC2oecBpFoqh1Lrogh0FPvicFxx4=; b=GVjDDRL3dcccDrSxRq92oKuam2/XFN1rqKNba0X5s3NM95tpOA+sNEGa1Cpv/qHJZu 9nReUUJgk5BVZ6NupZtr3yrJ2jAByFTxI5dVESE6ZusKQMLtA9Wfp6KDKIe+FWOGr2f5 PsIXrVb5TXLtYXwnzBsucseUYQCx1YPlvqLD7M3M16JIP8kaTRQC0MAfQ0k/ULXCkHJ8 qV1QRbMZB45Agj3pXmYWrph6NrUcYFGNQfdPz16sd/maDQYlA0/2hpy7oNhfMLntJ60O JdF8MtoNKZqtj+GN1Wk5WpnYZkA6S+drBxQbAuNvEORwQ74OtMHxoC6IB9UZ3YW4z78S xksA== X-Gm-Message-State: APjAAAVbxYlmVCp7UgB7bVKyfSDoOoLQ4fXnvgORBgGm7UBqEmoJ/Lwo vR1UkVFhoqxEHxI5CPnunzE= X-Google-Smtp-Source: APXvYqwzHVU93ie1bseLLY/s+4NFR5ZzARfzHrP6+sB19QpVkZf9w0io00VLw9eswka+jOaiddjjTw== X-Received: by 2002:a05:600c:2107:: with SMTP id u7mr14817594wml.13.1571057472712; Mon, 14 Oct 2019 05:51:12 -0700 (PDT) Received: from localhost (p2E5BE2CE.dip0.t-ipconnect.de. [46.91.226.206]) by smtp.gmail.com with ESMTPSA id c132sm27253057wme.27.2019.10.14.05.51.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 05:51:11 -0700 (PDT) From: Thierry Reding To: Thierry Reding Subject: [PATCH 10/14] drm/tegra: Move IOMMU group into host1x client Date: Mon, 14 Oct 2019 14:50:45 +0200 Message-Id: <20191014125049.425101-11-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191014125049.425101-1-thierry.reding@gmail.com> References: <20191014125049.425101-1-thierry.reding@gmail.com> MIME-Version: 1.0 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:in-reply-to:references :mime-version:content-transfer-encoding; bh=ByOD/URUTplb+5mvC2oecBpFoqh1Lrogh0FPvicFxx4=; b=BfXUzm2VewPyYkUCGJVNqEQaPRyntweb24BGSGEiaGKmWqLNb5E3CKsBtzyRHit1LF RH+rOqQtsJdAMqc/jwYwepBvBV70dlqA7O9VJVOPGNELd5sW/U3QINoZjawTzoxiX/iC oJVImuzxBq8VuGsrh0ilh8WUK/IFa8mmsgSdOLAbvsxiWTdKqs5bja6jYOVZ9AwACB6j jREavpuXhz0wORWSij+Y4/TSxLLfNmEZJEzjxXPxnyYnNyouaiaVFxz5lFFdppjm7Oo3 rl/RuXhI4jeTY9JLPkzJBYslXaQRiIMVynoIOzO+GQQkg2z/OEqwceqXxAMzsfOxylto hoow== 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, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Handling of the IOMMU group attachment is common to all clients, so move the group into the client to simplify code. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 9 ++++----- drivers/gpu/drm/tegra/dc.h | 2 -- drivers/gpu/drm/tegra/drm.c | 22 +++++++++++----------- drivers/gpu/drm/tegra/drm.h | 6 ++---- drivers/gpu/drm/tegra/gr2d.c | 10 ++++------ drivers/gpu/drm/tegra/gr3d.c | 10 ++++------ drivers/gpu/drm/tegra/vic.c | 10 ++++------ include/linux/host1x.h | 2 ++ 8 files changed, 31 insertions(+), 40 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index f7f7984bb749..3ac535bd99ca 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -2014,9 +2014,8 @@ static int tegra_dc_init(struct host1x_client *client) if (!dc->syncpt) dev_warn(dc->dev, "failed to allocate syncpoint\n"); - dc->group = host1x_client_iommu_attach(client, true); - if (IS_ERR(dc->group)) { - err = PTR_ERR(dc->group); + err = host1x_client_iommu_attach(client, true); + if (err < 0) { dev_err(client->dev, "failed to attach to domain: %d\n", err); return err; } @@ -2089,7 +2088,7 @@ static int tegra_dc_init(struct host1x_client *client) if (!IS_ERR(primary)) drm_plane_cleanup(primary); - host1x_client_iommu_detach(client, dc->group); + host1x_client_iommu_detach(client); host1x_syncpt_free(dc->syncpt); return err; @@ -2114,7 +2113,7 @@ static int tegra_dc_exit(struct host1x_client *client) return err; } - host1x_client_iommu_detach(client, dc->group); + host1x_client_iommu_detach(client); host1x_syncpt_free(dc->syncpt); return 0; diff --git a/drivers/gpu/drm/tegra/dc.h b/drivers/gpu/drm/tegra/dc.h index 0c4d17851f47..3d8ddccd758f 100644 --- a/drivers/gpu/drm/tegra/dc.h +++ b/drivers/gpu/drm/tegra/dc.h @@ -90,8 +90,6 @@ struct tegra_dc { struct drm_info_list *debugfs_files; const struct tegra_dc_soc_info *soc; - - struct iommu_group *group; }; static inline struct tegra_dc * diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 498d22a65616..b74362cb63eb 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -1068,8 +1068,7 @@ int tegra_drm_unregister_client(struct tegra_drm *tegra, return 0; } -struct iommu_group *host1x_client_iommu_attach(struct host1x_client *client, - bool shared) +int host1x_client_iommu_attach(struct host1x_client *client, bool shared) { struct drm_device *drm = dev_get_drvdata(client->parent); struct tegra_drm *tegra = drm->dev_private; @@ -1080,7 +1079,7 @@ struct iommu_group *host1x_client_iommu_attach(struct host1x_client *client, group = iommu_group_get(client->dev); if (!group) { dev_err(client->dev, "failed to get IOMMU group\n"); - return ERR_PTR(-ENODEV); + return -ENODEV; } if (!shared || (shared && (group != tegra->group))) { @@ -1095,7 +1094,7 @@ struct iommu_group *host1x_client_iommu_attach(struct host1x_client *client, err = iommu_attach_group(tegra->domain, group); if (err < 0) { iommu_group_put(group); - return ERR_PTR(err); + return err; } if (shared && !tegra->group) @@ -1103,22 +1102,23 @@ struct iommu_group *host1x_client_iommu_attach(struct host1x_client *client, } } - return group; + client->group = group; + + return 0; } -void host1x_client_iommu_detach(struct host1x_client *client, - struct iommu_group *group) +void host1x_client_iommu_detach(struct host1x_client *client) { struct drm_device *drm = dev_get_drvdata(client->parent); struct tegra_drm *tegra = drm->dev_private; - if (group) { - if (group == tegra->group) { - iommu_detach_group(tegra->domain, group); + if (client->group) { + if (client->group == tegra->group) { + iommu_detach_group(tegra->domain, client->group); tegra->group = NULL; } - iommu_group_put(group); + iommu_group_put(client->group); } } diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index 29911eff9ceb..6a06d636e930 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h @@ -100,10 +100,8 @@ int tegra_drm_register_client(struct tegra_drm *tegra, struct tegra_drm_client *client); int tegra_drm_unregister_client(struct tegra_drm *tegra, struct tegra_drm_client *client); -struct iommu_group *host1x_client_iommu_attach(struct host1x_client *client, - bool shared); -void host1x_client_iommu_detach(struct host1x_client *client, - struct iommu_group *group); +int host1x_client_iommu_attach(struct host1x_client *client, bool shared); +void host1x_client_iommu_detach(struct host1x_client *client); int tegra_drm_init(struct tegra_drm *tegra, struct drm_device *drm); int tegra_drm_exit(struct tegra_drm *tegra); diff --git a/drivers/gpu/drm/tegra/gr2d.c b/drivers/gpu/drm/tegra/gr2d.c index 3cbb4a029c41..5d5af9a05c18 100644 --- a/drivers/gpu/drm/tegra/gr2d.c +++ b/drivers/gpu/drm/tegra/gr2d.c @@ -17,7 +17,6 @@ struct gr2d_soc { }; struct gr2d { - struct iommu_group *group; struct tegra_drm_client client; struct host1x_channel *channel; struct clk *clk; @@ -51,9 +50,8 @@ static int gr2d_init(struct host1x_client *client) goto put; } - gr2d->group = host1x_client_iommu_attach(client, false); - if (IS_ERR(gr2d->group)) { - err = PTR_ERR(gr2d->group); + err = host1x_client_iommu_attach(client, false); + if (err < 0) { dev_err(client->dev, "failed to attach to domain: %d\n", err); goto free; } @@ -67,7 +65,7 @@ static int gr2d_init(struct host1x_client *client) return 0; detach: - host1x_client_iommu_detach(client, gr2d->group); + host1x_client_iommu_detach(client); free: host1x_syncpt_free(client->syncpts[0]); put: @@ -87,7 +85,7 @@ static int gr2d_exit(struct host1x_client *client) if (err < 0) return err; - host1x_client_iommu_detach(client, gr2d->group); + host1x_client_iommu_detach(client); host1x_syncpt_free(client->syncpts[0]); host1x_channel_put(gr2d->channel); diff --git a/drivers/gpu/drm/tegra/gr3d.c b/drivers/gpu/drm/tegra/gr3d.c index 87a386134cc4..c249a6bd8d51 100644 --- a/drivers/gpu/drm/tegra/gr3d.c +++ b/drivers/gpu/drm/tegra/gr3d.c @@ -23,7 +23,6 @@ struct gr3d_soc { }; struct gr3d { - struct iommu_group *group; struct tegra_drm_client client; struct host1x_channel *channel; struct clk *clk_secondary; @@ -60,9 +59,8 @@ static int gr3d_init(struct host1x_client *client) goto put; } - gr3d->group = host1x_client_iommu_attach(client, false); - if (IS_ERR(gr3d->group)) { - err = PTR_ERR(gr3d->group); + err = host1x_client_iommu_attach(client, false); + if (err < 0) { dev_err(client->dev, "failed to attach to domain: %d\n", err); goto free; } @@ -76,7 +74,7 @@ static int gr3d_init(struct host1x_client *client) return 0; detach: - host1x_client_iommu_detach(client, gr3d->group); + host1x_client_iommu_detach(client); free: host1x_syncpt_free(client->syncpts[0]); put: @@ -95,7 +93,7 @@ static int gr3d_exit(struct host1x_client *client) if (err < 0) return err; - host1x_client_iommu_detach(client, gr3d->group); + host1x_client_iommu_detach(client); host1x_syncpt_free(client->syncpts[0]); host1x_channel_put(gr3d->channel); diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c index e4b17c7ce708..d34b1ada422c 100644 --- a/drivers/gpu/drm/tegra/vic.c +++ b/drivers/gpu/drm/tegra/vic.c @@ -34,7 +34,6 @@ struct vic { void __iomem *regs; struct tegra_drm_client client; struct host1x_channel *channel; - struct iommu_group *group; struct device *dev; struct clk *clk; struct reset_control *rst; @@ -188,9 +187,8 @@ static int vic_init(struct host1x_client *client) struct vic *vic = to_vic(drm); int err; - vic->group = host1x_client_iommu_attach(client, false); - if (IS_ERR(vic->group)) { - err = PTR_ERR(vic->group); + err = host1x_client_iommu_attach(client, false); + if (err < 0) { dev_err(vic->dev, "failed to attach to domain: %d\n", err); return err; } @@ -224,7 +222,7 @@ static int vic_init(struct host1x_client *client) free_channel: host1x_channel_put(vic->channel); detach: - host1x_client_iommu_detach(client, vic->group); + host1x_client_iommu_detach(client); return err; } @@ -246,7 +244,7 @@ static int vic_exit(struct host1x_client *client) host1x_syncpt_free(client->syncpts[0]); host1x_channel_put(vic->channel); - host1x_client_iommu_detach(client, vic->group); + host1x_client_iommu_detach(client); return 0; } diff --git a/include/linux/host1x.h b/include/linux/host1x.h index 4396cd566a33..8b2d1a4bf7b1 100644 --- a/include/linux/host1x.h +++ b/include/linux/host1x.h @@ -18,6 +18,7 @@ enum host1x_class { }; struct host1x_client; +struct iommu_group; /** * struct host1x_client_ops - host1x client operations @@ -44,6 +45,7 @@ struct host1x_client { struct list_head list; struct device *parent; struct device *dev; + struct iommu_group *group; const struct host1x_client_ops *ops; From patchwork Mon Oct 14 12:50:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11188705 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 61B87912 for ; Mon, 14 Oct 2019 12:51:22 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 49C3921744 for ; Mon, 14 Oct 2019 12:51:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 49C3921744 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4A34F6E2CC; Mon, 14 Oct 2019 12:51:21 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id EA4586E2CC for ; Mon, 14 Oct 2019 12:51:16 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id a6so17128547wma.5 for ; Mon, 14 Oct 2019 05:51:16 -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:mime-version:content-transfer-encoding; bh=5kAEqnBZ6MmRl+pXbq1LnTbk9P8s3U977DcUAEiFmNQ=; b=cIh5M/hqKDgSjBpTtNhyLTz3piYT2tMxYCZRJjgM+Ueib3FZoc5E3g/CEOS8IWb5C9 6FXuBVGj7CJOnFrnW4niYjYoqxaS/wfI1d9TwIqNBrzMcMotm8FRbIKSyjGxGYDkNkID sI4zUhYa7rNPxbLw7ucWGyIN/E0/bvmZDROIQf4aN3uNV+g6Y1xftb/1TkH3jg2G6HIm PC//fJ3LUiSeOPwy10pllBSbtr0lQeqQOlpez6wr1B6r7AWloBHyzJ2hgmoyoa7vltQR p6hppFm9Tt9OkUDXx9U/vlMuq6RNdf6rihyvBNJIO/JZg+uKmA4I/JWp4hPlI4hyJtXM hpRg== X-Gm-Message-State: APjAAAV6kD8qm13RXk94klW+O2jQ2+kjX/2f5DGx9ctxbjBEROhAqioC g2Le+yfapdF4ndIvH4BoIbs= X-Google-Smtp-Source: APXvYqzHAe84RO7omKdazqiBlohn5OFKMP5dJ0KX3C4NyvHOdxnOz7lq0UQEhU/M8Fkw8ZPW46LAdg== X-Received: by 2002:a7b:ce01:: with SMTP id m1mr14027365wmc.136.1571057475139; Mon, 14 Oct 2019 05:51:15 -0700 (PDT) Received: from localhost (p2E5BE2CE.dip0.t-ipconnect.de. [46.91.226.206]) by smtp.gmail.com with ESMTPSA id g13sm15458488wrm.42.2019.10.14.05.51.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 05:51:14 -0700 (PDT) From: Thierry Reding To: Thierry Reding Subject: [PATCH 11/14] drm/tegra: gem: Rename paddr -> iova Date: Mon, 14 Oct 2019 14:50:46 +0200 Message-Id: <20191014125049.425101-12-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191014125049.425101-1-thierry.reding@gmail.com> References: <20191014125049.425101-1-thierry.reding@gmail.com> MIME-Version: 1.0 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:in-reply-to:references :mime-version:content-transfer-encoding; bh=5kAEqnBZ6MmRl+pXbq1LnTbk9P8s3U977DcUAEiFmNQ=; b=lp/tJ/XNOr+QTKZTeVJqJkHPo6CdzfhczvWGwiyMVGrHxfKOxokv20TZuMjMV7HsKL 4lqj7pkB+1xuV2peHoYiAcpxXlaqX7nRJeE2IXOanWFcvXqunKImn5G4IgOlf0y8NafE AHhG6rkS7R5YiHRVptyRH0LGXFS43j56F6FzkNZ01lpob8+ndRXISLPAbID4ZtMQTMKj 6S/Thf4cx2ot0ha6IOzEQStjbUleLyDURrDQirnQToFpmmCy4ONPHwINOwByo5UK+yq5 0UvLV/1TzgeT7qkbEvs9HnjbLEnaLYpGxZAPwJ5tIeSvR8EpA2RCatgcRXA9JmldGwPt ihMg== 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, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding The address can refer to either physical memory or IO virtual memory. If referring to IO virtual memory, there will always be an associated physical memory address. Rename this variable to "iova" to clarify in all cases that this is the IO virtual memory, which in the absence of an IOMMU is identical to the physical address. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 6 +++--- drivers/gpu/drm/tegra/fb.c | 4 ++-- drivers/gpu/drm/tegra/gem.c | 18 +++++++++--------- drivers/gpu/drm/tegra/gem.h | 2 +- drivers/gpu/drm/tegra/hub.c | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 3ac535bd99ca..54966f538141 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -717,7 +717,7 @@ static void tegra_plane_atomic_update(struct drm_plane *plane, for (i = 0; i < fb->format->num_planes; i++) { struct tegra_bo *bo = tegra_fb_get_plane(fb, i); - window.base[i] = bo->paddr + fb->offsets[i]; + window.base[i] = bo->iova + fb->offsets[i]; /* * Tegra uses a shared stride for UV planes. Framebuffers are @@ -869,11 +869,11 @@ static void tegra_cursor_atomic_update(struct drm_plane *plane, return; } - value |= (bo->paddr >> 10) & 0x3fffff; + value |= (bo->iova >> 10) & 0x3fffff; tegra_dc_writel(dc, value, DC_DISP_CURSOR_START_ADDR); #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT - value = (bo->paddr >> 32) & 0x3; + value = (bo->iova >> 32) & 0x3; tegra_dc_writel(dc, value, DC_DISP_CURSOR_START_ADDR_HI); #endif diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c index e34325c83d28..7cea89f29a5c 100644 --- a/drivers/gpu/drm/tegra/fb.c +++ b/drivers/gpu/drm/tegra/fb.c @@ -269,10 +269,10 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper, } } - drm->mode_config.fb_base = (resource_size_t)bo->paddr; + drm->mode_config.fb_base = (resource_size_t)bo->iova; info->screen_base = (void __iomem *)bo->vaddr + offset; info->screen_size = size; - info->fix.smem_start = (unsigned long)(bo->paddr + offset); + info->fix.smem_start = (unsigned long)(bo->iova + offset); info->fix.smem_len = size; return 0; diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c index fb7667c8dd4c..7412e23500d1 100644 --- a/drivers/gpu/drm/tegra/gem.c +++ b/drivers/gpu/drm/tegra/gem.c @@ -33,7 +33,7 @@ static dma_addr_t tegra_bo_pin(struct host1x_bo *bo, struct sg_table **sgt) *sgt = obj->sgt; - return obj->paddr; + return obj->iova; } static void tegra_bo_unpin(struct host1x_bo *bo, struct sg_table *sgt) @@ -133,9 +133,9 @@ static int tegra_bo_iommu_map(struct tegra_drm *tegra, struct tegra_bo *bo) goto unlock; } - bo->paddr = bo->mm->start; + bo->iova = bo->mm->start; - bo->size = iommu_map_sg(tegra->domain, bo->paddr, bo->sgt->sgl, + bo->size = iommu_map_sg(tegra->domain, bo->iova, bo->sgt->sgl, bo->sgt->nents, prot); if (!bo->size) { dev_err(tegra->drm->dev, "failed to map buffer\n"); @@ -161,7 +161,7 @@ static int tegra_bo_iommu_unmap(struct tegra_drm *tegra, struct tegra_bo *bo) return 0; mutex_lock(&tegra->mm_lock); - iommu_unmap(tegra->domain, bo->paddr, bo->size); + iommu_unmap(tegra->domain, bo->iova, bo->size); drm_mm_remove_node(bo->mm); mutex_unlock(&tegra->mm_lock); @@ -209,7 +209,7 @@ static void tegra_bo_free(struct drm_device *drm, struct tegra_bo *bo) sg_free_table(bo->sgt); kfree(bo->sgt); } else if (bo->vaddr) { - dma_free_wc(drm->dev, bo->gem.size, bo->vaddr, bo->paddr); + dma_free_wc(drm->dev, bo->gem.size, bo->vaddr, bo->iova); } } @@ -264,7 +264,7 @@ static int tegra_bo_alloc(struct drm_device *drm, struct tegra_bo *bo) } else { size_t size = bo->gem.size; - bo->vaddr = dma_alloc_wc(drm->dev, size, &bo->paddr, + bo->vaddr = dma_alloc_wc(drm->dev, size, &bo->iova, GFP_KERNEL | __GFP_NOWARN); if (!bo->vaddr) { dev_err(drm->dev, @@ -365,7 +365,7 @@ static struct tegra_bo *tegra_bo_import(struct drm_device *drm, goto detach; } - bo->paddr = sg_dma_address(bo->sgt->sgl); + bo->iova = sg_dma_address(bo->sgt->sgl); } bo->gem.import_attach = attach; @@ -461,7 +461,7 @@ int __tegra_gem_mmap(struct drm_gem_object *gem, struct vm_area_struct *vma) vma->vm_flags &= ~VM_PFNMAP; vma->vm_pgoff = 0; - err = dma_mmap_wc(gem->dev->dev, vma, bo->vaddr, bo->paddr, + err = dma_mmap_wc(gem->dev->dev, vma, bo->vaddr, bo->iova, gem->size); if (err < 0) { drm_gem_vm_close(vma); @@ -523,7 +523,7 @@ tegra_gem_prime_map_dma_buf(struct dma_buf_attachment *attach, if (sg_alloc_table(sgt, 1, GFP_KERNEL)) goto free; - sg_dma_address(sgt->sgl) = bo->paddr; + sg_dma_address(sgt->sgl) = bo->iova; sg_dma_len(sgt->sgl) = gem->size; } diff --git a/drivers/gpu/drm/tegra/gem.h b/drivers/gpu/drm/tegra/gem.h index 83ffb1e14ca3..fafb5724499b 100644 --- a/drivers/gpu/drm/tegra/gem.h +++ b/drivers/gpu/drm/tegra/gem.h @@ -31,7 +31,7 @@ struct tegra_bo { struct host1x_bo base; unsigned long flags; struct sg_table *sgt; - dma_addr_t paddr; + dma_addr_t iova; void *vaddr; struct drm_mm_node *mm; diff --git a/drivers/gpu/drm/tegra/hub.c b/drivers/gpu/drm/tegra/hub.c index 839b49c40e51..104115e42190 100644 --- a/drivers/gpu/drm/tegra/hub.c +++ b/drivers/gpu/drm/tegra/hub.c @@ -457,7 +457,7 @@ static void tegra_shared_plane_atomic_update(struct drm_plane *plane, tegra_plane_writel(p, 0, DC_WINBUF_CDE_CONTROL); bo = tegra_fb_get_plane(fb, 0); - base = bo->paddr; + base = bo->iova; tegra_plane_writel(p, state->format, DC_WIN_COLOR_DEPTH); tegra_plane_writel(p, 0, DC_WIN_PRECOMP_WGRP_PARAMS); From patchwork Mon Oct 14 12:50:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11188707 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2969B912 for ; Mon, 14 Oct 2019 12:51:24 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 11DD521744 for ; Mon, 14 Oct 2019 12:51:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 11DD521744 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8343C6E2D5; Mon, 14 Oct 2019 12:51:21 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9D7556E2D1 for ; Mon, 14 Oct 2019 12:51:19 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id y21so16640625wmi.0 for ; Mon, 14 Oct 2019 05:51:19 -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:mime-version:content-transfer-encoding; bh=VDWizjgHzHaIFYFt83zBnigeKDs+hp0GWtpu1Y4vNf8=; b=gOy2/uWuhbYIm3F+0y22xui3sXeN8lWiJh2iKan1ek2+u2P3z/hXqA/PZ8kzHpu50A ohCc5rDaMtdI+x9qZW3RumNR2AYQ2Gzzp2FB6eK5dUCGzt2Y7kd3XnsA+rchPmNTHMBE CIEGN6MeZS2H8dyrxssYtEJyfvd2Kk086zFwg1rCqqFUi3e2DygBdM00MzJtGUpePT28 33l5e+8oEM/enHF3Jj7yCgA56DIwatXTWS1v/3+KmQYaHX0M/P09i7Oocr2BI7HZ4YjI LNiei1VelGS7ldgdHUVqsr/fxDCE0Nyp+pxrJe10RoLbIi6RXq3HRYJrxeGfqXAF368a fIaA== X-Gm-Message-State: APjAAAXbJGme/D5GybVuqCM3Jao6Hnd6pulfHXoI1aljX/UapEisVQsI cc0RfDvncIhe/SFlUPpJ6LGPYFFz X-Google-Smtp-Source: APXvYqz8X5+f6i1aMnNFDYBatBFCV+qGCetZxynDcGxPHgl8rkjrnIO1LlCP6g5G7sRB6rhIdl5V9A== X-Received: by 2002:a1c:a941:: with SMTP id s62mr14393658wme.128.1571057478049; Mon, 14 Oct 2019 05:51:18 -0700 (PDT) Received: from localhost (p2E5BE2CE.dip0.t-ipconnect.de. [46.91.226.206]) by smtp.gmail.com with ESMTPSA id c18sm16730393wrv.10.2019.10.14.05.51.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 05:51:16 -0700 (PDT) From: Thierry Reding To: Thierry Reding Subject: [PATCH 12/14] drm/tegra: gem: Use dma_get_sgtable() Date: Mon, 14 Oct 2019 14:50:47 +0200 Message-Id: <20191014125049.425101-13-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191014125049.425101-1-thierry.reding@gmail.com> References: <20191014125049.425101-1-thierry.reding@gmail.com> MIME-Version: 1.0 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:in-reply-to:references :mime-version:content-transfer-encoding; bh=VDWizjgHzHaIFYFt83zBnigeKDs+hp0GWtpu1Y4vNf8=; b=nYS0pc+oc0WP0DGiaz+7394+j+LUl8X/KfzH9D3W7fs8+8xliID/0kQZ3l3rqzsoMy 6i0KPVh0S4rOoYWSQK4Ev0Fu1Q7/WnXq7wltsFHNt7Qg0LysUo38fk2KaNQpHTk/wBBz J6z71ciFh8KMMIVbt17hD1F7yDenRoIR2X/vFMEO4M1i+XAf7WFTxRVByrowTBw0JYH5 U6YQM88spXnpMWDsb/6ArnDjbOu3hLQoS2JZM8nxDoHYNdb0ocj4JsYVgH1N5XNNXsT5 WLtr0EK769PH2oeOETG54LFovq05Pyh5Kn42XWsWAsWwHVu2ZUxenuQ2e3DxbXzkXqEB AiQA== 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, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Rather than manually creating an SG table in an incorrect way, let the standard dma_get_sgtable() function do it. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/gem.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c index 7412e23500d1..3345cce14662 100644 --- a/drivers/gpu/drm/tegra/gem.c +++ b/drivers/gpu/drm/tegra/gem.c @@ -520,11 +520,9 @@ tegra_gem_prime_map_dma_buf(struct dma_buf_attachment *attach, if (dma_map_sg(attach->dev, sgt->sgl, sgt->nents, dir) == 0) goto free; } else { - if (sg_alloc_table(sgt, 1, GFP_KERNEL)) + if (dma_get_sgtable(attach->dev, sgt, bo->vaddr, bo->iova, + gem->size) < 0) goto free; - - sg_dma_address(sgt->sgl) = bo->iova; - sg_dma_len(sgt->sgl) = gem->size; } return sgt; From patchwork Mon Oct 14 12:50:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11188709 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CD58B1575 for ; Mon, 14 Oct 2019 12:51:26 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B566621835 for ; Mon, 14 Oct 2019 12:51:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B566621835 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D782E6E2D1; Mon, 14 Oct 2019 12:51:25 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id 732A66E2D1 for ; Mon, 14 Oct 2019 12:51:21 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id 7so17172910wme.1 for ; Mon, 14 Oct 2019 05:51:21 -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:mime-version:content-transfer-encoding; bh=L6DFI3lr21cxldQszCfNagwz6ouXjHUUOPmyE9u059w=; b=KqkUakKtBaLigBc3ecNGqjOWMvAIQwmtUe5FchKQ+UuNA4jNat9S2vpwPmHT7Y7/fL PG7PXC7yV/2dtxdLM+xZlk/+AtYUJ0j3Q8cnMfT0xc1DYjRotwF6LY8d9szthVkeRMU+ J4UM15g+mxH+ryUHPSZGMjIn7ErvxoFk97IZzUali5vOsrbqkAlOOuOgGJKPa27XmK7n B/zOSbuispsJGbuUKpluqY4O2OoawBxVLhKKMfM5yqlQwqalrhJvOMnOuBG41+ZzBXC6 pTt0TyfI8Rhy6OD+NnO+Z6C0HUcmMgNccvFuBZTBrO+Gf+uIyAoap/jB5xpYFp/ApjeR gRZQ== X-Gm-Message-State: APjAAAVggoFsNjpObqKMoo/F8HsOTDaxPBKEcuCZjrzGTYABR2Blljxz Mxn5vqy3VzXujDEy5XeoHbg= X-Google-Smtp-Source: APXvYqyN/LerxskEetZ2/hwohnBAAPRhjP7KDY4Of6Q6oxq2vm6c4N3iagQzsL2fEAFxN5yMJQiWCg== X-Received: by 2002:a7b:ce88:: with SMTP id q8mr14001743wmj.160.1571057479883; Mon, 14 Oct 2019 05:51:19 -0700 (PDT) Received: from localhost (p2E5BE2CE.dip0.t-ipconnect.de. [46.91.226.206]) by smtp.gmail.com with ESMTPSA id t123sm31334879wma.40.2019.10.14.05.51.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 05:51:19 -0700 (PDT) From: Thierry Reding To: Thierry Reding Subject: [PATCH 13/14] drm/tegra: gem: Always map SG tables for DMA-BUFs Date: Mon, 14 Oct 2019 14:50:48 +0200 Message-Id: <20191014125049.425101-14-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191014125049.425101-1-thierry.reding@gmail.com> References: <20191014125049.425101-1-thierry.reding@gmail.com> MIME-Version: 1.0 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:in-reply-to:references :mime-version:content-transfer-encoding; bh=L6DFI3lr21cxldQszCfNagwz6ouXjHUUOPmyE9u059w=; b=iPgItiXtpgKKBpeS125en/RKu/Hj7ylehRo9pfmYEoVm4ncJ24VHPmBL8B8VHBw+3a UiB1RotVHIX7OrWZooxiKLMKlVGj7rmjPPWoPvXbnNCHDg0+YvwpA2h3kbpxVeWVORs+ yHtQR19gSg3+/qHaJCo0doaCnxQWUCocX/Ly5oD5XEE15JDH/DvDa7tNCSgAIbwZRLEO nkGkn72PnO6vxoGEGqiszfYpQLNtCQqPYfnvLAb6gBQaiCMvkMiQ38c7TCZlk+SO90nS khUeK9b3HJh4m1voNL4vYIGAktkhbts7c9GwdwrvcJgKcgnoHz/bXR+xj8gaFz4WFDeb xA9Q== 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, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding When an importer wants to map a DMA-BUF, make sure to always actually map it, irrespective of whether the buffer is contiguous or not. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/gem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c index 3345cce14662..00701cadaceb 100644 --- a/drivers/gpu/drm/tegra/gem.c +++ b/drivers/gpu/drm/tegra/gem.c @@ -516,15 +516,15 @@ tegra_gem_prime_map_dma_buf(struct dma_buf_attachment *attach, for_each_sg(sgt->sgl, sg, bo->num_pages, i) sg_set_page(sg, bo->pages[i], PAGE_SIZE, 0); - - if (dma_map_sg(attach->dev, sgt->sgl, sgt->nents, dir) == 0) - goto free; } else { if (dma_get_sgtable(attach->dev, sgt, bo->vaddr, bo->iova, gem->size) < 0) goto free; } + if (dma_map_sg(attach->dev, sgt->sgl, sgt->nents, dir) == 0) + goto free; + return sgt; free: From patchwork Mon Oct 14 12:50:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11188711 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4FA931575 for ; Mon, 14 Oct 2019 12:51:29 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 37D4721848 for ; Mon, 14 Oct 2019 12:51:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 37D4721848 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 366CE6E2D7; Mon, 14 Oct 2019 12:51:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0625E6E2D1 for ; Mon, 14 Oct 2019 12:51:24 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id y21so16640829wmi.0 for ; Mon, 14 Oct 2019 05:51:24 -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:mime-version:content-transfer-encoding; bh=T0xL/iDkEL+mRgHC/hRILKSEGgtjkYP7/04WXy0TU5c=; b=W2TJ4PPpsL7NASsagkdGmBWQuStTZmX8Czrab2i2fNMeUCWTdPI0NHEHQf8Pd40J+b vWNtZCAD/AVP01uX+CRWoNqJktkQArvaxDNLvRzGB3F/bDhJhL9EJ1meklMon+AktNd/ aN4+2mvi+oGVPHjfufjTW7MjvbeEDWy9ZyXWQeMfwBhp6gir5W05biXnoPMqVA3TRjVF ImQODvqIAsawBr7zdy/TK5+fTJdI19UG4Z1ABiimMmhHw8OyYUXBXYR8zT0m5L+9179Q lnue7Rzzz/AZiglWYPMX4wZLccpiZdvAdIlk/JcAR/NskFBMcekDxFKLDHeaoqQc1u4b SnUQ== X-Gm-Message-State: APjAAAVCGnKWpZcLdMdRlmy7R+cRvBXFJFIQ6MqfNXKqXzPnkI4qDZbA +91Z04AjJvh3rjPJLuwX1mw= X-Google-Smtp-Source: APXvYqy4hQZbCr4bXF44azC0xINbKmfHk3TGROlTqQmbYp9gts0pMzgY0rJb683HGAO9RY464ZaW0Q== X-Received: by 2002:a1c:f60d:: with SMTP id w13mr15847792wmc.150.1571057481904; Mon, 14 Oct 2019 05:51:21 -0700 (PDT) Received: from localhost (p2E5BE2CE.dip0.t-ipconnect.de. [46.91.226.206]) by smtp.gmail.com with ESMTPSA id a192sm16440939wma.1.2019.10.14.05.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 05:51:20 -0700 (PDT) From: Thierry Reding To: Thierry Reding Subject: [PATCH 14/14] drm/tegra: gem: Use sg_alloc_table_from_pages() Date: Mon, 14 Oct 2019 14:50:49 +0200 Message-Id: <20191014125049.425101-15-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191014125049.425101-1-thierry.reding@gmail.com> References: <20191014125049.425101-1-thierry.reding@gmail.com> MIME-Version: 1.0 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:in-reply-to:references :mime-version:content-transfer-encoding; bh=T0xL/iDkEL+mRgHC/hRILKSEGgtjkYP7/04WXy0TU5c=; b=oQ2Y1lnIBaHHF4NPbEeUhTFXJAFOjbYO1SZBlITCO+R2+00RLcbPQU3SF9W5KAKV1d JuEtjQFDwm0IhwXV8fZ3d0Pc3sSMUnUrhyziBQKy97RFxdEGMOxENwpW8SqOuGKuDgvE wAUkkwB2HFFyiWo9wc5zLjuJ3ThbdZyaaEKX+JMVtf4tPpElZkZ1zr85Ymmiiz9x9tx0 dTERRZ3SR9eL/8wzZn0yW9npRXzj5FHKao8F3ffjJEbbLs0glkFZHjmYLYE3xNa7L/pd ByUbsXvO6xnUXoBHvna2lv3zdugigTJ1RlC7HM7WXviadepy4eiDCETOEYzZLqId1UVG DujQ== 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, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Instead of manually creating the SG table for a discontiguous buffer, use the existing sg_alloc_table_from_pages(). Note that this is not safe to be used with the ARM DMA/IOMMU integration code because that will not ensure that the whole buffer is mapped contiguously. Depending on the size of the individual entries the mapping may end up containing holes to ensure alignment. However, we only ever use these buffers with explicit IOMMU API usage and know how to avoid these holes. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/gem.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c index 00701cadaceb..d2f88cc3134f 100644 --- a/drivers/gpu/drm/tegra/gem.c +++ b/drivers/gpu/drm/tegra/gem.c @@ -508,14 +508,9 @@ tegra_gem_prime_map_dma_buf(struct dma_buf_attachment *attach, return NULL; if (bo->pages) { - struct scatterlist *sg; - unsigned int i; - - if (sg_alloc_table(sgt, bo->num_pages, GFP_KERNEL)) + if (sg_alloc_table_from_pages(sgt, bo->pages, bo->num_pages, + 0, gem->size, GFP_KERNEL) < 0) goto free; - - for_each_sg(sgt->sgl, sg, bo->num_pages, i) - sg_set_page(sg, bo->pages[i], PAGE_SIZE, 0); } else { if (dma_get_sgtable(attach->dev, sgt, bo->vaddr, bo->iova, gem->size) < 0)