All of lore.kernel.org
 help / color / mirror / Atom feed
* [for-next 0/2] Broadcom's driver add global atomics
@ 2021-05-17 13:25 Devesh Sharma
  2021-05-17 13:25 ` [for-next 1/2] RDMA/bnxt_re: Enable global atomic ops if platform supports Devesh Sharma
  2021-05-17 13:25 ` [for-next 2/2] bnxt_re: Update maintainers list Devesh Sharma
  0 siblings, 2 replies; 8+ messages in thread
From: Devesh Sharma @ 2021-05-17 13:25 UTC (permalink / raw)
  To: linux-rdma; +Cc: Devesh Sharma

[-- Attachment #1: Type: text/plain, Size: 648 bytes --]

Adding automated detection and enablement of global PCI atomic
operation support.

Devesh Sharma (2):
  RDMA/bnxt_re: Enable global atomic ops if platform supports
  bnxt_re: Update maintainers list

 MAINTAINERS                               |  2 --
 drivers/infiniband/hw/bnxt_re/ib_verbs.c  |  4 ++++
 drivers/infiniband/hw/bnxt_re/main.c      |  4 ++++
 drivers/infiniband/hw/bnxt_re/qplib_res.c | 15 +++++++++++++++
 drivers/infiniband/hw/bnxt_re/qplib_res.h |  1 +
 drivers/infiniband/hw/bnxt_re/qplib_sp.c  | 13 ++++++++++++-
 drivers/infiniband/hw/bnxt_re/qplib_sp.h  |  2 --
 7 files changed, 36 insertions(+), 5 deletions(-)

-- 
2.25.1


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]

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

* [for-next 1/2] RDMA/bnxt_re: Enable global atomic ops if platform supports
  2021-05-17 13:25 [for-next 0/2] Broadcom's driver add global atomics Devesh Sharma
@ 2021-05-17 13:25 ` Devesh Sharma
  2021-05-20  7:50   ` Leon Romanovsky
  2021-05-17 13:25 ` [for-next 2/2] bnxt_re: Update maintainers list Devesh Sharma
  1 sibling, 1 reply; 8+ messages in thread
From: Devesh Sharma @ 2021-05-17 13:25 UTC (permalink / raw)
  To: linux-rdma; +Cc: Devesh Sharma

[-- Attachment #1: Type: text/plain, Size: 4705 bytes --]

Enabling Atomic operations for Gen P5 devices if the underlying
platform supports global atomic ops.

Fixes:7ff662b76167 ("Disable atomic capability on bnxt_re adapters")
Signed-off-by: Devesh Sharma <devesh.sharma@broadcom.com>
---
 drivers/infiniband/hw/bnxt_re/ib_verbs.c  |  4 ++++
 drivers/infiniband/hw/bnxt_re/main.c      |  4 ++++
 drivers/infiniband/hw/bnxt_re/qplib_res.c | 15 +++++++++++++++
 drivers/infiniband/hw/bnxt_re/qplib_res.h |  1 +
 drivers/infiniband/hw/bnxt_re/qplib_sp.c  | 13 ++++++++++++-
 drivers/infiniband/hw/bnxt_re/qplib_sp.h  |  2 --
 6 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
index 2efaa80bfbd2..8194ac52a484 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
@@ -163,6 +163,10 @@ int bnxt_re_query_device(struct ib_device *ibdev,
 	ib_attr->max_qp_init_rd_atom = dev_attr->max_qp_init_rd_atom;
 	ib_attr->atomic_cap = IB_ATOMIC_NONE;
 	ib_attr->masked_atomic_cap = IB_ATOMIC_NONE;
+	if (dev_attr->is_atomic) {
+		ib_attr->atomic_cap = IB_ATOMIC_GLOB;
+		ib_attr->masked_atomic_cap = IB_ATOMIC_GLOB;
+	}
 
 	ib_attr->max_ee_rd_atom = 0;
 	ib_attr->max_res_rd_atom = 0;
diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
index 8bfbf0231a9e..e91e987b7861 100644
--- a/drivers/infiniband/hw/bnxt_re/main.c
+++ b/drivers/infiniband/hw/bnxt_re/main.c
@@ -128,6 +128,10 @@ static int bnxt_re_setup_chip_ctx(struct bnxt_re_dev *rdev, u8 wqe_mode)
 	rdev->rcfw.res = &rdev->qplib_res;
 
 	bnxt_re_set_drv_mode(rdev, wqe_mode);
+	if (bnxt_qplib_enable_atomic_ops_to_root(en_dev->pdev))
+		ibdev_info(&rdev->ibdev,
+			   "platform doesn't support global atomics.");
+
 	return 0;
 }
 
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_res.c b/drivers/infiniband/hw/bnxt_re/qplib_res.c
index 3ca47004b752..d2efb295e0f6 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_res.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_res.c
@@ -959,3 +959,18 @@ int bnxt_qplib_alloc_res(struct bnxt_qplib_res *res, struct pci_dev *pdev,
 	bnxt_qplib_free_res(res);
 	return rc;
 }
+
+bool bnxt_qplib_enable_atomic_ops_to_root(struct pci_dev *dev)
+{
+	u16 ctl2;
+
+	if(pci_enable_atomic_ops_to_root(dev, PCI_EXP_DEVCAP2_ATOMIC_COMP32) &&
+	   pci_enable_atomic_ops_to_root(dev, PCI_EXP_DEVCAP2_ATOMIC_COMP64))
+		return true; /* Failure */
+	pcie_capability_read_word(dev, PCI_EXP_DEVCTL2, &ctl2);
+	if (ctl2 & PCI_EXP_DEVCTL2_ATOMIC_REQ)
+		return 0; /* Success */
+	pcie_capability_set_word(dev, PCI_EXP_DEVCTL2,
+				 PCI_EXP_DEVCTL2_ATOMIC_REQ);
+	return 0; /* Success */
+}
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_res.h b/drivers/infiniband/hw/bnxt_re/qplib_res.h
index 7a1ab38b95da..aca37ee9b710 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_res.h
+++ b/drivers/infiniband/hw/bnxt_re/qplib_res.h
@@ -373,6 +373,7 @@ void bnxt_qplib_free_ctx(struct bnxt_qplib_res *res,
 int bnxt_qplib_alloc_ctx(struct bnxt_qplib_res *res,
 			 struct bnxt_qplib_ctx *ctx,
 			 bool virt_fn, bool is_p5);
+bool bnxt_qplib_enable_atomic_ops_to_root(struct pci_dev *dev);
 
 static inline void bnxt_qplib_hwq_incr_prod(struct bnxt_qplib_hwq *hwq, u32 cnt)
 {
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_sp.c b/drivers/infiniband/hw/bnxt_re/qplib_sp.c
index 049b3576302b..57407be16f27 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_sp.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_sp.c
@@ -54,6 +54,17 @@ const struct bnxt_qplib_gid bnxt_qplib_gid_zero = {{ 0, 0, 0, 0, 0, 0, 0, 0,
 
 /* Device */
 
+static u8 bnxt_qplib_is_atomic_cap(struct bnxt_qplib_rcfw *rcfw)
+{
+	u16 pcie_ctl2 = 0;
+
+	if (!bnxt_qplib_is_chip_gen_p5(rcfw->res->cctx))
+		return false;
+
+	pcie_capability_read_word(rcfw->pdev, PCI_EXP_DEVCTL2, &pcie_ctl2);
+	return (pcie_ctl2 & PCI_EXP_DEVCTL2_ATOMIC_REQ);
+}
+
 static void bnxt_qplib_query_version(struct bnxt_qplib_rcfw *rcfw,
 				     char *fw_ver)
 {
@@ -162,7 +173,7 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw,
 		attr->tqm_alloc_reqs[i * 4 + 3] = *(++tqm_alloc);
 	}
 
-	attr->is_atomic = false;
+	attr->is_atomic = bnxt_qplib_is_atomic_cap(rcfw);
 bail:
 	bnxt_qplib_rcfw_free_sbuf(rcfw, sbuf);
 	return rc;
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_sp.h b/drivers/infiniband/hw/bnxt_re/qplib_sp.h
index bc228340684f..260104783691 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_sp.h
+++ b/drivers/infiniband/hw/bnxt_re/qplib_sp.h
@@ -42,8 +42,6 @@
 
 #define BNXT_QPLIB_RESERVED_QP_WRS	128
 
-#define PCI_EXP_DEVCTL2_ATOMIC_REQ      0x0040
-
 struct bnxt_qplib_dev_attr {
 #define FW_VER_ARR_LEN			4
 	u8				fw_ver[FW_VER_ARR_LEN];
-- 
2.25.1


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]

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

* [for-next 2/2] bnxt_re: Update maintainers list
  2021-05-17 13:25 [for-next 0/2] Broadcom's driver add global atomics Devesh Sharma
  2021-05-17 13:25 ` [for-next 1/2] RDMA/bnxt_re: Enable global atomic ops if platform supports Devesh Sharma
@ 2021-05-17 13:25 ` Devesh Sharma
  1 sibling, 0 replies; 8+ messages in thread
From: Devesh Sharma @ 2021-05-17 13:25 UTC (permalink / raw)
  To: linux-rdma; +Cc: Devesh Sharma

[-- Attachment #1: Type: text/plain, Size: 693 bytes --]

Updated the maintainers list and removed
non-active members.

Signed-off-by: Devesh Sharma <devesh.sharma@broadcom.com>
---
 MAINTAINERS | 2 --
 1 file changed, 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index bd7aff0c120f..786573a556b9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3736,8 +3736,6 @@ F:	drivers/gpio/gpio-bcm-kona.c
 BROADCOM NETXTREME-E ROCE DRIVER
 M:	Selvin Xavier <selvin.xavier@broadcom.com>
 M:	Devesh Sharma <devesh.sharma@broadcom.com>
-M:	Somnath Kotur <somnath.kotur@broadcom.com>
-M:	Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
 M:	Naresh Kumar PBS <nareshkumar.pbs@broadcom.com>
 L:	linux-rdma@vger.kernel.org
 S:	Supported
-- 
2.25.1


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]

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

* Re: [for-next 1/2] RDMA/bnxt_re: Enable global atomic ops if platform supports
  2021-05-17 13:25 ` [for-next 1/2] RDMA/bnxt_re: Enable global atomic ops if platform supports Devesh Sharma
@ 2021-05-20  7:50   ` Leon Romanovsky
  2021-05-21 12:50     ` Devesh Sharma
  0 siblings, 1 reply; 8+ messages in thread
From: Leon Romanovsky @ 2021-05-20  7:50 UTC (permalink / raw)
  To: Devesh Sharma; +Cc: linux-rdma

On Mon, May 17, 2021 at 06:55:21PM +0530, Devesh Sharma wrote:
> Enabling Atomic operations for Gen P5 devices if the underlying
> platform supports global atomic ops.
> 
> Fixes:7ff662b76167 ("Disable atomic capability on bnxt_re adapters")
> Signed-off-by: Devesh Sharma <devesh.sharma@broadcom.com>
> ---
>  drivers/infiniband/hw/bnxt_re/ib_verbs.c  |  4 ++++
>  drivers/infiniband/hw/bnxt_re/main.c      |  4 ++++
>  drivers/infiniband/hw/bnxt_re/qplib_res.c | 15 +++++++++++++++
>  drivers/infiniband/hw/bnxt_re/qplib_res.h |  1 +
>  drivers/infiniband/hw/bnxt_re/qplib_sp.c  | 13 ++++++++++++-
>  drivers/infiniband/hw/bnxt_re/qplib_sp.h  |  2 --
>  6 files changed, 36 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> index 2efaa80bfbd2..8194ac52a484 100644
> --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> @@ -163,6 +163,10 @@ int bnxt_re_query_device(struct ib_device *ibdev,
>  	ib_attr->max_qp_init_rd_atom = dev_attr->max_qp_init_rd_atom;
>  	ib_attr->atomic_cap = IB_ATOMIC_NONE;
>  	ib_attr->masked_atomic_cap = IB_ATOMIC_NONE;
> +	if (dev_attr->is_atomic) {
> +		ib_attr->atomic_cap = IB_ATOMIC_GLOB;
> +		ib_attr->masked_atomic_cap = IB_ATOMIC_GLOB;
> +	}
>  
>  	ib_attr->max_ee_rd_atom = 0;
>  	ib_attr->max_res_rd_atom = 0;
> diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
> index 8bfbf0231a9e..e91e987b7861 100644
> --- a/drivers/infiniband/hw/bnxt_re/main.c
> +++ b/drivers/infiniband/hw/bnxt_re/main.c
> @@ -128,6 +128,10 @@ static int bnxt_re_setup_chip_ctx(struct bnxt_re_dev *rdev, u8 wqe_mode)
>  	rdev->rcfw.res = &rdev->qplib_res;
>  
>  	bnxt_re_set_drv_mode(rdev, wqe_mode);
> +	if (bnxt_qplib_enable_atomic_ops_to_root(en_dev->pdev))
> +		ibdev_info(&rdev->ibdev,
> +			   "platform doesn't support global atomics.");
> +
>  	return 0;
>  }
>  
> diff --git a/drivers/infiniband/hw/bnxt_re/qplib_res.c b/drivers/infiniband/hw/bnxt_re/qplib_res.c
> index 3ca47004b752..d2efb295e0f6 100644
> --- a/drivers/infiniband/hw/bnxt_re/qplib_res.c
> +++ b/drivers/infiniband/hw/bnxt_re/qplib_res.c
> @@ -959,3 +959,18 @@ int bnxt_qplib_alloc_res(struct bnxt_qplib_res *res, struct pci_dev *pdev,
>  	bnxt_qplib_free_res(res);
>  	return rc;
>  }
> +
> +bool bnxt_qplib_enable_atomic_ops_to_root(struct pci_dev *dev)

Why do you need open-coded variant of pci_enable_atomic_ops_to_root()?

Thanks

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

* Re: [for-next 1/2] RDMA/bnxt_re: Enable global atomic ops if platform supports
  2021-05-20  7:50   ` Leon Romanovsky
@ 2021-05-21 12:50     ` Devesh Sharma
  2021-06-01 11:25       ` Leon Romanovsky
  0 siblings, 1 reply; 8+ messages in thread
From: Devesh Sharma @ 2021-05-21 12:50 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: linux-rdma

[-- Attachment #1: Type: text/plain, Size: 2955 bytes --]

On Thu, May 20, 2021 at 1:20 PM Leon Romanovsky <leon@kernel.org> wrote:
>
> On Mon, May 17, 2021 at 06:55:21PM +0530, Devesh Sharma wrote:
> > Enabling Atomic operations for Gen P5 devices if the underlying
> > platform supports global atomic ops.
> >
> > Fixes:7ff662b76167 ("Disable atomic capability on bnxt_re adapters")
> > Signed-off-by: Devesh Sharma <devesh.sharma@broadcom.com>
> > ---
> >  drivers/infiniband/hw/bnxt_re/ib_verbs.c  |  4 ++++
> >  drivers/infiniband/hw/bnxt_re/main.c      |  4 ++++
> >  drivers/infiniband/hw/bnxt_re/qplib_res.c | 15 +++++++++++++++
> >  drivers/infiniband/hw/bnxt_re/qplib_res.h |  1 +
> >  drivers/infiniband/hw/bnxt_re/qplib_sp.c  | 13 ++++++++++++-
> >  drivers/infiniband/hw/bnxt_re/qplib_sp.h  |  2 --
> >  6 files changed, 36 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> > index 2efaa80bfbd2..8194ac52a484 100644
> > --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> > +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> > @@ -163,6 +163,10 @@ int bnxt_re_query_device(struct ib_device *ibdev,
> >       ib_attr->max_qp_init_rd_atom = dev_attr->max_qp_init_rd_atom;
> >       ib_attr->atomic_cap = IB_ATOMIC_NONE;
> >       ib_attr->masked_atomic_cap = IB_ATOMIC_NONE;
> > +     if (dev_attr->is_atomic) {
> > +             ib_attr->atomic_cap = IB_ATOMIC_GLOB;
> > +             ib_attr->masked_atomic_cap = IB_ATOMIC_GLOB;
> > +     }
> >
> >       ib_attr->max_ee_rd_atom = 0;
> >       ib_attr->max_res_rd_atom = 0;
> > diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
> > index 8bfbf0231a9e..e91e987b7861 100644
> > --- a/drivers/infiniband/hw/bnxt_re/main.c
> > +++ b/drivers/infiniband/hw/bnxt_re/main.c
> > @@ -128,6 +128,10 @@ static int bnxt_re_setup_chip_ctx(struct bnxt_re_dev *rdev, u8 wqe_mode)
> >       rdev->rcfw.res = &rdev->qplib_res;
> >
> >       bnxt_re_set_drv_mode(rdev, wqe_mode);
> > +     if (bnxt_qplib_enable_atomic_ops_to_root(en_dev->pdev))
> > +             ibdev_info(&rdev->ibdev,
> > +                        "platform doesn't support global atomics.");
> > +
> >       return 0;
> >  }
> >
> > diff --git a/drivers/infiniband/hw/bnxt_re/qplib_res.c b/drivers/infiniband/hw/bnxt_re/qplib_res.c
> > index 3ca47004b752..d2efb295e0f6 100644
> > --- a/drivers/infiniband/hw/bnxt_re/qplib_res.c
> > +++ b/drivers/infiniband/hw/bnxt_re/qplib_res.c
> > @@ -959,3 +959,18 @@ int bnxt_qplib_alloc_res(struct bnxt_qplib_res *res, struct pci_dev *pdev,
> >       bnxt_qplib_free_res(res);
> >       return rc;
> >  }
> > +
> > +bool bnxt_qplib_enable_atomic_ops_to_root(struct pci_dev *dev)
>
> Why do you need open-coded variant of pci_enable_atomic_ops_to_root()?
That function is trying to write on the device after determination. I
can rename to something else to avoid partial namespace collision, not
a problem
>
> Thanks



-- 
-Regards
Devesh

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]

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

* Re: [for-next 1/2] RDMA/bnxt_re: Enable global atomic ops if platform supports
  2021-05-21 12:50     ` Devesh Sharma
@ 2021-06-01 11:25       ` Leon Romanovsky
  2021-06-01 14:15         ` Devesh Sharma
  0 siblings, 1 reply; 8+ messages in thread
From: Leon Romanovsky @ 2021-06-01 11:25 UTC (permalink / raw)
  To: Devesh Sharma; +Cc: linux-rdma

On Fri, May 21, 2021 at 06:20:35PM +0530, Devesh Sharma wrote:
> On Thu, May 20, 2021 at 1:20 PM Leon Romanovsky <leon@kernel.org> wrote:
> >
> > On Mon, May 17, 2021 at 06:55:21PM +0530, Devesh Sharma wrote:
> > > Enabling Atomic operations for Gen P5 devices if the underlying
> > > platform supports global atomic ops.
> > >
> > > Fixes:7ff662b76167 ("Disable atomic capability on bnxt_re adapters")
> > > Signed-off-by: Devesh Sharma <devesh.sharma@broadcom.com>
> > > ---
> > >  drivers/infiniband/hw/bnxt_re/ib_verbs.c  |  4 ++++
> > >  drivers/infiniband/hw/bnxt_re/main.c      |  4 ++++
> > >  drivers/infiniband/hw/bnxt_re/qplib_res.c | 15 +++++++++++++++
> > >  drivers/infiniband/hw/bnxt_re/qplib_res.h |  1 +
> > >  drivers/infiniband/hw/bnxt_re/qplib_sp.c  | 13 ++++++++++++-
> > >  drivers/infiniband/hw/bnxt_re/qplib_sp.h  |  2 --
> > >  6 files changed, 36 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> > > index 2efaa80bfbd2..8194ac52a484 100644
> > > --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> > > +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> > > @@ -163,6 +163,10 @@ int bnxt_re_query_device(struct ib_device *ibdev,
> > >       ib_attr->max_qp_init_rd_atom = dev_attr->max_qp_init_rd_atom;
> > >       ib_attr->atomic_cap = IB_ATOMIC_NONE;
> > >       ib_attr->masked_atomic_cap = IB_ATOMIC_NONE;
> > > +     if (dev_attr->is_atomic) {
> > > +             ib_attr->atomic_cap = IB_ATOMIC_GLOB;
> > > +             ib_attr->masked_atomic_cap = IB_ATOMIC_GLOB;
> > > +     }
> > >
> > >       ib_attr->max_ee_rd_atom = 0;
> > >       ib_attr->max_res_rd_atom = 0;
> > > diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
> > > index 8bfbf0231a9e..e91e987b7861 100644
> > > --- a/drivers/infiniband/hw/bnxt_re/main.c
> > > +++ b/drivers/infiniband/hw/bnxt_re/main.c
> > > @@ -128,6 +128,10 @@ static int bnxt_re_setup_chip_ctx(struct bnxt_re_dev *rdev, u8 wqe_mode)
> > >       rdev->rcfw.res = &rdev->qplib_res;
> > >
> > >       bnxt_re_set_drv_mode(rdev, wqe_mode);
> > > +     if (bnxt_qplib_enable_atomic_ops_to_root(en_dev->pdev))
> > > +             ibdev_info(&rdev->ibdev,
> > > +                        "platform doesn't support global atomics.");
> > > +
> > >       return 0;
> > >  }
> > >
> > > diff --git a/drivers/infiniband/hw/bnxt_re/qplib_res.c b/drivers/infiniband/hw/bnxt_re/qplib_res.c
> > > index 3ca47004b752..d2efb295e0f6 100644
> > > --- a/drivers/infiniband/hw/bnxt_re/qplib_res.c
> > > +++ b/drivers/infiniband/hw/bnxt_re/qplib_res.c
> > > @@ -959,3 +959,18 @@ int bnxt_qplib_alloc_res(struct bnxt_qplib_res *res, struct pci_dev *pdev,
> > >       bnxt_qplib_free_res(res);
> > >       return rc;
> > >  }
> > > +
> > > +bool bnxt_qplib_enable_atomic_ops_to_root(struct pci_dev *dev)
> >
> > Why do you need open-coded variant of pci_enable_atomic_ops_to_root()?
> That function is trying to write on the device after determination. I
> can rename to something else to avoid partial namespace collision, not
> a problem

I saw same implementation and this was the reason of my question.

Thanks

> >
> > Thanks
> 
> 
> 
> -- 
> -Regards
> Devesh



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

* Re: [for-next 1/2] RDMA/bnxt_re: Enable global atomic ops if platform supports
  2021-06-01 11:25       ` Leon Romanovsky
@ 2021-06-01 14:15         ` Devesh Sharma
  2021-06-01 14:47           ` Leon Romanovsky
  0 siblings, 1 reply; 8+ messages in thread
From: Devesh Sharma @ 2021-06-01 14:15 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: linux-rdma

[-- Attachment #1: Type: text/plain, Size: 3666 bytes --]

On Tue, Jun 1, 2021 at 4:55 PM Leon Romanovsky <leon@kernel.org> wrote:
>
> On Fri, May 21, 2021 at 06:20:35PM +0530, Devesh Sharma wrote:
> > On Thu, May 20, 2021 at 1:20 PM Leon Romanovsky <leon@kernel.org> wrote:
> > >
> > > On Mon, May 17, 2021 at 06:55:21PM +0530, Devesh Sharma wrote:
> > > > Enabling Atomic operations for Gen P5 devices if the underlying
> > > > platform supports global atomic ops.
> > > >
> > > > Fixes:7ff662b76167 ("Disable atomic capability on bnxt_re adapters")
> > > > Signed-off-by: Devesh Sharma <devesh.sharma@broadcom.com>
> > > > ---
> > > >  drivers/infiniband/hw/bnxt_re/ib_verbs.c  |  4 ++++
> > > >  drivers/infiniband/hw/bnxt_re/main.c      |  4 ++++
> > > >  drivers/infiniband/hw/bnxt_re/qplib_res.c | 15 +++++++++++++++
> > > >  drivers/infiniband/hw/bnxt_re/qplib_res.h |  1 +
> > > >  drivers/infiniband/hw/bnxt_re/qplib_sp.c  | 13 ++++++++++++-
> > > >  drivers/infiniband/hw/bnxt_re/qplib_sp.h  |  2 --
> > > >  6 files changed, 36 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> > > > index 2efaa80bfbd2..8194ac52a484 100644
> > > > --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> > > > +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> > > > @@ -163,6 +163,10 @@ int bnxt_re_query_device(struct ib_device *ibdev,
> > > >       ib_attr->max_qp_init_rd_atom = dev_attr->max_qp_init_rd_atom;
> > > >       ib_attr->atomic_cap = IB_ATOMIC_NONE;
> > > >       ib_attr->masked_atomic_cap = IB_ATOMIC_NONE;
> > > > +     if (dev_attr->is_atomic) {
> > > > +             ib_attr->atomic_cap = IB_ATOMIC_GLOB;
> > > > +             ib_attr->masked_atomic_cap = IB_ATOMIC_GLOB;
> > > > +     }
> > > >
> > > >       ib_attr->max_ee_rd_atom = 0;
> > > >       ib_attr->max_res_rd_atom = 0;
> > > > diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
> > > > index 8bfbf0231a9e..e91e987b7861 100644
> > > > --- a/drivers/infiniband/hw/bnxt_re/main.c
> > > > +++ b/drivers/infiniband/hw/bnxt_re/main.c
> > > > @@ -128,6 +128,10 @@ static int bnxt_re_setup_chip_ctx(struct bnxt_re_dev *rdev, u8 wqe_mode)
> > > >       rdev->rcfw.res = &rdev->qplib_res;
> > > >
> > > >       bnxt_re_set_drv_mode(rdev, wqe_mode);
> > > > +     if (bnxt_qplib_enable_atomic_ops_to_root(en_dev->pdev))
> > > > +             ibdev_info(&rdev->ibdev,
> > > > +                        "platform doesn't support global atomics.");
> > > > +
> > > >       return 0;
> > > >  }
> > > >
> > > > diff --git a/drivers/infiniband/hw/bnxt_re/qplib_res.c b/drivers/infiniband/hw/bnxt_re/qplib_res.c
> > > > index 3ca47004b752..d2efb295e0f6 100644
> > > > --- a/drivers/infiniband/hw/bnxt_re/qplib_res.c
> > > > +++ b/drivers/infiniband/hw/bnxt_re/qplib_res.c
> > > > @@ -959,3 +959,18 @@ int bnxt_qplib_alloc_res(struct bnxt_qplib_res *res, struct pci_dev *pdev,
> > > >       bnxt_qplib_free_res(res);
> > > >       return rc;
> > > >  }
> > > > +
> > > > +bool bnxt_qplib_enable_atomic_ops_to_root(struct pci_dev *dev)
> > >
> > > Why do you need open-coded variant of pci_enable_atomic_ops_to_root()?
> > That function is trying to write on the device after determination. I
> > can rename to something else to avoid partial namespace collision, not
> > a problem
>
> I saw same implementation and this was the reason of my question.
I see, you want me to drop a call to  "pcie_capability_set_word(dev,
PCI_EXP_DEVCTL2, PCI_EXP_DEVCTL2_ATOMIC_REQ);"
because this becomes duplicate after pci_enable_atomic_ops_to_root().

>
> Thanks
>
> > >
> > > Thanks
> >
> >
> >
> > --
> > -Regards
> > Devesh
>
>


-- 
-Regards
Devesh

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]

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

* Re: [for-next 1/2] RDMA/bnxt_re: Enable global atomic ops if platform supports
  2021-06-01 14:15         ` Devesh Sharma
@ 2021-06-01 14:47           ` Leon Romanovsky
  0 siblings, 0 replies; 8+ messages in thread
From: Leon Romanovsky @ 2021-06-01 14:47 UTC (permalink / raw)
  To: Devesh Sharma; +Cc: linux-rdma

On Tue, Jun 01, 2021 at 07:45:09PM +0530, Devesh Sharma wrote:
> On Tue, Jun 1, 2021 at 4:55 PM Leon Romanovsky <leon@kernel.org> wrote:
> >
> > On Fri, May 21, 2021 at 06:20:35PM +0530, Devesh Sharma wrote:
> > > On Thu, May 20, 2021 at 1:20 PM Leon Romanovsky <leon@kernel.org> wrote:
> > > >
> > > > On Mon, May 17, 2021 at 06:55:21PM +0530, Devesh Sharma wrote:
> > > > > Enabling Atomic operations for Gen P5 devices if the underlying
> > > > > platform supports global atomic ops.
> > > > >
> > > > > Fixes:7ff662b76167 ("Disable atomic capability on bnxt_re adapters")
> > > > > Signed-off-by: Devesh Sharma <devesh.sharma@broadcom.com>
> > > > > ---
> > > > >  drivers/infiniband/hw/bnxt_re/ib_verbs.c  |  4 ++++
> > > > >  drivers/infiniband/hw/bnxt_re/main.c      |  4 ++++
> > > > >  drivers/infiniband/hw/bnxt_re/qplib_res.c | 15 +++++++++++++++
> > > > >  drivers/infiniband/hw/bnxt_re/qplib_res.h |  1 +
> > > > >  drivers/infiniband/hw/bnxt_re/qplib_sp.c  | 13 ++++++++++++-
> > > > >  drivers/infiniband/hw/bnxt_re/qplib_sp.h  |  2 --
> > > > >  6 files changed, 36 insertions(+), 3 deletions(-)
> > > > >
> > > > > diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> > > > > index 2efaa80bfbd2..8194ac52a484 100644
> > > > > --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> > > > > +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> > > > > @@ -163,6 +163,10 @@ int bnxt_re_query_device(struct ib_device *ibdev,
> > > > >       ib_attr->max_qp_init_rd_atom = dev_attr->max_qp_init_rd_atom;
> > > > >       ib_attr->atomic_cap = IB_ATOMIC_NONE;
> > > > >       ib_attr->masked_atomic_cap = IB_ATOMIC_NONE;
> > > > > +     if (dev_attr->is_atomic) {
> > > > > +             ib_attr->atomic_cap = IB_ATOMIC_GLOB;
> > > > > +             ib_attr->masked_atomic_cap = IB_ATOMIC_GLOB;
> > > > > +     }
> > > > >
> > > > >       ib_attr->max_ee_rd_atom = 0;
> > > > >       ib_attr->max_res_rd_atom = 0;
> > > > > diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
> > > > > index 8bfbf0231a9e..e91e987b7861 100644
> > > > > --- a/drivers/infiniband/hw/bnxt_re/main.c
> > > > > +++ b/drivers/infiniband/hw/bnxt_re/main.c
> > > > > @@ -128,6 +128,10 @@ static int bnxt_re_setup_chip_ctx(struct bnxt_re_dev *rdev, u8 wqe_mode)
> > > > >       rdev->rcfw.res = &rdev->qplib_res;
> > > > >
> > > > >       bnxt_re_set_drv_mode(rdev, wqe_mode);
> > > > > +     if (bnxt_qplib_enable_atomic_ops_to_root(en_dev->pdev))
> > > > > +             ibdev_info(&rdev->ibdev,
> > > > > +                        "platform doesn't support global atomics.");
> > > > > +
> > > > >       return 0;
> > > > >  }
> > > > >
> > > > > diff --git a/drivers/infiniband/hw/bnxt_re/qplib_res.c b/drivers/infiniband/hw/bnxt_re/qplib_res.c
> > > > > index 3ca47004b752..d2efb295e0f6 100644
> > > > > --- a/drivers/infiniband/hw/bnxt_re/qplib_res.c
> > > > > +++ b/drivers/infiniband/hw/bnxt_re/qplib_res.c
> > > > > @@ -959,3 +959,18 @@ int bnxt_qplib_alloc_res(struct bnxt_qplib_res *res, struct pci_dev *pdev,
> > > > >       bnxt_qplib_free_res(res);
> > > > >       return rc;
> > > > >  }
> > > > > +
> > > > > +bool bnxt_qplib_enable_atomic_ops_to_root(struct pci_dev *dev)
> > > >
> > > > Why do you need open-coded variant of pci_enable_atomic_ops_to_root()?
> > > That function is trying to write on the device after determination. I
> > > can rename to something else to avoid partial namespace collision, not
> > > a problem
> >
> > I saw same implementation and this was the reason of my question.
> I see, you want me to drop a call to  "pcie_capability_set_word(dev,
> PCI_EXP_DEVCTL2, PCI_EXP_DEVCTL2_ATOMIC_REQ);"
> because this becomes duplicate after pci_enable_atomic_ops_to_root().

Yes, I think so.

> 
> >
> > Thanks
> >
> > > >
> > > > Thanks
> > >
> > >
> > >
> > > --
> > > -Regards
> > > Devesh
> >
> >
> 
> 
> -- 
> -Regards
> Devesh



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

end of thread, other threads:[~2021-06-01 14:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-17 13:25 [for-next 0/2] Broadcom's driver add global atomics Devesh Sharma
2021-05-17 13:25 ` [for-next 1/2] RDMA/bnxt_re: Enable global atomic ops if platform supports Devesh Sharma
2021-05-20  7:50   ` Leon Romanovsky
2021-05-21 12:50     ` Devesh Sharma
2021-06-01 11:25       ` Leon Romanovsky
2021-06-01 14:15         ` Devesh Sharma
2021-06-01 14:47           ` Leon Romanovsky
2021-05-17 13:25 ` [for-next 2/2] bnxt_re: Update maintainers list Devesh Sharma

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.