All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] [PULL REQUEST] Intel IOMMU updates for Linux v6.5
@ 2023-06-14  2:47 Lu Baolu
  2023-06-14  2:47 ` [PATCH 1/4] iommu/vt-d: Remove unnecessary (void*) conversions Lu Baolu
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Lu Baolu @ 2023-06-14  2:47 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: Yanfei Xu, Suhui, iommu, linux-kernel

Hi Joerg,

This includes patches queued for v6.5. They are:

 - Small and misc cleanups

The whole series is based on v6.4-rc6 and also available at:
https://github.com/LuBaolu/intel-iommu/commits/vtd-update-for-v6.5

Please pull them for x86/vt-d branch.

Best regards,
Baolu

Lu Baolu (1):
  iommu/vt-d: Remove commented-out code

Suhui (1):
  iommu/vt-d: Remove unnecessary (void*) conversions

Yanfei Xu (2):
  iommu/vt-d: Handle the failure case of dmar_reenable_qi()
  iommu/vt-d: Remove two WARN_ON in domain_context_mapping_one()

 drivers/iommu/intel/iommu.c | 27 ++++++++++-----------------
 1 file changed, 10 insertions(+), 17 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] iommu/vt-d: Remove unnecessary (void*) conversions
  2023-06-14  2:47 [PATCH 0/4] [PULL REQUEST] Intel IOMMU updates for Linux v6.5 Lu Baolu
@ 2023-06-14  2:47 ` Lu Baolu
  2023-06-14  2:47 ` [PATCH 2/4] iommu/vt-d: Handle the failure case of dmar_reenable_qi() Lu Baolu
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Lu Baolu @ 2023-06-14  2:47 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: Yanfei Xu, Suhui, iommu, linux-kernel

From: Suhui <suhui@nfschina.com>

No need cast (void*) to (struct root_entry *).

Signed-off-by: Suhui <suhui@nfschina.com>
Link: https://lore.kernel.org/r/20230425033743.75986-1-suhui@nfschina.com
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.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 b871a6afd803..323fa1a93765 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -1185,7 +1185,7 @@ static int iommu_alloc_root_entry(struct intel_iommu *iommu)
 {
 	struct root_entry *root;
 
-	root = (struct root_entry *)alloc_pgtable_page(iommu->node, GFP_ATOMIC);
+	root = alloc_pgtable_page(iommu->node, GFP_ATOMIC);
 	if (!root) {
 		pr_err("Allocating root entry for %s failed\n",
 			iommu->name);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] iommu/vt-d: Handle the failure case of dmar_reenable_qi()
  2023-06-14  2:47 [PATCH 0/4] [PULL REQUEST] Intel IOMMU updates for Linux v6.5 Lu Baolu
  2023-06-14  2:47 ` [PATCH 1/4] iommu/vt-d: Remove unnecessary (void*) conversions Lu Baolu
@ 2023-06-14  2:47 ` Lu Baolu
  2023-06-14  2:47 ` [PATCH 3/4] iommu/vt-d: Remove two WARN_ON in domain_context_mapping_one() Lu Baolu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Lu Baolu @ 2023-06-14  2:47 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: Yanfei Xu, Suhui, iommu, linux-kernel

From: Yanfei Xu <yanfei.xu@intel.com>

dmar_reenable_qi() may not succeed. Check and return when it fails.

Signed-off-by: Yanfei Xu <yanfei.xu@intel.com>
Link: https://lore.kernel.org/r/20230605112659.308981-2-yanfei.xu@intel.com
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
 drivers/iommu/intel/iommu.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 323fa1a93765..e83fe243680b 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -2967,10 +2967,15 @@ static int init_iommu_hw(void)
 {
 	struct dmar_drhd_unit *drhd;
 	struct intel_iommu *iommu = NULL;
+	int ret;
 
-	for_each_active_iommu(iommu, drhd)
-		if (iommu->qi)
-			dmar_reenable_qi(iommu);
+	for_each_active_iommu(iommu, drhd) {
+		if (iommu->qi) {
+			ret = dmar_reenable_qi(iommu);
+			if (ret)
+				return ret;
+		}
+	}
 
 	for_each_iommu(iommu, drhd) {
 		if (drhd->ignored) {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] iommu/vt-d: Remove two WARN_ON in domain_context_mapping_one()
  2023-06-14  2:47 [PATCH 0/4] [PULL REQUEST] Intel IOMMU updates for Linux v6.5 Lu Baolu
  2023-06-14  2:47 ` [PATCH 1/4] iommu/vt-d: Remove unnecessary (void*) conversions Lu Baolu
  2023-06-14  2:47 ` [PATCH 2/4] iommu/vt-d: Handle the failure case of dmar_reenable_qi() Lu Baolu
@ 2023-06-14  2:47 ` Lu Baolu
  2023-06-14  2:47 ` [PATCH 4/4] iommu/vt-d: Remove commented-out code Lu Baolu
  2023-06-16 14:38 ` [PATCH 0/4] [PULL REQUEST] Intel IOMMU updates for Linux v6.5 Joerg Roedel
  4 siblings, 0 replies; 6+ messages in thread
From: Lu Baolu @ 2023-06-14  2:47 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: Yanfei Xu, Suhui, iommu, linux-kernel

From: Yanfei Xu <yanfei.xu@intel.com>

Remove the WARN_ON(did == 0) as the domain id 0 is reserved and
set once the domain_ids is allocated. So iommu_init_domains will
never return 0.

Remove the WARN_ON(!table) as this pointer will be accessed in
the following code, if empty "table" really happens, the kernel
will report a NULL pointer reference warning at the first place.

Signed-off-by: Yanfei Xu <yanfei.xu@intel.com>
Link: https://lore.kernel.org/r/20230605112659.308981-3-yanfei.xu@intel.com
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
 drivers/iommu/intel/iommu.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index e83fe243680b..4c0b7424c45e 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -1897,8 +1897,6 @@ static int domain_context_mapping_one(struct dmar_domain *domain,
 	struct context_entry *context;
 	int ret;
 
-	WARN_ON(did == 0);
-
 	if (hw_pass_through && domain_type_is_si(domain))
 		translation = CONTEXT_TT_PASS_THROUGH;
 
@@ -1944,8 +1942,6 @@ static int domain_context_mapping_one(struct dmar_domain *domain,
 	if (sm_supported(iommu)) {
 		unsigned long pds;
 
-		WARN_ON(!table);
-
 		/* Setup the PASID DIR pointer: */
 		pds = context_get_sm_pds(table);
 		context->lo = (u64)virt_to_phys(table->table) |
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] iommu/vt-d: Remove commented-out code
  2023-06-14  2:47 [PATCH 0/4] [PULL REQUEST] Intel IOMMU updates for Linux v6.5 Lu Baolu
                   ` (2 preceding siblings ...)
  2023-06-14  2:47 ` [PATCH 3/4] iommu/vt-d: Remove two WARN_ON in domain_context_mapping_one() Lu Baolu
@ 2023-06-14  2:47 ` Lu Baolu
  2023-06-16 14:38 ` [PATCH 0/4] [PULL REQUEST] Intel IOMMU updates for Linux v6.5 Joerg Roedel
  4 siblings, 0 replies; 6+ messages in thread
From: Lu Baolu @ 2023-06-14  2:47 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: Yanfei Xu, Suhui, iommu, linux-kernel

These lines of code were commented out when they were first added in commit
ba39592764ed ("Intel IOMMU: Intel IOMMU driver"). We do not want to restore
them because the VT-d spec has deprecated the read/write draining hit.

VT-d spec (section 11.4.2):
"
 Hardware implementation with Major Version 2 or higher (VER_REG), always
 performs required drain without software explicitly requesting a drain in
 IOTLB invalidation. This field is deprecated and hardware  will always
 report it as 1 to maintain backward compatibility with software.
"

Remove the code to make the code cleaner.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
Link: https://lore.kernel.org/r/20230609060514.15154-1-baolu.lu@linux.intel.com
---
 drivers/iommu/intel/iommu.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 4c0b7424c45e..e5c111ff4dd9 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -1312,15 +1312,7 @@ static void __iommu_flush_iotlb(struct intel_iommu *iommu, u16 did,
 			iommu->name, type);
 		return;
 	}
-	/* Note: set drain read/write */
-#if 0
-	/*
-	 * This is probably to be super secure.. Looks like we can
-	 * ignore it without any impact.
-	 */
-	if (cap_read_drain(iommu->cap))
-		val |= DMA_TLB_READ_DRAIN;
-#endif
+
 	if (cap_write_drain(iommu->cap))
 		val |= DMA_TLB_WRITE_DRAIN;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] [PULL REQUEST] Intel IOMMU updates for Linux v6.5
  2023-06-14  2:47 [PATCH 0/4] [PULL REQUEST] Intel IOMMU updates for Linux v6.5 Lu Baolu
                   ` (3 preceding siblings ...)
  2023-06-14  2:47 ` [PATCH 4/4] iommu/vt-d: Remove commented-out code Lu Baolu
@ 2023-06-16 14:38 ` Joerg Roedel
  4 siblings, 0 replies; 6+ messages in thread
From: Joerg Roedel @ 2023-06-16 14:38 UTC (permalink / raw)
  To: Lu Baolu; +Cc: Yanfei Xu, Suhui, iommu, linux-kernel

On Wed, Jun 14, 2023 at 10:47:01AM +0800, Lu Baolu wrote:
> Hi Joerg,
> 
> This includes patches queued for v6.5. They are:
> 
>  - Small and misc cleanups
> 
> The whole series is based on v6.4-rc6 and also available at:
> https://github.com/LuBaolu/intel-iommu/commits/vtd-update-for-v6.5
> 
> Please pull them for x86/vt-d branch.

Pulled, thanks Baolu.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-06-16 14:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-14  2:47 [PATCH 0/4] [PULL REQUEST] Intel IOMMU updates for Linux v6.5 Lu Baolu
2023-06-14  2:47 ` [PATCH 1/4] iommu/vt-d: Remove unnecessary (void*) conversions Lu Baolu
2023-06-14  2:47 ` [PATCH 2/4] iommu/vt-d: Handle the failure case of dmar_reenable_qi() Lu Baolu
2023-06-14  2:47 ` [PATCH 3/4] iommu/vt-d: Remove two WARN_ON in domain_context_mapping_one() Lu Baolu
2023-06-14  2:47 ` [PATCH 4/4] iommu/vt-d: Remove commented-out code Lu Baolu
2023-06-16 14:38 ` [PATCH 0/4] [PULL REQUEST] Intel IOMMU updates for Linux v6.5 Joerg Roedel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.