Page MenuHomeFreeBSD

D29597.diff
No OneTemporary

D29597.diff

Index: sys/dev/xen/console/xen_console.c
===================================================================
--- sys/dev/xen/console/xen_console.c
+++ sys/dev/xen/console/xen_console.c
@@ -55,6 +55,7 @@
#include <xen/hypervisor.h>
#include <xen/xen_intr.h>
#include <xen/interface/io/console.h>
+#include <xen/hvm.h>
#include "opt_ddb.h"
#include "opt_printf.h"
@@ -272,6 +273,14 @@
static void
xencons_early_init_ring(struct xencons_priv *cons)
{
+ /*
+ * The ring is initialized later for the HVM console as the
+ * pmap code is not yet fully initialized
+ * TODO: See if we can map the ring in another way earlier.
+ */
+ if (!xen_hvm_domain())
+ return;
+
cons->intf = pmap_mapdev_attr(ptoa(xen_get_console_mfn()), PAGE_SIZE,
VM_MEMATTR_XEN);
cons->evtchn = xen_get_console_evtchn();
@@ -282,9 +291,23 @@
{
struct xencons_priv *cons;
int err;
+ xen_pfn_t pfn;
cons = tty_softc(tp);
+ /*
+ * The information are already retrieved in
+ * xencons_early_init_ring for PV guest
+ */
+ if (xen_hvm_domain()) {
+ cons->evtchn = hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN);
+ pfn = hvm_get_parameter(HVM_PARAM_CONSOLE_PFN);
+ if (!pfn)
+ return (ENODEV);
+ cons->intf = pmap_mapdev_attr(pfn << PAGE_SHIFT, PAGE_SIZE,
+ VM_MEMATTR_XEN);
+ }
+
if (cons->evtchn == 0)
return (ENODEV);
@@ -327,6 +350,10 @@
xencons_lock_assert(cons);
+ /* The console page may have not yet been initialized for HVM domain */
+ if (__predict_false(!intf))
+ return -1;
+
wcons = intf->out_cons;
wprod = intf->out_prod;
@@ -359,6 +386,10 @@
xencons_lock_assert(cons);
+ /* The console page may have not yet been initialized for HVM domain */
+ if (__predict_false(!intf))
+ return 0;
+
rcons = intf->in_cons;
rprod = intf->in_prod;
rmb();

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 15, 2:42 AM (11 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14637271
Default Alt Text
D29597.diff (1 KB)

Event Timeline