Extend UAR to have DevX UID
Subsystems (5)
cover Extend UAR to have DevX UID
From: Leon Romanovsky <[email protected]>
Changelog:
v1:
* Renamed functions and unexport mlx5_core uar calls.
v0: https://lore.kernel.org/all/[email protected]
----------------------------------------------------------------------
Hi,
This is short series from Meir that adds DevX UID to the UAR.
Thanks
Meir Lichtinger (2):
net/mlx5: Add uid field to UAR allocation structures IB/mlx5: Enable UAR to have DevX UID
drivers/infiniband/hw/mlx5/cmd.c | 26 +++++++++ drivers/infiniband/hw/mlx5/cmd.h | 2 + drivers/infiniband/hw/mlx5/main.c | 55 +++++++++++-------- drivers/net/ethernet/mellanox/mlx5/core/uar.c | 14 ++--- include/linux/mlx5/driver.h | 2 - include/linux/mlx5/mlx5_ifc.h | 4 +- 6 files changed, 68 insertions(+), 35 deletions(-)
Signature · 1 line
2.31.1
PATCH 1/2 net/mlx5: Add uid field to UAR allocation structures
From: Meir Lichtinger <[email protected]>
Add uid field to mlx5_ifc_alloc_uar_in_bits andmlx5_ifc_dealloc_uar_out_bits structs.
This field will be used by FW to manage UAR according to uid.
--- include/linux/mlx5/mlx5_ifc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/mlx5/mlx5_ifc.h +2 -2
@@ -7573,7 +7573,7 @@ struct mlx5_ifc_dealloc_uar_out_bits {struct mlx5_ifc_dealloc_uar_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
@@ -8420,7 +8420,7 @@ struct mlx5_ifc_alloc_uar_out_bits {struct mlx5_ifc_alloc_uar_in_bits {u8 opcode[0x10 ]; -u8 reserved_at_10[0x10 ]; +u8 uid[0x10 ];u8 reserved_at_20[0x10 ];u8 op_mod[0x10 ];
Signature · 1 line
2.31.1
PATCH 2/2 IB/mlx5: Enable UAR to have DevX UID
In reply to Leon RomanovskyFrom: Meir Lichtinger <[email protected]>
UID field was added to alloc_uar and dealloc_uar PRM command, to specify DevX UID for UAR. This change enables firmware validating user access to its own UAR resources.
For the kernel allocated UARs the UID will stay 0 as of today.
--- drivers/infiniband/hw/mlx5/cmd.c | 26 +++++++++ drivers/infiniband/hw/mlx5/cmd.h | 2 + drivers/infiniband/hw/mlx5/main.c | 55 +++++++++++-------- drivers/net/ethernet/mellanox/mlx5/core/uar.c | 14 ++--- include/linux/mlx5/driver.h | 2 - 5 files changed, 66 insertions(+), 33 deletions(-)
drivers/infiniband/hw/mlx5/cmd.c +26 -0
@@ -206,3 +206,29 @@ int mlx5_cmd_mad_ifc(struct mlx5_core_dev *dev, const void *inb, void *outb,kfree (in);return err; } + +int mlx5_cmd_uar_alloc (struct mlx5_core_dev *dev,u32 *uarn,u16 uid) +{ +u32 out[MLX5_ST_SZ_DW (alloc_uar_out)] = {}; +u32 in[MLX5_ST_SZ_DW (alloc_uar_in)] = {}; +int err; + +MLX5_SET (alloc_uar_in, in, opcode,MLX5_CMD_OP_ALLOC_UAR ); +MLX5_SET (alloc_uar_in, in, uid, uid); + err =mlx5_cmd_exec_inout (dev, alloc_uar, in, out); +if (err) +return err; + + *uarn =MLX5_GET (alloc_uar_out, out, uar); +return 0 ; +} + +int mlx5_cmd_uar_dealloc (struct mlx5_core_dev *dev,u32 uarn,u16 uid) +{ +u32 in[MLX5_ST_SZ_DW (dealloc_uar_in)] = {}; + +MLX5_SET (dealloc_uar_in, in, opcode,MLX5_CMD_OP_DEALLOC_UAR ); +MLX5_SET (dealloc_uar_in, in, uar, uarn); +MLX5_SET (dealloc_uar_in, in, uid, uid); +return mlx5_cmd_exec_in (dev, dealloc_uar, in); +}
drivers/infiniband/hw/mlx5/cmd.h +2 -0
@@ -57,4 +57,6 @@ int mlx5_cmd_xrcd_alloc(struct mlx5_core_dev *dev, u32 *xrcdn, u16 uid);int mlx5_cmd_xrcd_dealloc (struct mlx5_core_dev *dev,u32 xrcdn,u16 uid);int mlx5_cmd_mad_ifc (struct mlx5_core_dev *dev,const void *inb,void *outb,u16 opmod,u8 port); +int mlx5_cmd_uar_alloc (struct mlx5_core_dev *dev,u32 *uarn,u16 uid); +int mlx5_cmd_uar_dealloc (struct mlx5_core_dev *dev,u32 uarn,u16 uid);#endif /* MLX5_IB_CMD_H */
drivers/infiniband/hw/mlx5/main.c +31 -24
157 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/uar.c +7 -7
@@ -36,7 +36,7 @@#include <linux/mlx5/driver.h> #include "mlx5_core.h" -int mlx5_cmd_alloc_uar (struct mlx5_core_dev *dev,u32 *uarn) +static int mlx5_cmd_alloc_uar (struct mlx5_core_dev *dev,u32 *uarn) {u32 out[MLX5_ST_SZ_DW (alloc_uar_out)] = {};u32 in[MLX5_ST_SZ_DW (alloc_uar_in)] = {};
@@ -44,13 +44,14 @@ int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn)MLX5_SET (alloc_uar_in, in, opcode,MLX5_CMD_OP_ALLOC_UAR ); err =mlx5_cmd_exec_inout (dev, alloc_uar, in, out); -if (!err) - *uarn =MLX5_GET (alloc_uar_out, out, uar); -return err; +if (err) +return err; + + *uarn =MLX5_GET (alloc_uar_out, out, uar); +return 0 ; } -EXPORT_SYMBOL (mlx5_cmd_alloc_uar); -int mlx5_cmd_free_uar (struct mlx5_core_dev *dev,u32 uarn) +static int mlx5_cmd_free_uar (struct mlx5_core_dev *dev,u32 uarn) {u32 in[MLX5_ST_SZ_DW (dealloc_uar_in)] = {};
@@ -58,7 +59,6 @@ int mlx5_cmd_free_uar(struct mlx5_core_dev *dev, u32 uarn)MLX5_SET (dealloc_uar_in, in, uar, uarn);return mlx5_cmd_exec_in (dev, dealloc_uar, in); } -EXPORT_SYMBOL (mlx5_cmd_free_uar);static int uars_per_sys_page (struct mlx5_core_dev *mdev) {
include/linux/mlx5/driver.h +0 -2
@@ -1005,8 +1005,6 @@ void mlx5_cmd_mbox_status(void *out, u8 *status, u32 *syndrome);bool mlx5_cmd_is_down (struct mlx5_core_dev *dev);int mlx5_core_get_caps (struct mlx5_core_dev *dev,enum mlx5_cap_type cap_type); -int mlx5_cmd_alloc_uar (struct mlx5_core_dev *dev,u32 *uarn); -int mlx5_cmd_free_uar (struct mlx5_core_dev *dev,u32 uarn);void mlx5_health_flush (struct mlx5_core_dev *dev);void mlx5_health_cleanup (struct mlx5_core_dev *dev);int mlx5_health_init (struct mlx5_core_dev *dev);
Signature · 1 line
2.31.1
Jason Gunthorpe
maintainerQuoted 18 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
Changelog:
v1:
* Renamed functions and unexportmlx5_coreuar calls.
v0: https://lore.kernel.org/all/[email protected]
----------------------------------------------------------------------Hi,
This is short series from Meir that adds DevX UID to the UAR.
Thanks
Meir Lichtinger (2):
net/mlx5: Add uid field to UAR allocation structures IB/mlx5: Enable UAR to have DevX UID
Quoted 7 lines
drivers/infiniband/hw/mlx5/cmd.c | 26 +++++++++ drivers/infiniband/hw/mlx5/cmd.h | 2 + drivers/infiniband/hw/mlx5/main.c | 55 +++++++++++-------- drivers/net/ethernet/mellanox/mlx5/core/uar.c | 14 ++--- include/linux/mlx5/driver.h | 2 - include/linux/mlx5/mlx5_ifc.h | 4 +- 6 files changed, 68 insertions(+), 35 deletions(-)
This seems fine, can you update the shared branch please
Jason
Quoted 27 lines · Jason Gunthorpe
Quoted 18 lines · Leon Romanovsky
From: Leon Romanovsky <[email protected]>
Changelog:
v1:
* Renamed functions and unexportmlx5_coreuar calls.
v0: https://lore.kernel.org/all/[email protected]
----------------------------------------------------------------------Hi,
This is short series from Meir that adds DevX UID to the UAR.
Thanks
Meir Lichtinger (2):
net/mlx5: Add uid field to UAR allocation structures IB/mlx5: Enable UAR to have DevX UIDQuoted 7 lines
drivers/infiniband/hw/mlx5/cmd.c | 26 +++++++++ drivers/infiniband/hw/mlx5/cmd.h | 2 + drivers/infiniband/hw/mlx5/main.c | 55 +++++++++++-------- drivers/net/ethernet/mellanox/mlx5/core/uar.c | 14 ++--- include/linux/mlx5/driver.h | 2 - include/linux/mlx5/mlx5_ifc.h | 4 +- 6 files changed, 68 insertions(+), 35 deletions(-)
Quoted 1 line
This seems fine, can you update the shared branch please
Done, thanksd2c8a1554c10 IB/mlx5: Enable UAR to have DevX UID 8de1e9b01b03 net/mlx5: Add uid field to UAR allocation structures
Quoted 2 lines
Jason