[PATCH -next v14 11/19] riscv: Add ptrace vector support

Conor Dooley conor at kernel.org
Tue Mar 14 03:44:25 PDT 2023


On Tue, Mar 14, 2023 at 06:39:19PM +0800, Andy Chiu wrote:
> On Thu, Mar 2, 2023 at 7:27 PM Björn Töpel <bjorn at kernel.org> wrote:
> >
> > Andy Chiu <andy.chiu at sifive.com> writes:
> >
> > > diff --git a/arch/riscv/kernel/ptrace.c b/arch/riscv/kernel/ptrace.c
> > > index 2ae8280ae475..3c0e01d7f8fb 100644
> > > --- a/arch/riscv/kernel/ptrace.c
> > > +++ b/arch/riscv/kernel/ptrace.c
> > > @@ -83,6 +87,62 @@ static int riscv_fpr_set(struct task_struct *target,
> > >  }
> > >  #endif
> > >
> > > +#ifdef CONFIG_RISCV_ISA_V
> > > +static int riscv_vr_get(struct task_struct *target,
> > > +                     const struct user_regset *regset,
> > > +                     struct membuf to)
> > > +{
> > > +     struct __riscv_v_ext_state *vstate = &target->thread.vstate;
> > > +
> > > +     if (!riscv_v_vstate_query(task_pt_regs(target)))
> > > +             return -EINVAL;
> > > +     /*
> > > +      * Ensure the vector registers have been saved to the memory before
> > > +      * copying them to membuf.
> > > +      */
> > > +     if (target == current)
> > > +             riscv_v_vstate_save(current, task_pt_regs(current));
> > > +
> > > +     /* Copy vector header from vstate. */
> > > +     membuf_write(&to, vstate, offsetof(struct __riscv_v_ext_state, datap));
> > > +     membuf_zero(&to, sizeof(void *));
> > > +#if __riscv_xlen == 32
> > > +     membuf_zero(&to, sizeof(__u32));
> > > +#endif
> >
> > Remind me why the extra care is needed for 32b?
> >
> 
> That is from the old version of the code and I agree we should remove
> that.

> Hey Conor, does your Rb still hold after removing this #if,
> #endif section?

Sure.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/kvm-riscv/attachments/20230314/b6771807/attachment.sig>


More information about the kvm-riscv mailing list