aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2014-02-12 07:19:36 -0500
committerThomas Hellstrom <thellstrom@vmware.com>2014-02-12 13:31:45 -0500
commit36e952c1ed8ca44bca245c465c8293e175dd9222 (patch)
treec08437752f106cf8e88e9308f2491abb8aa94917 /drivers/gpu/drm
parentb055211d941eb6cb7b285be580cf6e51a01d2f44 (diff)
drm/vmwgfx: Fix command defines and checks
Make sure all guest-backed object commands are properly packed. Have the command verifier treat uninitialized command entries as invalid rather than dereferencing NULL pointers. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/vmwgfx/svga3d_reg.h122
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c3
2 files changed, 75 insertions, 50 deletions
diff --git a/drivers/gpu/drm/vmwgfx/svga3d_reg.h b/drivers/gpu/drm/vmwgfx/svga3d_reg.h
index b645647b7776..bb594c11605e 100644
--- a/drivers/gpu/drm/vmwgfx/svga3d_reg.h
+++ b/drivers/gpu/drm/vmwgfx/svga3d_reg.h
@@ -1223,9 +1223,19 @@ typedef enum {
1223#define SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL 1129 1223#define SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL 1129
1224 1224
1225#define SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE 1130 1225#define SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE 1130
1226 1226#define SVGA_3D_CMD_GB_SCREEN_DMA 1131
1227#define SVGA_3D_CMD_BIND_GB_SURFACE_WITH_PITCH 1132
1228#define SVGA_3D_CMD_GB_MOB_FENCE 1133
1229#define SVGA_3D_CMD_DEFINE_GB_SURFACE_V2 1134
1227#define SVGA_3D_CMD_DEFINE_GB_MOB64 1135 1230#define SVGA_3D_CMD_DEFINE_GB_MOB64 1135
1228#define SVGA_3D_CMD_REDEFINE_GB_MOB64 1136 1231#define SVGA_3D_CMD_REDEFINE_GB_MOB64 1136
1232#define SVGA_3D_CMD_NOP_ERROR 1137
1233
1234#define SVGA_3D_CMD_RESERVED1 1138
1235#define SVGA_3D_CMD_RESERVED2 1139
1236#define SVGA_3D_CMD_RESERVED3 1140
1237#define SVGA_3D_CMD_RESERVED4 1141
1238#define SVGA_3D_CMD_RESERVED5 1142
1229 1239
1230#define SVGA_3D_CMD_MAX 1142 1240#define SVGA_3D_CMD_MAX 1142
1231#define SVGA_3D_CMD_FUTURE_MAX 3000 1241#define SVGA_3D_CMD_FUTURE_MAX 3000
@@ -1973,8 +1983,7 @@ struct {
1973 uint32 sizeInBytes; 1983 uint32 sizeInBytes;
1974 uint32 validSizeInBytes; 1984 uint32 validSizeInBytes;
1975 SVGAMobFormat ptDepth; 1985 SVGAMobFormat ptDepth;
1976} 1986} __packed
1977__attribute__((__packed__))
1978SVGA3dCmdSetOTableBase; /* SVGA_3D_CMD_SET_OTABLE_BASE */ 1987SVGA3dCmdSetOTableBase; /* SVGA_3D_CMD_SET_OTABLE_BASE */
1979 1988
1980typedef 1989typedef
@@ -1984,15 +1993,13 @@ struct {
1984 uint32 sizeInBytes; 1993 uint32 sizeInBytes;
1985 uint32 validSizeInBytes; 1994 uint32 validSizeInBytes;
1986 SVGAMobFormat ptDepth; 1995 SVGAMobFormat ptDepth;
1987} 1996} __packed
1988__attribute__((__packed__))
1989SVGA3dCmdSetOTableBase64; /* SVGA_3D_CMD_SET_OTABLE_BASE64 */ 1997SVGA3dCmdSetOTableBase64; /* SVGA_3D_CMD_SET_OTABLE_BASE64 */
1990 1998
1991typedef 1999typedef
1992struct { 2000struct {
1993 SVGAOTableType type; 2001 SVGAOTableType type;
1994} 2002} __packed
1995__attribute__((__packed__))
1996SVGA3dCmdReadbackOTable; /* SVGA_3D_CMD_READBACK_OTABLE */ 2003SVGA3dCmdReadbackOTable; /* SVGA_3D_CMD_READBACK_OTABLE */
1997 2004
1998/* 2005/*
@@ -2005,8 +2012,7 @@ struct SVGA3dCmdDefineGBMob {
2005 SVGAMobFormat ptDepth; 2012 SVGAMobFormat ptDepth;
2006 PPN base; 2013 PPN base;
2007 uint32 sizeInBytes; 2014 uint32 sizeInBytes;
2008} 2015} __packed
2009__attribute__((__packed__))
2010SVGA3dCmdDefineGBMob; /* SVGA_3D_CMD_DEFINE_GB_MOB */ 2016SVGA3dCmdDefineGBMob; /* SVGA_3D_CMD_DEFINE_GB_MOB */
2011 2017
2012 2018
@@ -2017,8 +2023,7 @@ SVGA3dCmdDefineGBMob; /* SVGA_3D_CMD_DEFINE_GB_MOB */
2017typedef 2023typedef
2018struct SVGA3dCmdDestroyGBMob { 2024struct SVGA3dCmdDestroyGBMob {
2019 SVGAMobId mobid; 2025 SVGAMobId mobid;
2020} 2026} __packed
2021__attribute__((__packed__))
2022SVGA3dCmdDestroyGBMob; /* SVGA_3D_CMD_DESTROY_GB_MOB */ 2027SVGA3dCmdDestroyGBMob; /* SVGA_3D_CMD_DESTROY_GB_MOB */
2023 2028
2024/* 2029/*
@@ -2031,8 +2036,7 @@ struct SVGA3dCmdRedefineGBMob {
2031 SVGAMobFormat ptDepth; 2036 SVGAMobFormat ptDepth;
2032 PPN base; 2037 PPN base;
2033 uint32 sizeInBytes; 2038 uint32 sizeInBytes;
2034} 2039} __packed
2035__attribute__((__packed__))
2036SVGA3dCmdRedefineGBMob; /* SVGA_3D_CMD_REDEFINE_GB_MOB */ 2040SVGA3dCmdRedefineGBMob; /* SVGA_3D_CMD_REDEFINE_GB_MOB */
2037 2041
2038/* 2042/*
@@ -2045,8 +2049,7 @@ struct SVGA3dCmdDefineGBMob64 {
2045 SVGAMobFormat ptDepth; 2049 SVGAMobFormat ptDepth;
2046 PPN64 base; 2050 PPN64 base;
2047 uint32 sizeInBytes; 2051 uint32 sizeInBytes;
2048} 2052} __packed
2049__attribute__((__packed__))
2050SVGA3dCmdDefineGBMob64; /* SVGA_3D_CMD_DEFINE_GB_MOB64 */ 2053SVGA3dCmdDefineGBMob64; /* SVGA_3D_CMD_DEFINE_GB_MOB64 */
2051 2054
2052/* 2055/*
@@ -2059,8 +2062,7 @@ struct SVGA3dCmdRedefineGBMob64 {
2059 SVGAMobFormat ptDepth; 2062 SVGAMobFormat ptDepth;
2060 PPN64 base; 2063 PPN64 base;
2061 uint32 sizeInBytes; 2064 uint32 sizeInBytes;
2062} 2065} __packed
2063__attribute__((__packed__))
2064SVGA3dCmdRedefineGBMob64; /* SVGA_3D_CMD_REDEFINE_GB_MOB64 */ 2066SVGA3dCmdRedefineGBMob64; /* SVGA_3D_CMD_REDEFINE_GB_MOB64 */
2065 2067
2066/* 2068/*
@@ -2070,8 +2072,7 @@ SVGA3dCmdRedefineGBMob64; /* SVGA_3D_CMD_REDEFINE_GB_MOB64 */
2070typedef 2072typedef
2071struct SVGA3dCmdUpdateGBMobMapping { 2073struct SVGA3dCmdUpdateGBMobMapping {
2072 SVGAMobId mobid; 2074 SVGAMobId mobid;
2073} 2075} __packed
2074__attribute__((__packed__))
2075SVGA3dCmdUpdateGBMobMapping; /* SVGA_3D_CMD_UPDATE_GB_MOB_MAPPING */ 2076SVGA3dCmdUpdateGBMobMapping; /* SVGA_3D_CMD_UPDATE_GB_MOB_MAPPING */
2076 2077
2077/* 2078/*
@@ -2087,7 +2088,8 @@ struct SVGA3dCmdDefineGBSurface {
2087 uint32 multisampleCount; 2088 uint32 multisampleCount;
2088 SVGA3dTextureFilter autogenFilter; 2089 SVGA3dTextureFilter autogenFilter;
2089 SVGA3dSize size; 2090 SVGA3dSize size;
2090} SVGA3dCmdDefineGBSurface; /* SVGA_3D_CMD_DEFINE_GB_SURFACE */ 2091} __packed
2092SVGA3dCmdDefineGBSurface; /* SVGA_3D_CMD_DEFINE_GB_SURFACE */
2091 2093
2092/* 2094/*
2093 * Destroy a guest-backed surface. 2095 * Destroy a guest-backed surface.
@@ -2096,7 +2098,8 @@ struct SVGA3dCmdDefineGBSurface {
2096typedef 2098typedef
2097struct SVGA3dCmdDestroyGBSurface { 2099struct SVGA3dCmdDestroyGBSurface {
2098 uint32 sid; 2100 uint32 sid;
2099} SVGA3dCmdDestroyGBSurface; /* SVGA_3D_CMD_DESTROY_GB_SURFACE */ 2101} __packed
2102SVGA3dCmdDestroyGBSurface; /* SVGA_3D_CMD_DESTROY_GB_SURFACE */
2100 2103
2101/* 2104/*
2102 * Bind a guest-backed surface to an object. 2105 * Bind a guest-backed surface to an object.
@@ -2106,7 +2109,8 @@ typedef
2106struct SVGA3dCmdBindGBSurface { 2109struct SVGA3dCmdBindGBSurface {
2107 uint32 sid; 2110 uint32 sid;
2108 SVGAMobId mobid; 2111 SVGAMobId mobid;
2109} SVGA3dCmdBindGBSurface; /* SVGA_3D_CMD_BIND_GB_SURFACE */ 2112} __packed
2113SVGA3dCmdBindGBSurface; /* SVGA_3D_CMD_BIND_GB_SURFACE */
2110 2114
2111/* 2115/*
2112 * Conditionally bind a mob to a guest backed surface if testMobid 2116 * Conditionally bind a mob to a guest backed surface if testMobid
@@ -2123,7 +2127,7 @@ struct{
2123 SVGAMobId testMobid; 2127 SVGAMobId testMobid;
2124 SVGAMobId mobid; 2128 SVGAMobId mobid;
2125 uint32 flags; 2129 uint32 flags;
2126} 2130} __packed
2127SVGA3dCmdCondBindGBSurface; /* SVGA_3D_CMD_COND_BIND_GB_SURFACE */ 2131SVGA3dCmdCondBindGBSurface; /* SVGA_3D_CMD_COND_BIND_GB_SURFACE */
2128 2132
2129/* 2133/*
@@ -2135,7 +2139,8 @@ typedef
2135struct SVGA3dCmdUpdateGBImage { 2139struct SVGA3dCmdUpdateGBImage {
2136 SVGA3dSurfaceImageId image; 2140 SVGA3dSurfaceImageId image;
2137 SVGA3dBox box; 2141 SVGA3dBox box;
2138} SVGA3dCmdUpdateGBImage; /* SVGA_3D_CMD_UPDATE_GB_IMAGE */ 2142} __packed
2143SVGA3dCmdUpdateGBImage; /* SVGA_3D_CMD_UPDATE_GB_IMAGE */
2139 2144
2140/* 2145/*
2141 * Update an entire guest-backed surface. 2146 * Update an entire guest-backed surface.
@@ -2145,7 +2150,8 @@ struct SVGA3dCmdUpdateGBImage {
2145typedef 2150typedef
2146struct SVGA3dCmdUpdateGBSurface { 2151struct SVGA3dCmdUpdateGBSurface {
2147 uint32 sid; 2152 uint32 sid;
2148} SVGA3dCmdUpdateGBSurface; /* SVGA_3D_CMD_UPDATE_GB_SURFACE */ 2153} __packed
2154SVGA3dCmdUpdateGBSurface; /* SVGA_3D_CMD_UPDATE_GB_SURFACE */
2149 2155
2150/* 2156/*
2151 * Readback an image in a guest-backed surface. 2157 * Readback an image in a guest-backed surface.
@@ -2155,7 +2161,8 @@ struct SVGA3dCmdUpdateGBSurface {
2155typedef 2161typedef
2156struct SVGA3dCmdReadbackGBImage { 2162struct SVGA3dCmdReadbackGBImage {
2157 SVGA3dSurfaceImageId image; 2163 SVGA3dSurfaceImageId image;
2158} SVGA3dCmdReadbackGBImage; /* SVGA_3D_CMD_READBACK_GB_IMAGE*/ 2164} __packed
2165SVGA3dCmdReadbackGBImage; /* SVGA_3D_CMD_READBACK_GB_IMAGE*/
2159 2166
2160/* 2167/*
2161 * Readback an entire guest-backed surface. 2168 * Readback an entire guest-backed surface.
@@ -2165,7 +2172,8 @@ struct SVGA3dCmdReadbackGBImage {
2165typedef 2172typedef
2166struct SVGA3dCmdReadbackGBSurface { 2173struct SVGA3dCmdReadbackGBSurface {
2167 uint32 sid; 2174 uint32 sid;
2168} SVGA3dCmdReadbackGBSurface; /* SVGA_3D_CMD_READBACK_GB_SURFACE */ 2175} __packed
2176SVGA3dCmdReadbackGBSurface; /* SVGA_3D_CMD_READBACK_GB_SURFACE */
2169 2177
2170/* 2178/*
2171 * Readback a sub rect of an image in a guest-backed surface. After 2179 * Readback a sub rect of an image in a guest-backed surface. After
@@ -2179,7 +2187,7 @@ struct SVGA3dCmdReadbackGBImagePartial {
2179 SVGA3dSurfaceImageId image; 2187 SVGA3dSurfaceImageId image;
2180 SVGA3dBox box; 2188 SVGA3dBox box;
2181 uint32 invertBox; 2189 uint32 invertBox;
2182} 2190} __packed
2183SVGA3dCmdReadbackGBImagePartial; /* SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL */ 2191SVGA3dCmdReadbackGBImagePartial; /* SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL */
2184 2192
2185/* 2193/*
@@ -2190,7 +2198,8 @@ SVGA3dCmdReadbackGBImagePartial; /* SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL */
2190typedef 2198typedef
2191struct SVGA3dCmdInvalidateGBImage { 2199struct SVGA3dCmdInvalidateGBImage {
2192 SVGA3dSurfaceImageId image; 2200 SVGA3dSurfaceImageId image;
2193} SVGA3dCmdInvalidateGBImage; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE */ 2201} __packed
2202SVGA3dCmdInvalidateGBImage; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE */
2194 2203
2195/* 2204/*
2196 * Invalidate an entire guest-backed surface. 2205 * Invalidate an entire guest-backed surface.
@@ -2200,7 +2209,8 @@ struct SVGA3dCmdInvalidateGBImage {
2200typedef 2209typedef
2201struct SVGA3dCmdInvalidateGBSurface { 2210struct SVGA3dCmdInvalidateGBSurface {
2202 uint32 sid; 2211 uint32 sid;
2203} SVGA3dCmdInvalidateGBSurface; /* SVGA_3D_CMD_INVALIDATE_GB_SURFACE */ 2212} __packed
2213SVGA3dCmdInvalidateGBSurface; /* SVGA_3D_CMD_INVALIDATE_GB_SURFACE */
2204 2214
2205/* 2215/*
2206 * Invalidate a sub rect of an image in a guest-backed surface. After 2216 * Invalidate a sub rect of an image in a guest-backed surface. After
@@ -2214,7 +2224,7 @@ struct SVGA3dCmdInvalidateGBImagePartial {
2214 SVGA3dSurfaceImageId image; 2224 SVGA3dSurfaceImageId image;
2215 SVGA3dBox box; 2225 SVGA3dBox box;
2216 uint32 invertBox; 2226 uint32 invertBox;
2217} 2227} __packed
2218SVGA3dCmdInvalidateGBImagePartial; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL */ 2228SVGA3dCmdInvalidateGBImagePartial; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL */
2219 2229
2220/* 2230/*
@@ -2224,7 +2234,8 @@ SVGA3dCmdInvalidateGBImagePartial; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL */
2224typedef 2234typedef
2225struct SVGA3dCmdDefineGBContext { 2235struct SVGA3dCmdDefineGBContext {
2226 uint32 cid; 2236 uint32 cid;
2227} SVGA3dCmdDefineGBContext; /* SVGA_3D_CMD_DEFINE_GB_CONTEXT */ 2237} __packed
2238SVGA3dCmdDefineGBContext; /* SVGA_3D_CMD_DEFINE_GB_CONTEXT */
2228 2239
2229/* 2240/*
2230 * Destroy a guest-backed context. 2241 * Destroy a guest-backed context.
@@ -2233,7 +2244,8 @@ struct SVGA3dCmdDefineGBContext {
2233typedef 2244typedef
2234struct SVGA3dCmdDestroyGBContext { 2245struct SVGA3dCmdDestroyGBContext {
2235 uint32 cid; 2246 uint32 cid;
2236} SVGA3dCmdDestroyGBContext; /* SVGA_3D_CMD_DESTROY_GB_CONTEXT */ 2247} __packed
2248SVGA3dCmdDestroyGBContext; /* SVGA_3D_CMD_DESTROY_GB_CONTEXT */
2237 2249
2238/* 2250/*
2239 * Bind a guest-backed context. 2251 * Bind a guest-backed context.
@@ -2252,7 +2264,8 @@ struct SVGA3dCmdBindGBContext {
2252 uint32 cid; 2264 uint32 cid;
2253 SVGAMobId mobid; 2265 SVGAMobId mobid;
2254 uint32 validContents; 2266 uint32 validContents;
2255} SVGA3dCmdBindGBContext; /* SVGA_3D_CMD_BIND_GB_CONTEXT */ 2267} __packed
2268SVGA3dCmdBindGBContext; /* SVGA_3D_CMD_BIND_GB_CONTEXT */
2256 2269
2257/* 2270/*
2258 * Readback a guest-backed context. 2271 * Readback a guest-backed context.
@@ -2262,7 +2275,8 @@ struct SVGA3dCmdBindGBContext {
2262typedef 2275typedef
2263struct SVGA3dCmdReadbackGBContext { 2276struct SVGA3dCmdReadbackGBContext {
2264 uint32 cid; 2277 uint32 cid;
2265} SVGA3dCmdReadbackGBContext; /* SVGA_3D_CMD_READBACK_GB_CONTEXT */ 2278} __packed
2279SVGA3dCmdReadbackGBContext; /* SVGA_3D_CMD_READBACK_GB_CONTEXT */
2266 2280
2267/* 2281/*
2268 * Invalidate a guest-backed context. 2282 * Invalidate a guest-backed context.
@@ -2270,7 +2284,8 @@ struct SVGA3dCmdReadbackGBContext {
2270typedef 2284typedef
2271struct SVGA3dCmdInvalidateGBContext { 2285struct SVGA3dCmdInvalidateGBContext {
2272 uint32 cid; 2286 uint32 cid;
2273} SVGA3dCmdInvalidateGBContext; /* SVGA_3D_CMD_INVALIDATE_GB_CONTEXT */ 2287} __packed
2288SVGA3dCmdInvalidateGBContext; /* SVGA_3D_CMD_INVALIDATE_GB_CONTEXT */
2274 2289
2275/* 2290/*
2276 * Define a guest-backed shader. 2291 * Define a guest-backed shader.
@@ -2281,7 +2296,8 @@ struct SVGA3dCmdDefineGBShader {
2281 uint32 shid; 2296 uint32 shid;
2282 SVGA3dShaderType type; 2297 SVGA3dShaderType type;
2283 uint32 sizeInBytes; 2298 uint32 sizeInBytes;
2284} SVGA3dCmdDefineGBShader; /* SVGA_3D_CMD_DEFINE_GB_SHADER */ 2299} __packed
2300SVGA3dCmdDefineGBShader; /* SVGA_3D_CMD_DEFINE_GB_SHADER */
2285 2301
2286/* 2302/*
2287 * Bind a guest-backed shader. 2303 * Bind a guest-backed shader.
@@ -2291,7 +2307,8 @@ typedef struct SVGA3dCmdBindGBShader {
2291 uint32 shid; 2307 uint32 shid;
2292 SVGAMobId mobid; 2308 SVGAMobId mobid;
2293 uint32 offsetInBytes; 2309 uint32 offsetInBytes;
2294} SVGA3dCmdBindGBShader; /* SVGA_3D_CMD_BIND_GB_SHADER */ 2310} __packed
2311SVGA3dCmdBindGBShader; /* SVGA_3D_CMD_BIND_GB_SHADER */
2295 2312
2296/* 2313/*
2297 * Destroy a guest-backed shader. 2314 * Destroy a guest-backed shader.
@@ -2299,7 +2316,8 @@ typedef struct SVGA3dCmdBindGBShader {
2299 2316
2300typedef struct SVGA3dCmdDestroyGBShader { 2317typedef struct SVGA3dCmdDestroyGBShader {
2301 uint32 shid; 2318 uint32 shid;
2302} SVGA3dCmdDestroyGBShader; /* SVGA_3D_CMD_DESTROY_GB_SHADER */ 2319} __packed
2320SVGA3dCmdDestroyGBShader; /* SVGA_3D_CMD_DESTROY_GB_SHADER */
2303 2321
2304typedef 2322typedef
2305struct { 2323struct {
@@ -2314,14 +2332,16 @@ struct {
2314 * Note that FLOAT and INT constants are 4-dwords in length, while 2332 * Note that FLOAT and INT constants are 4-dwords in length, while
2315 * BOOL constants are 1-dword in length. 2333 * BOOL constants are 1-dword in length.
2316 */ 2334 */
2317} SVGA3dCmdSetGBShaderConstInline; 2335} __packed
2336SVGA3dCmdSetGBShaderConstInline;
2318/* SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE */ 2337/* SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE */
2319 2338
2320typedef 2339typedef
2321struct { 2340struct {
2322 uint32 cid; 2341 uint32 cid;
2323 SVGA3dQueryType type; 2342 SVGA3dQueryType type;
2324} SVGA3dCmdBeginGBQuery; /* SVGA_3D_CMD_BEGIN_GB_QUERY */ 2343} __packed
2344SVGA3dCmdBeginGBQuery; /* SVGA_3D_CMD_BEGIN_GB_QUERY */
2325 2345
2326typedef 2346typedef
2327struct { 2347struct {
@@ -2329,7 +2349,8 @@ struct {
2329 SVGA3dQueryType type; 2349 SVGA3dQueryType type;
2330 SVGAMobId mobid; 2350 SVGAMobId mobid;
2331 uint32 offset; 2351 uint32 offset;
2332} SVGA3dCmdEndGBQuery; /* SVGA_3D_CMD_END_GB_QUERY */ 2352} __packed
2353SVGA3dCmdEndGBQuery; /* SVGA_3D_CMD_END_GB_QUERY */
2333 2354
2334 2355
2335/* 2356/*
@@ -2346,21 +2367,22 @@ struct {
2346 SVGA3dQueryType type; 2367 SVGA3dQueryType type;
2347 SVGAMobId mobid; 2368 SVGAMobId mobid;
2348 uint32 offset; 2369 uint32 offset;
2349} SVGA3dCmdWaitForGBQuery; /* SVGA_3D_CMD_WAIT_FOR_GB_QUERY */ 2370} __packed
2371SVGA3dCmdWaitForGBQuery; /* SVGA_3D_CMD_WAIT_FOR_GB_QUERY */
2350 2372
2351typedef 2373typedef
2352struct { 2374struct {
2353 SVGAMobId mobid; 2375 SVGAMobId mobid;
2354 uint32 fbOffset; 2376 uint32 fbOffset;
2355 uint32 initalized; 2377 uint32 initalized;
2356} 2378} __packed
2357SVGA3dCmdEnableGart; /* SVGA_3D_CMD_ENABLE_GART */ 2379SVGA3dCmdEnableGart; /* SVGA_3D_CMD_ENABLE_GART */
2358 2380
2359typedef 2381typedef
2360struct { 2382struct {
2361 SVGAMobId mobid; 2383 SVGAMobId mobid;
2362 uint32 gartOffset; 2384 uint32 gartOffset;
2363} 2385} __packed
2364SVGA3dCmdMapMobIntoGart; /* SVGA_3D_CMD_MAP_MOB_INTO_GART */ 2386SVGA3dCmdMapMobIntoGart; /* SVGA_3D_CMD_MAP_MOB_INTO_GART */
2365 2387
2366 2388
@@ -2368,7 +2390,7 @@ typedef
2368struct { 2390struct {
2369 uint32 gartOffset; 2391 uint32 gartOffset;
2370 uint32 numPages; 2392 uint32 numPages;
2371} 2393} __packed
2372SVGA3dCmdUnmapGartRange; /* SVGA_3D_CMD_UNMAP_GART_RANGE */ 2394SVGA3dCmdUnmapGartRange; /* SVGA_3D_CMD_UNMAP_GART_RANGE */
2373 2395
2374 2396
@@ -2385,27 +2407,27 @@ struct {
2385 int32 xRoot; 2407 int32 xRoot;
2386 int32 yRoot; 2408 int32 yRoot;
2387 uint32 flags; 2409 uint32 flags;
2388} 2410} __packed
2389SVGA3dCmdDefineGBScreenTarget; /* SVGA_3D_CMD_DEFINE_GB_SCREENTARGET */ 2411SVGA3dCmdDefineGBScreenTarget; /* SVGA_3D_CMD_DEFINE_GB_SCREENTARGET */
2390 2412
2391typedef 2413typedef
2392struct { 2414struct {
2393 uint32 stid; 2415 uint32 stid;
2394} 2416} __packed
2395SVGA3dCmdDestroyGBScreenTarget; /* SVGA_3D_CMD_DESTROY_GB_SCREENTARGET */ 2417SVGA3dCmdDestroyGBScreenTarget; /* SVGA_3D_CMD_DESTROY_GB_SCREENTARGET */
2396 2418
2397typedef 2419typedef
2398struct { 2420struct {
2399 uint32 stid; 2421 uint32 stid;
2400 SVGA3dSurfaceImageId image; 2422 SVGA3dSurfaceImageId image;
2401} 2423} __packed
2402SVGA3dCmdBindGBScreenTarget; /* SVGA_3D_CMD_BIND_GB_SCREENTARGET */ 2424SVGA3dCmdBindGBScreenTarget; /* SVGA_3D_CMD_BIND_GB_SCREENTARGET */
2403 2425
2404typedef 2426typedef
2405struct { 2427struct {
2406 uint32 stid; 2428 uint32 stid;
2407 SVGA3dBox box; 2429 SVGA3dBox box;
2408} 2430} __packed
2409SVGA3dCmdUpdateGBScreenTarget; /* SVGA_3D_CMD_UPDATE_GB_SCREENTARGET */ 2431SVGA3dCmdUpdateGBScreenTarget; /* SVGA_3D_CMD_UPDATE_GB_SCREENTARGET */
2410 2432
2411/* 2433/*
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index 904fdde1ebab..efb575a7996c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
@@ -2032,6 +2032,9 @@ static int vmw_cmd_check(struct vmw_private *dev_priv,
2032 goto out_invalid; 2032 goto out_invalid;
2033 2033
2034 entry = &vmw_cmd_entries[cmd_id]; 2034 entry = &vmw_cmd_entries[cmd_id];
2035 if (unlikely(!entry->func))
2036 goto out_invalid;
2037
2035 if (unlikely(!entry->user_allow && !sw_context->kernel)) 2038 if (unlikely(!entry->user_allow && !sw_context->kernel))
2036 goto out_privileged; 2039 goto out_privileged;
2037 2040