2021-11-28 16:17:08

by Jisheng Zhang

[permalink] [raw]
Subject: [PATCH 0/5] 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(-)

--
2.34.0



2021-11-28 16:17:11

by Jisheng Zhang

[permalink] [raw]
Subject: [PATCH 2/5] riscv: head: make secondary_start_common() static

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

Signed-off-by: Jisheng Zhang <[email protected]>
---
arch/riscv/kernel/head.S | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
index f52f01ecbeea..3ce95f8783bd 100644
--- a/arch/riscv/kernel/head.S
+++ b/arch/riscv/kernel/head.S
@@ -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)
--
2.34.0


2021-11-28 16:17:14

by Jisheng Zhang

[permalink] [raw]
Subject: [PATCH 3/5] riscv: kvm: make kvm_riscv_vcpu_fp_clean() static

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

Signed-off-by: Jisheng Zhang <[email protected]>
---
arch/riscv/kvm/vcpu_fp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/kvm/vcpu_fp.c b/arch/riscv/kvm/vcpu_fp.c
index 1b070152578f..4449a976e5a6 100644
--- a/arch/riscv/kvm/vcpu_fp.c
+++ b/arch/riscv/kvm/vcpu_fp.c
@@ -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


2021-11-28 16:17:17

by Jisheng Zhang

[permalink] [raw]
Subject: [PATCH 4/5] riscv: errata: alternative: mark vendor_patch_func __initdata

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

Signed-off-by: Jisheng Zhang <[email protected]>
---
arch/riscv/errata/alternative.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/errata/alternative.c b/arch/riscv/errata/alternative.c
index 3b15885db70b..e8b4a0fe488c 100644
--- a/arch/riscv/errata/alternative.c
+++ b/arch/riscv/errata/alternative.c
@@ -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)
{
--
2.34.0


2021-11-28 16:17:20

by Jisheng Zhang

[permalink] [raw]
Subject: [PATCH 5/5] riscv: head: remove useless __PAGE_ALIGNED_BSS and .balign

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.

Signed-off-by: Jisheng Zhang <[email protected]>
---
arch/riscv/kernel/head.S | 4 ----
1 file changed, 4 deletions(-)

diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
index 3ce95f8783bd..c128a32c2ed3 100644
--- a/arch/riscv/kernel/head.S
+++ b/arch/riscv/kernel/head.S
@@ -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
--
2.34.0


2021-12-03 13:23:36

by Anup Patel

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

On Sun, Nov 28, 2021 at 9:45 PM Jisheng Zhang <[email protected]> wrote:
>
> There are no users outside vcpu_fp.c so make kvm_riscv_vcpu_fp_clean()
> static.
>
> Signed-off-by: Jisheng Zhang <[email protected]>

I have queued this patch for 5.17

Thanks,
Anup

> ---
> arch/riscv/kvm/vcpu_fp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/riscv/kvm/vcpu_fp.c b/arch/riscv/kvm/vcpu_fp.c
> index 1b070152578f..4449a976e5a6 100644
> --- a/arch/riscv/kvm/vcpu_fp.c
> +++ b/arch/riscv/kvm/vcpu_fp.c
> @@ -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
> [email protected]
> http://lists.infradead.org/mailman/listinfo/kvm-riscv

2022-01-09 19:48:12

by Palmer Dabbelt

[permalink] [raw]
Subject: Re: [PATCH 0/5] riscv: misc clean up

On Sun, 28 Nov 2021 08:07:36 PST (-0800), [email protected] wrote:
> 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.

> 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!