Re: [PATCH 1/3] Enable non page boundary BAR device assignment

Chris Wright
2009-12-16T05:44:30Z

* Michael S. Tsirkin (mst@redhat.com) wrote:
> On Tue, Dec 15, 2009 at 11:50:23AM -0800, Chris Wright wrote:
> > * Alexander Graf (agraf@suse.de) wrote:
> > > >>>> @@ -405,7 +511,7 @@ static int assigned_dev_register_regions(PCIRegion *io_regions,
> > > >>>> } else {
> > > >>>> pci_dev->v_addrs[i].u.r_virtbase =
> > > >>>> mmap(NULL,
> > > >>>> - (cur_region->size + 0xFFF) & 0xFFFFF000,
> > > >>>> + cur_region->size,
> > > >>>>
> > > >>>>
> > > >>> Hmm, one assumes this code did work at some point ...
> > > >>> do you know why was it done this way?
> > > >>>
> > > >> Nope :-).
> > > >
> > > > So maybe keep it that way or make the change in a separate patch.
> > >
> > > Well we're sure the normal path is size aligned, no? In fact, you
> > > recommended I should change the code to what this looks like ;-).
> >
> > Sort of moot. The typical case is page size aligned, and the kernel is
> > going to round up anyway.
>
> Why was this code here originally then? Any idea?

I think it's redundant, being paranoid to ensure a multiple of page mappings
w/out realizing that's what mmap will do anyway.

thanks,
-chris