f618b3f075
Some infrastructures below, Implement SdmaTimePacket which records the global GPU timestamp. Introduce class AsyncMPSQ and AsyncMPMQ. AsyncMPSQ is aka async multiple packet single queue. It takes a set of packet when create and submits them to a GPU to run. While AsyncMPMQ is aka async multiple packet multiple queue. It manages a set of AsyncMPSQ, and use a forloop to do operations of AsyncMPSQ. Implement sdma_multicopy helper functions. Change-Id: I47e1d2ca9630113b2a1d85a0055f3f8ee629fb5f Signed-off-by: xinhui pan <xinhui.pan@amd.com>
358 خطوط
7.2 KiB
C
358 خطوط
7.2 KiB
C
/*
|
|
* Copyright (C) 2014-2018 Advanced Micro Devices, Inc. All Rights Reserved.
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
* to deal in the Software without restriction, including without limitation
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
*
|
|
*/
|
|
|
|
#ifndef __SDMA_PKT_STRUCT_H__
|
|
#define __SDMA_PKT_STRUCT_H__
|
|
|
|
|
|
const unsigned int SDMA_OP_COPY = 1;
|
|
const unsigned int SDMA_OP_WRITE = 2;
|
|
|
|
const unsigned int SDMA_OP_FENCE = 5;
|
|
const unsigned int SDMA_OP_TRAP = 6;
|
|
const unsigned int SDMA_OP_TIMESTAMP = 13;
|
|
|
|
const unsigned int SDMA_OP_CONST_FILL = 11;
|
|
|
|
const unsigned int SDMA_SUBOP_COPY_LINEAR = 0;
|
|
|
|
const unsigned int SDMA_SUBOP_WRITE_LINEAR = 0;
|
|
|
|
/*
|
|
** Definitions for SDMA_PKT_COPY_LINEAR packet
|
|
*/
|
|
|
|
typedef struct SDMA_PKT_COPY_LINEAR_TAG
|
|
{
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int op:8;
|
|
unsigned int sub_op:8;
|
|
unsigned int reserved_0:11;
|
|
unsigned int broadcast:1;
|
|
unsigned int reserved_1:4;
|
|
};
|
|
unsigned int DW_0_DATA;
|
|
} HEADER_UNION;
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int count:22;
|
|
unsigned int reserved_0:10;
|
|
};
|
|
unsigned int DW_1_DATA;
|
|
} COUNT_UNION;
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int reserved_0:16;
|
|
unsigned int dst_sw:2;
|
|
unsigned int reserved_1:4;
|
|
unsigned int dst_ha:1;
|
|
unsigned int reserved_2:1;
|
|
unsigned int src_sw:2;
|
|
unsigned int reserved_3:4;
|
|
unsigned int src_ha:1;
|
|
unsigned int reserved_4:1;
|
|
};
|
|
unsigned int DW_2_DATA;
|
|
} PARAMETER_UNION;
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int src_addr_31_0:32;
|
|
};
|
|
unsigned int DW_3_DATA;
|
|
} SRC_ADDR_LO_UNION;
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int src_addr_63_32:32;
|
|
};
|
|
unsigned int DW_4_DATA;
|
|
} SRC_ADDR_HI_UNION;
|
|
|
|
struct
|
|
{
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int dst_addr_31_0:32;
|
|
};
|
|
unsigned int DW_5_DATA;
|
|
} DST_ADDR_LO_UNION;
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int dst_addr_63_32:32;
|
|
};
|
|
unsigned int DW_6_DATA;
|
|
} DST_ADDR_HI_UNION;
|
|
} DST_ADDR[0];
|
|
} SDMA_PKT_COPY_LINEAR, *PSDMA_PKT_COPY_LINEAR;
|
|
|
|
/*
|
|
** Definitions for SDMA_PKT_WRITE_UNTILED packet
|
|
*/
|
|
|
|
typedef struct SDMA_PKT_WRITE_UNTILED_TAG
|
|
{
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int op:8;
|
|
unsigned int sub_op:8;
|
|
unsigned int reserved_0:16;
|
|
};
|
|
unsigned int DW_0_DATA;
|
|
} HEADER_UNION;
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int dst_addr_31_0:32;
|
|
};
|
|
unsigned int DW_1_DATA;
|
|
} DST_ADDR_LO_UNION;
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int dst_addr_63_32:32;
|
|
};
|
|
unsigned int DW_2_DATA;
|
|
} DST_ADDR_HI_UNION;
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int count:22;
|
|
unsigned int reserved_0:2;
|
|
unsigned int sw:2;
|
|
unsigned int reserved_1:6;
|
|
};
|
|
unsigned int DW_3_DATA;
|
|
} DW_3_UNION;
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int data0:32;
|
|
};
|
|
unsigned int DW_4_DATA;
|
|
} DATA0_UNION;
|
|
} SDMA_PKT_WRITE_UNTILED, *PSDMA_PKT_WRITE_UNTILED;
|
|
|
|
/*
|
|
** Definitions for SDMA_PKT_FENCE packet
|
|
*/
|
|
|
|
typedef struct SDMA_PKT_FENCE_TAG
|
|
{
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int op:8;
|
|
unsigned int sub_op:8;
|
|
unsigned int reserved_0:16;
|
|
};
|
|
unsigned int DW_0_DATA;
|
|
} HEADER_UNION;
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int addr_31_0:32;
|
|
};
|
|
unsigned int DW_1_DATA;
|
|
} ADDR_LO_UNION;
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int addr_63_32:32;
|
|
};
|
|
unsigned int DW_2_DATA;
|
|
} ADDR_HI_UNION;
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int data:32;
|
|
};
|
|
unsigned int DW_3_DATA;
|
|
} DATA_UNION;
|
|
} SDMA_PKT_FENCE, *PSDMA_PKT_FENCE;
|
|
|
|
/*
|
|
** Definitions for SDMA_PKT_CONSTANT_FILL packet
|
|
*/
|
|
|
|
typedef struct SDMA_PKT_CONSTANT_FILL_TAG
|
|
{
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int op:8;
|
|
unsigned int sub_op:8;
|
|
unsigned int sw:2;
|
|
unsigned int reserved_0:12;
|
|
unsigned int fillsize:2;
|
|
};
|
|
unsigned int DW_0_DATA;
|
|
} HEADER_UNION;
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int dst_addr_31_0:32;
|
|
};
|
|
unsigned int DW_1_DATA;
|
|
} DST_ADDR_LO_UNION;
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int dst_addr_63_32:32;
|
|
};
|
|
unsigned int DW_2_DATA;
|
|
} DST_ADDR_HI_UNION;
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int src_data_31_0:32;
|
|
};
|
|
unsigned int DW_3_DATA;
|
|
} DATA_UNION;
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int count:22;
|
|
unsigned int reserved_0:10;
|
|
};
|
|
unsigned int DW_4_DATA;
|
|
} COUNT_UNION;
|
|
} SDMA_PKT_CONSTANT_FILL, *PSDMA_PKT_CONSTANT_FILL;
|
|
|
|
/*
|
|
** Definitions for SDMA_PKT_TRAP packet
|
|
*/
|
|
|
|
typedef struct SDMA_PKT_TRAP_TAG
|
|
{
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int op:8;
|
|
unsigned int sub_op:8;
|
|
unsigned int reserved_0:16;
|
|
};
|
|
unsigned int DW_0_DATA;
|
|
} HEADER_UNION;
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int int_context:28;
|
|
unsigned int reserved_0:4;
|
|
};
|
|
unsigned int DW_1_DATA;
|
|
} INT_CONTEXT_UNION;
|
|
} SDMA_PKT_TRAP, *PSDMA_PKT_TRAP;
|
|
|
|
|
|
/*
|
|
** Definitions for SDMA_PKT_TIMESTAMP packet
|
|
*/
|
|
|
|
typedef struct SDMA_PKT_TIMESTAMP_TAG
|
|
{
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int op:8;
|
|
unsigned int sub_op:8;
|
|
unsigned int reserved_0:16;
|
|
};
|
|
unsigned int DW_0_DATA;
|
|
} HEADER_UNION;
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int addr_31_0:32;
|
|
};
|
|
unsigned int DW_1_DATA;
|
|
} ADDR_LO_UNION;
|
|
|
|
union
|
|
{
|
|
struct
|
|
{
|
|
unsigned int addr_63_32:32;
|
|
};
|
|
unsigned int DW_2_DATA;
|
|
} ADDR_HI_UNION;
|
|
} SDMA_PKT_TIMESTAMP, *PSDMA_PKT_TIMESTAMP;
|
|
|
|
#endif // __SDMA_PKT_STRUCT_H__
|