Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp995706rdb; Fri, 1 Dec 2023 04:35:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IEoDi7PpemPqk3hYqRK6m+GceQG61Z3BU0DlsPUcfjNm0aRGYAxuAE8Fz1R4TWlITKJowbW X-Received: by 2002:a05:6a20:914e:b0:187:d44:59f1 with SMTP id x14-20020a056a20914e00b001870d4459f1mr24656963pzc.31.1701434099921; Fri, 01 Dec 2023 04:34:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701434099; cv=none; d=google.com; s=arc-20160816; b=JOgfo7BOW5pOqtpxH4jo1yLSiXVs7vCrLrzMIeWAaCRoBRydmUZocmrcX5W4EW7G9l naXnQhUCz/XILRYqulMXpg81EWg4ev22yj9oqDSqnscXGcX0EUMgqBzWq7UHKeu1bG4c 74jTFwa8lxwK5b5yu5Z/ibUu54kgCQY2Uz8tkUx62Rl1Wzh6BK2vwjzq65ECVI28nosj ZIvJN34CpKGZPkdtAtVMOw1lk4l4l3qIWzE5LbQ1CPy8nJ+q2LsTsEiFp20CuPymdaVD ctWxWHPDpsyk0anT5ISXiemPNiUD8kXiR8b+94/Thu7yQcikUIZGVVEDTd9cR59iujxH VS1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id; bh=PcmEE8VC2U+5jg7GJH1ZDiAlwJ5J322ki+suGwp2Xs8=; fh=yd3Wd1eqjiROB/NtzOulkq1Ppl0r2+mbMjhNeYdJotI=; b=IvA+B9jW1G5bND4/+iVFYbI5mZYb3CqUSpftkXO0zhChVuG7usFQfOyOq/c226OP4s H7IiQmZeSV3rwhvhGqjZQMsgT0QdMfj2PS/asX3EK6pMBcYQ7uAAhOtzJubn3jVsTMBP y39DMCHmIHDMVQRbq1AM90zbb04Sjvi1boy4UnvMBkp1NwnsOWb42vDzFtgTn+KpCAPb WpkzSg3HsO293feNpLFIdLAKTScfflssrOFauENSHjjMjZtWCimX1f+Hsva38rm8kQwW NlfS8kuA8QRbLl6YyZxdO9PyLXwL7Ro9fobQVESuR4jdE33Mx9H3KwEtmuJ6jzzgnIMs VX5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id g22-20020a056a0023d600b00691019fd0efsi3283049pfc.75.2023.12.01.04.34.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 04:34:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id C518B8343957; Fri, 1 Dec 2023 04:34:53 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378843AbjLAMee (ORCPT + 99 others); Fri, 1 Dec 2023 07:34:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378804AbjLAMee (ORCPT ); Fri, 1 Dec 2023 07:34:34 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6380C13E for ; Fri, 1 Dec 2023 04:34:40 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 84FF91007; Fri, 1 Dec 2023 04:35:26 -0800 (PST) Received: from [10.1.28.20] (e122027.cambridge.arm.com [10.1.28.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B87CF3F5A1; Fri, 1 Dec 2023 04:34:37 -0800 (PST) Message-ID: <865217b6-f4bc-410c-ba5b-f765c03d6002@arm.com> Date: Fri, 1 Dec 2023 12:34:35 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 1/3] drm/panfrost: Ignore core_mask for poweroff and disable PWRTRANS irq To: AngeloGioacchino Del Regno , boris.brezillon@collabora.com Cc: robh@kernel.org, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel@collabora.com, m.szyprowski@samsung.com, krzysztof.kozlowski@linaro.org References: <20231201104027.35273-1-angelogioacchino.delregno@collabora.com> <20231201104027.35273-2-angelogioacchino.delregno@collabora.com> Content-Language: en-GB From: Steven Price In-Reply-To: <20231201104027.35273-2-angelogioacchino.delregno@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 01 Dec 2023 04:34:54 -0800 (PST) On 01/12/2023 10:40, AngeloGioacchino Del Regno wrote: > Some SoCs may be equipped with a GPU containing two core groups > and this is exactly the case of Samsung's Exynos 5422 featuring > an ARM Mali-T628 MP6 GPU: the support for this GPU in Panfrost > is partial, as this driver currently supports using only one > core group and that's reflected on all parts of it, including > the power on (and power off, previously to this patch) function. > > The issue with this is that even though executing the soft reset > operation should power off all cores unconditionally, on at least > one platform we're seeing a crash that seems to be happening due > to an interrupt firing which may be because we are calling power > transition only on the first core group, leaving the second one > unchanged, or because ISR execution was pending before entering > the panfrost_gpu_power_off() function and executed after powering > off the GPU cores, or all of the above. > > Finally, solve this by: > - Avoid to enable the power transition interrupt on reset; and > - Ignoring the core_mask and ask the GPU to poweroff both core groups > > Fixes: 22aa1a209018 ("drm/panfrost: Really power off GPU cores in panfrost_gpu_power_off()") > Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Steven Price > --- > drivers/gpu/drm/panfrost/panfrost_gpu.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c > index 09f5e1563ebd..bd41617c5e4b 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_gpu.c > +++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c > @@ -78,7 +78,12 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev) > } > > gpu_write(pfdev, GPU_INT_CLEAR, GPU_IRQ_MASK_ALL); > - gpu_write(pfdev, GPU_INT_MASK, GPU_IRQ_MASK_ALL); > + > + /* Only enable the interrupts we care about */ > + gpu_write(pfdev, GPU_INT_MASK, > + GPU_IRQ_MASK_ERROR | > + GPU_IRQ_PERFCNT_SAMPLE_COMPLETED | > + GPU_IRQ_CLEAN_CACHES_COMPLETED); > > /* > * All in-flight jobs should have released their cycle > @@ -425,11 +430,10 @@ void panfrost_gpu_power_on(struct panfrost_device *pfdev) > > void panfrost_gpu_power_off(struct panfrost_device *pfdev) > { > - u64 core_mask = panfrost_get_core_mask(pfdev); > int ret; > u32 val; > > - gpu_write(pfdev, SHADER_PWROFF_LO, pfdev->features.shader_present & core_mask); > + gpu_write(pfdev, SHADER_PWROFF_LO, pfdev->features.shader_present); > ret = readl_relaxed_poll_timeout(pfdev->iomem + SHADER_PWRTRANS_LO, > val, !val, 1, 1000); > if (ret) > @@ -441,7 +445,7 @@ void panfrost_gpu_power_off(struct panfrost_device *pfdev) > if (ret) > dev_err(pfdev->dev, "tiler power transition timeout"); > > - gpu_write(pfdev, L2_PWROFF_LO, pfdev->features.l2_present & core_mask); > + gpu_write(pfdev, L2_PWROFF_LO, pfdev->features.l2_present); > ret = readl_poll_timeout(pfdev->iomem + L2_PWRTRANS_LO, > val, !val, 0, 1000); > if (ret)