From: Oleksii Kurochko <oleksii.kurochko@gmail.com>
To: Baptiste Le Duc <baptiste.le-duc@vates.tech>
Cc: xen-devel@lists.xenproject.org, zhangzheng@iscas.ac.cn,
"Alistair Francis" <alistair.francis@wdc.com>,
"Connor Davis" <connojdavis@gmail.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Anthony PERARD" <anthony.perard@vates.tech>,
"Michal Orzel" <michal.orzel@amd.com>,
"Jan Beulich" <jbeulich@suse.com>,
"Julien Grall" <julien@xen.org>,
"Roger Pau Monné" <roger@xenproject.org>,
"Stefano Stabellini" <sstabellini@kernel.org>
Subject: Re: [PATCH 3/5] xen/riscv: make Svpbmt no longer a required extension
Date: Tue, 1 Sep 2026 18:01:45 +0200 [thread overview]
Message-ID: <3f6cd361-6349-433e-a7b7-8cc72b31b84e@gmail.com> (raw)
In-Reply-To: <1788168989.8631fc262581453bbf619ec5b2062170.1a0572d6c8c000c4f3@vates.tech>
On 8/31/26 11:36 AM, Baptiste Le Duc wrote:
> On 2026-08-28 17:58 +0200, Oleksii Kurochko wrote:
>>
>>
>> On 8/27/26 5:33 PM, Baptiste Le Duc wrote:
>>> required_extensions[] panics at boot if Svpbmt is missing, which is a
>>> problem on hardware that doesn't implement it.
>>
>> Based only on this sentence it isn't clear why it is safe to have SvPBMT
>> = n and what guarantees that if some memory for a device dma for example
>
> Sorry I'm not used to this kind of terminology, does Svpbmt = n means that MT
> bits ([62:61]) are equal to 0 = PMA?
Yes, exactly. Sorry for the confusion; by "Svpbmt = n" I meant that the
Svpbmt extension is not available/implemented on the platform.
>
>> should be non-cachable and strongly ordered what will guarantee that.
>>
>> So basically something like that should be added to the commit message:
>> ```
>> Without the Svpbmt extension, memory attributes (such as cacheability
>> and ordering) are strictly tied to physical address ranges and enforced
>> by the hardware's Physical Memory Attributes (PMA) checker.
>>
>> In this configuration, supervisor software relies on the platform's
>> memory map: peripheral device registers (MMIO) are physically mapped
>> into hardware-defined I/O regions (which are implicitly non-cacheable
>> and strongly-ordered), while regular RAM is mapped as cacheable main
>> memory.
>>
>> S-mode paging can safely map these physical ranges without specifying
>> page-based memory types in the PTEs, as the hardware MMU and PMA
>> pipeline will correctly bypass caches for MMIO accesses based on the
>> target physical address.
> I think this could go in the previous paragraph as it only concerns
> of the configuration you mentionned.
>
>> Furthermore, on platforms that either feature
>> fully hardware-coherent DMA or do not expose non-coherent DMA agents to
>> the OS, page-level programmatic cache control via Svpbmt is not
>> required, making it safe to boot and run when Svpbmt is absent.
> If we have a platforms that doesn't have both of these feature, what
> would happen?
Regarding your question about what happens if a platform has
non-coherent DMA and also lacks Svpbmt:
In that scenario, we must rely on other standard RISC-V mechanisms to
guarantee coherence. Typically, this is handled in one of two ways:
1. PMA-backed non-cacheable memory pools: The operating system or
hypervisor must allocate DMA buffers from a specific physical address
range that the hardware's Physical Memory Attributes (PMA) checker
defines as implicitly non-cacheable.
2. Software-managed cache coherence (Zicbom): If we must allocate DMA
buffers from regular cacheable RAM on a non-coherent platform, the
platform must implement the Zicbom extension. Software (Xen/Linux) will
then use Cache-Block Operations (CBOs) like `cbo.clean`, `cbo.flush`,
and `cbo.inval` to manually flush and invalidate caches before and after
DMA transactions.
3. Some platform specific solution...
So indeed, there are several hardware design combinations, but compliant
platforms without Svpbmt must either enforce coherence in hardware,
provide dedicated non-cacheable physical memory via PMA, or implement
Zicbom for software-managed coherence.
> Do we need to add a check in Xen code?
Good question. Generally, it would definitely be good to check this, but
I’m not sure how we could do that at runtime.
The best approach I have in mind is to require the user to explicitly
set a RISCV_ISA_SVPBMT configuration option (which doesn’t exist yet and
would need to be introduced) if the platform supports SvPBMT.
~ Oleksii
next prev parent reply other threads:[~2026-09-01 16:02 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 15:27 [PATCH 0/5] xen/riscv: fix boot on missing extensions and MMU setup bugs Baptiste Le Duc
2026-08-27 15:33 ` [PATCH 1/5] xen/riscv: always set A/D bits at boot time Baptiste Le Duc
2026-08-28 10:59 ` Oleksii Kurochko
2026-08-28 13:58 ` Baptiste Le Duc
2026-08-28 16:12 ` Oleksii Kurochko
2026-08-31 8:17 ` Baptiste Le Duc
2026-08-27 15:33 ` [PATCH 2/5] xen/riscv: preset A/D bits in Xen's own page-table mappings Baptiste Le Duc
2026-08-28 13:34 ` Oleksii Kurochko
2026-08-31 8:52 ` Baptiste Le Duc
2026-08-27 15:33 ` [PATCH 3/5] xen/riscv: make Svpbmt no longer a required extension Baptiste Le Duc
2026-08-28 15:58 ` Oleksii Kurochko
2026-08-31 9:36 ` Baptiste Le Duc
2026-09-01 16:01 ` Oleksii Kurochko [this message]
2026-09-09 12:02 ` Baptiste Le Duc
2026-08-27 15:33 ` [PATCH 4/5] xen/riscv: make Zihintpause " Baptiste Le Duc
2026-08-28 8:59 ` Oleksii Kurochko
2026-08-28 9:16 ` Baptiste Le Duc
2026-08-27 15:33 ` [PATCH 5/5] xen/riscv: add SFENCE.VMA after enabling paging Baptiste Le Duc
2026-08-27 16:53 ` Oleksii Kurochko
2026-08-27 16:58 ` Oleksii Kurochko
2026-08-28 7:13 ` Jan Beulich
2026-08-28 8:03 ` Oleksii Kurochko
2026-08-28 8:11 ` Oleksii Kurochko
2026-08-28 8:29 ` Baptiste Le Duc
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=3f6cd361-6349-433e-a7b7-8cc72b31b84e@gmail.com \
--to=oleksii.kurochko@gmail.com \
--cc=alistair.francis@wdc.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=baptiste.le-duc@vates.tech \
--cc=connojdavis@gmail.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=roger@xenproject.org \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
--cc=zhangzheng@iscas.ac.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.