@@ -1925,6 +1925,70 @@ int dxgvmb_send_query_alloc_residency(struct dxgprocess *process,
19251925 return ret ;
19261926}
19271927
1928+ int dxgvmb_send_escape (struct dxgprocess * process ,
1929+ struct dxgadapter * adapter ,
1930+ struct d3dkmt_escape * args )
1931+ {
1932+ int ret ;
1933+ struct dxgkvmb_command_escape * command = NULL ;
1934+ u32 cmd_size = sizeof (* command );
1935+ struct dxgvmbusmsg msg = {.hdr = NULL };
1936+
1937+ if (args -> priv_drv_data_size > DXG_MAX_VM_BUS_PACKET_SIZE ) {
1938+ ret = - EINVAL ;
1939+ goto cleanup ;
1940+ }
1941+
1942+ cmd_size = cmd_size - sizeof (args -> priv_drv_data [0 ]) +
1943+ args -> priv_drv_data_size ;
1944+
1945+ ret = init_message (& msg , adapter , process , cmd_size );
1946+ if (ret )
1947+ goto cleanup ;
1948+ command = (void * )msg .msg ;
1949+ command_vgpu_to_host_init2 (& command -> hdr ,
1950+ DXGK_VMBCOMMAND_ESCAPE ,
1951+ process -> host_handle );
1952+ command -> adapter = args -> adapter ;
1953+ command -> device = args -> device ;
1954+ command -> type = args -> type ;
1955+ command -> flags = args -> flags ;
1956+ command -> priv_drv_data_size = args -> priv_drv_data_size ;
1957+ command -> context = args -> context ;
1958+ if (args -> priv_drv_data_size ) {
1959+ ret = copy_from_user (command -> priv_drv_data ,
1960+ args -> priv_drv_data ,
1961+ args -> priv_drv_data_size );
1962+ if (ret ) {
1963+ DXG_ERR ("failed to copy priv data" );
1964+ ret = - EINVAL ;
1965+ goto cleanup ;
1966+ }
1967+ }
1968+
1969+ ret = dxgvmb_send_sync_msg (msg .channel , msg .hdr , msg .size ,
1970+ command -> priv_drv_data ,
1971+ args -> priv_drv_data_size );
1972+ if (ret < 0 )
1973+ goto cleanup ;
1974+
1975+ if (args -> priv_drv_data_size ) {
1976+ ret = copy_to_user (args -> priv_drv_data ,
1977+ command -> priv_drv_data ,
1978+ args -> priv_drv_data_size );
1979+ if (ret ) {
1980+ DXG_ERR ("failed to copy priv data" );
1981+ ret = - EINVAL ;
1982+ }
1983+ }
1984+
1985+ cleanup :
1986+ free_message (& msg , process );
1987+ if (ret )
1988+ DXG_TRACE ("err: %d" , ret );
1989+ return ret ;
1990+ }
1991+
19281992int dxgvmb_send_query_vidmem_info (struct dxgprocess * process ,
19291993 struct dxgadapter * adapter ,
19301994 struct d3dkmt_queryvideomemoryinfo * args ,
@@ -1955,37 +2019,37 @@ int dxgvmb_send_query_vidmem_info(struct dxgprocess *process,
19552019 ret = copy_to_user (& output -> budget , & result .budget ,
19562020 sizeof (output -> budget ));
19572021 if (ret ) {
1958- pr_err ( "%s failed to copy budget", __func__ );
2022+ DXG_ERR ( " failed to copy budget" );
19592023 ret = - EINVAL ;
19602024 goto cleanup ;
19612025 }
19622026 ret = copy_to_user (& output -> current_usage , & result .current_usage ,
19632027 sizeof (output -> current_usage ));
19642028 if (ret ) {
1965- pr_err ( "%s failed to copy current usage", __func__ );
2029+ DXG_ERR ( " failed to copy current usage" );
19662030 ret = - EINVAL ;
19672031 goto cleanup ;
19682032 }
19692033 ret = copy_to_user (& output -> current_reservation ,
19702034 & result .current_reservation ,
19712035 sizeof (output -> current_reservation ));
19722036 if (ret ) {
1973- pr_err ( "%s failed to copy reservation", __func__ );
2037+ DXG_ERR ( " failed to copy reservation" );
19742038 ret = - EINVAL ;
19752039 goto cleanup ;
19762040 }
19772041 ret = copy_to_user (& output -> available_for_reservation ,
19782042 & result .available_for_reservation ,
19792043 sizeof (output -> available_for_reservation ));
19802044 if (ret ) {
1981- pr_err ( "%s failed to copy avail reservation", __func__ );
2045+ DXG_ERR ( " failed to copy avail reservation" );
19822046 ret = - EINVAL ;
19832047 }
19842048
19852049cleanup :
19862050 free_message (& msg , process );
19872051 if (ret )
1988- dev_dbg ( DXGDEV , "err: %d" , ret );
2052+ DXG_TRACE ( "err: %d" , ret );
19892053 return ret ;
19902054}
19912055
@@ -3152,3 +3216,4 @@ int dxgvmb_send_submit_command_hwqueue(struct dxgprocess *process,
31523216 DXG_TRACE ("err: %d" , ret );
31533217 return ret ;
31543218}
3219+
0 commit comments