xref: /openbmc/linux/include/linux/mlx5/mlx5_ifc_vdpa.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
10aae392bSLeon Romanovsky /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
20aae392bSLeon Romanovsky /* Copyright (c) 2020 Mellanox Technologies Ltd. */
30aae392bSLeon Romanovsky 
40aae392bSLeon Romanovsky #ifndef __MLX5_IFC_VDPA_H_
50aae392bSLeon Romanovsky #define __MLX5_IFC_VDPA_H_
60aae392bSLeon Romanovsky 
70aae392bSLeon Romanovsky enum {
80aae392bSLeon Romanovsky 	MLX5_VIRTIO_Q_EVENT_MODE_NO_MSIX_MODE  = 0x0,
90aae392bSLeon Romanovsky 	MLX5_VIRTIO_Q_EVENT_MODE_QP_MODE       = 0x1,
100aae392bSLeon Romanovsky 	MLX5_VIRTIO_Q_EVENT_MODE_MSIX_MODE     = 0x2,
110aae392bSLeon Romanovsky };
120aae392bSLeon Romanovsky 
130aae392bSLeon Romanovsky enum {
14879753c8SEli Cohen 	MLX5_VIRTIO_EMULATION_VIRTIO_QUEUE_TYPE_SPLIT   = 0,
15879753c8SEli Cohen 	MLX5_VIRTIO_EMULATION_VIRTIO_QUEUE_TYPE_PACKED  = 1,
160aae392bSLeon Romanovsky };
170aae392bSLeon Romanovsky 
180aae392bSLeon Romanovsky enum {
19879753c8SEli Cohen 	MLX5_VIRTIO_EMULATION_CAP_VIRTIO_QUEUE_TYPE_SPLIT =
20879753c8SEli Cohen 		BIT(MLX5_VIRTIO_EMULATION_VIRTIO_QUEUE_TYPE_SPLIT),
21879753c8SEli Cohen 	MLX5_VIRTIO_EMULATION_CAP_VIRTIO_QUEUE_TYPE_PACKED =
22879753c8SEli Cohen 		BIT(MLX5_VIRTIO_EMULATION_VIRTIO_QUEUE_TYPE_PACKED),
230aae392bSLeon Romanovsky };
240aae392bSLeon Romanovsky 
250aae392bSLeon Romanovsky struct mlx5_ifc_virtio_q_bits {
260aae392bSLeon Romanovsky 	u8    virtio_q_type[0x8];
270aae392bSLeon Romanovsky 	u8    reserved_at_8[0x5];
280aae392bSLeon Romanovsky 	u8    event_mode[0x3];
290aae392bSLeon Romanovsky 	u8    queue_index[0x10];
300aae392bSLeon Romanovsky 
310aae392bSLeon Romanovsky 	u8    full_emulation[0x1];
320aae392bSLeon Romanovsky 	u8    virtio_version_1_0[0x1];
330aae392bSLeon Romanovsky 	u8    reserved_at_22[0x2];
340aae392bSLeon Romanovsky 	u8    offload_type[0x4];
350aae392bSLeon Romanovsky 	u8    event_qpn_or_msix[0x18];
360aae392bSLeon Romanovsky 
370aae392bSLeon Romanovsky 	u8    doorbell_stride_index[0x10];
380aae392bSLeon Romanovsky 	u8    queue_size[0x10];
390aae392bSLeon Romanovsky 
400aae392bSLeon Romanovsky 	u8    device_emulation_id[0x20];
410aae392bSLeon Romanovsky 
420aae392bSLeon Romanovsky 	u8    desc_addr[0x40];
430aae392bSLeon Romanovsky 
440aae392bSLeon Romanovsky 	u8    used_addr[0x40];
450aae392bSLeon Romanovsky 
460aae392bSLeon Romanovsky 	u8    available_addr[0x40];
470aae392bSLeon Romanovsky 
480aae392bSLeon Romanovsky 	u8    virtio_q_mkey[0x20];
490aae392bSLeon Romanovsky 
500aae392bSLeon Romanovsky 	u8    max_tunnel_desc[0x10];
510aae392bSLeon Romanovsky 	u8    reserved_at_170[0x8];
520aae392bSLeon Romanovsky 	u8    error_type[0x8];
530aae392bSLeon Romanovsky 
540aae392bSLeon Romanovsky 	u8    umem_1_id[0x20];
550aae392bSLeon Romanovsky 
560aae392bSLeon Romanovsky 	u8    umem_1_size[0x20];
570aae392bSLeon Romanovsky 
580aae392bSLeon Romanovsky 	u8    umem_1_offset[0x40];
590aae392bSLeon Romanovsky 
600aae392bSLeon Romanovsky 	u8    umem_2_id[0x20];
610aae392bSLeon Romanovsky 
620aae392bSLeon Romanovsky 	u8    umem_2_size[0x20];
630aae392bSLeon Romanovsky 
640aae392bSLeon Romanovsky 	u8    umem_2_offset[0x40];
650aae392bSLeon Romanovsky 
660aae392bSLeon Romanovsky 	u8    umem_3_id[0x20];
670aae392bSLeon Romanovsky 
680aae392bSLeon Romanovsky 	u8    umem_3_size[0x20];
690aae392bSLeon Romanovsky 
700aae392bSLeon Romanovsky 	u8    umem_3_offset[0x40];
710aae392bSLeon Romanovsky 
720aae392bSLeon Romanovsky 	u8    counter_set_id[0x20];
730aae392bSLeon Romanovsky 
740aae392bSLeon Romanovsky 	u8    reserved_at_320[0x8];
750aae392bSLeon Romanovsky 	u8    pd[0x18];
760aae392bSLeon Romanovsky 
770aae392bSLeon Romanovsky 	u8    reserved_at_340[0xc0];
780aae392bSLeon Romanovsky };
790aae392bSLeon Romanovsky 
800aae392bSLeon Romanovsky struct mlx5_ifc_virtio_net_q_object_bits {
810aae392bSLeon Romanovsky 	u8    modify_field_select[0x40];
820aae392bSLeon Romanovsky 
830aae392bSLeon Romanovsky 	u8    reserved_at_40[0x20];
840aae392bSLeon Romanovsky 
850aae392bSLeon Romanovsky 	u8    vhca_id[0x10];
860aae392bSLeon Romanovsky 	u8    reserved_at_70[0x10];
870aae392bSLeon Romanovsky 
880aae392bSLeon Romanovsky 	u8    queue_feature_bit_mask_12_3[0xa];
890aae392bSLeon Romanovsky 	u8    dirty_bitmap_dump_enable[0x1];
900aae392bSLeon Romanovsky 	u8    vhost_log_page[0x5];
910aae392bSLeon Romanovsky 	u8    reserved_at_90[0xc];
920aae392bSLeon Romanovsky 	u8    state[0x4];
930aae392bSLeon Romanovsky 
940aae392bSLeon Romanovsky 	u8    reserved_at_a0[0x5];
950aae392bSLeon Romanovsky 	u8    queue_feature_bit_mask_2_0[0x3];
960aae392bSLeon Romanovsky 	u8    tisn_or_qpn[0x18];
970aae392bSLeon Romanovsky 
980aae392bSLeon Romanovsky 	u8    dirty_bitmap_mkey[0x20];
990aae392bSLeon Romanovsky 
1000aae392bSLeon Romanovsky 	u8    dirty_bitmap_size[0x20];
1010aae392bSLeon Romanovsky 
1020aae392bSLeon Romanovsky 	u8    dirty_bitmap_addr[0x40];
1030aae392bSLeon Romanovsky 
1040aae392bSLeon Romanovsky 	u8    hw_available_index[0x10];
1050aae392bSLeon Romanovsky 	u8    hw_used_index[0x10];
1060aae392bSLeon Romanovsky 
1070aae392bSLeon Romanovsky 	u8    reserved_at_160[0xa0];
1080aae392bSLeon Romanovsky 
1090aae392bSLeon Romanovsky 	struct mlx5_ifc_virtio_q_bits virtio_q_context;
1100aae392bSLeon Romanovsky };
1110aae392bSLeon Romanovsky 
1120aae392bSLeon Romanovsky struct mlx5_ifc_create_virtio_net_q_in_bits {
1130aae392bSLeon Romanovsky 	struct mlx5_ifc_general_obj_in_cmd_hdr_bits general_obj_in_cmd_hdr;
1140aae392bSLeon Romanovsky 
1150aae392bSLeon Romanovsky 	struct mlx5_ifc_virtio_net_q_object_bits obj_context;
1160aae392bSLeon Romanovsky };
1170aae392bSLeon Romanovsky 
1180aae392bSLeon Romanovsky struct mlx5_ifc_create_virtio_net_q_out_bits {
1190aae392bSLeon Romanovsky 	struct mlx5_ifc_general_obj_out_cmd_hdr_bits general_obj_out_cmd_hdr;
1200aae392bSLeon Romanovsky };
1210aae392bSLeon Romanovsky 
1220aae392bSLeon Romanovsky struct mlx5_ifc_destroy_virtio_net_q_in_bits {
1230aae392bSLeon Romanovsky 	struct mlx5_ifc_general_obj_in_cmd_hdr_bits general_obj_out_cmd_hdr;
1240aae392bSLeon Romanovsky };
1250aae392bSLeon Romanovsky 
1260aae392bSLeon Romanovsky struct mlx5_ifc_destroy_virtio_net_q_out_bits {
1270aae392bSLeon Romanovsky 	struct mlx5_ifc_general_obj_out_cmd_hdr_bits general_obj_out_cmd_hdr;
1280aae392bSLeon Romanovsky };
1290aae392bSLeon Romanovsky 
1300aae392bSLeon Romanovsky struct mlx5_ifc_query_virtio_net_q_in_bits {
1310aae392bSLeon Romanovsky 	struct mlx5_ifc_general_obj_in_cmd_hdr_bits general_obj_in_cmd_hdr;
1320aae392bSLeon Romanovsky };
1330aae392bSLeon Romanovsky 
1340aae392bSLeon Romanovsky struct mlx5_ifc_query_virtio_net_q_out_bits {
1350aae392bSLeon Romanovsky 	struct mlx5_ifc_general_obj_out_cmd_hdr_bits general_obj_out_cmd_hdr;
1360aae392bSLeon Romanovsky 
1370aae392bSLeon Romanovsky 	struct mlx5_ifc_virtio_net_q_object_bits obj_context;
1380aae392bSLeon Romanovsky };
1390aae392bSLeon Romanovsky 
1400aae392bSLeon Romanovsky enum {
1410aae392bSLeon Romanovsky 	MLX5_VIRTQ_MODIFY_MASK_STATE                    = (u64)1 << 0,
1420aae392bSLeon Romanovsky 	MLX5_VIRTQ_MODIFY_MASK_DIRTY_BITMAP_PARAMS      = (u64)1 << 3,
1430aae392bSLeon Romanovsky 	MLX5_VIRTQ_MODIFY_MASK_DIRTY_BITMAP_DUMP_ENABLE = (u64)1 << 4,
1440aae392bSLeon Romanovsky };
1450aae392bSLeon Romanovsky 
1460aae392bSLeon Romanovsky enum {
1470aae392bSLeon Romanovsky 	MLX5_VIRTIO_NET_Q_OBJECT_STATE_INIT     = 0x0,
1480aae392bSLeon Romanovsky 	MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY      = 0x1,
1490aae392bSLeon Romanovsky 	MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND  = 0x2,
1500aae392bSLeon Romanovsky 	MLX5_VIRTIO_NET_Q_OBJECT_STATE_ERR      = 0x3,
1510aae392bSLeon Romanovsky };
1520aae392bSLeon Romanovsky 
153*cae15c2eSEli Cohen /* This indicates that the object was not created or has already
154*cae15c2eSEli Cohen  * been desroyed. It is very safe to assume that this object will never
155*cae15c2eSEli Cohen  * have so many states
156*cae15c2eSEli Cohen  */
157*cae15c2eSEli Cohen enum {
158*cae15c2eSEli Cohen 	MLX5_VIRTIO_NET_Q_OBJECT_NONE = 0xffffffff
159*cae15c2eSEli Cohen };
160*cae15c2eSEli Cohen 
1610aae392bSLeon Romanovsky enum {
1620aae392bSLeon Romanovsky 	MLX5_RQTC_LIST_Q_TYPE_RQ            = 0x0,
1630aae392bSLeon Romanovsky 	MLX5_RQTC_LIST_Q_TYPE_VIRTIO_NET_Q  = 0x1,
1640aae392bSLeon Romanovsky };
1650aae392bSLeon Romanovsky 
1660aae392bSLeon Romanovsky struct mlx5_ifc_modify_virtio_net_q_in_bits {
1670aae392bSLeon Romanovsky 	struct mlx5_ifc_general_obj_in_cmd_hdr_bits general_obj_in_cmd_hdr;
1680aae392bSLeon Romanovsky 
1690aae392bSLeon Romanovsky 	struct mlx5_ifc_virtio_net_q_object_bits obj_context;
1700aae392bSLeon Romanovsky };
1710aae392bSLeon Romanovsky 
1720aae392bSLeon Romanovsky struct mlx5_ifc_modify_virtio_net_q_out_bits {
1730aae392bSLeon Romanovsky 	struct mlx5_ifc_general_obj_out_cmd_hdr_bits general_obj_out_cmd_hdr;
1740aae392bSLeon Romanovsky };
1750aae392bSLeon Romanovsky 
1761892a3d4SEli Cohen struct mlx5_ifc_virtio_q_counters_bits {
1771892a3d4SEli Cohen 	u8    modify_field_select[0x40];
1781892a3d4SEli Cohen 	u8    reserved_at_40[0x40];
1791892a3d4SEli Cohen 	u8    received_desc[0x40];
1801892a3d4SEli Cohen 	u8    completed_desc[0x40];
1811892a3d4SEli Cohen 	u8    error_cqes[0x20];
1821892a3d4SEli Cohen 	u8    bad_desc_errors[0x20];
1831892a3d4SEli Cohen 	u8    exceed_max_chain[0x20];
1841892a3d4SEli Cohen 	u8    invalid_buffer[0x20];
1851892a3d4SEli Cohen 	u8    reserved_at_180[0x280];
1861892a3d4SEli Cohen };
1871892a3d4SEli Cohen 
1881892a3d4SEli Cohen struct mlx5_ifc_create_virtio_q_counters_in_bits {
1891892a3d4SEli Cohen 	struct mlx5_ifc_general_obj_in_cmd_hdr_bits hdr;
1901892a3d4SEli Cohen 	struct mlx5_ifc_virtio_q_counters_bits virtio_q_counters;
1911892a3d4SEli Cohen };
1921892a3d4SEli Cohen 
1931892a3d4SEli Cohen struct mlx5_ifc_create_virtio_q_counters_out_bits {
1941892a3d4SEli Cohen 	struct mlx5_ifc_general_obj_in_cmd_hdr_bits hdr;
1951892a3d4SEli Cohen 	struct mlx5_ifc_virtio_q_counters_bits virtio_q_counters;
1961892a3d4SEli Cohen };
1971892a3d4SEli Cohen 
1981892a3d4SEli Cohen struct mlx5_ifc_destroy_virtio_q_counters_in_bits {
1991892a3d4SEli Cohen 	struct mlx5_ifc_general_obj_in_cmd_hdr_bits hdr;
2001892a3d4SEli Cohen };
2011892a3d4SEli Cohen 
2021892a3d4SEli Cohen struct mlx5_ifc_destroy_virtio_q_counters_out_bits {
2031892a3d4SEli Cohen 	struct mlx5_ifc_general_obj_out_cmd_hdr_bits hdr;
2041892a3d4SEli Cohen };
2051892a3d4SEli Cohen 
2061892a3d4SEli Cohen struct mlx5_ifc_query_virtio_q_counters_in_bits {
2071892a3d4SEli Cohen 	struct mlx5_ifc_general_obj_in_cmd_hdr_bits hdr;
2081892a3d4SEli Cohen };
2091892a3d4SEli Cohen 
2101892a3d4SEli Cohen struct mlx5_ifc_query_virtio_q_counters_out_bits {
2111892a3d4SEli Cohen 	struct mlx5_ifc_general_obj_in_cmd_hdr_bits hdr;
2121892a3d4SEli Cohen 	struct mlx5_ifc_virtio_q_counters_bits counters;
2131892a3d4SEli Cohen };
2141892a3d4SEli Cohen 
2150aae392bSLeon Romanovsky #endif /* __MLX5_IFC_VDPA_H_ */
216