Kernel KVM virtualization development
 help / color / mirror / Atom feed
* [PATCH] KVM: SVM: Do not warn on IGNNE MSR write
@ 2026-07-08 13:41 Jerry Lyu
  2026-07-08 13:50 ` Sean Christopherson
  0 siblings, 1 reply; 5+ messages in thread
From: Jerry Lyu @ 2026-07-08 13:41 UTC (permalink / raw)
  To: seanjc, pbonzini, joerg.roedel; +Cc: kvm, Jerry Lyu

Booting windows server 2025 on top of Linux KVM results in host kernel
warning logs of "Unhandled WRMSR(0xc0010115) = 0x0", which is due to
"IGNNE MSR" write in guest hyper-v. According to AMD APM volume 2,
section 15.30.2, the MSR is "only useful if IGNNE emulation has been
enabled in the HW_CR MSR", while currently KVM has prevented guests from
enabling it. So change the warning to a stronger check.

IGNNE is used in the legacy MS-DOS compatibility sub-mode of X87 FPU
exception handling. Intel SDM volume 1, section 8,7.2 describes the
details of this mode which applies to AMD CPU as well. The CPU selects
this mode when CR0.NE bit is 0, and will rely on two pins (FERR# and
IGNNE#) for exception handling. AMD later introduced IGNNE MSR to "set
the state of the processor-internal IGNNE signal directly" in order to
support the legacy mode without the dependency on IGNNE# pin.

The current KVM implementation does not emulate this feature, not sound
necessary as well. The commit 82494028dff648c29e3a ("KVM: SVM: Ignore
write of hwcr.ignne") clears the bit-8 value in the guest HWCR MSR
write, making such field always zero, then the write to guest IGNNE MSR
can always be safely ignored.

Signed-off-by: Jerry Lyu <jerry.lyu@open-hieco.net>
---
 arch/x86/kvm/svm/svm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index ef69a51ab27f..1100d9a66c2c 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -3196,7 +3196,7 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
 	case MSR_VM_CR:
 		return svm_set_vm_cr(vcpu, data);
 	case MSR_VM_IGNNE:
-		kvm_pr_unimpl_wrmsr(vcpu, ecx, data);
+		KVM_BUG_ON(vcpu->arch.msr_hwcr & BIT_ULL(8), vcpu->kvm);
 		break;
 	case MSR_AMD64_DE_CFG: {
 		u64 supported_de_cfg;

base-commit: 50406d35f5635e1cc523e61409d57e851b5f5df8
-- 
2.43.7


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] KVM: SVM: Do not warn on IGNNE MSR write
  2026-07-08 13:41 [PATCH] KVM: SVM: Do not warn on IGNNE MSR write Jerry Lyu
@ 2026-07-08 13:50 ` Sean Christopherson
  2026-07-09  1:41   ` Jerry Lyu
  0 siblings, 1 reply; 5+ messages in thread
From: Sean Christopherson @ 2026-07-08 13:50 UTC (permalink / raw)
  To: Jerry Lyu; +Cc: pbonzini, joerg.roedel, kvm

On Wed, Jul 08, 2026, Jerry Lyu wrote:
> Booting windows server 2025 on top of Linux KVM results in host kernel
> warning logs of "Unhandled WRMSR(0xc0010115) = 0x0", which is due to
> "IGNNE MSR" write in guest hyper-v. According to AMD APM volume 2,
> section 15.30.2, the MSR is "only useful if IGNNE emulation has been
> enabled in the HW_CR MSR", while currently KVM has prevented guests from
> enabling it. So change the warning to a stronger check.

Except the APM doesn't say anything about the ordering, and in typical APM
fashion, nor does it actually say what happens if IGNNE emulation is disabled.

> IGNNE is used in the legacy MS-DOS compatibility sub-mode of X87 FPU
> exception handling. Intel SDM volume 1, section 8,7.2 describes the
> details of this mode which applies to AMD CPU as well. The CPU selects
> this mode when CR0.NE bit is 0, and will rely on two pins (FERR# and
> IGNNE#) for exception handling. AMD later introduced IGNNE MSR to "set
> the state of the processor-internal IGNNE signal directly" in order to
> support the legacy mode without the dependency on IGNNE# pin.
> 
> The current KVM implementation does not emulate this feature, not sound
> necessary as well. The commit 82494028dff648c29e3a ("KVM: SVM: Ignore
> write of hwcr.ignne") clears the bit-8 value in the guest HWCR MSR
> write, making such field always zero, then the write to guest IGNNE MSR
> can always be safely ignored.

Well, yeah, that's what KVM is doing, ignoring the write.  But KVM is also logging
that the guest attempted to write an MSR that KVM doesn't support, i.e. this is
more or less working as intended.

That said, KVM does effectively support the case where #IGGNE is not asserted, so
I think we can simply do this to avoid the useless logging?

diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index e755f43f4376..a7efac3241c2 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -3205,7 +3205,8 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
        case MSR_VM_CR:
                return svm_set_vm_cr(vcpu, data);
        case MSR_VM_IGNNE:
-               kvm_pr_unimpl_wrmsr(vcpu, ecx, data);
+               if (data)
+                       kvm_pr_unimpl_wrmsr(vcpu, ecx, data);
                break;
        case MSR_AMD64_DE_CFG: {
                u64 supported_de_cfg;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] KVM: SVM: Do not warn on IGNNE MSR write
  2026-07-08 13:50 ` Sean Christopherson
@ 2026-07-09  1:41   ` Jerry Lyu
  2026-07-09  7:26     ` Jerry Lyu
  2026-07-09 13:32     ` Sean Christopherson
  0 siblings, 2 replies; 5+ messages in thread
From: Jerry Lyu @ 2026-07-09  1:41 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: pbonzini, joerg.roedel, kvm

Thanks Sean for the prompt feedback!

On Wed, Jul 08, 2026 at 06:50:50AM -0700, Sean Christopherson wrote:
> On Wed, Jul 08, 2026, Jerry Lyu wrote:
> > Booting windows server 2025 on top of Linux KVM results in host kernel
> > warning logs of "Unhandled WRMSR(0xc0010115) = 0x0", which is due to
> > "IGNNE MSR" write in guest hyper-v. According to AMD APM volume 2,
> > section 15.30.2, the MSR is "only useful if IGNNE emulation has been
> > enabled in the HW_CR MSR", while currently KVM has prevented guests from
> > enabling it. So change the warning to a stronger check.
> 
> Except the APM doesn't say anything about the ordering, and in typical APM

Indeed. I did some experiment on bare metal system to write IGNNE MSR
with it disabled and then write HW_CR to enable it, the written value is
still there. It can be in any order.

> fashion, nor does it actually say what happens if IGNNE emulation is disabled.

Right. I did not find that as well. Since IGNNE MSR and IGNNE emulation
is an incremental feature, it would be reasonable to guess that hardware
will fall back to the IGNNE pin usage relying on external sources to
assert/de-assert it. If the IGNNE pin is not available in hardware,
CR0.NE must not be 0 to use the legacy mode.

> 
> > IGNNE is used in the legacy MS-DOS compatibility sub-mode of X87 FPU
> > exception handling. Intel SDM volume 1, section 8,7.2 describes the
> > details of this mode which applies to AMD CPU as well. The CPU selects
> > this mode when CR0.NE bit is 0, and will rely on two pins (FERR# and
> > IGNNE#) for exception handling. AMD later introduced IGNNE MSR to "set
> > the state of the processor-internal IGNNE signal directly" in order to
> > support the legacy mode without the dependency on IGNNE# pin.
> > 
> > The current KVM implementation does not emulate this feature, not sound
> > necessary as well. The commit 82494028dff648c29e3a ("KVM: SVM: Ignore
> > write of hwcr.ignne") clears the bit-8 value in the guest HWCR MSR
> > write, making such field always zero, then the write to guest IGNNE MSR
> > can always be safely ignored.
> 
> Well, yeah, that's what KVM is doing, ignoring the write.  But KVM is also logging
> that the guest attempted to write an MSR that KVM doesn't support, i.e. this is
> more or less working as intended.
> 
> That said, KVM does effectively support the case where #IGGNE is not asserted, so
> I think we can simply do this to avoid the useless logging?

Yeah, that can work for the current case. However, if another guest
initializes the IGNNE MSR with different value meanwhile never enables
the IGNNE emulation, kvm will again print uselsss logging. How about
adding warning in HW_CR like below?

diff --git a/arch/x86/kvm/msrs.c b/arch/x86/kvm/msrs.c
index c230b18d87e3..cbb743c41276 100644
--- a/arch/x86/kvm/msrs.c
+++ b/arch/x86/kvm/msrs.c
@@ -1564,12 +1564,17 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
                u64 valid = BIT_ULL(18) | BIT_ULL(24);
 
                data &= ~(u64)0x40;     /* ignore flush filter disable */
-               data &= ~(u64)0x100;    /* ignore ignne emulation enable */
                data &= ~(u64)0x8;      /* ignore TLB cache disable */
 
                if (guest_cpu_cap_has(vcpu, X86_FEATURE_GP_ON_USER_CPUID))
                        valid |= MSR_K7_HWCR_CPUID_USER_DIS;
 
+               if (data & ~BIT_ULL(8)) {
+                       /* ignore ignne emulation enable with a warning */
+                       data &= ~(u64)0x100;
+                       kvm_pr_unimpl_wrmsr(vcpu, msr, data);
+               }
+
                if (data & ~valid) {
                        kvm_pr_unimpl_wrmsr(vcpu, msr, data);
                        return 1;

Then the IGNNE write can be silently ignored no matter what value to
write. The kvm selftest of hwcr_msr_test.c can keep unchanged. What's
your opinion? Thanks again!

> 
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index e755f43f4376..a7efac3241c2 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -3205,7 +3205,8 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
>         case MSR_VM_CR:
>                 return svm_set_vm_cr(vcpu, data);
>         case MSR_VM_IGNNE:
> -               kvm_pr_unimpl_wrmsr(vcpu, ecx, data);
> +               if (data)
> +                       kvm_pr_unimpl_wrmsr(vcpu, ecx, data);
>                 break;
>         case MSR_AMD64_DE_CFG: {
>                 u64 supported_de_cfg;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] KVM: SVM: Do not warn on IGNNE MSR write
  2026-07-09  1:41   ` Jerry Lyu
@ 2026-07-09  7:26     ` Jerry Lyu
  2026-07-09 13:32     ` Sean Christopherson
  1 sibling, 0 replies; 5+ messages in thread
From: Jerry Lyu @ 2026-07-09  7:26 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: pbonzini, joerg.roedel, kvm

On Thu, Jul 09, 2026 at 09:41:06AM +0800, Jerry Lyu wrote:
> Thanks Sean for the prompt feedback!
> 

[trim]

> > 
> > Well, yeah, that's what KVM is doing, ignoring the write.  But KVM is also logging
> > that the guest attempted to write an MSR that KVM doesn't support, i.e. this is
> > more or less working as intended.
> > 
> > That said, KVM does effectively support the case where #IGGNE is not asserted, so
> > I think we can simply do this to avoid the useless logging?
> 
> Yeah, that can work for the current case. However, if another guest
> initializes the IGNNE MSR with different value meanwhile never enables
> the IGNNE emulation, kvm will again print uselsss logging. How about
> adding warning in HW_CR like below?

Did more testing and found that windows did set the
HWCR.IgnneEm (bit-8). The conditonal branch needs to be below to avoid
the warning:

+               if (data & BIT_ULL(8)) {
+                       /* ignore ignne emulation enable with a warning */
+                       if (!(vcpu->arch.cr0 & X86_CR0_NE))
+                               kvm_pr_unimpl_wrmsr(vcpu, msr, data);
+                       data &= ~(u64)0x100;
+               }

This is also not complete as it only checks the current vcpu's cr0 while
the MSR is global, and it cannot capture the case where people enable
IgnneEm before clearing CR0.NE.

I now tend to go with Sean's initial suggestion which is simple and
address the windows issue. Thanks!

Regards,
-Jerry

> 
> diff --git a/arch/x86/kvm/msrs.c b/arch/x86/kvm/msrs.c
> index c230b18d87e3..cbb743c41276 100644
> --- a/arch/x86/kvm/msrs.c
> +++ b/arch/x86/kvm/msrs.c
> @@ -1564,12 +1564,17 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
>                 u64 valid = BIT_ULL(18) | BIT_ULL(24);
>  
>                 data &= ~(u64)0x40;     /* ignore flush filter disable */
> -               data &= ~(u64)0x100;    /* ignore ignne emulation enable */
>                 data &= ~(u64)0x8;      /* ignore TLB cache disable */
>  
>                 if (guest_cpu_cap_has(vcpu, X86_FEATURE_GP_ON_USER_CPUID))
>                         valid |= MSR_K7_HWCR_CPUID_USER_DIS;
>  
> +               if (data & BIT_ULL(8)) {
> +                       /* ignore ignne emulation enable with a warning */
> +                       data &= ~(u64)0x100;
> +                       kvm_pr_unimpl_wrmsr(vcpu, msr, data);
> +               }
> +
>                 if (data & ~valid) {
>                         kvm_pr_unimpl_wrmsr(vcpu, msr, data);
>                         return 1;
> 
> Then the IGNNE write can be silently ignored no matter what value to
> write. The kvm selftest of hwcr_msr_test.c can keep unchanged. What's
> your opinion? Thanks again!
> 
> > 
> > diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> > index e755f43f4376..a7efac3241c2 100644
> > --- a/arch/x86/kvm/svm/svm.c
> > +++ b/arch/x86/kvm/svm/svm.c
> > @@ -3205,7 +3205,8 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
> >         case MSR_VM_CR:
> >                 return svm_set_vm_cr(vcpu, data);
> >         case MSR_VM_IGNNE:
> > -               kvm_pr_unimpl_wrmsr(vcpu, ecx, data);
> > +               if (data)
> > +                       kvm_pr_unimpl_wrmsr(vcpu, ecx, data);
> >                 break;
> >         case MSR_AMD64_DE_CFG: {
> >                 u64 supported_de_cfg;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] KVM: SVM: Do not warn on IGNNE MSR write
  2026-07-09  1:41   ` Jerry Lyu
  2026-07-09  7:26     ` Jerry Lyu
@ 2026-07-09 13:32     ` Sean Christopherson
  1 sibling, 0 replies; 5+ messages in thread
From: Sean Christopherson @ 2026-07-09 13:32 UTC (permalink / raw)
  To: Jerry Lyu; +Cc: pbonzini, joerg.roedel, kvm

On Thu, Jul 09, 2026, Jerry Lyu wrote:
> > That said, KVM does effectively support the case where #IGGNE is not asserted, so
> > I think we can simply do this to avoid the useless logging?
> 
> Yeah, that can work for the current case. However, if another guest
> initializes the IGNNE MSR with different value meanwhile never enables
> the IGNNE emulation, kvm will again print uselsss logging.

If you find the logging useless, just disable that class of logging entirely by
setting report_ignored_msrs=false, either when loading kvm.ko or by writing
/sys/module/kvm/parameters/report_ignored_msrs (it's writable by root even when
KVM is loaded).

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-09 13:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-08 13:41 [PATCH] KVM: SVM: Do not warn on IGNNE MSR write Jerry Lyu
2026-07-08 13:50 ` Sean Christopherson
2026-07-09  1:41   ` Jerry Lyu
2026-07-09  7:26     ` Jerry Lyu
2026-07-09 13:32     ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox