All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] NTB: ntb_hw_intel: show BAR size in debugfs info
@ 2016-07-22 13:38 Allen Hubbe
  2016-07-22 13:38 ` [PATCH 2/2] NTB: ntb_hw_intel: use local variable pdev Allen Hubbe
  2016-07-22 16:19 ` [PATCH 1/2] NTB: ntb_hw_intel: show BAR size in debugfs info Jiang, Dave
  0 siblings, 2 replies; 5+ messages in thread
From: Allen Hubbe @ 2016-07-22 13:38 UTC (permalink / raw)
  To: linux-ntb; +Cc: Jon Mason, Dave Jiang, Allen Hubbe

It will be useful to know the hardware configured BAR size to diagnose
issues with NTB memory windows.

Signed-off-by: Allen Hubbe <Allen.Hubbe@emc.com>
---
 drivers/ntb/hw/intel/ntb_hw_intel.c | 39 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/drivers/ntb/hw/intel/ntb_hw_intel.c b/drivers/ntb/hw/intel/ntb_hw_intel.c
index 40d04ef5da9e..5efd03705e5c 100644
--- a/drivers/ntb/hw/intel/ntb_hw_intel.c
+++ b/drivers/ntb/hw/intel/ntb_hw_intel.c
@@ -551,13 +551,15 @@ static ssize_t ndev_debugfs_read(struct file *filp, char __user *ubuf,
 				 size_t count, loff_t *offp)
 {
 	struct intel_ntb_dev *ndev;
+	struct pci_dev *pdev;
 	void __iomem *mmio;
 	char *buf;
 	size_t buf_size;
 	ssize_t ret, off;
-	union { u64 v64; u32 v32; u16 v16; } u;
+	union { u64 v64; u32 v32; u16 v16; u8 v8; } u;
 
 	ndev = filp->private_data;
+	pdev = ndev_pdev(ndev);
 	mmio = ndev->self_mmio;
 
 	buf_size = min(count, 0x800ul);
@@ -632,6 +634,41 @@ static ssize_t ndev_debugfs_read(struct file *filp, char __user *ubuf,
 			 "Doorbell Bell -\t\t%#llx\n", u.v64);
 
 	off += scnprintf(buf + off, buf_size - off,
+			 "\nNTB Window Size:\n");
+
+	pci_read_config_byte(pdev, XEON_PBAR23SZ_OFFSET, &u.v8);
+	off += scnprintf(buf + off, buf_size - off,
+			 "PBAR23SZ %hhu\n", u.v8);
+	if (!ndev->bar4_split) {
+		pci_read_config_byte(pdev, XEON_PBAR45SZ_OFFSET, &u.v8);
+		off += scnprintf(buf + off, buf_size - off,
+				 "PBAR45SZ %hhu\n", u.v8);
+	} else {
+		pci_read_config_byte(pdev, XEON_PBAR4SZ_OFFSET, &u.v8);
+		off += scnprintf(buf + off, buf_size - off,
+				 "PBAR4SZ %hhu\n", u.v8);
+		pci_read_config_byte(pdev, XEON_PBAR5SZ_OFFSET, &u.v8);
+		off += scnprintf(buf + off, buf_size - off,
+				 "PBAR5SZ %hhu\n", u.v8);
+	}
+
+	pci_read_config_byte(pdev, XEON_SBAR23SZ_OFFSET, &u.v8);
+	off += scnprintf(buf + off, buf_size - off,
+			 "SBAR23SZ %hhu\n", u.v8);
+	if (!ndev->bar4_split) {
+		pci_read_config_byte(pdev, XEON_SBAR45SZ_OFFSET, &u.v8);
+		off += scnprintf(buf + off, buf_size - off,
+				 "SBAR45SZ %hhu\n", u.v8);
+	} else {
+		pci_read_config_byte(pdev, XEON_SBAR4SZ_OFFSET, &u.v8);
+		off += scnprintf(buf + off, buf_size - off,
+				 "SBAR4SZ %hhu\n", u.v8);
+		pci_read_config_byte(pdev, XEON_SBAR5SZ_OFFSET, &u.v8);
+		off += scnprintf(buf + off, buf_size - off,
+				 "SBAR5SZ %hhu\n", u.v8);
+	}
+
+	off += scnprintf(buf + off, buf_size - off,
 			 "\nNTB Incoming XLAT:\n");
 
 	u.v64 = ioread64(mmio + bar2_off(ndev->xlat_reg->bar2_xlat, 2));
-- 
2.7.2


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

* [PATCH 2/2] NTB: ntb_hw_intel: use local variable pdev
  2016-07-22 13:38 [PATCH 1/2] NTB: ntb_hw_intel: show BAR size in debugfs info Allen Hubbe
@ 2016-07-22 13:38 ` Allen Hubbe
  2016-07-22 16:20   ` Jiang, Dave
  2016-07-22 16:19 ` [PATCH 1/2] NTB: ntb_hw_intel: show BAR size in debugfs info Jiang, Dave
  1 sibling, 1 reply; 5+ messages in thread
From: Allen Hubbe @ 2016-07-22 13:38 UTC (permalink / raw)
  To: linux-ntb; +Cc: Jon Mason, Dave Jiang, Allen Hubbe

Clean up duplicated expression by replacing it with the equivalent local
varible pdev.

Signed-off-by: Allen Hubbe <Allen.Hubbe@emc.com>
---
 drivers/ntb/hw/intel/ntb_hw_intel.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/ntb/hw/intel/ntb_hw_intel.c b/drivers/ntb/hw/intel/ntb_hw_intel.c
index 5efd03705e5c..0d5c29ae51de 100644
--- a/drivers/ntb/hw/intel/ntb_hw_intel.c
+++ b/drivers/ntb/hw/intel/ntb_hw_intel.c
@@ -706,7 +706,7 @@ static ssize_t ndev_debugfs_read(struct file *filp, char __user *ubuf,
 				 "LMT45 -\t\t\t%#018llx\n", u.v64);
 	}
 
-	if (pdev_is_xeon(ndev->ntb.pdev)) {
+	if (pdev_is_xeon(pdev)) {
 		if (ntb_topo_is_b2b(ndev->ntb.topo)) {
 			off += scnprintf(buf + off, buf_size - off,
 					 "\nNTB Outgoing B2B XLAT:\n");
@@ -787,22 +787,22 @@ static ssize_t ndev_debugfs_read(struct file *filp, char __user *ubuf,
 		off += scnprintf(buf + off, buf_size - off,
 				 "\nXEON NTB Hardware Errors:\n");
 
-		if (!pci_read_config_word(ndev->ntb.pdev,
+		if (!pci_read_config_word(pdev,
 					  XEON_DEVSTS_OFFSET, &u.v16))
 			off += scnprintf(buf + off, buf_size - off,
 					 "DEVSTS -\t\t%#06x\n", u.v16);
 
-		if (!pci_read_config_word(ndev->ntb.pdev,
+		if (!pci_read_config_word(pdev,
 					  XEON_LINK_STATUS_OFFSET, &u.v16))
 			off += scnprintf(buf + off, buf_size - off,
 					 "LNKSTS -\t\t%#06x\n", u.v16);
 
-		if (!pci_read_config_dword(ndev->ntb.pdev,
+		if (!pci_read_config_dword(pdev,
 					   XEON_UNCERRSTS_OFFSET, &u.v32))
 			off += scnprintf(buf + off, buf_size - off,
 					 "UNCERRSTS -\t\t%#06x\n", u.v32);
 
-		if (!pci_read_config_dword(ndev->ntb.pdev,
+		if (!pci_read_config_dword(pdev,
 					   XEON_CORERRSTS_OFFSET, &u.v32))
 			off += scnprintf(buf + off, buf_size - off,
 					 "CORERRSTS -\t\t%#06x\n", u.v32);
-- 
2.7.2


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

* Re: [PATCH 1/2] NTB: ntb_hw_intel: show BAR size in debugfs info
  2016-07-22 13:38 [PATCH 1/2] NTB: ntb_hw_intel: show BAR size in debugfs info Allen Hubbe
  2016-07-22 13:38 ` [PATCH 2/2] NTB: ntb_hw_intel: use local variable pdev Allen Hubbe
@ 2016-07-22 16:19 ` Jiang, Dave
  2016-08-05 14:35   ` Jon Mason
  1 sibling, 1 reply; 5+ messages in thread
From: Jiang, Dave @ 2016-07-22 16:19 UTC (permalink / raw)
  To: Allen.Hubbe, linux-ntb; +Cc: jdmason


On Fri, 2016-07-22 at 09:38 -0400, Allen Hubbe wrote:
> It will be useful to know the hardware configured BAR size to
> diagnose
> issues with NTB memory windows.
> 
> Signed-off-by: Allen Hubbe <Allen.Hubbe@emc.com>
Acked-by: Dave Jiang <dave.jiang@intel.com>

> ---
>  drivers/ntb/hw/intel/ntb_hw_intel.c | 39
> ++++++++++++++++++++++++++++++++++++-
>  1 file changed, 38 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ntb/hw/intel/ntb_hw_intel.c
> b/drivers/ntb/hw/intel/ntb_hw_intel.c
> index 40d04ef5da9e..5efd03705e5c 100644
> --- a/drivers/ntb/hw/intel/ntb_hw_intel.c
> +++ b/drivers/ntb/hw/intel/ntb_hw_intel.c
> @@ -551,13 +551,15 @@ static ssize_t ndev_debugfs_read(struct file
> *filp, char __user *ubuf,
>  				 size_t count, loff_t *offp)
>  {
>  	struct intel_ntb_dev *ndev;
> +	struct pci_dev *pdev;
>  	void __iomem *mmio;
>  	char *buf;
>  	size_t buf_size;
>  	ssize_t ret, off;
> -	union { u64 v64; u32 v32; u16 v16; } u;
> +	union { u64 v64; u32 v32; u16 v16; u8 v8; } u;
>  
>  	ndev = filp->private_data;
> +	pdev = ndev_pdev(ndev);
>  	mmio = ndev->self_mmio;
>  
>  	buf_size = min(count, 0x800ul);
> @@ -632,6 +634,41 @@ static ssize_t ndev_debugfs_read(struct file
> *filp, char __user *ubuf,
>  			 "Doorbell Bell -\t\t%#llx\n", u.v64);
>  
>  	off += scnprintf(buf + off, buf_size - off,
> +			 "\nNTB Window Size:\n");
> +
> +	pci_read_config_byte(pdev, XEON_PBAR23SZ_OFFSET, &u.v8);
> +	off += scnprintf(buf + off, buf_size - off,
> +			 "PBAR23SZ %hhu\n", u.v8);
> +	if (!ndev->bar4_split) {
> +		pci_read_config_byte(pdev, XEON_PBAR45SZ_OFFSET,
> &u.v8);
> +		off += scnprintf(buf + off, buf_size - off,
> +				 "PBAR45SZ %hhu\n", u.v8);
> +	} else {
> +		pci_read_config_byte(pdev, XEON_PBAR4SZ_OFFSET,
> &u.v8);
> +		off += scnprintf(buf + off, buf_size - off,
> +				 "PBAR4SZ %hhu\n", u.v8);
> +		pci_read_config_byte(pdev, XEON_PBAR5SZ_OFFSET,
> &u.v8);
> +		off += scnprintf(buf + off, buf_size - off,
> +				 "PBAR5SZ %hhu\n", u.v8);
> +	}
> +
> +	pci_read_config_byte(pdev, XEON_SBAR23SZ_OFFSET, &u.v8);
> +	off += scnprintf(buf + off, buf_size - off,
> +			 "SBAR23SZ %hhu\n", u.v8);
> +	if (!ndev->bar4_split) {
> +		pci_read_config_byte(pdev, XEON_SBAR45SZ_OFFSET,
> &u.v8);
> +		off += scnprintf(buf + off, buf_size - off,
> +				 "SBAR45SZ %hhu\n", u.v8);
> +	} else {
> +		pci_read_config_byte(pdev, XEON_SBAR4SZ_OFFSET,
> &u.v8);
> +		off += scnprintf(buf + off, buf_size - off,
> +				 "SBAR4SZ %hhu\n", u.v8);
> +		pci_read_config_byte(pdev, XEON_SBAR5SZ_OFFSET,
> &u.v8);
> +		off += scnprintf(buf + off, buf_size - off,
> +				 "SBAR5SZ %hhu\n", u.v8);
> +	}
> +
> +	off += scnprintf(buf + off, buf_size - off,
>  			 "\nNTB Incoming XLAT:\n");
>  
>  	u.v64 = ioread64(mmio + bar2_off(ndev->xlat_reg->bar2_xlat,
> 2));

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

* Re: [PATCH 2/2] NTB: ntb_hw_intel: use local variable pdev
  2016-07-22 13:38 ` [PATCH 2/2] NTB: ntb_hw_intel: use local variable pdev Allen Hubbe
@ 2016-07-22 16:20   ` Jiang, Dave
  0 siblings, 0 replies; 5+ messages in thread
From: Jiang, Dave @ 2016-07-22 16:20 UTC (permalink / raw)
  To: Allen.Hubbe, linux-ntb; +Cc: jdmason


On Fri, 2016-07-22 at 09:38 -0400, Allen Hubbe wrote:
> Clean up duplicated expression by replacing it with the equivalent
> local
> varible pdev.
> 
> Signed-off-by: Allen Hubbe <Allen.Hubbe@emc.com>
Acked-by: Dave Jiang <dave.jiang@intel.com>

> ---
>  drivers/ntb/hw/intel/ntb_hw_intel.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/ntb/hw/intel/ntb_hw_intel.c
> b/drivers/ntb/hw/intel/ntb_hw_intel.c
> index 5efd03705e5c..0d5c29ae51de 100644
> --- a/drivers/ntb/hw/intel/ntb_hw_intel.c
> +++ b/drivers/ntb/hw/intel/ntb_hw_intel.c
> @@ -706,7 +706,7 @@ static ssize_t ndev_debugfs_read(struct file
> *filp, char __user *ubuf,
>  				 "LMT45 -\t\t\t%#018llx\n", u.v64);
>  	}
>  
> -	if (pdev_is_xeon(ndev->ntb.pdev)) {
> +	if (pdev_is_xeon(pdev)) {
>  		if (ntb_topo_is_b2b(ndev->ntb.topo)) {
>  			off += scnprintf(buf + off, buf_size - off,
>  					 "\nNTB Outgoing B2B
> XLAT:\n");
> @@ -787,22 +787,22 @@ static ssize_t ndev_debugfs_read(struct file
> *filp, char __user *ubuf,
>  		off += scnprintf(buf + off, buf_size - off,
>  				 "\nXEON NTB Hardware Errors:\n");
>  
> -		if (!pci_read_config_word(ndev->ntb.pdev,
> +		if (!pci_read_config_word(pdev,
>  					  XEON_DEVSTS_OFFSET,
> &u.v16))
>  			off += scnprintf(buf + off, buf_size - off,
>  					 "DEVSTS -\t\t%#06x\n",
> u.v16);
>  
> -		if (!pci_read_config_word(ndev->ntb.pdev,
> +		if (!pci_read_config_word(pdev,
>  					  XEON_LINK_STATUS_OFFSET,
> &u.v16))
>  			off += scnprintf(buf + off, buf_size - off,
>  					 "LNKSTS -\t\t%#06x\n",
> u.v16);
>  
> -		if (!pci_read_config_dword(ndev->ntb.pdev,
> +		if (!pci_read_config_dword(pdev,
>  					   XEON_UNCERRSTS_OFFSET,
> &u.v32))
>  			off += scnprintf(buf + off, buf_size - off,
>  					 "UNCERRSTS -\t\t%#06x\n",
> u.v32);
>  
> -		if (!pci_read_config_dword(ndev->ntb.pdev,
> +		if (!pci_read_config_dword(pdev,
>  					   XEON_CORERRSTS_OFFSET,
> &u.v32))
>  			off += scnprintf(buf + off, buf_size - off,
>  					 "CORERRSTS -\t\t%#06x\n",
> u.v32);
> -- 
> 2.7.2
> 

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

* Re: [PATCH 1/2] NTB: ntb_hw_intel: show BAR size in debugfs info
  2016-07-22 16:19 ` [PATCH 1/2] NTB: ntb_hw_intel: show BAR size in debugfs info Jiang, Dave
@ 2016-08-05 14:35   ` Jon Mason
  0 siblings, 0 replies; 5+ messages in thread
From: Jon Mason @ 2016-08-05 14:35 UTC (permalink / raw)
  To: Jiang, Dave; +Cc: Allen.Hubbe, linux-ntb

On Fri, Jul 22, 2016 at 12:19 PM, Jiang, Dave <dave.jiang@intel.com> wrote:
>
> On Fri, 2016-07-22 at 09:38 -0400, Allen Hubbe wrote:
>> It will be useful to know the hardware configured BAR size to
>> diagnose
>> issues with NTB memory windows.
>>
>> Signed-off-by: Allen Hubbe <Allen.Hubbe@emc.com>
> Acked-by: Dave Jiang <dave.jiang@intel.com>

Pulled into my ntb brach

>> ---
>>  drivers/ntb/hw/intel/ntb_hw_intel.c | 39
>> ++++++++++++++++++++++++++++++++++++-
>>  1 file changed, 38 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/ntb/hw/intel/ntb_hw_intel.c
>> b/drivers/ntb/hw/intel/ntb_hw_intel.c
>> index 40d04ef5da9e..5efd03705e5c 100644
>> --- a/drivers/ntb/hw/intel/ntb_hw_intel.c
>> +++ b/drivers/ntb/hw/intel/ntb_hw_intel.c
>> @@ -551,13 +551,15 @@ static ssize_t ndev_debugfs_read(struct file
>> *filp, char __user *ubuf,
>>                                size_t count, loff_t *offp)
>>  {
>>       struct intel_ntb_dev *ndev;
>> +     struct pci_dev *pdev;
>>       void __iomem *mmio;
>>       char *buf;
>>       size_t buf_size;
>>       ssize_t ret, off;
>> -     union { u64 v64; u32 v32; u16 v16; } u;
>> +     union { u64 v64; u32 v32; u16 v16; u8 v8; } u;
>>
>>       ndev = filp->private_data;
>> +     pdev = ndev_pdev(ndev);
>>       mmio = ndev->self_mmio;
>>
>>       buf_size = min(count, 0x800ul);
>> @@ -632,6 +634,41 @@ static ssize_t ndev_debugfs_read(struct file
>> *filp, char __user *ubuf,
>>                        "Doorbell Bell -\t\t%#llx\n", u.v64);
>>
>>       off += scnprintf(buf + off, buf_size - off,
>> +                      "\nNTB Window Size:\n");
>> +
>> +     pci_read_config_byte(pdev, XEON_PBAR23SZ_OFFSET, &u.v8);
>> +     off += scnprintf(buf + off, buf_size - off,
>> +                      "PBAR23SZ %hhu\n", u.v8);
>> +     if (!ndev->bar4_split) {
>> +             pci_read_config_byte(pdev, XEON_PBAR45SZ_OFFSET,
>> &u.v8);
>> +             off += scnprintf(buf + off, buf_size - off,
>> +                              "PBAR45SZ %hhu\n", u.v8);
>> +     } else {
>> +             pci_read_config_byte(pdev, XEON_PBAR4SZ_OFFSET,
>> &u.v8);
>> +             off += scnprintf(buf + off, buf_size - off,
>> +                              "PBAR4SZ %hhu\n", u.v8);
>> +             pci_read_config_byte(pdev, XEON_PBAR5SZ_OFFSET,
>> &u.v8);
>> +             off += scnprintf(buf + off, buf_size - off,
>> +                              "PBAR5SZ %hhu\n", u.v8);
>> +     }
>> +
>> +     pci_read_config_byte(pdev, XEON_SBAR23SZ_OFFSET, &u.v8);
>> +     off += scnprintf(buf + off, buf_size - off,
>> +                      "SBAR23SZ %hhu\n", u.v8);
>> +     if (!ndev->bar4_split) {
>> +             pci_read_config_byte(pdev, XEON_SBAR45SZ_OFFSET,
>> &u.v8);
>> +             off += scnprintf(buf + off, buf_size - off,
>> +                              "SBAR45SZ %hhu\n", u.v8);
>> +     } else {
>> +             pci_read_config_byte(pdev, XEON_SBAR4SZ_OFFSET,
>> &u.v8);
>> +             off += scnprintf(buf + off, buf_size - off,
>> +                              "SBAR4SZ %hhu\n", u.v8);
>> +             pci_read_config_byte(pdev, XEON_SBAR5SZ_OFFSET,
>> &u.v8);
>> +             off += scnprintf(buf + off, buf_size - off,
>> +                              "SBAR5SZ %hhu\n", u.v8);
>> +     }
>> +
>> +     off += scnprintf(buf + off, buf_size - off,
>>                        "\nNTB Incoming XLAT:\n");
>>
>>       u.v64 = ioread64(mmio + bar2_off(ndev->xlat_reg->bar2_xlat,
>> 2));

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

end of thread, other threads:[~2016-08-05 14:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-22 13:38 [PATCH 1/2] NTB: ntb_hw_intel: show BAR size in debugfs info Allen Hubbe
2016-07-22 13:38 ` [PATCH 2/2] NTB: ntb_hw_intel: use local variable pdev Allen Hubbe
2016-07-22 16:20   ` Jiang, Dave
2016-07-22 16:19 ` [PATCH 1/2] NTB: ntb_hw_intel: show BAR size in debugfs info Jiang, Dave
2016-08-05 14:35   ` Jon Mason

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.