Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Update to new Xen core platform stack #85

Merged
merged 2 commits into from
Oct 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ env:
- PINS="mirage-console:. mirage-console-xen:. mirage-console-unix:. mirage-console-xen-proto:. mirage-console-xen-backend:."
- DISTRO=alpine
matrix:
- OCAML_VERSION=4.06 PACKAGE="mirage-console"
- OCAML_VERSION=4.07 PACKAGE="mirage-console-xen-proto"
- OCAML_VERSION=4.07 PACKAGE="mirage-console-xen-backend"
- OCAML_VERSION=4.08 PACKAGE="mirage-console-xen"
- OCAML_VERSION=4.09 PACKAGE="mirage-console-unix"
- OCAML_VERSION=4.10 PACKAGE="mirage-console-unix"
- OCAML_VERSION=4.10 PACKAGE="mirage-console-xen"
- OCAML_VERSION=4.09 PACKAGE="mirage-console-xen-proto"
- OCAML_VERSION=4.09 PACKAGE="mirage-console-xen-backend"
- OCAML_VERSION=4.08 PACKAGE="mirage-console"
2 changes: 1 addition & 1 deletion mirage-console-unix.opam
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ homepage: "https://github.com/mirage/mirage-console"
doc: "https://mirage.github.io/mirage-console/"
bug-reports: "https://github.com/mirage/mirage-console/issues"
depends: [
"ocaml" {>= "4.06.0"}
"ocaml" {>= "4.08.0"}
"dune" {>= "1.0"}
"lwt" {>= "4.0.0"}
"cstruct" {>= "4.0.0"}
Expand Down
7 changes: 3 additions & 4 deletions mirage-console-xen-backend.opam
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ homepage: "https://github.com/mirage/mirage-console"
doc: "https://mirage.github.io/mirage-console/"
bug-reports: "https://github.com/mirage/mirage-console/issues"
depends: [
"ocaml" {>= "4.06.0"}
"ocaml" {>= "4.08.0"}
"dune" {>= "1.0"}
"mirage-console" {=version}
"mirage-console-xen-proto" {=version}
"mirage-xen" {>= "5.0.0"}
"mirage-xen" {>= "6.0.0"}
"io-page" {>= "2.0.0"}
"lwt" {>= "4.0.0"}
"io-page-xen" {>= "2.0.0"}
"xenstore"
"xen-evtchn"
"shared-memory-ring-lwt"
]
build: [
Expand Down
2 changes: 1 addition & 1 deletion mirage-console-xen-proto.opam
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ homepage: "https://github.com/mirage/mirage-console"
doc: "https://mirage.github.io/mirage-console/"
bug-reports: "https://github.com/mirage/mirage-console/issues"
depends: [
"ocaml" {>= "4.06.0"}
"ocaml" {>= "4.08.0"}
"dune" {>= "1.0"}
"mirage-console" {= version}
"rresult"
Expand Down
7 changes: 3 additions & 4 deletions mirage-console-xen.opam
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ homepage: "https://github.com/mirage/mirage-console"
doc: "https://mirage.github.io/mirage-console/"
bug-reports: "https://github.com/mirage/mirage-console/issues"
depends: [
"ocaml" {>= "4.06.0"}
"ocaml" {>= "4.08.0"}
"dune" {>= "1.0"}
"io-page" {>= "2.0.0"}
"mirage-console" {=version}
"mirage-console-xen-proto" {=version}
"xen-evtchn"
"io-page-xen"
"mirage-xen" {>= "5.0.0"}
"mirage-xen" {>= "6.0.0"}
]
build: [
["dune" "subst"] {pinned}
Expand Down
2 changes: 1 addition & 1 deletion mirage-console.opam
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ homepage: "https://github.com/mirage/mirage-console"
doc: "https://mirage.github.io/mirage-console/"
bug-reports: "https://github.com/mirage/mirage-console/issues"
depends: [
"ocaml" {>= "4.06.0"}
"ocaml" {>= "4.08.0"}
"dune" {>= "1.0"}
"mirage-device" {>= "2.0.0"}
"mirage-flow" {>= "2.0.0"}
Expand Down
14 changes: 7 additions & 7 deletions xen/backend/conback.ml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module type ACTIVATIONS = sig
val program_start: event
(** represents an event which 'fired' when the program started *)

val after: Eventchn.t -> event -> event Lwt.t
val after: OS.Eventchn.t -> event -> event Lwt.t
(** [next channel event] blocks until the system receives an event
newer than [event] on channel [channel]. If an event is received
while we aren't looking then this will be remembered and the
Expand All @@ -46,8 +46,8 @@ type stats = {

type t = {
domid: int;
xe: Eventchn.handle;
evtchn: Eventchn.t;
xe: OS.Eventchn.handle;
evtchn: OS.Eventchn.t;
ring: Cstruct.t;
}

Expand Down Expand Up @@ -80,7 +80,7 @@ module Make(A: ACTIVATIONS)(X: Xs_client_lwt.S)(C: CONSOLE) = struct
stats.total_read <- stats.total_read + n;
let seq = Int32.(add seq (of_int n)) in
Console_ring.Ring.Front.Reader.advance t.ring seq;
Eventchn.notify t.xe t.evtchn;
OS.Eventchn.notify t.xe t.evtchn;
A.after t.evtchn after >>= fun next ->
read_the_ring next in

Expand All @@ -100,7 +100,7 @@ module Make(A: ACTIVATIONS)(X: Xs_client_lwt.S)(C: CONSOLE) = struct
Cstruct.blit buffer 0 avail 0 n;
let seq = Int32.(add seq (of_int n)) in
Console_ring.Ring.Back.Writer.advance t.ring seq;
Eventchn.notify t.xe t.evtchn;
OS.Eventchn.notify t.xe t.evtchn;
loop after (Cstruct.shift buffer n)
end
end in
Expand All @@ -113,7 +113,7 @@ module Make(A: ACTIVATIONS)(X: Xs_client_lwt.S)(C: CONSOLE) = struct

let init xe domid ring_info c =
let evtchn =
Eventchn.bind_interdomain xe domid ring_info.RingInfo.event_channel
OS.Eventchn.bind_interdomain xe domid ring_info.RingInfo.event_channel
in
let grant =
{ OS.Xen.Import.domid = domid; ref = OS.Xen.Gntref.of_int32 ring_info.RingInfo.ref }
Expand Down Expand Up @@ -197,7 +197,7 @@ module Make(A: ACTIVATIONS)(X: Xs_client_lwt.S)(C: CONSOLE) = struct

let run (id: string) backend_name (domid,devid) =
make () >>= fun client ->
let xe = Eventchn.init () in
let xe = OS.Eventchn.init () in

C.connect id >>= fun t ->
mk_backend_path client backend_name (domid,devid) >>= fun backend_path ->
Expand Down
2 changes: 1 addition & 1 deletion xen/backend/conback.mli
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module type ACTIVATIONS = sig
val program_start: event
(** represents an event which 'fired' when the program started *)

val after: Eventchn.t -> event -> event Lwt.t
val after: OS.Eventchn.t -> event -> event Lwt.t
(** [next channel event] blocks until the system receives an event
newer than [event] on channel [channel]. If an event is received
while we aren't looking then this will be remembered and the
Expand Down
5 changes: 2 additions & 3 deletions xen/backend/dune
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(library
(name mirage_console_xen_backend)
(public_name mirage-console-xen-backend)
(libraries lwt mirage-xen xenstore xenstore.client xen-evtchn
shared-memory-ring mirage-console mirage-console-xen-proto io-page-xen)
(flags :standard -safe-string))
(libraries lwt mirage-xen xenstore xenstore.client io-page
shared-memory-ring mirage-console mirage-console-xen-proto))
29 changes: 18 additions & 11 deletions xen/console_xen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -127,23 +127,30 @@ let names_to_ids ids =
Lwt.return list)
) [] ids

type page = (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout)
Bigarray.Array1.t

external mirage_xen_get_console_evtchn: unit -> int =
"mirage_xen_get_console_evtchn"
external mirage_xen_get_console_page: unit -> page =
"mirage_xen_get_console_page"

let get_console_evtchn () = Eventchn.of_int @@
mirage_xen_get_console_evtchn ()

let get_console_page () = Cstruct.of_bigarray @@
mirage_xen_get_console_page ()

let get_initial_console () =
(* The domain is created with a reserved grant entry already set up.
We don't need to know who the backend domain is. *)
let page = Start_info.console_start_page () in
let page = get_console_page () in
let evtchn = get_console_evtchn () in
let ring = page in
(* We don't need to zero the initial console ring, and doing so may lose boot
* messages from Mini-OS. *)

let get_evtchn () =
let e = Eventchn.of_int Start_info.((get ()).console_evtchn) in
Eventchn.unmask h e;
e in
let evtchn = get_evtchn () in
(* We don't need to zero the initial console ring, doing so would lose
* initial messages from Solo5 / the OCaml runtime. *)
let closed = false in
let cons = { id = 0; backend_id = 0; gnt = Xen.console; ring; evtchn; closed } in
Sched.add_resume_hook (fun () -> cons.evtchn <- get_evtchn (); Lwt.return ());

Eventchn.unmask h evtchn;
Eventchn.notify h evtchn;
cons
Expand Down
8 changes: 3 additions & 5 deletions xen/dune
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
(library
(name mirage_console_xen)
(public_name mirage-console-xen)
(libraries lwt xenstore xen-evtchn shared-memory-ring
mirage-console-xen-proto mirage-console mirage-flow mirage-xen
io-page-xen)
(wrapped false)
(flags :standard -safe-string))
(libraries lwt xenstore shared-memory-ring io-page
mirage-console-xen-proto mirage-console mirage-flow mirage-xen)
(wrapped false))
3 changes: 1 addition & 2 deletions xen/proto/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
(name mirage_console_xen_proto)
(public_name mirage-console-xen-proto)
(libraries xenstore rresult)
(wrapped false)
(flags :standard -safe-string))
(wrapped false))