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 2/2] xen/arm: smmuv3: fix xl pci-assignable-remove
Date: Thu, 24 Jul 2025 01:00:39 +0000	[thread overview]
Message-ID: <aIGFsy88qvMj4bTB@kraken> (raw)
In-Reply-To: <20250723225422.116387-2-stewart.hildebrand@amd.com>

On Wed, Jul 23, 2025 at 06:54:20PM -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>
> ---
>  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..9312bb3c72d8 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 domain %d\n", d->domain_id);

Use %pd?

        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-24  1:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-23 22:54 [PATCH 1/2] xen/arm: smmuv3: fix UB during deassign Stewart Hildebrand
2025-07-23 22:54 ` [PATCH 2/2] xen/arm: smmuv3: fix xl pci-assignable-remove Stewart Hildebrand
2025-07-24  1:00   ` dmkhn [this message]
2025-07-25  6:13     ` Bertrand Marquis
2025-07-24  0:59 ` [PATCH 1/2] xen/arm: smmuv3: fix UB during deassign dmkhn
2025-07-25  6:15   ` Bertrand Marquis
2025-07-25  6:12 ` Bertrand Marquis

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=aIGFsy88qvMj4bTB@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.