All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: kvm-riscv@lists.infradead.org
Subject: [PATCH 2/4] KVM: riscv: selftests: Add exception handling support
Date: Fri, 28 Jul 2023 08:53:52 -0700	[thread overview]
Message-ID: <ZMPR56RVgzI6s6Ik@google.com> (raw)
In-Reply-To: <20230728-21d0e3ecb0d8916fd9d9bceb@orel>

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 at 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.


WARNING: multiple messages have this Message-ID (diff)
From: Sean Christopherson <seanjc@google.com>
To: Andrew Jones <ajones@ventanamicro.com>
Cc: Haibo Xu <haibo1.xu@intel.com>,
	xiaobo55x@gmail.com, Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Shuah Khan <shuah@kernel.org>, Anup Patel <anup@brainfault.org>,
	Atish Patra <atishp@atishpatra.org>,
	Marc Zyngier <maz@kernel.org>,
	Andrew Jones <andrew.jones@linux.dev>,
	Colton Lewis <coltonlewis@google.com>,
	Vipin Sharma <vipinsh@google.com>,
	Vishal Annapurve <vannapurve@google.com>,
	linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
	kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
	kvm-riscv@lists.infradead.org
Subject: Re: [PATCH 2/4] KVM: riscv: selftests: Add exception handling support
Date: Fri, 28 Jul 2023 08:53:52 -0700	[thread overview]
Message-ID: <ZMPR56RVgzI6s6Ik@google.com> (raw)
In-Reply-To: <20230728-21d0e3ecb0d8916fd9d9bceb@orel>

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.

WARNING: multiple messages have this Message-ID (diff)
From: Sean Christopherson <seanjc@google.com>
To: Andrew Jones <ajones@ventanamicro.com>
Cc: Haibo Xu <haibo1.xu@intel.com>,
	xiaobo55x@gmail.com,  Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	 Albert Ou <aou@eecs.berkeley.edu>,
	Paolo Bonzini <pbonzini@redhat.com>,
	 Shuah Khan <shuah@kernel.org>, Anup Patel <anup@brainfault.org>,
	 Atish Patra <atishp@atishpatra.org>,
	Marc Zyngier <maz@kernel.org>,
	 Andrew Jones <andrew.jones@linux.dev>,
	Colton Lewis <coltonlewis@google.com>,
	 Vipin Sharma <vipinsh@google.com>,
	Vishal Annapurve <vannapurve@google.com>,
	linux-kernel@vger.kernel.org,  linux-riscv@lists.infradead.org,
	kvm@vger.kernel.org,  linux-kselftest@vger.kernel.org,
	kvm-riscv@lists.infradead.org
Subject: Re: [PATCH 2/4] KVM: riscv: selftests: Add exception handling support
Date: Fri, 28 Jul 2023 08:53:52 -0700	[thread overview]
Message-ID: <ZMPR56RVgzI6s6Ik@google.com> (raw)
In-Reply-To: <20230728-21d0e3ecb0d8916fd9d9bceb@orel>

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.

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2023-07-28 15:53 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27  7:20 [PATCH 0/4] RISCV: Add kvm Sstc timer selftest Haibo Xu
2023-07-27  7:20 ` Haibo Xu
2023-07-27  7:20 ` Haibo Xu
2023-07-27  7:20 ` [PATCH 1/4] tools: riscv: Add header file csr.h Haibo Xu
2023-07-27  7:20   ` Haibo Xu
2023-07-27  7:20   ` Haibo Xu
2023-07-28  9:43   ` Andrew Jones
2023-07-28  9:43     ` Andrew Jones
2023-07-28  9:43     ` Andrew Jones
2023-08-02  2:05     ` Haibo Xu
2023-08-02  2:05       ` Haibo Xu
2023-08-02  2:05       ` Haibo Xu
2023-08-03  3:13       ` Guo Ren
2023-08-03  3:13         ` Guo Ren
2023-08-03  3:13         ` Guo Ren
2023-08-03  7:44         ` Andrew Jones
2023-08-03  7:44           ` Andrew Jones
2023-08-03  7:44           ` Andrew Jones
2023-08-05  1:31           ` Guo Ren
2023-08-05  1:31             ` Guo Ren
2023-08-05  1:31             ` Guo Ren
2023-07-27  7:20 ` [PATCH 2/4] KVM: riscv: selftests: Add exception handling support Haibo Xu
2023-07-27  7:20   ` Haibo Xu
2023-07-27  7:20   ` Haibo Xu
2023-07-28  9:37   ` Andrew Jones
2023-07-28  9:37     ` Andrew Jones
2023-07-28  9:37     ` Andrew Jones
2023-07-28 15:53     ` Sean Christopherson [this message]
2023-07-28 15:53       ` Sean Christopherson
2023-07-28 15:53       ` Sean Christopherson
2023-08-02  1:49       ` Haibo Xu
2023-08-02  1:49         ` Haibo Xu
2023-08-02  1:49         ` Haibo Xu
2023-08-02  1:46     ` Haibo Xu
2023-08-02  1:46       ` Haibo Xu
2023-08-02  1:46       ` Haibo Xu
2023-07-27  7:20 ` [PATCH 3/4] KVM: riscv: selftests: Add guest helper to get vcpu id Haibo Xu
2023-07-27  7:20   ` Haibo Xu
2023-07-27  7:20   ` Haibo Xu
2023-07-28  9:49   ` Andrew Jones
2023-07-28  9:49     ` Andrew Jones
2023-07-28  9:49     ` Andrew Jones
2023-08-02  2:02     ` Haibo Xu
2023-08-02  2:02       ` Haibo Xu
2023-08-02  2:02       ` Haibo Xu
2023-07-27  7:20 ` [PATCH 4/4] KVM: riscv: selftests: Add sstc_timer test Haibo Xu
2023-07-27  7:20   ` Haibo Xu
2023-07-27  7:20   ` Haibo Xu
2023-07-27 15:14 ` [PATCH 0/4] RISCV: Add kvm Sstc timer selftest Sean Christopherson
2023-07-27 15:14   ` Sean Christopherson
2023-07-27 15:14   ` Sean Christopherson
2023-07-28  1:37   ` Haibo Xu
2023-07-28  1:37     ` Haibo Xu
2023-07-28  1:37     ` Haibo Xu
2023-07-28  9:57     ` Andrew Jones
2023-07-28  9:57       ` Andrew Jones
2023-07-28  9:57       ` Andrew Jones
2023-08-02  2:01       ` Haibo Xu
2023-08-02  2:01         ` Haibo Xu
2023-08-02  2:01         ` Haibo Xu
2023-08-02 22:16 ` Sean Christopherson
2023-08-02 22:16   ` Sean Christopherson
2023-08-02 22:16   ` Sean Christopherson
2023-08-03  0:26   ` Haibo Xu
2023-08-03  0:26     ` Haibo Xu
2023-08-03  0:26     ` Haibo Xu
2023-08-27  8:59   ` Haibo Xu
2023-08-27  8:59     ` Haibo Xu
2023-08-27  8:59     ` Haibo Xu
2023-08-28 14:08     ` Sean Christopherson
2023-08-28 14:08       ` Sean Christopherson
2023-08-28 14:08       ` Sean Christopherson
2023-08-29  5:04       ` Haibo Xu
2023-08-29  5:04         ` Haibo Xu
2023-08-29  5:04         ` Haibo Xu

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=ZMPR56RVgzI6s6Ik@google.com \
    --to=seanjc@google.com \
    --cc=kvm-riscv@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.