mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
iommu/vt-d: Fix no_iommu to disable platform opt-in
If user explicitly requests to disable iommu (via "iommu=off" or
"intel_iommu=off"), there is no reason to force enabling it due
to platform opt-in (for external-facing devices). User should be
aware of any security implication of doing so.
"intel_iommu=off" implements this policy by setting no_platform_optin
to skip platform opt-in in platform_optin_force_iommu().
However, "iommu=off" (no_iommu=1) doesn't set no_platform_optin
hence is broken in this aspect:
- detect_intel_iommu() doesn't request ACS if no_iommu=1
- platform_optin_force_iommu() forces iommu on if external-facing
devices exist and no_platform_optin is not set
This leads to a bad configuration with ACS disabled while DMA
remapping is enabled.
Instead of setting no_platform_optin (will soon be removed) for
no_iommu=1, directly check no_iommu in platform_optin_force_iommu().
Fixes: 89a6079df7 ("iommu/vt-d: Force IOMMU on for platform opt in hint")
Cc: stable@vger.kernel.org
Signed-off-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
This commit is contained in:
parent
1251ade0e3
commit
219cc978d6
|
|
@ -2484,10 +2484,11 @@ static bool has_external_pci(void)
|
|||
|
||||
static int __init platform_optin_force_iommu(void)
|
||||
{
|
||||
if (!dmar_platform_optin() || no_platform_optin || !has_external_pci())
|
||||
if (no_iommu || !dmar_platform_optin() || no_platform_optin ||
|
||||
!has_external_pci())
|
||||
return 0;
|
||||
|
||||
if (no_iommu || dmar_disabled)
|
||||
if (dmar_disabled)
|
||||
pr_info("Intel-IOMMU force enabled due to platform opt in\n");
|
||||
|
||||
/*
|
||||
|
|
@ -2498,7 +2499,6 @@ static int __init platform_optin_force_iommu(void)
|
|||
iommu_set_default_passthrough(false);
|
||||
|
||||
dmar_disabled = 0;
|
||||
no_iommu = 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user