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 3A16842317C; Fri, 4 Sep 2026 06:18:39 +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=1788502720; cv=none; b=ujkcnH2/eE6UbatzR82SGW+6nA7QH8AM1cEQBjLbZlM2Nf0/V4tIAHF4rPgSZSltghUG4FbaTvSPXh3B27dmae16NrWE839ciXngs0O9dHGTAFp9xOKDyrViQ/RyjVc/0F7gp9ZZGXL0pQ8aY8toego+xL60nddb5IaEynlwnhM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788502720; c=relaxed/simple; bh=oR5lmk6tHjsceT5o/RMLijGmkpOmSfGbmu0L5GmDcRE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AiDP3n5WJKwgOdSSw5TZ4wcmmc14+bWQpby38cyaM09j97LV+mPisPDUQsG3TxHrKHnBg5j3KStwNJ2BAhY9+W/wyOYu2zoGPrLnSmf5LoEoAQaxbisa+4bIHbVR70BrtESTfhk3nbEeZ2rej07LWZCCZ57gxX96O95jX/sm2nY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=chCdWE0D; 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="chCdWE0D" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 909F11F00A3D; Fri, 4 Sep 2026 06:18:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788502719; bh=EEp4KdFFoLHIuo6Q3u7p9cvb9OPw3GjpptKBORRUv3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=chCdWE0DLUFm/68uhj6OgXj+Bdxhkk3d2HoEyPaSMNHNpUFKlz0QxXZSLmdWhSV5I YQ0LyarAnpE/X6zY4fuc7SiGFfGS12LFwoDnvkhYr9p6SnErScoU29lYRwLkeHCThs B7yIEf1L8CvR94LtYnqRMzR0QCHCG/AIGaeJBf9k= 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 6.12 305/403] iommu/vt-d: Fix no_iommu to disable platform opt-in Date: Fri, 4 Sep 2026 07:01:48 +0200 Message-ID: <20260904045741.778725830@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260904045734.806166532@linuxfoundation.org> References: <20260904045734.806166532@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 6.12-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 @@ -3156,10 +3156,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"); /* @@ -3170,7 +3171,6 @@ static int __init platform_optin_force_i iommu_set_default_passthrough(false); dmar_disabled = 0; - no_iommu = 0; return 1; }