From: guoren@kernel.org
To: arnd@arndb.de, guoren@kernel.org, palmer@rivosinc.com,
tglx@linutronix.de, peterz@infradead.org, luto@kernel.org,
conor.dooley@microchip.com, heiko@sntech.de, jszhang@kernel.org,
chenhuacai@kernel.org, apatel@ventanamicro.com,
atishp@atishpatra.org, mark.rutland@arm.com, bjorn@kernel.org,
paul.walmsley@sifive.com, catalin.marinas@arm.com,
will@kernel.org, rppt@kernel.org, anup@brainfault.org,
shihua@iscas.ac.cn, jiawei@iscas.ac.cn, liweiwei@iscas.ac.cn,
luxufan@iscas.ac.cn, chunyu@iscas.ac.cn, tsu.yubo@gmail.com,
wefu@redhat.com, wangjunqiang@iscas.ac.cn, kito.cheng@sifive.com,
andy.chiu@sifive.com, vincent.chen@sifive.com,
greentime.hu@sifive.com, corbet@lwn.net, wuwei2016@iscas.ac.cn,
jrtc27@jrtc27.com
Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-riscv@lists.infradead.org,
Guo Ren <guoren@linux.alibaba.com>
Subject: [RFC PATCH 07/22] riscv: s64ilp32: Add sbi support
Date: Thu, 18 May 2023 09:09:58 -0400 [thread overview]
Message-ID: <20230518131013.3366406-8-guoren@kernel.org> (raw)
In-Reply-To: <20230518131013.3366406-1-guoren@kernel.org>
From: Guo Ren <guoren@linux.alibaba.com>
The sbi uses xlen as base argument elements to connect m-mode and
s-mode. The previous implementation assumes sizeof(xlen_t) =
sizeof(long), but the s64ilp32's are different. So modify the sbi code
suitable with the s64ilp32 change.
Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Signed-off-by: Guo Ren <guoren@kernel.org>
---
arch/riscv/include/asm/cpu_ops_sbi.h | 4 ++--
arch/riscv/include/asm/sbi.h | 24 ++++++++++++------------
arch/riscv/kernel/cpu_ops_sbi.c | 4 ++--
arch/riscv/kernel/sbi.c | 24 ++++++++++++------------
4 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/arch/riscv/include/asm/cpu_ops_sbi.h b/arch/riscv/include/asm/cpu_ops_sbi.h
index d6e4665b3195..d967adad6b48 100644
--- a/arch/riscv/include/asm/cpu_ops_sbi.h
+++ b/arch/riscv/include/asm/cpu_ops_sbi.h
@@ -19,8 +19,8 @@ extern const struct cpu_operations cpu_ops_sbi;
* @stack_ptr: A pointer to the hart specific sp
*/
struct sbi_hart_boot_data {
- void *task_ptr;
- void *stack_ptr;
+ xlen_t task_ptr;
+ xlen_t stack_ptr;
};
#endif
diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h
index 945b7be249c1..d31135715f0e 100644
--- a/arch/riscv/include/asm/sbi.h
+++ b/arch/riscv/include/asm/sbi.h
@@ -123,16 +123,16 @@ enum sbi_ext_pmu_fid {
};
union sbi_pmu_ctr_info {
- unsigned long value;
+ xlen_t value;
struct {
- unsigned long csr:12;
- unsigned long width:6;
+ xlen_t csr:12;
+ xlen_t width:6;
#if __riscv_xlen == 32
- unsigned long reserved:13;
+ xlen_t reserved:13;
#else
- unsigned long reserved:45;
+ xlen_t reserved:45;
#endif
- unsigned long type:1;
+ xlen_t type:1;
};
};
@@ -254,15 +254,15 @@ enum sbi_pmu_ctr_type {
extern unsigned long sbi_spec_version;
struct sbiret {
- long error;
- long value;
+ xlen_t error;
+ xlen_t value;
};
void sbi_init(void);
-struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0,
- unsigned long arg1, unsigned long arg2,
- unsigned long arg3, unsigned long arg4,
- unsigned long arg5);
+struct sbiret sbi_ecall(int ext, int fid, xlen_t arg0,
+ xlen_t arg1, xlen_t arg2,
+ xlen_t arg3, xlen_t arg4,
+ xlen_t arg5);
void sbi_console_putchar(int ch);
int sbi_console_getchar(void);
diff --git a/arch/riscv/kernel/cpu_ops_sbi.c b/arch/riscv/kernel/cpu_ops_sbi.c
index efa0f0816634..01a1e270ec1d 100644
--- a/arch/riscv/kernel/cpu_ops_sbi.c
+++ b/arch/riscv/kernel/cpu_ops_sbi.c
@@ -71,8 +71,8 @@ static int sbi_cpu_start(unsigned int cpuid, struct task_struct *tidle)
/* Make sure tidle is updated */
smp_mb();
- bdata->task_ptr = tidle;
- bdata->stack_ptr = task_stack_page(tidle) + THREAD_SIZE;
+ bdata->task_ptr = (ulong)tidle;
+ bdata->stack_ptr = (ulong)task_stack_page(tidle) + THREAD_SIZE;
/* Make sure boot data is updated */
smp_mb();
hsm_data = __pa(bdata);
diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c
index 5c87db8fdff2..b649562aff61 100644
--- a/arch/riscv/kernel/sbi.c
+++ b/arch/riscv/kernel/sbi.c
@@ -22,21 +22,21 @@ static int (*__sbi_rfence)(int fid, const struct cpumask *cpu_mask,
unsigned long start, unsigned long size,
unsigned long arg4, unsigned long arg5) __ro_after_init;
-struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0,
- unsigned long arg1, unsigned long arg2,
- unsigned long arg3, unsigned long arg4,
- unsigned long arg5)
+struct sbiret sbi_ecall(int ext, int fid, xlen_t arg0,
+ xlen_t arg1, xlen_t arg2,
+ xlen_t arg3, xlen_t arg4,
+ xlen_t arg5)
{
struct sbiret ret;
- register uintptr_t a0 asm ("a0") = (uintptr_t)(arg0);
- register uintptr_t a1 asm ("a1") = (uintptr_t)(arg1);
- register uintptr_t a2 asm ("a2") = (uintptr_t)(arg2);
- register uintptr_t a3 asm ("a3") = (uintptr_t)(arg3);
- register uintptr_t a4 asm ("a4") = (uintptr_t)(arg4);
- register uintptr_t a5 asm ("a5") = (uintptr_t)(arg5);
- register uintptr_t a6 asm ("a6") = (uintptr_t)(fid);
- register uintptr_t a7 asm ("a7") = (uintptr_t)(ext);
+ register xlen_t a0 asm ("a0") = arg0;
+ register xlen_t a1 asm ("a1") = arg1;
+ register xlen_t a2 asm ("a2") = arg2;
+ register xlen_t a3 asm ("a3") = arg3;
+ register xlen_t a4 asm ("a4") = arg4;
+ register xlen_t a5 asm ("a5") = arg5;
+ register xlen_t a6 asm ("a6") = fid;
+ register xlen_t a7 asm ("a7") = ext;
asm volatile ("ecall"
: "+r" (a0), "+r" (a1)
: "r" (a2), "r" (a3), "r" (a4), "r" (a5), "r" (a6), "r" (a7)
--
2.36.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2023-05-18 13:12 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-18 13:09 [RFC PATCH 00/22] riscv: s64ilp32: Running 32-bit Linux kernel on 64-bit supervisor mode guoren
2023-05-18 13:09 ` [RFC PATCH 01/22] riscv: vdso: Unify vdso32 & compat_vdso into vdso/Makefile guoren
2023-05-18 13:09 ` [RFC PATCH 02/22] riscv: vdso: Remove compat_vdso/ guoren
2023-05-18 13:09 ` [RFC PATCH 03/22] riscv: vdso: Add time-related vDSO common flow for vdso32 guoren
2023-05-18 13:09 ` [RFC PATCH 04/22] clocksource: riscv: s64ilp32: Use __riscv_xlen instead of CONFIG_32BIT guoren
2023-05-18 13:09 ` [RFC PATCH 05/22] riscv: s64ilp32: Introduce xlen_t guoren
2023-05-18 13:09 ` [RFC PATCH 06/22] irqchip: riscv: s64ilp32: Use __riscv_xlen instead of CONFIG_32BIT guoren
2023-05-18 13:09 ` guoren [this message]
2023-05-18 13:09 ` [RFC PATCH 08/22] riscv: s64ilp32: Add asid support guoren
2023-05-18 13:10 ` [RFC PATCH 09/22] riscv: s64ilp32: Introduce PTR_L and PTR_S guoren
2023-05-18 13:10 ` [RFC PATCH 10/22] riscv: s64ilp32: Enable user space runtime environment guoren
2023-05-18 13:10 ` [RFC PATCH 11/22] riscv: s64ilp32: Add ebpf jit support guoren
2023-05-18 13:10 ` [RFC PATCH 12/22] riscv: s64ilp32: Add ELF32 support guoren
2023-05-18 13:10 ` [RFC PATCH 13/22] riscv: s64ilp32: Add ARCH RV64 ILP32 compiling framework guoren
2023-05-18 13:10 ` [RFC PATCH 14/22] riscv: s64ilp32: Add MMU_SV39 mode support for 32BIT guoren
2023-05-18 13:10 ` [RFC PATCH 15/22] riscv: s64ilp32: Enable native atomic64 guoren
2023-05-18 13:10 ` [RFC PATCH 16/22] riscv: s64ilp32: Add TImode (128 int) support guoren
2023-05-18 13:10 ` [RFC PATCH 17/22] riscv: s64ilp32: Implement cmpxchg_double guoren
2023-05-18 13:10 ` [RFC PATCH 18/22] riscv: s64ilp32: Disable KVM guoren
2023-05-18 13:10 ` [RFC PATCH 19/22] riscv: Cleanup rv32_defconfig guoren
2023-05-18 13:10 ` [RFC PATCH 20/22] riscv: s64ilp32: Add rv64ilp32_defconfig guoren
2023-05-18 13:10 ` [RFC PATCH 21/22] riscv: s64ilp32: Correct the rv64ilp32 stackframe layout guoren
2023-05-18 13:10 ` [RFC PATCH 22/22] riscv: s64ilp32: Temporary workaround solution to gcc problem guoren
2023-05-18 15:38 ` [RFC PATCH 00/22] riscv: s64ilp32: Running 32-bit Linux kernel on 64-bit supervisor mode Palmer Dabbelt
2023-05-18 18:29 ` Arnd Bergmann
2023-05-19 0:38 ` Paul Walmsley
2023-05-19 8:55 ` Arnd Bergmann
2023-05-19 15:31 ` Guo Ren
2023-05-19 16:53 ` Arnd Bergmann
2023-05-19 17:18 ` Palmer Dabbelt
2023-05-20 1:43 ` Guo Ren
2023-05-19 0:14 ` Paul Walmsley
2023-05-21 12:37 ` Guo Ren
2023-05-19 20:20 ` Arnd Bergmann
2023-05-20 2:53 ` Guo Ren
2023-05-20 10:13 ` Arnd Bergmann
2023-05-20 15:57 ` Guo Ren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230518131013.3366406-8-guoren@kernel.org \
--to=guoren@kernel.org \
--cc=andy.chiu@sifive.com \
--cc=anup@brainfault.org \
--cc=apatel@ventanamicro.com \
--cc=arnd@arndb.de \
--cc=atishp@atishpatra.org \
--cc=bjorn@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=chenhuacai@kernel.org \
--cc=chunyu@iscas.ac.cn \
--cc=conor.dooley@microchip.com \
--cc=corbet@lwn.net \
--cc=greentime.hu@sifive.com \
--cc=guoren@linux.alibaba.com \
--cc=heiko@sntech.de \
--cc=jiawei@iscas.ac.cn \
--cc=jrtc27@jrtc27.com \
--cc=jszhang@kernel.org \
--cc=kito.cheng@sifive.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=liweiwei@iscas.ac.cn \
--cc=luto@kernel.org \
--cc=luxufan@iscas.ac.cn \
--cc=mark.rutland@arm.com \
--cc=palmer@rivosinc.com \
--cc=paul.walmsley@sifive.com \
--cc=peterz@infradead.org \
--cc=rppt@kernel.org \
--cc=shihua@iscas.ac.cn \
--cc=tglx@linutronix.de \
--cc=tsu.yubo@gmail.com \
--cc=vincent.chen@sifive.com \
--cc=wangjunqiang@iscas.ac.cn \
--cc=wefu@redhat.com \
--cc=will@kernel.org \
--cc=wuwei2016@iscas.ac.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox