Skip to contentSkip to conversation

xen/arm: smmuv3: mark arm_smmu_disable_pasid __maybe_unused

PATCH Superseded Stewart Hildebrand 3 participants 7 messages Dec 13, 2022 – Dec 15, 2022

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 xen/arm: smmuv3: mark arm_smmu_disable_pasid __maybe_unused

When building with clang 12 and CONFIG_ARM_SMMU_V3=y, we observe the following build error:

drivers/passthrough/arm/smmu-v3.c:1408:20: error: unused function 'arm_smmu_disable_pasid' [-Werror,-Wunused-function] static inline void arm_smmu_disable_pasid(struct arm_smmu_master *master) { }

                   ^

arm_smmu_disable_pasid is not currently called from anywhere in Xen, but it is inside a section of code guarded by CONFIG_PCI_ATS, which may be helpful in the future if the PASID feature is to be implemented. Add the attribute __maybe_unused to the function.

---
v1->v2:
Add __maybe_unused attribute instead of removing

---
 xen/drivers/passthrough/arm/smmu-v3.c | 2 ++
 1 file changed, 2 insertions(+)
xen/drivers/passthrough/arm/smmu-v3.c +2 -0
index 9c9f4630090e..0cdc862f96d1 100644
@@ -1376,6 +1376,7 @@ static int arm_smmu_enable_pasid(struct arm_smmu_master *master)
 	return 0;
 }
 
+__maybe_unused
 static void arm_smmu_disable_pasid(struct arm_smmu_master *master)
 {
 	struct pci_dev *pdev;
@@ -1405,6 +1406,7 @@ static inline int arm_smmu_enable_pasid(struct arm_smmu_master *master)
 	return 0;
 }
 
+__maybe_unused
 static inline void arm_smmu_disable_pasid(struct arm_smmu_master *master) { }
 #endif /* CONFIG_PCI_ATS */
 
Signature · 1 line
2.39.0
Reviewed-by on v2 1/1
#1 lore raw

Hi Stewart,

Quoted 7 lines · Stewart Hildebrand

When building with clang 12 and CONFIG_ARM_SMMU_V3=y, we observe the following build error:

drivers/passthrough/arm/smmu-v3.c:1408:20: error: unused function 'arm_smmu_disable_pasid' [-Werror,-Wunused-function] static inline void arm_smmu_disable_pasid(struct arm_smmu_master *master) { }

Quoted 8 lines
                  ^

arm_smmu_disable_pasid is not currently called from anywhere in Xen, but it is inside a section of code guarded by CONFIG_PCI_ATS, which may be helpful in the future if the PASID feature is to be implemented. Add the attribute __maybe_unused to the function.

Regards,
Rahul

#2 lore raw
In reply to Stewart Hildebrand

Hi Stewart,

I was about to commit this patch when I noticed the placement of the attribute doesn't match what we are usually doing in Xen.

Quoted 25 lines · Stewart Hildebrand

When building with clang 12 and CONFIG_ARM_SMMU_V3=y, we observe the following build error:

drivers/passthrough/arm/smmu-v3.c:1408:20: error: unused function 'arm_smmu_disable_pasid' [-Werror,-Wunused-function] static inline void arm_smmu_disable_pasid(struct arm_smmu_master *master) { }

                    ^

arm_smmu_disable_pasid is not currently called from anywhere in Xen, but it is inside a section of code guarded by CONFIG_PCI_ATS, which may be helpful in the future if the PASID feature is to be implemented. Add the attribute __maybe_unused to the function.

---
v1->v2:
Add __maybe_unused attribute instead of removing

---
  xen/drivers/passthrough/arm/smmu-v3.c | 2 ++
  1 file changed, 2 insertions(+)
xen/drivers/passthrough/arm/smmu-v3.c +0 -0
index 9c9f4630090e..0cdc862f96d1 100644

xen/drivers/passthrough/arm/smmu-v3.c static int arm_smmu_enable_pasid(struct arm_smmu_master *master) · line 1380

Quoted 5 lines
xen/drivers/passthrough/arm/smmu-v3.c +1 -0
@@ -1376,6 +1376,7 @@ static int arm_smmu_enable_pasid(struct arm_smmu_master *master)
  	return 0;
  }
 
+__maybe_unused
  static void arm_smmu_disable_pasid(struct arm_smmu_master *master)

The attribute should be placed after "void". I.e.:

static void __maybe_unused arm_smmu_disable_pasid(...)

xen/drivers/passthrough/arm/smmu-v3.c static inline int arm_smmu_enable_pasid(struct arm_smmu_master *master) · line 1410

Quoted 8 lines
xen/drivers/passthrough/arm/smmu-v3.c +1 -0
  {
  	struct pci_dev *pdev;
@@ -1405,6 +1406,7 @@ static inline int arm_smmu_enable_pasid(struct arm_smmu_master *master)
  	return 0;
  }
 
+__maybe_unused
  static inline void arm_smmu_disable_pasid(struct arm_smmu_master *master) { }

Same here.

xen/drivers/passthrough/arm/smmu-v3.c static inline int arm_smmu_enable_pasid(struct arm_smmu_master *master) · line 1412

Quoted 2 lines
xen/drivers/passthrough/arm/smmu-v3.c +0 -0
  #endif /* CONFIG_PCI_ATS */
 

Cheers,

Signature · 1 line
Julien Grall
#3 lore raw
Quoted 34 lines · Julien Grall

Hi Stewart,

I was about to commit this patch when I noticed the placement of the attribute doesn't match what we are usually doing in Xen.

Quoted 28 lines · Stewart Hildebrand

When building with clang 12 and CONFIG_ARM_SMMU_V3=y, we observe the following build error:

drivers/passthrough/arm/smmu-v3.c:1408:20: error: unused function 'arm_smmu_disable_pasid' [-Werror,-Wunused-function] static inline void arm_smmu_disable_pasid(struct arm_smmu_master *master) { }
                    ^

arm_smmu_disable_pasid is not currently called from anywhere in Xen, but it is inside a section of code guarded by CONFIG_PCI_ATS, which may be helpful in the future if the PASID feature is to be implemented. Add the attribute __maybe_unused to the function.

---
v1->v2:
Add __maybe_unused attribute instead of removing
---
  xen/drivers/passthrough/arm/smmu-v3.c | 2 ++

  1 file changed, 2 insertions(+)
xen/drivers/passthrough/arm/smmu-v3.c +0 -0
index 9c9f4630090e..0cdc862f96d1 100644
@@ -1376,6 +1376,7 @@ static int arm_smmu_enable_pasid(struct arm_smmu_master *master)
       return 0;
   }
 
Quoted 6 lines

xen/drivers/passthrough/arm/smmu-v3.c static int arm_smmu_enable_pasid(struct arm_smmu_master *master) · line 1380

Quoted 2 lines
xen/drivers/passthrough/arm/smmu-v3.c +1 -0
+__maybe_unused
   static void arm_smmu_disable_pasid(struct arm_smmu_master *master)

The attribute should be placed after "void". I.e.:

static void __maybe_unused arm_smmu_disable_pasid(...)

I had initially tried placing it exactly where you suggest in the first draft of v2 of this patch. However, the line would then exceed 72 characters (actual 81 characters):

static void __maybe_unused arm_smmu_disable_pasid(struct arm_smmu_master *master)

So I found myself juggling with how best to wrap it. How about a newline after the __maybe_unused attribute?

static void __maybe_unused arm_smmu_disable_pasid(struct arm_smmu_master *master)

and similarly for the 2nd occurrence:

static inline void __maybe_unused arm_smmu_disable_pasid(struct arm_smmu_master *master) { }

There is precedent for this style of wrapping in xen/common/sched/credit2.c.

#4 lore raw

Hi Stewart,

Quoted 35 lines · Stewart Hildebrand
Quoted 34 lines · Julien Grall

Hi Stewart,

I was about to commit this patch when I noticed the placement of the attribute doesn't match what we are usually doing in Xen.

Quoted 28 lines · Stewart Hildebrand

When building with clang 12 and CONFIG_ARM_SMMU_V3=y, we observe the following build error:

drivers/passthrough/arm/smmu-v3.c:1408:20: error: unused function 'arm_smmu_disable_pasid' [-Werror,-Wunused-function] static inline void arm_smmu_disable_pasid(struct arm_smmu_master *master) { }
                    ^

arm_smmu_disable_pasid is not currently called from anywhere in Xen, but it is inside a section of code guarded by CONFIG_PCI_ATS, which may be helpful in the future if the PASID feature is to be implemented. Add the attribute __maybe_unused to the function.

---
v1->v2:
Add __maybe_unused attribute instead of removing

---
   xen/drivers/passthrough/arm/smmu-v3.c | 2 ++
   1 file changed, 2 insertions(+)
xen/drivers/passthrough/arm/smmu-v3.c +0 -0
index 9c9f4630090e..0cdc862f96d1 100644
@@ -1376,6 +1376,7 @@ static int arm_smmu_enable_pasid(struct arm_smmu_master *master)
       return 0;
   }
 
Quoted 8 lines
Quoted 6 lines

xen/drivers/passthrough/arm/smmu-v3.c static int arm_smmu_enable_pasid(struct arm_smmu_master *master) · line 1380

Quoted 2 lines
xen/drivers/passthrough/arm/smmu-v3.c +1 -0
+__maybe_unused
   static void arm_smmu_disable_pasid(struct arm_smmu_master *master)

The attribute should be placed after "void". I.e.:

static void __maybe_unused arm_smmu_disable_pasid(...)

I had initially tried placing it exactly where you suggest in the first draft of v2 of this patch. However, the line would then exceed 72 characters (actual 81 characters):

This doesn't change the problem here but the limit is 80 characters per line rather than 72.

Quoted 8 lines

static void __maybe_unused arm_smmu_disable_pasid(struct arm_smmu_master *master)

So I found myself juggling with how best to wrap it. How about a newline after the __maybe_unused attribute?

static void __maybe_unused arm_smmu_disable_pasid(struct arm_smmu_master *master)

Quoted 6 lines

and similarly for the 2nd occurrence:

static inline void __maybe_unused arm_smmu_disable_pasid(struct arm_smmu_master *master) { }

There is precedent for this style of wrapping in xen/common/sched/credit2.c.

Ah! I didn't realize the line would have been too long. In this case, the newline after __maybe_unused is the way to go.

Cheers,

Signature · 1 line
Julien Grall
#5 lore raw
Quoted 60 lines · Julien Grall

Hi Stewart,

Quoted 35 lines · Stewart Hildebrand
Quoted 34 lines · Julien Grall

Hi Stewart,

I was about to commit this patch when I noticed the placement of the attribute doesn't match what we are usually doing in Xen.

Quoted 28 lines · Stewart Hildebrand

When building with clang 12 and CONFIG_ARM_SMMU_V3=y, we observe the following build error:

drivers/passthrough/arm/smmu-v3.c:1408:20: error: unused function 'arm_smmu_disable_pasid' [-Werror,-Wunused-function] static inline void arm_smmu_disable_pasid(struct arm_smmu_master *master) { }
                     ^

arm_smmu_disable_pasid is not currently called from anywhere in Xen, but it is inside a section of code guarded by CONFIG_PCI_ATS, which may be helpful in the future if the PASID feature is to be implemented. Add the attribute __maybe_unused to the function.

---
v1->v2:
Add __maybe_unused attribute instead of removing
---
   xen/drivers/passthrough/arm/smmu-v3.c | 2 ++

   1 file changed, 2 insertions(+)
xen/drivers/passthrough/arm/smmu-v3.c +0 -0
index 9c9f4630090e..0cdc862f96d1 100644
@@ -1376,6 +1376,7 @@ static int arm_smmu_enable_pasid(struct arm_smmu_master *master)
        return 0;
    }
 
Quoted 8 lines
Quoted 6 lines

xen/drivers/passthrough/arm/smmu-v3.c static int arm_smmu_enable_pasid(struct arm_smmu_master *master) · line 1380

Quoted 2 lines
xen/drivers/passthrough/arm/smmu-v3.c +1 -0
+__maybe_unused
    static void arm_smmu_disable_pasid(struct arm_smmu_master *master)

The attribute should be placed after "void". I.e.:

static void __maybe_unused arm_smmu_disable_pasid(...)

I had initially tried placing it exactly where you suggest in the first draft of v2 of this patch. However, the line would then exceed 72 characters (actual 81 characters):

This doesn't change the problem here but the limit is 80 characters per line rather than 72.

Quoted 10 lines

static void __maybe_unused arm_smmu_disable_pasid(struct arm_smmu_master *master)

So I found myself juggling with how best to wrap it. How about a newline after the __maybe_unused attribute?

static void __maybe_unused arm_smmu_disable_pasid(struct arm_smmu_master *master)

and similarly for the 2nd occurrence:

Quoted 7 lines
Quoted 4 lines

static inline void __maybe_unused arm_smmu_disable_pasid(struct arm_smmu_master *master) { }

There is precedent for this style of wrapping in xen/common/sched/credit2.c.

Ah! I didn't realize the line would have been too long. In this case, the newline after __maybe_unused is the way to go.

Ok, I will send a v3 with this change.

Rahul - may I retain your R-b tag in v3?

#6 lore raw

Hi Stewart,

Quoted 66 lines · Stewart Hildebrand
Quoted 63 lines · Julien Grall

Hi Stewart,

Quoted 35 lines · Stewart Hildebrand
Quoted 34 lines · Julien Grall

Hi Stewart,

I was about to commit this patch when I noticed the placement of the attribute doesn't match what we are usually doing in Xen.

Quoted 28 lines · Stewart Hildebrand

When building with clang 12 and CONFIG_ARM_SMMU_V3=y, we observe the following build error:

drivers/passthrough/arm/smmu-v3.c:1408:20: error: unused function 'arm_smmu_disable_pasid' [-Werror,-Wunused-function] static inline void arm_smmu_disable_pasid(struct arm_smmu_master *master) { }

                     ^

arm_smmu_disable_pasid is not currently called from anywhere in Xen, but it is inside a section of code guarded by CONFIG_PCI_ATS, which may be helpful in the future if the PASID feature is to be implemented. Add the attribute __maybe_unused to the function.

---
v1->v2:
Add __maybe_unused attribute instead of removing

---
   xen/drivers/passthrough/arm/smmu-v3.c | 2 ++
   1 file changed, 2 insertions(+)
xen/drivers/passthrough/arm/smmu-v3.c +0 -0
index 9c9f4630090e..0cdc862f96d1 100644
@@ -1376,6 +1376,7 @@ static int arm_smmu_enable_pasid(struct arm_smmu_master *master)
       return 0;
   }
 
Quoted 8 lines
Quoted 6 lines

xen/drivers/passthrough/arm/smmu-v3.c static int arm_smmu_enable_pasid(struct arm_smmu_master *master) · line 1380

Quoted 2 lines
xen/drivers/passthrough/arm/smmu-v3.c +1 -0
+__maybe_unused
   static void arm_smmu_disable_pasid(struct arm_smmu_master *master)

The attribute should be placed after "void". I.e.:

static void __maybe_unused arm_smmu_disable_pasid(...)

I had initially tried placing it exactly where you suggest in the first draft of v2 of this patch. However, the line would then exceed 72 characters (actual 81 characters):

This doesn't change the problem here but the limit is 80 characters per line rather than 72.

Quoted 13 lines

static void __maybe_unused arm_smmu_disable_pasid(struct arm_smmu_master *master)

So I found myself juggling with how best to wrap it. How about a newline after the __maybe_unused attribute?

static void __maybe_unused arm_smmu_disable_pasid(struct arm_smmu_master *master)

and similarly for the 2nd occurrence:

static inline void __maybe_unused arm_smmu_disable_pasid(struct arm_smmu_master *master) { }

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

There is precedent for this style of wrapping in xen/common/sched/credit2.c.

Ah! I didn't realize the line would have been too long. In this case, the newline after __maybe_unused is the way to go.

Ok, I will send a v3 with this change.

Rahul - may I retain your R-b tag in v3?

Yes you can retain my R-b.

Regards,
Rahul