On Fri, 27 Nov 2026 16:35:10 -0500
Simon Song <[email protected]> wrote:

> On 11/26/2026 1:08 AM, Alex Williamson wrote:
> > On Wed, 25 Nov 2026 21:45:13 -0500
> > Simon Song <[email protected]> wrote:
> >   
> >> On 11/24/2026 7:19 PM, Alex Williamson wrote:
> >>>> +
> >>>> +    fn reset_prepare(rd: &NovaVgpuRegData<'_>) {
> >>>> +        // PCI holds the device lock, and VFIO may hold its memory 
> >>>> lock. Open and
> >>>> +        // close release this mutex before entering the VFIO core.
> >>>> +        let mut state = rd.state.lock();
> >>>> +        state.resetting = true;
> >>>> +        if state.active {
> >>>> +            if let Some(vgpu) = &rd.vgpu {
> >>>> +                if let Err(error) = vgpu.api.reset(vgpu.gfid) {
> >>>> +                    state.reset_error.get_or_insert(error);
> >>>> +                }
> >>>> +            }
> >>>> +        }
> >>>> +    }    
> >>>
> >>> This seems very wrong, why are we calling the PF driver reset in
> >>> reset_prepare()?  Isn't there still an FLR happening between prepare
> >>> and done?  Does it do anything?
> >>>     
> >> It will not reset the PF, vgpu.api.reset will reset this vgpu instance 
> >> behind this VF,
> >> the PF driver would ask firmware to reset the instance and scrub its 
> >> memory, then FLR
> >> follows  
> > 
> > PF reset is not the question.  We're calling into the PF driver to reset
> > the VF, but we should not be doing that from reset_prepare().  This
> > also still doesn't explain what the FLR that follows the PF initiated
> > VF reset actually does.  Why can't we just use FLR?  Do we need a
> > device specific reset quirk?
> >   
> FLR resets the VF itself, and firmware stops VF channels and reset registers,
> but doesn't reset vGPU state inside the firmware, and only PF driver can ask 
> firmware to do that
> 
> I agree it doesn't belong in reset_prepare, in next respin, I moved it to 
> reset_done(), so it runs
> after FLR

Both seem like an abuse of the setup/cleanup wrappers.  Is this a gap
in FLR support?  If so, this is why we have device specific reset
support in PCI-core.  Depending on the PF driver is going to be a
challenge though.  When and where specifically do we need this firmware
state reset?  Isn't the firmware already involved in the FLR?  Thanks,

Alex

Reply via email to