> -----Original Message----- > From: Philippe Mathieu-Daudé <phi...@linaro.org> > Sent: Wednesday, 22 March 2023 11:29 > To: Sriram Yagnaraman <sriram.yagnara...@est.tech> > Cc: qemu-devel@nongnu.org; Akihiko Odaki <akihiko.od...@daynix.com>; > Jason Wang <jasow...@redhat.com>; Dmitry Fleytman > <dmitry.fleyt...@gmail.com>; Michael S . Tsirkin <m...@redhat.com>; Marcel > Apfelbaum <marcel.apfelb...@gmail.com> > Subject: Re: [PATCH v8 2/8] igb: handle PF/VF reset properly > > On 22/3/23 10:26, Sriram Yagnaraman wrote: > > Use PFRSTD to reset RSTI bit for VFs, and raise VFLRE interrupt when > > VF is reset. > > > > Signed-off-by: Sriram Yagnaraman <sriram.yagnara...@est.tech> > > --- > > hw/net/igb_core.c | 33 +++++++++++++++++++++------------ > > hw/net/igb_regs.h | 3 +++ > > hw/net/trace-events | 2 ++ > > 3 files changed, 26 insertions(+), 12 deletions(-) > > > > diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index > > 596039aab8..fe6c7518e9 100644 > > --- a/hw/net/igb_core.c > > +++ b/hw/net/igb_core.c > > @@ -1895,14 +1895,6 @@ static void igb_set_eims(IGBCore *core, int > index, uint32_t val) > > igb_update_interrupt_state(core); > > } > > > > -static void igb_vf_reset(IGBCore *core, uint16_t vfn) -{ > > - /* TODO: Reset of the queue enable and the interrupt registers of the > > VF. > */ > > - > > - core->mac[V2PMAILBOX0 + vfn] &= ~E1000_V2PMAILBOX_RSTI; > > - core->mac[V2PMAILBOX0 + vfn] = E1000_V2PMAILBOX_RSTD; > > -} > > - > > static void mailbox_interrupt_to_vf(IGBCore *core, uint16_t vfn) > > { > > uint32_t ent = core->mac[VTIVAR_MISC + vfn]; @@ -1980,6 +1972,17 > > @@ static void igb_set_vfmailbox(IGBCore *core, int index, uint32_t val) > > } > > } > > > > +static void igb_vf_reset(IGBCore *core, uint16_t vfn) { > > + /* disable Rx and Tx for the VF*/ > > + core->mac[VFTE] &= ~BIT(vfn); > > + core->mac[VFRE] &= ~BIT(vfn); > > + /* indicate VF reset to PF */ > > + core->mac[VFLRE] |= BIT(vfn); > > + /* VFLRE and mailbox use the same interrupt cause */ > > + mailbox_interrupt_to_pf(core); > > +} > > Orthogonal to this patch, I'm surprised to see a function named > igb_vf_reset() which is not called by igb_reset().
Thanks for the pertinent comment, will fix it. On PF reset, the hardware will assert RSTI bit on all VF mailboxes, which should in turn trigger a VF reset after the PF reset is complete.