From: "Radim Krčmář" <rkrcmar@ventanamicro.com>
To: "Wu Fei" <atwufei@163.com>,
"Andrew Jones" <ajones@ventanamicro.com>,
<wu.fei9@sanechips.com.cn>
Cc: <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: Mon, 20 Oct 2025 21:32:57 +0200 [thread overview]
Message-ID: <DDNEF8ASSO19.2P4OJ3KYPWRIH@ventanamicro.com> (raw)
In-Reply-To: <93d3af21-5d3d-465c-a9f2-0eaed7475fb3@163.com>
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.
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.
>>
>>> +
>>> + // set the first (maximum) supported mode as default
>>
>> Please, no C++ comments, and don't we want a V39 mode to be the default?
>> In fact, VM_MODE_P41V39_4K should always be supported, so we can just set
>> VM_MODE_DEFAULT to that.
>
> It's likely the maximum supported mode is the most common configuration
> on production?
Yes, KVM currently picks the widest mode, although I think the optimal
choice of hgatp is the smallest one that fully covers the whole guest
physical address space.
(e.g. if all guest memory is mapped below 2 TiB, KVM should pick Sv39x4
for its hgatp, regardless of what is the widest supported mode.)
--
kvm-riscv mailing list
kvm-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kvm-riscv
next prev parent reply other threads:[~2025-10-20 19:34 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ář [this message]
2025-10-21 23:55 ` Andrew Jones
2025-10-22 13:13 ` Wu Fei
2025-10-22 14:26 ` Radim Krčmář
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=DDNEF8ASSO19.2P4OJ3KYPWRIH@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.