Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1353247pxx; Fri, 30 Oct 2020 08:09:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRF4v8+7mAk69KOcOMKRYgI1ZhX7BDzaqcEgr9h7/y0yqzEnzfJfVKMEHjzwRgcRStTt4y X-Received: by 2002:a17:907:435b:: with SMTP id oc19mr2833419ejb.311.1604070563349; Fri, 30 Oct 2020 08:09:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604070563; cv=none; d=google.com; s=arc-20160816; b=ZyaY5y/0uV+DYGhuO9XZwhrFsTnuyO8TVp+EMng63UiidO5otvhYUmiDGPgaBk1Zb7 JB1B2REb4mdnmbLN2Q/v5aWSq65A+K2qYagg8S7bA26GlUvsScD0VYz8CoyRZ0RNbZVh T2oVxJgug6XQa7BLBci9eCfLISIVGhVTglJCcgWHSLV0SyMd4EQXs87/GPsEzwNa9nBJ abdEVYLq4wwLnX3lFlYp9zdvLGMizT6rgaEAWG/823f7VjFWsA5dXEBVZ2/WwUtr33Ar 5najK+NJauPAp3Hwr6ToXR1bpTVeNyOpeWaHC2rqwr8LxZJigW9OgzDzEiBlvbBYeDUr Jrig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=XgWX8565SPsseY0oLMZQ53Ub+aiA6dnLBBMTB5yp3aY=; b=Rv7kVWu52vN8qMISQAyfo7cJ+7vRoOUmr3eCV7NAZauy/jmc4G2Ijq6Wt8DjwybHNM LeAeekUoJHJgAP/n067pkicZnME2YvX8C4snuFvOhEqd5BTWqPps040nlMUngN1LO4+u uL7LW5FjhsDAqAORXEMIq3cNahFCdiZW5b2U4GpAnhmhvLp08aspQ9KS6j34WjdaQUoe 4HUw4yLikaHXl8ajVgrlcgh1zdN8obsScc6O10ieYE9hXitD33dIVFlQuyPl/OllIK74 6akNjfN7WpISWx57plukSTVaRgzncVP2xMDCxvsKi570dO9q37SU1NZOQZshFHkgd980 FYaQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d22si3992280ejc.554.2020.10.30.08.08.59; Fri, 30 Oct 2020 08:09:23 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726829AbgJ3PHS (ORCPT + 99 others); Fri, 30 Oct 2020 11:07:18 -0400 Received: from foss.arm.com ([217.140.110.172]:36990 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726820AbgJ3PHR (ORCPT ); Fri, 30 Oct 2020 11:07:17 -0400 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 E96B6139F; Fri, 30 Oct 2020 07:58:56 -0700 (PDT) Received: from e112269-lin.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8E63B3F68F; Fri, 30 Oct 2020 07:58:55 -0700 (PDT) From: Steven Price To: Daniel Vetter , David Airlie , Rob Herring , Tomeu Vizoso Cc: Alyssa Rosenzweig , Steven Price , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Boris Brezillon Subject: [PATCH] drm/panfrost: Fix module unload Date: Fri, 30 Oct 2020 14:58:33 +0000 Message-Id: <20201030145833.29006-1-steven.price@arm.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When unloading the call to pm_runtime_put_sync_suspend() will attempt to turn the GPU cores off, however panfrost_device_fini() will have turned the clocks off. This leads to the hardware locking up. Instead don't call pm_runtime_put_sync_suspend() and instead simply mark the device as suspended using pm_runtime_set_suspended(). And also include this on the error path in panfrost_probe(). Fixes: aebe8c22a912 ("drm/panfrost: Fix possible suspend in panfrost_remove") Signed-off-by: Steven Price --- drivers/gpu/drm/panfrost/panfrost_drv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c index 23513869500c..0ac8ad18fdc6 100644 --- a/drivers/gpu/drm/panfrost/panfrost_drv.c +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c @@ -627,6 +627,7 @@ static int panfrost_probe(struct platform_device *pdev) err_out1: pm_runtime_disable(pfdev->dev); panfrost_device_fini(pfdev); + pm_runtime_set_suspended(pfdev->dev); err_out0: drm_dev_put(ddev); return err; @@ -641,9 +642,9 @@ static int panfrost_remove(struct platform_device *pdev) panfrost_gem_shrinker_cleanup(ddev); pm_runtime_get_sync(pfdev->dev); - panfrost_device_fini(pfdev); - pm_runtime_put_sync_suspend(pfdev->dev); pm_runtime_disable(pfdev->dev); + panfrost_device_fini(pfdev); + pm_runtime_set_suspended(pfdev->dev); drm_dev_put(ddev); return 0; -- 2.20.1