accel/amdxdna: Block running when IOMMU is off
Lizhi Hou
maintainerPATCH 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
@@ -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
Quoted 14 lines · Lizhi Hou
The AIE2 device firmware requires IOMMU on.
Signed-off-by Lizhi Hou <[email protected]>--- drivers/accel/amdxdna/aie2_pci.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/accel/amdxdna/aie2_pci.c +0
-0@@ -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.
Lizhi Hou
maintainerQuoted 20 lines · Mario Limonciello
Quoted 17 lines · Lizhi Hou
The AIE2 device firmware requires IOMMU on.
Signed-off-by Lizhi Hou <[email protected]>---
drivers/accel/amdxdna/aie2_pci.c| 5 +++++1 file changed, 5 insertions(+)drivers/accel/amdxdna/aie2_pci.c +1
-0@@ -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.
Mario Limonciello
Reviewed-byQuoted 31 lines · Lizhi Hou
Quoted 20 lines · Mario Limonciello
Quoted 17 lines · Lizhi Hou
The AIE2 device firmware requires IOMMU on.
Signed-off-by Lizhi Hou <[email protected]>---
drivers/accel/amdxdna/aie2_pci.c| 5 +++++1 file changed, 5 insertions(+)drivers/accel/amdxdna/aie2_pci.c +1
-0@@ -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.
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.
Signed-off-by Lizhi Hou <[email protected]>---
drivers/accel/amdxdna/aie2_pci.c| 5 +++++1 file changed, 5 insertions(+)drivers/accel/amdxdna/aie2_pci.c +1
-0@@ -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.
Reviewed-by Mario Limonciello <[email protected]>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.