Hi Mykyta,

> On 7 Apr 2026, at 10:58, Mykyta Poturai <[email protected]> wrote:
> 
> Allow for removing devices from SMMUv3. arm_smmu_deassign_dev handles
> most of the work by disabling ATS and zeroing STEs. Additionally, unset
> the dt_device_is_protected flag and free no longer needed smmu_master.
> 
> Tested on QEMU with SRIOV series[1] by repeatedly enabling/disabling
> VFs.
> 
> [1]: https://patchew.org/Xen/[email protected]/
> 
> Signed-off-by: Mykyta Poturai <[email protected]>
> ---
> xen/drivers/passthrough/arm/smmu-v3.c | 59 +++++++++++++++++++++++++++
> xen/include/xen/device_tree.h         |  5 +++
> 2 files changed, 64 insertions(+)
> 
> diff --git a/xen/drivers/passthrough/arm/smmu-v3.c 
> b/xen/drivers/passthrough/arm/smmu-v3.c
> index bf153227db..b5b834a7b7 100644
> --- a/xen/drivers/passthrough/arm/smmu-v3.c
> +++ b/xen/drivers/passthrough/arm/smmu-v3.c
> @@ -1493,6 +1493,64 @@ static int arm_smmu_assign_dev(struct domain *d, u8 
> devfn, struct device *dev,
> static int arm_smmu_deassign_dev(struct domain *d, uint8_t devfn,
> struct device *dev);
> 
> +static int arm_smmu_remove_device(u8 devfn, struct device *dev)
> +{
> + int ret = 0;
> + struct arm_smmu_master *master;
> + struct iommu_fwspec *fwspec;
> +

I think we need some protection for the phantom function so that we
don’t remove the shared master object? I’m quite new to the smmu code
though so if I’ve missed something let me know.

Cheers,
Luca

Reply via email to