* [PATCH] pciehp: Retrieve link speed after link is trained
@ 2011-10-09 7:06 Yinghai Lu
2011-11-02 21:05 ` Jesse Barnes
0 siblings, 1 reply; 6+ messages in thread
From: Yinghai Lu @ 2011-10-09 7:06 UTC (permalink / raw)
To: Jesse Barnes; +Cc: linux-pci, linux-kernel
During hot plug, board_added will call pciehp_power_on_slot().
But link speed is updated in pciehp_power_on_slot().
We should not update link speed there, because that is too early.
Move updating to pciehp_check_link_status() after making sure link is trained.
Signed-off-by: Yinghai Lu <yinghai.lu@oracle.com>
---
drivers/pci/hotplug/pciehp_hpc.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
Index: linux-2.6/drivers/pci/hotplug/pciehp_hpc.c
===================================================================
--- linux-2.6.orig/drivers/pci/hotplug/pciehp_hpc.c
+++ linux-2.6/drivers/pci/hotplug/pciehp_hpc.c
@@ -294,6 +294,8 @@ int pciehp_check_link_status(struct cont
return retval;
}
+ pcie_update_link_speed(ctrl->pcie->port->subordinate, lnk_status);
+
return retval;
}
@@ -516,14 +518,6 @@ int pciehp_power_on_slot(struct slot * s
ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__,
pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, slot_cmd);
- retval = pciehp_readw(ctrl, PCI_EXP_LNKSTA, &lnk_status);
- if (retval) {
- ctrl_err(ctrl, "%s: Cannot read LNKSTA register\n",
- __func__);
- return retval;
- }
- pcie_update_link_speed(ctrl->pcie->port->subordinate, lnk_status);
-
return retval;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] pciehp: Retrieve link speed after link is trained
2011-10-09 7:06 [PATCH] pciehp: Retrieve link speed after link is trained Yinghai Lu
@ 2011-11-02 21:05 ` Jesse Barnes
2011-11-03 7:07 ` Kenji Kaneshige
0 siblings, 1 reply; 6+ messages in thread
From: Jesse Barnes @ 2011-11-02 21:05 UTC (permalink / raw)
To: Yinghai Lu; +Cc: linux-pci, linux-kernel, Kenji Kaneshige, Hidetoshi Seto
[-- Attachment #1: Type: text/plain, Size: 1649 bytes --]
On Sun, 09 Oct 2011 00:06:06 -0700
Yinghai Lu <yinghai.lu@oracle.com> wrote:
>
> During hot plug, board_added will call pciehp_power_on_slot().
> But link speed is updated in pciehp_power_on_slot().
>
> We should not update link speed there, because that is too early.
>
> Move updating to pciehp_check_link_status() after making sure link is trained.
>
> Signed-off-by: Yinghai Lu <yinghai.lu@oracle.com>
>
> ---
> drivers/pci/hotplug/pciehp_hpc.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> Index: linux-2.6/drivers/pci/hotplug/pciehp_hpc.c
> ===================================================================
> --- linux-2.6.orig/drivers/pci/hotplug/pciehp_hpc.c
> +++ linux-2.6/drivers/pci/hotplug/pciehp_hpc.c
> @@ -294,6 +294,8 @@ int pciehp_check_link_status(struct cont
> return retval;
> }
>
> + pcie_update_link_speed(ctrl->pcie->port->subordinate, lnk_status);
> +
> return retval;
> }
>
> @@ -516,14 +518,6 @@ int pciehp_power_on_slot(struct slot * s
> ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__,
> pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, slot_cmd);
>
> - retval = pciehp_readw(ctrl, PCI_EXP_LNKSTA, &lnk_status);
> - if (retval) {
> - ctrl_err(ctrl, "%s: Cannot read LNKSTA register\n",
> - __func__);
> - return retval;
> - }
> - pcie_update_link_speed(ctrl->pcie->port->subordinate, lnk_status);
> -
> return retval;
> }
Kenji-san or Hidetoshi-san, would it be possible to get tested-bys and
reviewed-bys from you on this patch?
Thanks,
--
Jesse Barnes, Intel Open Source Technology Center
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] pciehp: Retrieve link speed after link is trained
2011-11-02 21:05 ` Jesse Barnes
@ 2011-11-03 7:07 ` Kenji Kaneshige
2011-11-07 11:30 ` Kenji Kaneshige
0 siblings, 1 reply; 6+ messages in thread
From: Kenji Kaneshige @ 2011-11-03 7:07 UTC (permalink / raw)
To: Jesse Barnes; +Cc: Yinghai Lu, linux-pci, linux-kernel, Hidetoshi Seto
(2011/11/03 6:05), Jesse Barnes wrote:
> On Sun, 09 Oct 2011 00:06:06 -0700
> Yinghai Lu<yinghai.lu@oracle.com> wrote:
>
>>
>> During hot plug, board_added will call pciehp_power_on_slot().
>> But link speed is updated in pciehp_power_on_slot().
>>
>> We should not update link speed there, because that is too early.
>>
>> Move updating to pciehp_check_link_status() after making sure link is trained.
>>
>> Signed-off-by: Yinghai Lu<yinghai.lu@oracle.com>
>>
>> ---
>> drivers/pci/hotplug/pciehp_hpc.c | 10 ++--------
>> 1 file changed, 2 insertions(+), 8 deletions(-)
>>
>> Index: linux-2.6/drivers/pci/hotplug/pciehp_hpc.c
>> ===================================================================
>> --- linux-2.6.orig/drivers/pci/hotplug/pciehp_hpc.c
>> +++ linux-2.6/drivers/pci/hotplug/pciehp_hpc.c
>> @@ -294,6 +294,8 @@ int pciehp_check_link_status(struct cont
>> return retval;
>> }
>>
>> + pcie_update_link_speed(ctrl->pcie->port->subordinate, lnk_status);
>> +
>> return retval;
>> }
>>
>> @@ -516,14 +518,6 @@ int pciehp_power_on_slot(struct slot * s
>> ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__,
>> pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, slot_cmd);
>>
>> - retval = pciehp_readw(ctrl, PCI_EXP_LNKSTA,&lnk_status);
>> - if (retval) {
>> - ctrl_err(ctrl, "%s: Cannot read LNKSTA register\n",
>> - __func__);
>> - return retval;
>> - }
>> - pcie_update_link_speed(ctrl->pcie->port->subordinate, lnk_status);
>> -
>> return retval;
>> }
>
> Kenji-san or Hidetoshi-san, would it be possible to get tested-bys and
> reviewed-bys from you on this patch?
>
> Thanks,
Looks good to me.
Reviewed-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Unfortunately, I don't have test environment right now. Maybe
I will be able to test it early next week.
Regards,
Kenji Kaneshige
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] pciehp: Retrieve link speed after link is trained
2011-11-03 7:07 ` Kenji Kaneshige
@ 2011-11-07 11:30 ` Kenji Kaneshige
2011-11-07 15:53 ` [PATCH -v2] " Yinghai Lu
0 siblings, 1 reply; 6+ messages in thread
From: Kenji Kaneshige @ 2011-11-07 11:30 UTC (permalink / raw)
To: Jesse Barnes, Yinghai Lu; +Cc: linux-pci, linux-kernel, Hidetoshi Seto
(2011/11/03 16:07), Kenji Kaneshige wrote:
> (2011/11/03 6:05), Jesse Barnes wrote:
>> On Sun, 09 Oct 2011 00:06:06 -0700
>> Yinghai Lu<yinghai.lu@oracle.com> wrote:
>>
>>>
>>> During hot plug, board_added will call pciehp_power_on_slot().
>>> But link speed is updated in pciehp_power_on_slot().
>>>
>>> We should not update link speed there, because that is too early.
>>>
>>> Move updating to pciehp_check_link_status() after making sure link is trained.
>>>
>>> Signed-off-by: Yinghai Lu<yinghai.lu@oracle.com>
>>>
>>> ---
>>> drivers/pci/hotplug/pciehp_hpc.c | 10 ++--------
>>> 1 file changed, 2 insertions(+), 8 deletions(-)
>>>
>>> Index: linux-2.6/drivers/pci/hotplug/pciehp_hpc.c
>>> ===================================================================
>>> --- linux-2.6.orig/drivers/pci/hotplug/pciehp_hpc.c
>>> +++ linux-2.6/drivers/pci/hotplug/pciehp_hpc.c
>>> @@ -294,6 +294,8 @@ int pciehp_check_link_status(struct cont
>>> return retval;
>>> }
>>>
>>> + pcie_update_link_speed(ctrl->pcie->port->subordinate, lnk_status);
>>> +
>>> return retval;
>>> }
>>>
>>> @@ -516,14 +518,6 @@ int pciehp_power_on_slot(struct slot * s
>>> ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__,
>>> pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, slot_cmd);
>>>
>>> - retval = pciehp_readw(ctrl, PCI_EXP_LNKSTA,&lnk_status);
>>> - if (retval) {
>>> - ctrl_err(ctrl, "%s: Cannot read LNKSTA register\n",
>>> - __func__);
>>> - return retval;
>>> - }
>>> - pcie_update_link_speed(ctrl->pcie->port->subordinate, lnk_status);
>>> -
>>> return retval;
>>> }
>>
>> Kenji-san or Hidetoshi-san, would it be possible to get tested-bys and
>> reviewed-bys from you on this patch?
>>
>> Thanks,
>
> Looks good to me.
> Reviewed-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
>
> Unfortunately, I don't have test environment right now. Maybe
> I will be able to test it early next week.
>
I got the following warning messages on kernel compile. I'm using 3.1.
Yinghai, please fix this.
CC drivers/pci/hotplug/pciehp_hpc.o
drivers/pci/hotplug/pciehp_hpc.c: In function 'pciehp_power_on_slot':
drivers/pci/hotplug/pciehp_hpc.c:489: warning: unused variable 'lnk_status'
Looks good to me, other than this.
Tested-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Regards,
Kenji Kaneshige
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH -v2] pciehp: Retrieve link speed after link is trained
2011-11-07 11:30 ` Kenji Kaneshige
@ 2011-11-07 15:53 ` Yinghai Lu
2011-11-07 16:07 ` Jesse Barnes
0 siblings, 1 reply; 6+ messages in thread
From: Yinghai Lu @ 2011-11-07 15:53 UTC (permalink / raw)
To: Jesse Barnes; +Cc: Kenji Kaneshige, linux-pci, linux-kernel, Hidetoshi Seto
During hot plug, board_added will call pciehp_power_on_slot().
But link speed is updated in pciehp_power_on_slot().
We should not update link speed there, because that is too early.
Move updating to pciehp_check_link_status() after making sure link is trained.
-v2: compiling warning that Kenji found.
Signed-off-by: Yinghai Lu <yinghai.lu@oracle.com>
Reviewed-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Tested-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
---
drivers/pci/hotplug/pciehp_hpc.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
Index: linux-2.6/drivers/pci/hotplug/pciehp_hpc.c
===================================================================
--- linux-2.6.orig/drivers/pci/hotplug/pciehp_hpc.c
+++ linux-2.6/drivers/pci/hotplug/pciehp_hpc.c
@@ -294,6 +294,8 @@ int pciehp_check_link_status(struct cont
return retval;
}
+ pcie_update_link_speed(ctrl->pcie->port->subordinate, lnk_status);
+
return retval;
}
@@ -484,7 +486,6 @@ int pciehp_power_on_slot(struct slot * s
u16 slot_cmd;
u16 cmd_mask;
u16 slot_status;
- u16 lnk_status;
int retval = 0;
/* Clear sticky power-fault bit from previous power failures */
@@ -516,14 +517,6 @@ int pciehp_power_on_slot(struct slot * s
ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__,
pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, slot_cmd);
- retval = pciehp_readw(ctrl, PCI_EXP_LNKSTA, &lnk_status);
- if (retval) {
- ctrl_err(ctrl, "%s: Cannot read LNKSTA register\n",
- __func__);
- return retval;
- }
- pcie_update_link_speed(ctrl->pcie->port->subordinate, lnk_status);
-
return retval;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH -v2] pciehp: Retrieve link speed after link is trained
2011-11-07 15:53 ` [PATCH -v2] " Yinghai Lu
@ 2011-11-07 16:07 ` Jesse Barnes
0 siblings, 0 replies; 6+ messages in thread
From: Jesse Barnes @ 2011-11-07 16:07 UTC (permalink / raw)
To: Yinghai Lu; +Cc: Kenji Kaneshige, linux-pci, linux-kernel, Hidetoshi Seto
[-- Attachment #1: Type: text/plain, Size: 497 bytes --]
On Mon, 07 Nov 2011 07:53:23 -0800
Yinghai Lu <yinghai.lu@oracle.com> wrote:
>
> During hot plug, board_added will call pciehp_power_on_slot().
> But link speed is updated in pciehp_power_on_slot().
>
> We should not update link speed there, because that is too early.
>
> Move updating to pciehp_check_link_status() after making sure link is trained.
>
> -v2: compiling warning that Kenji found.
Applied, thanks guys.
--
Jesse Barnes, Intel Open Source Technology Center
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-11-07 16:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-09 7:06 [PATCH] pciehp: Retrieve link speed after link is trained Yinghai Lu
2011-11-02 21:05 ` Jesse Barnes
2011-11-03 7:07 ` Kenji Kaneshige
2011-11-07 11:30 ` Kenji Kaneshige
2011-11-07 15:53 ` [PATCH -v2] " Yinghai Lu
2011-11-07 16:07 ` Jesse Barnes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox