Re: [PATCH 2/2] spi: qcom-geni: Add panic notifier to suspend controller during panic

Mark Brown <[email protected]>
Newsgroups org.kernel.vger.linux-spi,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Wed, Aug 05, 2026 at 04:12:10PM +0530, Praveen Talari wrote:
> When a VM crashes with an active SPI DMA transfer in progress, the
> SMMU raises context faults as the DMA engine continues to access
> IOVAs that are invalidated when the VM's memory context is torn down.
> These faults can affect other VMs sharing the same SMMU instance and
> obscure the root cause of the crash.

> +static int spi_geni_panic_notifier(struct notifier_block *nb,
> +				   unsigned long action, void *data)
> +{
> +	struct spi_geni_master *mas = container_of(nb, struct spi_geni_master, panic_nb);
> +	struct spi_controller *spi = dev_get_drvdata(mas->dev);
> +
> +	spi_controller_suspend(spi);

This will take locks - are you sure that's OK in a panic handler?

> -	return devm_spi_register_controller(dev, spi);
> +	ret = devm_spi_register_controller(dev, spi);
> +	if (ret)
> +		return ret;
> +
> +	mas->panic_nb.notifier_call = spi_geni_panic_notifier;
> +	ret = atomic_notifier_chain_register(&panic_notifier_list, &mas->panic_nb);
> +	if (ret)
> +		return ret;
> +
> +	return devm_add_action_or_reset(dev, spi_geni_unregister_notifiers, mas);

Should we have the notifier in place before registation, what happens if
we panic while probing a SPI device which is probing as a result of
registering the controller?
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmp7M28ACgkQJNaLcl1U
h9CtgAf/f+6KUg6XOD9iIRFVR4rVpXye7ircQCwBQTKLQmyadEoMmiseBOTGIlGz
S+0SKs/Qjy/k+zIyDeJtacOCxEEtVXgs+YZ/Vt3x6yv0fvwqjA70ZZBJguLGb1UZ
EBdRiCE2MuxkeMrmuVvN1Slkth+OPL9U0h6Lh2T0Ue6PO9gM+ZlNWVqCSU3mDybQ
GLDGWZw7xYtBrfPZ5oMmp0SEMmJHIvi9BWx64+kvNQ+Q4nPnIzGd2+8wGKUW30gL
OEcYXD54lUv2RxVZ5rQKxI+eT5kdCPc92M6x3+O2XwTi8RSwmmqWQApxViQwc4Mw
suRbzVi+MP4YnPsfvmWY64X3LV7Cxg==
=f4mQ
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.