linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] PCI/IOV: Fix VF0 cached config space size for other VFs
@ 2019-05-20 13:17 Hao Zheng
  2019-06-04 17:29 ` Alex Williamson
  0 siblings, 1 reply; 3+ messages in thread
From: Hao Zheng @ 2019-05-20 13:17 UTC (permalink / raw)
  To: bhelgaas; +Cc: linux-pci, linux-kernel, Hao Zheng, Quan Xu

Set the pcie_cap field before getting the config space size for
other VFs. Otherwise, the config space size of other VFs are error
set to 256, while the size of VF0 is 4096.

Signed-off-by: Hao Zheng <mowendugu@gmail.com>
Signed-off-by: Quan Xu <quan.xu0@gmail.com>
---
 drivers/pci/iov.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 3aa115e..239fad1 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -133,6 +133,7 @@ static void pci_read_vf_config_common(struct pci_dev *virtfn)
 	pci_read_config_word(virtfn, PCI_SUBSYSTEM_ID,
 			     &physfn->sriov->subsystem_device);
 
+	set_pcie_port_type(virtfn);
 	physfn->sriov->cfg_size = pci_cfg_space_size(virtfn);
 }
 
-- 
1.8.3.1


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

* Re: [PATCH 1/1] PCI/IOV: Fix VF0 cached config space size for other VFs
  2019-05-20 13:17 [PATCH 1/1] PCI/IOV: Fix VF0 cached config space size for other VFs Hao Zheng
@ 2019-06-04 17:29 ` Alex Williamson
  2019-06-14  3:57   ` 独孤败
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Williamson @ 2019-06-04 17:29 UTC (permalink / raw)
  To: Hao Zheng; +Cc: bhelgaas, linux-pci, linux-kernel, Quan Xu

On Mon, 20 May 2019 21:17:24 +0800
Hao Zheng <mowendugu@gmail.com> wrote:

> Set the pcie_cap field before getting the config space size for
> other VFs. Otherwise, the config space size of other VFs are error
> set to 256, while the size of VF0 is 4096.
> 
> Signed-off-by: Hao Zheng <mowendugu@gmail.com>
> Signed-off-by: Quan Xu <quan.xu0@gmail.com>
> ---
>  drivers/pci/iov.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
> index 3aa115e..239fad1 100644
> --- a/drivers/pci/iov.c
> +++ b/drivers/pci/iov.c
> @@ -133,6 +133,7 @@ static void pci_read_vf_config_common(struct pci_dev *virtfn)
>  	pci_read_config_word(virtfn, PCI_SUBSYSTEM_ID,
>  			     &physfn->sriov->subsystem_device);
>  
> +	set_pcie_port_type(virtfn);
>  	physfn->sriov->cfg_size = pci_cfg_space_size(virtfn);
>  }
>  

This results in set_pci_port_type() being called multiple times on
VF0.  Why not simply delay calling pci_read_vf_config_common() until
after pci_setup_device()?  Here's the alternate approach:

https://lore.kernel.org/linux-pci/155966918965.10361.16228304474160813310.stgit@gimli.home/

Thanks,
Alex

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

* Re: [PATCH 1/1] PCI/IOV: Fix VF0 cached config space size for other VFs
  2019-06-04 17:29 ` Alex Williamson
@ 2019-06-14  3:57   ` 独孤败
  0 siblings, 0 replies; 3+ messages in thread
From: 独孤败 @ 2019-06-14  3:57 UTC (permalink / raw)
  To: Alex Williamson; +Cc: Bjorn Helgaas, linux-pci, linux-kernel, Quan Xu

Alex Williamson <alex.williamson@redhat.com> 于2019年6月5日周三 上午1:29写道:
>
> On Mon, 20 May 2019 21:17:24 +0800
> Hao Zheng <mowendugu@gmail.com> wrote:
>
> > Set the pcie_cap field before getting the config space size for
> > other VFs. Otherwise, the config space size of other VFs are error
> > set to 256, while the size of VF0 is 4096.
> >
> > Signed-off-by: Hao Zheng <mowendugu@gmail.com>
> > Signed-off-by: Quan Xu <quan.xu0@gmail.com>
> > ---
> >  drivers/pci/iov.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
> > index 3aa115e..239fad1 100644
> > --- a/drivers/pci/iov.c
> > +++ b/drivers/pci/iov.c
> > @@ -133,6 +133,7 @@ static void pci_read_vf_config_common(struct pci_dev *virtfn)
> >       pci_read_config_word(virtfn, PCI_SUBSYSTEM_ID,
> >                            &physfn->sriov->subsystem_device);
> >
> > +     set_pcie_port_type(virtfn);
> >       physfn->sriov->cfg_size = pci_cfg_space_size(virtfn);
> >  }
> >
>
> This results in set_pci_port_type() being called multiple times on
> VF0.  Why not simply delay calling pci_read_vf_config_common() until
> after pci_setup_device()?  Here's the alternate approach:
>
> https://lore.kernel.org/linux-pci/155966918965.10361.16228304474160813310.stgit@gimli.home/

I get it. This is a better approach. Thank you for your advice!
>
> Thanks,
> Alex



-- 
Best Regards!

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

end of thread, other threads:[~2019-06-14  3:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-20 13:17 [PATCH 1/1] PCI/IOV: Fix VF0 cached config space size for other VFs Hao Zheng
2019-06-04 17:29 ` Alex Williamson
2019-06-14  3:57   ` 独孤败

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).