diff --git a/sys/dev/drm/i915/intel_engine_cs.c b/sys/dev/drm/i915/intel_engine_cs.c index 03efbc3def..e9cfc2a61b 100644 --- a/sys/dev/drm/i915/intel_engine_cs.c +++ b/sys/dev/drm/i915/intel_engine_cs.c @@ -492,11 +492,11 @@ void intel_engine_setup_common(struct intel_engine_cs *engine) static void cleanup_status_page(struct intel_engine_cs *engine) { - if (HWS_NEEDS_PHYSICAL(engine->i915)) { - void *addr = fetch_and_zero(&engine->status_page.page_addr); + struct drm_dma_handle *dmah; - __free_page(virt_to_page(addr)); - } + dmah = fetch_and_zero(&engine->i915->status_page_dmah); + if (dmah) + drm_pci_free(&engine->i915->drm, dmah); i915_vma_unpin_and_release(&engine->status_page.vma, I915_VMA_RELEASE_MAP); @@ -565,19 +565,17 @@ static int init_status_page(struct intel_engine_cs *engine) static int init_phys_status_page(struct intel_engine_cs *engine) { - struct page *page; + struct drm_i915_private *dev_priv = engine->i915; - /* - * Though the HWS register does support 36bit addresses, historically - * we have had hangs and corruption reported due to wild writes if - * the HWS is placed above 4G. - */ - page = alloc_page(GFP_KERNEL | __GFP_DMA32 | __GFP_ZERO); - if (!page) - return -ENOMEM; + GEM_BUG_ON(engine->id != RCS); - engine->status_page.page_addr = page_address(page); + dev_priv->status_page_dmah = + drm_pci_alloc(&dev_priv->drm, PAGE_SIZE, PAGE_SIZE); + if (!dev_priv->status_page_dmah) + return -ENOMEM; + engine->status_page.page_addr = dev_priv->status_page_dmah->vaddr; + memset(engine->status_page.page_addr, 0, PAGE_SIZE); return 0; } diff --git a/sys/dev/drm/i915/intel_ringbuffer.c b/sys/dev/drm/i915/intel_ringbuffer.c index 04b8079046..9e32b7bcc7 100644 --- a/sys/dev/drm/i915/intel_ringbuffer.c +++ b/sys/dev/drm/i915/intel_ringbuffer.c @@ -382,13 +382,11 @@ gen7_render_ring_flush(struct i915_request *rq, u32 mode) static void ring_setup_phys_status_page(struct intel_engine_cs *engine) { struct drm_i915_private *dev_priv = engine->i915; - struct page *page = virt_to_page(engine->status_page.page_addr); - phys_addr_t phys = PFN_PHYS(page_to_pfn(page)); u32 addr; - addr = lower_32_bits(phys); + addr = dev_priv->status_page_dmah->busaddr; if (INTEL_GEN(dev_priv) >= 4) - addr |= (phys >> 28) & 0xf0; + addr |= (dev_priv->status_page_dmah->busaddr >> 28) & 0xf0; I915_WRITE(HWS_PGA, addr); }