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

From: Gavin Shan <[email-masked]>
Date: Tue, 25 Jun 2013 15:47:55 +0800

On Tue, Jun 25, 2013 at 04:06:24PM +1000, Benjamin Herrenschmidt wrote:
>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 ?
>

Yeah, We should have one separate function to do that for bridge.
I'll do that in next revision.

>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.
>

If we just have complete reset for fenced PHB, we need restore it
from the cache (edev->config_space[1]) instead of reading that from
hardware. Fenced PHB is the special case on PowerNV :-)

Thanks,
Gavin