From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
Paolo Bonzini <pbonzini@redhat.com>,
Wanpeng Li <wanpeng.li@hotmail.com>
Subject: Re: [PATCH] KVM: LAPIC: Level-sensitive interrupts are not support for LINT1
Date: Fri, 13 Oct 2017 22:43:02 +0200 [thread overview]
Message-ID: <20171013204301.GB30745@flask> (raw)
In-Reply-To: <1507868873-6756-1-git-send-email-wanpeng.li@hotmail.com>
2017-10-12 21:27-0700, Wanpeng Li:
> From: Wanpeng Li <wanpeng.li@hotmail.com>
>
> SDM 10.5.1 mentioned:
> Software should always set the trigger mode in the LVT LINT1 register to 0 (edge
> sensitive). Level-sensitive interrupts are not supported from LINT1.
>
> I can intercept both Linux/windows 7/windows 2016 guests on my hand will set
> Level-sensitive trigger mode to LVT LINT1 register during boot.
And there is no problem with that, software can do that, delivery
through LINT1 is just undefined with that (most likely behaviors are:
deliver as edge and don't deliver.).
> This patch avoids the software too fool to set the level-sensitive trigger mode
> to LVT LINT1 register.
The software should see the value it writes, though, so the current
behavior is better.
Do we hit a KVM bug if the software uses APIC_LVT_LEVEL_TRIGGER?
Thanks.
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Radim Krčmář <rkrcmar@redhat.com>
> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
> ---
> arch/x86/kvm/lapic.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index a778f1a..26593c7 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -1758,6 +1758,8 @@ int kvm_lapic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val)
> val |= APIC_LVT_MASKED;
>
> val &= apic_lvt_mask[(reg - APIC_LVTT) >> 4];
> + if (reg == APIC_LVT1)
> + val &= ~APIC_LVT_LEVEL_TRIGGER;
> kvm_lapic_set_reg(apic, reg, val);
>
> break;
> --
> 2.7.4
>
next prev parent reply other threads:[~2017-10-13 20:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-13 4:27 [PATCH] KVM: LAPIC: Level-sensitive interrupts are not support for LINT1 Wanpeng Li
2017-10-13 20:43 ` Radim Krčmář [this message]
2017-10-15 2:14 ` Wanpeng Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171013204301.GB30745@flask \
--to=rkrcmar@redhat.com \
--cc=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=wanpeng.li@hotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox