Re: [PATCH] PCI: Reassign page-aligned memory resources to device for pci passthrough.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 3 Nov 2008 09:11:32 -0800
Jesse Barnes <jbarnes@xxxxxxxxxxxxxxxx> wrote:

> On Friday, October 31, 2008 5:30 am Matthew Wilcox wrote:
> > On Fri, Oct 31, 2008 at 02:49:30PM +0900, Yuji Shimada wrote:
> > > I created this patch for xen's dom0 linux. It is useful when we assign
> > > I/O device to HVM domain using pci passthrough, because page-aligned
> > > memory resource is required for pci passthrough. But I heard it is
> > > also useful for KVM. So I submit it to linux-pci ML.
> > >
> > > On many system, BIOS assigns memory resources to the device and
> > > enables it. So my patch disables the device, and releases memory
> > > resources. Then it assigns page-aligned memory resource to the device.
> > >
> > > To reassign page-aligned memory resources to device, please add boot
> > > parameters of linux as follows.
> > >
> > > 	reassigndev=00:1d.7,01:00.0
> > >
> > > 	reassigndev=	Specifies device to reassign page-aligned
> > > 			memory resources.  PCI-PCI bridge can be
> > > 			specified, if resource windows need to be
> > > 			expanded.
> >
> > It seems unreasonably restrictive to have to specify this at boot time.

There is reason to reassign resource at boot time.

Device driver can't access memory mapped register during reassigning
resource. So, if we reassign resource at run time, we have to suspend
device driver. On the other hand, if we reassign resource at boot
time, we don't have to suspend device driver, because device driver is
not running.

I think reassigning resource at boot time (before device driver runs)
is simple.

> > We do have some infrastructure for resizing and moving resource windows.
> > Perhaps you could investigate a method for reassigning resources at
> > runtime?

To reassign resource at run time, we have to do like "multi-level
rebalancing". In my understanding, current linux does not have such
mechanism.

> Yeah you should be able to modify resource_alignment to choose the smaller of 
> resource_size and PAGE_SIZE if that's what you need (possibly wrapping the 
> call where you need it rather that modifying kernel/resource.c directly).

I would not like to add "struct pci_dev* dev" parameter to
"resource_alignment" function. So, I will submit new patch which uses
wrapping function,

What I need is choosing the bigger of resource_size and PAGE_SIZE,
because the granularity of mapping between guest physical address and
machine address is page size.

Thanks,
--
Yuji Shimada

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux