All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-next 0/2] EFA host information
@ 2020-05-10 11:59 Gal Pressman
  2020-05-10 11:59 ` [PATCH for-next 1/2] RDMA/efa: Fix setting of wrong bit in get/set_feature commands Gal Pressman
  2020-05-10 11:59 ` [PATCH for-next 2/2] RDMA/efa: Report host information to the device Gal Pressman
  0 siblings, 2 replies; 14+ messages in thread
From: Gal Pressman @ 2020-05-10 11:59 UTC (permalink / raw)
  To: Jason Gunthorpe, Doug Ledford
  Cc: linux-rdma, Alexander Matushevsky, Gal Pressman

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.

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   | 64 ++++++++++++++++++-
 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          | 46 ++++++++++++-
 4 files changed, 127 insertions(+), 12 deletions(-)


base-commit: a97bf49f824e357f1cc5d292e247d05271d32afe
-- 
2.26.2


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

* [PATCH for-next 1/2] RDMA/efa: Fix setting of wrong bit in get/set_feature commands
  2020-05-10 11:59 [PATCH for-next 0/2] EFA host information Gal Pressman
@ 2020-05-10 11:59 ` Gal Pressman
  2020-05-10 11:59 ` [PATCH for-next 2/2] RDMA/efa: Report host information to the device Gal Pressman
  1 sibling, 0 replies; 14+ messages in thread
From: Gal Pressman @ 2020-05-10 11:59 UTC (permalink / raw)
  To: Jason Gunthorpe, Doug Ledford
  Cc: linux-rdma, Alexander Matushevsky, Gal Pressman, Firas JahJah,
	Yossi Leybovich

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.

Reviewed-by: Firas JahJah <firasj@amazon.com>
Reviewed-by: Yossi Leybovich <sleybo@amazon.com>
Signed-off-by: Gal Pressman <galpress@amazon.com>
---
 drivers/infiniband/hw/efa/efa_com_cmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/efa/efa_com_cmd.c b/drivers/infiniband/hw/efa/efa_com_cmd.c
index eea5574a62e8..69f842c92ff6 100644
--- a/drivers/infiniband/hw/efa/efa_com_cmd.c
+++ b/drivers/infiniband/hw/efa/efa_com_cmd.c
@@ -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);
-- 
2.26.2


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

* [PATCH for-next 2/2] RDMA/efa: Report host information to the device
  2020-05-10 11:59 [PATCH for-next 0/2] EFA host information Gal Pressman
  2020-05-10 11:59 ` [PATCH for-next 1/2] RDMA/efa: Fix setting of wrong bit in get/set_feature commands Gal Pressman
@ 2020-05-10 11:59 ` Gal Pressman
  2020-05-10 12:29   ` Leon Romanovsky
  2020-05-10 13:42     ` kbuild test robot
  1 sibling, 2 replies; 14+ messages in thread
From: Gal Pressman @ 2020-05-10 11:59 UTC (permalink / raw)
  To: Jason Gunthorpe, Doug Ledford
  Cc: linux-rdma, Alexander Matushevsky, Gal Pressman, Firas JahJah,
	Guy Tzalik

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.

Reviewed-by: Firas JahJah <firasj@amazon.com>
Reviewed-by: Guy Tzalik <gtzalik@amazon.com>
Signed-off-by: Gal Pressman <galpress@amazon.com>
---
 .../infiniband/hw/efa/efa_admin_cmds_defs.h   | 64 ++++++++++++++++++-
 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          | 46 ++++++++++++-
 4 files changed, 125 insertions(+), 10 deletions(-)

diff --git a/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h b/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
index 96b104ab5415..efdeebc9ea9b 100644
--- a/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
+++ b/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
@@ -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,55 @@ struct efa_admin_mmio_req_read_less_resp {
 	u32 reg_val;
 };
 
+enum efa_admin_os_type {
+	EFA_ADMIN_OS_LINUX                          = 0,
+	EFA_ADMIN_OS_WINDOWS                        = 1,
+};
+
+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 +869,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_ */
diff --git a/drivers/infiniband/hw/efa/efa_com_cmd.c b/drivers/infiniband/hw/efa/efa_com_cmd.c
index 69f842c92ff6..fabd8df2e78f 100644
--- a/drivers/infiniband/hw/efa/efa_com_cmd.c
+++ b/drivers/infiniband/hw/efa/efa_com_cmd.c
@@ -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;
diff --git a/drivers/infiniband/hw/efa/efa_com_cmd.h b/drivers/infiniband/hw/efa/efa_com_cmd.h
index 31db5a0cbd5b..41ce4a476ee6 100644
--- a/drivers/infiniband/hw/efa/efa_com_cmd.h
+++ b/drivers/infiniband/hw/efa/efa_com_cmd.h
@@ -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);
diff --git a/drivers/infiniband/hw/efa/efa_main.c b/drivers/infiniband/hw/efa/efa_main.c
index faf3ff1bca2a..f5ef7262683d 100644
--- a/drivers/infiniband/hw/efa/efa_main.c
+++ b/drivers/infiniband/hw/efa/efa_main.c
@@ -1,10 +1,11 @@
 // 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.
  */
 
 #include <linux/module.h>
 #include <linux/pci.h>
+#include <linux/utsname.h>
 
 #include <rdma/ib_user_verbs.h>
 
@@ -187,6 +188,47 @@ static void efa_stats_init(struct efa_dev *dev)
 		atomic64_set(s, 0);
 }
 
+static void efa_set_host_info(struct efa_dev *dev)
+{
+	struct efa_admin_set_feature_resp resp = {};
+	struct efa_admin_set_feature_cmd cmd = {};
+	struct efa_admin_host_info *hinf;
+	u32 bufsz = sizeof(*hinf);
+	dma_addr_t hinf_dma;
+
+	if (!efa_com_check_supported_feature_id(&dev->edev,
+						EFA_ADMIN_HOST_INFO))
+		return;
+
+	/* Failures in host info set shall not disturb probe */
+	hinf = dma_alloc_coherent(&dev->pdev->dev, bufsz, &hinf_dma,
+				  GFP_KERNEL);
+	if (!hinf)
+		return;
+
+	strlcpy(hinf->os_dist_str, utsname()->release,
+		min(sizeof(hinf->os_dist_str), sizeof(utsname()->release)));
+	hinf->os_type = EFA_ADMIN_OS_LINUX;
+	strlcpy(hinf->kernel_ver_str, utsname()->version,
+		min(sizeof(hinf->kernel_ver_str), sizeof(utsname()->version)));
+	hinf->kernel_ver = LINUX_VERSION_CODE;
+	EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_BUS, dev->pdev->bus->number);
+	EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_DEVICE,
+		PCI_SLOT(dev->pdev->devfn));
+	EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_FUNCTION,
+		PCI_FUNC(dev->pdev->devfn));
+	EFA_SET(&hinf->spec_ver, EFA_ADMIN_HOST_INFO_SPEC_MAJOR,
+		EFA_COMMON_SPEC_VERSION_MAJOR);
+	EFA_SET(&hinf->spec_ver, EFA_ADMIN_HOST_INFO_SPEC_MINOR,
+		EFA_COMMON_SPEC_VERSION_MINOR);
+	EFA_SET(&hinf->flags, EFA_ADMIN_HOST_INFO_INTREE, 1);
+
+	efa_com_set_feature_ex(&dev->edev, &resp, &cmd, EFA_ADMIN_HOST_INFO,
+			       hinf_dma, bufsz);
+
+	dma_free_coherent(&dev->pdev->dev, bufsz, hinf, hinf_dma);
+}
+
 static const struct ib_device_ops efa_dev_ops = {
 	.owner = THIS_MODULE,
 	.driver_id = RDMA_DRIVER_EFA,
@@ -251,6 +293,8 @@ static int efa_ib_device_add(struct efa_dev *dev)
 	if (err)
 		goto err_release_doorbell_bar;
 
+	efa_set_host_info(dev);
+
 	dev->ibdev.node_type = RDMA_NODE_UNSPECIFIED;
 	dev->ibdev.phys_port_cnt = 1;
 	dev->ibdev.num_comp_vectors = 1;
-- 
2.26.2


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

* Re: [PATCH for-next 2/2] RDMA/efa: Report host information to the device
  2020-05-10 11:59 ` [PATCH for-next 2/2] RDMA/efa: Report host information to the device Gal Pressman
@ 2020-05-10 12:29   ` Leon Romanovsky
  2020-05-10 13:05     ` Gal Pressman
  2020-05-10 13:42     ` kbuild test robot
  1 sibling, 1 reply; 14+ messages in thread
From: Leon Romanovsky @ 2020-05-10 12:29 UTC (permalink / raw)
  To: Gal Pressman
  Cc: Jason Gunthorpe, Doug Ledford, linux-rdma, Alexander Matushevsky,
	Firas JahJah, Guy Tzalik

On Sun, May 10, 2020 at 02:59:18PM +0300, Gal Pressman wrote:
> 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.
>
> Reviewed-by: Firas JahJah <firasj@amazon.com>
> Reviewed-by: Guy Tzalik <gtzalik@amazon.com>
> Signed-off-by: Gal Pressman <galpress@amazon.com>
> ---
>  .../infiniband/hw/efa/efa_admin_cmds_defs.h   | 64 ++++++++++++++++++-
>  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          | 46 ++++++++++++-
>  4 files changed, 125 insertions(+), 10 deletions(-)

I'm aware that you took the code from ENA which already has this logic
and it makes me sad to think about how much private data is leaked from
my personal VM in Amazon cloud to other parties.

>
> diff --git a/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h b/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
> index 96b104ab5415..efdeebc9ea9b 100644
> --- a/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
> +++ b/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
> @@ -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,55 @@ struct efa_admin_mmio_req_read_less_resp {
>  	u32 reg_val;
>  };
>
> +enum efa_admin_os_type {
> +	EFA_ADMIN_OS_LINUX                          = 0,
> +	EFA_ADMIN_OS_WINDOWS                        = 1,

Not used.

> +};
> +
> +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;

No to this.

> +
> +	/*
> +	 * 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 +869,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)

Not in use.

> +#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_ */
> diff --git a/drivers/infiniband/hw/efa/efa_com_cmd.c b/drivers/infiniband/hw/efa/efa_com_cmd.c
> index 69f842c92ff6..fabd8df2e78f 100644
> --- a/drivers/infiniband/hw/efa/efa_com_cmd.c
> +++ b/drivers/infiniband/hw/efa/efa_com_cmd.c
> @@ -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;
> diff --git a/drivers/infiniband/hw/efa/efa_com_cmd.h b/drivers/infiniband/hw/efa/efa_com_cmd.h
> index 31db5a0cbd5b..41ce4a476ee6 100644
> --- a/drivers/infiniband/hw/efa/efa_com_cmd.h
> +++ b/drivers/infiniband/hw/efa/efa_com_cmd.h
> @@ -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);
> diff --git a/drivers/infiniband/hw/efa/efa_main.c b/drivers/infiniband/hw/efa/efa_main.c
> index faf3ff1bca2a..f5ef7262683d 100644
> --- a/drivers/infiniband/hw/efa/efa_main.c
> +++ b/drivers/infiniband/hw/efa/efa_main.c
> @@ -1,10 +1,11 @@
>  // 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.
>   */
>
>  #include <linux/module.h>
>  #include <linux/pci.h>
> +#include <linux/utsname.h>
>
>  #include <rdma/ib_user_verbs.h>
>
> @@ -187,6 +188,47 @@ static void efa_stats_init(struct efa_dev *dev)
>  		atomic64_set(s, 0);
>  }
>
> +static void efa_set_host_info(struct efa_dev *dev)
> +{
> +	struct efa_admin_set_feature_resp resp = {};
> +	struct efa_admin_set_feature_cmd cmd = {};
> +	struct efa_admin_host_info *hinf;
> +	u32 bufsz = sizeof(*hinf);
> +	dma_addr_t hinf_dma;
> +
> +	if (!efa_com_check_supported_feature_id(&dev->edev,
> +						EFA_ADMIN_HOST_INFO))
> +		return;
> +
> +	/* Failures in host info set shall not disturb probe */
> +	hinf = dma_alloc_coherent(&dev->pdev->dev, bufsz, &hinf_dma,
> +				  GFP_KERNEL);
> +	if (!hinf)
> +		return;
> +
> +	strlcpy(hinf->os_dist_str, utsname()->release,
> +		min(sizeof(hinf->os_dist_str), sizeof(utsname()->release)));
> +	hinf->os_type = EFA_ADMIN_OS_LINUX;
> +	strlcpy(hinf->kernel_ver_str, utsname()->version,
> +		min(sizeof(hinf->kernel_ver_str), sizeof(utsname()->version)));
> +	hinf->kernel_ver = LINUX_VERSION_CODE;
> +	EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_BUS, dev->pdev->bus->number);
> +	EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_DEVICE,
> +		PCI_SLOT(dev->pdev->devfn));
> +	EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_FUNCTION,
> +		PCI_FUNC(dev->pdev->devfn));
> +	EFA_SET(&hinf->spec_ver, EFA_ADMIN_HOST_INFO_SPEC_MAJOR,
> +		EFA_COMMON_SPEC_VERSION_MAJOR);
> +	EFA_SET(&hinf->spec_ver, EFA_ADMIN_HOST_INFO_SPEC_MINOR,
> +		EFA_COMMON_SPEC_VERSION_MINOR);
> +	EFA_SET(&hinf->flags, EFA_ADMIN_HOST_INFO_INTREE, 1);

Ohhh, so users will change this line voluntarily?

Thanks

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

* Re: [PATCH for-next 2/2] RDMA/efa: Report host information to the device
  2020-05-10 12:29   ` Leon Romanovsky
@ 2020-05-10 13:05     ` Gal Pressman
  2020-05-10 15:16       ` Leon Romanovsky
  0 siblings, 1 reply; 14+ messages in thread
From: Gal Pressman @ 2020-05-10 13:05 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Jason Gunthorpe, Doug Ledford, linux-rdma, Alexander Matushevsky,
	Firas JahJah, Guy Tzalik

On 10/05/2020 15:29, Leon Romanovsky wrote:
> On Sun, May 10, 2020 at 02:59:18PM +0300, Gal Pressman wrote:
>> diff --git a/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h b/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
>> index 96b104ab5415..efdeebc9ea9b 100644
>> --- a/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
>> +++ b/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
>> @@ -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,55 @@ struct efa_admin_mmio_req_read_less_resp {
>>  	u32 reg_val;
>>  };
>>
>> +enum efa_admin_os_type {
>> +	EFA_ADMIN_OS_LINUX                          = 0,
>> +	EFA_ADMIN_OS_WINDOWS                        = 1,
> 
> Not used.

That's the device interface..

> 
>> +};
>> +
>> +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;
> 
> No to this.

Same, this is the device interface.
And obviously it's not used as we don't have a driver version.

> 
>> +
>> +	/*
>> +	 * 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 +869,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)
> 
> Not in use.

Same.

> 
>> +#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_ */
>> +static void efa_set_host_info(struct efa_dev *dev)
>> +{
>> +	struct efa_admin_set_feature_resp resp = {};
>> +	struct efa_admin_set_feature_cmd cmd = {};
>> +	struct efa_admin_host_info *hinf;
>> +	u32 bufsz = sizeof(*hinf);
>> +	dma_addr_t hinf_dma;
>> +
>> +	if (!efa_com_check_supported_feature_id(&dev->edev,
>> +						EFA_ADMIN_HOST_INFO))
>> +		return;
>> +
>> +	/* Failures in host info set shall not disturb probe */
>> +	hinf = dma_alloc_coherent(&dev->pdev->dev, bufsz, &hinf_dma,
>> +				  GFP_KERNEL);
>> +	if (!hinf)
>> +		return;
>> +
>> +	strlcpy(hinf->os_dist_str, utsname()->release,
>> +		min(sizeof(hinf->os_dist_str), sizeof(utsname()->release)));
>> +	hinf->os_type = EFA_ADMIN_OS_LINUX;
>> +	strlcpy(hinf->kernel_ver_str, utsname()->version,
>> +		min(sizeof(hinf->kernel_ver_str), sizeof(utsname()->version)));
>> +	hinf->kernel_ver = LINUX_VERSION_CODE;
>> +	EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_BUS, dev->pdev->bus->number);
>> +	EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_DEVICE,
>> +		PCI_SLOT(dev->pdev->devfn));
>> +	EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_FUNCTION,
>> +		PCI_FUNC(dev->pdev->devfn));
>> +	EFA_SET(&hinf->spec_ver, EFA_ADMIN_HOST_INFO_SPEC_MAJOR,
>> +		EFA_COMMON_SPEC_VERSION_MAJOR);
>> +	EFA_SET(&hinf->spec_ver, EFA_ADMIN_HOST_INFO_SPEC_MINOR,
>> +		EFA_COMMON_SPEC_VERSION_MINOR);
>> +	EFA_SET(&hinf->flags, EFA_ADMIN_HOST_INFO_INTREE, 1);
> 
> Ohhh, so users will change this line voluntarily?

Are you worried with out of tree users?

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

* Re: [PATCH for-next 2/2] RDMA/efa: Report host information to the device
  2020-05-10 11:59 ` [PATCH for-next 2/2] RDMA/efa: Report host information to the device Gal Pressman
@ 2020-05-10 13:42     ` kbuild test robot
  2020-05-10 13:42     ` kbuild test robot
  1 sibling, 0 replies; 14+ messages in thread
From: kbuild test robot @ 2020-05-10 13:42 UTC (permalink / raw)
  To: Gal Pressman, Jason Gunthorpe, Doug Ledford
  Cc: kbuild-all, linux-rdma, Alexander Matushevsky, Gal Pressman,
	Firas JahJah, Guy Tzalik

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

Hi Gal,

I love your patch! Yet something to improve:

[auto build test ERROR on rdma/for-next]
[also build test ERROR on v5.7-rc4 next-20200508]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Gal-Pressman/EFA-host-information/20200510-200519
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
config: riscv-allyesconfig (attached as .config)
compiler: riscv64-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/infiniband/hw/efa/efa_main.c: In function 'efa_set_host_info':
>> drivers/infiniband/hw/efa/efa_main.c:214:21: error: 'LINUX_VERSION_CODE' undeclared (first use in this function)
     214 |  hinf->kernel_ver = LINUX_VERSION_CODE;
         |                     ^~~~~~~~~~~~~~~~~~
   drivers/infiniband/hw/efa/efa_main.c:214:21: note: each undeclared identifier is reported only once for each function it appears in

vim +/LINUX_VERSION_CODE +214 drivers/infiniband/hw/efa/efa_main.c

   190	
   191	static void efa_set_host_info(struct efa_dev *dev)
   192	{
   193		struct efa_admin_set_feature_resp resp = {};
   194		struct efa_admin_set_feature_cmd cmd = {};
   195		struct efa_admin_host_info *hinf;
   196		u32 bufsz = sizeof(*hinf);
   197		dma_addr_t hinf_dma;
   198	
   199		if (!efa_com_check_supported_feature_id(&dev->edev,
   200							EFA_ADMIN_HOST_INFO))
   201			return;
   202	
   203		/* Failures in host info set shall not disturb probe */
   204		hinf = dma_alloc_coherent(&dev->pdev->dev, bufsz, &hinf_dma,
   205					  GFP_KERNEL);
   206		if (!hinf)
   207			return;
   208	
   209		strlcpy(hinf->os_dist_str, utsname()->release,
   210			min(sizeof(hinf->os_dist_str), sizeof(utsname()->release)));
   211		hinf->os_type = EFA_ADMIN_OS_LINUX;
   212		strlcpy(hinf->kernel_ver_str, utsname()->version,
   213			min(sizeof(hinf->kernel_ver_str), sizeof(utsname()->version)));
 > 214		hinf->kernel_ver = LINUX_VERSION_CODE;
   215		EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_BUS, dev->pdev->bus->number);
   216		EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_DEVICE,
   217			PCI_SLOT(dev->pdev->devfn));
   218		EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_FUNCTION,
   219			PCI_FUNC(dev->pdev->devfn));
   220		EFA_SET(&hinf->spec_ver, EFA_ADMIN_HOST_INFO_SPEC_MAJOR,
   221			EFA_COMMON_SPEC_VERSION_MAJOR);
   222		EFA_SET(&hinf->spec_ver, EFA_ADMIN_HOST_INFO_SPEC_MINOR,
   223			EFA_COMMON_SPEC_VERSION_MINOR);
   224		EFA_SET(&hinf->flags, EFA_ADMIN_HOST_INFO_INTREE, 1);
   225	
   226		efa_com_set_feature_ex(&dev->edev, &resp, &cmd, EFA_ADMIN_HOST_INFO,
   227				       hinf_dma, bufsz);
   228	
   229		dma_free_coherent(&dev->pdev->dev, bufsz, hinf, hinf_dma);
   230	}
   231	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 63433 bytes --]

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

* Re: [PATCH for-next 2/2] RDMA/efa: Report host information to the device
@ 2020-05-10 13:42     ` kbuild test robot
  0 siblings, 0 replies; 14+ messages in thread
From: kbuild test robot @ 2020-05-10 13:42 UTC (permalink / raw)
  To: kbuild-all

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

Hi Gal,

I love your patch! Yet something to improve:

[auto build test ERROR on rdma/for-next]
[also build test ERROR on v5.7-rc4 next-20200508]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Gal-Pressman/EFA-host-information/20200510-200519
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
config: riscv-allyesconfig (attached as .config)
compiler: riscv64-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/infiniband/hw/efa/efa_main.c: In function 'efa_set_host_info':
>> drivers/infiniband/hw/efa/efa_main.c:214:21: error: 'LINUX_VERSION_CODE' undeclared (first use in this function)
     214 |  hinf->kernel_ver = LINUX_VERSION_CODE;
         |                     ^~~~~~~~~~~~~~~~~~
   drivers/infiniband/hw/efa/efa_main.c:214:21: note: each undeclared identifier is reported only once for each function it appears in

vim +/LINUX_VERSION_CODE +214 drivers/infiniband/hw/efa/efa_main.c

   190	
   191	static void efa_set_host_info(struct efa_dev *dev)
   192	{
   193		struct efa_admin_set_feature_resp resp = {};
   194		struct efa_admin_set_feature_cmd cmd = {};
   195		struct efa_admin_host_info *hinf;
   196		u32 bufsz = sizeof(*hinf);
   197		dma_addr_t hinf_dma;
   198	
   199		if (!efa_com_check_supported_feature_id(&dev->edev,
   200							EFA_ADMIN_HOST_INFO))
   201			return;
   202	
   203		/* Failures in host info set shall not disturb probe */
   204		hinf = dma_alloc_coherent(&dev->pdev->dev, bufsz, &hinf_dma,
   205					  GFP_KERNEL);
   206		if (!hinf)
   207			return;
   208	
   209		strlcpy(hinf->os_dist_str, utsname()->release,
   210			min(sizeof(hinf->os_dist_str), sizeof(utsname()->release)));
   211		hinf->os_type = EFA_ADMIN_OS_LINUX;
   212		strlcpy(hinf->kernel_ver_str, utsname()->version,
   213			min(sizeof(hinf->kernel_ver_str), sizeof(utsname()->version)));
 > 214		hinf->kernel_ver = LINUX_VERSION_CODE;
   215		EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_BUS, dev->pdev->bus->number);
   216		EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_DEVICE,
   217			PCI_SLOT(dev->pdev->devfn));
   218		EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_FUNCTION,
   219			PCI_FUNC(dev->pdev->devfn));
   220		EFA_SET(&hinf->spec_ver, EFA_ADMIN_HOST_INFO_SPEC_MAJOR,
   221			EFA_COMMON_SPEC_VERSION_MAJOR);
   222		EFA_SET(&hinf->spec_ver, EFA_ADMIN_HOST_INFO_SPEC_MINOR,
   223			EFA_COMMON_SPEC_VERSION_MINOR);
   224		EFA_SET(&hinf->flags, EFA_ADMIN_HOST_INFO_INTREE, 1);
   225	
   226		efa_com_set_feature_ex(&dev->edev, &resp, &cmd, EFA_ADMIN_HOST_INFO,
   227				       hinf_dma, bufsz);
   228	
   229		dma_free_coherent(&dev->pdev->dev, bufsz, hinf, hinf_dma);
   230	}
   231	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 63433 bytes --]

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

* Re: [PATCH for-next 2/2] RDMA/efa: Report host information to the device
  2020-05-10 13:42     ` kbuild test robot
  (?)
@ 2020-05-10 14:40     ` Gal Pressman
  2020-05-10 15:11         ` Leon Romanovsky
  -1 siblings, 1 reply; 14+ messages in thread
From: Gal Pressman @ 2020-05-10 14:40 UTC (permalink / raw)
  To: kbuild test robot, Jason Gunthorpe, Doug Ledford
  Cc: kbuild-all, linux-rdma, Alexander Matushevsky, Firas JahJah, Guy Tzalik

On 10/05/2020 16:42, kbuild test robot wrote:
> Hi Gal,
> 
> I love your patch! Yet something to improve:
> 
> [auto build test ERROR on rdma/for-next]
> [also build test ERROR on v5.7-rc4 next-20200508]
> [if your patch is applied to the wrong git tree, please drop us a note to help
> improve the system. BTW, we also suggest to use '--base' option to specify the
> base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
> 
> url:    https://github.com/0day-ci/linux/commits/Gal-Pressman/EFA-host-information/20200510-200519
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
> config: riscv-allyesconfig (attached as .config)
> compiler: riscv64-linux-gcc (GCC) 9.3.0
> reproduce:
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=riscv 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kbuild test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>):
> 
>    drivers/infiniband/hw/efa/efa_main.c: In function 'efa_set_host_info':
>>> drivers/infiniband/hw/efa/efa_main.c:214:21: error: 'LINUX_VERSION_CODE' undeclared (first use in this function)
>      214 |  hinf->kernel_ver = LINUX_VERSION_CODE;
>          |                     ^~~~~~~~~~~~~~~~~~
>    drivers/infiniband/hw/efa/efa_main.c:214:21: note: each undeclared identifier is reported only once for each function it appears in
> 
> vim +/LINUX_VERSION_CODE +214 drivers/infiniband/hw/efa/efa_main.c
> 
>    190	
>    191	static void efa_set_host_info(struct efa_dev *dev)
>    192	{
>    193		struct efa_admin_set_feature_resp resp = {};
>    194		struct efa_admin_set_feature_cmd cmd = {};
>    195		struct efa_admin_host_info *hinf;
>    196		u32 bufsz = sizeof(*hinf);
>    197		dma_addr_t hinf_dma;
>    198	
>    199		if (!efa_com_check_supported_feature_id(&dev->edev,
>    200							EFA_ADMIN_HOST_INFO))
>    201			return;
>    202	
>    203		/* Failures in host info set shall not disturb probe */
>    204		hinf = dma_alloc_coherent(&dev->pdev->dev, bufsz, &hinf_dma,
>    205					  GFP_KERNEL);
>    206		if (!hinf)
>    207			return;
>    208	
>    209		strlcpy(hinf->os_dist_str, utsname()->release,
>    210			min(sizeof(hinf->os_dist_str), sizeof(utsname()->release)));
>    211		hinf->os_type = EFA_ADMIN_OS_LINUX;
>    212		strlcpy(hinf->kernel_ver_str, utsname()->version,
>    213			min(sizeof(hinf->kernel_ver_str), sizeof(utsname()->version)));
>  > 214		hinf->kernel_ver = LINUX_VERSION_CODE;
>    215		EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_BUS, dev->pdev->bus->number);
>    216		EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_DEVICE,
>    217			PCI_SLOT(dev->pdev->devfn));
>    218		EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_FUNCTION,
>    219			PCI_FUNC(dev->pdev->devfn));
>    220		EFA_SET(&hinf->spec_ver, EFA_ADMIN_HOST_INFO_SPEC_MAJOR,
>    221			EFA_COMMON_SPEC_VERSION_MAJOR);
>    222		EFA_SET(&hinf->spec_ver, EFA_ADMIN_HOST_INFO_SPEC_MINOR,
>    223			EFA_COMMON_SPEC_VERSION_MINOR);
>    224		EFA_SET(&hinf->flags, EFA_ADMIN_HOST_INFO_INTREE, 1);
>    225	
>    226		efa_com_set_feature_ex(&dev->edev, &resp, &cmd, EFA_ADMIN_HOST_INFO,
>    227				       hinf_dma, bufsz);
>    228	
>    229		dma_free_coherent(&dev->pdev->dev, bufsz, hinf, hinf_dma);
>    230	}
>    231	
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> 

Thanks robot, I'm missing an #include <linux/version.h> in efa_main.c.

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

* Re: [PATCH for-next 2/2] RDMA/efa: Report host information to the device
  2020-05-10 14:40     ` Gal Pressman
@ 2020-05-10 15:11         ` Leon Romanovsky
  0 siblings, 0 replies; 14+ messages in thread
From: Leon Romanovsky @ 2020-05-10 15:11 UTC (permalink / raw)
  To: Gal Pressman
  Cc: kbuild test robot, Jason Gunthorpe, Doug Ledford, kbuild-all,
	linux-rdma, Alexander Matushevsky, Firas JahJah, Guy Tzalik

On Sun, May 10, 2020 at 05:40:21PM +0300, Gal Pressman wrote:
> On 10/05/2020 16:42, kbuild test robot wrote:
> > Hi Gal,
> >
> > I love your patch! Yet something to improve:
> >
> > [auto build test ERROR on rdma/for-next]
> > [also build test ERROR on v5.7-rc4 next-20200508]
> > [if your patch is applied to the wrong git tree, please drop us a note to help
> > improve the system. BTW, we also suggest to use '--base' option to specify the
> > base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
> >
> > url:    https://github.com/0day-ci/linux/commits/Gal-Pressman/EFA-host-information/20200510-200519
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
> > config: riscv-allyesconfig (attached as .config)
> > compiler: riscv64-linux-gcc (GCC) 9.3.0
> > reproduce:
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # save the attached .config to linux build tree
> >         COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=riscv
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kbuild test robot <lkp@intel.com>
> >
> > All errors (new ones prefixed by >>):
> >
> >    drivers/infiniband/hw/efa/efa_main.c: In function 'efa_set_host_info':
> >>> drivers/infiniband/hw/efa/efa_main.c:214:21: error: 'LINUX_VERSION_CODE' undeclared (first use in this function)
> >      214 |  hinf->kernel_ver = LINUX_VERSION_CODE;
> >          |                     ^~~~~~~~~~~~~~~~~~
> >    drivers/infiniband/hw/efa/efa_main.c:214:21: note: each undeclared identifier is reported only once for each function it appears in
> >
> > vim +/LINUX_VERSION_CODE +214 drivers/infiniband/hw/efa/efa_main.c
> >
> >    190
> >    191	static void efa_set_host_info(struct efa_dev *dev)
> >    192	{
> >    193		struct efa_admin_set_feature_resp resp = {};
> >    194		struct efa_admin_set_feature_cmd cmd = {};
> >    195		struct efa_admin_host_info *hinf;
> >    196		u32 bufsz = sizeof(*hinf);
> >    197		dma_addr_t hinf_dma;
> >    198
> >    199		if (!efa_com_check_supported_feature_id(&dev->edev,
> >    200							EFA_ADMIN_HOST_INFO))
> >    201			return;
> >    202
> >    203		/* Failures in host info set shall not disturb probe */
> >    204		hinf = dma_alloc_coherent(&dev->pdev->dev, bufsz, &hinf_dma,
> >    205					  GFP_KERNEL);
> >    206		if (!hinf)
> >    207			return;
> >    208
> >    209		strlcpy(hinf->os_dist_str, utsname()->release,
> >    210			min(sizeof(hinf->os_dist_str), sizeof(utsname()->release)));
> >    211		hinf->os_type = EFA_ADMIN_OS_LINUX;
> >    212		strlcpy(hinf->kernel_ver_str, utsname()->version,
> >    213			min(sizeof(hinf->kernel_ver_str), sizeof(utsname()->version)));
> >  > 214		hinf->kernel_ver = LINUX_VERSION_CODE;
> >    215		EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_BUS, dev->pdev->bus->number);
> >    216		EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_DEVICE,
> >    217			PCI_SLOT(dev->pdev->devfn));
> >    218		EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_FUNCTION,
> >    219			PCI_FUNC(dev->pdev->devfn));
> >    220		EFA_SET(&hinf->spec_ver, EFA_ADMIN_HOST_INFO_SPEC_MAJOR,
> >    221			EFA_COMMON_SPEC_VERSION_MAJOR);
> >    222		EFA_SET(&hinf->spec_ver, EFA_ADMIN_HOST_INFO_SPEC_MINOR,
> >    223			EFA_COMMON_SPEC_VERSION_MINOR);
> >    224		EFA_SET(&hinf->flags, EFA_ADMIN_HOST_INFO_INTREE, 1);
> >    225
> >    226		efa_com_set_feature_ex(&dev->edev, &resp, &cmd, EFA_ADMIN_HOST_INFO,
> >    227				       hinf_dma, bufsz);
> >    228
> >    229		dma_free_coherent(&dev->pdev->dev, bufsz, hinf, hinf_dma);
> >    230	}
> >    231
> >
> > ---
> > 0-DAY CI Kernel Test Service, Intel Corporation
> > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> >
>
> Thanks robot, I'm missing an #include <linux/version.h> in efa_main.c.

I'm not so sure that you can use that header.
You need to use "#include <generated/utsrelease.h>" instead of
LINUX_VERSION.

Thanks

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

* Re: [PATCH for-next 2/2] RDMA/efa: Report host information to the device
@ 2020-05-10 15:11         ` Leon Romanovsky
  0 siblings, 0 replies; 14+ messages in thread
From: Leon Romanovsky @ 2020-05-10 15:11 UTC (permalink / raw)
  To: kbuild-all

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

On Sun, May 10, 2020 at 05:40:21PM +0300, Gal Pressman wrote:
> On 10/05/2020 16:42, kbuild test robot wrote:
> > Hi Gal,
> >
> > I love your patch! Yet something to improve:
> >
> > [auto build test ERROR on rdma/for-next]
> > [also build test ERROR on v5.7-rc4 next-20200508]
> > [if your patch is applied to the wrong git tree, please drop us a note to help
> > improve the system. BTW, we also suggest to use '--base' option to specify the
> > base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
> >
> > url:    https://github.com/0day-ci/linux/commits/Gal-Pressman/EFA-host-information/20200510-200519
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
> > config: riscv-allyesconfig (attached as .config)
> > compiler: riscv64-linux-gcc (GCC) 9.3.0
> > reproduce:
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # save the attached .config to linux build tree
> >         COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=riscv
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kbuild test robot <lkp@intel.com>
> >
> > All errors (new ones prefixed by >>):
> >
> >    drivers/infiniband/hw/efa/efa_main.c: In function 'efa_set_host_info':
> >>> drivers/infiniband/hw/efa/efa_main.c:214:21: error: 'LINUX_VERSION_CODE' undeclared (first use in this function)
> >      214 |  hinf->kernel_ver = LINUX_VERSION_CODE;
> >          |                     ^~~~~~~~~~~~~~~~~~
> >    drivers/infiniband/hw/efa/efa_main.c:214:21: note: each undeclared identifier is reported only once for each function it appears in
> >
> > vim +/LINUX_VERSION_CODE +214 drivers/infiniband/hw/efa/efa_main.c
> >
> >    190
> >    191	static void efa_set_host_info(struct efa_dev *dev)
> >    192	{
> >    193		struct efa_admin_set_feature_resp resp = {};
> >    194		struct efa_admin_set_feature_cmd cmd = {};
> >    195		struct efa_admin_host_info *hinf;
> >    196		u32 bufsz = sizeof(*hinf);
> >    197		dma_addr_t hinf_dma;
> >    198
> >    199		if (!efa_com_check_supported_feature_id(&dev->edev,
> >    200							EFA_ADMIN_HOST_INFO))
> >    201			return;
> >    202
> >    203		/* Failures in host info set shall not disturb probe */
> >    204		hinf = dma_alloc_coherent(&dev->pdev->dev, bufsz, &hinf_dma,
> >    205					  GFP_KERNEL);
> >    206		if (!hinf)
> >    207			return;
> >    208
> >    209		strlcpy(hinf->os_dist_str, utsname()->release,
> >    210			min(sizeof(hinf->os_dist_str), sizeof(utsname()->release)));
> >    211		hinf->os_type = EFA_ADMIN_OS_LINUX;
> >    212		strlcpy(hinf->kernel_ver_str, utsname()->version,
> >    213			min(sizeof(hinf->kernel_ver_str), sizeof(utsname()->version)));
> >  > 214		hinf->kernel_ver = LINUX_VERSION_CODE;
> >    215		EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_BUS, dev->pdev->bus->number);
> >    216		EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_DEVICE,
> >    217			PCI_SLOT(dev->pdev->devfn));
> >    218		EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_FUNCTION,
> >    219			PCI_FUNC(dev->pdev->devfn));
> >    220		EFA_SET(&hinf->spec_ver, EFA_ADMIN_HOST_INFO_SPEC_MAJOR,
> >    221			EFA_COMMON_SPEC_VERSION_MAJOR);
> >    222		EFA_SET(&hinf->spec_ver, EFA_ADMIN_HOST_INFO_SPEC_MINOR,
> >    223			EFA_COMMON_SPEC_VERSION_MINOR);
> >    224		EFA_SET(&hinf->flags, EFA_ADMIN_HOST_INFO_INTREE, 1);
> >    225
> >    226		efa_com_set_feature_ex(&dev->edev, &resp, &cmd, EFA_ADMIN_HOST_INFO,
> >    227				       hinf_dma, bufsz);
> >    228
> >    229		dma_free_coherent(&dev->pdev->dev, bufsz, hinf, hinf_dma);
> >    230	}
> >    231
> >
> > ---
> > 0-DAY CI Kernel Test Service, Intel Corporation
> > https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
> >
>
> Thanks robot, I'm missing an #include <linux/version.h> in efa_main.c.

I'm not so sure that you can use that header.
You need to use "#include <generated/utsrelease.h>" instead of
LINUX_VERSION.

Thanks

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

* Re: [PATCH for-next 2/2] RDMA/efa: Report host information to the device
  2020-05-10 13:05     ` Gal Pressman
@ 2020-05-10 15:16       ` Leon Romanovsky
  2020-05-11 12:47         ` Gal Pressman
  0 siblings, 1 reply; 14+ messages in thread
From: Leon Romanovsky @ 2020-05-10 15:16 UTC (permalink / raw)
  To: Gal Pressman
  Cc: Jason Gunthorpe, Doug Ledford, linux-rdma, Alexander Matushevsky,
	Firas JahJah, Guy Tzalik

On Sun, May 10, 2020 at 04:05:45PM +0300, Gal Pressman wrote:
> On 10/05/2020 15:29, Leon Romanovsky wrote:
> > On Sun, May 10, 2020 at 02:59:18PM +0300, Gal Pressman wrote:
> >> diff --git a/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h b/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
> >> index 96b104ab5415..efdeebc9ea9b 100644
> >> --- a/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
> >> +++ b/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
> >> @@ -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,55 @@ struct efa_admin_mmio_req_read_less_resp {
> >>  	u32 reg_val;
> >>  };
> >>
> >> +enum efa_admin_os_type {
> >> +	EFA_ADMIN_OS_LINUX                          = 0,
> >> +	EFA_ADMIN_OS_WINDOWS                        = 1,
> >
> > Not used.
>
> That's the device interface..

It doesn't matter, we don't add code/defines that are not in use.

>
> >
> >> +};
> >> +
> >> +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;
> >
> > No to this.
>
> Same, this is the device interface.
> And obviously it's not used as we don't have a driver version.
>
> >
> >> +
> >> +	/*
> >> +	 * 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 +869,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)
> >
> > Not in use.
>
> Same.

Same :)

>
> >
> >> +#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_ */
> >> +static void efa_set_host_info(struct efa_dev *dev)
> >> +{
> >> +	struct efa_admin_set_feature_resp resp = {};
> >> +	struct efa_admin_set_feature_cmd cmd = {};
> >> +	struct efa_admin_host_info *hinf;
> >> +	u32 bufsz = sizeof(*hinf);
> >> +	dma_addr_t hinf_dma;
> >> +
> >> +	if (!efa_com_check_supported_feature_id(&dev->edev,
> >> +						EFA_ADMIN_HOST_INFO))
> >> +		return;
> >> +
> >> +	/* Failures in host info set shall not disturb probe */
> >> +	hinf = dma_alloc_coherent(&dev->pdev->dev, bufsz, &hinf_dma,
> >> +				  GFP_KERNEL);
> >> +	if (!hinf)
> >> +		return;
> >> +
> >> +	strlcpy(hinf->os_dist_str, utsname()->release,
> >> +		min(sizeof(hinf->os_dist_str), sizeof(utsname()->release)));
> >> +	hinf->os_type = EFA_ADMIN_OS_LINUX;
> >> +	strlcpy(hinf->kernel_ver_str, utsname()->version,
> >> +		min(sizeof(hinf->kernel_ver_str), sizeof(utsname()->version)));
> >> +	hinf->kernel_ver = LINUX_VERSION_CODE;
> >> +	EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_BUS, dev->pdev->bus->number);
> >> +	EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_DEVICE,
> >> +		PCI_SLOT(dev->pdev->devfn));
> >> +	EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_FUNCTION,
> >> +		PCI_FUNC(dev->pdev->devfn));
> >> +	EFA_SET(&hinf->spec_ver, EFA_ADMIN_HOST_INFO_SPEC_MAJOR,
> >> +		EFA_COMMON_SPEC_VERSION_MAJOR);
> >> +	EFA_SET(&hinf->spec_ver, EFA_ADMIN_HOST_INFO_SPEC_MINOR,
> >> +		EFA_COMMON_SPEC_VERSION_MINOR);
> >> +	EFA_SET(&hinf->flags, EFA_ADMIN_HOST_INFO_INTREE, 1);
> >
> > Ohhh, so users will change this line voluntarily?
>
> Are you worried with out of tree users?

Should I? I'm not worried, but excited to see such naive debug approach.

Thanks

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

* Re: [PATCH for-next 2/2] RDMA/efa: Report host information to the device
  2020-05-10 15:11         ` Leon Romanovsky
  (?)
@ 2020-05-11 12:40         ` Gal Pressman
  -1 siblings, 0 replies; 14+ messages in thread
From: Gal Pressman @ 2020-05-11 12:40 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: kbuild test robot, Jason Gunthorpe, Doug Ledford, kbuild-all,
	linux-rdma, Alexander Matushevsky, Firas JahJah, Guy Tzalik

On 10/05/2020 18:11, Leon Romanovsky wrote:
> On Sun, May 10, 2020 at 05:40:21PM +0300, Gal Pressman wrote:
>> On 10/05/2020 16:42, kbuild test robot wrote:
>>> Hi Gal,
>>>
>>> I love your patch! Yet something to improve:
>>>
>>> [auto build test ERROR on rdma/for-next]
>>> [also build test ERROR on v5.7-rc4 next-20200508]
>>> [if your patch is applied to the wrong git tree, please drop us a note to help
>>> improve the system. BTW, we also suggest to use '--base' option to specify the
>>> base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
>>>
>>> url:    https://github.com/0day-ci/linux/commits/Gal-Pressman/EFA-host-information/20200510-200519
>>> base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
>>> config: riscv-allyesconfig (attached as .config)
>>> compiler: riscv64-linux-gcc (GCC) 9.3.0
>>> reproduce:
>>>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>>>         chmod +x ~/bin/make.cross
>>>         # save the attached .config to linux build tree
>>>         COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=riscv
>>>
>>> If you fix the issue, kindly add following tag as appropriate
>>> Reported-by: kbuild test robot <lkp@intel.com>
>>>
>>> All errors (new ones prefixed by >>):
>>>
>>>    drivers/infiniband/hw/efa/efa_main.c: In function 'efa_set_host_info':
>>>>> drivers/infiniband/hw/efa/efa_main.c:214:21: error: 'LINUX_VERSION_CODE' undeclared (first use in this function)
>>>      214 |  hinf->kernel_ver = LINUX_VERSION_CODE;
>>>          |                     ^~~~~~~~~~~~~~~~~~
>>>    drivers/infiniband/hw/efa/efa_main.c:214:21: note: each undeclared identifier is reported only once for each function it appears in
>>>
>>> vim +/LINUX_VERSION_CODE +214 drivers/infiniband/hw/efa/efa_main.c
>>>
>>>    190
>>>    191	static void efa_set_host_info(struct efa_dev *dev)
>>>    192	{
>>>    193		struct efa_admin_set_feature_resp resp = {};
>>>    194		struct efa_admin_set_feature_cmd cmd = {};
>>>    195		struct efa_admin_host_info *hinf;
>>>    196		u32 bufsz = sizeof(*hinf);
>>>    197		dma_addr_t hinf_dma;
>>>    198
>>>    199		if (!efa_com_check_supported_feature_id(&dev->edev,
>>>    200							EFA_ADMIN_HOST_INFO))
>>>    201			return;
>>>    202
>>>    203		/* Failures in host info set shall not disturb probe */
>>>    204		hinf = dma_alloc_coherent(&dev->pdev->dev, bufsz, &hinf_dma,
>>>    205					  GFP_KERNEL);
>>>    206		if (!hinf)
>>>    207			return;
>>>    208
>>>    209		strlcpy(hinf->os_dist_str, utsname()->release,
>>>    210			min(sizeof(hinf->os_dist_str), sizeof(utsname()->release)));
>>>    211		hinf->os_type = EFA_ADMIN_OS_LINUX;
>>>    212		strlcpy(hinf->kernel_ver_str, utsname()->version,
>>>    213			min(sizeof(hinf->kernel_ver_str), sizeof(utsname()->version)));
>>>  > 214		hinf->kernel_ver = LINUX_VERSION_CODE;
>>>    215		EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_BUS, dev->pdev->bus->number);
>>>    216		EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_DEVICE,
>>>    217			PCI_SLOT(dev->pdev->devfn));
>>>    218		EFA_SET(&hinf->bdf, EFA_ADMIN_HOST_INFO_FUNCTION,
>>>    219			PCI_FUNC(dev->pdev->devfn));
>>>    220		EFA_SET(&hinf->spec_ver, EFA_ADMIN_HOST_INFO_SPEC_MAJOR,
>>>    221			EFA_COMMON_SPEC_VERSION_MAJOR);
>>>    222		EFA_SET(&hinf->spec_ver, EFA_ADMIN_HOST_INFO_SPEC_MINOR,
>>>    223			EFA_COMMON_SPEC_VERSION_MINOR);
>>>    224		EFA_SET(&hinf->flags, EFA_ADMIN_HOST_INFO_INTREE, 1);
>>>    225
>>>    226		efa_com_set_feature_ex(&dev->edev, &resp, &cmd, EFA_ADMIN_HOST_INFO,
>>>    227				       hinf_dma, bufsz);
>>>    228
>>>    229		dma_free_coherent(&dev->pdev->dev, bufsz, hinf, hinf_dma);
>>>    230	}
>>>    231
>>>
>>> ---
>>> 0-DAY CI Kernel Test Service, Intel Corporation
>>> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
>>>
>>
>> Thanks robot, I'm missing an #include <linux/version.h> in efa_main.c.
> 
> I'm not so sure that you can use that header.
> You need to use "#include <generated/utsrelease.h>" instead of
> LINUX_VERSION.

Are you sure about that?
I think <generated/utsrelease.h> is used for UTS_RELEASE define.

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

* Re: [PATCH for-next 2/2] RDMA/efa: Report host information to the device
  2020-05-10 15:16       ` Leon Romanovsky
@ 2020-05-11 12:47         ` Gal Pressman
  2020-05-11 16:34           ` Leon Romanovsky
  0 siblings, 1 reply; 14+ messages in thread
From: Gal Pressman @ 2020-05-11 12:47 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Jason Gunthorpe, Doug Ledford, linux-rdma, Alexander Matushevsky,
	Firas JahJah, Guy Tzalik

On 10/05/2020 18:16, Leon Romanovsky wrote:
> On Sun, May 10, 2020 at 04:05:45PM +0300, Gal Pressman wrote:
>> On 10/05/2020 15:29, Leon Romanovsky wrote:
>>> On Sun, May 10, 2020 at 02:59:18PM +0300, Gal Pressman wrote:
>>>> diff --git a/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h b/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
>>>> index 96b104ab5415..efdeebc9ea9b 100644
>>>> --- a/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
>>>> +++ b/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
>>>> @@ -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,55 @@ struct efa_admin_mmio_req_read_less_resp {
>>>>  	u32 reg_val;
>>>>  };
>>>>
>>>> +enum efa_admin_os_type {
>>>> +	EFA_ADMIN_OS_LINUX                          = 0,
>>>> +	EFA_ADMIN_OS_WINDOWS                        = 1,
>>>
>>> Not used.
>>
>> That's the device interface..
> 
> It doesn't matter, we don't add code/defines that are not in use.

First of all, that's not true, look at mlx5 device spec for example.
It's 10k lines long and has many unused values..

I don't think we should go as far as commits like 1759d322f4ba ("net/mlx5: Add
hardware definitions for sub functions") which adds new commands interface
without implementing it (nor does any following patch), but exposing the related
bits directly in the scope of the feature that's being introduced is different.

The driver version fields that you don't like are going to stay there as they're
the device ABI, and IMHO "hiding" them as reserved has zero upsides and won't
change the fact that they're unused.

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

* Re: [PATCH for-next 2/2] RDMA/efa: Report host information to the device
  2020-05-11 12:47         ` Gal Pressman
@ 2020-05-11 16:34           ` Leon Romanovsky
  0 siblings, 0 replies; 14+ messages in thread
From: Leon Romanovsky @ 2020-05-11 16:34 UTC (permalink / raw)
  To: Gal Pressman
  Cc: Jason Gunthorpe, Doug Ledford, linux-rdma, Alexander Matushevsky,
	Firas JahJah, Guy Tzalik

On Mon, May 11, 2020 at 03:47:57PM +0300, Gal Pressman wrote:
> On 10/05/2020 18:16, Leon Romanovsky wrote:
> > On Sun, May 10, 2020 at 04:05:45PM +0300, Gal Pressman wrote:
> >> On 10/05/2020 15:29, Leon Romanovsky wrote:
> >>> On Sun, May 10, 2020 at 02:59:18PM +0300, Gal Pressman wrote:
> >>>> diff --git a/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h b/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
> >>>> index 96b104ab5415..efdeebc9ea9b 100644
> >>>> --- a/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
> >>>> +++ b/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h
> >>>> @@ -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,55 @@ struct efa_admin_mmio_req_read_less_resp {
> >>>>  	u32 reg_val;
> >>>>  };
> >>>>
> >>>> +enum efa_admin_os_type {
> >>>> +	EFA_ADMIN_OS_LINUX                          = 0,
> >>>> +	EFA_ADMIN_OS_WINDOWS                        = 1,
> >>>
> >>> Not used.
> >>
> >> That's the device interface..
> >
> > It doesn't matter, we don't add code/defines that are not in use.
>
> First of all, that's not true, look at mlx5 device spec for example.
> It's 10k lines long and has many unused values..

Patch that removes that crap is more than welcomed.

>
> I don't think we should go as far as commits like 1759d322f4ba ("net/mlx5: Add
> hardware definitions for sub functions") which adds new commands interface
> without implementing it (nor does any following patch), but exposing the related
> bits directly in the scope of the feature that's being introduced is different.

It is not on my watch and feel free to NAK any patch that tries to do the same.

>
> The driver version fields that you don't like are going to stay there as they're
> the device ABI, and IMHO "hiding" them as reserved has zero upsides and won't
> change the fact that they're unused.

Our views are different.

Thanks

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

end of thread, other threads:[~2020-05-11 16:35 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-10 11:59 [PATCH for-next 0/2] EFA host information Gal Pressman
2020-05-10 11:59 ` [PATCH for-next 1/2] RDMA/efa: Fix setting of wrong bit in get/set_feature commands Gal Pressman
2020-05-10 11:59 ` [PATCH for-next 2/2] RDMA/efa: Report host information to the device Gal Pressman
2020-05-10 12:29   ` Leon Romanovsky
2020-05-10 13:05     ` Gal Pressman
2020-05-10 15:16       ` Leon Romanovsky
2020-05-11 12:47         ` Gal Pressman
2020-05-11 16:34           ` Leon Romanovsky
2020-05-10 13:42   ` kbuild test robot
2020-05-10 13:42     ` kbuild test robot
2020-05-10 14:40     ` Gal Pressman
2020-05-10 15:11       ` Leon Romanovsky
2020-05-10 15:11         ` Leon Romanovsky
2020-05-11 12:40         ` Gal Pressman

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.