[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 4/5] Make MMIO address page aligned in guest.
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] Re: [PATCH 4/5] Make MMIO address page aligned in guest. |
Date: |
Sun, 11 Oct 2009 23:48:20 +0200 |
User-agent: |
Mutt/1.5.19 (2009-01-05) |
On Sun, Oct 11, 2009 at 08:59:06PM +0200, Gleb Natapov wrote:
> MMIO of some devices are not page aligned, such as some EHCI
> controllers and virtual Realtek NIC in guest. Current guest
> bios doesn't guarantee the start address of MMIO page aligned.
> This may result in failure of device assignment, because KVM
> only allow to register page aligned memory slots. For example,
> it fails to assign EHCI controller (its MMIO size is 1KB) with
> virtual Realtek NIC (its MMIO size is 256Bytes), because MMIO
> of virtual Realtek NIC in guest starts from 0xf2001000, MMIO of
> the EHCI controller will starts from 0xf2001400.
>
> MMIO addresses in guest are allocated in guest bios. This patch
> makes MMIO address page aligned in bios, then fixes the issue.
>
> qemu-kvm commit ccc9b91a1fdfac4161461a519e10a233f5066d2f
>
> Signed-off-by: Gleb Natapov <address@hidden>
This wastes memory for non-assigned devices. I think it's better, and
cleaner, to make qemu increase the BAR size up to 4K for assigned
devices if it wants page size alignment.
> ---
> src/pciinit.c | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/src/pciinit.c b/src/pciinit.c
> index 29b3901..53fbfcf 100644
> --- a/src/pciinit.c
> +++ b/src/pciinit.c
> @@ -10,6 +10,7 @@
> #include "biosvar.h" // GET_EBDA
> #include "pci_ids.h" // PCI_VENDOR_ID_INTEL
> #include "pci_regs.h" // PCI_COMMAND
> +#include "paravirt.h"
>
> #define PCI_ROM_SLOT 6
> #define PCI_NUM_REGIONS 7
> @@ -158,6 +159,12 @@ static void pci_bios_init_device(u16 bdf)
> *paddr = ALIGN(*paddr, size);
> pci_set_io_region_addr(bdf, i, *paddr);
> *paddr += size;
> + if (kvm_para_available()) {
> + /* make memory address page aligned */
> + /* needed for device assignment on kvm */
> + if (!(val & PCI_BASE_ADDRESS_SPACE_IO))
> + *paddr = (*paddr + 0xfff) & 0xfffff000;
> + }
> }
> }
> break;
> --
> 1.6.3.3
>
>
- [Qemu-devel] Re: [PATCH 3/5] Use the correct mask to size the PCI option ROM BAR., (continued)
- [Qemu-devel] Re: [PATCH 3/5] Use the correct mask to size the PCI option ROM BAR., Gleb Natapov, 2009/10/12
- [Qemu-devel] Re: [PATCH 3/5] Use the correct mask to size the PCI option ROM BAR., Michael S. Tsirkin, 2009/10/12
- [Qemu-devel] Re: [PATCH 3/5] Use the correct mask to size the PCI option ROM BAR., Gleb Natapov, 2009/10/12
- [Qemu-devel] Re: [PATCH 3/5] Use the correct mask to size the PCI option ROM BAR., Michael S. Tsirkin, 2009/10/12
- [Qemu-devel] Re: [PATCH 3/5] Use the correct mask to size the PCI option ROM BAR., Gleb Natapov, 2009/10/12
- [Qemu-devel] Re: [PATCH 3/5] Use the correct mask to size the PCI option ROM BAR., Michael S. Tsirkin, 2009/10/12
- [Qemu-devel] seabios: fix low bits in ROM and I/O sizing, Michael S. Tsirkin, 2009/10/12
- [Qemu-devel] Re: seabios: fix low bits in ROM and I/O sizing, Gleb Natapov, 2009/10/13
- Re: [Qemu-devel] Re: seabios: fix low bits in ROM and I/O sizing, Kevin O'Connor, 2009/10/14
[Qemu-devel] [PATCH 4/5] Make MMIO address page aligned in guest., Gleb Natapov, 2009/10/11
- [Qemu-devel] Re: [PATCH 4/5] Make MMIO address page aligned in guest.,
Michael S. Tsirkin <=
- [Qemu-devel] Re: [PATCH 4/5] Make MMIO address page aligned in guest., Gleb Natapov, 2009/10/12
- [Qemu-devel] Re: [PATCH 4/5] Make MMIO address page aligned in guest., Michael S. Tsirkin, 2009/10/12
- [Qemu-devel] Re: [PATCH 4/5] Make MMIO address page aligned in guest., Gleb Natapov, 2009/10/12
- [Qemu-devel] Re: [PATCH 4/5] Make MMIO address page aligned in guest., Michael S. Tsirkin, 2009/10/12
- [Qemu-devel] Re: [PATCH 4/5] Make MMIO address page aligned in guest., Gleb Natapov, 2009/10/12
- [Qemu-devel] Re: [PATCH 4/5] Make MMIO address page aligned in guest., Michael S. Tsirkin, 2009/10/12
- [Qemu-devel] Re: [PATCH 4/5] Make MMIO address page aligned in guest., Gleb Natapov, 2009/10/12
[Qemu-devel] Re: [PATCH 4/5] Make MMIO address page aligned in guest., Kevin O'Connor, 2009/10/12