Re: [PATCH] KVM: selftests: Add guest-side test for AMD HWCR.McStatusWrEn
From: Sean Christopherson
Date: Thu May 07 2026 - 14:28:56 EST
On Thu, May 07, 2026, Costas Argyris wrote:
> The existing hwcr_msr_test exercises MSR_K7_HWCR only via KVM_SET_MSRS,
> which sets host_initiated=true in KVM. The gate in set_msr_mce() that
> calls can_set_mci_status() short-circuits when host_initiated=true, so
> can_set_mci_status() is never reached by the existing test.
>
> Add a guest-side test that verifies HWCR.McStatusWrEn (bit 18) correctly
> gates non-zero writes to MCi_STATUS MSRs. With the bit set, the write
> must succeed and read back unchanged. With the bit clear, the write must
> raise #GP and leave the register unmodified.
>
> Signed-off-by: Costas Argyris <costas.argyris@xxxxxxx>
> ---
> .../testing/selftests/kvm/x86/hwcr_msr_test.c | 65 ++++++++++++++++++-
> 1 file changed, 63 insertions(+), 2 deletions(-)
Rather than pile code into a one-off MSR test, how hard would it be to fold this
into msrs_test.c?