Skip to content

Commit

Permalink
Remove old lguest I/O infrrasructure.
Browse files Browse the repository at this point in the history
This patch gets rid of the old lguest host I/O infrastructure and
replaces it with a single hypercall "LHCALL_NOTIFY" which takes an
address.

The main change is the removal of io.c: that mainly did inter-guest
I/O, which virtio doesn't yet support.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Oct 23, 2007
1 parent 0ca49ca commit 1504527
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 752 deletions.
2 changes: 1 addition & 1 deletion drivers/lguest/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Host requires the other files, which can be a module.
obj-$(CONFIG_LGUEST) += lg.o
lg-y = core.o hypercalls.o page_tables.o interrupts_and_traps.o \
segments.o io.o lguest_user.o
segments.o lguest_user.o

lg-$(CONFIG_X86_32) += x86/switcher_32.o x86/core.o

Expand Down
12 changes: 4 additions & 8 deletions drivers/lguest/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,12 @@ int run_guest(struct lguest *lg, unsigned long __user *user)
if (lg->hcall)
do_hypercalls(lg);

/* It's possible the Guest did a SEND_DMA hypercall to the
/* It's possible the Guest did a NOTIFY hypercall to the
* Launcher, in which case we return from the read() now. */
if (lg->dma_is_pending) {
if (put_user(lg->pending_dma, user) ||
put_user(lg->pending_key, user+1))
if (lg->pending_notify) {
if (put_user(lg->pending_notify, user))
return -EFAULT;
return sizeof(unsigned long)*2;
return sizeof(lg->pending_notify);
}

/* Check for signals */
Expand Down Expand Up @@ -288,9 +287,6 @@ static int __init init(void)
if (err)
goto unmap;

/* The I/O subsystem needs some things initialized. */
lguest_io_init();

/* We might need to reserve an interrupt vector. */
err = init_interrupts();
if (err)
Expand Down
26 changes: 8 additions & 18 deletions drivers/lguest/hypercalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,9 @@ static void do_hcall(struct lguest *lg, struct hcall_args *args)
else
guest_pagetable_flush_user(lg);
break;
case LHCALL_BIND_DMA:
/* BIND_DMA really wants four arguments, but it's the only call
* which does. So the Guest packs the number of buffers and
* the interrupt number into the final argument, and we decode
* it here. This can legitimately fail, since we currently
* place a limit on the number of DMA pools a Guest can have.
* So we return true or false from this call. */
args->arg0 = bind_dma(lg, args->arg1, args->arg2,
args->arg3 >> 8, args->arg3 & 0xFF);
break;

/* All these calls simply pass the arguments through to the right
* routines. */
case LHCALL_SEND_DMA:
send_dma(lg, args->arg1, args->arg2);
break;
case LHCALL_NEW_PGTABLE:
guest_new_pagetable(lg, args->arg1);
break;
Expand All @@ -99,6 +86,9 @@ static void do_hcall(struct lguest *lg, struct hcall_args *args)
/* Similarly, this sets the halted flag for run_guest(). */
lg->halted = 1;
break;
case LHCALL_NOTIFY:
lg->pending_notify = args->arg1;
break;
default:
if (lguest_arch_do_hcall(lg, args))
kill_guest(lg, "Bad hypercall %li\n", args->arg0);
Expand Down Expand Up @@ -156,9 +146,9 @@ static void do_async_hcalls(struct lguest *lg)
break;
}

/* Stop doing hypercalls if we've just done a DMA to the
* Launcher: it needs to service this first. */
if (lg->dma_is_pending)
/* Stop doing hypercalls if they want to notify the Launcher:
* it needs to service this first. */
if (lg->pending_notify)
break;
}
}
Expand Down Expand Up @@ -220,9 +210,9 @@ void do_hypercalls(struct lguest *lg)
do_async_hcalls(lg);

/* If we stopped reading the hypercall ring because the Guest did a
* SEND_DMA to the Launcher, we want to return now. Otherwise we do
* NOTIFY to the Launcher, we want to return now. Otherwise we do
* the hypercall. */
if (!lg->dma_is_pending) {
if (!lg->pending_notify) {
do_hcall(lg, lg->hcall);
/* Tricky point: we reset the hcall pointer to mark the
* hypercall as "done". We use the hcall pointer rather than
Expand Down
Loading

0 comments on commit 1504527

Please sign in to comment.