Skip to contentSkip to conversation

EFA host information

PATCH Applied Gal Pressman 2 participants 9 messages May 12, 2020 – May 21, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover EFA host information

Hello,

This submission adds support for host information report to the EFA device. The feature allows the driver to inform the EFA device firmware with system configuration used for debugging and troubleshooting purposes.

Changelog -
v1->v2: https://lore.kernel.org/linux-rdma/[email protected]/
* Added #include <linux/version.h> (reported by kbuild test robot)
* Remove unused values per Leon's request
* Explicitly set all fields in the host info buffer

Gal Pressman (2):
RDMA/efa: Fix setting of wrong bit in get/set_feature commands RDMA/efa: Report host information to the device

 .../infiniband/hw/efa/efa_admin_cmds_defs.h   | 63 ++++++++++++++++++-
 drivers/infiniband/hw/efa/efa_com_cmd.c       | 18 +++---
 drivers/infiniband/hw/efa/efa_com_cmd.h       | 11 +++-
 drivers/infiniband/hw/efa/efa_main.c          | 52 ++++++++++++++-
 4 files changed, 132 insertions(+), 12 deletions(-)
Signature · 1 line
2.26.2
#1 lore raw

PATCH v2 1/2 RDMA/efa: Fix setting of wrong bit in get/set_feature commands

When using a control buffer the ctrl_data bit should be set in order to indicate the control buffer address is valid, not ctrl_data_indirect which is used when the control buffer itself is indirect.

---
 drivers/infiniband/hw/efa/efa_com_cmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/efa/efa_com_cmd.c +2 -2
index eea5574a62e8..69f842c92ff6 100644
@@ -388,7 +388,7 @@ static int efa_com_get_feature_ex(struct efa_com_dev *edev,
 
 	if (control_buff_size)
 		EFA_SET(&get_cmd.aq_common_descriptor.flags,
-			EFA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT, 1);
+			EFA_ADMIN_AQ_COMMON_DESC_CTRL_DATA, 1);
 
 	efa_com_set_dma_addr(control_buf_dma_addr,
 			     &get_cmd.control_buffer.address.mem_addr_high,
@@ -540,7 +540,7 @@ static int efa_com_set_feature_ex(struct efa_com_dev *edev,
 	if (control_buff_size) {
 		set_cmd->aq_common_descriptor.flags = 0;
 		EFA_SET(&set_cmd->aq_common_descriptor.flags,
-			EFA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT, 1);
+			EFA_ADMIN_AQ_COMMON_DESC_CTRL_DATA, 1);
 		efa_com_set_dma_addr(control_buf_dma_addr,
 				     &set_cmd->control_buffer.address.mem_addr_high,
 				     &set_cmd->control_buffer.address.mem_addr_low);
Signature · 1 line
2.26.2
#2 lore raw

Re: [PATCH for-next v2 1/2] RDMA/efa: Fix setting of wrong bit in get/set_feature commands

Quoted 10 lines · Gal Pressman

When using a control buffer the ctrl_data bit should be set in order to indicate the control buffer address is valid, not ctrl_data_indirect which is used when the control buffer itself is indirect.

---
 drivers/infiniband/hw/efa/efa_com_cmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

No fixes line??

Jason

#3 lore raw

Re: [PATCH for-next v2 1/2] RDMA/efa: Fix setting of wrong bit in get/set_feature commands

Quoted 5 lines · Jason Gunthorpe
Quoted 4 lines · Gal Pressman

When using a control buffer the ctrl_data bit should be set in order to indicate the control buffer address is valid, not ctrl_data_indirect which is used when the control buffer itself is indirect.

Quoted 8 lines
Quoted 6 lines
---
 drivers/infiniband/hw/efa/efa_com_cmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

No fixes line??

The reason I didn't add a fixes line (and sent it to for-next) is that it turns out this is the first set feature command to use a control buffer so nothing was broken, but this is necessary for patch #2 to work.

#4 lore raw

Re: [PATCH for-next v2 1/2] RDMA/efa: Fix setting of wrong bit in get/set_feature commands

Quoted 12 lines · Gal Pressman
Quoted 11 lines · Jason Gunthorpe
Quoted 9 lines · Gal Pressman

When using a control buffer the ctrl_data bit should be set in order to indicate the control buffer address is valid, not ctrl_data_indirect which is used when the control buffer itself is indirect.

 drivers/infiniband/hw/efa/efa_com_cmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 5 lines
Quoted 1 line

No fixes line??

The reason I didn't add a fixes line (and sent it to for-next) is that it turns out this is the first set feature command to use a control buffer so nothing was broken, but this is necessary for patch #2 to work.

It should probably still have a fixes line in case someone decided to backport the 2nd patch. But applied without

Jason

#5 lore raw

Re: [PATCH for-next v2 1/2] RDMA/efa: Fix setting of wrong bit in get/set_feature commands

Quoted 13 lines · Jason Gunthorpe
Quoted 12 lines · Gal Pressman
Quoted 11 lines · Jason Gunthorpe
Quoted 9 lines · Gal Pressman

When using a control buffer the ctrl_data bit should be set in order to indicate the control buffer address is valid, not ctrl_data_indirect which is used when the control buffer itself is indirect.

 drivers/infiniband/hw/efa/efa_com_cmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

No fixes line??

The reason I didn't add a fixes line (and sent it to for-next) is that it turns out this is the first set feature command to use a control buffer so nothing was broken, but this is necessary for patch #2 to work.

It should probably still have a fixes line in case someone decided to backport the 2nd patch. But applied without

Hmm, you're right.
If it isn't too late:

Fixes e9c6c5373088 ("RDMA/efa: Add common command handlers")

Thanks

#6 lore raw

Re: [PATCH for-next v2 1/2] RDMA/efa: Fix setting of wrong bit in get/set_feature commands

Quoted 20 lines · Gal Pressman
Quoted 19 lines · Jason Gunthorpe
Quoted 17 lines · Gal Pressman
Quoted 5 lines · Jason Gunthorpe
Quoted 4 lines · Gal Pressman

When using a control buffer the ctrl_data bit should be set in order to indicate the control buffer address is valid, not ctrl_data_indirect which is used when the control buffer itself is indirect.

Quoted 7 lines
Quoted 5 lines
 drivers/infiniband/hw/efa/efa_com_cmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

No fixes line??

The reason I didn't add a fixes line (and sent it to for-next) is that it turns out this is the first set feature command to use a control buffer so nothing was broken, but this is necessary for patch #2 to work.

Quoted 6 lines
Quoted 2 lines

It should probably still have a fixes line in case someone decided to backport the 2nd patch. But applied without

Hmm, you're right.
If it isn't too late:

Fixes e9c6c5373088 ("RDMA/efa: Add common command handlers")

Okay done

Jason

#7 lore raw

PATCH v2 2/2 RDMA/efa: Report host information to the device

In reply to Gal Pressman

The host info feature allows the driver to infrom the EFA device firmware with system configuration for debugging and troubleshooting purposes.

The host info buffer is passed as an admin command DMA mapped control buffer, and is unmapped and freed once the command CQE is consumed.

Currently, the setting of host info is done for each device on its probe. Failing to set the host info for the device shall not disturb the probe flow, any errors will be discarded.

---
 .../infiniband/hw/efa/efa_admin_cmds_defs.h   | 63 ++++++++++++++++++-
 drivers/infiniband/hw/efa/efa_com_cmd.c       | 14 ++---
 drivers/infiniband/hw/efa/efa_com_cmd.h       | 11 +++-
 drivers/infiniband/hw/efa/efa_main.c          | 52 ++++++++++++++-
 4 files changed, 130 insertions(+), 10 deletions(-)
drivers/infiniband/hw/efa/efa_admin_cmds_defs.h +62 -1
index 96b104ab5415..bef2bd291054 100644
@@ -37,7 +37,7 @@ enum efa_admin_aq_feature_id {
 	EFA_ADMIN_NETWORK_ATTR                      = 3,
 	EFA_ADMIN_QUEUE_ATTR                        = 4,
 	EFA_ADMIN_HW_HINTS                          = 5,
-	EFA_ADMIN_FEATURES_OPCODE_NUM               = 8,
+	EFA_ADMIN_HOST_INFO                         = 6,
 };
 
 /* QP transport type */
@@ -799,6 +799,54 @@ struct efa_admin_mmio_req_read_less_resp {
 	u32 reg_val;
 };
 
+enum efa_admin_os_type {
+	EFA_ADMIN_OS_LINUX                          = 0,
+};
+
+struct efa_admin_host_info {
+	/* OS distribution string format */
+	u8 os_dist_str[128];
+
+	/* Defined in enum efa_admin_os_type */
+	u32 os_type;
+
+	/* Kernel version string format */
+	u8 kernel_ver_str[32];
+
+	/* Kernel version numeric format */
+	u32 kernel_ver;
+
+	/*
+	 * 7:0 : driver_module_type
+	 * 15:8 : driver_sub_minor
+	 * 23:16 : driver_minor
+	 * 31:24 : driver_major
+	 */
+	u32 driver_ver;
+
+	/*
+	 * Device's Bus, Device and Function
+	 * 2:0 : function
+	 * 7:3 : device
+	 * 15:8 : bus
+	 */
+	u16 bdf;
+
+	/*
+	 * Spec version
+	 * 7:0 : spec_minor
+	 * 15:8 : spec_major
+	 */
+	u16 spec_ver;
+
+	/*
+	 * 0 : intree - Intree driver
+	 * 1 : gdr - GPUDirect RDMA supported
+	 * 31:2 : reserved2
+	 */
+	u32 flags;
+};
+
 /* create_qp_cmd */
 #define EFA_ADMIN_CREATE_QP_CMD_SQ_VIRT_MASK                BIT(0)
 #define EFA_ADMIN_CREATE_QP_CMD_RQ_VIRT_MASK                BIT(1)
@@ -820,4 +868,17 @@ struct efa_admin_mmio_req_read_less_resp {
 /* feature_device_attr_desc */
 #define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_RDMA_READ_MASK   BIT(0)
 
+/* host_info */
+#define EFA_ADMIN_HOST_INFO_DRIVER_MODULE_TYPE_MASK         GENMASK(7, 0)
+#define EFA_ADMIN_HOST_INFO_DRIVER_SUB_MINOR_MASK           GENMASK(15, 8)
+#define EFA_ADMIN_HOST_INFO_DRIVER_MINOR_MASK               GENMASK(23, 16)
+#define EFA_ADMIN_HOST_INFO_DRIVER_MAJOR_MASK               GENMASK(31, 24)
+#define EFA_ADMIN_HOST_INFO_FUNCTION_MASK                   GENMASK(2, 0)
+#define EFA_ADMIN_HOST_INFO_DEVICE_MASK                     GENMASK(7, 3)
+#define EFA_ADMIN_HOST_INFO_BUS_MASK                        GENMASK(15, 8)
+#define EFA_ADMIN_HOST_INFO_SPEC_MINOR_MASK                 GENMASK(7, 0)
+#define EFA_ADMIN_HOST_INFO_SPEC_MAJOR_MASK                 GENMASK(15, 8)
+#define EFA_ADMIN_HOST_INFO_INTREE_MASK                     BIT(0)
+#define EFA_ADMIN_HOST_INFO_GDR_MASK                        BIT(1)
+
 #endif /* _EFA_ADMIN_CMDS_H_ */
drivers/infiniband/hw/efa/efa_com_cmd.c +7 -7
index 69f842c92ff6..fabd8df2e78f 100644
@@ -351,7 +351,7 @@ int efa_com_destroy_ah(struct efa_com_dev *edev,
 	return 0;
 }
 
-static bool
+bool
 efa_com_check_supported_feature_id(struct efa_com_dev *edev,
 				   enum efa_admin_aq_feature_id feature_id)
 {
@@ -517,12 +517,12 @@ int efa_com_get_hw_hints(struct efa_com_dev *edev,
 	return 0;
 }
 
-static int efa_com_set_feature_ex(struct efa_com_dev *edev,
-				  struct efa_admin_set_feature_resp *set_resp,
-				  struct efa_admin_set_feature_cmd *set_cmd,
-				  enum efa_admin_aq_feature_id feature_id,
-				  dma_addr_t control_buf_dma_addr,
-				  u32 control_buff_size)
+int efa_com_set_feature_ex(struct efa_com_dev *edev,
+			   struct efa_admin_set_feature_resp *set_resp,
+			   struct efa_admin_set_feature_cmd *set_cmd,
+			   enum efa_admin_aq_feature_id feature_id,
+			   dma_addr_t control_buf_dma_addr,
+			   u32 control_buff_size)
 {
 	struct efa_com_admin_queue *aq;
 	int err;
drivers/infiniband/hw/efa/efa_com_cmd.h +10 -1
index 31db5a0cbd5b..41ce4a476ee6 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
 /*
- * Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All rights reserved.
+ * Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All rights reserved.
  */
 
 #ifndef _EFA_COM_CMD_H_
@@ -270,6 +270,15 @@ int efa_com_get_device_attr(struct efa_com_dev *edev,
 			    struct efa_com_get_device_attr_result *result);
 int efa_com_get_hw_hints(struct efa_com_dev *edev,
 			 struct efa_com_get_hw_hints_result *result);
+bool
+efa_com_check_supported_feature_id(struct efa_com_dev *edev,
+				   enum efa_admin_aq_feature_id feature_id);
+int efa_com_set_feature_ex(struct efa_com_dev *edev,
+			   struct efa_admin_set_feature_resp *set_resp,
+			   struct efa_admin_set_feature_cmd *set_cmd,
+			   enum efa_admin_aq_feature_id feature_id,
+			   dma_addr_t control_buf_dma_addr,
+			   u32 control_buff_size);
 int efa_com_set_aenq_config(struct efa_com_dev *edev, u32 groups);
 int efa_com_alloc_pd(struct efa_com_dev *edev,
 		     struct efa_com_alloc_pd_result *result);
drivers/infiniband/hw/efa/efa_main.c +51 -1

73 lines not on this page · raw message

Signature · 1 line
2.26.2
#8 lore raw

Re: [PATCH for-next v2 2/2] RDMA/efa: Report host information to the device

Quoted 14 lines · Gal Pressman

The host info feature allows the driver to infrom the EFA device firmware with system configuration for debugging and troubleshooting purposes.

The host info buffer is passed as an admin command DMA mapped control buffer, and is unmapped and freed once the command CQE is consumed.

Currently, the setting of host info is done for each device on its probe. Failing to set the host info for the device shall not disturb the probe flow, any errors will be discarded.

Quoted 6 lines
---
 .../infiniband/hw/efa/efa_admin_cmds_defs.h   | 63 ++++++++++++++++++-
 drivers/infiniband/hw/efa/efa_com_cmd.c       | 14 ++---
 drivers/infiniband/hw/efa/efa_com_cmd.h       | 11 +++-
 drivers/infiniband/hw/efa/efa_main.c          | 52 ++++++++++++++-
 4 files changed, 130 insertions(+), 10 deletions(-)

Applied to for-next, thanks

Jason