Merge tag 'trace-v5.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
[sfrench/cifs-2.6.git] / drivers / gpu / drm / i915 / gvt / gtt.c
index c2f7d20f634691c343059b9cb1ac69931e3f81b7..244ad17297646be945d55218ddcadef799de335b 100644 (file)
@@ -811,7 +811,7 @@ static int reclaim_one_ppgtt_mm(struct intel_gvt *gvt);
 
 /* Allocate shadow page table without guest page. */
 static struct intel_vgpu_ppgtt_spt *ppgtt_alloc_spt(
-               struct intel_vgpu *vgpu, intel_gvt_gtt_type_t type)
+               struct intel_vgpu *vgpu, enum intel_gvt_gtt_type type)
 {
        struct device *kdev = &vgpu->gvt->dev_priv->drm.pdev->dev;
        struct intel_vgpu_ppgtt_spt *spt = NULL;
@@ -861,7 +861,7 @@ err_free_spt:
 
 /* Allocate shadow page table associated with specific gfn. */
 static struct intel_vgpu_ppgtt_spt *ppgtt_alloc_spt_gfn(
-               struct intel_vgpu *vgpu, intel_gvt_gtt_type_t type,
+               struct intel_vgpu *vgpu, enum intel_gvt_gtt_type type,
                unsigned long gfn, bool guest_pde_ips)
 {
        struct intel_vgpu_ppgtt_spt *spt;
@@ -936,7 +936,7 @@ static int ppgtt_invalidate_spt_by_shadow_entry(struct intel_vgpu *vgpu,
 {
        struct intel_gvt_gtt_pte_ops *ops = vgpu->gvt->gtt.pte_ops;
        struct intel_vgpu_ppgtt_spt *s;
-       intel_gvt_gtt_type_t cur_pt_type;
+       enum intel_gvt_gtt_type cur_pt_type;
 
        GEM_BUG_ON(!gtt_type_is_pt(get_next_pt_type(e->type)));
 
@@ -1076,6 +1076,11 @@ static struct intel_vgpu_ppgtt_spt *ppgtt_populate_spt_by_guest_entry(
        } else {
                int type = get_next_pt_type(we->type);
 
+               if (!gtt_type_is_pt(type)) {
+                       ret = -EINVAL;
+                       goto err;
+               }
+
                spt = ppgtt_alloc_spt_gfn(vgpu, type, ops->get_pfn(we), ips);
                if (IS_ERR(spt)) {
                        ret = PTR_ERR(spt);
@@ -1855,7 +1860,7 @@ static void vgpu_free_mm(struct intel_vgpu_mm *mm)
  * Zero on success, negative error code in pointer if failed.
  */
 struct intel_vgpu_mm *intel_vgpu_create_ppgtt_mm(struct intel_vgpu *vgpu,
-               intel_gvt_gtt_type_t root_entry_type, u64 pdps[])
+               enum intel_gvt_gtt_type root_entry_type, u64 pdps[])
 {
        struct intel_gvt *gvt = vgpu->gvt;
        struct intel_vgpu_mm *mm;
@@ -2309,7 +2314,7 @@ int intel_vgpu_emulate_ggtt_mmio_write(struct intel_vgpu *vgpu,
 }
 
 static int alloc_scratch_pages(struct intel_vgpu *vgpu,
-               intel_gvt_gtt_type_t type)
+               enum intel_gvt_gtt_type type)
 {
        struct intel_vgpu_gtt *gtt = &vgpu->gtt;
        struct intel_gvt_gtt_pte_ops *ops = vgpu->gvt->gtt.pte_ops;
@@ -2594,7 +2599,7 @@ struct intel_vgpu_mm *intel_vgpu_find_ppgtt_mm(struct intel_vgpu *vgpu,
  * Zero on success, negative error code if failed.
  */
 struct intel_vgpu_mm *intel_vgpu_get_ppgtt_mm(struct intel_vgpu *vgpu,
-               intel_gvt_gtt_type_t root_entry_type, u64 pdps[])
+               enum intel_gvt_gtt_type root_entry_type, u64 pdps[])
 {
        struct intel_vgpu_mm *mm;