| .. | .. |
|---|
| 146 | 146 | static u32 intel_vgpu_get_stride(struct intel_vgpu *vgpu, int pipe, |
|---|
| 147 | 147 | u32 tiled, int stride_mask, int bpp) |
|---|
| 148 | 148 | { |
|---|
| 149 | | - struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; |
|---|
| 149 | + struct drm_i915_private *dev_priv = vgpu->gvt->gt->i915; |
|---|
| 150 | 150 | |
|---|
| 151 | 151 | u32 stride_reg = vgpu_vreg_t(vgpu, DSPSTRIDE(pipe)) & stride_mask; |
|---|
| 152 | 152 | u32 stride = stride_reg; |
|---|
| 153 | 153 | |
|---|
| 154 | | - if (IS_SKYLAKE(dev_priv) |
|---|
| 155 | | - || IS_KABYLAKE(dev_priv) |
|---|
| 156 | | - || IS_BROXTON(dev_priv)) { |
|---|
| 154 | + if (INTEL_GEN(dev_priv) >= 9) { |
|---|
| 157 | 155 | switch (tiled) { |
|---|
| 158 | 156 | case PLANE_CTL_TILED_LINEAR: |
|---|
| 159 | 157 | stride = stride_reg * 64; |
|---|
| .. | .. |
|---|
| 204 | 202 | int intel_vgpu_decode_primary_plane(struct intel_vgpu *vgpu, |
|---|
| 205 | 203 | struct intel_vgpu_primary_plane_format *plane) |
|---|
| 206 | 204 | { |
|---|
| 205 | + struct drm_i915_private *dev_priv = vgpu->gvt->gt->i915; |
|---|
| 207 | 206 | u32 val, fmt; |
|---|
| 208 | | - struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; |
|---|
| 209 | 207 | int pipe; |
|---|
| 210 | 208 | |
|---|
| 211 | 209 | pipe = get_active_pipe(vgpu); |
|---|
| .. | .. |
|---|
| 217 | 215 | if (!plane->enabled) |
|---|
| 218 | 216 | return -ENODEV; |
|---|
| 219 | 217 | |
|---|
| 220 | | - if (IS_SKYLAKE(dev_priv) |
|---|
| 221 | | - || IS_KABYLAKE(dev_priv) |
|---|
| 222 | | - || IS_BROXTON(dev_priv)) { |
|---|
| 218 | + if (INTEL_GEN(dev_priv) >= 9) { |
|---|
| 223 | 219 | plane->tiled = val & PLANE_CTL_TILED_MASK; |
|---|
| 224 | 220 | fmt = skl_format_to_drm( |
|---|
| 225 | 221 | val & PLANE_CTL_FORMAT_MASK, |
|---|
| .. | .. |
|---|
| 249 | 245 | plane->hw_format = fmt; |
|---|
| 250 | 246 | |
|---|
| 251 | 247 | 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)) |
|---|
| 253 | 249 | return -EINVAL; |
|---|
| 254 | 250 | |
|---|
| 255 | 251 | plane->base_gpa = intel_vgpu_gma_to_gpa(vgpu->gtt.ggtt_mm, plane->base); |
|---|
| .. | .. |
|---|
| 260 | 256 | } |
|---|
| 261 | 257 | |
|---|
| 262 | 258 | 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) ? |
|---|
| 266 | 260 | (_PRI_PLANE_STRIDE_MASK >> 6) : |
|---|
| 267 | 261 | _PRI_PLANE_STRIDE_MASK, plane->bpp); |
|---|
| 268 | 262 | |
|---|
| .. | .. |
|---|
| 338 | 332 | int intel_vgpu_decode_cursor_plane(struct intel_vgpu *vgpu, |
|---|
| 339 | 333 | struct intel_vgpu_cursor_plane_format *plane) |
|---|
| 340 | 334 | { |
|---|
| 335 | + struct drm_i915_private *dev_priv = vgpu->gvt->gt->i915; |
|---|
| 341 | 336 | u32 val, mode, index; |
|---|
| 342 | 337 | u32 alpha_plane, alpha_force; |
|---|
| 343 | | - struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; |
|---|
| 344 | 338 | int pipe; |
|---|
| 345 | 339 | |
|---|
| 346 | 340 | pipe = get_active_pipe(vgpu); |
|---|
| .. | .. |
|---|
| 374 | 368 | alpha_plane, alpha_force); |
|---|
| 375 | 369 | |
|---|
| 376 | 370 | 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)) |
|---|
| 378 | 372 | return -EINVAL; |
|---|
| 379 | 373 | |
|---|
| 380 | 374 | plane->base_gpa = intel_vgpu_gma_to_gpa(vgpu->gtt.ggtt_mm, plane->base); |
|---|
| .. | .. |
|---|
| 478 | 472 | plane->drm_format = drm_format; |
|---|
| 479 | 473 | |
|---|
| 480 | 474 | 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)) |
|---|
| 482 | 476 | return -EINVAL; |
|---|
| 483 | 477 | |
|---|
| 484 | 478 | plane->base_gpa = intel_vgpu_gma_to_gpa(vgpu->gtt.ggtt_mm, plane->base); |
|---|