Linux PCI Non-Transparent Bridge framework and drivers
 help / color / mirror / Atom feed
* [PATCH] ntb: ntb_hw_intel: link_poll isn't clearing the pending status properly
@ 2017-02-16 23:22 Dave Jiang
  2017-02-17  1:07 ` Jon Mason
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Jiang @ 2017-02-16 23:22 UTC (permalink / raw)
  To: jdmason; +Cc: linux-ntb, allen.hubbe

On Skylake hardware, the link_poll isn't clearing the pending interrupt
bit.  Adding a new function for SKX that handles clearing of status bit the
right way.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
 drivers/ntb/hw/intel/ntb_hw_intel.c |   24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/ntb/hw/intel/ntb_hw_intel.c b/drivers/ntb/hw/intel/ntb_hw_intel.c
index eca9688..c002384 100644
--- a/drivers/ntb/hw/intel/ntb_hw_intel.c
+++ b/drivers/ntb/hw/intel/ntb_hw_intel.c
@@ -1629,6 +1629,28 @@ static void atom_deinit_dev(struct intel_ntb_dev *ndev)
 
 /* Skylake Xeon NTB */
 
+static int skx_poll_link(struct intel_ntb_dev *ndev)
+{
+	u16 reg_val;
+	int rc;
+
+	ndev->reg->db_iowrite(ndev->db_link_mask,
+			      ndev->self_mmio +
+			      ndev->self_reg->db_clear);
+
+	rc = pci_read_config_word(ndev->ntb.pdev,
+				  SKX_LINK_STATUS_OFFSET, &reg_val);
+	if (rc)
+		return 0;
+
+	if (reg_val == ndev->lnk_sta)
+		return 0;
+
+	ndev->lnk_sta = reg_val;
+
+	return 1;
+}
+
 static u64 skx_db_ioread(void __iomem *mmio)
 {
 	return ioread64(mmio);
@@ -2852,7 +2874,7 @@ static struct intel_b2b_addr xeon_b2b_dsd_addr = {
 };
 
 static const struct intel_ntb_reg skx_reg = {
-	.poll_link		= xeon_poll_link,
+	.poll_link		= skx_poll_link,
 	.link_is_up		= xeon_link_is_up,
 	.db_ioread		= skx_db_ioread,
 	.db_iowrite		= skx_db_iowrite,


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ntb: ntb_hw_intel: link_poll isn't clearing the pending status properly
  2017-02-16 23:22 [PATCH] ntb: ntb_hw_intel: link_poll isn't clearing the pending status properly Dave Jiang
@ 2017-02-17  1:07 ` Jon Mason
  0 siblings, 0 replies; 2+ messages in thread
From: Jon Mason @ 2017-02-17  1:07 UTC (permalink / raw)
  To: Dave Jiang; +Cc: linux-ntb, allen.hubbe

On Thu, Feb 16, 2017 at 04:22:36PM -0700, Dave Jiang wrote:
> On Skylake hardware, the link_poll isn't clearing the pending interrupt
> bit.  Adding a new function for SKX that handles clearing of status bit the
> right way.
> 
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>

Pulled into my ntb branch.  I'll give it a couple of hours for the
bots to build test it, then I'll give a pull request to Linux (assuming
that it isn't too late in the cycle).

Thanks,
Jon


> ---
>  drivers/ntb/hw/intel/ntb_hw_intel.c |   24 +++++++++++++++++++++++-
>  1 file changed, 23 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ntb/hw/intel/ntb_hw_intel.c b/drivers/ntb/hw/intel/ntb_hw_intel.c
> index eca9688..c002384 100644
> --- a/drivers/ntb/hw/intel/ntb_hw_intel.c
> +++ b/drivers/ntb/hw/intel/ntb_hw_intel.c
> @@ -1629,6 +1629,28 @@ static void atom_deinit_dev(struct intel_ntb_dev *ndev)
>  
>  /* Skylake Xeon NTB */
>  
> +static int skx_poll_link(struct intel_ntb_dev *ndev)
> +{
> +	u16 reg_val;
> +	int rc;
> +
> +	ndev->reg->db_iowrite(ndev->db_link_mask,
> +			      ndev->self_mmio +
> +			      ndev->self_reg->db_clear);
> +
> +	rc = pci_read_config_word(ndev->ntb.pdev,
> +				  SKX_LINK_STATUS_OFFSET, &reg_val);
> +	if (rc)
> +		return 0;
> +
> +	if (reg_val == ndev->lnk_sta)
> +		return 0;
> +
> +	ndev->lnk_sta = reg_val;
> +
> +	return 1;
> +}
> +
>  static u64 skx_db_ioread(void __iomem *mmio)
>  {
>  	return ioread64(mmio);
> @@ -2852,7 +2874,7 @@ static struct intel_b2b_addr xeon_b2b_dsd_addr = {
>  };
>  
>  static const struct intel_ntb_reg skx_reg = {
> -	.poll_link		= xeon_poll_link,
> +	.poll_link		= skx_poll_link,
>  	.link_is_up		= xeon_link_is_up,
>  	.db_ioread		= skx_db_ioread,
>  	.db_iowrite		= skx_db_iowrite,
> 
> -- 
> You received this message because you are subscribed to the Google Groups "linux-ntb" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-ntb+unsubscribe@googlegroups.com.
> To post to this group, send email to linux-ntb@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/linux-ntb/148728735682.1188.5989205862351479482.stgit%40djiang5-desk3.ch.intel.com.
> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-17  1:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-16 23:22 [PATCH] ntb: ntb_hw_intel: link_poll isn't clearing the pending status properly Dave Jiang
2017-02-17  1:07 ` Jon Mason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox