xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "James Harper" <james.harper@bendigoit.com.au>
To: Daniel Castro <evil.dani@gmail.com>,
	xen-devel@lists.xensource.com, seabios@seabios.org
Subject: RE: Ideas for PV on SeaBIOS
Date: Thu, 19 May 2011 17:44:36 +1000	[thread overview]
Message-ID: <AEC6C66638C05B468B556EA548C1A77D01D57231@trantor> (raw)
In-Reply-To: <BANLkTikE+98CEbfcW4-M_7ECkiyTmnAMjg@mail.gmail.com>

> 
> Good Day,
> 
> In order to give PV Drivers to SeaBIOS we will need to solve a few
> problems, one is the following:
> Does a booting kernel informs the BIOS that it will leave real mode
> and not use it again? When the booting kernel uses CPU real mode for
> the last time, how can we (Xen or SeaBIOS) know that real mode will no
> longer be used, and hence BIOS calls will not be issued?
> We want upon last real mode usage to leave all Xen PV information in a
> clean state, this means, closing the channel and ring between the
> newly created domain and the host system.
> 
> If you have any ideas please let me know.
> 

You can look at the Linux source code and see what the first thing it
does is. With GPLPV, the first thing I do is set up logging to
/var/log/qemu-dm-<domu name>.log (iowrites which are caught by qemu),
but only under the checked drivers. The next thing is to balloon down
the memory before Windows touches it too much. Then I disable the qemu
devices (iowrites which are caught by qemu). Finally I check the CPUID
for the xen signature (should probably do that first) and then set up
the rights etc.

I think the cheapest way to do it would be to trap the iowrite's and use
that as the trigger to tear down the rings etc, as the iowrites are
already processed in qemu which should be easier to intercept, but the
xen guys would need to comment on if you can guarantee that this is
always done by any reasonably recent version of Linux with PV drivers.
There may well be lots of current installations that pre-date those
iowrite's.

Next I guess you could look for the WriteMSR instruction to copy the
hypercall pages in, or look for an OS querying the CPUID's where the Xen
signatures live, but then the Hyper-V signatures are there too and I
don't know when Windows queries those. Possibly harder to trap as Xen
would either need to signal qemu or SeaBIOS directly that this had
happened.

Alternatively, seeing the HVM_PARAM_CALLBACK_IRQ, HVM_PARAM_STORE_PFN,
and HVM_PARAM_STORE_EVTCHN hypercalls (hvm set op) is the definitive way
to know that the OS is initialising the xenbus interface. SeaBIOS would
need to trap the calls (all three I guess in case they were executed in
an order you didn't expect) before they were executed, which would be
harder as I think qemu never sees it. This early intervention would be
required as you'd need to use xenbus to tear down the interfaces which
is probably asking a bit much.

James

  parent reply	other threads:[~2011-05-19  7:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-19  5:33 Ideas for PV on SeaBIOS Daniel Castro
2011-05-19  7:19 ` Keir Fraser
2011-05-19  8:01   ` [Xen-devel] " Ian Campbell
2011-05-21  7:39     ` Paolo Bonzini
2011-05-21  8:44       ` James Harper
2011-05-23  9:23         ` [Xen-devel] " Ian Campbell
2011-05-23 10:20           ` James Harper
2011-05-23 10:23             ` Ian Campbell
2011-05-19  7:44 ` James Harper [this message]
2011-05-19  8:08 ` Jan Beulich
2011-05-19  8:17   ` Juergen Gross
2011-05-19  8:20   ` Tim Deegan
2011-05-19  9:36     ` Ian Campbell
2011-05-19 15:02       ` Keir Fraser
2011-05-19 17:00       ` Ideas for PV on SeaBIOS - flush/barrier in QEMU Konrad Rzeszutek Wilk
2011-05-19  9:32   ` Ideas for PV on SeaBIOS James Harper
2011-05-21 13:38   ` [SeaBIOS] " Kevin O'Connor
2011-05-21 13:29 ` Kevin O'Connor
2011-05-23  5:24   ` Stefan Hajnoczi
2011-05-23  9:50     ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AEC6C66638C05B468B556EA548C1A77D01D57231@trantor \
    --to=james.harper@bendigoit.com.au \
    --cc=evil.dani@gmail.com \
    --cc=seabios@seabios.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).