Skip to contentSkip to conversation

riscv: misc clean up

PATCH In review Jisheng Zhang 3 participants 8 messages Nov 28, 2021 – Jan 9, 2022

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

cover riscv: misc clean up

This series is a misc clean up: clean up useless LoCs, or make some functions static, or mark function pointer as __initdata, or remove one function().

Jisheng Zhang (5):
riscv: remove cpu_stop()
riscv: head: make secondary_start_common() static
riscv: kvm: make kvm_riscv_vcpu_fp_clean() static
riscv: errata: alternative: mark vendor_patch_func __initdata
riscv: head: remove useless __PAGE_ALIGNED_BSS and .balign

 arch/riscv/errata/alternative.c | 3 ++-
 arch/riscv/include/asm/smp.h    | 2 --
 arch/riscv/kernel/cpu-hotplug.c | 8 +-------
 arch/riscv/kernel/head.S        | 9 ++-------
 arch/riscv/kvm/vcpu_fp.c        | 2 +-
 5 files changed, 6 insertions(+), 18 deletions(-)
Signature · 1 line
2.34.0
#1 lore raw

PATCH 1/5 riscv: remove cpu_stop()

Except arch_cpu_idle_dead(), no users of this function. So remove cpu_stop() and fold its code into arch_cpu_idle_dead().

---
 arch/riscv/include/asm/smp.h    | 2 --
 arch/riscv/kernel/cpu-hotplug.c | 8 +-------
 2 files changed, 1 insertion(+), 9 deletions(-)
arch/riscv/include/asm/smp.h +0 -2
index a7d2811f3536..e2b0d6c40a6c 100644
@@ -63,8 +63,6 @@ asmlinkage void smp_callin(void);
 #if defined CONFIG_HOTPLUG_CPU
 int __cpu_disable(void);
 void __cpu_die(unsigned int cpu);
-void cpu_stop(void);
-#else
 #endif /* CONFIG_HOTPLUG_CPU */
 
 #else
arch/riscv/kernel/cpu-hotplug.c +1 -7
index df84e0c13db1..be7f05b542bb 100644
@@ -14,12 +14,6 @@
 #include <asm/cpu_ops.h>
 #include <asm/sbi.h>
 
-void cpu_stop(void);
-void arch_cpu_idle_dead(void)
-{
-	cpu_stop();
-}
-
 bool cpu_has_hotplug(unsigned int cpu)
 {
 	if (cpu_ops[cpu]->cpu_stop)
@@ -75,7 +69,7 @@ void __cpu_die(unsigned int cpu)
 /*
  * Called from the idle thread for the CPU which has been shutdown.
  */
-void cpu_stop(void)
+void arch_cpu_idle_dead(void)
 {
 	idle_task_exit();
 
Signature · 1 line
2.34.0
#2 lore raw

PATCH 2/5 riscv: head: make secondary_start_common() static

In reply to Jisheng Zhang

There are no users outside head.S so make secondary_start_common() static.

---
 arch/riscv/kernel/head.S | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/riscv/kernel/head.S +2 -3
index f52f01ecbeea..3ce95f8783bd 100644
@@ -177,8 +177,7 @@ secondary_start_sbi:
 	REG_L sp, (a4)
 	REG_L tp, (a5)
 
-	.global secondary_start_common
-secondary_start_common:
+.Lsecondary_start_common:
 
 #ifdef CONFIG_MMU
 	/* Enable virtual memory and relocate to virtual address */
@@ -365,7 +364,7 @@ clear_bss_done:
 	beqz tp, .Lwait_for_cpu_up
 	fence
 
-	tail secondary_start_common
+	tail .Lsecondary_start_common
 #endif
 
 END(_start_kernel)
Signature · 1 line
2.34.0
#3 lore raw

PATCH 3/5 riscv: kvm: make kvm_riscv_vcpu_fp_clean() static

In reply to Jisheng Zhang

There are no users outside vcpu_fp.c so make kvm_riscv_vcpu_fp_clean() static.

---
 arch/riscv/kvm/vcpu_fp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kvm/vcpu_fp.c +1 -1
index 1b070152578f..4449a976e5a6 100644
@@ -26,7 +26,7 @@ void kvm_riscv_vcpu_fp_reset(struct kvm_vcpu *vcpu)
 		cntx->sstatus |= SR_FS_OFF;
 }
 
-void kvm_riscv_vcpu_fp_clean(struct kvm_cpu_context *cntx)
+static void kvm_riscv_vcpu_fp_clean(struct kvm_cpu_context *cntx)
 {
 	cntx->sstatus &= ~SR_FS;
 	cntx->sstatus |= SR_FS_CLEAN;
Signature · 1 line
2.34.0
maintainer
#4 lore raw

Re: [PATCH 3/5] riscv: kvm: make kvm_riscv_vcpu_fp_clean() static

Quoted 5 lines · Jisheng Zhang

There are no users outside vcpu_fp.c so make kvm_riscv_vcpu_fp_clean() static.

I have queued this patch for 5.17

Thanks,
Anup

Quoted 25 lines
---
 arch/riscv/kvm/vcpu_fp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kvm/vcpu_fp.c +1 -2
index 1b070152578f..4449a976e5a6 100644
@@ -26,7 +26,7 @@ void kvm_riscv_vcpu_fp_reset(struct kvm_vcpu *vcpu)
                cntx->sstatus |= SR_FS_OFF;
 }
 
-void kvm_riscv_vcpu_fp_clean(struct kvm_cpu_context *cntx)
+static void kvm_riscv_vcpu_fp_clean(struct kvm_cpu_context *cntx)
 {
        cntx->sstatus &= ~SR_FS;
        cntx->sstatus |= SR_FS_CLEAN;
--

2.34.0

--
kvm-riscv mailing list
kvm-riscv at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kvm-riscv

#5 lore raw

PATCH 4/5 riscv: errata: alternative: mark vendor_patch_func __initdata

In reply to Jisheng Zhang

The function pointer vendor_patch_func is only used during init, so mark it as __initdata.

---
 arch/riscv/errata/alternative.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/riscv/errata/alternative.c +2 -1
index 3b15885db70b..e8b4a0fe488c 100644
@@ -22,7 +22,8 @@ static struct cpu_manufacturer_info_t {
 } cpu_mfr_info;
 
 static void (*vendor_patch_func)(struct alt_entry *begin, struct alt_entry *end,
-				 unsigned long archid, unsigned long impid);
+				 unsigned long archid,
+				 unsigned long impid) __initdata;
 
 static inline void __init riscv_fill_cpu_mfr_info(void)
 {
Signature · 1 line
2.34.0
#6 lore raw

PATCH 5/5 riscv: head: remove useless __PAGE_ALIGNED_BSS and .balign

In reply to Jisheng Zhang

After commit 83e7b8769a08 ("RISC-V: move empty_zero_page definition to C and export it"), the empty_zero_page has been moved outside head.S, the __PAGE_ALIGNED_BSS and .balign LoCs are useless, clean up them.

---
 arch/riscv/kernel/head.S | 4 ----
 1 file changed, 4 deletions(-)
arch/riscv/kernel/head.S +0 -4
index 3ce95f8783bd..c128a32c2ed3 100644
@@ -447,7 +447,3 @@ ENTRY(reset_regs)
 	ret
 END(reset_regs)
 #endif /* CONFIG_RISCV_M_MODE */
-
-__PAGE_ALIGNED_BSS
-	/* Empty zero page */
-	.balign PAGE_SIZE
Signature · 1 line
2.34.0
maintainer
#7 lore raw
In reply to Jisheng Zhang
Quoted 8 lines · jszhang at kernel.org

This series is a misc clean up: clean up useless LoCs, or make some functions static, or mark function pointer as __initdata, or remove one function().

Jisheng Zhang (5):
riscv: remove cpu_stop()
riscv: head: make secondary_start_common() static
riscv: kvm: make kvm_riscv_vcpu_fp_clean() static

Probably best to split out the KVM patches, as they go in via a different tree.

Quoted 9 lines

riscv: errata: alternative: mark vendor_patch_func __initdata
riscv: head: remove useless __PAGE_ALIGNED_BSS and .balign

 arch/riscv/errata/alternative.c | 3 ++-
 arch/riscv/include/asm/smp.h    | 2 --
 arch/riscv/kernel/cpu-hotplug.c | 8 +-------
 arch/riscv/kernel/head.S        | 9 ++-------
 arch/riscv/kvm/vcpu_fp.c        | 2 +-
 5 files changed, 6 insertions(+), 18 deletions(-)

These are on for-next (aside from the KVM one, which Anup has already picked up).

Thanks!