On Thu, Jun 06, 2013 at 05:06:32PM +0200, Gerd Hoffmann wrote:
> On 06/06/13 08:34, Gleb Natapov wrote:
> > On Wed, Jun 05, 2013 at 07:41:17PM -0500, Anthony Liguori wrote:
> >>
> >> Oh, you mean in real mode.
> >>
> >> SeaBIOS runs the virtio code in 32-bit mode with a flat memory layout.
> >> There are loads of ASSERT32FLAT()s in the code to make sure of this.
> >>
> > Well, not exactly. Initialization is done in 32bit, but disk
> > reads/writes are done in 16bit mode since it should work from int13
> > interrupt handler.
>
> Exactly. It's "only" the initialization code which has ASSERt32FLAT()
> all over the place. Which actually is the majority of the code in most
> cases as all the hardware detection and initialization code is there.
> But kicking I/O requests must work from 16bit mode too.
>
> > The only way I know to access MMIO bars from 16 bit
> > is to use SMM which we do not have in KVM.
>
> For seabios itself this isn't a big issue, see pci_{readl,writel} in
> src/pci.c. When called in 16bit mode it goes into 32bit mode
> temporarily, just for accessing the mmio register. ahci driver uses it,
> xhci driver (wip atm) will use that too, and virtio-{blk,scsi} drivers
> in seabios can do the same.
>
Isn't this approach broken? How can SeaBIOS be sure it restores real
mode registers to exactly same state they were before entering 32bit
mode?
> But as hpa mentioned it will be more tricky for option roms (aka
> virtio-net).
>
> cheers,
> Gerd
>
--
Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html