[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 13/21] libs/guest: allow updating a cpu policy MSR data
- To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
- Date: Tue, 13 Apr 2021 16:01:31 +0200
- 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-SenderADCheck; bh=4zjRbsyq+DaWv6wnjrp/39MtyMLtRSSqzlhDBppNwHA=; b=dVwroCq1zzWGRtUBiZ+QSTsOACxThy4KsBpY5gobjrF5kOuf+n2c0JerA0+HwBQibTF0c3BifHaZUM2pdv8qdjIRrOVRwrVjRgvVwk0I4Ie1LGyckuE/8Dx3eMLWVG4q2QeESg/PZYHMR89hF5KUqznM8UIBRPgUJJsxbck2Y3ckjkvy2cU4NPaszXMqMqCC6k5cT0rxI1D1/rpXGs4k8nwzFt98VgYAOL6+RZE7qvhTBt/MRtN+sRRAbIxKMlVFsekx7bpY4hDHDE4ZyNEIGlH1dzTP4vP6+x8zRAkyS0EXXNu1oNRmBTs6HOUoa+5/goyvytiDWEoobMBxALWjnQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZwVANm0qhv5f/T6gaMK7OXEZyxJVMIQrbyFB3AFurCCogxs0xoGNxk65NVG5I2jDuKckeGKJYwl9rwTAN4xT0xjSrswH6ncNjWYGJ6e4bgL/0K92oNlTvxOoxWiZQCQh1+MZQ5uwhpc5gTVDzOzoDMBmp2Q9K+XjwVj8hqRAqJ+B8UkWbTm0zIQVg0kSm3WN83w63Lvqozpn8WEraruWwzJl5AYHi83wdbKE+dhdAsTlH5BHiYyAcjGBU4OYhGltaGNSed9DOIJXF95o39dQ2wLFMaDccFwOUSf6qP0RXKgEPu/K+fZPWMhxIjv1XpFE8gqLkgMKbwJyLmxV9WKOkQ==
- Authentication-results: esa6.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
- Delivery-date: Tue, 13 Apr 2021 14:03:15 +0000
- Ironport-hdrordr: A9a23:muOtX6sSYC+vRwxdcLCfb3YS7skCrIMji2hD6mlwRA09T+Wxi9 2ukPMH1RX9lTYWXzUalcqdPbSbKEmwybde544NMbC+GDT3oWfAFvAG0aLO4R3FXxf/+OlUyL t6f8FFYuHYIFBmga/BjzWQPM0nxLC8npyAocf74zNTQRpxa6dmhj0JaDqzNkFtXgFJCd4YOf OnhvZvnDardXQJYsnTPBBsM9TrnNHXiIngJScPGh9P0mKzpAm14733GQXw5GZ8bxpzx94ZkF TtokjCyYiI99q6zRLd0GG71eUtpPLRjuFtKebJpswcKjDHghulaoJ7S9S5zU0IidDq0nkGup 3hpAohItRS5hrqDx2IiCqo4SbM+nIP7GLv0lCRi3eLm72HeBsKT/BvqKgcVzmx0TtFgPhMlJ hl8kjcir9sSTTHpyj578igbWATqmOE5UAMvMRWs2ZSSuIlGdhshL1axmx5OrEaEhn37Yg2ed Med/301bJtfVSWY2uxhBgI/PWcGnA6HhKxSkMfoMCi0z9PgHBjz0cDrfZv50s9yA==
- Ironport-sdr: UvUOwl0n7404jnOeNInaf0XiQm+TDLJgyj1L8gyDMXm7gqmpkGJXB1DFE8eEr/Ow33Vzk131SN UEuZMtb8lMHd+2Hhy1Mhy4Q6F2ChXyZsHTq6Zy2chFtMWAWrpr5PS9IoiV+1udualNRPrfHjH4 6Z1t6052sy0bl3lRJQUoRlylWW/vQYcw33FRaiafF5x2xko1PsHBJDD30ySSVHtm/KNYNRTC9/ gUfsloqv/NLx0z0qJm1iXaAgNkuYzjg6szm2WAqwe+GZLkbm7N0iE4H8ieCJL7XvDyF6vcZAcv kqE=
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Introduce a helper to update the MSR policy using an array of
xen_msr_entry_t entries. Note the MSRs present in the input
xen_msr_entry_t array will replace any existing entries on the
policy.
No user of the interface introduced on this patch.
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Changes since v1:
- Drop logic to update entries manually.
- Only print failure message if err_msr != -1.
---
tools/include/xenctrl.h | 2 ++
tools/libs/guest/xg_cpuid_x86.c | 18 ++++++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 49f919f16a7..9a6d1b126d8 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2616,6 +2616,8 @@ int xc_cpu_policy_get_msr(xc_interface *xch, const
xc_cpu_policy_t policy,
int xc_cpu_policy_update_cpuid(xc_interface *xch, xc_cpu_policy_t policy,
const xen_cpuid_leaf_t *leaves,
uint32_t nr);
+int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t policy,
+ const xen_msr_entry_t *msrs, uint32_t nr);
int xc_get_cpu_levelling_caps(xc_interface *xch, uint32_t *caps);
int xc_get_cpu_featureset(xc_interface *xch, uint32_t index,
diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 00595e14cc3..26b09322dfa 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -907,3 +907,21 @@ int xc_cpu_policy_update_cpuid(xc_interface *xch,
xc_cpu_policy_t policy,
return rc;
}
+
+int xc_cpu_policy_update_msrs(xc_interface *xch, xc_cpu_policy_t policy,
+ const xen_msr_entry_t *msrs, uint32_t nr)
+{
+ unsigned int err_msr = -1;
+ int rc = x86_msr_copy_from_buffer(&policy->msr, msrs, nr, &err_msr);
+
+ if ( rc )
+ {
+ if ( err_msr != -1 )
+ ERROR("Failed to deserialise MSRS (err index %#x) (%d = %s)",
+ err_msr, -rc, strerror(-rc));
+ errno = -rc;
+ rc = -1;
+ }
+
+ return rc;
+}
--
2.30.1
|