From: Michael Ellerman <patch-notifications@ellerman.id.au>
To: Alexey Kardashevskiy <aik@ozlabs.ru>, linuxppc-dev@lists.ozlabs.org
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
Alistair Popple <alistair@popple.id.au>,
Sam Bobroff <sbobroff@linux.ibm.com>,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [PATCH kernel] powerpc/powernv: Fix stale iommu table base after VFIO
Date: Mon, 8 Jul 2019 11:19:43 +1000 (AEST) [thread overview]
Message-ID: <45hng34j7nz9sNF@ozlabs.org> (raw)
In-Reply-To: <20190628065300.41674-1-aik@ozlabs.ru>
On Fri, 2019-06-28 at 06:53:00 UTC, Alexey Kardashevskiy wrote:
> The powernv platform uses @dma_iommu_ops for non-bypass DMA. These ops
> need an iommu_table pointer which is stored in
> dev->archdata.iommu_table_base. It is initialized during
> pcibios_setup_device() which handles boot time devices. However when
> a device is taken from the system in order to pass it through, the default
> IOMMU table is destroyed but the pointer in a device is not updated;
> also when a device is returned back to the system, a new table pointer
> is not stored in dev->archdata.iommu_table_base either. So when a just
> returned device tries using IOMMU, it crashes on accessing stale
> iommu_table or its members.
>
> This calls set_iommu_table_base() when the default window is created.
> Note it used to be there before but was wrongly removed (see "fixes").
> It did not appear before as these days most devices simply use bypass.
>
> This adds set_iommu_table_base(NULL) when a device is taken from
> the system to make it clear that IOMMU DMA cannot be used past that point.
>
> Fixes: c4e9d3c1e65a ("powerpc/powernv/pseries: Rework device adding to IOMMU groups")
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/5636427d087a55842c1a199dfb839e6545d30e5d
cheers
prev parent reply other threads:[~2019-07-08 1:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-28 6:53 [PATCH kernel] powerpc/powernv: Fix stale iommu table base after VFIO Alexey Kardashevskiy
2019-07-08 1:19 ` Michael Ellerman [this message]
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=45hng34j7nz9sNF@ozlabs.org \
--to=patch-notifications@ellerman.id.au \
--cc=aik@ozlabs.ru \
--cc=alistair@popple.id.au \
--cc=david@gibson.dropbear.id.au \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=sbobroff@linux.ibm.com \
/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).