public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <andrew.jones@linux.dev>
To: Cade Richard <cade.richard@gmail.com>
Cc: kvm@vger.kernel.org, kvm-riscv@lists.infradead.org,
	 atishp@rivosinc.com, cade.richard@berkeley.edu,
	jamestiotio@gmail.com
Subject: Re: [PATCH kvm-unit-tests] riscv: sbi: add dbcn write test
Date: Wed, 7 Aug 2024 15:37:27 +0200	[thread overview]
Message-ID: <20240807-bb9135bb41297039b3b7e135@orel> (raw)
In-Reply-To: <20240807-ff37f5aa2c767c4b3b734cc0@orel>

On Wed, Aug 07, 2024 at 02:29:31PM GMT, Andrew Jones wrote:
> On Wed, Aug 07, 2024 at 01:36:33PM GMT, Andrew Jones wrote:
> ...
> > I just tried 32-bit KVM and see that the DBCN write test fails the
> > 'write success' test. That may be a KVM bug.
> >
> 
> We can blame both KVM and kvmtool.
> 
> KVM sets sbiret.error to a0 and sbiret.value to a1 before exiting to
> userspace[1]. I think that comes from thinking about how a real ecall
> would set them. However, as this isn't an ecall, they should get set
> directly by userspace, not through registers. Also, we should initialize
> them to some known value before calling userspace, and zero is probably
> the best choice.

Thinking about this some more and discussing it with Anup, the best
choice for sbiret.error is to initialize it to SBI_ERR_NOT_SUPPORTED.
Doing that won't allow the test to pass with old kvmtool, but that's
OK. I'll send a KVM patch for that and the kvmtool patch.

Thanks,
drew

> 
> kvmtool neglects to set sbiret.error to SBI_SUCCESS on a successful write.
> QEMU does set it, so this failure shouldn't happen with QEMU, but I
> haven't tried it.
> 
> Patching both KVM and kvmtool is best, as it would allow the test to pass
> when running new KVM with old kvmtool and when running old KVM with new
> kvmtool.
> 
> [1] arch/riscv/kvm/vcpu_sbi.c:130
> 
> Thanks,
> drew
> 
> -- 
> kvm-riscv mailing list
> kvm-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kvm-riscv

  reply	other threads:[~2024-08-07 13:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-07  5:51 [PATCH kvm-unit-tests] riscv: sbi: add dbcn write test Cade Richard
2024-08-07  7:43 ` Andrew Jones
2024-08-07 11:36 ` Andrew Jones
2024-08-07 12:29   ` Andrew Jones
2024-08-07 13:37     ` Andrew Jones [this message]
2024-08-09  7:52 ` Andrew Jones

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=20240807-bb9135bb41297039b3b7e135@orel \
    --to=andrew.jones@linux.dev \
    --cc=atishp@rivosinc.com \
    --cc=cade.richard@berkeley.edu \
    --cc=cade.richard@gmail.com \
    --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