From: Qingfang Deng <qingfang.deng@linux.dev>
To: Himanshu Chauhan <himanshu.chauhan@oss.qualcomm.com>,
linux-riscv@lists.infradead.org
Cc: alex@ghiti.fr, aou@eecs.berkeley.edu, palmer@dabbelt.com,
pjw@kernel.org, shuah@kernel.org, linux-kernel@vger.kernel.org,
thecharlesjenkins@gmail.com, jtaubepe@redhat.com
Subject: Re: [PATCH v6 1/5] riscv: Introduce support for hardware break/watchpoints
Date: Tue, 15 Sep 2026 11:21:39 +0800 [thread overview]
Message-ID: <2cd4868b-05b1-4f3c-992a-3bed5afd0abf@linux.dev> (raw)
In-Reply-To: <20260803134913.2013674-2-himanshu.chauhan@oss.qualcomm.com>
Hi,
On 2026/8/3 21:49, Himanshu Chauhan wrote:
> +#define MEM_HI(_m) ((unsigned long)upper_32_bits(_m))
> +#define MEM_LO(_m) ((unsigned long)lower_32_bits(_m))
> +
> +static int arch_smp_setup_sbi_shmem(unsigned int cpu)
> +{
> + union sbi_dbtr_shmem_entry *dbtr_shmem;
> + phys_addr_t shmem_pa;
> + struct sbiret ret;
> +
> + dbtr_shmem = per_cpu_ptr(sbi_dbtr_shmem, cpu);
> + if (!dbtr_shmem) {
per_cpu_ptr() never returns NULL, so this check can be removed.
> + pr_err("Invalid per-cpu shared memory for debug triggers\n");
> + return -ENODEV;
> + }
> +
> + shmem_pa = per_cpu_ptr_to_phys(dbtr_shmem);
> +
> + ret = sbi_ecall(SBI_EXT_DBTR, SBI_EXT_DBTR_SETUP_SHMEM,
> + MEM_LO(shmem_pa), MEM_HI(shmem_pa), 0, 0, 0, 0);
The ABI takes lower and upper XLEN bits instead of fixed 32 bits, so
this will break on an XLEN == 64 system and a physical address >= 4GiB.
#if __riscv_xlen == 64
#define MEM_HI(_m) 0UL
#define MEM_LO(_m) (unsigned long)(_m)
#elif __riscv_xlen == 32
#define MEM_HI(_m) (unsigned long)upper_32_bits(_m)
#define MEM_LO(_m) (unsigned long)lower_32_bits(_m)
#else
#error "Unknown __riscv_xlen"
#endif
> +
> + if (ret.error) {
> + pr_warn("%s: failed to setup shared memory. error: %ld\n",
> + __func__, ret.error);
> + return sbi_err_map_linux_errno(ret.error);
> + }
> +
> + pr_info("CPU %d: HW Breakpoint shared memory registered.\n", cpu);
> +
> + return 0;
> +}
Kind regards,
Qingfang
next prev parent reply other threads:[~2026-09-15 3:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 13:49 [PATCH v6 0/5] " Himanshu Chauhan
2026-08-03 13:49 ` [PATCH v6 1/5] " Himanshu Chauhan
2026-08-05 13:20 ` Chen Pei
2026-09-11 8:54 ` Rui Qi
2026-09-14 13:18 ` Himanshu Chauhan
2026-09-15 2:36 ` Rui Qi
2026-09-15 3:21 ` Qingfang Deng [this message]
2026-08-03 13:49 ` [PATCH v6 2/5] riscv: Add breakpoint and watchpoint test for riscv Himanshu Chauhan
2026-08-03 13:49 ` [PATCH v6 3/5] riscv: ptrace support for hardware break/watchpoints Himanshu Chauhan
2026-08-05 13:22 ` Chen Pei
2026-09-15 8:47 ` Rui Qi
2026-08-03 13:49 ` [PATCH v6 4/5] selftests/breakpoints: extend riscv test for ptrace hw break/watchpoints Himanshu Chauhan
2026-08-03 13:49 ` [PATCH v6 5/5] MAINTAINERS: Add entry for RISC-V Debugging Himanshu Chauhan
2026-08-04 17:10 ` [PATCH v6 0/5] riscv: Introduce support for hardware break/watchpoints Jesse Taube
2026-08-07 8:00 ` Himanshu Chauhan
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=2cd4868b-05b1-4f3c-992a-3bed5afd0abf@linux.dev \
--to=qingfang.deng@linux.dev \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=himanshu.chauhan@oss.qualcomm.com \
--cc=jtaubepe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=shuah@kernel.org \
--cc=thecharlesjenkins@gmail.com \
/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
all inboxes | Powered by JetHome®