linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/4] powerpc/kvm: Fix ifdef to remove build warning
@ 2025-05-18  4:41 Madhavan Srinivasan
  2025-05-18  4:41 ` [PATCH v2 2/4] powerpc/perf: make isa207_pmu_format_group struct static Madhavan Srinivasan
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Madhavan Srinivasan @ 2025-05-18  4:41 UTC (permalink / raw)
  To: mpe, npiggin, christophe.leroy
  Cc: naveen, linuxppc-dev, Madhavan Srinivasan, Venkat Rao Bagalkote

When compiling for pseries or powernv defconfig with "make C=1",
these warning were reported bu sparse tool in powerpc/kernel/kvm.c

arch/powerpc/kernel/kvm.c:635:9: warning: switch with no cases
arch/powerpc/kernel/kvm.c:646:9: warning: switch with no cases

Currently #ifdef were added after the switch case which are specific
for BOOKE and PPC_BOOK3S_32. These are not enabled in pseries/powernv
defconfig. Fix it by moving the #ifdef before switch(){}

Fixes: cbe487fac7fc0 ("KVM: PPC: Add mtsrin PV code")
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
---
Changelog v1:
- Changed the patch title
- Added tags

 arch/powerpc/kernel/kvm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index 5b3c093611ba..7209d00a9c25 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -632,19 +632,19 @@ static void __init kvm_check_ins(u32 *inst, u32 features)
 #endif
 	}
 
-	switch (inst_no_rt & ~KVM_MASK_RB) {
 #ifdef CONFIG_PPC_BOOK3S_32
+	switch (inst_no_rt & ~KVM_MASK_RB) {
 	case KVM_INST_MTSRIN:
 		if (features & KVM_MAGIC_FEAT_SR) {
 			u32 inst_rb = _inst & KVM_MASK_RB;
 			kvm_patch_ins_mtsrin(inst, inst_rt, inst_rb);
 		}
 		break;
-#endif
 	}
+#endif
 
-	switch (_inst) {
 #ifdef CONFIG_BOOKE
+	switch (_inst) {
 	case KVM_INST_WRTEEI_0:
 		kvm_patch_ins_wrteei_0(inst);
 		break;
@@ -652,8 +652,8 @@ static void __init kvm_check_ins(u32 *inst, u32 features)
 	case KVM_INST_WRTEEI_1:
 		kvm_patch_ins_wrtee(inst, 0, 1);
 		break;
-#endif
 	}
+#endif
 }
 
 extern u32 kvm_template_start[];
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/4] powerpc/perf: make isa207_pmu_format_group struct static
  2025-05-18  4:41 [PATCH v2 1/4] powerpc/kvm: Fix ifdef to remove build warning Madhavan Srinivasan
@ 2025-05-18  4:41 ` Madhavan Srinivasan
  2025-05-18  9:20   ` kernel test robot
  2025-05-18  4:41 ` [PATCH v2 3/4] powerpc/prom_init: Fix shellcheck warnings Madhavan Srinivasan
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Madhavan Srinivasan @ 2025-05-18  4:41 UTC (permalink / raw)
  To: mpe, npiggin, christophe.leroy
  Cc: naveen, linuxppc-dev, Madhavan Srinivasan, Venkat Rao Bagalkote

isa207_pmu_format_group struct is local to the source and does not need to
be in global scope, so make it static

Cleans up sparse warning:
arch/powerpc/perf/isa207-common.c:40:30: warning: symbol 'isa207_pmu_format_group'
was not declared. Should it be static?

Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
---
Changelog v1:
- Added tested by tag

 arch/powerpc/perf/isa207-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/perf/isa207-common.c b/arch/powerpc/perf/isa207-common.c
index 2b3547fdba4a..bbef51849f33 100644
--- a/arch/powerpc/perf/isa207-common.c
+++ b/arch/powerpc/perf/isa207-common.c
@@ -37,7 +37,7 @@ static struct attribute *isa207_pmu_format_attr[] = {
 	NULL,
 };
 
-const struct attribute_group isa207_pmu_format_group = {
+static const struct attribute_group isa207_pmu_format_group = {
 	.name = "format",
 	.attrs = isa207_pmu_format_attr,
 };
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 3/4] powerpc/prom_init: Fix shellcheck warnings
  2025-05-18  4:41 [PATCH v2 1/4] powerpc/kvm: Fix ifdef to remove build warning Madhavan Srinivasan
  2025-05-18  4:41 ` [PATCH v2 2/4] powerpc/perf: make isa207_pmu_format_group struct static Madhavan Srinivasan
@ 2025-05-18  4:41 ` Madhavan Srinivasan
  2025-05-18  4:41 ` [PATCH v2 4/4] powerpc/boot/install.sh: " Madhavan Srinivasan
  2025-08-28  6:33 ` [PATCH v2 1/4] powerpc/kvm: Fix ifdef to remove build warning Madhavan Srinivasan
  3 siblings, 0 replies; 6+ messages in thread
From: Madhavan Srinivasan @ 2025-05-18  4:41 UTC (permalink / raw)
  To: mpe, npiggin, christophe.leroy
  Cc: naveen, linuxppc-dev, Madhavan Srinivasan, Stephen Rothwell,
	Venkat Rao Bagalkote

Fix "Double quote to prevent globbing and word splitting."
warning from shellcheck

Reviewed-by: Stephen Rothwell <sfr@cab.auug.org.au>
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
---
Changelog v1:
- Added tags

 arch/powerpc/kernel/prom_init_check.sh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/kernel/prom_init_check.sh b/arch/powerpc/kernel/prom_init_check.sh
index 69623b9045d5..3090b97258ae 100644
--- a/arch/powerpc/kernel/prom_init_check.sh
+++ b/arch/powerpc/kernel/prom_init_check.sh
@@ -15,8 +15,8 @@
 
 has_renamed_memintrinsics()
 {
-	grep -q "^CONFIG_KASAN=y$" ${KCONFIG_CONFIG} && \
-		! grep -q "^CONFIG_CC_HAS_KASAN_MEMINTRINSIC_PREFIX=y" ${KCONFIG_CONFIG}
+	grep -q "^CONFIG_KASAN=y$" "${KCONFIG_CONFIG}" && \
+		! grep -q "^CONFIG_CC_HAS_KASAN_MEMINTRINSIC_PREFIX=y" "${KCONFIG_CONFIG}"
 }
 
 if has_renamed_memintrinsics
@@ -42,15 +42,15 @@ check_section()
 {
     file=$1
     section=$2
-    size=$(objdump -h -j $section $file 2>/dev/null | awk "\$2 == \"$section\" {print \$3}")
+    size=$(objdump -h -j "$section" "$file" 2>/dev/null | awk "\$2 == \"$section\" {print \$3}")
     size=${size:-0}
-    if [ $size -ne 0 ]; then
+    if [ "$size" -ne 0 ]; then
 	ERROR=1
 	echo "Error: Section $section not empty in prom_init.c" >&2
     fi
 }
 
-for UNDEF in $($NM -u $OBJ | awk '{print $2}')
+for UNDEF in $($NM -u "$OBJ" | awk '{print $2}')
 do
 	# On 64-bit nm gives us the function descriptors, which have
 	# a leading . on the name, so strip it off here.
@@ -87,8 +87,8 @@ do
 	fi
 done
 
-check_section $OBJ .data
-check_section $OBJ .bss
-check_section $OBJ .init.data
+check_section "$OBJ" .data
+check_section "$OBJ" .bss
+check_section "$OBJ" .init.data
 
 exit $ERROR
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 4/4] powerpc/boot/install.sh: Fix shellcheck warnings
  2025-05-18  4:41 [PATCH v2 1/4] powerpc/kvm: Fix ifdef to remove build warning Madhavan Srinivasan
  2025-05-18  4:41 ` [PATCH v2 2/4] powerpc/perf: make isa207_pmu_format_group struct static Madhavan Srinivasan
  2025-05-18  4:41 ` [PATCH v2 3/4] powerpc/prom_init: Fix shellcheck warnings Madhavan Srinivasan
@ 2025-05-18  4:41 ` Madhavan Srinivasan
  2025-08-28  6:33 ` [PATCH v2 1/4] powerpc/kvm: Fix ifdef to remove build warning Madhavan Srinivasan
  3 siblings, 0 replies; 6+ messages in thread
From: Madhavan Srinivasan @ 2025-05-18  4:41 UTC (permalink / raw)
  To: mpe, npiggin, christophe.leroy
  Cc: naveen, linuxppc-dev, Madhavan Srinivasan, Venkat Rao Bagalkote

Fix shellcheck warning such as
"Double quote to prevent globbing and word splitting." and
Use $(...) notation instead of legacy backticks `...`.

Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
---
Changelog v1:
-Added tested by tag

 arch/powerpc/boot/install.sh | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/boot/install.sh b/arch/powerpc/boot/install.sh
index 101fcb397a0f..c3df6c27ce75 100755
--- a/arch/powerpc/boot/install.sh
+++ b/arch/powerpc/boot/install.sh
@@ -19,19 +19,19 @@
 set -e
 
 # this should work for both the pSeries zImage and the iSeries vmlinux.sm
-image_name=`basename $2`
+image_name=$(basename "$2")
 
 
 echo "Warning: '${INSTALLKERNEL}' command not available... Copying" \
      "directly to $4/$image_name-$1" >&2
 
-if [ -f $4/$image_name-$1 ]; then
-	mv $4/$image_name-$1 $4/$image_name-$1.old
+if [ -f "$4"/"$image_name"-"$1" ]; then
+	mv "$4"/"$image_name"-"$1" "$4"/"$image_name"-"$1".old
 fi
 
-if [ -f $4/System.map-$1 ]; then
-	mv $4/System.map-$1 $4/System-$1.old
+if [ -f "$4"/System.map-"$1" ]; then
+	mv "$4"/System.map-"$1" "$4"/System-"$1".old
 fi
 
-cat $2 > $4/$image_name-$1
-cp $3 $4/System.map-$1
+cat "$2" > "$4"/"$image_name"-"$1"
+cp "$3" "$4"/System.map-"$1"
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/4] powerpc/perf: make isa207_pmu_format_group struct static
  2025-05-18  4:41 ` [PATCH v2 2/4] powerpc/perf: make isa207_pmu_format_group struct static Madhavan Srinivasan
@ 2025-05-18  9:20   ` kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2025-05-18  9:20 UTC (permalink / raw)
  To: Madhavan Srinivasan, mpe, npiggin, christophe.leroy
  Cc: oe-kbuild-all, naveen, linuxppc-dev, Madhavan Srinivasan,
	Venkat Rao Bagalkote

Hi Madhavan,

kernel test robot noticed the following build errors:

[auto build test ERROR on powerpc/next]
[also build test ERROR on powerpc/fixes linus/master powerpc/topic/ppc-kvm v6.15-rc6 next-20250516]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Madhavan-Srinivasan/powerpc-perf-make-isa207_pmu_format_group-struct-static/20250518-124244
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
patch link:    https://lore.kernel.org/r/20250518044107.39928-2-maddy%40linux.ibm.com
patch subject: [PATCH v2 2/4] powerpc/perf: make isa207_pmu_format_group struct static
config: powerpc64-randconfig-002-20250518 (https://download.01.org/0day-ci/archive/20250518/202505181711.k5ONrdnI-lkp@intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250518/202505181711.k5ONrdnI-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505181711.k5ONrdnI-lkp@intel.com/

All errors (new ones prefixed by >>):

>> powerpc64-linux-ld: arch/powerpc/perf/power8-pmu.o:arch/powerpc/perf/power8-pmu.c:199: undefined reference to `isa207_pmu_format_group'

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/4] powerpc/kvm: Fix ifdef to remove build warning
  2025-05-18  4:41 [PATCH v2 1/4] powerpc/kvm: Fix ifdef to remove build warning Madhavan Srinivasan
                   ` (2 preceding siblings ...)
  2025-05-18  4:41 ` [PATCH v2 4/4] powerpc/boot/install.sh: " Madhavan Srinivasan
@ 2025-08-28  6:33 ` Madhavan Srinivasan
  3 siblings, 0 replies; 6+ messages in thread
From: Madhavan Srinivasan @ 2025-08-28  6:33 UTC (permalink / raw)
  To: mpe, npiggin, christophe.leroy, Madhavan Srinivasan
  Cc: naveen, linuxppc-dev, Venkat Rao Bagalkote

On Sun, 18 May 2025 10:11:04 +0530, Madhavan Srinivasan wrote:
> When compiling for pseries or powernv defconfig with "make C=1",
> these warning were reported bu sparse tool in powerpc/kernel/kvm.c
> 
> arch/powerpc/kernel/kvm.c:635:9: warning: switch with no cases
> arch/powerpc/kernel/kvm.c:646:9: warning: switch with no cases
> 
> Currently #ifdef were added after the switch case which are specific
> for BOOKE and PPC_BOOK3S_32. These are not enabled in pseries/powernv
> defconfig. Fix it by moving the #ifdef before switch(){}
> 
> [...]

Applied to powerpc/fixes.

[1/4] powerpc/kvm: Fix ifdef to remove build warning
      https://git.kernel.org/powerpc/c/88688a2c8ac6c8036d983ad8b34ce191c46a10aa
[3/4] powerpc/prom_init: Fix shellcheck warnings
      https://git.kernel.org/powerpc/c/d40ae9033418095642f65f4fd54dc5a7d292ee39
[4/4] powerpc/boot/install.sh: Fix shellcheck warnings
      https://git.kernel.org/powerpc/c/8763d2257f5231cfdfd8a53594647927dbf8bb06

Thanks


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-08-28  6:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-18  4:41 [PATCH v2 1/4] powerpc/kvm: Fix ifdef to remove build warning Madhavan Srinivasan
2025-05-18  4:41 ` [PATCH v2 2/4] powerpc/perf: make isa207_pmu_format_group struct static Madhavan Srinivasan
2025-05-18  9:20   ` kernel test robot
2025-05-18  4:41 ` [PATCH v2 3/4] powerpc/prom_init: Fix shellcheck warnings Madhavan Srinivasan
2025-05-18  4:41 ` [PATCH v2 4/4] powerpc/boot/install.sh: " Madhavan Srinivasan
2025-08-28  6:33 ` [PATCH v2 1/4] powerpc/kvm: Fix ifdef to remove build warning Madhavan Srinivasan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).