@@ -1902,6 +1902,129 @@ dxgkio_destroy_allocation(struct dxgprocess *process, void *__user inargs)
19021902 return ret ;
19031903}
19041904
1905+ static int
1906+ dxgkio_submit_command (struct dxgprocess * process , void * __user inargs )
1907+ {
1908+ int ret ;
1909+ struct d3dkmt_submitcommand args ;
1910+ struct dxgdevice * device = NULL ;
1911+ struct dxgadapter * adapter = NULL ;
1912+
1913+ ret = copy_from_user (& args , inargs , sizeof (args ));
1914+ if (ret ) {
1915+ DXG_ERR ("failed to copy input args" );
1916+ ret = - EINVAL ;
1917+ goto cleanup ;
1918+ }
1919+
1920+ if (args .broadcast_context_count > D3DDDI_MAX_BROADCAST_CONTEXT ||
1921+ args .broadcast_context_count == 0 ) {
1922+ DXG_ERR ("invalid number of contexts" );
1923+ ret = - EINVAL ;
1924+ goto cleanup ;
1925+ }
1926+
1927+ if (args .priv_drv_data_size > DXG_MAX_VM_BUS_PACKET_SIZE ) {
1928+ DXG_ERR ("invalid private data size" );
1929+ ret = - EINVAL ;
1930+ goto cleanup ;
1931+ }
1932+
1933+ if (args .num_history_buffers > 1024 ) {
1934+ DXG_ERR ("invalid number of history buffers" );
1935+ ret = - EINVAL ;
1936+ goto cleanup ;
1937+ }
1938+
1939+ if (args .num_primaries > DXG_MAX_VM_BUS_PACKET_SIZE ) {
1940+ DXG_ERR ("invalid number of primaries" );
1941+ ret = - EINVAL ;
1942+ goto cleanup ;
1943+ }
1944+
1945+ device = dxgprocess_device_by_object_handle (process ,
1946+ HMGRENTRY_TYPE_DXGCONTEXT ,
1947+ args .broadcast_context [0 ]);
1948+ if (device == NULL ) {
1949+ ret = - EINVAL ;
1950+ goto cleanup ;
1951+ }
1952+
1953+ adapter = device -> adapter ;
1954+ ret = dxgadapter_acquire_lock_shared (adapter );
1955+ if (ret < 0 ) {
1956+ adapter = NULL ;
1957+ goto cleanup ;
1958+ }
1959+
1960+ ret = dxgvmb_send_submit_command (process , adapter , & args );
1961+
1962+ cleanup :
1963+
1964+ if (adapter )
1965+ dxgadapter_release_lock_shared (adapter );
1966+ if (device )
1967+ kref_put (& device -> device_kref , dxgdevice_release );
1968+
1969+ DXG_TRACE ("ioctl:%s %d" , errorstr (ret ), ret );
1970+ return ret ;
1971+ }
1972+
1973+ static int
1974+ dxgkio_submit_command_to_hwqueue (struct dxgprocess * process , void * __user inargs )
1975+ {
1976+ int ret ;
1977+ struct d3dkmt_submitcommandtohwqueue args ;
1978+ struct dxgdevice * device = NULL ;
1979+ struct dxgadapter * adapter = NULL ;
1980+
1981+ ret = copy_from_user (& args , inargs , sizeof (args ));
1982+ if (ret ) {
1983+ DXG_ERR ("failed to copy input args" );
1984+ ret = - EINVAL ;
1985+ goto cleanup ;
1986+ }
1987+
1988+ if (args .priv_drv_data_size > DXG_MAX_VM_BUS_PACKET_SIZE ) {
1989+ DXG_ERR ("invalid private data size" );
1990+ ret = - EINVAL ;
1991+ goto cleanup ;
1992+ }
1993+
1994+ if (args .num_primaries > DXG_MAX_VM_BUS_PACKET_SIZE ) {
1995+ DXG_ERR ("invalid number of primaries" );
1996+ ret = - EINVAL ;
1997+ goto cleanup ;
1998+ }
1999+
2000+ device = dxgprocess_device_by_object_handle (process ,
2001+ HMGRENTRY_TYPE_DXGHWQUEUE ,
2002+ args .hwqueue );
2003+ if (device == NULL ) {
2004+ ret = - EINVAL ;
2005+ goto cleanup ;
2006+ }
2007+
2008+ adapter = device -> adapter ;
2009+ ret = dxgadapter_acquire_lock_shared (adapter );
2010+ if (ret < 0 ) {
2011+ adapter = NULL ;
2012+ goto cleanup ;
2013+ }
2014+
2015+ ret = dxgvmb_send_submit_command_hwqueue (process , adapter , & args );
2016+
2017+ cleanup :
2018+
2019+ if (adapter )
2020+ dxgadapter_release_lock_shared (adapter );
2021+ if (device )
2022+ kref_put (& device -> device_kref , dxgdevice_release );
2023+
2024+ DXG_TRACE ("ioctl:%s %d" , errorstr (ret ), ret );
2025+ return ret ;
2026+ }
2027+
19052028static int
19062029dxgkio_submit_signal_to_hwqueue (struct dxgprocess * process , void * __user inargs )
19072030{
@@ -3666,7 +3789,7 @@ static struct ioctl_desc ioctls[] = {
36663789/* 0x0c */ {},
36673790/* 0x0d */ {},
36683791/* 0x0e */ {},
3669- /* 0x0f */ {},
3792+ /* 0x0f */ {dxgkio_submit_command , LX_DXSUBMITCOMMAND },
36703793/* 0x10 */ {dxgkio_create_sync_object , LX_DXCREATESYNCHRONIZATIONOBJECT },
36713794/* 0x11 */ {dxgkio_signal_sync_object , LX_DXSIGNALSYNCHRONIZATIONOBJECT },
36723795/* 0x12 */ {dxgkio_wait_sync_object , LX_DXWAITFORSYNCHRONIZATIONOBJECT },
@@ -3706,7 +3829,7 @@ static struct ioctl_desc ioctls[] = {
37063829 LX_DXSIGNALSYNCHRONIZATIONOBJECTFROMGPU },
37073830/* 0x33 */ {dxgkio_signal_sync_object_gpu2 ,
37083831 LX_DXSIGNALSYNCHRONIZATIONOBJECTFROMGPU2 },
3709- /* 0x34 */ {},
3832+ /* 0x34 */ {dxgkio_submit_command_to_hwqueue , LX_DXSUBMITCOMMANDTOHWQUEUE },
37103833/* 0x35 */ {dxgkio_submit_signal_to_hwqueue ,
37113834 LX_DXSUBMITSIGNALSYNCOBJECTSTOHWQUEUE },
37123835/* 0x36 */ {dxgkio_submit_wait_to_hwqueue ,
0 commit comments