[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH for-4.17 2/2] hvm/apic: repurpose the reporting of the APIC assist options
- To: Paul Durrant <xadimgnik@xxxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Fri, 4 Nov 2022 17:01:41 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DdADsRAL26iqXpbjPknC6YkRukOhKl7sqTPpsiKisxg=; b=CVu2WNdnLhTIUAWuQAYY48Hp5yHUo49KdW1T2exNaM4Xq+f/yTTyiHTsUlMPbEEga3PdtvEnJDzW+WW9Zt/p7LyyZYuvbBDR5Xl20SWoYy7lrwynw/LlwMW4XwFad61K3Gk6pJk1+vTeQdGKF7V4/5R63q/TAzGUR81lW1IFn87UcYqAlKt5CeW4PTkUTuFIFoTrR99pd0WTv36wMhiKHLJZrU59sofEKRXBOqgeoZ+ZvARKib39p9+UPBGVTUfOOB5VwZLGyujG+TLwuRwKTO6f0Z0uKOuXIeg3kVVBL+6JDUychw0Hu1W3XRwvG74Fp8oxKCsKSFq2yjVwh9zgQQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NqqPRBp2zxx4MQwVEbh/g4Qq7Vaa1vQOS8XZjCvHPbTWl5xZT0Dbzq+10aMpM+9FdMaT90+ERbzcG5I5OT79q+1R/1ma0+kBDj3bXJ3H4PDQ5RGJHnQ/JdQMGv9NlySWexzzlLO9z96QwOjjDgSo6ZOivAjaTSiswpYe8vGG+lvOx6U0aDeWrapAUTLNy8ch7rd482t/5FkPugBHoxlG6EL7KgK6XG8Tl1861jiAqXBLBgxyf+GO93dAFva+XOapi0ALRUhICXjhedr+pq+5ytcAZa66Sw9x5RcjEO6biEP+WUEmMWrM2uoWVLfRQCEykbmFG6qQpjllJh/zT4H4Sw==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Henry.Wang@xxxxxxx, Wei Liu <wl@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jun Nakajima <jun.nakajima@xxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>
- Delivery-date: Fri, 04 Nov 2022 16:02:21 +0000
- Ironport-data: A9a23:9AUErKm+gBcIEZYoAX/FKdvo5gx9J0RdPkR7XQ2eYbSJt1+Wr1Gzt xJKXmmGP/3bMWamL4tya4uxoUIG7ZaByNRiGgU9qiFgFiMWpZLJC+rCIxarNUt+DCFhoGFPt JxCN4aafKjYaleG+39B55C49SEUOZmgH+a6U6icf3grHmeIcQ954Tp7gek1n4V0ttawBgKJq LvartbWfVSowFaYCEpNg064gE4p7aqaVA8w5ARkP6kS5AOGzRH5MbpETU2PByqgKmVrNrbSq 9brlNmR4m7f9hExPdKp+p6TnpoiG+O60aCm0xK6aoD66vRwjnVaPpUTbZLwXXx/mTSR9+2d/ f0W3XCGpaXFCYWX8AgVe0Ew/yiTpsSq8pefSZS0mZT7I0Er7xIAahihZa07FdRwxwp5PY1B3 fElOisKSy+nu9i/2LilZtVqoNYnK/C+aevzulk4pd3YJdAPZMiZBo/svJpf1jp2gd1SF/HDY cZfcSBocBnLfxxIPBEQFY46m+CrwHL4dlW0qnrM/fZxvzeVkVU3jOWF3Nn9I7RmQe1PmUmVv CTe9nnRCRAGLt2PjzGC9xpAg8efwX2iBdpJT9VU8NZ2oR7N2VwDSyRPFkmcuOnnqEWPdfN2f hl8Fi0G6PJaGFaQZsn0Uxy9r3iFvTYTXtNRF6sx7wTl4rrZ5UOVC3YJShZFacc6r4kmSDoyz FiLktj1Qzt1v9W9aX+b7KbSkjq0NgAcN2pEbigBJSMa5/HzrYd1iQjAJv5hGqOoitz+GRnr3 iuH6iM5gt07j9MNkaOy/lnFgjeljpnPUgMxoA7QWwqN7Q5nZYjje42h73Da6+pNKMCSSVzpg ZQfs82X7eRLB5fUkiWIGLoJBOvxu6vDNyDAi1lyGZVn7y6q53OoYYFX5nd5OVttNcEHPzTuZ Sc/pD9s2XOaB1PyBYcfXm57I517pUQ8PbwJjszpU+c=
- Ironport-hdrordr: A9a23:aqN4F6MTA3Ov38BcT1P155DYdb4zR+YMi2TDiHoddfUFSKalfp 6V98jztSWatN/eYgBEpTmlAtj5fZq6z+8P3WBxB8baYOCCggeVxe5ZjbcKrweQeBEWs9Qtr5 uIEJIOd+EYb2IK6voSiTPQe7hA/DDEytHPuQ639QYQcegAUdAF0+4WMHf4LqUgLzM2eKbRWa Dsr/au4FGbCAcqR/X+IkNAc/nIptXNmp6jSRkaByQ/4A3LqT+z8rb1HzWRwx9bClp0sPwf2F mAtza8yrSosvm9xBOZ/2jP765OkN+k7tdYHsSDhuUcNz2poAe1Y4ZKXaGEoVkO0amSwWdvtO OJjwYrPsx15X+UVmapoSH10w2l6zoq42+K8y7tvVLT5ejCAB4qActIgoxUNjHD7VA7gd162K VXm0qEqpt+F3r77WvAzumNcysvulu/oHIkn+JWpWdYS5EiZLhYqpFa1F9JEa0HADnx5OkcYa VT5fnnlbdrmG6hHjDkVjEF+q3uYp1zJGbKfqE6gL3a79AM90oJjXfxx6Qk7wI9HdwGOtx5Dt //Q9RVfYF1P7ErhJ1GdZY8qOuMexvwqEH3QRSvCGWiMp07EFTwjLOyyIkJxYiRCe41Jd0J6d 78bG8=
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Fri, Nov 04, 2022 at 03:55:54PM +0000, Paul Durrant wrote:
> On 04/11/2022 14:22, Roger Pau Monne wrote:
> > The current reporting of the hardware assisted APIC options is done by
> > checking "virtualize APIC accesses" which is not very helpful, as that
> > feature doesn't avoid a vmexit, instead it does provide some help in
> > order to detect APIC MMIO accesses in vmexit processing.
> >
> > Repurpose the current reporting of xAPIC assistance to instead report
> > such feature as present when there's support for "TPR shadow" and
> > "APIC register virtualization" because in that case some xAPIC MMIO
> > register accesses are handled directly by the hardware, without
> > requiring a vmexit.
> >
> > For symetry also change assisted x2APIC reporting to require
> > "virtualize x2APIC mode" and "APIC register virtualization", dropping
> > the option to also be reported when "virtual interrupt delivery" is
> > available. Presence of the "virtual interrupt delivery" feature will
> > be reported using a different option.
> >
> > Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> > ---
> > I find the logic in vmx_vlapic_msr_changed() hard to follow, but I
> > don't want to rewrite the function logic at this point.
> > ---
> > xen/arch/x86/hvm/viridian/viridian.c | 2 +-
> > xen/arch/x86/hvm/vmx/vmcs.c | 8 ++++----
> > xen/arch/x86/hvm/vmx/vmx.c | 25 ++++++++++++++++++-------
> > xen/arch/x86/traps.c | 4 +---
> > 4 files changed, 24 insertions(+), 15 deletions(-)
> >
> > diff --git a/xen/arch/x86/hvm/viridian/viridian.c
> > b/xen/arch/x86/hvm/viridian/viridian.c
> > index c4fa0a8b32..bafd8e90de 100644
> > --- a/xen/arch/x86/hvm/viridian/viridian.c
> > +++ b/xen/arch/x86/hvm/viridian/viridian.c
> > @@ -201,7 +201,7 @@ void cpuid_viridian_leaves(const struct vcpu *v,
> > uint32_t leaf,
> > * Suggest x2APIC mode by default, unless xAPIC registers are
> > hardware
> > * virtualized and x2APIC ones aren't.
> > */
> > - if ( !cpu_has_vmx_apic_reg_virt ||
> > cpu_has_vmx_virtualize_x2apic_mode )
> > + if ( !has_assisted_xapic(d) || has_assisted_x2apic(d) )
>
> So, not sure why this is separated from patch 1 but stated this way it seems
> counterintuitive. We only want to use the viridian MSRs if they are going to
> be more efficient.. which I think is only in the case where we have neither
> an x2apic not an assisted xapic (hence we would trap for MMIO).
I've read the MS HTLFS and I guess I got confused, the section about
this CPUID bit states:
"Bit 3: Recommend using MSRs for accessing APIC registers EOI, ICR and
TPR rather than their memory-mapped"
So I've (wrongly) understood that MSRs for accessing APIC registers
was meant to be a recommendation to use x2APIC mode in order to access
those registers. Didn't realize Viridian had a way to expose certain
APIC registers using MSRs when the APIC is in xAPIC mode.
I withdraw patch 1 and adjust patch 2 accordingly then.
Thanks, Roger.
|