Skip to contentSkip to conversation

iommu/vt-d: Move intel_iommu_ops to header file

PATCH In review Andy Shevchenko 3 participants 6 messages Feb 7, 2022 – Feb 16, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 iommu/vt-d: Move intel_iommu_ops to header file

Compiler is not happy about hidden declaration of intel_iommu_ops.

.../iommu.c:414:24: warning: symbol 'intel_iommu_ops' was not declared. Should it be static?

Move declaration to header file to make compiler happy.

---
v2: made sure it compiles with IRQ_REMAP=y, INTEL_IOMMU=n (Lu)

 drivers/iommu/intel/dmar.c  | 2 --
 include/linux/intel-iommu.h | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/iommu/intel/dmar.c +0 -2
index 915bff76fe96..b114e09a647d 100644
@@ -66,8 +66,6 @@ static unsigned long dmar_seq_ids[BITS_TO_LONGS(DMAR_UNITS_SUPPORTED)];
 static int alloc_iommu(struct dmar_drhd_unit *drhd);
 static void free_iommu(struct intel_iommu *iommu);
 
-extern const struct iommu_ops intel_iommu_ops;
-
 static void dmar_register_drhd_unit(struct dmar_drhd_unit *drhd)
 {
 	/*
include/linux/intel-iommu.h +2 -0
index 69230fd695ea..1036c1900b5c 100644
@@ -813,6 +813,8 @@ bool context_present(struct context_entry *context);
 struct context_entry *iommu_context_addr(struct intel_iommu *iommu, u8 bus,
 					 u8 devfn, int alloc);
 
+extern const struct iommu_ops intel_iommu_ops;
+
 #ifdef CONFIG_INTEL_IOMMU
 extern int iommu_calculate_agaw(struct intel_iommu *iommu);
 extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu);
Signature · 6 lines
2.34.1

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
#1 lore raw
Quoted 5 lines · Andy Shevchenko

Compiler is not happy about hidden declaration of intel_iommu_ops.

.../iommu.c:414:24: warning: symbol 'intel_iommu_ops' was not declared. Should it be static?

Move declaration to header file to make compiler happy.

Note, with this change we are closer to have a clean build with the CONFIG_WERROR=y when make W=1.

Signature · 8 lines
With Best Regards,
Andy Shevchenko


_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
maintainer
#2 lore raw
In reply to Andy Shevchenko

include/linux/intel-iommu.h bool context_present(struct context_entry *context); · line 817

Quoted 10 lines · Andy Shevchenko
include/linux/intel-iommu.h +2 -0
index 69230fd695ea..1036c1900b5c 100644
@@ -813,6 +813,8 @@ bool context_present(struct context_entry *context);
 struct context_entry *iommu_context_addr(struct intel_iommu *iommu, u8 bus,
 					 u8 devfn, int alloc);
 
+extern const struct iommu_ops intel_iommu_ops;
+

The intel_iommu_ops symbol is only used in drivers/iommu/intel, so I would prefer a header in that directory. But I leave that up to Baolu to decide.

Thanks,

Joerg

maintainer
#3 lore raw
Quoted 9 lines · Joerg Roedel
Quoted 8 lines · Andy Shevchenko
include/linux/intel-iommu.h +0 -0
index 69230fd695ea..1036c1900b5c 100644
@@ -813,6 +813,8 @@ bool context_present(struct context_entry *context);
  struct context_entry *iommu_context_addr(struct intel_iommu *iommu, u8 bus,
  					 u8 devfn, int alloc);
 
Quoted 5 lines

include/linux/intel-iommu.h bool context_present(struct context_entry *context); · line 817

Quoted 2 lines
include/linux/intel-iommu.h +2 -0
+extern const struct iommu_ops intel_iommu_ops;
+

The intel_iommu_ops symbol is only used in drivers/iommu/intel, so I would prefer a header in that directory. But I leave that up to Baolu to decide.

Agreed. I also have a plan to split them out into a internal header.

Best regards,
baolu

#4 lore raw
Quoted 2 lines · Lu Baolu
Quoted 1 line · Joerg Roedel

On Mon, Feb 07, 2022 at 04:12:40PM +0200, Andy Shevchenko wrote:

...

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

+extern const struct iommu_ops intel_iommu_ops;

The intel_iommu_ops symbol is only used in drivers/iommu/intel, so I would prefer a header in that directory. But I leave that up to Baolu to decide.

Agreed. I also have a plan to split them out into a internal header.

The above change is hanging for more than a year, can we apply it and then you can do a split?

Signature · 8 lines
With Best Regards,
Andy Shevchenko


_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
maintainer
#5 lore raw
Quoted 8 lines · Andy Shevchenko
Quoted 2 lines · Lu Baolu
Quoted 1 line · Joerg Roedel

On Mon, Feb 07, 2022 at 04:12:40PM +0200, Andy Shevchenko wrote:

...

Quoted 1 line
Quoted 1 line
Quoted 1 line

+extern const struct iommu_ops intel_iommu_ops;

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

The intel_iommu_ops symbol is only used in drivers/iommu/intel, so I would prefer a header in that directory. But I leave that up to Baolu to decide.

Agreed. I also have a plan to split them out into a internal header.

The above change is hanging for more than a year, can we apply it and then you can do a split?

Yeah. This is my plan. The include/linux/intel-iommu.h also keeps other internal only helpers. It worth a separated cleanup patch.

Best regards,
baolu
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu