public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [0/3] -reserved-ram for PCI passthrough without VT-d and without paravirt
@ 2008-03-31 16:55 Andrea Arcangeli
  2008-03-31 17:02 ` [1/3] " Andrea Arcangeli
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Andrea Arcangeli @ 2008-03-31 16:55 UTC (permalink / raw)
  To: kvm-devel

Hello,

These three patches (one against host kernel, one against kvm.git, one
against kvm-userland.git) forces KVM to map all RAM mapped in the
virtualized e820 map provided to the guest with gfn = hfn. In turn
it's now possible to give direct hardware access to the guest, all DMA
will work fine on the virtualized guest ram.

The bios has to be updated to alter the end of the first ram slot in
the virtualized e820 map. This is unfixable as the address hardcoded
in the current bios is higher than what's marked as ram in my hardware
e820 map.

The only exception where gfn != hfn for ranges included in the
virtualized e820 map is for the magic bios page at host physical
address zero (bytes from 0 to 4096). All linux versions will
definitely never attempt to dma on such a page. If all OS are like
linux there will be no problem and pci passthrough will work
regardless of the guest OS without requiring any paravirtualization,
nor VT-d.

This only implements the memory management side, the logic to map mmio
regions into kvm address space will require further changes. The limit
of the reserved ram is around 1G and it has to be set at compile time,
so the guest will run with no more than 1G of ram (it's fairly easy to
extend it to 2G though). You can't run more than one guest with
-reserved-ram at once or they'll be overwriting themself. You need
access to /dev/mem on the userland side, and CAP_ADMIN on the kernel
side to run this.

I choosed an approach to require the minimal number of changes given
this is a short term approach due the lack of hardware features in
lots of cpus out there.

This is how the memory layout looks like when live guest runs
(physical start set to 512M and kvm -m 300).

7f108d429000-7f108d42b000 rw-p 7f108d429000 00:00 0
7f108d42b000-7f108d4ba000 rw-s 00000000 00:0e 275                        /dev/mem
7f108d4ba000-7f108d52a000 rw-p 7f108d4ba000 00:00 0
7f108d52a000-7f10a002a000 rw-s 00100000 00:0e 275                        /dev/mem
7f10a002a000-7f10a142e000 rw-p 7f10a002a000 00:00 0

  PID TTY      STAT   TIME  MAJFL   TRS   DRS   RSS %MEM COMMAND
 5522 ?        SLl    4:06      1  1568 427067 33144  7.0 bin/x86_64/kvm/bin/qemu-system-x86_64 -hda tmp/vir

RSS isn't including the reserved ram of course.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-04-12 12:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-31 16:55 [0/3] -reserved-ram for PCI passthrough without VT-d and without paravirt Andrea Arcangeli
2008-03-31 17:02 ` [1/3] " Andrea Arcangeli
2008-03-31 17:07 ` [2/3] " Andrea Arcangeli
2008-03-31 17:20 ` [3/3] -reserved-ram for PCI passthrough without iommu " Andrea Arcangeli
2008-04-11 12:13 ` [0/3] -reserved-ram for PCI passthrough without VT-d " Amit Shah
2008-04-11 18:36   ` [0/3] -reserved-ram for PCI passthrough without VT-d and without?paravirt Andrea Arcangeli
2008-04-12  7:41     ` Amit Shah
2008-04-12 12:22       ` Andrea Arcangeli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox