diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2014-02-12 07:19:36 -0500 |
---|---|---|
committer | Thomas Hellstrom <thellstrom@vmware.com> | 2014-02-12 13:31:45 -0500 |
commit | 36e952c1ed8ca44bca245c465c8293e175dd9222 (patch) | |
tree | c08437752f106cf8e88e9308f2491abb8aa94917 /drivers/gpu/drm | |
parent | b055211d941eb6cb7b285be580cf6e51a01d2f44 (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.h | 122 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 3 |
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__)) | ||
1978 | SVGA3dCmdSetOTableBase; /* SVGA_3D_CMD_SET_OTABLE_BASE */ | 1987 | SVGA3dCmdSetOTableBase; /* SVGA_3D_CMD_SET_OTABLE_BASE */ |
1979 | 1988 | ||
1980 | typedef | 1989 | typedef |
@@ -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__)) | ||
1989 | SVGA3dCmdSetOTableBase64; /* SVGA_3D_CMD_SET_OTABLE_BASE64 */ | 1997 | SVGA3dCmdSetOTableBase64; /* SVGA_3D_CMD_SET_OTABLE_BASE64 */ |
1990 | 1998 | ||
1991 | typedef | 1999 | typedef |
1992 | struct { | 2000 | struct { |
1993 | SVGAOTableType type; | 2001 | SVGAOTableType type; |
1994 | } | 2002 | } __packed |
1995 | __attribute__((__packed__)) | ||
1996 | SVGA3dCmdReadbackOTable; /* SVGA_3D_CMD_READBACK_OTABLE */ | 2003 | SVGA3dCmdReadbackOTable; /* 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__)) | ||
2010 | SVGA3dCmdDefineGBMob; /* SVGA_3D_CMD_DEFINE_GB_MOB */ | 2016 | SVGA3dCmdDefineGBMob; /* SVGA_3D_CMD_DEFINE_GB_MOB */ |
2011 | 2017 | ||
2012 | 2018 | ||
@@ -2017,8 +2023,7 @@ SVGA3dCmdDefineGBMob; /* SVGA_3D_CMD_DEFINE_GB_MOB */ | |||
2017 | typedef | 2023 | typedef |
2018 | struct SVGA3dCmdDestroyGBMob { | 2024 | struct SVGA3dCmdDestroyGBMob { |
2019 | SVGAMobId mobid; | 2025 | SVGAMobId mobid; |
2020 | } | 2026 | } __packed |
2021 | __attribute__((__packed__)) | ||
2022 | SVGA3dCmdDestroyGBMob; /* SVGA_3D_CMD_DESTROY_GB_MOB */ | 2027 | SVGA3dCmdDestroyGBMob; /* 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__)) | ||
2036 | SVGA3dCmdRedefineGBMob; /* SVGA_3D_CMD_REDEFINE_GB_MOB */ | 2040 | SVGA3dCmdRedefineGBMob; /* 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__)) | ||
2050 | SVGA3dCmdDefineGBMob64; /* SVGA_3D_CMD_DEFINE_GB_MOB64 */ | 2053 | SVGA3dCmdDefineGBMob64; /* 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__)) | ||
2064 | SVGA3dCmdRedefineGBMob64; /* SVGA_3D_CMD_REDEFINE_GB_MOB64 */ | 2066 | SVGA3dCmdRedefineGBMob64; /* SVGA_3D_CMD_REDEFINE_GB_MOB64 */ |
2065 | 2067 | ||
2066 | /* | 2068 | /* |
@@ -2070,8 +2072,7 @@ SVGA3dCmdRedefineGBMob64; /* SVGA_3D_CMD_REDEFINE_GB_MOB64 */ | |||
2070 | typedef | 2072 | typedef |
2071 | struct SVGA3dCmdUpdateGBMobMapping { | 2073 | struct SVGA3dCmdUpdateGBMobMapping { |
2072 | SVGAMobId mobid; | 2074 | SVGAMobId mobid; |
2073 | } | 2075 | } __packed |
2074 | __attribute__((__packed__)) | ||
2075 | SVGA3dCmdUpdateGBMobMapping; /* SVGA_3D_CMD_UPDATE_GB_MOB_MAPPING */ | 2076 | SVGA3dCmdUpdateGBMobMapping; /* 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 |
2092 | SVGA3dCmdDefineGBSurface; /* 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 { | |||
2096 | typedef | 2098 | typedef |
2097 | struct SVGA3dCmdDestroyGBSurface { | 2099 | struct SVGA3dCmdDestroyGBSurface { |
2098 | uint32 sid; | 2100 | uint32 sid; |
2099 | } SVGA3dCmdDestroyGBSurface; /* SVGA_3D_CMD_DESTROY_GB_SURFACE */ | 2101 | } __packed |
2102 | SVGA3dCmdDestroyGBSurface; /* 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 | |||
2106 | struct SVGA3dCmdBindGBSurface { | 2109 | struct SVGA3dCmdBindGBSurface { |
2107 | uint32 sid; | 2110 | uint32 sid; |
2108 | SVGAMobId mobid; | 2111 | SVGAMobId mobid; |
2109 | } SVGA3dCmdBindGBSurface; /* SVGA_3D_CMD_BIND_GB_SURFACE */ | 2112 | } __packed |
2113 | SVGA3dCmdBindGBSurface; /* 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 |
2127 | SVGA3dCmdCondBindGBSurface; /* SVGA_3D_CMD_COND_BIND_GB_SURFACE */ | 2131 | SVGA3dCmdCondBindGBSurface; /* SVGA_3D_CMD_COND_BIND_GB_SURFACE */ |
2128 | 2132 | ||
2129 | /* | 2133 | /* |
@@ -2135,7 +2139,8 @@ typedef | |||
2135 | struct SVGA3dCmdUpdateGBImage { | 2139 | struct SVGA3dCmdUpdateGBImage { |
2136 | SVGA3dSurfaceImageId image; | 2140 | SVGA3dSurfaceImageId image; |
2137 | SVGA3dBox box; | 2141 | SVGA3dBox box; |
2138 | } SVGA3dCmdUpdateGBImage; /* SVGA_3D_CMD_UPDATE_GB_IMAGE */ | 2142 | } __packed |
2143 | SVGA3dCmdUpdateGBImage; /* 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 { | |||
2145 | typedef | 2150 | typedef |
2146 | struct SVGA3dCmdUpdateGBSurface { | 2151 | struct SVGA3dCmdUpdateGBSurface { |
2147 | uint32 sid; | 2152 | uint32 sid; |
2148 | } SVGA3dCmdUpdateGBSurface; /* SVGA_3D_CMD_UPDATE_GB_SURFACE */ | 2153 | } __packed |
2154 | SVGA3dCmdUpdateGBSurface; /* 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 { | |||
2155 | typedef | 2161 | typedef |
2156 | struct SVGA3dCmdReadbackGBImage { | 2162 | struct SVGA3dCmdReadbackGBImage { |
2157 | SVGA3dSurfaceImageId image; | 2163 | SVGA3dSurfaceImageId image; |
2158 | } SVGA3dCmdReadbackGBImage; /* SVGA_3D_CMD_READBACK_GB_IMAGE*/ | 2164 | } __packed |
2165 | SVGA3dCmdReadbackGBImage; /* 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 { | |||
2165 | typedef | 2172 | typedef |
2166 | struct SVGA3dCmdReadbackGBSurface { | 2173 | struct SVGA3dCmdReadbackGBSurface { |
2167 | uint32 sid; | 2174 | uint32 sid; |
2168 | } SVGA3dCmdReadbackGBSurface; /* SVGA_3D_CMD_READBACK_GB_SURFACE */ | 2175 | } __packed |
2176 | SVGA3dCmdReadbackGBSurface; /* 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 |
2183 | SVGA3dCmdReadbackGBImagePartial; /* SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL */ | 2191 | SVGA3dCmdReadbackGBImagePartial; /* SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL */ |
2184 | 2192 | ||
2185 | /* | 2193 | /* |
@@ -2190,7 +2198,8 @@ SVGA3dCmdReadbackGBImagePartial; /* SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL */ | |||
2190 | typedef | 2198 | typedef |
2191 | struct SVGA3dCmdInvalidateGBImage { | 2199 | struct SVGA3dCmdInvalidateGBImage { |
2192 | SVGA3dSurfaceImageId image; | 2200 | SVGA3dSurfaceImageId image; |
2193 | } SVGA3dCmdInvalidateGBImage; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE */ | 2201 | } __packed |
2202 | SVGA3dCmdInvalidateGBImage; /* 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 { | |||
2200 | typedef | 2209 | typedef |
2201 | struct SVGA3dCmdInvalidateGBSurface { | 2210 | struct SVGA3dCmdInvalidateGBSurface { |
2202 | uint32 sid; | 2211 | uint32 sid; |
2203 | } SVGA3dCmdInvalidateGBSurface; /* SVGA_3D_CMD_INVALIDATE_GB_SURFACE */ | 2212 | } __packed |
2213 | SVGA3dCmdInvalidateGBSurface; /* 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 |
2218 | SVGA3dCmdInvalidateGBImagePartial; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL */ | 2228 | SVGA3dCmdInvalidateGBImagePartial; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL */ |
2219 | 2229 | ||
2220 | /* | 2230 | /* |
@@ -2224,7 +2234,8 @@ SVGA3dCmdInvalidateGBImagePartial; /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL */ | |||
2224 | typedef | 2234 | typedef |
2225 | struct SVGA3dCmdDefineGBContext { | 2235 | struct SVGA3dCmdDefineGBContext { |
2226 | uint32 cid; | 2236 | uint32 cid; |
2227 | } SVGA3dCmdDefineGBContext; /* SVGA_3D_CMD_DEFINE_GB_CONTEXT */ | 2237 | } __packed |
2238 | SVGA3dCmdDefineGBContext; /* 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 { | |||
2233 | typedef | 2244 | typedef |
2234 | struct SVGA3dCmdDestroyGBContext { | 2245 | struct SVGA3dCmdDestroyGBContext { |
2235 | uint32 cid; | 2246 | uint32 cid; |
2236 | } SVGA3dCmdDestroyGBContext; /* SVGA_3D_CMD_DESTROY_GB_CONTEXT */ | 2247 | } __packed |
2248 | SVGA3dCmdDestroyGBContext; /* 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 |
2268 | SVGA3dCmdBindGBContext; /* 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 { | |||
2262 | typedef | 2275 | typedef |
2263 | struct SVGA3dCmdReadbackGBContext { | 2276 | struct SVGA3dCmdReadbackGBContext { |
2264 | uint32 cid; | 2277 | uint32 cid; |
2265 | } SVGA3dCmdReadbackGBContext; /* SVGA_3D_CMD_READBACK_GB_CONTEXT */ | 2278 | } __packed |
2279 | SVGA3dCmdReadbackGBContext; /* 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 { | |||
2270 | typedef | 2284 | typedef |
2271 | struct SVGA3dCmdInvalidateGBContext { | 2285 | struct SVGA3dCmdInvalidateGBContext { |
2272 | uint32 cid; | 2286 | uint32 cid; |
2273 | } SVGA3dCmdInvalidateGBContext; /* SVGA_3D_CMD_INVALIDATE_GB_CONTEXT */ | 2287 | } __packed |
2288 | SVGA3dCmdInvalidateGBContext; /* 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 |
2300 | SVGA3dCmdDefineGBShader; /* 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 |
2311 | SVGA3dCmdBindGBShader; /* 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 | ||
2300 | typedef struct SVGA3dCmdDestroyGBShader { | 2317 | typedef struct SVGA3dCmdDestroyGBShader { |
2301 | uint32 shid; | 2318 | uint32 shid; |
2302 | } SVGA3dCmdDestroyGBShader; /* SVGA_3D_CMD_DESTROY_GB_SHADER */ | 2319 | } __packed |
2320 | SVGA3dCmdDestroyGBShader; /* SVGA_3D_CMD_DESTROY_GB_SHADER */ | ||
2303 | 2321 | ||
2304 | typedef | 2322 | typedef |
2305 | struct { | 2323 | struct { |
@@ -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 |
2336 | SVGA3dCmdSetGBShaderConstInline; | ||
2318 | /* SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE */ | 2337 | /* SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE */ |
2319 | 2338 | ||
2320 | typedef | 2339 | typedef |
2321 | struct { | 2340 | struct { |
2322 | uint32 cid; | 2341 | uint32 cid; |
2323 | SVGA3dQueryType type; | 2342 | SVGA3dQueryType type; |
2324 | } SVGA3dCmdBeginGBQuery; /* SVGA_3D_CMD_BEGIN_GB_QUERY */ | 2343 | } __packed |
2344 | SVGA3dCmdBeginGBQuery; /* SVGA_3D_CMD_BEGIN_GB_QUERY */ | ||
2325 | 2345 | ||
2326 | typedef | 2346 | typedef |
2327 | struct { | 2347 | struct { |
@@ -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 |
2353 | SVGA3dCmdEndGBQuery; /* 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 |
2371 | SVGA3dCmdWaitForGBQuery; /* SVGA_3D_CMD_WAIT_FOR_GB_QUERY */ | ||
2350 | 2372 | ||
2351 | typedef | 2373 | typedef |
2352 | struct { | 2374 | struct { |
2353 | SVGAMobId mobid; | 2375 | SVGAMobId mobid; |
2354 | uint32 fbOffset; | 2376 | uint32 fbOffset; |
2355 | uint32 initalized; | 2377 | uint32 initalized; |
2356 | } | 2378 | } __packed |
2357 | SVGA3dCmdEnableGart; /* SVGA_3D_CMD_ENABLE_GART */ | 2379 | SVGA3dCmdEnableGart; /* SVGA_3D_CMD_ENABLE_GART */ |
2358 | 2380 | ||
2359 | typedef | 2381 | typedef |
2360 | struct { | 2382 | struct { |
2361 | SVGAMobId mobid; | 2383 | SVGAMobId mobid; |
2362 | uint32 gartOffset; | 2384 | uint32 gartOffset; |
2363 | } | 2385 | } __packed |
2364 | SVGA3dCmdMapMobIntoGart; /* SVGA_3D_CMD_MAP_MOB_INTO_GART */ | 2386 | SVGA3dCmdMapMobIntoGart; /* SVGA_3D_CMD_MAP_MOB_INTO_GART */ |
2365 | 2387 | ||
2366 | 2388 | ||
@@ -2368,7 +2390,7 @@ typedef | |||
2368 | struct { | 2390 | struct { |
2369 | uint32 gartOffset; | 2391 | uint32 gartOffset; |
2370 | uint32 numPages; | 2392 | uint32 numPages; |
2371 | } | 2393 | } __packed |
2372 | SVGA3dCmdUnmapGartRange; /* SVGA_3D_CMD_UNMAP_GART_RANGE */ | 2394 | SVGA3dCmdUnmapGartRange; /* 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 |
2389 | SVGA3dCmdDefineGBScreenTarget; /* SVGA_3D_CMD_DEFINE_GB_SCREENTARGET */ | 2411 | SVGA3dCmdDefineGBScreenTarget; /* SVGA_3D_CMD_DEFINE_GB_SCREENTARGET */ |
2390 | 2412 | ||
2391 | typedef | 2413 | typedef |
2392 | struct { | 2414 | struct { |
2393 | uint32 stid; | 2415 | uint32 stid; |
2394 | } | 2416 | } __packed |
2395 | SVGA3dCmdDestroyGBScreenTarget; /* SVGA_3D_CMD_DESTROY_GB_SCREENTARGET */ | 2417 | SVGA3dCmdDestroyGBScreenTarget; /* SVGA_3D_CMD_DESTROY_GB_SCREENTARGET */ |
2396 | 2418 | ||
2397 | typedef | 2419 | typedef |
2398 | struct { | 2420 | struct { |
2399 | uint32 stid; | 2421 | uint32 stid; |
2400 | SVGA3dSurfaceImageId image; | 2422 | SVGA3dSurfaceImageId image; |
2401 | } | 2423 | } __packed |
2402 | SVGA3dCmdBindGBScreenTarget; /* SVGA_3D_CMD_BIND_GB_SCREENTARGET */ | 2424 | SVGA3dCmdBindGBScreenTarget; /* SVGA_3D_CMD_BIND_GB_SCREENTARGET */ |
2403 | 2425 | ||
2404 | typedef | 2426 | typedef |
2405 | struct { | 2427 | struct { |
2406 | uint32 stid; | 2428 | uint32 stid; |
2407 | SVGA3dBox box; | 2429 | SVGA3dBox box; |
2408 | } | 2430 | } __packed |
2409 | SVGA3dCmdUpdateGBScreenTarget; /* SVGA_3D_CMD_UPDATE_GB_SCREENTARGET */ | 2431 | SVGA3dCmdUpdateGBScreenTarget; /* 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 | ||