Skip to contentSkip to conversation

drivers/xen/hypervisor: Expose Xen SIF flags to userspace

PATCH Applied Per Bilse 3 participants 4 messages Jan 3, 2023 – Feb 13, 2023 Xen hypervisor interface

lore
Share & tools
lore

Per Bilse

author
#0 lore raw

PATCH v3 1/1 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.

---
v2: minor fix to layout, incorporate suggestions from Juergen Gross
v3: update assumed availability in documentation

---
 Documentation/ABI/stable/sysfs-hypervisor-xen | 13 ++++
 drivers/xen/sys-hypervisor.c                  | 69 +++++++++++++++++--
 2 files changed, 78 insertions(+), 4 deletions(-)
Documentation/ABI/stable/sysfs-hypervisor-xen +13 -0
index 748593c64568..be9ca9981bb1 100644
@@ -120,3 +120,16 @@ Contact:	[email protected]
 Description:	If running under Xen:
 		The Xen version is in the format <major>.<minor><extra>
 		This is the <minor> part of it.
+
+What:		/sys/hypervisor/start_flags/*
+Date:		March 2023
+KernelVersion:	6.3.0
+Contact:	[email protected]
+Description:	If running under Xen:
+		All bits in Xen's start-flags are represented as
+		boolean files, returning '1' if set, '0' otherwise.
+		This takes the place of the defunct /proc/xen/capabilities,
+		which would contain "control_d" on dom0, and be empty
+		otherwise.  This flag is now exposed as "initdomain" in
+		addition to the "privileged" flag; all other possible flags
+		are accessible as "unknownXX".
drivers/xen/sys-hypervisor.c +65 -4

96 lines not on this page · raw message

Signature · 1 line
2.31.1
maintainer Reviewed-by on v3 1/1
#1 lore raw
Quoted 10 lines · Per Bilse

/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.

Quoted 7 lines

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.

Juergen

merge bot Applied
#2 lore raw
In reply to Per Bilse
The following commit has been merged into the objtool/core branch of tip:

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     859761e770f8c88eea2ae6ae379798b432728cd6
Gitweb:        https://git.kernel.org/tip/859761e770f8c88eea2ae6ae379798b432728cd6
Author:        Per Bilse <[email protected]>
AuthorDate:    Tue, 03 Jan 2023 13:02:13 
Committer:     Juergen Gross <[email protected]>
CommitterDate: Tue, 17 Jan 2023 08:47:05 +01:00

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.

---
 Documentation/ABI/stable/sysfs-hypervisor-xen | 13 +++-
 drivers/xen/sys-hypervisor.c                  | 69 ++++++++++++++++--
 2 files changed, 78 insertions(+), 4 deletions(-)
Documentation/ABI/stable/sysfs-hypervisor-xen +13 -0
index 748593c..be9ca99 100644
@@ -120,3 +120,16 @@ Contact:	[email protected]
 Description:	If running under Xen:
 		The Xen version is in the format <major>.<minor><extra>
 		This is the <minor> part of it.
+
+What:		/sys/hypervisor/start_flags/*
+Date:		March 2023
+KernelVersion:	6.3.0
+Contact:	[email protected]
+Description:	If running under Xen:
+		All bits in Xen's start-flags are represented as
+		boolean files, returning '1' if set, '0' otherwise.
+		This takes the place of the defunct /proc/xen/capabilities,
+		which would contain "control_d" on dom0, and be empty
+		otherwise.  This flag is now exposed as "initdomain" in
+		addition to the "privileged" flag; all other possible flags
+		are accessible as "unknownXX".
drivers/xen/sys-hypervisor.c +65 -4

96 lines not on this page · raw message

maintainer Applied
#3 lore raw
In reply to Per Bilse
Quoted 10 lines · Per Bilse

/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.

Quoted 7 lines

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.

Pushed to xen/tip.got for-linus-6.3

Juergen