Page MenuHomeFreeBSD

D29874.diff
No OneTemporary

D29874.diff

Index: sys/arm64/arm64/machdep.c
===================================================================
--- sys/arm64/arm64/machdep.c
+++ sys/arm64/arm64/machdep.c
@@ -105,6 +105,16 @@
enum arm64_bus arm64_bus_method = ARM64_BUS_NONE;
+#ifdef XENHVM
+#include <xen/xen-os.h>
+#include <xen/features.h>
+
+static start_info_t _xen_start_info;
+start_info_t *HYPERVISOR_start_info = &_xen_start_info;
+
+enum xen_domain_type xen_domain_type = XEN_NATIVE;
+#endif
+
struct pcpu __pcpu[MAXCPU];
static struct trapframe proc0_tf;
@@ -1235,6 +1245,31 @@
return (VM_MEMATTR_DEVICE);
}
+#ifdef XENHVM
+static void
+xen_early_init(void)
+{
+ phandle_t root;
+
+ if ((root = OF_finddevice("/")) == 0)
+ return;
+ /*
+ * The device tree contains a node with the compatible string "xen,xen"
+ * when the OS will run on top of Xen.
+ */
+ if (fdt_depth_search_compatible(root, "xen,xen", 0) == 0)
+ return;
+
+ xen_domain_type = XEN_HVM_DOMAIN;
+ setup_xen_features();
+
+ if (xen_feature(XENFEAT_dom0))
+ HYPERVISOR_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED;
+ else
+ HYPERVISOR_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
+}
+#endif
+
void
initarm(struct arm64_bootparams *abp)
{
@@ -1267,6 +1302,14 @@
link_elf_ireloc(kmdp);
try_load_dtb(kmdp);
+#ifdef XENHVM
+ /*
+ * We need to know early if FreeBSD is running on top of Xen.
+ * Therefore we can get an early console working
+ */
+ xen_early_init();
+#endif
+
efi_systbl_phys = MD_FETCH(kmdp, MODINFOMD_FW_HANDLE, vm_paddr_t);
/* Load the physical memory ranges */

File Metadata

Mime Type
text/plain
Expires
Tue, May 19, 8:19 AM (15 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33288524
Default Alt Text
D29874.diff (1 KB)

Event Timeline