Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Andrew Jones <andrew.jones@linux.dev>
To: James Raphael Tiovalen <jamestiotio@gmail.com>
Cc: kvm@vger.kernel.org, kvm-riscv@lists.infradead.org,
	 atishp@rivosinc.com, cade.richard@berkeley.edu
Subject: Re: [kvm-unit-tests PATCH v4 3/3] riscv: sbi: Add tests for HSM extension
Date: Mon, 16 Sep 2024 12:49:31 +0200	[thread overview]
Message-ID: <20240916-cedb477964d0af321cea6bec@orel> (raw)
In-Reply-To: <20240915183459.52476-4-jamestiotio@gmail.com>

On Mon, Sep 16, 2024 at 02:34:59AM GMT, James Raphael Tiovalen wrote:
...
> +static struct sbiret sbi_hart_suspend(uint32_t suspend_type, unsigned long resume_addr, unsigned long opaque)
> +{
> +	return sbi_ecall(SBI_EXT_HSM, SBI_EXT_HSM_HART_SUSPEND, suspend_type, resume_addr, opaque, 0, 0, 0);
> +}
> +

It's good to create these wrappers per the spec, i.e. use the parameter
name types from the spec to define the wrapper, but we should also
remember that if, like in this case, we force a parameter to be of a
certain type that we also add tests for when we use input outside the
expected range by using a "raw" ecall. See the last test of the DBCN
extension where we test a byte write with a word full of data to
ensure the SBI call does the right thing. We have to call sbi_ecall()
instead of sbi_dbcn_write_byte() to do that because sbi_dbcn_write_byte()
has been written to only accept uint8_t input.

So we'll need some sort of test for suspend where we pass a value
with high bits set for suspend_type when running the test on rv64.

Thanks,
drew

      parent reply	other threads:[~2024-09-16 10:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-15 18:34 [kvm-unit-tests PATCH v4 0/3] riscv: sbi: Add support to test HSM extension James Raphael Tiovalen
2024-09-15 18:34 ` [kvm-unit-tests PATCH v4 1/3] riscv: Rewrite hartid_to_cpu in assembly James Raphael Tiovalen
2024-09-16  7:19   ` Andrew Jones
2024-09-15 18:34 ` [kvm-unit-tests PATCH v4 2/3] riscv: sbi: Provide entry point for HSM tests James Raphael Tiovalen
2024-09-15 18:34 ` [kvm-unit-tests PATCH v4 3/3] riscv: sbi: Add tests for HSM extension James Raphael Tiovalen
2024-09-16  9:23   ` Andrew Jones
2024-09-16 10:49   ` Andrew Jones [this message]

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=20240916-cedb477964d0af321cea6bec@orel \
    --to=andrew.jones@linux.dev \
    --cc=atishp@rivosinc.com \
    --cc=cade.richard@berkeley.edu \
    --cc=jamestiotio@gmail.com \
    --cc=kvm-riscv@lists.infradead.org \
    --cc=kvm@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox