All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@ventanamicro.com>
To: "Wu Fei" <atwufei@163.com>, "Andrew Jones" <ajones@ventanamicro.com>
Cc: <wu.fei9@sanechips.com.cn>, <kvm-riscv@lists.infradead.org>,
	"kvm-riscv" <kvm-riscv-bounces@lists.infradead.org>
Subject: Re: [PATCH 2/2] KVM: riscv: selftests: Detect supported vm modes
Date: Wed, 22 Oct 2025 16:26:20 +0200	[thread overview]
Message-ID: <DDOX5JZWQK87.2SZ1CS39ZZAOZ@ventanamicro.com> (raw)
In-Reply-To: <5ed53d05-2ed8-43dc-8a41-1906b6982c80@163.com>

2025-10-22T21:13:08+08:00, Wu Fei <atwufei@163.com>:
> On 10/22/25 07:55, Andrew Jones wrote:
>> On Mon, Oct 20, 2025 at 09:32:57PM +0200, Radim Krčmář wrote:
>>> 2025-10-20T21:26:18+08:00, Wu Fei <atwufei@163.com>:
>>>> On 10/18/25 00:04, Andrew Jones wrote:
>>>>>> -               guest_mode_append(VM_MODE_P56V57_4K, sz >= 59);
>>>>>> -               guest_mode_append(VM_MODE_P50V48_4K, sz >= 50);
>>>>>> -               guest_mode_append(VM_MODE_P41V39_4K, sz >= 41);
>>>>>> +               guest_mode_append(VM_MODE_P56V57_4K, satp_mode >= SATP_MODE_57 && sz >= 59);
>>>>>> +               guest_mode_append(VM_MODE_P50V48_4K, satp_mode >= SATP_MODE_48 && sz >= 50);
>>>>>> +               guest_mode_append(VM_MODE_P41V39_4K, satp_mode >= SATP_MODE_39 && sz >= 41);
>>>>>
>>>>> Something along these lines was what I was suggesting in the last patch,
>>>>> but where we select from many more combinations of P and V for modes.
>>>>>
>>>>> VM_MODE_P41V39_4K
>>>>> VM_MODE_P41V48_4K
>>>>> VM_MODE_P41V57_4K
>>>>> VM_MODE_P50V48_4K
>>>>> VM_MODE_P50V57_4K
>>>>> VM_MODE_P59V57_4K
>>>>
>>>> Do we need more? e.g. for sv39, there could be P50V39 and P56V39.
>>>
>>> Bare is probably the most important first stage mode, as it's the only
>>> one that might fully test the two extra bits of Sv57x4.
>> 
>> Indeed, but for that we need a mode named something like VM_MODE_BARE59.
>
> The current code has some assumption on non-bare mode, such as virt_map. 
> It looks not trivial to support BARE mode. Is it okay to focus on 
> non-bare mode in this series, and leave bare mode support to another 
> patchset?>

Of course.  There is no point in adding symbols that are not used.

>>> I think a single combination per "x4" mode might be sufficient, since
>>> all non-bare first stages generate 56-bit physical addresses anyway, but
>>> it makes sense to have all of them if we're doing more than one.
>> 
>> Yeah, might as well.
>
> Add all of them?

Tests cannot choose hgatp; KVM just tells us that the physical width is.
This means that we must support the following:

  VM_MODE_P41V39_4K
  VM_MODE_P50V39_4K
  VM_MODE_P59V39_4K

I don't think it's correct to assume that when SvABx4 is supported, then
SvAB is supported, hence we must have Sv39 for each hgatp mode that KVM
supports.

And shouldn't it be invalid to pick VM_MODE_P41V39_4K when KVM is using
Sv48x4?  For tests that that don't care about physical width, we could
add:

  VM_MODE_PXXV39_4K

It doesn't seem necessary to support more than that, but if our tests
want larger virtual address space, we can add V48 and V57 variants.

Thanks.

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

  reply	other threads:[~2025-10-22 14:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20251017110908650RWBl7sDIk6WUGhkvJSH4L@zte.com.cn>
2025-10-17  3:13 ` [PATCH 1/2] KVM: riscv: selftests: Add riscv vm satp modes wu.fei9
2025-10-17 15:38   ` Andrew Jones
2025-10-20 13:09     ` Wu Fei
2025-10-21 23:35       ` Andrew Jones
2025-10-17  3:15 ` [PATCH 2/2] KVM: riscv: selftests: Detect supported vm modes wu.fei9
2025-10-17 16:04   ` Andrew Jones
2025-10-20 13:26     ` Wu Fei
2025-10-20 19:32       ` Radim Krčmář
2025-10-21 23:55         ` Andrew Jones
2025-10-22 13:13           ` Wu Fei
2025-10-22 14:26             ` Radim Krčmář [this message]
2025-10-24 13:48               ` Wu Fei
2025-10-24 15:59                 ` Radim Krčmář

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=DDOX5JZWQK87.2SZ1CS39ZZAOZ@ventanamicro.com \
    --to=rkrcmar@ventanamicro.com \
    --cc=ajones@ventanamicro.com \
    --cc=atwufei@163.com \
    --cc=kvm-riscv-bounces@lists.infradead.org \
    --cc=kvm-riscv@lists.infradead.org \
    --cc=wu.fei9@sanechips.com.cn \
    /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.