Final series to make Arm MISRA allcode green
cover Final series to make Arm MISRA allcode green
No more regressions for clean guidelines:
https://gitlab.com/xen-project/people/morzel/xen/-/pipelines/2433943072
Michal Orzel (2):
iommu/arm: smmu: Fix variable shadowing
iommu/arm: ipmmu-vmsa: Fix variable shadowing
xen/drivers/passthrough/arm/ipmmu-vmsa.c | 6 ++---- xen/drivers/passthrough/arm/smmu.c | 7 +++---- 2 files changed, 5 insertions(+), 8 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/2 iommu/arm: smmu: Fix variable shadowing
Rename 'pdev' to 'pci_dev' in the dev_print_pci() macro to avoid shadowing local 'pdev' variables at call sites.
Remove the unused 'ret' declaration from arm_smmu_dt_add_device_generic() where the function-scope 'ret' is sufficient.
Fix shadowing of 'domain' in arm_smmu_assign_dev() by removing the inner-scope redeclaration, using the function-scope variable instead.
This fixes MISRA C R5.3.
--- xen/drivers/passthrough/arm/smmu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
xen/drivers/passthrough/arm/smmu.c +3 -4
@@ -130,8 +130,8 @@ typedef enum irqreturn irqreturn_t; printk(lvl "smmu: %s: " fmt, dev_name((dev)), ## __VA_ARGS__); \ else \ { \ -struct pci_dev *pdev =dev_to_pci ((dev)); \ - printk(lvl "smmu: %pp: " fmt, &pdev->sbdf, ## __VA_ARGS__); \ +struct pci_dev *pci_dev =dev_to_pci ((dev)); \ + printk(lvl "smmu: %pp: " fmt, &pci_dev->sbdf, ## __VA_ARGS__); \ } \ })#endif
@@ -927,7 +927,6 @@ static int arm_smmu_dt_add_device_generic(u8 devfn, struct device *dev)if (dev_is_pci (dev) ) {struct pci_dev *pdev =dev_to_pci (dev); -int ret;/* Ignore calls for phantom functions */ if ( devfn != pdev->devfn )
@@ -2788,7 +2787,7 @@ static int arm_smmu_assign_dev(struct domain *d, u8 devfn,/* dom_io is used as a sentinel for quarantined devices */ if ( d == dom_io ) { -struct iommu_domain *domain =dev_iommu_domain (dev); + domain =dev_iommu_domain (dev);if ( !iommu_quarantine )return 0 ;
Signature · 1 line
2.43.0
Re: [PATCH 1/2] iommu/arm: smmu: Fix variable shadowing
Quoted 6 lines · Michal Orzel
Rename 'pdev' to '
pci_dev' in thedev_print_pci()macro to avoid shadowing local 'pdev' variables at call sites.Remove the unused 'ret' declaration from
arm_smmu_dt_add_device_generic()where the function-scope 'ret' is sufficient.
Quoted 6 lines
Fix shadowing of 'domain' in
arm_smmu_assign_dev()by removing the inner-scope redeclaration, using the function-scope variable instead.This fixes MISRA C R5.3.
Signed-off-by Michal Orzel <[email protected]>
Quoted 39 lines
--- xen/drivers/passthrough/arm/smmu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)xen/drivers/passthrough/arm/smmu.c +3
-4@@ -130,8 +130,8 @@ typedef enum irqreturn irqreturn_t; printk(lvl "smmu: %s: " fmt, dev_name((dev)), ## __VA_ARGS__); \ else \ { \ -struct pci_dev *pdev =dev_to_pci ((dev)); \ - printk(lvl "smmu: %pp: " fmt, &pdev->sbdf, ## __VA_ARGS__); \ +struct pci_dev *pci_dev =dev_to_pci ((dev)); \ + printk(lvl "smmu: %pp: " fmt, &pci_dev->sbdf, ## __VA_ARGS__); \ } \ })#endif @@ -927,7 +927,6 @@ static int arm_smmu_dt_add_device_generic(u8 devfn, struct device *dev)if (dev_is_pci (dev) ) {struct pci_dev *pdev =dev_to_pci (dev); -int ret;/* Ignore calls for phantom functions */ if ( devfn != pdev->devfn )@@ -2788,7 +2787,7 @@ static int arm_smmu_assign_dev(struct domain *d, u8 devfn,/* dom_io is used as a sentinel for quarantined devices */ if ( d == dom_io ) { -struct iommu_domain *domain =dev_iommu_domain (dev); + domain =dev_iommu_domain (dev);if ( !iommu_quarantine )return 0 ;Signature · 1 line
2.43.0
PATCH 2/2 iommu/arm: ipmmu-vmsa: Fix variable shadowing
In reply to Michal OrzelRename 'pdev' to 'pci_dev' in the dev_print_pci() macro to avoid shadowing local 'pdev' variables at call sites.
Remove the unused 'ret' declaration from ipmmu_assign_device() where the function-scope 'ret' is sufficient.
This fixes MISRA C R5.3.
--- xen/drivers/passthrough/arm/ipmmu-vmsa.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
xen/drivers/passthrough/arm/ipmmu-vmsa.c +2 -4
@@ -65,8 +65,8 @@ printk(lvl "ipmmu: %s: " fmt, dev_name((dev)), ## __VA_ARGS__); \ else \ { \ -struct pci_dev *pdev =dev_to_pci ((dev)); \ - printk(lvl "ipmmu: %pp: " fmt, &pdev->sbdf, ## __VA_ARGS__); \ +struct pci_dev *pci_dev =dev_to_pci ((dev)); \ + printk(lvl "ipmmu: %pp: " fmt, &pci_dev->sbdf, ## __VA_ARGS__); \ } \ })#endif
@@ -1171,8 +1171,6 @@ static int ipmmu_assign_device(struct domain *d, u8 devfn, struct device *dev,/* dom_io is used as a sentinel for quarantined devices */ if ( d == dom_io ) { -int ret; -/* * Try to de-assign: do not return error if it was already * de-assigned.
Signature · 1 line
2.43.0
Re: [PATCH 2/2] iommu/arm: ipmmu-vmsa: Fix variable shadowing
On 4/7/26 13:34, Michal Orzel wrote:
Hello Michal
Quoted 1 line
Rename 'pdev' to '
pci_dev' in thedev_print_pci()macro to avoid
NIT: The macro is named dev_print, not dev_print_pci.
Quoted 8 lines
shadowing local 'pdev' variables at call sites.
Remove the unused 'ret' declaration from
ipmmu_assign_device()where the function-scope 'ret' is sufficient.This fixes MISRA C R5.3.
Signed-off-by Michal Orzel <[email protected]>
Quoted 28 lines
--- xen/drivers/passthrough/arm/ipmmu-vmsa.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)xen/drivers/passthrough/arm/ipmmu-vmsa.c +2
-4@@ -65,8 +65,8 @@ printk(lvl "ipmmu: %s: " fmt, dev_name((dev)), ## __VA_ARGS__); \ else \ { \ -struct pci_dev *pdev =dev_to_pci ((dev)); \ - printk(lvl "ipmmu: %pp: " fmt, &pdev->sbdf, ## __VA_ARGS__); \ +struct pci_dev *pci_dev =dev_to_pci ((dev)); \ + printk(lvl "ipmmu: %pp: " fmt, &pci_dev->sbdf, ## __VA_ARGS__); \ } \ })#endif @@ -1171,8 +1171,6 @@ static int ipmmu_assign_device(struct domain *d, u8 devfn, struct device *dev,/* dom_io is used as a sentinel for quarantined devices */ if ( d == dom_io ) { -int ret; -/* * Try to de-assign: do not return error if it was already * de-assigned.
Re: [PATCH 2/2] iommu/arm: ipmmu-vmsa: Fix variable shadowing
In reply to Michal OrzelQuoted 9 lines · Michal Orzel
Rename 'pdev' to '
pci_dev' in thedev_print_pci()macro to avoid shadowing local 'pdev' variables at call sites.Remove the unused 'ret' declaration from
ipmmu_assign_device()where the function-scope 'ret' is sufficient.This fixes MISRA C R5.3.
Signed-off-by Michal Orzel <[email protected]>
Quoted 31 lines
--- xen/drivers/passthrough/arm/ipmmu-vmsa.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)xen/drivers/passthrough/arm/ipmmu-vmsa.c +2
-4@@ -65,8 +65,8 @@ printk(lvl "ipmmu: %s: " fmt, dev_name((dev)), ## __VA_ARGS__); \ else \ { \ -struct pci_dev *pdev =dev_to_pci ((dev)); \ - printk(lvl "ipmmu: %pp: " fmt, &pdev->sbdf, ## __VA_ARGS__); \ +struct pci_dev *pci_dev =dev_to_pci ((dev)); \ + printk(lvl "ipmmu: %pp: " fmt, &pci_dev->sbdf, ## __VA_ARGS__); \ } \ })#endif @@ -1171,8 +1171,6 @@ static int ipmmu_assign_device(struct domain *d, u8 devfn, struct device *dev,/* dom_io is used as a sentinel for quarantined devices */ if ( d == dom_io ) { -int ret; -/* * Try to de-assign: do not return error if it was already * de-assigned. Signature · 1 line
2.43.0
Quoted 10 lines · Michal Orzel
No more regressions for clean guidelines:
https://gitlab.com/xen-project/people/morzel/xen/-/pipelines/2433943072Michal Orzel (2):
iommu/arm: smmu: Fix variable shadowing
iommu/arm: ipmmu-vmsa: Fix variable shadowingxen/drivers/passthrough/arm/ipmmu-vmsa.c | 6 ++---- xen/drivers/passthrough/arm/smmu.c | 7 +++---- 2 files changed, 5 insertions(+), 8 deletions(-)
If all the violations are fixed, should this test be made blocking?
~Andrew
Quoted 8 lines · Andrew Cooper
Quoted 7 lines · Michal Orzel
No more regressions for clean guidelines:
https://gitlab.com/xen-project/people/morzel/xen/-/pipelines/2433943072Michal Orzel (2):
iommu/arm: smmu: Fix variable shadowing
iommu/arm: ipmmu-vmsa: Fix variable shadowing
Quoted 7 lines
Quoted 3 lines
xen/drivers/passthrough/arm/ipmmu-vmsa.c | 6 ++---- xen/drivers/passthrough/arm/smmu.c | 7 +++---- 2 files changed, 5 insertions(+), 8 deletions(-)If all the violations are fixed, should this test be made blocking?
~Andrew
Only if they are also clean on x86; otherwise an arm-specific list of clean rules should be made (probably better). @Michal what do you prefer?
Signature · 4 lines
Nicola Vetrini, B.Sc. Software Engineer BUGSENG (https://bugseng.com) LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253
Quoted 13 lines · Nicola Vetrini
Quoted 12 lines · Andrew Cooper
Quoted 10 lines · Michal Orzel
No more regressions for clean guidelines:
https://gitlab.com/xen-project/people/morzel/xen/-/pipelines/2433943072Michal Orzel (2):
iommu/arm: smmu: Fix variable shadowing
iommu/arm: ipmmu-vmsa: Fix variable shadowingxen/drivers/passthrough/arm/ipmmu-vmsa.c | 6 ++---- xen/drivers/passthrough/arm/smmu.c | 7 +++----
2 files changed, 5 insertions(+), 8 deletions(-)
Quoted 7 lines
Quoted 3 lines
If all the violations are fixed, should this test be made blocking?
~Andrew
Only if they are also clean on x86; otherwise an arm-specific list of clean rules should be made (probably better). @Michal what do you prefer?
All I'm suggesting is this:
xen.git/xen$ git diff
automation/gitlab-ci/analyze.yaml +0 -0
@@ -149,7 +149,7 @@ eclair-ARM64-allcode:
CONFIG_STACK_PROTECTOR=y
CONFIG_UNSUPPORTED=y
CONFIG_VM_EVENT=y
- allow_failure: true
+ allow_failure: false
eclair-ARM64-testing:
extends: eclair-ARM64-allcode
so regressions become blocking.
~Andrew
Quoted 40 lines · Andrew Cooper
Quoted 13 lines · Nicola Vetrini
Quoted 12 lines · Andrew Cooper
Quoted 10 lines · Michal Orzel
No more regressions for clean guidelines:
https://gitlab.com/xen-project/people/morzel/xen/-/pipelines/2433943072Michal Orzel (2):
iommu/arm: smmu: Fix variable shadowing
iommu/arm: ipmmu-vmsa: Fix variable shadowingxen/drivers/passthrough/arm/ipmmu-vmsa.c | 6 ++---- xen/drivers/passthrough/arm/smmu.c | 7 +++----
2 files changed, 5 insertions(+), 8 deletions(-)Quoted 7 lines
Quoted 3 lines
If all the violations are fixed, should this test be made blocking?
~Andrew
Only if they are also clean on x86; otherwise an arm-specific list of clean rules should be made (probably better). @Michal what do you prefer?
All I'm suggesting is this:
xen.git/xen$ git diff
automation/gitlab-ci/analyze.yaml +0
-0@@ -149,7 +149,7 @@ eclair-ARM64-allcode:CONFIG_STACK_PROTECTOR=y
CONFIG_UNSUPPORTED=y
CONFIG_VM_EVENT=y
-allow_failure: true
+allow_failure: false
eclair-ARM64-testing:
extends: eclair-ARM64-allcode
Quoted 3 lines
so regressions become blocking.
~Andrew
Ah, yes, indeed. I didn't look at the patches but given the diff it makes sense
Signature · 4 lines
Nicola Vetrini, B.Sc. Software Engineer BUGSENG (https://bugseng.com) LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253
Quoted 43 lines · Nicola Vetrini
Quoted 42 lines · Andrew Cooper
Quoted 13 lines · Nicola Vetrini
Quoted 12 lines · Andrew Cooper
Quoted 10 lines · Michal Orzel
No more regressions for clean guidelines:
https://gitlab.com/xen-project/people/morzel/xen/-/pipelines/2433943072Michal Orzel (2):
iommu/arm: smmu: Fix variable shadowing
iommu/arm: ipmmu-vmsa: Fix variable shadowingxen/drivers/passthrough/arm/ipmmu-vmsa.c | 6 ++---- xen/drivers/passthrough/arm/smmu.c | 7 +++----
2 files changed, 5 insertions(+), 8 deletions(-)Quoted 8 lines
Quoted 3 lines
If all the violations are fixed, should this test be made blocking?
~Andrew
Only if they are also clean on x86; otherwise an arm-specific list of clean rules should be made (probably better). @Michal what do you prefer?
All I'm suggesting is this:
xen.git/xen$ git diff
automation/gitlab-ci/analyze.yaml +0
-0@@ -149,7 +149,7 @@ eclair-ARM64-allcode:CONFIG_STACK_PROTECTOR=y
CONFIG_UNSUPPORTED=y
CONFIG_VM_EVENT=y
-allow_failure: true
+allow_failure: false
eclair-ARM64-testing:
extends: eclair-ARM64-allcode
Quoted 6 lines
Quoted 3 lines
so regressions become blocking.
~Andrew
Ah, yes, indeed. I didn't look at the patches but given the diff it makes sense
In general that's a good idea and something I had in mind. That said, we will likely be expanding the list of enabled features there as soon as one arrives. What should we do in that case? Make sure that before adding new =y option, the allcode passes in our Xen fork?
~Michal
Quoted 44 lines · Michal
Quoted 42 lines · Nicola Vetrini
Quoted 41 lines · Andrew Cooper
Quoted 12 lines · Nicola Vetrini
Quoted 11 lines · Andrew Cooper
Quoted 10 lines · Michal Orzel
No more regressions for clean guidelines:
https://gitlab.com/xen-project/people/morzel/xen/-/pipelines/2433943072Michal Orzel (2):
iommu/arm: smmu: Fix variable shadowing
iommu/arm: ipmmu-vmsa: Fix variable shadowingxen/drivers/passthrough/arm/ipmmu-vmsa.c | 6 ++---- xen/drivers/passthrough/arm/smmu.c | 7 +++----
2 files changed, 5 insertions(+), 8 deletions(-)Quoted 7 lines
Quoted 3 lines
If all the violations are fixed, should this test be made blocking?
~Andrew
Only if they are also clean on x86; otherwise an arm-specific list of clean rules should be made (probably better). @Michal what do you prefer?
All I'm suggesting is this:
xen.git/xen$ git diff
automation/gitlab-ci/analyze.yaml +0
-0@@ -149,7 +149,7 @@ eclair-ARM64-allcode:CONFIG_STACK_PROTECTOR=y
CONFIG_UNSUPPORTED=y
CONFIG_VM_EVENT=y
-allow_failure: true
+allow_failure: false
eclair-ARM64-testing:
extends: eclair-ARM64-allcodeso regressions become blocking.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
~Andrew
Ah, yes, indeed. I didn't look at the patches but given the diff it makes sense
In general that's a good idea and something I had in mind. That said, we will likely be expanding the list of enabled features there as soon as one arrives. What should we do in that case? Make sure that before adding new =y option, the allcode passes in our Xen fork?
New code could be clean as it goes in. At this point, it's not interestingly different from "does it compile" as a prerequisite.
~Andrew
Quoted 48 lines · Andrew Cooper
Quoted 47 lines · Michal
Quoted 45 lines · Nicola Vetrini
Quoted 39 lines · Andrew Cooper
Quoted 12 lines · Nicola Vetrini
Quoted 11 lines · Andrew Cooper
Quoted 10 lines · Michal Orzel
No more regressions for clean guidelines:
https://gitlab.com/xen-project/people/morzel/xen/-/pipelines/2433943072Michal Orzel (2):
iommu/arm: smmu: Fix variable shadowing
iommu/arm: ipmmu-vmsa: Fix variable shadowingxen/drivers/passthrough/arm/ipmmu-vmsa.c | 6 ++---- xen/drivers/passthrough/arm/smmu.c | 7 +++----
2 files changed, 5 insertions(+), 8 deletions(-)Quoted 7 lines
Quoted 3 lines
If all the violations are fixed, should this test be made blocking?
~Andrew
Only if they are also clean on x86; otherwise an arm-specific list of clean rules should be made (probably better). @Michal what do you prefer?
All I'm suggesting is this:
xen.git/xen$ git diff
automation/gitlab-ci/analyze.yaml +0
-0@@ -149,7 +149,7 @@ eclair-ARM64-allcode:CONFIG_STACK_PROTECTOR=y
CONFIG_UNSUPPORTED=y
CONFIG_VM_EVENT=y
-allow_failure: true
+allow_failure: false
eclair-ARM64-testing:
extends: eclair-ARM64-allcodeQuoted 3 lines
so regressions become blocking.
~Andrew
Ah, yes, indeed. I didn't look at the patches but given the diff it makes sense
Quoted 7 lines
Quoted 4 lines
In general that's a good idea and something I had in mind. That said, we will likely be expanding the list of enabled features there as soon as one arrives. What should we do in that case? Make sure that before adding new =y option, the allcode passes in our Xen fork?
New code could be clean as it goes in. At this point, it's not interestingly different from "does it compile" as a prerequisite.
I can see there are some missing features like static memory/shared memory but they are tested as part of AMD (it would still be good to have all listed in allcode). Additionally, we could enable early printk with some dummy values to cover early_printk.c
~Michal