hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/gpu/drm/i915/gvt/fb_decoder.c
....@@ -146,14 +146,12 @@
146146 static u32 intel_vgpu_get_stride(struct intel_vgpu *vgpu, int pipe,
147147 u32 tiled, int stride_mask, int bpp)
148148 {
149
- struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv;
149
+ struct drm_i915_private *dev_priv = vgpu->gvt->gt->i915;
150150
151151 u32 stride_reg = vgpu_vreg_t(vgpu, DSPSTRIDE(pipe)) & stride_mask;
152152 u32 stride = stride_reg;
153153
154
- if (IS_SKYLAKE(dev_priv)
155
- || IS_KABYLAKE(dev_priv)
156
- || IS_BROXTON(dev_priv)) {
154
+ if (INTEL_GEN(dev_priv) >= 9) {
157155 switch (tiled) {
158156 case PLANE_CTL_TILED_LINEAR:
159157 stride = stride_reg * 64;
....@@ -204,8 +202,8 @@
204202 int intel_vgpu_decode_primary_plane(struct intel_vgpu *vgpu,
205203 struct intel_vgpu_primary_plane_format *plane)
206204 {
205
+ struct drm_i915_private *dev_priv = vgpu->gvt->gt->i915;
207206 u32 val, fmt;
208
- struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv;
209207 int pipe;
210208
211209 pipe = get_active_pipe(vgpu);
....@@ -217,9 +215,7 @@
217215 if (!plane->enabled)
218216 return -ENODEV;
219217
220
- if (IS_SKYLAKE(dev_priv)
221
- || IS_KABYLAKE(dev_priv)
222
- || IS_BROXTON(dev_priv)) {
218
+ if (INTEL_GEN(dev_priv) >= 9) {
223219 plane->tiled = val & PLANE_CTL_TILED_MASK;
224220 fmt = skl_format_to_drm(
225221 val & PLANE_CTL_FORMAT_MASK,
....@@ -249,7 +245,7 @@
249245 plane->hw_format = fmt;
250246
251247 plane->base = vgpu_vreg_t(vgpu, DSPSURF(pipe)) & I915_GTT_PAGE_MASK;
252
- if (!intel_gvt_ggtt_validate_range(vgpu, plane->base, 0))
248
+ if (!vgpu_gmadr_is_valid(vgpu, plane->base))
253249 return -EINVAL;
254250
255251 plane->base_gpa = intel_vgpu_gma_to_gpa(vgpu->gtt.ggtt_mm, plane->base);
....@@ -260,9 +256,7 @@
260256 }
261257
262258 plane->stride = intel_vgpu_get_stride(vgpu, pipe, plane->tiled,
263
- (IS_SKYLAKE(dev_priv)
264
- || IS_KABYLAKE(dev_priv)
265
- || IS_BROXTON(dev_priv)) ?
259
+ (INTEL_GEN(dev_priv) >= 9) ?
266260 (_PRI_PLANE_STRIDE_MASK >> 6) :
267261 _PRI_PLANE_STRIDE_MASK, plane->bpp);
268262
....@@ -338,9 +332,9 @@
338332 int intel_vgpu_decode_cursor_plane(struct intel_vgpu *vgpu,
339333 struct intel_vgpu_cursor_plane_format *plane)
340334 {
335
+ struct drm_i915_private *dev_priv = vgpu->gvt->gt->i915;
341336 u32 val, mode, index;
342337 u32 alpha_plane, alpha_force;
343
- struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv;
344338 int pipe;
345339
346340 pipe = get_active_pipe(vgpu);
....@@ -374,7 +368,7 @@
374368 alpha_plane, alpha_force);
375369
376370 plane->base = vgpu_vreg_t(vgpu, CURBASE(pipe)) & I915_GTT_PAGE_MASK;
377
- if (!intel_gvt_ggtt_validate_range(vgpu, plane->base, 0))
371
+ if (!vgpu_gmadr_is_valid(vgpu, plane->base))
378372 return -EINVAL;
379373
380374 plane->base_gpa = intel_vgpu_gma_to_gpa(vgpu->gtt.ggtt_mm, plane->base);
....@@ -478,7 +472,7 @@
478472 plane->drm_format = drm_format;
479473
480474 plane->base = vgpu_vreg_t(vgpu, SPRSURF(pipe)) & I915_GTT_PAGE_MASK;
481
- if (!intel_gvt_ggtt_validate_range(vgpu, plane->base, 0))
475
+ if (!vgpu_gmadr_is_valid(vgpu, plane->base))
482476 return -EINVAL;
483477
484478 plane->base_gpa = intel_vgpu_gma_to_gpa(vgpu->gtt.ggtt_mm, plane->base);