From patchwork Thu Nov 28 15:37:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11266285 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 C39E714B7 for ; Thu, 28 Nov 2019 15:37:56 +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 AA95E21781 for ; Thu, 28 Nov 2019 15:37:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA95E21781 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 0844389C05; Thu, 28 Nov 2019 15:37:56 +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 ECB3C89A32 for ; Thu, 28 Nov 2019 15:37:46 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id b11so11353995wmj.4 for ; Thu, 28 Nov 2019 07:37:46 -0800 (PST) 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=FuaMjHIYXz5VbkPp7vbASLG/rrUrkAh/Y4RiebzPwjs=; b=AWM7g0K2cD31vMxCZHvzXMn8671mah5v8O5Gz1oeOgcqglAdtrCWJ0FFgpwtEC51wA e0maYxgbWkeRnBw5X1QiiYBFQpu8m3b363n0MblAIEWfCiJICaWUsF2DBSh1QFvQaUdO s6ZIiOUVHXhUjv52PdDicu+8Zil1sjDC5sTNZoon7drY0E5Cb1BcLCDOZ24MBfQ33Aq/ 0OV+uXvzH9V89drxEK6vzseWIHYv2pwMEPLTnfNXs0ZT2mx/3XZ2ydz++BdZ4tp9EJCn eG1CVefucrXY7rRgu9QjYulKBuF+DYvF+gdhIxqmPBac2cYFXcyqqz9fpPBZfHq5lS7f OI7A== X-Gm-Message-State: APjAAAWRtzQ1NhdRLS3P32R/UFLfAa1Jw4sP44UNSd/kQ9Y0A1bSs8ud nYSLqLcKRiX3ijchTGRIQDE= X-Google-Smtp-Source: APXvYqz3xn9e/51N3n2xNkmI65xr2AXQvgtC2eYygg+gDmItvMgd2G741V/Gq9zZHrNaDz+YYsbjIQ== X-Received: by 2002:a1c:2b82:: with SMTP id r124mr10347797wmr.112.1574955465466; Thu, 28 Nov 2019 07:37:45 -0800 (PST) Received: from localhost (pD9E518ED.dip0.t-ipconnect.de. [217.229.24.237]) by smtp.gmail.com with ESMTPSA id c1sm23139312wrs.24.2019.11.28.07.37.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2019 07:37:44 -0800 (PST) From: Thierry Reding To: Thierry Reding Subject: [PATCH 1/9] drm/tegra: hub: Remove bogus connection mutex check Date: Thu, 28 Nov 2019 16:37:33 +0100 Message-Id: <20191128153741.2380419-2-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191128153741.2380419-1-thierry.reding@gmail.com> References: <20191128153741.2380419-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=FuaMjHIYXz5VbkPp7vbASLG/rrUrkAh/Y4RiebzPwjs=; b=arJ/EiNSglJZooI0IbSwGn/phEGeIcEiQBRbY5c79Z0DlyHqdtluiaLR8Umjwj+K/+ 1V2gaVPdNHfbO1Oa0zuObZ20yVDuGnjpXTByLmvFY/zbZnFRMhBSnDrMbM9nPByW0xAO oSoqpOBVKIH269zBTr7Wjv1c0Qlfq1ijiLjD7Xin5qStp+tKNaAGTmBkdHhT+Zq55z/S 1PjTtUTJvXCBbKODwbRivMN7UA5CoQJNWDih6P9uADojnFjgSa2nXpfMRGawWneF+leT vSvXQDF4m71q+JqhUarq963w0+jl22pGjJdF9Age5CIRDEozWdOZGrPG11SwN3CIvSDx 9ARg== 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 I have no recollection why that check is there, but it seems to trigger all the time, so remove it. Everything works fine without. Signed-off-by: Thierry Reding Reviewed-by: Daniel Vetter --- drivers/gpu/drm/tegra/hub.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/gpu/drm/tegra/hub.c b/drivers/gpu/drm/tegra/hub.c index 6aca0fd5a8e5..e56c0f7d3a13 100644 --- a/drivers/gpu/drm/tegra/hub.c +++ b/drivers/gpu/drm/tegra/hub.c @@ -615,11 +615,8 @@ static struct tegra_display_hub_state * tegra_display_hub_get_state(struct tegra_display_hub *hub, struct drm_atomic_state *state) { - struct drm_device *drm = dev_get_drvdata(hub->client.parent); struct drm_private_state *priv; - WARN_ON(!drm_modeset_is_locked(&drm->mode_config.connection_mutex)); - priv = drm_atomic_get_private_obj_state(state, &hub->base); if (IS_ERR(priv)) return ERR_CAST(priv); From patchwork Thu Nov 28 15:37:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11266283 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 AFDD91393 for ; Thu, 28 Nov 2019 15:37:52 +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 9790621781 for ; Thu, 28 Nov 2019 15:37:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9790621781 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 9192889B3B; Thu, 28 Nov 2019 15:37:51 +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 AB48A89A32 for ; Thu, 28 Nov 2019 15:37:48 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id j18so7697122wmk.1 for ; Thu, 28 Nov 2019 07:37:48 -0800 (PST) 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=dNaoo3mI+xfZVrHcwdtziDtvG7sdJdHcDl5YU1IbCPI=; b=SvMkvqhfJeu/3qvtl2nshZ1xUGzOahFkCOYBJhWMnFEx/UH/g6PIz8g9xENQB9LzwF +7tB5BMAjlAO6tY/01tbw/W3RR1aktwWsCYIWiHiWtAJ+0oeiG0ji/AZG7n0W4Iy8IeB EwFoABqdN3b53dDBE9rkxx/l7AN6c5gAsrpXsQnsoo06hDRXPUpX7sipr5Dw9b5onGa1 6d0EB+flIlVnxcQ/tgm4D5RPdN3mv0zU1KXVYAvFBpV793t5xTKe7MSehWPORdord35X nNazTt7zT1DUbDNtbYtO9WvSTvXxwao3dd5gA33olMq9+k+CxskQd/SvLgg5Q0FiPhxD kVsw== X-Gm-Message-State: APjAAAXTaGr5l0hzNVLgoMGbC/K9YjmIMGGp6zkDMOJIUh97h6rPhS73 VAhJGRQo4Qy7P5pdZ2ImwbY= X-Google-Smtp-Source: APXvYqzoiFXF+tYKLyY+hdee6OAJkYHDs/CjucImZ7iJ1DslaZ2xMNDMpFVD7kmM4nZlKtPsYeO6fw== X-Received: by 2002:a1c:4e1a:: with SMTP id g26mr10460607wmh.138.1574955467207; Thu, 28 Nov 2019 07:37:47 -0800 (PST) Received: from localhost (pD9E518ED.dip0.t-ipconnect.de. [217.229.24.237]) by smtp.gmail.com with ESMTPSA id a3sm1323242wmh.5.2019.11.28.07.37.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2019 07:37:46 -0800 (PST) From: Thierry Reding To: Thierry Reding Subject: [PATCH 2/9] drm/tegra: gem: Properly pin imported buffers Date: Thu, 28 Nov 2019 16:37:34 +0100 Message-Id: <20191128153741.2380419-3-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191128153741.2380419-1-thierry.reding@gmail.com> References: <20191128153741.2380419-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=dNaoo3mI+xfZVrHcwdtziDtvG7sdJdHcDl5YU1IbCPI=; b=A02Ea3PDZO6vcgy0N6CnvrNeKVCYmC8EdeKZvajIZfa2c6r+VRck/zUsN5UwHpSuRM X7kx5yVWo3NcbuDOVOT9xjkUoae6pXA0AUpUyJPM2K7JEiM08ZmpqnOjIV9LHdWauIs9 vrK0hP2mbyQ+Xaz5I0RGa0L/aYEMWoBqcUDXknB4wJN6J5G3xJLlpT9i9HRTpPF0Bl/o bPqsjM29bzR0hfJoqgF4Rpd2EjWUm06ai/Rb+hocVj8fUpotxuEL2jM5a0zbbMfY9EI1 9Npvr+rAgeuIooH+BXmOWoKNfFzjKJez05QTGBrq33SjFc2GIw9Sqr10j21U1XbjInOP peoQ== 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 Buffers that are imported from a DMA-BUF don't have pages allocated with them. At the same time an SG table for them can't be derived using the DMA API helpers because the necessary information doesn't exist. However there's already an SG table that was created during import, so this can simply be duplicated. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/gem.c | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c index 746dae32c484..6dfad56eee2b 100644 --- a/drivers/gpu/drm/tegra/gem.c +++ b/drivers/gpu/drm/tegra/gem.c @@ -27,6 +27,29 @@ static void tegra_bo_put(struct host1x_bo *bo) drm_gem_object_put_unlocked(&obj->gem); } +/* XXX move this into lib/scatterlist.c? */ +static int sg_alloc_table_from_sg(struct sg_table *sgt, struct scatterlist *sg, + unsigned int nents, gfp_t gfp_mask) +{ + struct scatterlist *dst; + unsigned int i; + int err; + + err = sg_alloc_table(sgt, nents, gfp_mask); + if (err < 0) + return err; + + dst = sgt->sgl; + + for (i = 0; i < nents; i++) { + sg_set_page(dst, sg_page(sg), sg->length, 0); + dst = sg_next(dst); + sg = sg_next(sg); + } + + return 0; +} + static struct sg_table *tegra_bo_pin(struct device *dev, struct host1x_bo *bo, dma_addr_t *phys) { @@ -52,11 +75,31 @@ static struct sg_table *tegra_bo_pin(struct device *dev, struct host1x_bo *bo, return ERR_PTR(-ENOMEM); if (obj->pages) { + /* + * If the buffer object was allocated from the explicit IOMMU + * API code paths, construct an SG table from the pages. + */ err = sg_alloc_table_from_pages(sgt, obj->pages, obj->num_pages, 0, obj->gem.size, GFP_KERNEL); if (err < 0) goto free; + } else if (obj->sgt) { + /* + * If the buffer object already has an SG table but no pages + * were allocated for it, it means the buffer was imported and + * the SG table needs to be copied to avoid overwriting any + * other potential users of the original SG table. + */ + err = sg_alloc_table_from_sg(sgt, obj->sgt->sgl, obj->sgt->nents, + GFP_KERNEL); + if (err < 0) + goto free; } else { + /* + * If the buffer object had no pages allocated and if it was + * not imported, it had to be allocated with the DMA API, so + * the DMA API helper can be used. + */ err = dma_get_sgtable(dev, sgt, obj->vaddr, obj->iova, obj->gem.size); if (err < 0) From patchwork Thu Nov 28 15:37:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11266293 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 CC0DB14B7 for ; Thu, 28 Nov 2019 15:38: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 B3A7C2084D for ; Thu, 28 Nov 2019 15:38:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B3A7C2084D 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 F201B6E845; Thu, 28 Nov 2019 15:38:10 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7002A89A32 for ; Thu, 28 Nov 2019 15:37:50 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id z7so28211586wrl.13 for ; Thu, 28 Nov 2019 07:37:50 -0800 (PST) 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=1T7/AcKP+hhj8SOL+bY3lDT9n71bxZ0GZTUy8vWuG2g=; b=qy3hWbU9kETYMvMqP37HkajAq5xA3S5+ewKvj79yfOL9OtV3kfGvO4tlqHz6vaZSKH bg2h182Uit0wS+awdTCKRUM03WosmsBX3bGGJTq8eUf1XJV+/994vO4Qyxdg76320G68 um4c+Lt2LbyY7kZBaCMp/SILI7eoHcUePQ5kj2lKfk5K161A0rba+UZFlWeI8gprmwZ1 zl27T1qRMCPqWR7mBxTwumwJ7HT9wr/Zr9Q5aop7PHXCcCBM8owb7Ey1MWXwb4G+Pc1r pMPt19lAt8IK7cVGesLWm9OviOKXwUnpvwsbV2Ob5qGab+HPyYf/s/3bZONheavQ4xtI suJQ== X-Gm-Message-State: APjAAAXkpLbVnVK9zVUsYnEt0TLcoy52FH9BeLkCEm2STEuvk3TjXhwk W4tpqL6Kgt1xcZYVzvUYT6U= X-Google-Smtp-Source: APXvYqxKLainoNtcc0HDYljhnL3r7ynNz0rfcrAvv/OaB23srWIx2DeO4OnP3I8objnbbNwISXF4/A== X-Received: by 2002:adf:ec48:: with SMTP id w8mr1044845wrn.19.1574955468937; Thu, 28 Nov 2019 07:37:48 -0800 (PST) Received: from localhost (pD9E518ED.dip0.t-ipconnect.de. [217.229.24.237]) by smtp.gmail.com with ESMTPSA id l26sm10811590wmj.48.2019.11.28.07.37.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2019 07:37:48 -0800 (PST) From: Thierry Reding To: Thierry Reding Subject: [PATCH 3/9] drm/tegra: gem: Remove premature import restrictions Date: Thu, 28 Nov 2019 16:37:35 +0100 Message-Id: <20191128153741.2380419-4-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191128153741.2380419-1-thierry.reding@gmail.com> References: <20191128153741.2380419-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=1T7/AcKP+hhj8SOL+bY3lDT9n71bxZ0GZTUy8vWuG2g=; b=Tpd2Ng5wKj1h9mYegR6CcgORwfu+unKC6Z52kdP+Lh8xc10PYhNiJMKy1fXhyhMNe4 EVEm0JMyoShZpbXGeWhr8DR0AgVeWVyQXNjxoA6vP0FJeWexKJeo5Ctl4u3sYLoNiaV5 c5w1G38jZojKpu3AwC3MieqnPKVXIkaaF0Fw1kO1o/e19vzRs9dW1W7zrIqsksMksmis c2v8QLm6zuLIvc5WreVea9H2sEdgfwQ1Mz7QZJApfymVkwHJNLCViktOX9GXw+o7Dtja 11UbqMN2ADA9pIh4RJizyvCeZWzcVkoDmrF9idnwTQ4Wxpj3/yqAtjBFT0IbIMGW5NHP w/PQ== 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 not known at import time whether or not all users of a DMA-BUF will be able to deal with non-contiguous memory. Each user needs to verify at map-time whether it can access the buffer. Signed-off-by: Thierry Reding Reviewed-by: Daniel Vetter --- drivers/gpu/drm/tegra/gem.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c index 6dfad56eee2b..bc15b430156d 100644 --- a/drivers/gpu/drm/tegra/gem.c +++ b/drivers/gpu/drm/tegra/gem.c @@ -440,13 +440,6 @@ static struct tegra_bo *tegra_bo_import(struct drm_device *drm, err = tegra_bo_iommu_map(tegra, bo); if (err < 0) goto detach; - } else { - if (bo->sgt->nents > 1) { - err = -EINVAL; - goto detach; - } - - bo->iova = sg_dma_address(bo->sgt->sgl); } bo->gem.import_attach = attach; From patchwork Thu Nov 28 15:37: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: 11266295 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 70B481393 for ; Thu, 28 Nov 2019 15:38: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 581BC2084D for ; Thu, 28 Nov 2019 15:38:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 581BC2084D 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 16AB26E847; Thu, 28 Nov 2019 15:38:11 +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 8574589C05 for ; Thu, 28 Nov 2019 15:37:52 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id b11so11354248wmj.4 for ; Thu, 28 Nov 2019 07:37:52 -0800 (PST) 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=HrdYqIJ8Cxshs6Aa/bHGdGgDvlNcq34vR+c5j3HYNtA=; b=IKCURifBU+t2mgad2WvT21H/fnz33IjdFS0Yigms2hSSJpeP/3wK7Vyatyokzr/ASl TpwnAkYe5N20XuHgBoYvEmRUy8MiK57xiSDzAQIllvENO0ozQV1cQMMQE8ExQJcWYXOF ZdNSHUxFV7aFojdqM7Lgo096dS1/vBSdqv2qNO3hyG9j5DR+NKW8WKnoktc7l/37niXD 9UnhvBl+ytvDr0Jf4o4Dfyv4SatbirUUrpRN+cKV5nonpx1XZ1acbg7SoeolE4ElutYG 3eyHdGejMHIFYRdO8dDG5gmXwq+GHzXGe3Q/Yo+qpvr2TZN6V5DtHunJZt2TJfRbqWuK 5CWg== X-Gm-Message-State: APjAAAV+Cjo+fqdVtbQ++0MDXkp6FOCv/Vx11JiYWOhaVk/9JBm2sa1K J+/xyA6vt2YX7QdPg0LUV9mMtHVIDp4= X-Google-Smtp-Source: APXvYqz8SKwAvHY3TytakMY5iSY6gVr7NcSbL5ZBcKy9HT6jLMl11Qps6inph4HJyMHNHUhNhtWFzg== X-Received: by 2002:a7b:c004:: with SMTP id c4mr9913681wmb.45.1574955471094; Thu, 28 Nov 2019 07:37:51 -0800 (PST) Received: from localhost (pD9E518ED.dip0.t-ipconnect.de. [217.229.24.237]) by smtp.gmail.com with ESMTPSA id s10sm2701711wrw.12.2019.11.28.07.37.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2019 07:37:50 -0800 (PST) From: Thierry Reding To: Thierry Reding Subject: [PATCH 4/9] drm/tegra: Use proper IOVA address for cursor image Date: Thu, 28 Nov 2019 16:37:36 +0100 Message-Id: <20191128153741.2380419-5-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191128153741.2380419-1-thierry.reding@gmail.com> References: <20191128153741.2380419-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=HrdYqIJ8Cxshs6Aa/bHGdGgDvlNcq34vR+c5j3HYNtA=; b=VfoW0WCZF+O9ztW6wTwsZMcCQ8NaJVc1t8TgojB5qpDu8Wi8cwhXomlYqyp7AlR06e eaWEng2jbKbaYA+K81DXFAfcC6m972l2XqOLYlgzrqXbf6DPCveZ7TNQMgT8tVk5sJlO BjMsUVLOE6h4OUQUsdzfYEE2iTL9FzXqylcoAvgpkW/fLJxCwO4r6DNXVZfkvYieAbcA 4ojPNM7FuokCqYnzQ8RoFdFTuqAYZdCtv6gh4IP2ScJ2BbTtXOzbCqo+w5IlJROIGc1h YvunSypP2EUJEOlRbuAbcs8yHk6o7IQnQhKdlLVcGp9s2BLqMgsd+WKYjRwFCTgCL1Aq TcCQ== 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 IOVA address for the cursor is the result of mapping the buffer object for the given display controller. Make sure to use the proper IOVA address as stored in the cursor's plane state. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index d03b33c3b114..0a5f86b61fda 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -847,16 +847,15 @@ static int tegra_cursor_atomic_check(struct drm_plane *plane, static void tegra_cursor_atomic_update(struct drm_plane *plane, struct drm_plane_state *old_state) { - struct tegra_bo *bo = tegra_fb_get_plane(plane->state->fb, 0); + struct tegra_plane_state *state = to_tegra_plane_state(plane->state); struct tegra_dc *dc = to_tegra_dc(plane->state->crtc); - struct drm_plane_state *state = plane->state; u32 value = CURSOR_CLIP_DISPLAY; /* rien ne va plus */ if (!plane->state->crtc || !plane->state->fb) return; - switch (state->crtc_w) { + switch (plane->state->crtc_w) { case 32: value |= CURSOR_SIZE_32x32; break; @@ -874,16 +873,16 @@ static void tegra_cursor_atomic_update(struct drm_plane *plane, break; default: - WARN(1, "cursor size %ux%u not supported\n", state->crtc_w, - state->crtc_h); + WARN(1, "cursor size %ux%u not supported\n", + plane->state->crtc_w, plane->state->crtc_h); return; } - value |= (bo->iova >> 10) & 0x3fffff; + value |= (state->iova[0] >> 10) & 0x3fffff; tegra_dc_writel(dc, value, DC_DISP_CURSOR_START_ADDR); #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT - value = (bo->iova >> 32) & 0x3; + value = (state->iova[0] >> 32) & 0x3; tegra_dc_writel(dc, value, DC_DISP_CURSOR_START_ADDR_HI); #endif @@ -902,7 +901,8 @@ static void tegra_cursor_atomic_update(struct drm_plane *plane, tegra_dc_writel(dc, value, DC_DISP_BLEND_CURSOR_CONTROL); /* position the cursor */ - value = (state->crtc_y & 0x3fff) << 16 | (state->crtc_x & 0x3fff); + value = (plane->state->crtc_y & 0x3fff) << 16 | + (plane->state->crtc_x & 0x3fff); tegra_dc_writel(dc, value, DC_DISP_CURSOR_POSITION); } From patchwork Thu Nov 28 15:37: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: 11266297 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 2CB211393 for ; Thu, 28 Nov 2019 15:38: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 147772084D for ; Thu, 28 Nov 2019 15:38:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 147772084D 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 4DFA66E848; Thu, 28 Nov 2019 15:38:11 +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 83C7389C05 for ; Thu, 28 Nov 2019 15:37:54 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id t2so31628208wrr.1 for ; Thu, 28 Nov 2019 07:37:54 -0800 (PST) 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=e3Cc2//Jedy29iR0NuLCg+mBJ8hMbnZaK6sR0m6EGNQ=; b=dbDsgCj0Ui6dddUGt0oADwo7GE2xneI08onrP6izQ44HEStfPH945yuwkYoVOMEJnt 2czwFeA8dfWKzZoTW4pGOmMgPWfgskC02fESz06Mwjn7nz0WfXR02LMkJP9Gj8tlLkna 4VdrI1WqZ13EjVqdFRp8YcZ5A/JfTyCiqkSdtVsyDVawzW0awwLD/UH6VOZVtZyqQJcF krf41ZRdQbSY9ylFyObitRPfFx71nTK0tjr/3371Xjqz7zSC70XT4mryWHvt5flUgEUQ n4TS7vK/n+vqNJYB+JMmB+QAJkYJOa08vPtJvE/oEyUJv+Qj1M3anid8F+rtwGDEmY62 vDxg== X-Gm-Message-State: APjAAAW/V97MtKli3Sj5DZ9C2DcqMU7AtrHJNNc7o02bzMBYxm3TKEJ/ yeLfUqtKhIOSZE4QUmHGLP31iko0IJU= X-Google-Smtp-Source: APXvYqznLbmloFE8Kzv2U0a0B5MP/NJG2iQfE289tpiPsFMKGQ9gKYgSUMDx8bFN9WzZ44BhSG8VNg== X-Received: by 2002:a5d:4d4a:: with SMTP id a10mr41209977wru.220.1574955473108; Thu, 28 Nov 2019 07:37:53 -0800 (PST) Received: from localhost (pD9E518ED.dip0.t-ipconnect.de. [217.229.24.237]) by smtp.gmail.com with ESMTPSA id a184sm1541637wmf.29.2019.11.28.07.37.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2019 07:37:52 -0800 (PST) From: Thierry Reding To: Thierry Reding Subject: [PATCH 5/9] drm/tegra: sor: Implement system suspend/resume Date: Thu, 28 Nov 2019 16:37:37 +0100 Message-Id: <20191128153741.2380419-6-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191128153741.2380419-1-thierry.reding@gmail.com> References: <20191128153741.2380419-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=e3Cc2//Jedy29iR0NuLCg+mBJ8hMbnZaK6sR0m6EGNQ=; b=RyG9SEIHXQokDPgRMb6Ai6MV7qEqx+HTV6eSrAom/gBWkIthW++azf4Z8u38FcJtPV OBInrLDESevAmWoYj+DyRQ/AeDQL+zEAkkUxQybxeczbP2kLmtq1ywsup/QzS7bG7N0v ByRETWp/bxEky5PmjWQx2TyvSt8MLmp140oRLYjQU85EfFMdtvdjAyAKcKyWZ1hUN5To ug/cFueZ9KYE1BFmMmXnun1B4RaC3wraprTL5v7BuhHkEM4Pj+XXATYC2FbpI66QLoOM PY8kMz0lVFSai3b0Az2Xcjr6HrM6s7Bz3jXKCGHzlGK9LIvXXlgPC+oavPcfudb1kQfP +blA== 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 Upon system suspend, make sure the +5V HDMI regulator is disabled. This avoids potentially leaking current to the HDMI connector. This also makes sure that upon resume the regulator is enabled again, which in some cases is necessary to properly restore the state of the supply on resume. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/sor.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index 615cb319fa8b..2200f4cd397a 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -3912,8 +3912,7 @@ static int tegra_sor_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM -static int tegra_sor_suspend(struct device *dev) +static int tegra_sor_runtime_suspend(struct device *dev) { struct tegra_sor *sor = dev_get_drvdata(dev); int err; @@ -3935,7 +3934,7 @@ static int tegra_sor_suspend(struct device *dev) return 0; } -static int tegra_sor_resume(struct device *dev) +static int tegra_sor_runtime_resume(struct device *dev) { struct tegra_sor *sor = dev_get_drvdata(dev); int err; @@ -3967,10 +3966,25 @@ static int tegra_sor_resume(struct device *dev) return 0; } -#endif + +static int tegra_sor_suspend(struct device *dev) +{ + struct tegra_sor *sor = dev_get_drvdata(dev); + + return regulator_disable(sor->hdmi_supply); +} + +static int tegra_sor_resume(struct device *dev) +{ + struct tegra_sor *sor = dev_get_drvdata(dev); + + return regulator_enable(sor->hdmi_supply); +} static const struct dev_pm_ops tegra_sor_pm_ops = { - SET_RUNTIME_PM_OPS(tegra_sor_suspend, tegra_sor_resume, NULL) + SET_RUNTIME_PM_OPS(tegra_sor_runtime_suspend, tegra_sor_runtime_resume, + NULL) + SET_SYSTEM_SLEEP_PM_OPS(tegra_sor_suspend, tegra_sor_resume) }; struct platform_driver tegra_sor_driver = { From patchwork Thu Nov 28 15:37: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: 11266289 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 793AF1393 for ; Thu, 28 Nov 2019 15:38: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 6119121781 for ; Thu, 28 Nov 2019 15:38:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6119121781 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 1394F89D73; Thu, 28 Nov 2019 15:38: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 98B9C89D67 for ; Thu, 28 Nov 2019 15:37:56 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id b18so31671524wrj.8 for ; Thu, 28 Nov 2019 07:37:56 -0800 (PST) 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=qux6awnp95L6xNm3T6+oYkp3AFsi3QUxGHXoIt7wf6k=; b=mUwa2a+U+tCB4fICmb0tOmjq615TcNWoF1y6apwIJDNJl9l1wVib/JF59KgoVhtrP9 a0SDegaQVwWXYiUiIejQVtqvw7jJNxmQBE6DCRomfVxAKxMgEwOo8/bpqznLLn7uYyjX zNecahe5T2czfmetOcE/XtBMA0Ax8QU/yEMiFq+a6nMK9w1mPEK9W60D1BZ+EQAY85hR srgUAi4RgnYP0ei7Bg6xVbd/bp+MwGHLPvbukNhv9sTTUNsfv42XC11KRHhUUIxXtXeb 3k+I9o5lloLS2kAxoi6OD+VZSa/n+hNs+HJoVQ9YifhRE/71INEwBhDfLtYJOOEQAqkE EAMA== X-Gm-Message-State: APjAAAWCf4aKvAq7qBBbJWvRyQeT2MvuiGxJMT4ORlV3n3Ii7nLvuGOB jj9OOtYBbih8K95QHeiLHwxP8K7Kvmw= X-Google-Smtp-Source: APXvYqwCi2enm9WVk9Vzi9jS5O75DRxVjDMjX+CMd235U8su11RkDUEiTHNvcQkSgYM6QnmzreDmfg== X-Received: by 2002:a5d:5487:: with SMTP id h7mr8000464wrv.396.1574955475125; Thu, 28 Nov 2019 07:37:55 -0800 (PST) Received: from localhost (pD9E518ED.dip0.t-ipconnect.de. [217.229.24.237]) by smtp.gmail.com with ESMTPSA id d14sm10958907wru.9.2019.11.28.07.37.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2019 07:37:54 -0800 (PST) From: Thierry Reding To: Thierry Reding Subject: [PATCH 6/9] drm/tegra: vic: Export module device table Date: Thu, 28 Nov 2019 16:37:38 +0100 Message-Id: <20191128153741.2380419-7-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191128153741.2380419-1-thierry.reding@gmail.com> References: <20191128153741.2380419-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=qux6awnp95L6xNm3T6+oYkp3AFsi3QUxGHXoIt7wf6k=; b=Ul+EHQu58/zzBjdgiA+xRnMIB1WtzSPokN6O7LS3eVKpgAmKdsOgwROqSQ8Odk+Y1v EZ9bvAfT0jIAF5Wr+BM9P2GIilzGyjYx1hK1Ap7p/lV2NdHCj4ksCLEaichMm+Gur5Wc pQKx+DVEaasZjKHzLa37KgAfc0gHWdWLfhr8CRp8qtqesSmsR7aIq6XZr7001WyRj7Mt 1o/qWhbABVisu1a3q1P3duIUCIr4gTNm6KoY1k4EKGf7oGDXDfLL08YyDsnPmCfOmFjO pkZm09G/E4C2MfPbnIgEA5nF+TKegW1+WwygiIRQikRL3p0N3F9h3Uy8CLnJyWcHizU8 PcrQ== 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, Daniel Vetter , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding Export the module device table to ensure the VIC compatible strings are listed in the module's aliases table. This in turn causes the driver to be automatically loaded on boot if VIC is the only enabled subdevice of the logical host1x DRM device. Reviewed-by: Daniel Vetter Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/vic.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c index 9444ba183990..c4d82b8b3065 100644 --- a/drivers/gpu/drm/tegra/vic.c +++ b/drivers/gpu/drm/tegra/vic.c @@ -386,13 +386,14 @@ static const struct vic_config vic_t194_config = { .supports_sid = true, }; -static const struct of_device_id vic_match[] = { +static const struct of_device_id tegra_vic_of_match[] = { { .compatible = "nvidia,tegra124-vic", .data = &vic_t124_config }, { .compatible = "nvidia,tegra210-vic", .data = &vic_t210_config }, { .compatible = "nvidia,tegra186-vic", .data = &vic_t186_config }, { .compatible = "nvidia,tegra194-vic", .data = &vic_t194_config }, { }, }; +MODULE_DEVICE_TABLE(of, tegra_vic_of_match); static int vic_probe(struct platform_device *pdev) { @@ -516,7 +517,7 @@ static const struct dev_pm_ops vic_pm_ops = { struct platform_driver tegra_vic_driver = { .driver = { .name = "tegra-vic", - .of_match_table = vic_match, + .of_match_table = tegra_vic_of_match, .pm = &vic_pm_ops }, .probe = vic_probe, From patchwork Thu Nov 28 15:37: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: 11266287 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 7130E14B7 for ; Thu, 28 Nov 2019 15:38: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 590BC21781 for ; Thu, 28 Nov 2019 15:38:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 590BC21781 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 6168889C3F; Thu, 28 Nov 2019 15:38:00 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by gabe.freedesktop.org (Postfix) with ESMTPS id A202D89C3F for ; Thu, 28 Nov 2019 15:37:58 +0000 (UTC) Received: by mail-wr1-x434.google.com with SMTP id t2so31628468wrr.1 for ; Thu, 28 Nov 2019 07:37:58 -0800 (PST) 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=+Dj5QeGhVIw+jJO0yySFJPhYXfPiaBftwUYyrusaKzY=; b=jWUyFPBfGaSfWfWXXtdcu6z/jTlIzflieW3a1bWaUaiINqnOkANw2GDa2Ud5dIhY0y yeB6GHGQ1PEEbQNjL2k3Jx8ttqm50aqu3L5auhIqm2AM3LRZxuNGoen3/I8AG3cnViFq 5w63J2eyu16ajI1UiwKKKpv9N+OlraYu9qZtQwnPV4nd5BtTSxEaYXkYxBqq70SfoCGO vaOkEGgZzihk3umELKEuWlZF0VlE6xt5/H/vVm7OBU4OCZpsW7gEAfv3mtLAbEGVMbk7 aLzJnc0CvtfT3ry2EOvuS7tnnRnk7A+jZ1E3scGEDf71reAHKCLWwNR10GvgnqnCEcj0 hndQ== X-Gm-Message-State: APjAAAX4ptZQaV5zUB7IjAvMi3utqEEuH2gho/5OIKZGv8IuG4nZ6b6c cDL50Va/aKubLTQsc/OymtM= X-Google-Smtp-Source: APXvYqwS6ivoSIoL1JFkfrZIU83hrx3H7cggPKDcssn9xfif+3YWxM9Ll57LI06q98frR6TkygjpZw== X-Received: by 2002:adf:9427:: with SMTP id 36mr40495496wrq.166.1574955477119; Thu, 28 Nov 2019 07:37:57 -0800 (PST) Received: from localhost (pD9E518ED.dip0.t-ipconnect.de. [217.229.24.237]) by smtp.gmail.com with ESMTPSA id 60sm23844474wrn.86.2019.11.28.07.37.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2019 07:37:56 -0800 (PST) From: Thierry Reding To: Thierry Reding Subject: [PATCH 7/9] drm/tegra: Silence expected errors on IOMMU attach Date: Thu, 28 Nov 2019 16:37:39 +0100 Message-Id: <20191128153741.2380419-8-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191128153741.2380419-1-thierry.reding@gmail.com> References: <20191128153741.2380419-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=+Dj5QeGhVIw+jJO0yySFJPhYXfPiaBftwUYyrusaKzY=; b=cqT7e+42pcBLNUzMN1laPcYNlu1zTORQr2TV7bJdnQlTWu4bwC9aJkxcRknC91wrVQ VMJqdr/fksMMm/pyo2cJRP8DXDjHnQk4U0xC8eQ5Q2eB1iwzJBfU3teahBAnrj/j4duT koKAM9qrs4ZmhmvRz3gK+U/6YuEeR6+gc77WUyXSY+C7VuV0DVp1+b88VZ5vGJaJYAU8 6N2HFCQ9IX+xEEfLzBBIMnFLhFRYpMCvoRZin3ZVmcQCNBtWYwBgu8aaA8w7z5j1rFHo JZPpQni4vP1rrwt1RzrOoJkVES4hkRIu2IJhyUTSHUT0fwSblrnzSV31BFMtBQSjcdNc /Trw== 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 Subdevices may not be hooked up to an IOMMU via device tree. Detect such situations and avoid confusing users by not emitting an error message. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dc.c | 2 +- drivers/gpu/drm/tegra/drm.c | 4 +--- drivers/gpu/drm/tegra/vic.c | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 0a5f86b61fda..2b9a25c977c0 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -2027,7 +2027,7 @@ static int tegra_dc_init(struct host1x_client *client) dev_warn(dc->dev, "failed to allocate syncpoint\n"); err = host1x_client_iommu_attach(client); - if (err < 0) { + if (err < 0 && err != -ENODEV) { dev_err(client->dev, "failed to attach to domain: %d\n", err); return err; } diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 56e5e7a5c108..7a16b51eaa2d 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -920,10 +920,8 @@ int host1x_client_iommu_attach(struct host1x_client *client) if (tegra->domain) { group = iommu_group_get(client->dev); - if (!group) { - dev_err(client->dev, "failed to get IOMMU group\n"); + if (!group) return -ENODEV; - } if (domain != tegra->domain) { err = iommu_attach_group(tegra->domain, group); diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c index c4d82b8b3065..3526c2892ddb 100644 --- a/drivers/gpu/drm/tegra/vic.c +++ b/drivers/gpu/drm/tegra/vic.c @@ -167,7 +167,7 @@ static int vic_init(struct host1x_client *client) int err; err = host1x_client_iommu_attach(client); - if (err < 0) { + if (err < 0 && err != -ENODEV) { dev_err(vic->dev, "failed to attach to domain: %d\n", err); return err; } From patchwork Thu Nov 28 15:37: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: 11266291 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 1D98A14B7 for ; Thu, 28 Nov 2019 15:38:12 +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 054A521781 for ; Thu, 28 Nov 2019 15:38:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 054A521781 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 A0CD36E822; Thu, 28 Nov 2019 15:38:10 +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 6368689D67 for ; Thu, 28 Nov 2019 15:38:00 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id z3so31635813wru.3 for ; Thu, 28 Nov 2019 07:38:00 -0800 (PST) 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=0dzbVXJ7V8hcU1LtMIPexGVLsK0+2tdodZ/4GZpJrGQ=; b=UCvHa3QI+SSOV9zseWd3zN1CQOu33LthVBX8oLdEBlCBv8iA92gvJoCi0MCoiFvZAp eTwBCNsyf24xjjYXMW1ae33+zrSShNWegWKFLBXL3dPLwpJAny9DgN/xVjIRMw9mL7tv +iA5eTybStEACA90c6ctJJ4SAxl8vyiVQwuNuEvRiEiCv2r5T3p5toFxdoImgnaWfT7O kYvOhImJQnS4ty5g1tB+ttpC3+q2W8aB7TPxteq6tR6L9Vi8xFVEY1rIOSKC34M+mv1p KKVtsQBlRSt1xfLgE8UGcxEsv69u/Hkg29auqjr3rMO6ernThHUzse9iwfxHos3Wrswn 4Okg== X-Gm-Message-State: APjAAAV7qK8wtOVkzp+QnqpCyOVVmhMNCQ9d4C0jqf1zdb0hqSYJ55N6 hsjCs2XCLmRnNtRwkOV+EQG1P+ZXbaA= X-Google-Smtp-Source: APXvYqwN6jeHqpiergoAp6H44RRaiLz+Bep/6Nl1tHZ/cpDeXEHqkAVIY9PD5yeg/w5+Yv36571D4A== X-Received: by 2002:adf:f802:: with SMTP id s2mr17381533wrp.201.1574955478979; Thu, 28 Nov 2019 07:37:58 -0800 (PST) Received: from localhost (pD9E518ED.dip0.t-ipconnect.de. [217.229.24.237]) by smtp.gmail.com with ESMTPSA id q3sm1858695wrn.33.2019.11.28.07.37.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2019 07:37:58 -0800 (PST) From: Thierry Reding To: Thierry Reding Subject: [PATCH 8/9] drm/tegra: dpaux: Add missing runtime PM references Date: Thu, 28 Nov 2019 16:37:40 +0100 Message-Id: <20191128153741.2380419-9-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191128153741.2380419-1-thierry.reding@gmail.com> References: <20191128153741.2380419-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=0dzbVXJ7V8hcU1LtMIPexGVLsK0+2tdodZ/4GZpJrGQ=; b=WqZ/47EKwwoGBWxgT/2GeoCq0+nbfB28gH8NAOmaWg8LYI9qJGORY/MDy1ojv8+P38 AvNWstImqj2TYDREPetx+/GdEXvi+K81npK6H7j3fMrhLsQxuFQnQ2HW2y7DQ/h5cYQ+ MPJHNqxmCWDQVav3wIPaYhGVn5VJqEFUQ+snIlTO+A84tSHnbGpRSf4nYXQlUNgJf6Cg eYc3l7NeJSfXrBQDC5dwmFawt/Prsuxu/42NCoOVgTqvrzWs9vayr1VzFoXY/1VUKeRU rLjD6DeIr3/G+R7rHqo0ezvBQfUH850fgrY0kcPYjlx7JkVm/+YuAad3CoGDKOzhenkC bsiQ== 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 Ensure that a runtime PM reference is acquired each time the DPAUX registers are accessed. Otherwise the code may end up running without the controller being powered, out-of-reset or clocked in some corner cases, resulting in a crash. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/dpaux.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c index 622cdf1ad246..4b2b86aed1a5 100644 --- a/drivers/gpu/drm/tegra/dpaux.c +++ b/drivers/gpu/drm/tegra/dpaux.c @@ -434,8 +434,13 @@ static int tegra_dpaux_set_mux(struct pinctrl_dev *pinctrl, unsigned int function, unsigned int group) { struct tegra_dpaux *dpaux = pinctrl_dev_get_drvdata(pinctrl); + int err; + + pm_runtime_get_sync(dpaux->dev); + err = tegra_dpaux_pad_config(dpaux, function); + pm_runtime_put(dpaux->dev); - return tegra_dpaux_pad_config(dpaux, function); + return err; } static const struct pinmux_ops tegra_dpaux_pinmux_ops = { @@ -809,15 +814,22 @@ enum drm_connector_status drm_dp_aux_detect(struct drm_dp_aux *aux) int drm_dp_aux_enable(struct drm_dp_aux *aux) { struct tegra_dpaux *dpaux = to_dpaux(aux); + int err; + + pm_runtime_get_sync(dpaux->dev); + err = tegra_dpaux_pad_config(dpaux, DPAUX_PADCTL_FUNC_AUX); + pm_runtime_put(dpaux->dev); - return tegra_dpaux_pad_config(dpaux, DPAUX_PADCTL_FUNC_AUX); + return err; } int drm_dp_aux_disable(struct drm_dp_aux *aux) { struct tegra_dpaux *dpaux = to_dpaux(aux); + pm_runtime_get_sync(dpaux->dev); tegra_dpaux_pad_power_down(dpaux); + pm_runtime_put(dpaux->dev); return 0; } From patchwork Thu Nov 28 15:37: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: 11266299 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 500341393 for ; Thu, 28 Nov 2019 15:38:28 +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 37C6021781 for ; Thu, 28 Nov 2019 15:38:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 37C6021781 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 61DB96E84A; Thu, 28 Nov 2019 15:38:27 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 508B96E822 for ; Thu, 28 Nov 2019 15:38:02 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id z7so28212317wrl.13 for ; Thu, 28 Nov 2019 07:38:02 -0800 (PST) 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=DZWNjGPJrA9TiLgOiM42Wa6pCMxexw+xtFbZOuu9Dj0=; b=P0RluODebqO0qRfqM1iy6XdAkSq++zXIpm77sivraQaOttmA+3Qir0GsFiXx7T5W6E VLrPj3T+u5dL78QXHTlkXr1nedQgsMcW/ieb/wTBoKr6DwHBEqSB/DUcYF+LPV1J9OML yGash2eaJQnPswNucAPthFq4Uzm51xkmMMV9WdViLVP4EfmShVhNj2HDODSPF7rnPnZp sTNxEOBrsYuW5fRtVTa2TqCjmb3dEQTXrFL4EFryizBB59SrnrB3CSQAyfmipRRTkoqi eg/81jw1mb0yp5aqjiOB+ZRmnSKWFxcHk1EJiVI+0DLPIgDyHxFDZZZQ5wJQGup/ZYPK kxUg== X-Gm-Message-State: APjAAAUcsEsBPYzBV6qgRF5CTZHCNqNA/zTGaD2pjx8wdFX8avOBisLN 4ox/F9pMhu0JsAtXt4BPILI= X-Google-Smtp-Source: APXvYqxY00AlQiRyW3tG6/BnHI8I8iDyWl6zJrMYZ8i9WUIigDI2zW81I6BGYQR6FwxL4UuWXDfaJg== X-Received: by 2002:a5d:46c7:: with SMTP id g7mr13891032wrs.11.1574955480883; Thu, 28 Nov 2019 07:38:00 -0800 (PST) Received: from localhost (pD9E518ED.dip0.t-ipconnect.de. [217.229.24.237]) by smtp.gmail.com with ESMTPSA id 72sm24285631wrl.73.2019.11.28.07.37.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2019 07:38:00 -0800 (PST) From: Thierry Reding To: Thierry Reding Subject: [PATCH 9/9] drm/tegra: sor: Make the +5V HDMI supply optional Date: Thu, 28 Nov 2019 16:37:41 +0100 Message-Id: <20191128153741.2380419-10-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191128153741.2380419-1-thierry.reding@gmail.com> References: <20191128153741.2380419-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=DZWNjGPJrA9TiLgOiM42Wa6pCMxexw+xtFbZOuu9Dj0=; b=fBM1fnaSHGPaWj2oDBplza3m7QMiLpkQd4blnANTy09QOm9ZAmdZs+MxmnNEnUhauM Nrqgw71rQIAn9ttijEmzZoCTxxtAuxFfcDRthNbgBOOr71OkD6KrO+auVhP//1d4TAYS TCSvmrKJ8qQXRWv7U1XOEuEGjEaArFMentcrB2fpRZM1tANAmPDI8u64a+h8UsWnOSz3 Xeg41ALMwyGoZcL743L9UOzL5F/WaOmV6+2MNY7oa8Nfxm/w4ctoyXrZSQTZ96icQQyB u+wq/C90LEzesgf6O5fZLysT6CmHNf9im0svPqvmJHVZDjyE+5JkV0At652rkmy06Mfr N0gA== 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 SOR supports multiple display modes, but only when driving an HDMI monitor does it make sense to control the +5V power supply. eDP and DP don't need this, so make it optional. This fixes a crash observed during system suspend/resume. Signed-off-by: Thierry Reding Acked-by: Daniel Vetter --- drivers/gpu/drm/tegra/sor.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index 2200f4cd397a..a68d3b36b972 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -3970,15 +3970,29 @@ static int tegra_sor_runtime_resume(struct device *dev) static int tegra_sor_suspend(struct device *dev) { struct tegra_sor *sor = dev_get_drvdata(dev); + int err; + + if (sor->hdmi_supply) { + err = regulator_disable(sor->hdmi_supply); + if (err < 0) + return err; + } - return regulator_disable(sor->hdmi_supply); + return 0; } static int tegra_sor_resume(struct device *dev) { struct tegra_sor *sor = dev_get_drvdata(dev); + int err; + + if (sor->hdmi_supply) { + err = regulator_enable(sor->hdmi_supply); + if (err < 0) + return err; + } - return regulator_enable(sor->hdmi_supply); + return 0; } static const struct dev_pm_ops tegra_sor_pm_ops = {