On 01/22/2017 02:30 PM, Nadav Har'El wrote:
Looks reasonable.
But there is something I don't understand - why do you call this in the commit message an
"early console"? What is supposed to happen later - will you have an ISA serial
port, or VGA, or something else? What prevents you from using that
thing also early? (e.g., in x64, for the "early console" we use
console::isa_serial_console::early_init()).
Currently it uses HYPERVISOR_console_io hypercall just to let the world know
the kernel it alive.
This hypercall should not be used by Xen guests in normal case (hypervisor will
only print message from guest if built in debug mode), but use shared ring of
requests/replies to communicate with console PV back-end.
However we can't allocate ring early during boot, only after fpranges are
initialized. So the idea is to use
HYPERVISOR_console_io for early debugging purposes, and switch over to
full-blown console front-end later -- when page allocator is ready. I'm gonna
implement that as well.
--
regards,
Sergiy
--
Nadav Har'El
[email protected] <mailto:[email protected]>
On Fri, Jan 20, 2017 at 1:04 PM, 'Sergiy Kibrik' via OSv Development
<[email protected] <mailto:[email protected]>> wrote:
Primitive driver that uses HYPERVISOR_console_io hypercall to provide early
console.
Signed-off-by: Sergiy Kibrik <[email protected]
<mailto:[email protected]>>
---
drivers/xenconsole.cc | 36 ++++++++++++++++++++++++++++++++++++
drivers/xenconsole.hh | 31 +++++++++++++++++++++++++++++++
2 files changed, 67 insertions(+)
create mode 100644 drivers/xenconsole.cc
create mode 100644 drivers/xenconsole.hh
diff --git a/drivers/xenconsole.cc b/drivers/xenconsole.cc
new file mode 100644
index 0000000..fe7c5bf
--- /dev/null
+++ b/drivers/xenconsole.cc
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2017 Sergiy Kibrik <[email protected]
<mailto:[email protected]>>
+ *
+ * This work is open source software, licensed under the terms of the
+ * BSD license as described in the LICENSE file in the top-level directory.
+ */
+
+#include <bsd/porting/netport.h> /* __dead2 defined here */
+#include <xen/hypervisor.h>
+
+#include "xenconsole.hh"
+
+namespace console {
+
+void XEN_Console::write(const char *str, size_t len) {
+ HYPERVISOR_console_write(str, len);
+}
+
+void XEN_Console::dev_start()
+{
+}
+
+void XEN_Console::flush()
+{
+}
+
+bool XEN_Console::input_ready()
+{
+ return false; /*TODO: support input */
+}
+
+char XEN_Console::readch() {
+ return '\0'; /*TODO: support input */
+}
+
+}
diff --git a/drivers/xenconsole.hh b/drivers/xenconsole.hh
new file mode 100644
index 0000000..ec43893
--- /dev/null
+++ b/drivers/xenconsole.hh
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2017 Sergiy Kibrik <[email protected]
<mailto:[email protected]>>
+ *
+ * This work is open source software, licensed under the terms of the
+ * BSD license as described in the LICENSE file in the top-level directory.
+ */
+
+#ifndef XEN_CONSOLE_HH
+#define XEN_CONSOLE_HH
+
+#include "console-driver.hh"
+#include "exceptions.hh"
+#include <osv/interrupt.hh>
+
+namespace console {
+
+class XEN_Console : public console_driver {
+public:
+ virtual void write(const char *str, size_t len);
+ virtual void flush();
+ virtual bool input_ready();
+ virtual char readch();
+
+private:
+ virtual void dev_start();
+ virtual const char *thread_name() { return "xen-input"; }
+};
+
+}
+
+#endif /* XEN_CONSOLE_HH */
--
2.7.4
--
You received this message because you are subscribed to the Google Groups "OSv
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected]
<mailto:osv-dev%[email protected]>.
For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google Groups "OSv
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.