Message ID | 20200901105445.22277-4-roger.pau@citrix.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | x86: switch default MSR behavior | expand |
On 01/09/2020 11:54, Roger Pau Monne wrote: > @@ -517,6 +523,15 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val) > wrmsr_tsc_aux(val); > break; > > + case MSR_AMD64_DE_CFG: > + /* > + * OpenBSD 6.7 will panic if writing to DE_CFG triggers a #GP: > + * https://www.illumos.org/issues/12998 "Drop writes", or some suitable equivalent, so it is clear what action Xen is trying to take in response to the bug. Otherwise, Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> > + */ > + if ( !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) ) > + goto gp_fault; > + break; > + > case MSR_AMD64_DR0_ADDRESS_MASK: > case MSR_AMD64_DR1_ADDRESS_MASK ... MSR_AMD64_DR3_ADDRESS_MASK: > if ( !cp->extd.dbext || val != (uint32_t)val )
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c index a478b91f23..e84107ac7b 100644 --- a/xen/arch/x86/msr.c +++ b/xen/arch/x86/msr.c @@ -292,6 +292,12 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val) *val = msrs->tsc_aux; break; + case MSR_AMD64_DE_CFG: + if ( !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) ) + goto gp_fault; + *val = AMD64_DE_CFG_LFENCE_SERIALISE; + break; + case MSR_AMD64_DR0_ADDRESS_MASK: case MSR_AMD64_DR1_ADDRESS_MASK ... MSR_AMD64_DR3_ADDRESS_MASK: if ( !cp->extd.dbext ) @@ -517,6 +523,15 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val) wrmsr_tsc_aux(val); break; + case MSR_AMD64_DE_CFG: + /* + * OpenBSD 6.7 will panic if writing to DE_CFG triggers a #GP: + * https://www.illumos.org/issues/12998 + */ + if ( !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) ) + goto gp_fault; + break; + case MSR_AMD64_DR0_ADDRESS_MASK: case MSR_AMD64_DR1_ADDRESS_MASK ... MSR_AMD64_DR3_ADDRESS_MASK: if ( !cp->extd.dbext || val != (uint32_t)val )
Report LFENCE_SERIALISE unconditionally for DE_CFG on AMD hardware and silently drop writes. Reported-by: Andrew Cooper <andrew.cooper3@citrix.com> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- Changes since v2: - Drop the bot_cpu checks and don't attempt to read the MSR, just return LFENCE_SERIALISE unconditionally. - Add a comment about OpenBSD panicking if writing to the MSR triggers a #GP. Changes since v1: - New in this version. --- xen/arch/x86/msr.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)