diff options
author | Jon Derrick <jonathan.derrick@intel.com> | 2020-05-27 10:56:15 -0600 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2020-05-29 15:11:14 +0200 |
commit | 8038bdb8553313ad53bfcffcf8294dd0ab44618f (patch) | |
tree | 8285506f78a3b70df6d805be7d0c07493e9405b9 /lib/show_mem.c | |
parent | 7809c4d5805b1d331acfe0047dd9695691d428d4 (diff) | |
download | linux-stable-8038bdb8553313ad53bfcffcf8294dd0ab44618f.tar.gz linux-stable-8038bdb8553313ad53bfcffcf8294dd0ab44618f.tar.bz2 linux-stable-8038bdb8553313ad53bfcffcf8294dd0ab44618f.zip |
iommu/vt-d: Only clear real DMA device's context entries
Domain context mapping can encounter issues with sub-devices of a real
DMA device. A sub-device cannot have a valid context entry due to it
potentially aliasing another device's 16-bit ID. It's expected that
sub-devices of the real DMA device uses the real DMA device's requester
when context mapping.
This is an issue when a sub-device is removed where the context entry is
cleared for all aliases. Other sub-devices are still valid, resulting in
those sub-devices being stranded without valid context entries.
The correct approach is to use the real DMA device when programming the
context entries. The insertion path is correct because device_to_iommu()
will return the bus and devfn of the real DMA device. The removal path
needs to only operate on the real DMA device, otherwise the entire
context entry would be cleared for all sub-devices of the real DMA
device.
This patch also adds a helper to determine if a struct device is a
sub-device of a real DMA device.
Fixes: 2b0140c69637e ("iommu/vt-d: Use pci_real_dma_dev() for mapping")
Cc: stable@vger.kernel.org # v5.6+
Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
Acked-by: Lu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/20200527165617.297470-2-jonathan.derrick@intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'lib/show_mem.c')
0 files changed, 0 insertions, 0 deletions