forked from Minki/linux
IOMMU Fixes for Linux v4.12-rc1
Including: * Another compile-fix as a fallout of the recent header-file cleanup * Add a missing IO/TLB flush to the Intel VT-d kdump code path * A fix for ARM64 dma code to only access initialized iova_domain members -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABAgAGBQJZHrr1AAoJECvwRC2XARrjR9gQAMaVmFpTl35KqJKam9bKb7p7 uXbFvZmA7BSWknLYCdRChUe/wTY7o++Quf/XIUBYOZ4/pnPUZO0dChIUX3iGa3H7 gcxdS+myfX8OvhIteXMQPDgGiVQ39KDq2uwFVYS8rfAo1KN8Azm6JtaNrDIXMD0h fuMCRmfhukyT2BpEDD2VIsWQc6sP/SnvezRdT4zscLpnRrdh2NbAtQgNAPUXQkXI XpfAF1WRAGFw9VQXLMul5agD5ebPnZWQ4sh3KMs9iMTMhKRzX/kJ8hZql+ZcBhzx CxWUJbYPhTrU2Y88xJwwGb0CnjzBcVaeu0Wgy8cPfE5tTP6bqIoiG0VVEnduvYbB H8OG8KwbEKnBeA1hlNSqzsEmSehv1GK280eWB6lQUMq+GpqZLaB9xwh3159t0Sw+ IJO+8ph72mkFuXfvoH7Ms/D+I0vjvWzjElNeYS5bOKaiLczeu5BsUhE+3BtP8SmB TucEDKKhefITo1192OA8U9IB2EFsPUonxYxYQNs31c7uMzP96VTcM36dc95MncpH Esu8+JcqrVx2KVZmqoLOH3brsedsVFVmoKfwE18nmMUerL1nkIl2lor6gTl2yjiV FJPOXNylF7naRoUHo9TIvwl3Q0uXbiiwVyRosgfNySSN1ecw9Qx4ByOxlYnS4cut uDSvkYH/fDtXlWbz/tPM =ok9C -----END PGP SIGNATURE----- Merge tag 'iommu-fixes-v4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu Pull IOMMU fixes from Joerg Roedel: - another compile-fix as a fallout of the recent header-file cleanup - add a missing IO/TLB flush to the Intel VT-d kdump code path - a fix for ARM64 dma code to only access initialized iova_domain members * tag 'iommu-fixes-v4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: iommu/mediatek: Include linux/dma-mapping.h iommu/vt-d: Flush the IOTLB to get rid of the initial kdump mappings iommu/dma: Don't touch invalid iova_domain members
This commit is contained in:
commit
d4c6cd157a
@ -396,13 +396,13 @@ static void iommu_dma_free_iova(struct iommu_dma_cookie *cookie,
|
||||
dma_addr_t iova, size_t size)
|
||||
{
|
||||
struct iova_domain *iovad = &cookie->iovad;
|
||||
unsigned long shift = iova_shift(iovad);
|
||||
|
||||
/* The MSI case is only ever cleaning up its most recent allocation */
|
||||
if (cookie->type == IOMMU_DMA_MSI_COOKIE)
|
||||
cookie->msi_iova -= size;
|
||||
else
|
||||
free_iova_fast(iovad, iova >> shift, size >> shift);
|
||||
free_iova_fast(iovad, iova_pfn(iovad, iova),
|
||||
size >> iova_shift(iovad));
|
||||
}
|
||||
|
||||
static void __iommu_dma_unmap(struct iommu_domain *domain, dma_addr_t dma_addr,
|
||||
@ -617,11 +617,14 @@ static dma_addr_t __iommu_dma_map(struct device *dev, phys_addr_t phys,
|
||||
{
|
||||
struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
|
||||
struct iommu_dma_cookie *cookie = domain->iova_cookie;
|
||||
struct iova_domain *iovad = &cookie->iovad;
|
||||
size_t iova_off = iova_offset(iovad, phys);
|
||||
size_t iova_off = 0;
|
||||
dma_addr_t iova;
|
||||
|
||||
size = iova_align(iovad, size + iova_off);
|
||||
if (cookie->type == IOMMU_DMA_IOVA_COOKIE) {
|
||||
iova_off = iova_offset(&cookie->iovad, phys);
|
||||
size = iova_align(&cookie->iovad, size + iova_off);
|
||||
}
|
||||
|
||||
iova = iommu_dma_alloc_iova(domain, size, dma_get_mask(dev), dev);
|
||||
if (!iova)
|
||||
return DMA_ERROR_CODE;
|
||||
|
@ -2055,11 +2055,14 @@ static int domain_context_mapping_one(struct dmar_domain *domain,
|
||||
if (context_copied(context)) {
|
||||
u16 did_old = context_domain_id(context);
|
||||
|
||||
if (did_old >= 0 && did_old < cap_ndoms(iommu->cap))
|
||||
if (did_old >= 0 && did_old < cap_ndoms(iommu->cap)) {
|
||||
iommu->flush.flush_context(iommu, did_old,
|
||||
(((u16)bus) << 8) | devfn,
|
||||
DMA_CCMD_MASK_NOBIT,
|
||||
DMA_CCMD_DEVICE_INVL);
|
||||
iommu->flush.flush_iotlb(iommu, did_old, 0, 0,
|
||||
DMA_TLB_DSI_FLUSH);
|
||||
}
|
||||
}
|
||||
|
||||
pgd = domain->pgd;
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/component.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/dma-iommu.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/interrupt.h>
|
||||
|
Loading…
Reference in New Issue
Block a user