Subject: Re: [PATCH 03/10] powerpc/eeh: Check PCIe link after reset

From: Benjamin Herrenschmidt <[email-masked]>
Date: Tue, 25 Jun 2013 16:06:24 +1000

On Tue, 2013-06-25 at 13:55 +0800, Gavin Shan wrote:
>         * don't touch the other command bits
>          */
> -       eeh_ops->read_config(dn, PCI_COMMAND, 4, &cmd);
> -       if (edev->config_space[1] & PCI_COMMAND_PARITY)
> -               cmd |= PCI_COMMAND_PARITY;
> -       else
> -               cmd &= ~PCI_COMMAND_PARITY;
> -       if (edev->config_space[1] & PCI_COMMAND_SERR)
> -               cmd |= PCI_COMMAND_SERR;
> -       else
> -               cmd &= ~PCI_COMMAND_SERR;
> -       eeh_ops->write_config(dn, PCI_COMMAND, 4, cmd);
> +       if (pdev) {
> +               eeh_ops->write_config(dn, PCI_COMMAND, 4,
> +                                     edev->config_space[1]);
> +       } else {

That needs a much better comment. Why are you doing that instead
of what's below ? In fact there is more to restore in a bridge
right ? (windows etc...). Do you do that ? Should we just have a
different function to restore a device vs. a bridge ?

I also don't see a need to do thing differently between phyp and
powernv. Bridges inside partitions would suffer the same fate in
both cases.

Ben.

> +               eeh_ops->read_config(dn, PCI_COMMAND, 4, &cmd);
> +               if (edev->config_space[1] & PCI_COMMAND_PARITY)
> +                       cmd |= PCI_COMMAND_PARITY;
> +               else
> +                       cmd &= ~PCI_COMMAND_PARITY;
> +               if (edev->config_space[1] & PCI_COMMAND_SERR)
> +                       cmd |= PCI_COMMAND_SERR;
> +               else
> +                       cmd &= ~PCI_COMMAND_SERR;
> +               eeh_ops->write_config(dn, PCI_COMMAND, 4, cmd);
> +       }
> +