All of lore.kernel.org
 help / color / mirror / Atom feed
From: dmkhn@proton.me
To: Stewart Hildebrand <stewart.hildebrand@amd.com>
Cc: xen-devel@lists.xenproject.org,
	Bertrand Marquis <bertrand.marquis@arm.com>,
	Rahul Singh <rahul.singh@arm.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>,
	Michal Orzel <michal.orzel@amd.com>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Subject: Re: [PATCH v2 2/2] xen/arm: smmuv3: fix xl pci-assignable-remove
Date: Fri, 25 Jul 2025 20:17:55 +0000	[thread overview]
Message-ID: <aIPmbqTKFyl9p5HI@kraken> (raw)
In-Reply-To: <20250725174553.15322-2-stewart.hildebrand@amd.com>

On Fri, Jul 25, 2025 at 01:45:51PM -0400, Stewart Hildebrand wrote:
> When attempting to xl pci-assignable-remove a PCI device, we encounter:
> 
> $ xl pci-assignable-remove 00:01.0
> (XEN) SMMUv3: <no-node>:  not attached to domain 32753
> (XEN) d[IO]: deassign (0000:00:01.0) failed (-3)
> libxl: error: libxl_pci.c:910:libxl__device_pci_assignable_remove: failed to de-quarantine 0000:00:01.0
> 
> When a PCI device is being deassigned from domIO,
> arm_smmu_deassign_dev() should return before checking the smmu domain.
> 
> Fixes: 63919fc4d1ca ("xen/arm: smmuv3: Add PCI devices support for SMMUv3")
> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
> Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>

Reviewed-by: Denis Mukhin <dmukhin@ford.com> 

> ---
> v1->v2:
> * use %pd in print format
> * add Bertrand's A-b
> ---
>  xen/drivers/passthrough/arm/smmu-v3.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c
> index db08d3c04269..5e9e3e048e34 100644
> --- a/xen/drivers/passthrough/arm/smmu-v3.c
> +++ b/xen/drivers/passthrough/arm/smmu-v3.c
> @@ -2747,11 +2747,6 @@ static int arm_smmu_deassign_dev(struct domain *d, uint8_t devfn, struct device
>  	struct arm_smmu_domain *smmu_domain = to_smmu_domain(io_domain);
>  	struct arm_smmu_master *master = dev_iommu_priv_get(dev);
> 
> -	if (!smmu_domain || smmu_domain->d != d) {
> -		dev_err(dev, " not attached to domain %d\n", d->domain_id);
> -		return -ESRCH;
> -	}
> -
>  #ifdef CONFIG_HAS_PCI
>  	if ( dev_is_pci(dev) )
>  	{
> @@ -2767,6 +2762,11 @@ static int arm_smmu_deassign_dev(struct domain *d, uint8_t devfn, struct device
>  	}
>  #endif
> 
> +	if (!smmu_domain || smmu_domain->d != d) {
> +		dev_err(dev, " not attached to %pd\n", d);
> +		return -ESRCH;
> +	}
> +
>  	spin_lock(&xen_domain->lock);
> 
>  	arm_smmu_detach_dev(master);
> --
> 2.50.1
> 
> 



  reply	other threads:[~2025-07-25 20:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-25 17:45 [PATCH v2 1/2] xen/arm: smmuv3: fix UB during deassign Stewart Hildebrand
2025-07-25 17:45 ` [PATCH v2 2/2] xen/arm: smmuv3: fix xl pci-assignable-remove Stewart Hildebrand
2025-07-25 20:17   ` dmkhn [this message]
2025-07-25 20:17 ` [PATCH v2 1/2] xen/arm: smmuv3: fix UB during deassign dmkhn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aIPmbqTKFyl9p5HI@kraken \
    --to=dmkhn@proton.me \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=bertrand.marquis@arm.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=rahul.singh@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=stewart.hildebrand@amd.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.