From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sender6-op-o11.zoho.com (sender6-op-o11.zoho.com [165.173.180.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65CF32F260C for ; Sat, 12 Sep 2026 19:27:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=165.173.180.11 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789241275; cv=pass; b=TrDKM0SLhp1r8jdamTypxxFZiWfs7rR38q6bELkyd2mPkvj4QZtiuwr8TDOhfKYpmp3WXd2pgUY8RkluOVYvheggzo0TLObqzbxDi1F6i6WANxIZ5GTP+UIsB6rZMQlMCcHJ69B379gjKQo1fWvYIPUjVU7UErbFtwoAwtAep40= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789241275; c=relaxed/simple; bh=zYQBQUfSzQO+W8jhwa6ez9qTjs184jpN5iZq07bkuJ4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sqbpr0E4k169Q9ZfU6+NSqTiG5gNQ4RjtRv66W7+jqGzR156wiyxMdamtMom+JrWYaYERH5Ha1a1lWdT6F12iJqwJOLgXH6D+SeBHIHYJba5e5CjfDy8ftvURp7i6lluTS8ZXmjTS1vc+QeDb1QfgvGczNRf+sntzJkquqNVRyY= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b=Bi4Yfa/m; arc=pass smtp.client-ip=165.173.180.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b="Bi4Yfa/m" ARC-Seal: i=1; a=rsa-sha256; t=1789241254; cv=none; d=zohomail.com; s=zohoarc; b=B4CaJ7dUQuCJbR23Nt2XbHCuwV4RDnfdco77oGVLs/g74AbpHNYMpelvmk1fIFdM0irHbcKRSn12BQKzPFTNZf+vy+oV/iNkhZPEXI/54Q1BRurJ+6IEqQGhWtd0gIOF5WkEE8mGL5Vb+IKrOqhZXuekhywdHO4JyGVor7+ci8g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789241254; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=bEBDSJzrRr1SVORYP1XOYyIEe3AEhIJwVdb2STNG+Kg=; b=EGE7glYAzZ+2MZRLJSTFEkizho3ToCevnoRIJOtM/7fTnQhPJfXEJjRTpf64MxQBcjHPKNp5TspmArzQrlNpb7Clgv0CoV9yZl0a7NU9UgkQSQiZ75Wqm9jTMava5yDdQ18ql55nr8q72Au6JR3iKM/lESFqvQ03sEBECIfEeqw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=adrian.larumbe@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1789241254; s=zohomail; d=collabora.com; i=adrian.larumbe@collabora.com; h=Date:Date:From:From:To:To:Cc:Cc:Subject:Subject:Message-ID:MIME-Version:Content-Type:In-Reply-To:Message-Id:Reply-To; bh=bEBDSJzrRr1SVORYP1XOYyIEe3AEhIJwVdb2STNG+Kg=; b=Bi4Yfa/mYcMDQSKonuCfQSDP349qF7UpJTlWTqSIVtbL1vuMBFhNCS+S3/hnoF6u HPHAd3OqqRrad6kTGCGEvVcvoVLh29K7E8xFLrjaRM1zAC8dNT/W2pIc49yPRnP8Rvz R3XroajRSHxIfMnbKC7qcvgc5lSOOVoaGa8w+MXg= Received: by mx.zohomail.com with SMTPS id 1789241252677947.9407094368581; Sat, 12 Sep 2026 12:27:32 -0700 (PDT) Date: Sat, 12 Sep 2026 20:27:28 +0100 From: Adrian Larumbe To: Boris Brezillon Cc: Steven Price , Liviu Dudau , Chris Diamand , Akash Goel , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 18/18] drm/panthor: Add debugfs knobs to simulate reset failures Message-ID: References: <20260826-panthor-unplug-fixes-v4-0-982cc8f4234b@collabora.com> <20260826-panthor-unplug-fixes-v4-18-982cc8f4234b@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20260826-panthor-unplug-fixes-v4-18-982cc8f4234b@collabora.com> X-Zoho-Virus-Status: 1 X-Zoho-AV-Stamp: zmail-av-0.2.13.1.5.4/289.238.31 I've tried poking the knob that fakes an error in the reset path and got two different kinds of oputput: Either ``` [ 1950.080236] panthor fb000000.gpu: [drm] *ERROR* Failed to boot MCU after reset, making device unusable. [ 1951.167384] panthor fb000000.gpu: [drm] Timed out waiting for MCU to halt [ 1951.167543] panthor fb000000.gpu: [drm] Failed to cleanly suspend MCU ``` or just ``` [ 2022.804466] panthor fb000000.gpu: [drm] *ERROR* Failed to boot MCU after reset, making device unusable. ``` I guess the former happens when after device unplug, there are still inflight jobs that keep a PM reference. On 26.08.2026 16:56, Boris Brezillon wrote: > It's almost impossible to trigger a situation where the reset > doesn't work now that the driver is more mature, so let's add two > knobs to exercise this error path: > > - a knob to trigger a reset > - a knob to fake an error in the reset path > > Signed-off-by: Boris Brezillon > --- > drivers/gpu/drm/panthor/panthor_device.c | 48 +++++++++++++++++++++++++++++++- > drivers/gpu/drm/panthor/panthor_device.h | 8 ++++++ > 2 files changed, 55 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/panthor/panthor_device.c b/drivers/gpu/drm/panthor/panthor_device.c > index 328e601d80e8..8bdc511310c0 100644 > --- a/drivers/gpu/drm/panthor/panthor_device.c > +++ b/drivers/gpu/drm/panthor/panthor_device.c > @@ -5,6 +5,7 @@ > /* Copyright 2025 ARM Limited. All rights reserved. */ > > #include > +#include > #include > #include > #include > @@ -182,7 +183,10 @@ static void panthor_device_reset_work(struct work_struct *work) > panthor_hw_soft_reset(ptdev); > panthor_hw_l2_power_on(ptdev); > panthor_mmu_post_reset(ptdev); > - ret = panthor_fw_post_reset(ptdev); > + if (ptdev->reset.fake_failure) > + ret = -EIO; > + else > + ret = panthor_fw_post_reset(ptdev); > atomic_set(&ptdev->reset.pending, 0); > panthor_sched_post_reset(ptdev, ret != 0); > drm_dev_exit(cookie); > @@ -690,8 +694,50 @@ int panthor_device_suspend(struct device *dev) > } > > #ifdef CONFIG_DEBUG_FS > +static int panthor_device_fake_fw_reset_failure_get(void *data, u64 *val) > +{ > + struct panthor_device *ptdev = data; > + > + *val = ptdev->reset.fake_failure ? 1 : 0; > + return 0; > +} > + > +static int panthor_device_fake_fw_reset_failure_set(void *data, u64 val) > +{ > + struct panthor_device *ptdev = data; > + > + ptdev->reset.fake_failure = val ? true : false; > + return 0; > +} > + > +DEFINE_DEBUGFS_ATTRIBUTE(panthor_device_fake_fw_reset_failure_fops, > + panthor_device_fake_fw_reset_failure_get, > + panthor_device_fake_fw_reset_failure_set, "%llu\n"); > + > +static ssize_t panthor_device_reset_file_write(struct file *file, > + const char __user *, size_t size, > + loff_t *) > +{ > + struct panthor_device *ptdev = file_inode(file)->i_private; > + > + panthor_device_schedule_reset(ptdev); > + return size; > +} > + > +static const struct debugfs_short_fops panthor_device_reset_fops = { > + .write = panthor_device_reset_file_write, > +}; > + > void panthor_device_debugfs_init(struct drm_minor *minor) > { > + struct panthor_device *ptdev = container_of(minor->dev, struct panthor_device, base); > + > + debugfs_create_file("fake_fw_reset_failure", 0644, > + minor->debugfs_root, ptdev, > + &panthor_device_fake_fw_reset_failure_fops); > + debugfs_create_file("reset", 0200, > + minor->debugfs_root, ptdev, > + &panthor_device_reset_fops); > panthor_mmu_debugfs_init(minor); > panthor_gem_debugfs_init(minor); > } > diff --git a/drivers/gpu/drm/panthor/panthor_device.h b/drivers/gpu/drm/panthor/panthor_device.h > index e12049961912..82ec34347eba 100644 > --- a/drivers/gpu/drm/panthor/panthor_device.h > +++ b/drivers/gpu/drm/panthor/panthor_device.h > @@ -294,6 +294,14 @@ struct panthor_device { > * all FW sections to make sure we start from a fresh state. > */ > bool fast; > + > + /** > + * @fake_failure: When true, pretend the FW boot in the reset path failed. > + * > + * This is important to check that we're doing the right thing in this very > + * unlikely case. > + */ > + bool fake_failure; > } reset; > > /** @pm: Power management related data. */ > > -- > 2.55.0 Adrian Larumbe