~vicamo/+git/ubuntu-kernel:bug-1876707/allow-32bit-devices-use-dma-domain/unstable

Last commit made on 2020-06-02
Get this branch:
git clone -b bug-1876707/allow-32bit-devices-use-dma-domain/unstable https://git.launchpad.net/~vicamo/+git/ubuntu-kernel
Only You-Sheng Yang can upload to this branch. If you are You-Sheng Yang please log in for upload directions.

Branch merges

Branch information

Name:
bug-1876707/allow-32bit-devices-use-dma-domain/unstable
Repository:
lp:~vicamo/+git/ubuntu-kernel

Recent commits

9d22264... by You-Sheng Yang

Bug 1876707: fix NULL pointer dereference in nvme reset work-queue when VMD raid mode and SecureBoot turned on simultaneously on TigerLake

f7fe27f... by Sai Praneeth Prakhya <email address hidden>

iommu: Remove functions that support private domain

BugLink: https://bugs.launchpad.net/bugs/1876707

After moving iommu_group setup to iommu core code [1][2] and removing
private domain support in vt-d [3], there are no users for functions such
as iommu_request_dm_for_dev(), iommu_request_dma_domain_for_dev() and
request_default_domain_for_dev(). So, remove these functions.

[1] commit dce8d6964ebd ("iommu/amd: Convert to probe/release_device()
    call-backs")
[2] commit e5d1841f18b2 ("iommu/vt-d: Convert to probe/release_device()
    call-backs")
[3] commit 327d5b2fee91 ("iommu/vt-d: Allow 32bit devices to uses DMA
    domain")

Signed-off-by: Sai Praneeth Prakhya <email address hidden>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Lu Baolu <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Joerg Roedel <email address hidden>
(cherry picked from commit 69cf449166987d9a041020be6422ee7bf94a7228
linux-next)
Signed-off-by: You-Sheng Yang <email address hidden>

bf74494... by Lu Baolu <email address hidden>

iommu/vt-d: Apply per-device dma_ops

BugLink: https://bugs.launchpad.net/bugs/1876707

Current Intel IOMMU driver sets the system level dma_ops. This causes
each dma API to go through the IOMMU driver even the devices are using
identity mapped domains. This sets per-device dma_ops only if a device
is using a DMA domain. Otherwise, use the default system level dma_ops
for direct dma.

Signed-off-by: Lu Baolu <email address hidden>
Tested-by: Daniel Drake <email address hidden>
Reviewed-by: Jon Derrick <email address hidden>
Reviewed-by: Jerry Snitselaar <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Joerg Roedel <email address hidden>
(cherry picked from commit 6fc7020cf298aaec343df423746b44d99c6efaa5
linux-next)
Signed-off-by: You-Sheng Yang <email address hidden>

dccb313... by Lu Baolu <email address hidden>

iommu/vt-d: Allow PCI sub-hierarchy to use DMA domain

BugLink: https://bugs.launchpad.net/bugs/1876707

Before commit fa954e6831789 ("iommu/vt-d: Delegate the dma domain
to upper layer"), Intel IOMMU started off with all devices in the
identity domain, and took them out later if it found they couldn't
access all of memory. This required devices behind a PCI bridge to
use a DMA domain at the beginning because all PCI devices behind
the bridge use the same source-id in their transactions and the
domain couldn't be changed at run-time.

Intel IOMMU driver is now aligned with the default domain framework,
there's no need to keep this requirement anymore.

Signed-off-by: Lu Baolu <email address hidden>
Tested-by: Daniel Drake <email address hidden>
Reviewed-by: Jon Derrick <email address hidden>
Reviewed-by: Jerry Snitselaar <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Joerg Roedel <email address hidden>
(cherry picked from commit 14b3526d5909f01e1d1baa05f50952788bb7418e
linux-next)
Signed-off-by: You-Sheng Yang <email address hidden>

8bec7c4... by Lu Baolu <email address hidden>

iommu/vt-d: Allow 32bit devices to uses DMA domain

BugLink: https://bugs.launchpad.net/bugs/1876707

Currently, if a 32bit device initially uses an identity domain, Intel
IOMMU driver will convert it forcibly to a DMA one if its address
capability is not enough for the whole system memory. The motivation was
to overcome the overhead caused by possible bounced buffer.

Unfortunately, this improvement has led to many problems. For example,
some 32bit devices are required to use an identity domain, forcing them
to use DMA domain will cause the device not to work anymore. On the
other hand, the VMD sub-devices share a domain but each sub-device might
have different address capability. Forcing a VMD sub-device to use DMA
domain blindly will impact the operation of other sub-devices without
any notification. Further more, PCI aliased devices (PCI bridge and all
devices beneath it, VMD devices and various devices quirked with
pci_add_dma_alias()) must use the same domain. Forcing one device to
switch to DMA domain during runtime will cause in-fligh DMAs for other
devices to abort or target to other memory which might cause undefind
system behavior.

With the last private domain usage in iommu_need_mapping() removed, all
private domain helpers are also cleaned in this patch. Otherwise, the
compiler will complain that some functions are defined but not used.

Signed-off-by: Lu Baolu <email address hidden>
Tested-by: Daniel Drake <email address hidden>
Reviewed-by: Jon Derrick <email address hidden>
Reviewed-by: Jerry Snitselaar <email address hidden>
Cc: Daniel Drake <email address hidden>
Cc: Derrick Jonathan <email address hidden>
Cc: Jerry Snitselaar <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Joerg Roedel <email address hidden>
(cherry picked from commit 327d5b2fee91c404a3956c324193892cf2cc9528
linux-next)
Signed-off-by: You-Sheng Yang <email address hidden>

b7ad792... by Joerg Roedel <email address hidden>

iommu: Don't call .probe_finalize() under group->mutex

BugLink: https://bugs.launchpad.net/bugs/1876707

The .probe_finalize() call-back of some IOMMU drivers calls into
arm_iommu_attach_device(). This function will call back into the
IOMMU core code, where it tries to take group->mutex again, resulting
in a deadlock.

As there is no reason why .probe_finalize() needs to be called under
that mutex, move it after the lock has been released to fix the
deadlock.

Fixes: deac0b3bed26 ("iommu: Split off default domain allocation from group assignment")
Reported-by: Yong Wu <email address hidden>
Signed-off-by: Joerg Roedel <email address hidden>
Cc: Yong Wu <email address hidden>
Link: https://lore.kernel.org/r/20200519132824.15163-1-joro@8bytes.org
(cherry picked from commit 8350a49c2ef8aa166e498595e68ef3833fd74e55
linux-next)
Signed-off-by: You-Sheng Yang <email address hidden>

1116506... by Tero Kristo via iommu <email address hidden>

iommu/omap: Add check for iommu group when no IOMMU in use

BugLink: https://bugs.launchpad.net/bugs/1876707

Most of the devices in OMAP family of SoCs are not using IOMMU. The
patch for converting the OMAP IOMMU to use generic IOMMU bus probe
functionality failed to add a check for this, so add it here.

Fixes: c822b37cac48 ("iommu/omap: Remove orphan_dev tracking")
Reported-by: Tomi Valkeinen <email address hidden>
Signed-off-by: Tero Kristo <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Joerg Roedel <email address hidden>
(cherry picked from commit 46b14fc61bfa409efe95a7752a5dba361d753c66
linux-next)
Signed-off-by: You-Sheng Yang <email address hidden>

ad49e01... by Arnd Bergmann

iommu/renesas: Fix unused-function warning

BugLink: https://bugs.launchpad.net/bugs/1876707

gcc warns because the only reference to ipmmu_find_group
is inside of an #ifdef:

drivers/iommu/ipmmu-vmsa.c:878:28: error: 'ipmmu_find_group' defined but not used [-Werror=unused-function]

Change the #ifdef to an equivalent IS_ENABLED().

Fixes: 6580c8a78424 ("iommu/renesas: Convert to probe/release_device() call-backs")
Signed-off-by: Arnd Bergmann <email address hidden>
Reviewed-by: Simon Horman <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Joerg Roedel <email address hidden>
(cherry picked from commit 2ba20b5a5b8f948d498f4b38ba910ff339e609ef
linux-next)
Signed-off-by: You-Sheng Yang <email address hidden>

eaf796f... by Qian Cai <email address hidden>

iommu/amd: Fix variable "iommu" set but not used

BugLink: https://bugs.launchpad.net/bugs/1876707

The commit dce8d6964ebd ("iommu/amd: Convert to probe/release_device()
call-backs") introduced an unused variable,

drivers/iommu/amd_iommu.c: In function 'amd_iommu_uninit_device':
drivers/iommu/amd_iommu.c:422:20: warning: variable 'iommu' set but not
used [-Wunused-but-set-variable]
  struct amd_iommu *iommu;
                    ^~~~~

Signed-off-by: Qian Cai <email address hidden>
Link: https://<email address hidden>
Fixes: dce8d6964ebd ("iommu/amd: Convert to probe/release_device() call-backs")
Signed-off-by: Joerg Roedel <email address hidden>
(cherry picked from commit cfcccbe8879f79bc9f8a162bcb482c74b8768094
linux-next)
Signed-off-by: You-Sheng Yang <email address hidden>

d0e5a7e... by Joerg Roedel <email address hidden>

iommu: Unexport iommu_group_get_for_dev()

BugLink: https://bugs.launchpad.net/bugs/1876707

The function is now only used in IOMMU core code and shouldn't be used
outside of it anyway, so remove the export for it.

Signed-off-by: Joerg Roedel <email address hidden>
Tested-by: Marek Szyprowski <email address hidden>
Acked-by: Marek Szyprowski <email address hidden>
Link: https://lore.kernel.org/r/20200429133712.31431-35-joro@8bytes.org
Signed-off-by: Joerg Roedel <email address hidden>
(backported from commit 1b032ec1ecbce6047af7d11c9db432e237cb17d8
linux-next)
Signed-off-by: You-Sheng Yang <email address hidden>