qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Akihiko Odaki <akihiko.odaki@daynix.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
	Ani Sinha <anisinha@redhat.com>,
	Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
	Sriram Yagnaraman <sriram.yagnaraman@est.tech>,
	Jason Wang <jasowang@redhat.com>, Keith Busch <kbusch@kernel.org>,
	Klaus Jensen <its@irrelevant.dk>
Subject: Re: [PATCH 3/4] igb: Fix ARI next function numbers
Date: Sun, 2 Jul 2023 17:38:42 +0900	[thread overview]
Message-ID: <ff06355e-bfd6-7574-e42c-ecfd6939e7aa@daynix.com> (raw)
In-Reply-To: <20230702010041-mutt-send-email-mst@kernel.org>

On 2023/07/02 14:05, Michael S. Tsirkin wrote:
> On Sat, Jul 01, 2023 at 04:01:21PM +0900, Akihiko Odaki wrote:
>> The next function numbers are expected to form a linked list ending with
>> 0.
>>
>> Fixes: 3a977deebe ("Intrdocue igb device emulation")
>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>> ---
>>   hw/net/igb_core.h | 3 +++
>>   hw/net/igb.c      | 4 +---
>>   hw/net/igbvf.c    | 5 ++++-
>>   3 files changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/hw/net/igb_core.h b/hw/net/igb_core.h
>> index 9cbbfd516b..e1dab76995 100644
>> --- a/hw/net/igb_core.h
>> +++ b/hw/net/igb_core.h
>> @@ -49,6 +49,9 @@
>>   #define IGB_NUM_QUEUES          (16)
>>   #define IGB_NUM_VM_POOLS        (8)
>>   
>> +#define IGB_VF_OFFSET           (0x80)
>> +#define IGB_VF_STRIDE           (2)
>> +
>>   typedef struct IGBCore IGBCore;
>>   
>>   enum { PHY_R = BIT(0),
>> diff --git a/hw/net/igb.c b/hw/net/igb.c
>> index 1c989d7677..543ca0114a 100644
>> --- a/hw/net/igb.c
>> +++ b/hw/net/igb.c
>> @@ -81,8 +81,6 @@ struct IGBState {
>>   };
>>   
>>   #define IGB_CAP_SRIOV_OFFSET    (0x160)
>> -#define IGB_VF_OFFSET           (0x80)
>> -#define IGB_VF_STRIDE           (2)
>>   
>>   #define E1000E_MMIO_IDX     0
>>   #define E1000E_FLASH_IDX    1
>> @@ -431,7 +429,7 @@ static void igb_pci_realize(PCIDevice *pci_dev, Error **errp)
>>           hw_error("Failed to initialize AER capability");
>>       }
>>   
>> -    pcie_ari_init(pci_dev, 0x150, 1);
>> +    pcie_ari_init(pci_dev, 0x150, IGB_VF_OFFSET);
>>   
>>       pcie_sriov_pf_init(pci_dev, IGB_CAP_SRIOV_OFFSET, TYPE_IGBVF,
>>           IGB_82576_VF_DEV_ID, IGB_MAX_VF_FUNCTIONS, IGB_MAX_VF_FUNCTIONS,
> 
> 
> I think this change would break migrations from 8.0. No?

Well, I don't have a reason to concern more for this change than other 
bug fixes with behavioral changes observable from the guest.

> 
> 
> More importantly your commit log says linked list should end
> with 0, but you make it point at a VF instead.
> 
> 
>> diff --git a/hw/net/igbvf.c b/hw/net/igbvf.c
>> index 284ea61184..bf2f237ab5 100644
>> --- a/hw/net/igbvf.c
>> +++ b/hw/net/igbvf.c
>> @@ -240,6 +240,9 @@ static const MemoryRegionOps mmio_ops = {
>>   static void igbvf_pci_realize(PCIDevice *dev, Error **errp)
>>   {
>>       IgbVfState *s = IGBVF(dev);
>> +    uint16_t nextvfn = pcie_sriov_vf_number(dev) + 1;
>> +    uint16_t nextfn = nextvfn < IGB_MAX_VF_FUNCTIONS ?
>> +                      IGB_VF_OFFSET + nextvfn * IGB_VF_STRIDE : 0;
>>       int ret;
>>       int i;
>>   
>> @@ -270,7 +273,7 @@ static void igbvf_pci_realize(PCIDevice *dev, Error **errp)
>>           hw_error("Failed to initialize AER capability");
>>       }
>>   
>> -    pcie_ari_init(dev, 0x150, 1);
>> +    pcie_ari_init(dev, 0x150, nextfn);
> 
> 
> 
> For this one I don't see why it matters at all:
> 
> The presence of Shadow Functions does not affect this field.
> For VFs, this field is undefined since VFs are located using First VF Offset (see § Section 9.3.3.9 ) and VF
> Stride (see § Section 9.3.3.10 ).

I missed the statements saying the field is undefined for VFs. I posted 
an alternative series ("[PATCH 0/3] pci: Fix ARI next function numbers") 
so please review it.

> 
> 
> 
> 
>>   }
>>   
>>   static void igbvf_pci_uninit(PCIDevice *dev)
>> -- 
>> 2.41.0
> 


  reply	other threads:[~2023-07-02  8:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-01  7:01 [PATCH 0/4] pci: Compare function number and ARI next function number Akihiko Odaki
2023-07-01  7:01 ` [PATCH 1/4] docs: Fix next function numbers in SR/IOV documentation Akihiko Odaki
2023-07-01 14:31   ` Ani Sinha
2023-07-02  3:51     ` Akihiko Odaki
2023-07-01  7:01 ` [PATCH 2/4] hw/nvme: Fix ARI next function numbers Akihiko Odaki
2023-07-01  7:01 ` [PATCH 3/4] igb: " Akihiko Odaki
2023-07-02  5:05   ` Michael S. Tsirkin
2023-07-02  8:38     ` Akihiko Odaki [this message]
2023-07-02  8:40       ` Michael S. Tsirkin
2023-07-01  7:01 ` [PATCH 4/4] pci: Compare function number and ARI next function number Akihiko Odaki
2023-07-02  4:58   ` Michael S. Tsirkin
2023-07-02  8:46     ` Akihiko Odaki
2023-07-02  8:55       ` Michael S. Tsirkin
2023-07-02  8:57         ` Michael S. Tsirkin
2023-07-11  7:10   ` Ani Sinha
2023-07-11  8:33     ` Michael S. Tsirkin
2023-07-02  5:10 ` [PATCH 0/4] " Michael S. Tsirkin

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=ff06355e-bfd6-7574-e42c-ecfd6939e7aa@daynix.com \
    --to=akihiko.odaki@daynix.com \
    --cc=anisinha@redhat.com \
    --cc=its@irrelevant.dk \
    --cc=jasowang@redhat.com \
    --cc=kbusch@kernel.org \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sriram.yagnaraman@est.tech \
    /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;
as well as URLs for NNTP newsgroup(s).