2023-06-14 03:00:37

by Baolu Lu

[permalink] [raw]
Subject: [PATCH 0/4] [PULL REQUEST] Intel IOMMU updates for Linux v6.5

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



2023-06-14 03:07:07

by Baolu Lu

[permalink] [raw]
Subject: [PATCH 1/4] iommu/vt-d: Remove unnecessary (void*) conversions

From: Suhui <[email protected]>

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

Signed-off-by: Suhui <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Lu Baolu <[email protected]>
---
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


2023-06-14 03:20:14

by Baolu Lu

[permalink] [raw]
Subject: [PATCH 3/4] iommu/vt-d: Remove two WARN_ON in domain_context_mapping_one()

From: Yanfei Xu <[email protected]>

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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Lu Baolu <[email protected]>
---
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


2023-06-14 03:23:31

by Baolu Lu

[permalink] [raw]
Subject: [PATCH 2/4] iommu/vt-d: Handle the failure case of dmar_reenable_qi()

From: Yanfei Xu <[email protected]>

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

Signed-off-by: Yanfei Xu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Lu Baolu <[email protected]>
---
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


2023-06-16 14:58:49

by Joerg Roedel

[permalink] [raw]
Subject: Re: [PATCH 0/4] [PULL REQUEST] Intel IOMMU updates for Linux v6.5

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.