|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] libs/guest: introduce helper to fetch a domain cpu policy
commit c79d253226de3466cbc41401014d9a35507bff33
Author: Roger Pau Monne <roger.pau@xxxxxxxxxx>
AuthorDate: Wed Mar 17 14:46:11 2021 +0100
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Thu Apr 29 19:27:21 2021 +0100
libs/guest: introduce helper to fetch a domain cpu policy
Such helper is based on the existing functions to fetch a CPUID and
MSR policies, but uses the xc_cpu_policy_t type to return the data to
the caller.
No user of the interface introduced on the patch.
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
tools/include/xenctrl.h | 2 ++
tools/libs/guest/xg_cpuid_x86.c | 25 +++++++++++++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 187df5c5d2..34d979d11d 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2599,6 +2599,8 @@ void xc_cpu_policy_destroy(xc_cpu_policy_t policy);
/* Retrieve a system policy, or get/set a domains policy. */
int xc_cpu_policy_get_system(xc_interface *xch, unsigned int policy_idx,
xc_cpu_policy_t policy);
+int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
+ xc_cpu_policy_t policy);
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 dad560fb40..2cbc4b550f 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -737,3 +737,28 @@ int xc_cpu_policy_get_system(xc_interface *xch, unsigned
int policy_idx,
return rc;
}
+
+int xc_cpu_policy_get_domain(xc_interface *xch, uint32_t domid,
+ xc_cpu_policy_t policy)
+{
+ unsigned int nr_leaves = ARRAY_SIZE(policy->leaves);
+ unsigned int nr_entries = ARRAY_SIZE(policy->entries);
+ int rc;
+
+ rc = xc_get_domain_cpu_policy(xch, domid, &nr_leaves, policy->leaves,
+ &nr_entries, policy->entries);
+ if ( rc )
+ {
+ PERROR("Failed to obtain domain %u policy", domid);
+ return rc;
+ }
+
+ rc = deserialize_policy(xch, policy, nr_leaves, nr_entries);
+ if ( rc )
+ {
+ errno = -rc;
+ rc = -1;
+ }
+
+ return rc;
+}
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |