All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Dom0 PCI: fix SR-IOV function dependency link problem
@ 2009-06-03  5:41 Yu Zhao
  2009-06-04  5:33 ` Isaku Yamahata
  0 siblings, 1 reply; 3+ messages in thread
From: Yu Zhao @ 2009-06-03  5:41 UTC (permalink / raw)
  To: keir.fraser; +Cc: xen-devel

[-- Attachment #1: Type: text/plain, Size: 497 bytes --]

PCIe Root Complex Integrated Endpoint does not implement ARI, so this
kind of endpoint uses 3-bit function number. The function dependency
link of the integrated endpoint should be calculated using the device
number field in conjunction with the value from function dependency
link register.

Normal SR-IOV endpoint always implements ARI and the function dependency
link register contains 8-bit function number (i.e. `devfn' from software
perspective).

Signed-off-by: Yu Zhao <yu.zhao@intel.com>

[-- Attachment #2: 01.patch --]
[-- Type: text/x-patch, Size: 1235 bytes --]

# HG changeset patch
# User Yu Zhao <yu.zhao@intel.com>
# Date 1244007161 -28800
# Node ID 3a959a6975152b741389d2eed1823d55be4f2889
# Parent  ec3442c2ed48eb11fcacd3fe31af48932f0a6645
PCI: fix SR-IOV function dependency link problem

PCIe Root Complex Integrated Endpoint does not implement ARI, so this
kind of endpoint uses 3-bit function number. The function dependency
link of the integrated endpoint should be calculated using the device
number field in conjunction with the value from function dependency
link register.

Normal SR-IOV endpoint always implements ARI and the function dependency
link register contains 8-bit function number (i.e. `devfn' from software
perspective).

Signed-off-by: Yu Zhao <yu.zhao@intel.com>

diff -r ec3442c2ed48 -r 3a959a697515 drivers/pci/iov.c
--- a/drivers/pci/iov.c	Wed Jun 03 13:30:08 2009 +0800
+++ b/drivers/pci/iov.c	Wed Jun 03 13:32:41 2009 +0800
@@ -366,6 +366,8 @@
 	iov->self = dev;
 	pci_read_config_dword(dev, pos + PCI_SRIOV_CAP, &iov->cap);
 	pci_read_config_byte(dev, pos + PCI_SRIOV_FUNC_LINK, &iov->link);
+	if (!dev->bus->number)	/* Root Complex Integrated Endpoint */
+		iov->link = PCI_DEVFN(PCI_SLOT(dev->devfn), iov->link);
 
 	if (pdev)
 		iov->dev = pci_dev_get(pdev);

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Dom0 PCI: fix SR-IOV function dependency link problem
  2009-06-03  5:41 [PATCH] Dom0 PCI: fix SR-IOV function dependency link problem Yu Zhao
@ 2009-06-04  5:33 ` Isaku Yamahata
  2009-06-04 12:38   ` Yu Zhao
  0 siblings, 1 reply; 3+ messages in thread
From: Isaku Yamahata @ 2009-06-04  5:33 UTC (permalink / raw)
  To: Yu Zhao; +Cc: xen-devel, keir.fraser

On Wed, Jun 03, 2009 at 01:41:34PM +0800, Yu Zhao wrote:
> PCIe Root Complex Integrated Endpoint does not implement ARI, so this
> kind of endpoint uses 3-bit function number. The function dependency
> link of the integrated endpoint should be calculated using the device
> number field in conjunction with the value from function dependency
> link register.
> 
> Normal SR-IOV endpoint always implements ARI and the function dependency
> link register contains 8-bit function number (i.e. `devfn' from software
> perspective).
> 
> Signed-off-by: Yu Zhao <yu.zhao@intel.com>

> # HG changeset patch
> # User Yu Zhao <yu.zhao@intel.com>
> # Date 1244007161 -28800
> # Node ID 3a959a6975152b741389d2eed1823d55be4f2889
> # Parent  ec3442c2ed48eb11fcacd3fe31af48932f0a6645
> PCI: fix SR-IOV function dependency link problem
> 
> PCIe Root Complex Integrated Endpoint does not implement ARI, so this
> kind of endpoint uses 3-bit function number. The function dependency
> link of the integrated endpoint should be calculated using the device
> number field in conjunction with the value from function dependency
> link register.
> 
> Normal SR-IOV endpoint always implements ARI and the function dependency
> link register contains 8-bit function number (i.e. `devfn' from software
> perspective).
> 
> Signed-off-by: Yu Zhao <yu.zhao@intel.com>
> 
> diff -r ec3442c2ed48 -r 3a959a697515 drivers/pci/iov.c
> --- a/drivers/pci/iov.c	Wed Jun 03 13:30:08 2009 +0800
> +++ b/drivers/pci/iov.c	Wed Jun 03 13:32:41 2009 +0800
> @@ -366,6 +366,8 @@
>  	iov->self = dev;
>  	pci_read_config_dword(dev, pos + PCI_SRIOV_CAP, &iov->cap);
>  	pci_read_config_byte(dev, pos + PCI_SRIOV_FUNC_LINK, &iov->link);
> +	if (!dev->bus->number)	/* Root Complex Integrated Endpoint */
> +		iov->link = PCI_DEVFN(PCI_SLOT(dev->devfn), iov->link);
>  
>  	if (pdev)
>  		iov->dev = pci_dev_get(pdev);

Possibly the above check may work.
But pci capability list should be examined.
something like
  rpcap = pci_find_capability(pdev, PCI_CAP_ID_EXP);
  if (!rpcap)
	  pci_read_config_word(pdev, rpcap + PCI_CAP_FLAGS, &cap);
	  if (cap == PCI_EXP_TYPE_RC_END)
...

thanks,
-- 
yamahata

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Dom0 PCI: fix SR-IOV function dependency link problem
  2009-06-04  5:33 ` Isaku Yamahata
@ 2009-06-04 12:38   ` Yu Zhao
  0 siblings, 0 replies; 3+ messages in thread
From: Yu Zhao @ 2009-06-04 12:38 UTC (permalink / raw)
  To: Isaku Yamahata; +Cc: xen-devel, keir.fraser

Isaku Yamahata wrote:
> On Wed, Jun 03, 2009 at 01:41:34PM +0800, Yu Zhao wrote:
>> PCIe Root Complex Integrated Endpoint does not implement ARI, so this
>> kind of endpoint uses 3-bit function number. The function dependency
>> link of the integrated endpoint should be calculated using the device
>> number field in conjunction with the value from function dependency
>> link register.
>>
>> Normal SR-IOV endpoint always implements ARI and the function dependency
>> link register contains 8-bit function number (i.e. `devfn' from software
>> perspective).
>>
>> Signed-off-by: Yu Zhao <yu.zhao@intel.com>
> 
>> # HG changeset patch
>> # User Yu Zhao <yu.zhao@intel.com>
>> # Date 1244007161 -28800
>> # Node ID 3a959a6975152b741389d2eed1823d55be4f2889
>> # Parent  ec3442c2ed48eb11fcacd3fe31af48932f0a6645
>> PCI: fix SR-IOV function dependency link problem
>>
>> PCIe Root Complex Integrated Endpoint does not implement ARI, so this
>> kind of endpoint uses 3-bit function number. The function dependency
>> link of the integrated endpoint should be calculated using the device
>> number field in conjunction with the value from function dependency
>> link register.
>>
>> Normal SR-IOV endpoint always implements ARI and the function dependency
>> link register contains 8-bit function number (i.e. `devfn' from software
>> perspective).
>>
>> Signed-off-by: Yu Zhao <yu.zhao@intel.com>
>>
>> diff -r ec3442c2ed48 -r 3a959a697515 drivers/pci/iov.c
>> --- a/drivers/pci/iov.c	Wed Jun 03 13:30:08 2009 +0800
>> +++ b/drivers/pci/iov.c	Wed Jun 03 13:32:41 2009 +0800
>> @@ -366,6 +366,8 @@
>>  	iov->self = dev;
>>  	pci_read_config_dword(dev, pos + PCI_SRIOV_CAP, &iov->cap);
>>  	pci_read_config_byte(dev, pos + PCI_SRIOV_FUNC_LINK, &iov->link);
>> +	if (!dev->bus->number)	/* Root Complex Integrated Endpoint */
>> +		iov->link = PCI_DEVFN(PCI_SLOT(dev->devfn), iov->link);
>>  
>>  	if (pdev)
>>  		iov->dev = pci_dev_get(pdev);
> 
> Possibly the above check may work.
> But pci capability list should be examined.
> something like
>   rpcap = pci_find_capability(pdev, PCI_CAP_ID_EXP);
>   if (!rpcap)
> 	  pci_read_config_word(pdev, rpcap + PCI_CAP_FLAGS, &cap);
> 	  if (cap == PCI_EXP_TYPE_RC_END)

It will works well since the capability check is already done before 
doing anything else:

int pci_iov_init(struct pci_dev *dev)
{
         int pos;

         pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_SRIOV);
         if (pos)
                 return sriov_init(dev, pos);

         return -ENODEV;
}

Thanks,
Yu

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-06-04 12:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-03  5:41 [PATCH] Dom0 PCI: fix SR-IOV function dependency link problem Yu Zhao
2009-06-04  5:33 ` Isaku Yamahata
2009-06-04 12:38   ` Yu Zhao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.