mirror of https://gitee.com/openkylin/linux.git
xen: add sysfs node for hypervisor build id
For support of Xen hypervisor live patching the hypervisor build id is needed. Add a node /sys/hypervisor/properties/buildid containing the information. Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: Juergen Gross <jgross@suse.com>
This commit is contained in:
parent
a714c2865f
commit
84b7625728
|
@ -1,5 +1,5 @@
|
||||||
What: /sys/hypervisor/guest_type
|
What: /sys/hypervisor/guest_type
|
||||||
Date: May 2017
|
Date: June 2017
|
||||||
KernelVersion: 4.13
|
KernelVersion: 4.13
|
||||||
Contact: xen-devel@lists.xenproject.org
|
Contact: xen-devel@lists.xenproject.org
|
||||||
Description: If running under Xen:
|
Description: If running under Xen:
|
||||||
|
@ -32,3 +32,12 @@ Description: If running under Xen:
|
||||||
Describes Xen PMU features (as an integer). A set bit indicates
|
Describes Xen PMU features (as an integer). A set bit indicates
|
||||||
that the corresponding feature is enabled. See
|
that the corresponding feature is enabled. See
|
||||||
include/xen/interface/xenpmu.h for available features
|
include/xen/interface/xenpmu.h for available features
|
||||||
|
|
||||||
|
What: /sys/hypervisor/properties/buildid
|
||||||
|
Date: June 2017
|
||||||
|
KernelVersion: 4.13
|
||||||
|
Contact: xen-devel@lists.xenproject.org
|
||||||
|
Description: If running under Xen:
|
||||||
|
Build id of the hypervisor, needed for hypervisor live patching.
|
||||||
|
Might return "<denied>" in case of special security settings
|
||||||
|
in the hypervisor.
|
||||||
|
|
|
@ -356,12 +356,40 @@ static ssize_t features_show(struct hyp_sysfs_attr *attr, char *buffer)
|
||||||
|
|
||||||
HYPERVISOR_ATTR_RO(features);
|
HYPERVISOR_ATTR_RO(features);
|
||||||
|
|
||||||
|
static ssize_t buildid_show(struct hyp_sysfs_attr *attr, char *buffer)
|
||||||
|
{
|
||||||
|
ssize_t ret;
|
||||||
|
struct xen_build_id *buildid;
|
||||||
|
|
||||||
|
ret = HYPERVISOR_xen_version(XENVER_build_id, NULL);
|
||||||
|
if (ret < 0) {
|
||||||
|
if (ret == -EPERM)
|
||||||
|
ret = sprintf(buffer, "<denied>");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
buildid = kmalloc(sizeof(*buildid) + ret, GFP_KERNEL);
|
||||||
|
if (!buildid)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
buildid->len = ret;
|
||||||
|
ret = HYPERVISOR_xen_version(XENVER_build_id, buildid);
|
||||||
|
if (ret > 0)
|
||||||
|
ret = sprintf(buffer, "%s", buildid->buf);
|
||||||
|
kfree(buildid);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
HYPERVISOR_ATTR_RO(buildid);
|
||||||
|
|
||||||
static struct attribute *xen_properties_attrs[] = {
|
static struct attribute *xen_properties_attrs[] = {
|
||||||
&capabilities_attr.attr,
|
&capabilities_attr.attr,
|
||||||
&changeset_attr.attr,
|
&changeset_attr.attr,
|
||||||
&virtual_start_attr.attr,
|
&virtual_start_attr.attr,
|
||||||
&pagesize_attr.attr,
|
&pagesize_attr.attr,
|
||||||
&features_attr.attr,
|
&features_attr.attr,
|
||||||
|
&buildid_attr.attr,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue