Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2011828ybz; Thu, 30 Apr 2020 09:18:22 -0700 (PDT) X-Google-Smtp-Source: APiQypKc39045Z9T0kHbdnMYhUDZ1K2pd6Ho85eJ4ROttD+3SGYq0ZolqDT5PaC6nR24DkM5QE17 X-Received: by 2002:a05:6402:333:: with SMTP id q19mr3625879edw.186.1588263502829; Thu, 30 Apr 2020 09:18:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588263502; cv=none; d=google.com; s=arc-20160816; b=N/g+D83J2H+Cd6dVcmV9AXebok9FusIiCfXAWJZoOVu/SibP5R0GhDHNlvw98KdvZp TbiKDpjKE4kphEZPx4/w6MhtMYG+qkVEZJnBltozWwA9crdL4bSYYr4K+IoIkKuzkmEL VVqGEmH77kEzbocI653pVH96rkTHL0CgcYd/scKZfpQi3YoKdjhm85s1YN7naH9haBfK 7zOekPL2u0MO7GFd3Y0vys3UCnrlypDnO2GSH/DL2cDcMJNTP/b/7IiXFf3HqGyHkHdA 1gzQc7aJYdqhUNWMb+MsDd4UNJV2oYBapig8RfnjkXKZFkWPI4XjdfmLeJkW7TX/JJQL tLjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=9tMKgUNiVkUhpbJNhAr0hm95irgxD28lhjeV8PkyOXw=; b=kKXcQnTkYUVo8GMs/hNjXxQMVM/0v6iC4f2mffaDMuAsfamMSOstluQMANuj110HsF n8Sx63cw8gHROoHkv7trkRRQ0g3ZWJ2sccgnWAeykV/kWFAkqASJQwTobQDZsBS1siuZ orMAcIXgbGijXsAU62NYP+Jk826hE5aOw9ID2r1ccMtOUrip98XzVQbHpdVcy4unzQL+ FcN2xexHoY1fOQm9fYR/NE6lRRJs2O9TQr82T4V6IyEE+hNv7JgdEoUVronbW2eKiNeN X9/+UOnprq6W6W7dywu9epNF9hNgrU2umvgtCuYOelgbswO3JcM4kWVap4a+OWKv7555 earA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lJBIxD+U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x25si13743ejs.434.2020.04.30.09.17.58; Thu, 30 Apr 2020 09:18:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lJBIxD+U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726929AbgD3QOS (ORCPT + 99 others); Thu, 30 Apr 2020 12:14:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726486AbgD3QOR (ORCPT ); Thu, 30 Apr 2020 12:14:17 -0400 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C298C035494; Thu, 30 Apr 2020 09:14:17 -0700 (PDT) Received: by mail-io1-xd44.google.com with SMTP id i19so2042800ioh.12; Thu, 30 Apr 2020 09:14:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9tMKgUNiVkUhpbJNhAr0hm95irgxD28lhjeV8PkyOXw=; b=lJBIxD+U8h9JNWqczpIHYOA2edcOylANhJNLxX7tesOutIKTPAgFimaA71Q4BN3lFt CGdE71ndDyan0ElbnjdpXRfFAeM3FaoZUuZy4QwOiG6H2+Ms9wxfrmq86ne2Ncxduo2s o3oH8+ZOcyM+mE6+HP4hWSsipRphFTDlHJjDks7AcSYXE7geDz7xu6toAZaAdZAWGs7u doCtqwvkh1wxfWlI/hclqWa5WNI/PUHzg9W1oPax2zCgrBJN8THiWO9T/BRkfG7p5sQ6 6byMtoOITdG3H87AkEiMJfkj6f+yvBrPZTtUnw30mdJTdGYwy75RtSWnREdZmACd4nAs pzPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9tMKgUNiVkUhpbJNhAr0hm95irgxD28lhjeV8PkyOXw=; b=hE7+3GxazZ/mropwvjK/2OVLfR+5oEaXbgeEOlysbHPnWID3LO8CiuN8LHIsYOFOTy JsIgFDwb3lORkSkUdSbaw6NN/KxS7Qo0okOJjbo6A3RKZQNfr5i47oEOYt29zVI55fjl Dpn/tUlZKYSv/HRb7yO6YgtDLPPTZZwLDtk1AGyEXIW3F8QuWRflHiUpAn+Gd61R7bjM p9P7XW4/US9Hgk8etGw8i/pC0h6Qac//YLCpJT8AtfPv4fqFLsmQ6rwB29lfxci03W8Q i1jj/xON+jdtMhH5Z7mcMpVXZEmLZ5A4G8qDvLKOlEiz19p4+Exo8vby4G3zFt9IzDlH zm1Q== X-Gm-Message-State: AGi0PuYdyVIMQFAImMCf5KF8vMWYOj9Jw3e9C2jzAFEJrRLGBkWrft/6 H0rAmZHtrpZLnb0CwW5WDmwoS5wD53VdOEyahIGpAml3 X-Received: by 2002:a6b:5904:: with SMTP id n4mr2693593iob.142.1588263256671; Thu, 30 Apr 2020 09:14:16 -0700 (PDT) MIME-Version: 1.0 References: <20200430124602.14463-1-frieder.schrempf@kontron.de> <20200430124602.14463-2-frieder.schrempf@kontron.de> <5e1f804c4c27927d10b2283747c1cae6606abe7c.camel@pengutronix.de> <6a5fbb8a-bf28-9c8e-53c7-7a3e5f338a2c@kontron.de> In-Reply-To: <6a5fbb8a-bf28-9c8e-53c7-7a3e5f338a2c@kontron.de> From: Adam Ford Date: Thu, 30 Apr 2020 11:14:02 -0500 Message-ID: Subject: Re: [RFC PATCH 1/4] drm/etnaviv: Prevent IRQ triggering at probe time on i.MX8MM To: Schrempf Frieder Cc: Lucas Stach , Anson Huang , Christian Gmeiner , Daniel Baluta , Fabio Estevam , Leonard Crestez , Li Jun , NXP Linux Team , Peng Fan , Pengutronix Kernel Team , Russell King , Sascha Hauer , Shawn Guo , "S.j. Wang" , "devicetree@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "etnaviv@lists.freedesktop.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 30, 2020 at 10:31 AM Schrempf Frieder wrote: > > Hi Lucas, > > On 30.04.20 16:32, Lucas Stach wrote: > > Hi Frieder, > > > > Am Donnerstag, den 30.04.2020, 12:46 +0000 schrieb Schrempf Frieder: > >> From: Frieder Schrempf > >> > >> On i.MX8MM there is an interrupt getting triggered immediately after > >> requesting the IRQ, which leads to a stall as the handler accesses > >> the GPU registers whithout the clock being enabled. > >> > >> Enabling the clocks briefly seems to clear the IRQ state, so we do > >> this before requesting the IRQ. > > > > This is most likely caused by improper power-up sequencing. Normally > > the GPC will trigger a hardware reset of the modules inside a power > > domain when the domain is powered on. This requires the clocks to be > > running at this point, as those resets are synchronous, so need clock > > pulses to propagate through the hardware. > > Ok, I was suspecting something like that and your explanation makes > total sense to me. > > > > > From what I see the i.MX8MM is still missing the power domain > > controller integration, but I'm pretty confident that this problem > > should be solved in the power domain code, instead of the GPU driver. > > Ok. I was hoping that GPU support could be added without power domain > control, but I now see that this is probably not reasonable at all. > So I will keep on hoping that NXP comes up with an upstreamable solution > for the power domain handling. There was a patch for upstream power-domain control from NXP a few days ago: https://patchwork.kernel.org/cover/10904511/ Can these be somehow tested to see if it helps the issue with the GPU? adam > > Thanks, > Frieder > > > > > Regards, > > Lucas > > > >> Signed-off-by: Frieder Schrempf > >> --- > >> drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 29 ++++++++++++++++++++----- > >> -- > >> 1 file changed, 22 insertions(+), 7 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c > >> b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c > >> index a31eeff2b297..23877c1f150a 100644 > >> --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c > >> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c > >> @@ -1775,13 +1775,6 @@ static int etnaviv_gpu_platform_probe(struct > >> platform_device *pdev) > >> return gpu->irq; > >> } > >> > >> - err = devm_request_irq(&pdev->dev, gpu->irq, irq_handler, 0, > >> - dev_name(gpu->dev), gpu); > >> - if (err) { > >> - dev_err(dev, "failed to request IRQ%u: %d\n", gpu->irq, > >> err); > >> - return err; > >> - } > >> - > >> /* Get Clocks: */ > >> gpu->clk_reg = devm_clk_get(&pdev->dev, "reg"); > >> DBG("clk_reg: %p", gpu->clk_reg); > >> @@ -1805,6 +1798,28 @@ static int etnaviv_gpu_platform_probe(struct > >> platform_device *pdev) > >> gpu->clk_shader = NULL; > >> gpu->base_rate_shader = clk_get_rate(gpu->clk_shader); > >> > >> + /* > >> + * On i.MX8MM there is an interrupt getting triggered > >> immediately > >> + * after requesting the IRQ, which leads to a stall as the > >> handler > >> + * accesses the GPU registers whithout the clock being enabled. > >> + * Enabling the clocks briefly seems to clear the IRQ state, so > >> we do > >> + * this here before requesting the IRQ. > >> + */ > >> + err = etnaviv_gpu_clk_enable(gpu); > >> + if (err) > >> + return err; > >> + > >> + err = etnaviv_gpu_clk_disable(gpu); > >> + if (err) > >> + return err; > >> + > >> + err = devm_request_irq(&pdev->dev, gpu->irq, irq_handler, 0, > >> + dev_name(gpu->dev), gpu); > >> + if (err) { > >> + dev_err(dev, "failed to request IRQ%u: %d\n", gpu->irq, > >> err); > >> + return err; > >> + } > >> + > >> /* TODO: figure out max mapped size */ > >> dev_set_drvdata(dev, gpu); > >> > >