2026년 5월 12일 (화) 오후 5:15, Tao Liu <ltao(a)redhat.xn--com>-4f21ay07k 작성:
Great! Thank you.
> On Wed, May 6, 2026 at 1:01 PM Austin Kim <austindh.kim(a)gmail.com> wrote:
> >
> > 2026년 5월 6일 (수) 오전 6:39, Tao Liu <ltao(a)redhat.xn--com>-4f21ay07k 작성:
> > >
> > > Hi Austin,
> > >
> > > Sorry for the late reply.
> >
> > No, problem.
> >
> > >
> > > On Wed, Apr 15, 2026 at 5:36 PM Austin Kim <austindh.kim(a)gmail.com>
wrote:
> > > >
> > > > 2026년 4월 6일 (월) 오후 1:53, Austin Kim <austindh.kim(a)gmail.xn--com>-4f21ay07k
작성:
> > > > >
> > > > > The VTOP and PTOV macros are typically implemented using
architecture-specific
> > > > > functions to improve maintainability and debugging capabilities.
> > > > >
> > > > > This patch moves the RISCV64-specific VTOP/PTOV logic from inline
macros
> > > > > in defs.h to dedicated functions in riscv64.c. This refactoring
makes the
> > > > > code easier to understand and provides a better location for
adding
> > > > > future debugging or validation checks.
> > > > >
> > > > > No functional changes are introduced by this patch.
> > > > >
> > > > > Signed-off-by: Austin Kim <austindh.kim(a)gmail.com>
> > > > > ---
> > > > > defs.h | 14 ++++----------
> > > > > riscv64.c | 24 ++++++++++++++++++++++++
> > > > > 2 files changed, 28 insertions(+), 10 deletions(-)
> > > > >
> > > > > diff --git a/defs.h b/defs.h
> > > > > index a6f4372..54f1725 100644
> > > > > --- a/defs.h
> > > > > +++ b/defs.h
> > > > > @@ -3803,16 +3803,8 @@ typedef signed int s32;
> > > > > /*
> > > > > * Direct memory mapping
> > > > > */
> > > > > -#define PTOV(X)
\
> > > > > - (((unsigned long)(X)+(machdep->kvbase)) -
machdep->machspec->phys_base)
> > > > > -#define VTOP(X) ({
\
> > > > > - ulong _X = X;
\
> > > > > - (THIS_KERNEL_VERSION >= LINUX(5,13,0) &&
\
> > > > > - (_X) >=
machdep->machspec->kernel_link_addr) ? \
> > > > > - ((unsigned
long)(_X)-(machdep->machspec->va_kernel_pa_offset)): \
> > > > > - (((unsigned long)(_X)-(machdep->kvbase)) +
\
> > > > > - machdep->machspec->phys_base);
\
> > > > > - })
> > > > > +#define PTOV(X) riscv64_PTOV((ulong)(X))
> > > > > +#define VTOP(X) riscv64_VTOP((ulong)(X))
> > > > > #define PAGEBASE(X) (((ulong)(X)) &
(ulong)machdep->pagemask)
> > > > >
> > > > > /*
> > > > > @@ -7211,6 +7203,8 @@ void
riscv64_display_regs_from_elf_notes(int, FILE *);
> > > > > void riscv64_init(int);
> > > > > void riscv64_dump_machdep_table(ulong);
> > > > > int riscv64_IS_VMALLOC_ADDR(ulong);
> > > > > +ulong riscv64_PTOV(ulong);
> > > > > +ulong riscv64_VTOP(ulong);
> > > > >
> > > > > #define display_idt_table() \
> > > > > error(FATAL, "-d option is not applicable to RISCV64
architecture\n")
> > > > > diff --git a/riscv64.c b/riscv64.c
> > > > > index eceae70..3aee827 100644
> > > > > --- a/riscv64.c
> > > > > +++ b/riscv64.c
> > > > > @@ -1606,6 +1606,30 @@ riscv64_uvtop(struct task_context *tc,
ulong uvaddr, physaddr_t *paddr, int verb
> > > > > }
> > > > > }
> > > > >
> > > > > +ulong riscv64_PTOV(ulong paddr)
> > > > > +{
> > > > > + ulong vaddr;
> > > > > + ulong offset = paddr -
machdep->machspec->phys_base;
> > > > > +
> > > > > + vaddr = offset + machdep->kvbase;
> > > > > +
> > > > > + return vaddr;
> > > > > +}
> > > > > +
> > > > > +ulong
> > > > > +riscv64_VTOP(ulong addr)
> > > > > +{
> > > > > + ulong paddr;
> > > > > +
> > > > > + if ( (THIS_KERNEL_VERSION >= LINUX(5,13,0))
&&
> > > > > + (addr >=
machdep->machspec->kernel_link_addr))
> > > > > + paddr = (addr -
(machdep->machspec->va_kernel_pa_offset));
> > > > > + else
> > > > > + paddr = (addr - (ulong)machdep->kvbase +
machdep->machspec->phys_base);
> > > > > +
> > > > > + return paddr;
> > > > > +}
> > > >
> > > > Hello,
> > > >
> > > > Would you please give feedback on this patch?
> > > >
> > > > I think that VTOP() and PTOV() are architecture-specific functions.
> > > > For example, arm64_VTOP() and arm64_PTOV() are declared and used in
arm64.c
> > > >
> > > > It would be good to have riscv64_VTOP() and riscv64_PTOV() in
riscv64.c
> > >
> > > Agreed. The patch LGTM, so ack.
> > >
> >
> > Thank you for positive feedback.
> >
> > BR,
> > Austin Kim
> >
> > > Thanks,
> > > Tao Liu
> > >
> > > >
> > > > BR,
> > > > Austin Kim
> > > >
> > > >
> > > > > +
> > > > > static int
> > > > > riscv64_kvtop(struct task_context *tc, ulong kvaddr, physaddr_t
*paddr, int verbose)
> > > > > {
> > > > > --
> > > > > 2.34.1
> > > > >
> > > > --
> > > > Crash-utility mailing list -- devel(a)lists.crash-utility.osci.io
> > > > To unsubscribe send an email to
devel-leave(a)lists.crash-utility.osci.io
> > > > https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
> > > > Contribution Guidelines:
https://github.com/crash-utility/crash/wiki
> > > >
> > >
> >
>