linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Sven Peter <sven@svenpeter.dev>
Cc: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iommu/dart: Clear sid2group entry when a group is freed
Date: Fri, 24 Sep 2021 14:57:27 +0100	[thread overview]
Message-ID: <87wnn6t6t4.wl-maz@kernel.org> (raw)
In-Reply-To: <20210924134502.15589-1-sven@svenpeter.dev>

On Fri, 24 Sep 2021 14:45:02 +0100,
Sven Peter <sven@svenpeter.dev> wrote:
> 
> sid2groups keeps track of which stream id combinations belong to a
> iommu_group to assign those correctly to devices.
> When a iommu_group is freed a stale pointer will however remain in
> sid2groups. This prevents devices with the same stream id combination
> to ever be attached again (see below).
> Fix that by creating a shadow copy of the stream id configuration
> when a group is allocated for the first time and clear the sid2group
> entry when that group is freed.
> 
>   # echo 1 >/sys/bus/pci/devices/0000\:03\:00.0/remove
>   pci 0000:03:00.0: Removing from iommu group 1
>   # echo 1 >/sys/bus/pci/rescan
>   [...]
>   pci 0000:03:00.0: BAR 0: assigned [mem 0x6a0000000-0x6a000ffff 64bit pref]
>   pci 0000:03:00.0: BAR 2: assigned [mem 0x6a0010000-0x6a001ffff 64bit pref]
>   pci 0000:03:00.0: BAR 6: assigned [mem 0x6c0100000-0x6c01007ff pref]
>   tg3 0000:03:00.0: Failed to add to iommu group 1: -2
>   [...]
> 
> Fixes: 46d1fb072e76b161 ("iommu/dart: Add DART iommu driver")
> Reported-by: Marc Zyngier <maz@kernel.org>
> Signed-off-by: Sven Peter <sven@svenpeter.dev>

Thanks for posting this.

Tested-by: Marc Zyngier <maz@kernel.org>

	M.

-- 
Without deviation from the norm, progress is not possible.

  reply	other threads:[~2021-09-24 13:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-24 13:45 [PATCH] iommu/dart: Clear sid2group entry when a group is freed Sven Peter
2021-09-24 13:57 ` Marc Zyngier [this message]
2021-09-28  9:47 ` Joerg Roedel

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=87wnn6t6t4.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sven@svenpeter.dev \
    --cc=will@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).