iommu: intel: don't dereference iommu_device if IOMMU_API is not built
Subsystems (2)
PATCH 1/1 iommu: intel: don't dereference iommu_device if IOMMU_API is not built
From: Bartosz Golaszewski <[email protected]>
Since commit c40aaaac1018 ("iommu/vt-d: Gracefully handle DMAR units with no supported address widths") dmar.c needs struct iommu_device to be selected. We can drop this dependency by not dereferencing struct iommu_device if IOMMU_API is not selected and by reusing the information stored in iommu->drhd->ignored instead.
This fixes the following build error when IOMMU_API is not selected:
drivers/iommu/intel/dmar.c: In function ‘free_iommu’:drivers/iommu/intel/dmar.c:1139:41: error: ‘struct iommu_device’ has no member named ‘ops’
1139 | if (intel_iommu_enabled && iommu->iommu.ops) {
^--- drivers/iommu/intel/dmar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel/dmar.c +1 -1
@@ -1136,7 +1136,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)static void free_iommu (struct intel_iommu *iommu) { -if (intel_iommu_enabled && iommu->iommu.ops) { +if (intel_iommu_enabled && !iommu->drhd->ignored) {iommu_device_unregister (&iommu->iommu);iommu_device_sysfs_remove (&iommu->iommu); }
Signature · 1 line
2.28.0
Quoted 10 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Since commit
c40aaaac1018("iommu/vt-d: Gracefully handle DMAR units with no supported address widths")dmar.cneeds structiommu_deviceto be selected. We can drop this dependency by not dereferencing structiommu_deviceifIOMMU_APIis not selected and by reusing the information stored iniommu->drhd->ignoredinstead.This fixes the following build error when
IOMMU_APIis not selected:
Quoted 7 lines
drivers/iommu/intel/dmar.c: In function ‘free_iommu’:drivers/iommu/intel/dmar.c:1139:41: error: ‘struct iommu_device’ has no member named ‘ops’1139 | if (intel_iommu_enabled && iommu->iommu.ops) { ^Fixes c40aaaac1018 ("iommu/vt-d: Gracefully handle DMAR units with no supported address widths")Signed-off-by Bartosz Golaszewski <[email protected]>
Oops, apologies for that. Thanks for fixing it.
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Quoted 10 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Since commit
c40aaaac1018("iommu/vt-d: Gracefully handle DMAR units with no supported address widths")dmar.cneeds structiommu_deviceto be selected. We can drop this dependency by not dereferencing structiommu_deviceifIOMMU_APIis not selected and by reusing the information stored iniommu->drhd->ignoredinstead.This fixes the following build error when
IOMMU_APIis not selected:
Quoted 7 lines
drivers/iommu/intel/dmar.c: In function ‘free_iommu’:drivers/iommu/intel/dmar.c:1139:41: error: ‘struct iommu_device’ has no member named ‘ops’1139 | if (intel_iommu_enabled && iommu->iommu.ops) { ^Fixes c40aaaac1018 ("iommu/vt-d: Gracefully handle DMAR units with no supported address widths")Signed-off-by Bartosz Golaszewski <[email protected]>
With commit title adjusted to "iommu/vt-d: Don't dereference iommu_device if IOMMU_API is not built",
Best regards,
baolu
Quoted 18 lines
--- drivers/iommu/intel/dmar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iommu/intel/dmar.c +1
-1@@ -1136,7 +1136,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)static void free_iommu (struct intel_iommu *iommu) { -if (intel_iommu_enabled && iommu->iommu.ops) { +if (intel_iommu_enabled && !iommu->drhd->ignored) {iommu_device_unregister (&iommu->iommu);iommu_device_sysfs_remove (&iommu->iommu); }
Quoted 17 lines · Lu Baolu
Quoted 15 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Since commit
c40aaaac1018("iommu/vt-d: Gracefully handle DMAR units with no supported address widths")dmar.cneeds structiommu_deviceto be selected. We can drop this dependency by not dereferencing structiommu_deviceifIOMMU_APIis not selected and by reusing the information stored iniommu->drhd->ignoredinstead.This fixes the following build error when
IOMMU_APIis not selected:
drivers/iommu/intel/dmar.c: In function ‘free_iommu’:drivers/iommu/intel/dmar.c:1139:41: error: ‘struct iommu_device’ has no member named ‘ops’1139 | if (intel_iommu_enabled && iommu->iommu.ops) { ^
Quoted 8 lines
Quoted 2 lines
Fixes c40aaaac1018 ("iommu/vt-d: Gracefully handle DMAR units with no supported address widths")Signed-off-by Bartosz Golaszewski <[email protected]>With commit title adjusted to "iommu/vt-d: Don't dereference
iommu_deviceifIOMMU_APIis not built",Acked-by Lu Baolu <[email protected]>
Do you want me to resend it again with a changed title or can you fix it up when applying? Or should someone else pick it up?
Bartosz
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Lu Baolu
maintainerHi Bartosz,
Quoted 21 lines · Bartosz Golaszewski
Quoted 20 lines · Lu Baolu
Quoted 17 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Since commit
c40aaaac1018("iommu/vt-d: Gracefully handle DMAR units with no supported address widths")dmar.cneeds structiommu_deviceto be selected. We can drop this dependency by not dereferencing structiommu_deviceifIOMMU_APIis not selected and by reusing the information stored iniommu->drhd->ignoredinstead.This fixes the following build error when
IOMMU_APIis not selected:
drivers/iommu/intel/dmar.c: In function ‘free_iommu’:drivers/iommu/intel/dmar.c:1139:41: error: ‘struct iommu_device’ has no member named ‘ops’1139 | if (intel_iommu_enabled && iommu->iommu.ops) { ^Fixes c40aaaac1018 ("iommu/vt-d: Gracefully handle DMAR units with no supported address widths")Signed-off-by Bartosz Golaszewski <[email protected]>
Quoted 8 lines
Quoted 5 lines
With commit title adjusted to "iommu/vt-d: Don't dereference
iommu_deviceifIOMMU_APIis not built",Acked-by Lu Baolu <[email protected]>Do you want me to resend it again with a changed title or can you fix it up when applying? Or should someone else pick it up?
I suppose Joerg will pick this up. I guess you don't need to resend it unless Joerg asks you to do.
Best regards,
baolu
Joerg Roedel
maintainerQuoted 2 lines · Lu Baolu
I suppose Joerg will pick this up. I guess you don't need to resend it unless Joerg asks you to do.
Yes, will pick this up soon, no need to re-send.
Thanks,
Joerg
David Woodhouse
maintainerQuoted 5 lines · Joerg Roedel
Quoted 2 lines · Lu Baolu
I suppose Joerg will pick this up. I guess you don't need to resend it unless Joerg asks you to do.
Yes, will pick this up soon, no need to re-send.
Please could it, and the commit it fixes, both go to stable@
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Quoted 12 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Since commit
c40aaaac1018("iommu/vt-d: Gracefully handle DMAR units with no supported address widths")dmar.cneeds structiommu_deviceto be selected. We can drop this dependency by not dereferencing structiommu_deviceifIOMMU_APIis not selected and by reusing the information stored iniommu->drhd->ignoredinstead.This fixes the following build error when
IOMMU_APIis not selected:
drivers/iommu/intel/dmar.c: In function ‘free_iommu’:drivers/iommu/intel/dmar.c:1139:41: error: ‘struct iommu_device’ has no member named ‘ops’
Quoted 8 lines
1139 | if (intel_iommu_enabled && iommu->iommu.ops) { ^Fixes c40aaaac1018 ("iommu/vt-d: Gracefully handle DMAR units with no supported address widths")Signed-off-by Bartosz Golaszewski <[email protected]>--- drivers/iommu/intel/dmar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks.