]> xenbits.xensource.com Git - people/andrewcoop/xen.git/commit
iommu/amd: atomically update IRTE
authorRoger Pau Monne <roger.pau@citrix.com>
Mon, 20 Jan 2025 14:48:21 +0000 (15:48 +0100)
committerRoger Pau Monne <roger.pau@citrix.com>
Mon, 27 Jan 2025 12:05:11 +0000 (13:05 +0100)
commitb953a99da98d63a7c827248abc450d4e8e015ab6
tree1989c4306c63766650d1b3a4704bdf4932078f1d
parenta2bbb140be9d176226495cb991af59721c34b3f1
iommu/amd: atomically update IRTE

Either when using a 32bit Interrupt Remapping Entry or a 128bit one update
the entry atomically, by using cmpxchg unconditionally as IOMMU depends on
it.  No longer disable the entry by setting RemapEn = 0 ahead of updating
it.  As a consequence of not toggling RemapEn ahead of the update the
Interrupt Remapping Table needs to be flushed after the entry update.

This avoids a window where the IRTE has RemapEn = 0, which can lead to
IO_PAGE_FAULT if the underlying interrupt source is not masked.

There's no guidance in AMD-Vi specification about how IRTE update should be
performed as opposed to DTE updating which has specific guidance.  However
DTE updating claims that reads will always be at least 128bits in size, and
hence for the purposes here assume that reads and caching of the IRTE
entries in either 32 or 128 bit format will be done atomically from
the IOMMU.

Note that as part of introducing a new raw128 field in the IRTE struct, the
current raw field is renamed to raw64 to explicitly contain the size in the
field name.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
xen/drivers/passthrough/amd/iommu_intr.c