<div dir="ltr"><div>Applied to bionic:linux master-next, thanks :)</div><div><br></div><div>- Luke<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 16, 2023 at 9:52 PM Po-Hsu Lin <<a href="mailto:po-hsu.lin@canonical.com">po-hsu.lin@canonical.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">[Impact]<br>
RDPRU, the Read Processor Register instruction of AMD Zen 2 processors<br>
is used to give access to some processor registers that are typically<br>
only accessible when the privilege level is zero.<br>
<br>
rdpru test in ubuntu_kvm_unit_tests is to check if the RDPRU instruction<br>
can be intercepted by the Hypervisor. Without this patchset, this test<br>
will fail on our AMD Zen 2 system "riccioli" with:<br>
FAIL: RDPRU raises #UD<br>
<br>
[Fix]<br>
* fb64f293 x86/cpufeatures: Add feature bit RDPRU on AMD<br>
* 0cb8410b kvm: svm: Intercept RDPRU<br>
<br>
We have these patches in newer releases already, only Bionic 4.15<br>
requires this fix. The first patch needs to be backported with some<br>
context adjustment, the second can be cherry-picked.<br>
<br>
[Test]<br>
Test kernel can be found here:<br>
<a href="https://people.canonical.com/~phlin/kernel/lp-1968681-rdpru/" rel="noreferrer" target="_blank">https://people.canonical.com/~phlin/kernel/lp-1968681-rdpru/</a><br>
<br>
With the patched kernel, this rdpru test will pass on the target AMD<br>
Zen 2 system.<br>
$ sudo ./rdpru<br>
BUILD_HEAD=d6421940<br>
timeout -k 1s --foreground 90s /usr/bin/qemu-system-x86_64 --no-reboot \<br>
-nodefaults -device pc-testdev -device isa-debug-exit,iobase=0xf4,iosize=0x4 \<br>
-vnc none -serial stdio -device pci-testdev -machine accel=kvm -kernel \<br>
/tmp/tmp.XOMVxpyNnl -smp 1 -cpu max # -initrd /tmp/tmp.I2TbGXFiaZ<br>
enabling apic<br>
smp: waiting for 0 APs<br>
PASS: RDPRU raises #UD<br>
SUMMARY: 1 tests<br>
PASS rdpru (1 tests)<br>
<br>
And the rdpru flag will be available in cpuinfo:<br>
$ grep -o rdpru /proc/cpuinfo<br>
rdpru<br>
<br>
[Where problems could occur]<br>
This patchset will add a new feature bit RDPRU for AMD Zen 2. We can<br>
expect to see new issues coming up when using this bit in the future.<br>
<br>
Babu Moger (1):<br>
x86/cpufeatures: Add feature bit RDPRU on AMD<br>
<br>
Jim Mattson (1):<br>
kvm: svm: Intercept RDPRU<br>
<br>
arch/x86/include/asm/cpufeatures.h | 1 +<br>
arch/x86/include/asm/svm.h | 1 +<br>
arch/x86/include/uapi/asm/svm.h | 1 +<br>
arch/x86/kvm/svm.c | 8 ++++++++<br>
4 files changed, 11 insertions(+)<br>
<br>
-- <br>
2.7.4<br>
<br>
<br>
-- <br>
kernel-team mailing list<br>
<a href="mailto:kernel-team@lists.ubuntu.com" target="_blank">kernel-team@lists.ubuntu.com</a><br>
<a href="https://lists.ubuntu.com/mailman/listinfo/kernel-team" rel="noreferrer" target="_blank">https://lists.ubuntu.com/mailman/listinfo/kernel-team</a><br>
</blockquote></div></div>