drivers/xen/hypervisor: Expose Xen SIF flags to userspace
authorPer Bilse <per.bilse@citrix.com>
Tue, 3 Jan 2023 13:02:13 +0000 (13:02 +0000)
committerJuergen Gross <jgross@suse.com>
Mon, 13 Feb 2023 05:53:19 +0000 (06:53 +0100)
commit415dab3c179632d098aadc756b39cebceb977978
tree46521e2cc2c75e7d3a9692dbe8c3a61746a703f6
parentceaa837f96adb69c0df0397937cd74991d5d821a
drivers/xen/hypervisor: Expose Xen SIF flags to userspace

/proc/xen is a legacy pseudo filesystem which predates Xen support
getting merged into Linux.  It has largely been replaced with more
normal locations for data (/sys/hypervisor/ for info, /dev/xen/ for
user devices).  We want to compile xenfs support out of the dom0 kernel.

There is one item which only exists in /proc/xen, namely
/proc/xen/capabilities with "control_d" being the signal of "you're in
the control domain".  This ultimately comes from the SIF flags provided
at VM start.

This patch exposes all SIF flags in /sys/hypervisor/start_flags/ as
boolean files, one for each bit, returning '1' if set, '0' otherwise.
Two known flags, 'privileged' and 'initdomain', are explicitly named,
and all remaining flags can be accessed via generically named files,
as suggested by Andrew Cooper.

Signed-off-by: Per Bilse <per.bilse@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/20230103130213.2129753-1-per.bilse@citrix.com
Signed-off-by: Juergen Gross <jgross@suse.com>
Documentation/ABI/stable/sysfs-hypervisor-xen
drivers/xen/sys-hypervisor.c