[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJve8o=FO6hHmu=zthUDdyM7y2RN2VPRanCrBHuBJZeTPxV10Q@mail.gmail.com>
Date: Wed, 2 Aug 2023 09:49:41 +0800
From: Haibo Xu <xiaobo55x@...il.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Andrew Jones <ajones@...tanamicro.com>,
Haibo Xu <haibo1.xu@...el.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>,
Paolo Bonzini <pbonzini@...hat.com>,
Shuah Khan <shuah@...nel.org>,
Anup Patel <anup@...infault.org>,
Atish Patra <atishp@...shpatra.org>,
Marc Zyngier <maz@...nel.org>,
Andrew Jones <andrew.jones@...ux.dev>,
Colton Lewis <coltonlewis@...gle.com>,
Vipin Sharma <vipinsh@...gle.com>,
Vishal Annapurve <vannapurve@...gle.com>,
linux-kernel@...r.kernel.org, linux-riscv@...ts.infradead.org,
kvm@...r.kernel.org, linux-kselftest@...r.kernel.org,
kvm-riscv@...ts.infradead.org
Subject: Re: [PATCH 2/4] KVM: riscv: selftests: Add exception handling support
On Fri, Jul 28, 2023 at 11:53 PM Sean Christopherson <seanjc@...gle.com> wrote:
>
> On Fri, Jul 28, 2023, Andrew Jones wrote:
> > On Thu, Jul 27, 2023 at 03:20:06PM +0800, Haibo Xu wrote:
> > > +void vm_init_trap_vector_tables(struct kvm_vm *vm);
> > > +void vcpu_init_trap_vector_tables(struct kvm_vcpu *vcpu);
> >
> > I think we should use a common name for these prototypes that the other
> > architectures agree to and then put them in a common header. My vote for
> > the naming is,
>
> Just allocate the tables in kvm_arch_vm_post_create(). I've been meaning to
> convert x86 and ARM, but keep getting distracted/waylaid by other things.
>
> https://lore.kernel.org/all/Y8hCBOndYMD9zsDL@google.com
>
> > void vm_init_vector_tables(struct kvm_vm *vm);
> > void vcpu_init_vector_tables(struct kvm_vcpu *vcpu);
> >
> > > +
> > > +typedef void(*handler_fn)(struct ex_regs *);
> > > +void vm_install_exception_handler(struct kvm_vm *vm, int ec, handler_fn handler);
> >
> > I'd also put this typedef
>
> And rename it to (*exception_handler_fn).
>
> > and prototype in a common header (with s/ec/vector/ to what you have here)
>
> Hmm, yeah, I think it makes sense to let vm_install_exception_handler() be used
> from common code. the vector to be installed is inherently arch specific, but
> it would be easy enough for a test to use #ifdeffery to define the correct vector.
Thanks for the suggestion. I'll have a try to consolidate these codes in v2.
Powered by blists - more mailing lists