[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9236c22e-f931-43a0-aafc-2179f53a0afa@linux.intel.com>
Date: Thu, 4 Dec 2025 14:19:54 +0800
From: Baolu Lu <baolu.lu@...ux.intel.com>
To: Samiullah Khawaja <skhawaja@...gle.com>,
David Woodhouse <dwmw2@...radead.org>, Joerg Roedel <joro@...tes.org>,
Will Deacon <will@...nel.org>, Pasha Tatashin <pasha.tatashin@...een.com>,
Jason Gunthorpe <jgg@...pe.ca>, iommu@...ts.linux.dev
Cc: Robin Murphy <robin.murphy@....com>, Pratyush Yadav
<pratyush@...nel.org>, Kevin Tian <kevin.tian@...el.com>,
Alex Williamson <alex@...zbot.org>, linux-kernel@...r.kernel.org,
Saeed Mahameed <saeedm@...dia.com>,
Adithya Jayachandran <ajayachandra@...dia.com>,
Parav Pandit <parav@...dia.com>, Leon Romanovsky <leonro@...dia.com>,
William Tu <witu@...dia.com>, Vipin Sharma <vipinsh@...gle.com>,
dmatlack@...gle.com, YiFei Zhu <zhuyifei@...gle.com>,
Chris Li <chrisl@...nel.org>, praan@...gle.com
Subject: Re: [RFC PATCH v2 20/32] iommu: Add APIs to get preserved state of a
device
On 12/3/25 07:02, Samiullah Khawaja wrote:
> The preserved state of the device needs to be fetched at various places
> during liveupdate. The added API can also be used to check if a device
> is preserved or not. The API is only used during shutdown and after
> liveupdate so no locking needed.
>
> Signed-off-by: Samiullah Khawaja<skhawaja@...gle.com>
> ---
> include/linux/iommu-lu.h | 67 ++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 67 insertions(+)
>
> diff --git a/include/linux/iommu-lu.h b/include/linux/iommu-lu.h
> index 95375530b7be..08a659de8553 100644
> --- a/include/linux/iommu-lu.h
> +++ b/include/linux/iommu-lu.h
> @@ -8,9 +8,76 @@
> #ifndef _LINUX_IOMMU_LU_H
> #define _LINUX_IOMMU_LU_H
>
> +#include <linux/device.h>
> +#include <linux/iommu.h>
> #include <linux/liveupdate.h>
> #include <linux/kho/abi/iommu.h>
>
> +#ifdef CONFIG_LIVEUPDATE
> +static inline void *dev_iommu_preserved_state(struct device *dev)
> +{
> + struct device_ser *ser;
> +
> + ser = dev->iommu->device_ser;
This might cause "NULL pointer dereference" issue if the device is not
iommu probed.
if (!dev->iommu)
return NULL;
ser = dev->iommu->device_ser;
> + if (ser && !ser->obj.incoming)
> + return ser;
> +
> + return NULL;
> +}
Thanks,
baolu
Powered by blists - more mailing lists