[PATCH 2/2] NVMe: Implement PCI-e reset notification callback

Learner Study learner.study at gmail.com
Mon Apr 21 18:34:20 PDT 2014


Hi Keith,

I think NVMe Reset should apply to PF mode driver only, and not to VF
mode driver.
Is that understanding correct? Does the NVMe driver know which mode
its running in?

Thanks!


On Tue, Apr 8, 2014 at 4:42 PM, Keith Busch <keith.busch at intel.com> wrote:
>
> Disable and shutdown the device prior to reset, and restart the device
> after.
>
> Signed-off-by: Keith Busch <keith.busch at intel.com>
> ---
>  drivers/block/nvme-core.c |   11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
> index 625259d..273ff12 100644
> --- a/drivers/block/nvme-core.c
> +++ b/drivers/block/nvme-core.c
> @@ -2605,6 +2605,16 @@ static void nvme_reset_failed_dev(struct work_struct *ws)
>         nvme_dev_reset(dev);
>  }
>
> +static void nvme_reset_notify(struct pci_dev *pdev, int prepare)
> +{
> +       struct nvme_dev *dev = pci_get_drvdata(pdev);
> +
> +       if (prepare)
> +               nvme_dev_shutdown(dev);
> +       else
> +               nvme_dev_resume(dev);
> +}
> +
>  static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  {
>         int result = -ENOMEM;
> @@ -2744,6 +2754,7 @@ static const struct pci_error_handlers nvme_err_handler = {
>         .link_reset     = nvme_link_reset,
>         .slot_reset     = nvme_slot_reset,
>         .resume         = nvme_error_resume,
> +       .reset_notify   = nvme_reset_notify,
>  };
>
>  /* Move to pci_ids.h later */
> --
> 1.7.10.4
>
>
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme at lists.infradead.org
> http://merlin.infradead.org/mailman/listinfo/linux-nvme



More information about the Linux-nvme mailing list