Re: [PATCH] powerpc-powernv: align BARs to PAGE_SIZE on powernv platform

2012-09-10 Thread Alex Williamson
On Wed, 2012-09-05 at 15:27 +1000, Alexey Kardashevskiy wrote: > On 05/09/12 15:17, Benjamin Herrenschmidt wrote: > > On Tue, 2012-09-04 at 22:57 -0600, Alex Williamson wrote: > > > >> Do we need an extra region info field, or is it sufficient that we > >> define a region to be mmap'able with getpa

Re: [PATCH] powerpc-powernv: align BARs to PAGE_SIZE on powernv platform

2012-09-04 Thread Alexey Kardashevskiy
On 05/09/12 15:17, Benjamin Herrenschmidt wrote: On Tue, 2012-09-04 at 22:57 -0600, Alex Williamson wrote: Do we need an extra region info field, or is it sufficient that we define a region to be mmap'able with getpagesize() pages when the MMAP flag is set and simply offset the region within th

Re: [PATCH] powerpc-powernv: align BARs to PAGE_SIZE on powernv platform

2012-09-04 Thread Benjamin Herrenschmidt
On Tue, 2012-09-04 at 22:57 -0600, Alex Williamson wrote: > Do we need an extra region info field, or is it sufficient that we > define a region to be mmap'able with getpagesize() pages when the MMAP > flag is set and simply offset the region within the device fd? ex. Alexey ? You mentioned you

Re: [PATCH] powerpc-powernv: align BARs to PAGE_SIZE on powernv platform

2012-09-04 Thread Alex Williamson
On Wed, 2012-09-05 at 11:16 +1000, Benjamin Herrenschmidt wrote: > > > It's still bad in more ways that I care to explain... > > > > Well it is right before pci_reassigndev_resource_alignment() which is > > common and does the same thing. > > > > > The main one is that you do the "fixup" in a ve

Re: [PATCH] powerpc-powernv: align BARs to PAGE_SIZE on powernv platform

2012-09-04 Thread Benjamin Herrenschmidt
> > It's still bad in more ways that I care to explain... > > Well it is right before pci_reassigndev_resource_alignment() which is > common and does the same thing. > > > The main one is that you do the "fixup" in a very wrong place anyway and > > it might cause cases of overlapping BARs. > >

Re: [PATCH] powerpc-powernv: align BARs to PAGE_SIZE on powernv platform

2012-09-04 Thread Alexey Kardashevskiy
On 05/09/12 05:45, Benjamin Herrenschmidt wrote: On Tue, 2012-09-04 at 17:36 +1000, Alexey Kardashevskiy wrote: VFIO adds a separate memory region for every BAR and tries to mmap() it to provide direct BAR mapping to the guest. If it succeedes, QEMU registers this address with kvm_set_phys_mem()

Re: [PATCH] powerpc-powernv: align BARs to PAGE_SIZE on powernv platform

2012-09-04 Thread Benjamin Herrenschmidt
On Tue, 2012-09-04 at 17:36 +1000, Alexey Kardashevskiy wrote: > VFIO adds a separate memory region for every BAR and tries > to mmap() it to provide direct BAR mapping to the guest. > If it succeedes, QEMU registers this address with kvm_set_phys_mem(). > However it is not always possible because

[PATCH] powerpc-powernv: align BARs to PAGE_SIZE on powernv platform

2012-09-04 Thread Alexey Kardashevskiy
VFIO adds a separate memory region for every BAR and tries to mmap() it to provide direct BAR mapping to the guest. If it succeedes, QEMU registers this address with kvm_set_phys_mem(). However it is not always possible because such a BAR should be host page size aligned. In this case VFIO uses "sl