Skip to content

x86: Enable PAT for write-combining mappings - #147

Merged
slp merged 1 commit into
libkrun:mainfrom
jakogut:enable-mtrr-pat
Sep 22, 2026
Merged

slp merged 1 commit into
libkrun:mainfrom
jakogut:enable-mtrr-pat

Conversation

@jakogut

@jakogut jakogut commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Enable MTRR and PAT in the generic and Windows kernel configurations to match SEV and TDX. CONFIG_X86_PAT depends on CONFIG_MTRR. Without PAT, WC mappings fall back to UC-minus.

AMD and Intel userspace drivers use write-combined GPU buffers with virtio native contexts. Venus and virgl also expose write-combined buffer mappings to the guest. The UC-minus fallback makes CPU writes to these buffers expensive. Write-back mappings are unaffected.

Tested with AMD native contexts on Strix Halo integrated graphics and an RX 9070 XT discrete GPU. Strix Halo showed about a 95% reduction in RADV command recording CPU time. Intel, Venus and virgl remain untested.

Signed-off-by: Joseph Kogut joseph.kogut@gmail.com

Enable MTRR and PAT in the generic and Windows kernel configurations
to match SEV and TDX. CONFIG_X86_PAT depends on CONFIG_MTRR. Without
PAT, WC mappings fall back to UC-minus.

AMD and Intel userspace drivers use write-combined GPU buffers with
virtio native contexts. Venus and virgl also expose write-combined
buffer mappings to the guest. The UC-minus fallback makes CPU writes
to these buffers expensive. Write-back mappings are unaffected.

Tested with AMD native contexts on Strix Halo integrated graphics and
an RX 9070 XT discrete GPU. Strix Halo showed about a 95% reduction in
RADV command recording CPU time. Intel, Venus and virgl remain untested.

Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
@slp

slp commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Makes sense, nice one here, thanks @jakogut !

@slp
slp merged commit 529fbc0 into libkrun:main Sep 22, 2026
6 checks passed
@jakogut
jakogut deleted the enable-mtrr-pat branch September 22, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants