From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (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 02B2435202A for ; Thu, 2 Jul 2026 06:01:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782972086; cv=none; b=i4D1PaoGXTrMu06w8KelWOtCDveuBYGe8g+Hh2LQC35ufFmNcnF3bDTuoNjA+IYIARYx8hEi7GdrEsq9DNPCDNc6ouqHUiDgU9MGHUORnmz2XkVlCQ+XKlaGV4gRgyaX53jm0FNZmikKIP1wsuf3AM3XWNZOMDvERsBTc5NVkGc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782972086; c=relaxed/simple; bh=B/asl3BYWzIU0Y1W398Lm8ckSLzL2fuDqTaH7fEx4oQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YuzSOFfB6kkIojXRY6pib4bxAKWTsqqRl2rvHVesHbXD7lQ+2pxdWAvhbz2rTeWDdBTGvmobkNS+AD11325VCsaKOPuozBLcdS5KgSZf9y6YYvdjtSDq4xni2K5oLd/CgzN6FGdYLy/QTfzDElMIn9Aa9TFiPWoJtavmeMeis/4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=iqbVb2ON; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="iqbVb2ON" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1782972085; x=1814508085; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=B/asl3BYWzIU0Y1W398Lm8ckSLzL2fuDqTaH7fEx4oQ=; b=iqbVb2ONncAHeBHe7QUVwPX9GxVa0C3NDI6jQSFU2z799XHvaxbhJ6uA WFzI2favIqS5EAbdSJnttADqEBgVkmu61jgYLknrGDU66+7QWgbRTZT2e hqC9h3oMUH3eBqAoExmOAgU5VDZR01iNR4Kpz/G8SroTlKL2KM0Rt+UMD Y5We6IOULeHw3GWBu9UupCA7x2cV0PFfMZU3VbO81628cHRQsY2TvZnB3 x8QgD9ExvxgE6MxuwTXpVYoDrvsFmS4gkUatyBTp//vteaIUuoWliGu1G ZhyzuBmBTUH6Jz7duw7H78zXhO3lbof13twuzvGE6YL+aPltFK4BSJAz9 g==; X-CSE-ConnectionGUID: zfymcwFDSky5ftiSX+jB8g== X-CSE-MsgGUID: /cFuElhKSo+s9o23fied7g== X-IronPort-AV: E=McAfee;i="6800,10657,11834"; a="101256487" X-IronPort-AV: E=Sophos;i="6.25,143,1779174000"; d="scan'208";a="101256487" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jul 2026 23:01:24 -0700 X-CSE-ConnectionGUID: Sfoc1Uu0SGCxhriOO4jwOA== X-CSE-MsgGUID: oR5c1UnFRjKydljhrE/QZA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,143,1779174000"; d="scan'208";a="253425857" Received: from ktian1-pkvm.sh.intel.com ([10.239.48.205]) by orviesa009.jf.intel.com with ESMTP; 01 Jul 2026 23:01:21 -0700 From: Kevin Tian To: Lu Baolu , Joerg Roedel , Will Deacon , Robin Murphy Cc: Kevin Tian , Mika Westerberg , Ashok Raj , Chris Wright , Jesse Barnes , Asit Mallick , iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/9] iommu/vt-d: Use dmar_can_force_on() for platform optin Date: Thu, 2 Jul 2026 06:12:12 +0000 Message-ID: <20260702061216.388743-6-kevin.tian@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260702061216.388743-1-kevin.tian@intel.com> References: <20260702061216.388743-1-kevin.tian@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit So the policy of requesting ACS in detect_intel_iommu() is consistent with that in platform_optin_force_iommu(). While at it, remove no_platform_optin which is unnecessary now. Signed-off-by: Kevin Tian --- drivers/iommu/intel/iommu.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index c66909b8e33b..94cf144b4b70 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -58,7 +58,6 @@ static int rwbf_quirk; */ static int force_on = 0; int intel_iommu_tboot_noforce; -static int no_platform_optin; #define ROOT_ENTRY_NR (VTD_PAGE_SIZE/sizeof(struct root_entry)) @@ -251,7 +250,6 @@ static int __init intel_iommu_setup(char *str) } else if (!strncmp(str, "off", 3)) { dmar_policy = DMAR_USER_OFF; dmar_disabled = 1; - no_platform_optin = 1; pr_info("IOMMU disabled\n"); } else if (!strncmp(str, "igfx_off", 8)) { disable_igfx_iommu = 1; @@ -2489,20 +2487,23 @@ static bool has_external_pci(void) static int __init platform_optin_force_iommu(void) { - if (no_iommu || !dmar_platform_optin() || no_platform_optin || - !has_external_pci()) + if (!dmar_platform_optin() || !dmar_can_force_on(DMAR_FORCEON_PLATFORM)) return 0; - if (dmar_disabled) - pr_info("Intel-IOMMU force enabled due to platform opt in\n"); + if (!has_external_pci()) + return 0; /* * If Intel-IOMMU is disabled by default, we will apply identity * map for all devices except those marked as being untrusted. */ - if (dmar_disabled) + if (dmar_policy_off()) { + pr_info("Intel-IOMMU force enabled due to platform opt in\n"); iommu_set_default_passthrough(false); + } + /* No concurrent access to dmar_policy at this point. */ + dmar_policy = DMAR_FORCE_ON; dmar_disabled = 0; return 1; -- 2.43.0