[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 5/4] x86/hvm: Drop hvm_{get,set}_guest_bndcfgs() and use {get,set}_regs() instead
- To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Wed, 19 Jan 2022 14:50:58 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=CpC6hIhFyhNsB5EmZgPhkJi4wbmloz50+KsjrFaJzlU=; b=VKVQpxmbCjVvyv88mBSEvppl8grdpoG7ypY4OAO0VaJLQOu67+CneL2cyXnxtiG96Rt41YstXsN+QrQj9iiD8VK1m5JpJR6sjUwGHumdJ9Rc5rH59xAkNjcPDURQ8moVeenzdW85jxYdZHao/r1tI5v64AHYgVjyYFJymfeHwYkRxDBMJzn0FmYABDMLKu+aqzvartOwMmxZvngP0FwZgdrgGW8JodnpeJ/ET2tfECoi/kDISPDIEQ38DgCi0Cxykg8jf2A57uato0MRw8AqiyoHbSD88xAJKqYFCz1bgPRBHH1ERfFI6rXu5xjrkTxwpDv3Whpy/xIlemrJrGjVRA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iRWKfMzhyxrGZDJLzper9e1EB7nDPi526bI9cLTJG+VwdWFdh1spN//Arq4Aw8hzloi8ybBsU/cDNl+gN5ykknJ1AXtdy8BOuaTB6slS3exYUhBAs6RRRAXE2MWjZelQV7nXTbg0XiZWDLxkxGgXEByW3g3WMho/E6C0qWn09t+f1SInnqOy4RLSYBqPXjHdUMc3+KnycD1WavQrzcD6fRcJCfurikZGjYfNhkz5Ovxrdpu0KwPN/bdGps3em6/WwmWSsod1QcwKqx0OttwdVqVKPJIqEPFXClEhjf+b9B86YzkcxEZP0cEp0cWk9nX3HpZZVXX4O3rf1ODsjuIiww==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Jun Nakajima <jun.nakajima@xxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Wed, 19 Jan 2022 13:51:14 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 17.01.2022 20:25, Andrew Cooper wrote:
> hvm_{get,set}_guest_bndcfgs() are thin wrappers around accessing MSR_BNDCFGS.
>
> MPX was implemented on Skylake uarch CPUs and dropped in subsequent CPUs, and
> is disabled by default in Xen VMs.
>
> It would be nice to move all the logic into vmx_msr_{read,write}_intercept(),
> but the common HVM migration code uses guest_{rd,wr}msr(). Therefore, use
> {get,set}_regs() to reduce the quantity of "common" HVM code.
>
> In lieu of having hvm_set_guest_bndcfgs() split out, use some #ifdef
> CONFIG_HVM in guest_wrmsr(). In vmx_{get,set}_regs(), split the switch
> statements into two depending on whether the require remote VMCS acquisition
> or not.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
One remark:
> @@ -323,10 +324,9 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t
> *val)
> break;
>
> case MSR_IA32_BNDCFGS:
> - if ( !cp->feat.mpx || !is_hvm_domain(d) ||
> - !hvm_get_guest_bndcfgs(v, val) )
> + if ( !cp->feat.mpx ) /* Implies Intel HVM only */
Wouldn't it make sense to accompany this comment by ...
> goto gp_fault;
> - break;
ASSERT(is_hvm_domain(d));
(and then the same on the "set" path)?
Jan
|