From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D64F3B19BC; Fri, 4 Sep 2026 05:32:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788499923; cv=none; b=WLb4xjdbCcR4MRtmGOyTFffTUEm2r66yZ48CMj3pnHICL88kGUist7VR643wO0Lc14hRw8VCBwT1vEjBhudKV61EcKqDN4I5D/lzZVtvMYzmvlABL+4AWkyzOeAbzy48gB9GZE5IS3rZClgOMcJXYg17N3JA6tS29aIUpKBLTZw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788499923; c=relaxed/simple; bh=+MpG0srlkoZRhcQfHGCah503JkSxe3tLldZKc1NNBA8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e7e4BxA+wkTA/o3prbuOeLvbaD+WK+PqiNG2GR8rv9t4FGc/A7mMOhkHgYpDIv97YmWPOyrzjh3uW5Az4aCYSScLgCFtPqHQIRcUStEOhMep6eEP/U8Hky+EBYQkrYX+9f4MG+MIymC8D5HXc2wUDqml1n9x8iggxp06iRA01/8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=vKX08ThE; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="vKX08ThE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73AE11F00A3D; Fri, 4 Sep 2026 05:32:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788499922; bh=FacyaB+ndDgrg6H8nzIfquuoBcdci56QJcJn5glJdmU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=vKX08ThEU76S9m6Nqzd68lOjqtGSkGcQGHiHrvt8BXH15HQgr4NFwf1R4mYXCPsYb kjxuGEac3AcPBHu2I1qA81XGXRfFuvD91nQ/SPj/ymzPgK49+uO9JkzxO4eZllM7pP j8PQDIS+hYltCi+GgNA4fh38MvAxT6Tp/y+oAanQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kevin Tian , Lu Baolu , Joerg Roedel Subject: [PATCH 7.2 544/713] iommu/vt-d: Fix no_iommu to disable platform opt-in Date: Fri, 4 Sep 2026 06:58:32 +0200 Message-ID: <20260904045816.012768721@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260904045803.810145556@linuxfoundation.org> References: <20260904045803.810145556@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kevin Tian commit 219cc978d69ce9b538d0d73936c569d4ca5b0a24 upstream. 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: 89a6079df791 ("iommu/vt-d: Force IOMMU on for platform opt in hint") Cc: stable@vger.kernel.org Signed-off-by: Kevin Tian Signed-off-by: Lu Baolu Signed-off-by: Joerg Roedel Signed-off-by: Greg Kroah-Hartman --- drivers/iommu/intel/iommu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -2482,10 +2482,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"); /* @@ -2496,7 +2497,6 @@ static int __init platform_optin_force_i iommu_set_default_passthrough(false); dmar_disabled = 0; - no_iommu = 0; return 1; }