public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
From: sathyanarayanan kuppuswamy  <sathyanarayanan.kuppuswamy@linux.intel.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: bhelgaas@google.com, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org, ashok.raj@intel.com,
	keith.busch@intel.com, mike.campin@intel.com
Subject: Re: [PATCH v2 1/1] PCI/IOV: Fix incorrect cfg_size for VF > 0
Date: Wed, 12 Jun 2019 11:41:36 -0700	[thread overview]
Message-ID: <0b21c76e-53f3-c35e-cebf-00719e451b11@linux.intel.com> (raw)
In-Reply-To: <20190612121910.231368e2@x1.home>


On 6/12/19 11:19 AM, Alex Williamson wrote:
> On Wed, 12 Jun 2019 10:06:47 -0700
> sathyanarayanan.kuppuswamy@linux.intel.com wrote:
>
>> From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
>>
>> Commit 975bb8b4dc93 ("PCI/IOV: Use VF0 cached config space size for
>> other VFs") calculates and caches the cfg_size for VF0 device before
>> initializing the pcie_cap of the device which results in using incorrect
>> cfg_size for all VF devices > 0. So set pcie_cap of the device before
>> calculating the cfg_size of VF0 device.
>>
>> Fixes: 975bb8b4dc93 ("PCI/IOV: Use VF0 cached config space size for
>> other VFs")
>> Cc: Ashok Raj <ashok.raj@intel.com>
>> Suggested-by: Mike Campin <mike.campin@intel.com>
>> Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
>> ---
>>
>> Changes since v1:
>>   * Fixed a typo in commit message.
>>
>>   drivers/pci/iov.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
>> index 3aa115ed3a65..2869011c0e35 100644
>> --- a/drivers/pci/iov.c
>> +++ b/drivers/pci/iov.c
>> @@ -160,6 +160,7 @@ int pci_iov_add_virtfn(struct pci_dev *dev, int id)
>>   	virtfn->device = iov->vf_device;
>>   	virtfn->is_virtfn = 1;
>>   	virtfn->physfn = pci_dev_get(dev);
>> +	virtfn->pcie_cap = pci_find_capability(virtfn, PCI_CAP_ID_EXP);
>>   
>>   	if (id == 0)
>>   		pci_read_vf_config_common(virtfn);
> Why not re-order until after we've setup pcie_cap?
>
> https://lore.kernel.org/linux-pci/20190604143617.0a226555@x1.home/T/#

pci_read_vf_config_common() also caches values for properties like 
class, hdr_type, susbsystem_vendor/device. These values are read/used in 
pci_setup_device(). So if we can use cached values in 
pci_setup_device(), we don't have to read them from registers twice for 
each device.

>
> Thanks,
> Alex
>
-- 
Sathyanarayanan Kuppuswamy
Linux kernel developer


  reply	other threads:[~2019-06-12 18:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-12 17:06 [PATCH v2 1/1] PCI/IOV: Fix incorrect cfg_size for VF > 0 sathyanarayanan.kuppuswamy
2019-06-12 18:15 ` Myron Stowe
2019-06-12 18:19 ` Alex Williamson
2019-06-12 18:41   ` sathyanarayanan kuppuswamy [this message]
2019-06-12 18:58     ` Alex Williamson
2019-06-12 19:03       ` Raj, Ashok
2019-06-12 19:12         ` Alex Williamson
2019-06-12 19:52         ` Raslan, KarimAllah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b21c76e-53f3-c35e-cebf-00719e451b11@linux.intel.com \
    --to=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=alex.williamson@redhat.com \
    --cc=ashok.raj@intel.com \
    --cc=bhelgaas@google.com \
    --cc=keith.busch@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mike.campin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox