From nobody Thu Oct 2 10:39:56 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (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 3C927288DA for ; Thu, 18 Sep 2025 05:04:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758171847; cv=none; b=e6CR1HlJSmxq57kxvkyDd6oeIwOyEjMFaEtrLn3ZSrfr8qFVWoIWl4BrOxXawJ0vkxzld+AQkJvqN7f32DzB31V6BJmUPja2qk3v9qLTk/Fyl+q8Xyd09ct74jRULeItuZGMf9TEbsPkUoqnuXONtKIpjfMPzy4ja3k5nW3WgnI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758171847; c=relaxed/simple; bh=rGLx+MboJvSWlJwrlf2DVv8MGDDP4w8MrS8i1yDyxEk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TXnMUj041HUtFj9GtL7tVIwB7/OTqgGengGmXDJoGw4y4+izVe1rpLRectHRn3f+V30mKKodAqpvmnsJnvFrdQxLAHkvq5UWb8ViRFxzp+L3m1929UaFYbFKmCQplaqA06PZG04D9i/xlq46sMQ1hhbXNo1B2q4RM43O6msXVCE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=kSV6zKRP; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="kSV6zKRP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1758171844; x=1789707844; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rGLx+MboJvSWlJwrlf2DVv8MGDDP4w8MrS8i1yDyxEk=; b=kSV6zKRPby3bN+R1YgzwaTyN1F8crb6mG64MmeVZfq8gmdbRy01Y7WT3 cehp283bIdMbHfI4bWcRa915Z3oyoCqHMr/Mxzc8uUnWUNwG7kYNKRHeW lpqzcJztDbPtNUMbrEymYFP1kyOcTXpHf3qnGwALmh0tF7qGwa4fn2CQQ knIRAEnHiABJ7TcrljK2EoKWLDaIF89PSSCGYY3R5PRkU4nHCKtvzSATK XYbNT4eNrLGY9KYvRRpsbUIIjQtLs4txLrutQTgXIc+SvOzx/trq/6/Es lcyyFZCzadOr411/o9MsemmWuyuiitMDxUuPIEopRpRoqwega3Kp9RRl/ w==; X-CSE-ConnectionGUID: 67tKj853SOmmB3STUM5D3g== X-CSE-MsgGUID: 7AA4vpazREqW1z/8Lplosw== X-IronPort-AV: E=McAfee;i="6800,10657,11556"; a="60182251" X-IronPort-AV: E=Sophos;i="6.18,274,1751266800"; d="scan'208";a="60182251" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2025 22:04:03 -0700 X-CSE-ConnectionGUID: Hf+PBDC1TqO/HkMI+A72SA== X-CSE-MsgGUID: fQmkKDexSS2pIUfRmY6LJA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,274,1751266800"; d="scan'208";a="175353400" Received: from allen-box.sh.intel.com ([10.239.159.52]) by fmviesa006.fm.intel.com with ESMTP; 17 Sep 2025 22:04:02 -0700 From: Lu Baolu To: Joerg Roedel Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 1/7] iommu/vt-d: Replace snprintf with scnprintf in dmar_latency_snapshot() Date: Thu, 18 Sep 2025 13:01:58 +0800 Message-ID: <20250918050204.359508-2-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250918050204.359508-1-baolu.lu@linux.intel.com> References: <20250918050204.359508-1-baolu.lu@linux.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: quoted-printable Content-Type: text/plain; charset="utf-8" From: Seyediman Seyedarab snprintf() returns the number of bytes that would have been written, not the number actually written. Using this for offset tracking can cause buffer overruns if truncation occurs. Replace snprintf() with scnprintf() to ensure the offset stays within bounds. Since scnprintf() never returns a negative value, and zero is not possible in this context because 'bytes' starts at 0 and 'size - bytes' is DEBUG_BUFFER_SIZE in the first call, which is large enough to hold the string literals used, the return value is always positive. An integer overflow is also completely out of reach here due to the small and fixed buffer size. The error check in latency_show_one() is therefore unnecessary. Remove it and make dmar_latency_snapshot() return void. Signed-off-by: Seyediman Seyedarab Link: https://lore.kernel.org/r/20250731225048.131364-1-ImanDevel@gmail.com Signed-off-by: Lu Baolu --- drivers/iommu/intel/debugfs.c | 10 ++-------- drivers/iommu/intel/perf.c | 10 ++++------ drivers/iommu/intel/perf.h | 5 ++--- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/iommu/intel/debugfs.c b/drivers/iommu/intel/debugfs.c index affbf4a1558d..65d2f792f0f7 100644 --- a/drivers/iommu/intel/debugfs.c +++ b/drivers/iommu/intel/debugfs.c @@ -648,17 +648,11 @@ DEFINE_SHOW_ATTRIBUTE(ir_translation_struct); static void latency_show_one(struct seq_file *m, struct intel_iommu *iommu, struct dmar_drhd_unit *drhd) { - int ret; - seq_printf(m, "IOMMU: %s Register Base Address: %llx\n", iommu->name, drhd->reg_base_addr); =20 - ret =3D dmar_latency_snapshot(iommu, debug_buf, DEBUG_BUFFER_SIZE); - if (ret < 0) - seq_puts(m, "Failed to get latency snapshot"); - else - seq_puts(m, debug_buf); - seq_puts(m, "\n"); + dmar_latency_snapshot(iommu, debug_buf, DEBUG_BUFFER_SIZE); + seq_printf(m, "%s\n", debug_buf); } =20 static int latency_show(struct seq_file *m, void *v) diff --git a/drivers/iommu/intel/perf.c b/drivers/iommu/intel/perf.c index adc4de6bbd88..dceeadc3ee7c 100644 --- a/drivers/iommu/intel/perf.c +++ b/drivers/iommu/intel/perf.c @@ -113,7 +113,7 @@ static char *latency_type_names[] =3D { " svm_prq" }; =20 -int dmar_latency_snapshot(struct intel_iommu *iommu, char *str, size_t siz= e) +void dmar_latency_snapshot(struct intel_iommu *iommu, char *str, size_t si= ze) { struct latency_statistic *lstat =3D iommu->perf_statistic; unsigned long flags; @@ -122,7 +122,7 @@ int dmar_latency_snapshot(struct intel_iommu *iommu, ch= ar *str, size_t size) memset(str, 0, size); =20 for (i =3D 0; i < COUNTS_NUM; i++) - bytes +=3D snprintf(str + bytes, size - bytes, + bytes +=3D scnprintf(str + bytes, size - bytes, "%s", latency_counter_names[i]); =20 spin_lock_irqsave(&latency_lock, flags); @@ -130,7 +130,7 @@ int dmar_latency_snapshot(struct intel_iommu *iommu, ch= ar *str, size_t size) if (!dmar_latency_enabled(iommu, i)) continue; =20 - bytes +=3D snprintf(str + bytes, size - bytes, + bytes +=3D scnprintf(str + bytes, size - bytes, "\n%s", latency_type_names[i]); =20 for (j =3D 0; j < COUNTS_NUM; j++) { @@ -156,11 +156,9 @@ int dmar_latency_snapshot(struct intel_iommu *iommu, c= har *str, size_t size) break; } =20 - bytes +=3D snprintf(str + bytes, size - bytes, + bytes +=3D scnprintf(str + bytes, size - bytes, "%12lld", val); } } spin_unlock_irqrestore(&latency_lock, flags); - - return bytes; } diff --git a/drivers/iommu/intel/perf.h b/drivers/iommu/intel/perf.h index df9a36942d64..1d4baad7e852 100644 --- a/drivers/iommu/intel/perf.h +++ b/drivers/iommu/intel/perf.h @@ -40,7 +40,7 @@ void dmar_latency_disable(struct intel_iommu *iommu, enum= latency_type type); bool dmar_latency_enabled(struct intel_iommu *iommu, enum latency_type typ= e); void dmar_latency_update(struct intel_iommu *iommu, enum latency_type type, u64 latency); -int dmar_latency_snapshot(struct intel_iommu *iommu, char *str, size_t siz= e); +void dmar_latency_snapshot(struct intel_iommu *iommu, char *str, size_t si= ze); #else static inline int dmar_latency_enable(struct intel_iommu *iommu, enum latency_type type) @@ -64,9 +64,8 @@ dmar_latency_update(struct intel_iommu *iommu, enum laten= cy_type type, u64 laten { } =20 -static inline int +static inline void dmar_latency_snapshot(struct intel_iommu *iommu, char *str, size_t size) { - return 0; } #endif /* CONFIG_DMAR_PERF */ --=20 2.43.0 From nobody Thu Oct 2 10:39:56 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (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 6BEC92750E3 for ; Thu, 18 Sep 2025 05:04:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758171848; cv=none; b=oKVpkwd6KFN9ZlcUv9Tu5LV/3cf4mhs6mkl5MWRTR0VoYFwIIfGTlVU+tBSECp813E0kuVU7AGxfscDeo+hUOLVA64umS9QYogHsl5ceEXJY60S8ilfGioJLQP7Og87f9UU9wMV193K69w4oFrpgu+XgWkNCopiy0bD1BMIaZiA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758171848; c=relaxed/simple; bh=vC+09tLRfMKWEKQFxq6BEb9i3D5JAX2l8AB4jWSy8sw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DEfIClnHw8H4ju9W84nvXKppYK0iM9TQIq9yWlcnFrI+2VgsHVIpvfzdQmcnGNSK7iqvlCOKvuq0Oedi2AtWJF8LHRIdHga59izky+tKfDRECWpqaoMFzeHRB5aHBNMIlOchS0sYmR5hoTukxz6qmtmT68juuRcheDd/Rvy6S5k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Vaa1C1kc; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Vaa1C1kc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1758171845; x=1789707845; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vC+09tLRfMKWEKQFxq6BEb9i3D5JAX2l8AB4jWSy8sw=; b=Vaa1C1kctZjPQzIXobKfkMHsYIMCBpf2UoC6isl8Vt+Z6vNemcAkRea9 zk2cW0PgfsKvTAdtGbbwhjAvRhzAhA/+BJ4JNDEKz589fjo2nLJDEvg5b mJ8dnzhwUyajAuYODObG9r9jVg+iSuFBLHnOEHQiBj+erxvg+0QrikTfp JBhsOdo0TLGqftbAtKA9/c/JDbgeWffFoErzhbJGfrDUKg4LOiDx6h8Se 2MIigIDDqQ3FprORv8bI/EX7aQzbeZmYggNdHRr2coJFvIxjXvP2tvRo0 mymP8Uj35Ud/cD3jtYhQGkmODTcsjRrQZR+w0J551JqMKzTcrtFLPLUOT g==; X-CSE-ConnectionGUID: DE0zvp9fQp6PnT+lTZKcsA== X-CSE-MsgGUID: KVHeLbvFR1634tTJXsoqXA== X-IronPort-AV: E=McAfee;i="6800,10657,11556"; a="60182254" X-IronPort-AV: E=Sophos;i="6.18,274,1751266800"; d="scan'208";a="60182254" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2025 22:04:05 -0700 X-CSE-ConnectionGUID: DB/bwS7vR/CzrEY189Iqvw== X-CSE-MsgGUID: haNOsQhaRz6VchvvuvjqWA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,274,1751266800"; d="scan'208";a="175353402" Received: from allen-box.sh.intel.com ([10.239.159.52]) by fmviesa006.fm.intel.com with ESMTP; 17 Sep 2025 22:04:03 -0700 From: Lu Baolu To: Joerg Roedel Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 2/7] iommu/vt-d: debugfs: Fix legacy mode page table dump logic Date: Thu, 18 Sep 2025 13:01:59 +0800 Message-ID: <20250918050204.359508-3-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250918050204.359508-1-baolu.lu@linux.intel.com> References: <20250918050204.359508-1-baolu.lu@linux.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: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Vineeth Pillai (Google)" In legacy mode, SSPTPTR is ignored if TT is not 00b or 01b. SSPTPTR maybe uninitialized or zero in that case and may cause oops like: Oops: general protection fault, probably for non-canonical address 0xf00087d3f000f000: 0000 [#1] SMP NOPTI CPU: 2 UID: 0 PID: 786 Comm: cat Not tainted 6.16.0 #191 PREEMPT(voluntary) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.17.0-5.fc42 04/= 01/2014 RIP: 0010:pgtable_walk_level+0x98/0x150 RSP: 0018:ffffc90000f279c0 EFLAGS: 00010206 RAX: 0000000040000000 RBX: ffffc90000f27ab0 RCX: 000000000000001e RDX: 0000000000000003 RSI: f00087d3f000f000 RDI: f00087d3f0010000 RBP: ffffc90000f27a00 R08: ffffc90000f27a98 R09: 0000000000000002 R10: 0000000000000000 R11: 0000000000000000 R12: f00087d3f000f000 R13: 0000000000000000 R14: 0000000040000000 R15: ffffc90000f27a98 FS: 0000764566dcb740(0000) GS:ffff8881f812c000(0000) knlGS:00000000000000= 00 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000764566d44000 CR3: 0000000109d81003 CR4: 0000000000772ef0 PKRU: 55555554 Call Trace: pgtable_walk_level+0x88/0x150 domain_translation_struct_show.isra.0+0x2d9/0x300 dev_domain_translation_struct_show+0x20/0x40 seq_read_iter+0x12d/0x490 ... Avoid walking the page table if TT is not 00b or 01b. Fixes: 2b437e804566 ("iommu/vt-d: debugfs: Support dumping a specified page= table") Signed-off-by: Vineeth Pillai (Google) Reviewed-by: Kevin Tian Link: https://lore.kernel.org/r/20250814163153.634680-1-vineeth@bitbyteword= .org Signed-off-by: Lu Baolu --- drivers/iommu/intel/debugfs.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/intel/debugfs.c b/drivers/iommu/intel/debugfs.c index 65d2f792f0f7..38790ff50977 100644 --- a/drivers/iommu/intel/debugfs.c +++ b/drivers/iommu/intel/debugfs.c @@ -435,8 +435,21 @@ static int domain_translation_struct_show(struct seq_f= ile *m, } pgd &=3D VTD_PAGE_MASK; } else { /* legacy mode */ - pgd =3D context->lo & VTD_PAGE_MASK; - agaw =3D context->hi & 7; + u8 tt =3D (u8)(context->lo & GENMASK_ULL(3, 2)) >> 2; + + /* + * According to Translation Type(TT), + * get the page table pointer(SSPTPTR). + */ + switch (tt) { + case CONTEXT_TT_MULTI_LEVEL: + case CONTEXT_TT_DEV_IOTLB: + pgd =3D context->lo & VTD_PAGE_MASK; + agaw =3D context->hi & 7; + break; + default: + goto iommu_unlock; + } } =20 seq_printf(m, "Device %04x:%02x:%02x.%x ", --=20 2.43.0 From nobody Thu Oct 2 10:39:56 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (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 2726A2773E9 for ; Thu, 18 Sep 2025 05:04:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758171848; cv=none; b=K5Kd/8Qp7QZhsGbtJ3/YoeeSYoEwngmY58cZRRgVsn1JS4wr831e3dinFXnOAV8VARN1mcq5Po200kkxFBIU7vwCeiNuw+u9bq4lyrHS4QQ958drbTCGgxmD4dvthIPXDoTU2lQbxSaDRaCErMBhwi1luMPcRWlhKwN0Wv8Yns0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758171848; c=relaxed/simple; bh=zIlB6FcHardt8kbvUs2KpFdkBGZVO3qdznG6wASoccU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d3Mz0x9CbQ4PedVPMUf964ll0mXO5GWc+V0SDr8Hfhn6INnp3vKnATqdIpPcF3YE/+Gai8eI4Iz9WLrjlyhQz0Lgw2swbsddDMZsUJHGO4yjtOEc/M4hVXXTmUTEoQnCrPaQLrFoYDSliGmTwAsgb5+chR+8H3T/lxZQ+u/J58Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=K9xj+SAd; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="K9xj+SAd" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1758171846; x=1789707846; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zIlB6FcHardt8kbvUs2KpFdkBGZVO3qdznG6wASoccU=; b=K9xj+SAdhrkUDZTJgFBTkNbUyTRzpMW2w1c1kXrKCTtFq/oAtJF6x+m9 DGWpEOzHTg2j7Ea0YNpvjbxm88/FbcIoI7W5pItvkomZoVzw+pCYdsg6L 5QRtuKdSDF59m8IXcc5cZH0dcDgogB2PEZ0SdNyEPSFJxYgyH5LzkpjJx sdGbZM2rUz2mojpQw5l0tz1MlExcAOZcn1BaPIWJgGNNJljg2WO2Llf/W UialUCzauGPlFjkAWOPyJh8HrJGXl05rR0QRBxttczjbFZ+Iusw9kQNvQ rQSZurLX6CR+HFsO56z5Nb4UTEVhZBd7mxLPLu6GaMp9DwRq3gOdvifLx Q==; X-CSE-ConnectionGUID: zzVs0u4gTEeHfITSaWHa3g== X-CSE-MsgGUID: RaDa8XnJT8+6W3uj1QnVbg== X-IronPort-AV: E=McAfee;i="6800,10657,11556"; a="60182257" X-IronPort-AV: E=Sophos;i="6.18,274,1751266800"; d="scan'208";a="60182257" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2025 22:04:06 -0700 X-CSE-ConnectionGUID: nKXC74x8Qe2gcboeaAAvdg== X-CSE-MsgGUID: 5MuBYmvrSjGQRCccNxaXzQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,274,1751266800"; d="scan'208";a="175353403" Received: from allen-box.sh.intel.com ([10.239.159.52]) by fmviesa006.fm.intel.com with ESMTP; 17 Sep 2025 22:04:05 -0700 From: Lu Baolu To: Joerg Roedel Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 3/7] iommu/vt-d: Drop unused cap_super_offset() Date: Thu, 18 Sep 2025 13:02:00 +0800 Message-ID: <20250918050204.359508-4-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250918050204.359508-1-baolu.lu@linux.intel.com> References: <20250918050204.359508-1-baolu.lu@linux.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: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Yury Norov (NVIDIA)" The macro is unused. Drop the dead code. Signed-off-by: Yury Norov (NVIDIA) Link: https://lore.kernel.org/r/20250913015024.81186-1-yury.norov@gmail.com Signed-off-by: Lu Baolu --- drivers/iommu/intel/iommu.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/iommu/intel/iommu.h b/drivers/iommu/intel/iommu.h index d09b92871659..7da1cf88ce80 100644 --- a/drivers/iommu/intel/iommu.h +++ b/drivers/iommu/intel/iommu.h @@ -173,8 +173,6 @@ #define cap_pgsel_inv(c) (((c) >> 39) & 1) =20 #define cap_super_page_val(c) (((c) >> 34) & 0xf) -#define cap_super_offset(c) (((find_first_bit(&cap_super_page_val(c), 4)) \ - * OFFSET_STRIDE) + 21) =20 #define cap_fault_reg_offset(c) ((((c) >> 24) & 0x3ff) * 16) #define cap_max_fault_reg_offset(c) \ --=20 2.43.0 From nobody Thu Oct 2 10:39:56 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (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 667E927B51C for ; Thu, 18 Sep 2025 05:04:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758171849; cv=none; b=D096x/SY531Nu7yV2/UGK131Xjb9zIK9ZSQ2gLiq21qRso6zm4BAcbF7NouUAWatYJmhDT5gZwVw8Kyx1pac8Wp15eSa7his2q6T+l4nqYer0VoXPROF88hfD9XzaY1v8PxfvtJ3e1z68d6fHM8ef62QifdyXcC6bfUUzxwG0BA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758171849; c=relaxed/simple; bh=agWi5rS8mtHtpuBk3+yZ7A10OphKCTIfwAfaBMo3pEw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZI0KkgWtqve6z4DKjfIO2eqdKWptm8pclNmFqu6j0UsV+UV7PJr6K0lDjraV3uHob5vb2YHU+OaIT/j6t/o7b2YShwCLXvStiGAvQAeGVsrOVUxKvRPYqTRpeLjTykH1lU5d/Q1k/iaBhbcNVjwLwQG5Voreh+AIKZisaoOOFik= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=eaxW+r+6; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="eaxW+r+6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1758171847; x=1789707847; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=agWi5rS8mtHtpuBk3+yZ7A10OphKCTIfwAfaBMo3pEw=; b=eaxW+r+6NdB9sGSOm5BJhtt8WfU9PFnvqve0Tn99a5s6R/0tnruYLLoo 9Eos8z7FZCNomzc+QVXQRIDSRdYUwfFtnOLrQRlAgP6l7YD4GEpHUesbU fOqt+Cnyqp/Kms4inXcYy/xpBZmdunRdTzx+JHSPc/SnZg2FK2akdjPKR 1aQC5Tw5tvrhEbTG2+nMHMxFDBw1b4c2E6pRsRZPALlhnj5c+UgmY0jN2 ulX7f/ws77r3ORA6b+dmOQSl/9SUve56F/qMxRwQC5DjLIb0v6qTVl2kN ch7uDfL8ssTngakkElnqJCkHKvXWDyIuhBx2IBbUyQ+PNSgT+b4qcVjDj A==; X-CSE-ConnectionGUID: ZLKI+ix2SdeBijMylSr/tw== X-CSE-MsgGUID: dMYPa+fXQT2wahnpw32kzw== X-IronPort-AV: E=McAfee;i="6800,10657,11556"; a="60182262" X-IronPort-AV: E=Sophos;i="6.18,274,1751266800"; d="scan'208";a="60182262" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2025 22:04:07 -0700 X-CSE-ConnectionGUID: AS4OLpgTRL6taShsdKCyJA== X-CSE-MsgGUID: SC5B1GRuQVKU+TMI4JX2Kg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,274,1751266800"; d="scan'208";a="175353405" Received: from allen-box.sh.intel.com ([10.239.159.52]) by fmviesa006.fm.intel.com with ESMTP; 17 Sep 2025 22:04:06 -0700 From: Lu Baolu To: Joerg Roedel Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 4/7] iommu/vt-d: Remove LPIG from page group response descriptor Date: Thu, 18 Sep 2025 13:02:01 +0800 Message-ID: <20250918050204.359508-5-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250918050204.359508-1-baolu.lu@linux.intel.com> References: <20250918050204.359508-1-baolu.lu@linux.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: quoted-printable Content-Type: text/plain; charset="utf-8" Bit 66 in the page group response descriptor used to be the LPIG (Last Page in Group), but it was marked as Reserved since Specification 4.0. Remove programming on this bit to make it consistent with the latest specification. Existing hardware all treats bit 66 of the page group response descriptor as "ignored", therefore this change doesn't break any existing hardware. Signed-off-by: Lu Baolu Link: https://lore.kernel.org/r/20250901053943.1708490-1-baolu.lu@linux.int= el.com --- drivers/iommu/intel/iommu.h | 1 - drivers/iommu/intel/prq.c | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/intel/iommu.h b/drivers/iommu/intel/iommu.h index 7da1cf88ce80..21d79414385c 100644 --- a/drivers/iommu/intel/iommu.h +++ b/drivers/iommu/intel/iommu.h @@ -460,7 +460,6 @@ enum { #define QI_PGRP_PASID(pasid) (((u64)(pasid)) << 32) =20 /* Page group response descriptor QW1 */ -#define QI_PGRP_LPIG(x) (((u64)(x)) << 2) #define QI_PGRP_IDX(idx) (((u64)(idx)) << 3) =20 =20 diff --git a/drivers/iommu/intel/prq.c b/drivers/iommu/intel/prq.c index 52570e42a14c..ff63c228e6e1 100644 --- a/drivers/iommu/intel/prq.c +++ b/drivers/iommu/intel/prq.c @@ -151,8 +151,7 @@ static void handle_bad_prq_event(struct intel_iommu *io= mmu, QI_PGRP_PASID_P(req->pasid_present) | QI_PGRP_RESP_CODE(result) | QI_PGRP_RESP_TYPE; - desc.qw1 =3D QI_PGRP_IDX(req->prg_index) | - QI_PGRP_LPIG(req->lpig); + desc.qw1 =3D QI_PGRP_IDX(req->prg_index); =20 qi_submit_sync(iommu, &desc, 1, 0); } @@ -379,19 +378,17 @@ void intel_iommu_page_response(struct device *dev, st= ruct iopf_fault *evt, struct iommu_fault_page_request *prm; struct qi_desc desc; bool pasid_present; - bool last_page; u16 sid; =20 prm =3D &evt->fault.prm; sid =3D PCI_DEVID(bus, devfn); pasid_present =3D prm->flags & IOMMU_FAULT_PAGE_REQUEST_PASID_VALID; - last_page =3D prm->flags & IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE; =20 desc.qw0 =3D QI_PGRP_PASID(prm->pasid) | QI_PGRP_DID(sid) | QI_PGRP_PASID_P(pasid_present) | QI_PGRP_RESP_CODE(msg->code) | QI_PGRP_RESP_TYPE; - desc.qw1 =3D QI_PGRP_IDX(prm->grpid) | QI_PGRP_LPIG(last_page); + desc.qw1 =3D QI_PGRP_IDX(prm->grpid); desc.qw2 =3D 0; desc.qw3 =3D 0; =20 --=20 2.43.0 From nobody Thu Oct 2 10:39:56 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (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 5276B27F19F for ; Thu, 18 Sep 2025 05:04:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758171849; cv=none; b=hGmCBKKrN1dVbfY7+etxLDIZBLx0F4Wk0a+5Prsjk2LNpzYx68Pap8rDhNzkOL8v3aaddgx5hfvgbZ7pHcQt1Iq/UXoms71cyE+Lzabwi2gAvLkY0vLpNc6LwjUAtL96AmOmXrcKrTEmfZAirgn5kXFFN/kTstpNIqE/AQYWIEE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758171849; c=relaxed/simple; bh=lHghKH4ULMXAHmF5d8L32yT2BD6X8Hm29QJ7mE4fltI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D/Q+g/sCr07T/6JPj65bXQUIZ5AGMYxhZi7+uP8bam0Ws5hDvddYPrjyVQNaTPzhmd8lAFw14dN9d4S/Ay3njpO7OpYEY+BpLB0CtHWxpLa6jHI6oGQLwung4bu+hq599RBT6NQrwxBS276VY05VEXVMl+Qn2gOVF+xgPYV8si8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=V/7VmVC/; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="V/7VmVC/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1758171848; x=1789707848; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lHghKH4ULMXAHmF5d8L32yT2BD6X8Hm29QJ7mE4fltI=; b=V/7VmVC/coR0bjnJlNRtRKTjEFa1IJydSJEdjBDejyTLAFYgrhkUIzFT LodYC0KR9U2vSaARg1IbmHs4l5ufg08dyQWDZUq5C8raS2sZWGHWWyC0B +lNZwsi38il+2m/iDP+hTqVB1GVpCwfYumZeLPbdEOh2+AIBWZgsEQiXv j40MJYvV+lVNPwdo28WhG9YjvHI5G1sNaes1gBT+VzD+/BjuRZ0inVJ/s yYHGQQtC2b/Br+bF8X0+Td9R3I+kHBxEChaGAhaGvdi8Wt7Rb4mkeyD6P zdBVyC59+ClmPTV9XTBymuQvi9JGw9xa5Ya0Luo25j7Q4DlqZdk5jBF9R g==; X-CSE-ConnectionGUID: OEnr0tNlTYOogic4foSSGQ== X-CSE-MsgGUID: BjB5foswSmmpi/hSmpsqnA== X-IronPort-AV: E=McAfee;i="6800,10657,11556"; a="60182266" X-IronPort-AV: E=Sophos;i="6.18,274,1751266800"; d="scan'208";a="60182266" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2025 22:04:08 -0700 X-CSE-ConnectionGUID: +Hia2RwMTrCOgB2D5Evtmw== X-CSE-MsgGUID: a1SS4fVlQF2+HD8nN1ybbQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,274,1751266800"; d="scan'208";a="175353409" Received: from allen-box.sh.intel.com ([10.239.159.52]) by fmviesa006.fm.intel.com with ESMTP; 17 Sep 2025 22:04:07 -0700 From: Lu Baolu To: Joerg Roedel Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 5/7] iommu/vt-d: PRS isn't usable if PDS isn't supported Date: Thu, 18 Sep 2025 13:02:02 +0800 Message-ID: <20250918050204.359508-6-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250918050204.359508-1-baolu.lu@linux.intel.com> References: <20250918050204.359508-1-baolu.lu@linux.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: quoted-printable Content-Type: text/plain; charset="utf-8" The specification, Section 7.10, "Software Steps to Drain Page Requests & Responses," requires software to submit an Invalidation Wait Descriptor (inv_wait_dsc) with the Page-request Drain (PD=3D1) flag set, along with the Invalidation Wait Completion Status Write flag (SW=3D1). It then waits for the Invalidation Wait Descriptor's completion. However, the PD field in the Invalidation Wait Descriptor is optional, as stated in Section 6.5.2.9, "Invalidation Wait Descriptor": "Page-request Drain (PD): Remapping hardware implementations reporting Page-request draining as not supported (PDS =3D 0 in ECAP_REG) treat this field as reserved." This implies that if the IOMMU doesn't support the PDS capability, software can't drain page requests and group responses as expected. Do not enable PCI/PRI if the IOMMU doesn't support PDS. Reported-by: Joel Granados Closes: https://lore.kernel.org/r/20250909-jag-pds-v1-1-ad8cba0e494e@kernel= .org Fixes: 66ac4db36f4c ("iommu/vt-d: Add page request draining support") Cc: stable@vger.kernel.org Signed-off-by: Lu Baolu Link: https://lore.kernel.org/r/20250915062946.120196-1-baolu.lu@linux.inte= l.com --- drivers/iommu/intel/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 9c3ab9d9f69a..92759a8f8330 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -3812,7 +3812,7 @@ static struct iommu_device *intel_iommu_probe_device(= struct device *dev) } =20 if (info->ats_supported && ecap_prs(iommu->ecap) && - pci_pri_supported(pdev)) + ecap_pds(iommu->ecap) && pci_pri_supported(pdev)) info->pri_supported =3D 1; } } --=20 2.43.0 From nobody Thu Oct 2 10:39:56 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (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 8C3AF283FE9 for ; Thu, 18 Sep 2025 05:04:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758171851; cv=none; b=bVD5nK/vw9cy2eHH+qm+vPtZ2gkWCD+IZRS5tTtc0TSWmrL9faoSzko53e/Sq+ssz/7l836og2ODJ2aQRgLQl2MhtyxROgg9rFya6QiLwSeLF8Iq7uIomWtdozKxb5Xl7gN4LChjrVjkOEfQP9ovpSCBrDU+8rQMpjMOc37dHDM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758171851; c=relaxed/simple; bh=gAv61IfogKa6k1nhAsVHmIS1MZiQQ1MRA7IlN77Qpvc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bJNVloE8YUGdj4APJaKWYI23LLDG9SeYTBApLGncFbj0QBBABwaCOHv7YRGOX5NmqUPKtgbra808icH6Ls2urxexzd/+jatqdFhYJMaH1fFKQBBf8jgI3kaBzRtpADQb+qFCJyxM5hCmlwJBUP3v3an+3PFod0EDKScmq/aK+S4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=cRaVncSJ; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="cRaVncSJ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1758171849; x=1789707849; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gAv61IfogKa6k1nhAsVHmIS1MZiQQ1MRA7IlN77Qpvc=; b=cRaVncSJU1vfVCdXLxJmUSC4483PE60Xf1yiMqzeJFojsSsZazVHcqLG XtQI8cErfXmHLjd8jwmfwsuK/CxrELdkaC/MjkY9q9sg0QudymI+xke7H Qi/upcN5FbD4/IbjWqpVM8wSlJuaWd/2hI0NXhR+JyfGRvwjo96Z6eBaq KgWs+yKxXwxREnu8ci0gq1BhCGrTDL5t/3gV5hptIpSr3tlBUSq9iEZgG nU4uNA8CvWwtQeJdLU14ppM8VD+qan2G6REnvk/dZaBoH5R/S32tZSYuq 3NPX+kP8uYrKeJEZerzJ5CEA+OIZ9erO+fkt22E7ofjA4d0AYDeC+aCTE w==; X-CSE-ConnectionGUID: uxXqiEesR4G/Z4moHd1SNw== X-CSE-MsgGUID: uUa/zkHDSoyDWN6crUs0Yg== X-IronPort-AV: E=McAfee;i="6800,10657,11556"; a="60182271" X-IronPort-AV: E=Sophos;i="6.18,274,1751266800"; d="scan'208";a="60182271" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2025 22:04:09 -0700 X-CSE-ConnectionGUID: u/1YlTDATGCLD63kcYK6yA== X-CSE-MsgGUID: Pe4IiJ1EQpCGaUNiQvfCdw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,274,1751266800"; d="scan'208";a="175353410" Received: from allen-box.sh.intel.com ([10.239.159.52]) by fmviesa006.fm.intel.com with ESMTP; 17 Sep 2025 22:04:08 -0700 From: Lu Baolu To: Joerg Roedel Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 6/7] iommu/vt-d: Removal of Advanced Fault Logging Date: Thu, 18 Sep 2025 13:02:03 +0800 Message-ID: <20250918050204.359508-7-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250918050204.359508-1-baolu.lu@linux.intel.com> References: <20250918050204.359508-1-baolu.lu@linux.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: quoted-printable Content-Type: text/plain; charset="utf-8" The advanced fault logging has been removed from the specification since v4.0. Linux doesn't implement advanced fault logging functionality, but it currently dumps the advanced logging registers through debugfs. Remove the dumping of these advanced fault logging registers through debugfs to avoid potential access to non-present registers. Signed-off-by: Lu Baolu Link: https://lore.kernel.org/r/20250917024850.143801-1-baolu.lu@linux.inte= l.com --- drivers/iommu/intel/debugfs.c | 1 - drivers/iommu/intel/iommu.h | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/iommu/intel/debugfs.c b/drivers/iommu/intel/debugfs.c index 38790ff50977..765edb3740e2 100644 --- a/drivers/iommu/intel/debugfs.c +++ b/drivers/iommu/intel/debugfs.c @@ -63,7 +63,6 @@ static const struct iommu_regset iommu_regs_64[] =3D { IOMMU_REGSET_ENTRY(ECAP), IOMMU_REGSET_ENTRY(RTADDR), IOMMU_REGSET_ENTRY(CCMD), - IOMMU_REGSET_ENTRY(AFLOG), IOMMU_REGSET_ENTRY(PHMBASE), IOMMU_REGSET_ENTRY(PHMLIMIT), IOMMU_REGSET_ENTRY(IQH), diff --git a/drivers/iommu/intel/iommu.h b/drivers/iommu/intel/iommu.h index 21d79414385c..ef7a1ae8e0db 100644 --- a/drivers/iommu/intel/iommu.h +++ b/drivers/iommu/intel/iommu.h @@ -77,7 +77,6 @@ #define DMAR_FEDATA_REG 0x3c /* Fault event interrupt data register */ #define DMAR_FEADDR_REG 0x40 /* Fault event interrupt addr register */ #define DMAR_FEUADDR_REG 0x44 /* Upper address register */ -#define DMAR_AFLOG_REG 0x58 /* Advanced Fault control */ #define DMAR_PMEN_REG 0x64 /* Enable Protected Memory Region */ #define DMAR_PLMBASE_REG 0x68 /* PMRR Low addr */ #define DMAR_PLMLIMIT_REG 0x6c /* PMRR low limit */ --=20 2.43.0 From nobody Thu Oct 2 10:39:56 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (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 8707D27A108 for ; Thu, 18 Sep 2025 05:04:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758171852; cv=none; b=QAKgRiq3mzUY84TMs70Z+E9sz00JD5WbNliXFnloBFln3DtCTnMK+OOAuamhZ0E6/gl+vNcqHmTdnVHwV4iXW1j/ruTgcuggIfRLKUc5PQtuk7FOoebnpE8PDoQ6Hw73B6hx53kFKYK9CzF0a272yLcC/Lohf/35j2qHTEHxQmo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758171852; c=relaxed/simple; bh=Zu5AnuoxLCmHJOACwOEU2451ClLNd6bkHUbQEk2MCqo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BmODd1G05rM0KaG0PFSypzXSMuEdKAW8i0XebZfWYACPSu4c1zs4VtCZGkSWJlRC7SYS+3RVL13lnDyNHvx6E0xFjqOozzvT+bdpZ4BDAMMH8aumBxx2KzFRrtj3G3BNst4w5Dw7wgolOFH0tnopMz9RIihoBpE4Pp8PB4GtykI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=fpVHigV/; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fpVHigV/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1758171850; x=1789707850; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Zu5AnuoxLCmHJOACwOEU2451ClLNd6bkHUbQEk2MCqo=; b=fpVHigV/UptesdtMDWz7nS4XI8oDPshW3DBr56WZJpToes07CSV0Co+0 UmhbPPsQx0Gvn5AW2zO1UzpS15BuDLPCyAvlQ+kCq90ofi+mmwYPHmEdv 59xdGAVl4F2yEUvF8UZoxf8Zc/oXOHduP+JApayZgTkVdzZ/Vkxt+uuyo o0HWql9TQcrwaw20r+aqYD6W+GcN7BI7uj7iHb8LhYwW1Bs6jd+nYz2eP 6bxYrXjPjGgbsSIwl4/nDLoTZ0ASWKcZmOItW/M8agh9mw1QUxUqLa3wh XggMQbS+OaxJrINsT2Qt3HlWVenkaDwgoPwh4GfEowlYeHdXXt6wK4thN g==; X-CSE-ConnectionGUID: 9+SCZL33SC+DyEOn0d1JdA== X-CSE-MsgGUID: JWjgwqZbTQu9ZOjocHsgLQ== X-IronPort-AV: E=McAfee;i="6800,10657,11556"; a="60182275" X-IronPort-AV: E=Sophos;i="6.18,274,1751266800"; d="scan'208";a="60182275" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2025 22:04:10 -0700 X-CSE-ConnectionGUID: lVPoDScTSzio531Pl0nI4A== X-CSE-MsgGUID: 97WaycxmQGycBcbYMS6prw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,274,1751266800"; d="scan'208";a="175353411" Received: from allen-box.sh.intel.com ([10.239.159.52]) by fmviesa006.fm.intel.com with ESMTP; 17 Sep 2025 22:04:09 -0700 From: Lu Baolu To: Joerg Roedel Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 7/7] iommu/vt-d: debugfs: Avoid dumping context command register Date: Thu, 18 Sep 2025 13:02:04 +0800 Message-ID: <20250918050204.359508-8-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250918050204.359508-1-baolu.lu@linux.intel.com> References: <20250918050204.359508-1-baolu.lu@linux.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: quoted-printable Content-Type: text/plain; charset="utf-8" The register-based cache invalidation interface is in the process of being replaced by the queued invalidation interface. The VT-d architecture allows hardware implementations with a queued invalidation interface to not implement the registers used for cache invalidation. Currently, the debugfs interface dumps the Context Command Register unconditionally, which is not reasonable. Remove it to avoid potential access to non-present registers. Signed-off-by: Lu Baolu Link: https://lore.kernel.org/r/20250917025051.143853-1-baolu.lu@linux.inte= l.com --- drivers/iommu/intel/debugfs.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iommu/intel/debugfs.c b/drivers/iommu/intel/debugfs.c index 765edb3740e2..617fd81a80f0 100644 --- a/drivers/iommu/intel/debugfs.c +++ b/drivers/iommu/intel/debugfs.c @@ -62,7 +62,6 @@ static const struct iommu_regset iommu_regs_64[] =3D { IOMMU_REGSET_ENTRY(CAP), IOMMU_REGSET_ENTRY(ECAP), IOMMU_REGSET_ENTRY(RTADDR), - IOMMU_REGSET_ENTRY(CCMD), IOMMU_REGSET_ENTRY(PHMBASE), IOMMU_REGSET_ENTRY(PHMLIMIT), IOMMU_REGSET_ENTRY(IQH), --=20 2.43.0