diff mbox series

[for-next] RDMA/vmw_pvrdma: Support upto 64-bit PFNs

Message ID 1548479367-18648-1-git-send-email-aditr@vmware.com (mailing list archive)
State Mainlined
Commit 8aa04ad3b39396e315b23448c56d5465200fa777
Delegated to: Jason Gunthorpe
Headers show
Series [for-next] RDMA/vmw_pvrdma: Support upto 64-bit PFNs | expand

Commit Message

Adit Ranadive Jan. 26, 2019, 5:09 a.m. UTC
Update the driver to use the new device capability to report 64-bit
UAR PFNs.

Reviewed-by: Jorgen Hansen <jhansen@vmware.com>
Signed-off-by: Adit Ranadive <aditr@vmware.com>
---
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h | 15 ++++++++++-----
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c    |  6 +++++-
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c   |  7 ++++++-
 3 files changed, 21 insertions(+), 7 deletions(-)

Comments

Vishnu Dasa Jan. 28, 2019, 7:55 p.m. UTC | #1
LGTM!

Reviewed-by: Vishnu Dasa <vdasa@vmware.com>

On 1/25/19, 9:09 PM, "Adit Ranadive" <aditr@vmware.com> wrote:

    Update the driver to use the new device capability to report 64-bit
    UAR PFNs.
    
    Reviewed-by: Jorgen Hansen <jhansen@vmware.com>
    Signed-off-by: Adit Ranadive <aditr@vmware.com>
    ---
     drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h | 15 ++++++++++-----
     drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c    |  6 +++++-
     drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c   |  7 ++++++-
     3 files changed, 21 insertions(+), 7 deletions(-)
    
    diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h
    index 6fd5a8f4e2f6..8f9749d54688 100644
    --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h
    +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h
    @@ -57,7 +57,8 @@
     
     #define PVRDMA_ROCEV1_VERSION		17
     #define PVRDMA_ROCEV2_VERSION		18
    -#define PVRDMA_VERSION			PVRDMA_ROCEV2_VERSION
    +#define PVRDMA_PPN64_VERSION		19
    +#define PVRDMA_VERSION			PVRDMA_PPN64_VERSION
     
     #define PVRDMA_BOARD_ID			1
     #define PVRDMA_REV_ID			1
    @@ -279,8 +280,10 @@ struct pvrdma_device_shared_region {
     						/* W: Async ring page info. */
     	struct pvrdma_ring_page_info cq_ring_pages;
     						/* W: CQ ring page info. */
    -	u32 uar_pfn;				/* W: UAR pageframe. */
    -	u32 pad2;				/* Pad to 8-byte align. */
    +	union {
    +		u32 uar_pfn;			/* W: UAR pageframe. */
    +		u64 uar_pfn64;			/* W: 64-bit UAR page frame. */
    +	};
     	struct pvrdma_device_caps caps;		/* R: Device capabilities. */
     };
     
    @@ -411,8 +414,10 @@ struct pvrdma_cmd_query_pkey_resp {
     
     struct pvrdma_cmd_create_uc {
     	struct pvrdma_cmd_hdr hdr;
    -	u32 pfn; /* UAR page frame number */
    -	u8 reserved[4];
    +	union {
    +		u32 pfn; /* UAR page frame number */
    +		u64 pfn64; /* 64-bit UAR page frame number */
    +	};
     };
     
     struct pvrdma_cmd_create_uc_resp {
    diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
    index 1bc415483d9b..7d91640e9311 100644
    --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
    +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
    @@ -905,7 +905,11 @@ static int pvrdma_pci_probe(struct pci_dev *pdev,
     		PVRDMA_GOS_BITS_64;
     	dev->dsr->gos_info.gos_type = PVRDMA_GOS_TYPE_LINUX;
     	dev->dsr->gos_info.gos_ver = 1;
    -	dev->dsr->uar_pfn = dev->driver_uar.pfn;
    +
    +	if (dev->dsr_version < PVRDMA_PPN64_VERSION)
    +		dev->dsr->uar_pfn = dev->driver_uar.pfn;
    +	else
    +		dev->dsr->uar_pfn64 = dev->driver_uar.pfn;
     
     	/* Command slot. */
     	dev->cmd_slot = dma_alloc_coherent(&pdev->dev, PAGE_SIZE,
    diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c
    index e10149248ce2..fafb2add3b44 100644
    --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c
    +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c
    @@ -340,7 +340,12 @@ struct ib_ucontext *pvrdma_alloc_ucontext(struct ib_device *ibdev,
     
     	/* get ctx_handle from host */
     	memset(cmd, 0, sizeof(*cmd));
    -	cmd->pfn = context->uar.pfn;
    +
    +	if (vdev->dsr_version < PVRDMA_PPN64_VERSION)
    +		cmd->pfn = context->uar.pfn;
    +	else
    +		cmd->pfn64 = context->uar.pfn;
    +
     	cmd->hdr.cmd = PVRDMA_CMD_CREATE_UC;
     	ret = pvrdma_cmd_post(vdev, &req, &rsp, PVRDMA_CMD_CREATE_UC_RESP);
     	if (ret < 0) {
    -- 
    1.8.3.1
Jason Gunthorpe Jan. 30, 2019, 4:41 a.m. UTC | #2
On Sat, Jan 26, 2019 at 05:09:36AM +0000, Adit Ranadive wrote:
> Update the driver to use the new device capability to report 64-bit
> UAR PFNs.
> 
> Reviewed-by: Jorgen Hansen <jhansen@vmware.com>
> Signed-off-by: Adit Ranadive <aditr@vmware.com>
> Reviewed-by: Vishnu Dasa <vdasa@vmware.com>
> ---
>  drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h | 15 ++++++++++-----
>  drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c    |  6 +++++-
>  drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c   |  7 ++++++-
>  3 files changed, 21 insertions(+), 7 deletions(-)

Applied to for-next

Thanks,
Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h
index 6fd5a8f4e2f6..8f9749d54688 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h
@@ -57,7 +57,8 @@ 
 
 #define PVRDMA_ROCEV1_VERSION		17
 #define PVRDMA_ROCEV2_VERSION		18
-#define PVRDMA_VERSION			PVRDMA_ROCEV2_VERSION
+#define PVRDMA_PPN64_VERSION		19
+#define PVRDMA_VERSION			PVRDMA_PPN64_VERSION
 
 #define PVRDMA_BOARD_ID			1
 #define PVRDMA_REV_ID			1
@@ -279,8 +280,10 @@  struct pvrdma_device_shared_region {
 						/* W: Async ring page info. */
 	struct pvrdma_ring_page_info cq_ring_pages;
 						/* W: CQ ring page info. */
-	u32 uar_pfn;				/* W: UAR pageframe. */
-	u32 pad2;				/* Pad to 8-byte align. */
+	union {
+		u32 uar_pfn;			/* W: UAR pageframe. */
+		u64 uar_pfn64;			/* W: 64-bit UAR page frame. */
+	};
 	struct pvrdma_device_caps caps;		/* R: Device capabilities. */
 };
 
@@ -411,8 +414,10 @@  struct pvrdma_cmd_query_pkey_resp {
 
 struct pvrdma_cmd_create_uc {
 	struct pvrdma_cmd_hdr hdr;
-	u32 pfn; /* UAR page frame number */
-	u8 reserved[4];
+	union {
+		u32 pfn; /* UAR page frame number */
+		u64 pfn64; /* 64-bit UAR page frame number */
+	};
 };
 
 struct pvrdma_cmd_create_uc_resp {
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
index 1bc415483d9b..7d91640e9311 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
@@ -905,7 +905,11 @@  static int pvrdma_pci_probe(struct pci_dev *pdev,
 		PVRDMA_GOS_BITS_64;
 	dev->dsr->gos_info.gos_type = PVRDMA_GOS_TYPE_LINUX;
 	dev->dsr->gos_info.gos_ver = 1;
-	dev->dsr->uar_pfn = dev->driver_uar.pfn;
+
+	if (dev->dsr_version < PVRDMA_PPN64_VERSION)
+		dev->dsr->uar_pfn = dev->driver_uar.pfn;
+	else
+		dev->dsr->uar_pfn64 = dev->driver_uar.pfn;
 
 	/* Command slot. */
 	dev->cmd_slot = dma_alloc_coherent(&pdev->dev, PAGE_SIZE,
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c
index e10149248ce2..fafb2add3b44 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c
@@ -340,7 +340,12 @@  struct ib_ucontext *pvrdma_alloc_ucontext(struct ib_device *ibdev,
 
 	/* get ctx_handle from host */
 	memset(cmd, 0, sizeof(*cmd));
-	cmd->pfn = context->uar.pfn;
+
+	if (vdev->dsr_version < PVRDMA_PPN64_VERSION)
+		cmd->pfn = context->uar.pfn;
+	else
+		cmd->pfn64 = context->uar.pfn;
+
 	cmd->hdr.cmd = PVRDMA_CMD_CREATE_UC;
 	ret = pvrdma_cmd_post(vdev, &req, &rsp, PVRDMA_CMD_CREATE_UC_RESP);
 	if (ret < 0) {