public inbox for linux-doc@vger.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <radim.krcmar@oss.qualcomm.com>
To: <fangyu.yu@linux.alibaba.com>
Cc: <ajones@ventanamicro.com>, <alex@ghiti.fr>,
	<andrew.jones@oss.qualcomm.com>, <anup@brainfault.org>,
	<aou@eecs.berkeley.edu>, <atish.patra@linux.dev>,
	<corbet@lwn.net>, <guoren@kernel.org>,
	<kvm-riscv@lists.infradead.org>, <kvm@vger.kernel.org>,
	<linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-riscv@lists.infradead.org>, <palmer@dabbelt.com>,
	<pbonzini@redhat.com>, <pjw@kernel.org>
Subject: Re: [PATCH v3 1/2] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode
Date: Fri, 30 Jan 2026 15:58:32 +0000	[thread overview]
Message-ID: <DG21QMIKJS7W.1OUK0OFL8S3A8@oss.qualcomm.com> (raw)
In-Reply-To: <20260130132458.16367-1-fangyu.yu@linux.alibaba.com>

2026-01-30T21:24:58+08:00, <fangyu.yu@linux.alibaba.com>:
>>> From: Fangyu Yu <fangyu.yu@linux.alibaba.com>
>>> -	kvm_info("using %s G-stage page table format\n", str);
>>> +	kvm_info("Max G-stage page table format %s\n", str);
>>
>>Fun fact: the ISA doesn't define the same hierarchy for hgatp modes as
>>it does for satp modes, so we could have just Sv57x4 and nothing below.
>>
>>We could do just with a code comment that we're assuming vendors will do
>>better, but I'd rather not introduce more assumptions...
>>I think the easiest would be to kvm_riscv_gstage_mode_detect() levels in
>>reverse and stop on the first one that is not supported.
>>(I'll reply with a patch later.)
>
> Please refer to the discussion here:
> https://github.com/riscv/riscv-isa-manual/issues/2208
> If Sv57x4 is implemented, then Sv48x4 and Sv39x4 must also be implemented.

I don't think so, sadly, but we're mostly dealing with technicalities
here.  As Andrew pointed out:

  "The H extension itself does not impose this requirement, so
  technically Sv57x4 without Sv48x4 conforms to the H extension spec."

This means it's completely valid to support {Bare, Sv39x4, Sv57x4}.
The RVA23 profile imposes additional constraints via Shgatpa:

  "For each supported virtual memory scheme SvNN supported in satp, the
  corresponding hgatp SvNNx4 mode must be supported.
  The hgatp mode Bare must also be supported."

The requirement only goes one way, so an RVA23 implementation with just
{Bare, Sv39} in satp could support {Bare, Sv39x4, Sv57x4} in hgatp,
because RVA23 nor ISA prevent Sv57x4 to be there.
Not that I expect any sensible implementation to do this...

Btw. do we target only RVA23 with KVM?

Thanks.

  reply	other threads:[~2026-01-30 15:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-25 15:04 [PATCH v3 0/2] Support runtime configuration for per-VM's HGATP mode fangyu.yu
2026-01-25 15:04 ` [PATCH v3 1/2] RISC-V: KVM: " fangyu.yu
2026-01-29 15:27   ` Radim Krčmář
2026-01-29 20:25     ` [SUGGESTION] KVM: RISC-V: detect gstage mode hierarchy Radim Krčmář
2026-01-30 13:24     ` Re: [PATCH v3 1/2] RISC-V: KVM: Support runtime configuration for per-VM's HGATP mode fangyu.yu
2026-01-30 15:58       ` Radim Krčmář [this message]
2026-01-31  6:12         ` fangyu.yu
2026-01-25 15:04 ` [PATCH v3 2/2] RISC-V: KVM: add KVM_CAP_RISCV_SET_HGATP_MODE fangyu.yu
2026-01-26  1:25   ` fangyu.yu
2026-01-29 17:40   ` Radim Krčmář
2026-01-30 13:25     ` fangyu.yu

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=DG21QMIKJS7W.1OUK0OFL8S3A8@oss.qualcomm.com \
    --to=radim.krcmar@oss.qualcomm.com \
    --cc=ajones@ventanamicro.com \
    --cc=alex@ghiti.fr \
    --cc=andrew.jones@oss.qualcomm.com \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=atish.patra@linux.dev \
    --cc=corbet@lwn.net \
    --cc=fangyu.yu@linux.alibaba.com \
    --cc=guoren@kernel.org \
    --cc=kvm-riscv@lists.infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=pbonzini@redhat.com \
    --cc=pjw@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