git: 69c6eee7567b - main - xen: introduce xen_pv_disks_disabled()

Roger Pau Monné royger at FreeBSD.org
Wed Jul 28 15:27:59 UTC 2021


The branch main has been updated by royger:

URL: https://cgit.FreeBSD.org/src/commit/?id=69c6eee7567ba17c9575c4bcc3bb9eb2666dd290

commit 69c6eee7567ba17c9575c4bcc3bb9eb2666dd290
Author:     Julien Grall <julien at xen.org>
AuthorDate: 2015-10-16 18:18:21 +0000
Commit:     Roger Pau Monné <royger at FreeBSD.org>
CommitDate: 2021-07-28 15:27:04 +0000

    xen: introduce xen_pv_disks_disabled()
    
    ARM guest is considered as HVM in Freebsd but they only support PV disk
    (no emulation available).
    
    Submitted by: Elliott Mitchell <ehem+freebsd at m5p.com>
    Reviewed by: royger
    Differential Revision: https://reviews.freebsd.org/D29403
---
 sys/dev/xen/blkfront/blkfront.c |  2 +-
 sys/x86/include/xen/xen-os.h    | 10 ++++++++++
 sys/xen/xen-os.h                |  2 --
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/sys/dev/xen/blkfront/blkfront.c b/sys/dev/xen/blkfront/blkfront.c
index 847644ca1e67..7078cb16caa1 100644
--- a/sys/dev/xen/blkfront/blkfront.c
+++ b/sys/dev/xen/blkfront/blkfront.c
@@ -1439,7 +1439,7 @@ xbd_probe(device_t dev)
 	if (strcmp(xenbus_get_type(dev), "vbd") != 0)
 		return (ENXIO);
 
-	if (xen_hvm_domain() && xen_disable_pv_disks != 0)
+	if (xen_pv_disks_disabled())
 		return (ENXIO);
 
 	if (xen_hvm_domain()) {
diff --git a/sys/x86/include/xen/xen-os.h b/sys/x86/include/xen/xen-os.h
index a6766190bfc2..37463a8b069c 100644
--- a/sys/x86/include/xen/xen-os.h
+++ b/sys/x86/include/xen/xen-os.h
@@ -43,9 +43,19 @@
 /* If non-zero, the hypervisor has been configured to use a direct vector */
 extern int xen_vector_callback_enabled;
 
+/* tunable for disabling PV disks */
+extern int xen_disable_pv_disks;
+
 /* tunable for disabling PV nics */
 extern int xen_disable_pv_nics;
 
+static inline bool
+xen_pv_disks_disabled(void)
+{
+
+	return (xen_hvm_domain() && xen_disable_pv_disks != 0);
+}
+
 static inline bool
 xen_pv_nics_disabled(void)
 {
diff --git a/sys/xen/xen-os.h b/sys/xen/xen-os.h
index 6817e96c10fc..988da24dc878 100644
--- a/sys/xen/xen-os.h
+++ b/sys/xen/xen-os.h
@@ -74,8 +74,6 @@ xen_get_console_evtchn(void)
 
 extern shared_info_t *HYPERVISOR_shared_info;
 
-extern int xen_disable_pv_disks;
-
 extern bool xen_suspend_cancelled;
 
 enum xen_domain_type {


More information about the dev-commits-src-all mailing list