* [PATCH 1/3] KVM: pci passthrough un-page-aligned mmio device on machines w/o VT-d
@ 2008-12-15 14:57 刘晓建
2008-12-16 6:37 ` Han, Weidong
0 siblings, 1 reply; 2+ messages in thread
From: 刘晓建 @ 2008-12-15 14:57 UTC (permalink / raw)
To: kvm
the following patches apply to KVM-79. however, just now I viewed the code in
KVM-81, and saw the problem remains.
when assigning a pci device to guest os, the qemu can not guarantee the device's
virtual iomem address has the same page offset with the real one.
for example: in native linux, the the starting iomem address for my via-rhine nic
is 0x00000000df9fff00, which is not page aligned. But QEMU will emulate this nic
has a page aligned mmio address. This difference will make guest os access the
wrong address when it tries to do mmio.
It seems Han Weidong has disabled QEMU assign this kinds of devices to guest os.
The following patch will remove this constraint.
---
diff -uNr kvm-79/bios/rombios32.c kvm-79-fixed/bios/rombios32.c
--- kvm-79/bios/rombios32.c 2008-11-12 19:48:01.000000000 +0800
+++ kvm-79-fixed/bios/rombios32.c 2008-12-12 11:38:41.000000000 +0800
@@ -931,7 +931,9 @@
paddr = &pci_bios_bigmem_addr;
else
paddr = &pci_bios_mem_addr;
- *paddr = (*paddr + size - 1) & ~(size - 1);
+
+ /* To preserve the iomem page offset. --Xiaojian Liu */
+ *paddr = ((*paddr + size - 1) & ~(size - 1)) | (val & 0x0fff);
pci_set_io_region_addr(d, i, *paddr);
*paddr += size;
}
Xiaojian Liu
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [PATCH 1/3] KVM: pci passthrough un-page-aligned mmio device on machines w/o VT-d
2008-12-15 14:57 [PATCH 1/3] KVM: pci passthrough un-page-aligned mmio device on machines w/o VT-d 刘晓建
@ 2008-12-16 6:37 ` Han, Weidong
0 siblings, 0 replies; 2+ messages in thread
From: Han, Weidong @ 2008-12-16 6:37 UTC (permalink / raw)
To: '刘晓建', 'kvm@vger.kernel.org'
刘晓建 wrote:
> the following patches apply to KVM-79. however, just now I viewed the
> code in KVM-81, and saw the problem remains.
>
> when assigning a pci device to guest os, the qemu can not guarantee
> the device's virtual iomem address has the same page offset with the
> real one.
> for example: in native linux, the the starting iomem address for my
> via-rhine nic is 0x00000000df9fff00, which is not page aligned. But
> QEMU will emulate this nic has a page aligned mmio address. This
> difference will make guest os access the wrong address when it tries
> to do mmio.
>
Pls note that multiple devices may share one page for their MMIO, and they may be assigned to different guests, there is potential isolation issue. So we don't allow to assign these devices.
Regards,
Weidong
> It seems Han Weidong has disabled QEMU assign this kinds of devices
> to guest os. The following patch will remove this constraint.
> ---
> diff -uNr kvm-79/bios/rombios32.c kvm-79-fixed/bios/rombios32.c
> --- kvm-79/bios/rombios32.c 2008-11-12 19:48:01.000000000 +0800
> +++ kvm-79-fixed/bios/rombios32.c 2008-12-12 11:38:41.000000000 +0800
> @@ -931,7 +931,9 @@
> paddr = &pci_bios_bigmem_addr;
> else
> paddr = &pci_bios_mem_addr;
> - *paddr = (*paddr + size - 1) & ~(size - 1);
> +
> + /* To preserve the iomem page offset. --Xiaojian Liu */
> + *paddr = ((*paddr + size - 1) & ~(size - 1)) | (val
> & 0x0fff); pci_set_io_region_addr(d, i, *paddr);
> *paddr += size;
> }
>
> Xiaojian Liu
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-12-16 6:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-15 14:57 [PATCH 1/3] KVM: pci passthrough un-page-aligned mmio device on machines w/o VT-d 刘晓建
2008-12-16 6:37 ` Han, Weidong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox