From: Jan Beulich <jbeulich@suse.com>
To: Grygorii Strashko <grygorii_strashko@epam.com>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>,
"Alejandro Vallejo" <alejandro.garciavallejo@amd.com>,
"Jason Andryuk" <jason.andryuk@amd.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [XEN][PATCH] x86/hvm: vlapic: fix RO bits emulation in LVTx regs
Date: Fri, 26 Sep 2025 14:00:04 +0200 [thread overview]
Message-ID: <5472d09f-4bce-4aeb-b517-79348923281d@suse.com> (raw)
In-Reply-To: <c3635e2e-3d37-4b29-8ed4-304f9a17cdcf@epam.com>
On 26.09.2025 13:34, Grygorii Strashko wrote:
> On 26.09.25 13:52, Jan Beulich wrote:
>> On 26.09.2025 12:38, Grygorii Strashko wrote:
>>> On 26.09.25 11:17, Jan Beulich wrote:
>>>> On 25.09.2025 21:55, Grygorii Strashko wrote:
>>>> While looking at this, don't we have an issue with CMCI as well?
>>>
>>> I see no APIC_CMCI write emulation. only read.
>>
>> guest_wrmsr_x2apic() has
>>
>> case APIC_CMCI:
>
> it will end up calling vlapic_reg_write() which doesn't have case statement for
> APIC_CMCI - write ignored.
Which again is what I had described.
>>>> guest_{rd,wr}msr_x2apic() handle it, but vlapic_reg_write() doesn't. I.e. on
>>>> AMD we would fail to deliver #GP when the guest accesses it, while on Intel
>>>> we would lose the value written. And we also don't set its mask bit in
>>>> vlapic_do_init(). I guess I need to make a patch ...
>>>
>>> Is'n it depends on CMCI capability exposing to guest?
>>
>> Yes, that's part of what I was (effectively) saying.
>>
>>> (have no idea what's CMCI :)
>>
>> Corrected Machine Check Interrupt.
>
> Looking at:
>
> #define VLAPIC_VERSION 0x00050014
>
> which means "Max LVT Entries" = 6 (5+1)
>
> Looking at linux kernel apic.c:
> #ifdef CONFIG_X86_MCE_INTEL
> if (maxlvt >= 6) {
> v = apic_read(APIC_LVTCMCI);
> if (!(v & APIC_LVT_MASKED))
> apic_write(APIC_LVTCMCI, v | APIC_LVT_MASKED);
> }
> #endif
>
> Which means Xen never really emulated APIC_CMCI, so wouldn't it be correct to just drop APIC_CMCI?
From the SDM it's not quite clear to me whether using the LVT count is the
correct / only way to determine whether there's a CMCI LVT entry. To me
it reads more like the MCG_CAP bit is what is the basis. Perhaps based on
that we should conditionally set the LVT count to 6 (AMD) or 7 (Intel).
> Also, taking into account that it's Intel specific.
Another part of what I said I think needs correcting.
Jan
prev parent reply other threads:[~2025-09-26 12:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-25 19:55 [XEN][PATCH] x86/hvm: vlapic: fix RO bits emulation in LVTx regs Grygorii Strashko
2025-09-26 8:17 ` Jan Beulich
2025-09-26 10:38 ` Grygorii Strashko
2025-09-26 10:52 ` Jan Beulich
2025-09-26 11:12 ` Alejandro Vallejo
2025-09-26 12:28 ` Grygorii Strashko
2025-09-26 11:34 ` Grygorii Strashko
2025-09-26 12:00 ` Jan Beulich [this message]
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=5472d09f-4bce-4aeb-b517-79348923281d@suse.com \
--to=jbeulich@suse.com \
--cc=alejandro.garciavallejo@amd.com \
--cc=andrew.cooper3@citrix.com \
--cc=grygorii_strashko@epam.com \
--cc=jason.andryuk@amd.com \
--cc=roger.pau@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.