Skip to contentSkip to conversation

accel/amdxdna: Block running when IOMMU is off

PATCH In review Lizhi Hou 2 participants 5 messages May 20 – May 21

Subsystems (2)
lore
Share & tools
lore

Lizhi Hou

author maintainer
#0 lore raw

PATCH 1/1 accel/amdxdna: Block running when IOMMU is off

The AIE2 device firmware requires IOMMU on.

---
 drivers/accel/amdxdna/aie2_pci.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/accel/amdxdna/aie2_pci.c +5 -0
index c4d345d4c76b..22f66c7f534d 100644
@@ -490,6 +490,11 @@ static int aie2_init(struct amdxdna_dev *xdna)
 		return -EINVAL;
 	}
 
+	if (!xdna->group) {
+		XDNA_ERR(xdna, "Running without IOMMU not supported");
+		return -EINVAL;
+	}
+
 	ndev = drmm_kzalloc(&xdna->ddev, sizeof(*ndev), GFP_KERNEL);
 	if (!ndev)
 		return -ENOMEM;
Signature · 1 line
2.34.1
#1 lore raw
Quoted 14 lines · Lizhi Hou

The AIE2 device firmware requires IOMMU on.

---
  drivers/accel/amdxdna/aie2_pci.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/accel/amdxdna/aie2_pci.c +0 -0
index c4d345d4c76b..22f66c7f534d 100644
@@ -490,6 +490,11 @@ static int aie2_init(struct amdxdna_dev *xdna)
  		return -EINVAL;

drivers/accel/amdxdna/aie2_pci.c static int aie2_init(struct amdxdna_dev *xdna) · line 500

Quoted 10 lines
drivers/accel/amdxdna/aie2_pci.c +5 -0
  	}
 
+	if (!xdna->group) {
+		XDNA_ERR(xdna, "Running without IOMMU not supported");
+		return -EINVAL;
+	}
+
  	ndev = drmm_kzalloc(&xdna->ddev, sizeof(*ndev), GFP_KERNEL);
  	if (!ndev)
  		return -ENOMEM;

I think it would be better to change the return for amdxdna_iommu_init().

This has a check that lets !xdna->group pass; which can be turned into an error code instead.

author maintainer
#2 lore raw
Quoted 20 lines · Mario Limonciello
Quoted 17 lines · Lizhi Hou

The AIE2 device firmware requires IOMMU on.

---
  drivers/accel/amdxdna/aie2_pci.c | 5 +++++

  1 file changed, 5 insertions(+)
drivers/accel/amdxdna/aie2_pci.c +1 -0
index c4d345d4c76b..22f66c7f534d 100644
@@ -490,6 +490,11 @@ static int aie2_init(struct amdxdna_dev *xdna)
           return -EINVAL;
       }
   +    if (!xdna->group) {
+        XDNA_ERR(xdna, "Running without IOMMU not supported");
Quoted 8 lines

drivers/accel/amdxdna/aie2_pci.c static int aie2_init(struct amdxdna_dev *xdna) · line 500

Quoted 6 lines
drivers/accel/amdxdna/aie2_pci.c +3 -0
+        return -EINVAL;
+    }
+
       ndev = drmm_kzalloc(&xdna->ddev, sizeof(*ndev), GFP_KERNEL);
       if (!ndev)
           return -ENOMEM;

I think it would be better to change the return for amdxdna_iommu_init().

amdxdna_iommu_init() is common code for all kinds of hardware. I would keep the check only for AIE2 now, which is known to require IOMMU on.

Lizhi

Quoted 2 lines

This has a check that lets !xdna->group pass; which can be turned into an error code instead.

Reviewed-by
#3 lore raw
Quoted 31 lines · Lizhi Hou
Quoted 20 lines · Mario Limonciello
Quoted 17 lines · Lizhi Hou

The AIE2 device firmware requires IOMMU on.

---
  drivers/accel/amdxdna/aie2_pci.c | 5 +++++

  1 file changed, 5 insertions(+)
drivers/accel/amdxdna/aie2_pci.c +1 -0
index c4d345d4c76b..22f66c7f534d 100644
@@ -490,6 +490,11 @@ static int aie2_init(struct amdxdna_dev *xdna)
           return -EINVAL;
       }
   +    if (!xdna->group) {
+        XDNA_ERR(xdna, "Running without IOMMU not supported");
Quoted 8 lines

drivers/accel/amdxdna/aie2_pci.c static int aie2_init(struct amdxdna_dev *xdna) · line 500

Quoted 6 lines
drivers/accel/amdxdna/aie2_pci.c +3 -0
+        return -EINVAL;
+    }
+
       ndev = drmm_kzalloc(&xdna->ddev, sizeof(*ndev), GFP_KERNEL);
       if (!ndev)
           return -ENOMEM;

I think it would be better to change the return for amdxdna_iommu_init().

Quoted 1 line

amdxdna_iommu_init() is common code for all kinds of hardware. I would keep the check only for AIE2 now, which is known to require IOMMU on.

Got it. Then this makes sense.

Quoted 6 lines

Lizhi

Quoted 2 lines

This has a check that lets !xdna->group pass; which can be turned into an error code instead.

author maintainer Applied
#4 lore raw

Applied to drm-misc-fixes

Quoted 45 lines · Mario Limonciello
Quoted 31 lines · Lizhi Hou
Quoted 20 lines · Mario Limonciello
Quoted 17 lines · Lizhi Hou

The AIE2 device firmware requires IOMMU on.

---
  drivers/accel/amdxdna/aie2_pci.c | 5 +++++

  1 file changed, 5 insertions(+)
drivers/accel/amdxdna/aie2_pci.c +1 -0
index c4d345d4c76b..22f66c7f534d 100644
@@ -490,6 +490,11 @@ static int aie2_init(struct amdxdna_dev *xdna)
           return -EINVAL;
       }
   +    if (!xdna->group) {
+        XDNA_ERR(xdna, "Running without IOMMU not supported");
Quoted 8 lines

drivers/accel/amdxdna/aie2_pci.c static int aie2_init(struct amdxdna_dev *xdna) · line 500

Quoted 6 lines
drivers/accel/amdxdna/aie2_pci.c +3 -0
+        return -EINVAL;
+    }
+
       ndev = drmm_kzalloc(&xdna->ddev, sizeof(*ndev), GFP_KERNEL);
       if (!ndev)
           return -ENOMEM;

I think it would be better to change the return for amdxdna_iommu_init().

Quoted 1 line

amdxdna_iommu_init() is common code for all kinds of hardware. I would keep the check only for AIE2 now, which is known to require IOMMU on.

Got it.  Then this makes sense.

Quoted 6 lines

Lizhi

Quoted 2 lines

This has a check that lets !xdna->group pass; which can be turned into an error code instead.