From b0bf4d37548ceebf46f89c4377b5e8b945b772ea Mon Sep 17 00:00:00 2001 From: jc_gargma Date: Tue, 11 Feb 2020 14:07:38 -0800 Subject: Fix hotfix names --- ...-Do-not-require-PHY_SKU-NVM-section-for-3.patch | 39 ++++++ ...uire-PHY_SKU-NVM-section-for-3168-devices.patch | 39 ------ ...PageReserved-manipulation-from-drm_pci_al.patch | 91 +++++++++++++ ...eReserved-manipulation-from-drm_pci_alloc.patch | 91 ------------- ...eclists-Always-force-a-context-reload-whe.patch | 145 +++++++++++++++++++++ ...ays-force-a-context-reload-when-rewinding.patch | 145 --------------------- PKGBUILD | 12 +- 7 files changed, 281 insertions(+), 281 deletions(-) create mode 100644 0003-iwlwifi-mvm-Do-not-require-PHY_SKU-NVM-section-for-3.patch delete mode 100644 0003-iwlwifi-mvm-Do-not-require-PHY_SKU-NVM-section-for-3168-devices.patch create mode 100644 0005-drm-Remove-PageReserved-manipulation-from-drm_pci_al.patch delete mode 100644 0005-drm-Remove-PageReserved-manipulation-from-drm_pci_alloc.patch create mode 100644 0006-drm-i915-execlists-Always-force-a-context-reload-whe.patch delete mode 100644 0006-drm-i915-execlists-Always-force-a-context-reload-when-rewinding.patch diff --git a/0003-iwlwifi-mvm-Do-not-require-PHY_SKU-NVM-section-for-3.patch b/0003-iwlwifi-mvm-Do-not-require-PHY_SKU-NVM-section-for-3.patch new file mode 100644 index 0000000..f9830bb --- /dev/null +++ b/0003-iwlwifi-mvm-Do-not-require-PHY_SKU-NVM-section-for-3.patch @@ -0,0 +1,39 @@ +From 0e6fb279c7fc6fc818942f668f731946286c959c Mon Sep 17 00:00:00 2001 +From: Dan Moulding +Date: Tue, 28 Jan 2020 02:31:07 -0700 +Subject: iwlwifi: mvm: Do not require PHY_SKU NVM section for 3168 devices + +The logic for checking required NVM sections was recently fixed in +commit b3f20e098293 ("iwlwifi: mvm: fix NVM check for 3168 +devices"). However, with that fixed the else is now taken for 3168 +devices and within the else clause there is a mandatory check for the +PHY_SKU section. This causes the parsing to fail for 3168 devices. + +The PHY_SKU section is really only mandatory for the IWL_NVM_EXT +layout (the phy_sku parameter of iwl_parse_nvm_data is only used when +the NVM type is IWL_NVM_EXT). So this changes the PHY_SKU section +check so that it's only mandatory for IWL_NVM_EXT. + +Fixes: b3f20e098293 ("iwlwifi: mvm: fix NVM check for 3168 devices") +Signed-off-by: Dan Moulding +--- + drivers/net/wireless/intel/iwlwifi/mvm/nvm.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c +index 46128a2a9c6e..e98ce380c7b9 100644 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c +@@ -308,7 +308,8 @@ iwl_parse_nvm_sections(struct iwl_mvm *mvm) + } + + /* PHY_SKU section is mandatory in B0 */ +- if (!mvm->nvm_sections[NVM_SECTION_TYPE_PHY_SKU].data) { ++ if (mvm->trans->cfg->nvm_type == IWL_NVM_EXT && ++ !mvm->nvm_sections[NVM_SECTION_TYPE_PHY_SKU].data) { + IWL_ERR(mvm, + "Can't parse phy_sku in B0, empty sections\n"); + return NULL; +-- +cgit v1.2.2-1-gc45e + diff --git a/0003-iwlwifi-mvm-Do-not-require-PHY_SKU-NVM-section-for-3168-devices.patch b/0003-iwlwifi-mvm-Do-not-require-PHY_SKU-NVM-section-for-3168-devices.patch deleted file mode 100644 index f9830bb..0000000 --- a/0003-iwlwifi-mvm-Do-not-require-PHY_SKU-NVM-section-for-3168-devices.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 0e6fb279c7fc6fc818942f668f731946286c959c Mon Sep 17 00:00:00 2001 -From: Dan Moulding -Date: Tue, 28 Jan 2020 02:31:07 -0700 -Subject: iwlwifi: mvm: Do not require PHY_SKU NVM section for 3168 devices - -The logic for checking required NVM sections was recently fixed in -commit b3f20e098293 ("iwlwifi: mvm: fix NVM check for 3168 -devices"). However, with that fixed the else is now taken for 3168 -devices and within the else clause there is a mandatory check for the -PHY_SKU section. This causes the parsing to fail for 3168 devices. - -The PHY_SKU section is really only mandatory for the IWL_NVM_EXT -layout (the phy_sku parameter of iwl_parse_nvm_data is only used when -the NVM type is IWL_NVM_EXT). So this changes the PHY_SKU section -check so that it's only mandatory for IWL_NVM_EXT. - -Fixes: b3f20e098293 ("iwlwifi: mvm: fix NVM check for 3168 devices") -Signed-off-by: Dan Moulding ---- - drivers/net/wireless/intel/iwlwifi/mvm/nvm.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c -index 46128a2a9c6e..e98ce380c7b9 100644 ---- a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c -+++ b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c -@@ -308,7 +308,8 @@ iwl_parse_nvm_sections(struct iwl_mvm *mvm) - } - - /* PHY_SKU section is mandatory in B0 */ -- if (!mvm->nvm_sections[NVM_SECTION_TYPE_PHY_SKU].data) { -+ if (mvm->trans->cfg->nvm_type == IWL_NVM_EXT && -+ !mvm->nvm_sections[NVM_SECTION_TYPE_PHY_SKU].data) { - IWL_ERR(mvm, - "Can't parse phy_sku in B0, empty sections\n"); - return NULL; --- -cgit v1.2.2-1-gc45e - diff --git a/0005-drm-Remove-PageReserved-manipulation-from-drm_pci_al.patch b/0005-drm-Remove-PageReserved-manipulation-from-drm_pci_al.patch new file mode 100644 index 0000000..15688c8 --- /dev/null +++ b/0005-drm-Remove-PageReserved-manipulation-from-drm_pci_al.patch @@ -0,0 +1,91 @@ +From c40f78c76b2f3ae55c348e8b206b0b283f01549c Mon Sep 17 00:00:00 2001 +From: Chris Wilson +Date: Sun, 2 Feb 2020 17:16:31 +0000 +Subject: drm: Remove PageReserved manipulation from drm_pci_alloc + +drm_pci_alloc/drm_pci_free are very thin wrappers around the core dma +facilities, and we have no special reason within the drm layer to behave +differently. In particular, since + +commit de09d31dd38a50fdce106c15abd68432eebbd014 +Author: Kirill A. Shutemov +Date: Fri Jan 15 16:51:42 2016 -0800 + + page-flags: define PG_reserved behavior on compound pages + + As far as I can see there's no users of PG_reserved on compound pages. + Let's use PF_NO_COMPOUND here. + +it has been illegal to combine GFP_COMP with SetPageReserved, so lets +stop doing both and leave the dma layer to its own devices. + +Reported-by: Taketo Kabe +Bug: https://gitlab.freedesktop.org/drm/intel/issues/1027 +Fixes: de09d31dd38a ("page-flags: define PG_reserved behavior on compound pages") +Signed-off-by: Chris Wilson +Cc: # v4.5+ +Reviewed-by: Alex Deucher +Link: https://patchwork.freedesktop.org/patch/msgid/20200202171635.4039044-1-chris@chris-wilson.co.uk +--- + drivers/gpu/drm/drm_pci.c | 23 ++--------------------- + 1 file changed, 2 insertions(+), 21 deletions(-) + +diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c +index a86a3ab2771c..235729f4aadb 100644 +--- a/drivers/gpu/drm/drm_pci.c ++++ b/drivers/gpu/drm/drm_pci.c +@@ -51,8 +51,6 @@ + drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align) + { + drm_dma_handle_t *dmah; +- unsigned long addr; +- size_t sz; + + /* pci_alloc_consistent only guarantees alignment to the smallest + * PAGE_SIZE order which is greater than or equal to the requested size. +@@ -68,20 +66,13 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t ali + dmah->size = size; + dmah->vaddr = dma_alloc_coherent(&dev->pdev->dev, size, + &dmah->busaddr, +- GFP_KERNEL | __GFP_COMP); ++ GFP_KERNEL); + + if (dmah->vaddr == NULL) { + kfree(dmah); + return NULL; + } + +- /* XXX - Is virt_to_page() legal for consistent mem? */ +- /* Reserve */ +- for (addr = (unsigned long)dmah->vaddr, sz = size; +- sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) { +- SetPageReserved(virt_to_page((void *)addr)); +- } +- + return dmah; + } + +@@ -94,19 +85,9 @@ EXPORT_SYMBOL(drm_pci_alloc); + */ + void __drm_legacy_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah) + { +- unsigned long addr; +- size_t sz; +- +- if (dmah->vaddr) { +- /* XXX - Is virt_to_page() legal for consistent mem? */ +- /* Unreserve */ +- for (addr = (unsigned long)dmah->vaddr, sz = dmah->size; +- sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) { +- ClearPageReserved(virt_to_page((void *)addr)); +- } ++ if (dmah->vaddr) + dma_free_coherent(&dev->pdev->dev, dmah->size, dmah->vaddr, + dmah->busaddr); +- } + } + + /** +-- +cgit v1.2.2-1-gc45e + diff --git a/0005-drm-Remove-PageReserved-manipulation-from-drm_pci_alloc.patch b/0005-drm-Remove-PageReserved-manipulation-from-drm_pci_alloc.patch deleted file mode 100644 index 15688c8..0000000 --- a/0005-drm-Remove-PageReserved-manipulation-from-drm_pci_alloc.patch +++ /dev/null @@ -1,91 +0,0 @@ -From c40f78c76b2f3ae55c348e8b206b0b283f01549c Mon Sep 17 00:00:00 2001 -From: Chris Wilson -Date: Sun, 2 Feb 2020 17:16:31 +0000 -Subject: drm: Remove PageReserved manipulation from drm_pci_alloc - -drm_pci_alloc/drm_pci_free are very thin wrappers around the core dma -facilities, and we have no special reason within the drm layer to behave -differently. In particular, since - -commit de09d31dd38a50fdce106c15abd68432eebbd014 -Author: Kirill A. Shutemov -Date: Fri Jan 15 16:51:42 2016 -0800 - - page-flags: define PG_reserved behavior on compound pages - - As far as I can see there's no users of PG_reserved on compound pages. - Let's use PF_NO_COMPOUND here. - -it has been illegal to combine GFP_COMP with SetPageReserved, so lets -stop doing both and leave the dma layer to its own devices. - -Reported-by: Taketo Kabe -Bug: https://gitlab.freedesktop.org/drm/intel/issues/1027 -Fixes: de09d31dd38a ("page-flags: define PG_reserved behavior on compound pages") -Signed-off-by: Chris Wilson -Cc: # v4.5+ -Reviewed-by: Alex Deucher -Link: https://patchwork.freedesktop.org/patch/msgid/20200202171635.4039044-1-chris@chris-wilson.co.uk ---- - drivers/gpu/drm/drm_pci.c | 23 ++--------------------- - 1 file changed, 2 insertions(+), 21 deletions(-) - -diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c -index a86a3ab2771c..235729f4aadb 100644 ---- a/drivers/gpu/drm/drm_pci.c -+++ b/drivers/gpu/drm/drm_pci.c -@@ -51,8 +51,6 @@ - drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align) - { - drm_dma_handle_t *dmah; -- unsigned long addr; -- size_t sz; - - /* pci_alloc_consistent only guarantees alignment to the smallest - * PAGE_SIZE order which is greater than or equal to the requested size. -@@ -68,20 +66,13 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t ali - dmah->size = size; - dmah->vaddr = dma_alloc_coherent(&dev->pdev->dev, size, - &dmah->busaddr, -- GFP_KERNEL | __GFP_COMP); -+ GFP_KERNEL); - - if (dmah->vaddr == NULL) { - kfree(dmah); - return NULL; - } - -- /* XXX - Is virt_to_page() legal for consistent mem? */ -- /* Reserve */ -- for (addr = (unsigned long)dmah->vaddr, sz = size; -- sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) { -- SetPageReserved(virt_to_page((void *)addr)); -- } -- - return dmah; - } - -@@ -94,19 +85,9 @@ EXPORT_SYMBOL(drm_pci_alloc); - */ - void __drm_legacy_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah) - { -- unsigned long addr; -- size_t sz; -- -- if (dmah->vaddr) { -- /* XXX - Is virt_to_page() legal for consistent mem? */ -- /* Unreserve */ -- for (addr = (unsigned long)dmah->vaddr, sz = dmah->size; -- sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) { -- ClearPageReserved(virt_to_page((void *)addr)); -- } -+ if (dmah->vaddr) - dma_free_coherent(&dev->pdev->dev, dmah->size, dmah->vaddr, - dmah->busaddr); -- } - } - - /** --- -cgit v1.2.2-1-gc45e - diff --git a/0006-drm-i915-execlists-Always-force-a-context-reload-whe.patch b/0006-drm-i915-execlists-Always-force-a-context-reload-whe.patch new file mode 100644 index 0000000..b6214d2 --- /dev/null +++ b/0006-drm-i915-execlists-Always-force-a-context-reload-whe.patch @@ -0,0 +1,145 @@ +From 6ffd5925e2659e589d48b8dcaf06e0b3cc0f4d52 Mon Sep 17 00:00:00 2001 +From: Chris Wilson +Date: Fri, 7 Feb 2020 21:14:52 +0000 +Subject: drm/i915/execlists: Always force a context reload when rewinding + RING_TAIL + +If we rewind the RING_TAIL on a context, due to a preemption event, we +must force the context restore for the RING_TAIL update to be properly +handled. Rather than note which preemption events may cause us to rewind +the tail, compare the new request's tail with the previously submitted +RING_TAIL, as it turns out that timeslicing was causing unexpected +rewinds. + + -0 0d.s2 1280851190us : __execlists_submission_tasklet: 0000:00:02.0 rcs0: expired last=130:4698, prio=3, hint=3 + -0 0d.s2 1280851192us : __i915_request_unsubmit: 0000:00:02.0 rcs0: fence 66:119966, current 119964 + -0 0d.s2 1280851195us : __i915_request_unsubmit: 0000:00:02.0 rcs0: fence 130:4698, current 4695 + -0 0d.s2 1280851198us : __i915_request_unsubmit: 0000:00:02.0 rcs0: fence 130:4696, current 4695 +^---- Note we unwind 2 requests from the same context + + -0 0d.s2 1280851208us : __i915_request_submit: 0000:00:02.0 rcs0: fence 130:4696, current 4695 + -0 0d.s2 1280851213us : __i915_request_submit: 0000:00:02.0 rcs0: fence 134:1508, current 1506 +^---- But to apply the new timeslice, we have to replay the first request + before the new client can start -- the unexpected RING_TAIL rewind + + -0 0d.s2 1280851219us : trace_ports: 0000:00:02.0 rcs0: submit { 130:4696*, 134:1508 } + synmark2-5425 2..s. 1280851239us : process_csb: 0000:00:02.0 rcs0: cs-irq head=5, tail=0 + synmark2-5425 2..s. 1280851240us : process_csb: 0000:00:02.0 rcs0: csb[0]: status=0x00008002:0x00000000 +^---- Preemption event for the ELSP update; note the lite-restore + + synmark2-5425 2..s. 1280851243us : trace_ports: 0000:00:02.0 rcs0: preempted { 130:4698, 66:119966 } + synmark2-5425 2..s. 1280851246us : trace_ports: 0000:00:02.0 rcs0: promote { 130:4696*, 134:1508 } + synmark2-5425 2.... 1280851462us : __i915_request_commit: 0000:00:02.0 rcs0: fence 130:4700, current 4695 + synmark2-5425 2.... 1280852111us : __i915_request_commit: 0000:00:02.0 rcs0: fence 130:4702, current 4695 + synmark2-5425 2.Ns1 1280852296us : process_csb: 0000:00:02.0 rcs0: cs-irq head=0, tail=2 + synmark2-5425 2.Ns1 1280852297us : process_csb: 0000:00:02.0 rcs0: csb[1]: status=0x00000814:0x00000000 + synmark2-5425 2.Ns1 1280852299us : trace_ports: 0000:00:02.0 rcs0: completed { 130:4696!, 134:1508 } + synmark2-5425 2.Ns1 1280852301us : process_csb: 0000:00:02.0 rcs0: csb[2]: status=0x00000818:0x00000040 + synmark2-5425 2.Ns1 1280852302us : trace_ports: 0000:00:02.0 rcs0: completed { 134:1508, 0:0 } + synmark2-5425 2.Ns1 1280852313us : process_csb: process_csb:2336 GEM_BUG_ON(!i915_request_completed(*execlists->active) && !reset_in_progress(execlists)) + +Fixes: 8ee36e048c98 ("drm/i915/execlists: Minimalistic timeslicing") +Referenecs: 82c69bf58650 ("drm/i915/gt: Detect if we miss WaIdleLiteRestore") +Signed-off-by: Chris Wilson +Cc: Mika Kuoppala +Reviewed-by: Mika Kuoppala +Cc: # v5.4+ +Link: https://patchwork.freedesktop.org/patch/msgid/20200207211452.2860634-1-chris@chris-wilson.co.uk +--- + drivers/gpu/drm/i915/gt/intel_lrc.c | 18 ++++++++---------- + drivers/gpu/drm/i915/gt/intel_ring.c | 1 + + drivers/gpu/drm/i915/gt/intel_ring.h | 8 ++++++++ + drivers/gpu/drm/i915/gt/intel_ring_types.h | 1 + + 4 files changed, 18 insertions(+), 10 deletions(-) + +diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c +index d925a1035c9d..1b4784bfa7e5 100644 +--- a/drivers/gpu/drm/i915/gt/intel_lrc.c ++++ b/drivers/gpu/drm/i915/gt/intel_lrc.c +@@ -1157,7 +1157,7 @@ static u64 execlists_update_context(struct i915_request *rq) + { + struct intel_context *ce = rq->hw_context; + u64 desc = ce->lrc_desc; +- u32 tail; ++ u32 tail, prev; + + /* + * WaIdleLiteRestore:bdw,skl +@@ -1170,9 +1170,15 @@ static u64 execlists_update_context(struct i915_request *rq) + * subsequent resubmissions (for lite restore). Should that fail us, + * and we try and submit the same tail again, force the context + * reload. ++ * ++ * If we need to return to a preempted context, we need to skip the ++ * lite-restore and force it to reload the RING_TAIL. Otherwise, the ++ * HW has a tendency to ignore us rewinding the TAIL to the end of ++ * an earlier request. + */ + tail = intel_ring_set_tail(rq->ring, rq->tail); +- if (unlikely(ce->lrc_reg_state[CTX_RING_TAIL] == tail)) ++ prev = ce->lrc_reg_state[CTX_RING_TAIL]; ++ if (unlikely(intel_ring_direction(rq->ring, tail, prev) <= 0)) + desc |= CTX_DESC_FORCE_RESTORE; + ce->lrc_reg_state[CTX_RING_TAIL] = tail; + rq->tail = rq->wa_tail; +@@ -1651,14 +1657,6 @@ static void execlists_dequeue(struct intel_engine_cs *engine) + */ + __unwind_incomplete_requests(engine); + +- /* +- * If we need to return to the preempted context, we +- * need to skip the lite-restore and force it to +- * reload the RING_TAIL. Otherwise, the HW has a +- * tendency to ignore us rewinding the TAIL to the +- * end of an earlier request. +- */ +- last->hw_context->lrc_desc |= CTX_DESC_FORCE_RESTORE; + last = NULL; + } else if (need_timeslice(engine, last) && + timer_expired(&engine->execlists.timer)) { +diff --git a/drivers/gpu/drm/i915/gt/intel_ring.c b/drivers/gpu/drm/i915/gt/intel_ring.c +index 374b28f13ca0..6ff803f397c4 100644 +--- a/drivers/gpu/drm/i915/gt/intel_ring.c ++++ b/drivers/gpu/drm/i915/gt/intel_ring.c +@@ -145,6 +145,7 @@ intel_engine_create_ring(struct intel_engine_cs *engine, int size) + + kref_init(&ring->ref); + ring->size = size; ++ ring->wrap = BITS_PER_TYPE(ring->size) - ilog2(size); + + /* + * Workaround an erratum on the i830 which causes a hang if +diff --git a/drivers/gpu/drm/i915/gt/intel_ring.h b/drivers/gpu/drm/i915/gt/intel_ring.h +index ea2839d9e044..5bdce24994aa 100644 +--- a/drivers/gpu/drm/i915/gt/intel_ring.h ++++ b/drivers/gpu/drm/i915/gt/intel_ring.h +@@ -56,6 +56,14 @@ static inline u32 intel_ring_wrap(const struct intel_ring *ring, u32 pos) + return pos & (ring->size - 1); + } + ++static inline int intel_ring_direction(const struct intel_ring *ring, ++ u32 next, u32 prev) ++{ ++ typecheck(typeof(ring->size), next); ++ typecheck(typeof(ring->size), prev); ++ return (next - prev) << ring->wrap; ++} ++ + static inline bool + intel_ring_offset_valid(const struct intel_ring *ring, + unsigned int pos) +diff --git a/drivers/gpu/drm/i915/gt/intel_ring_types.h b/drivers/gpu/drm/i915/gt/intel_ring_types.h +index d9f17f38e0cc..3cd7fec7fd8d 100644 +--- a/drivers/gpu/drm/i915/gt/intel_ring_types.h ++++ b/drivers/gpu/drm/i915/gt/intel_ring_types.h +@@ -45,6 +45,7 @@ struct intel_ring { + + u32 space; + u32 size; ++ u32 wrap; + u32 effective_size; + }; + +-- +cgit v1.2.2-1-gc45e + diff --git a/0006-drm-i915-execlists-Always-force-a-context-reload-when-rewinding.patch b/0006-drm-i915-execlists-Always-force-a-context-reload-when-rewinding.patch deleted file mode 100644 index b6214d2..0000000 --- a/0006-drm-i915-execlists-Always-force-a-context-reload-when-rewinding.patch +++ /dev/null @@ -1,145 +0,0 @@ -From 6ffd5925e2659e589d48b8dcaf06e0b3cc0f4d52 Mon Sep 17 00:00:00 2001 -From: Chris Wilson -Date: Fri, 7 Feb 2020 21:14:52 +0000 -Subject: drm/i915/execlists: Always force a context reload when rewinding - RING_TAIL - -If we rewind the RING_TAIL on a context, due to a preemption event, we -must force the context restore for the RING_TAIL update to be properly -handled. Rather than note which preemption events may cause us to rewind -the tail, compare the new request's tail with the previously submitted -RING_TAIL, as it turns out that timeslicing was causing unexpected -rewinds. - - -0 0d.s2 1280851190us : __execlists_submission_tasklet: 0000:00:02.0 rcs0: expired last=130:4698, prio=3, hint=3 - -0 0d.s2 1280851192us : __i915_request_unsubmit: 0000:00:02.0 rcs0: fence 66:119966, current 119964 - -0 0d.s2 1280851195us : __i915_request_unsubmit: 0000:00:02.0 rcs0: fence 130:4698, current 4695 - -0 0d.s2 1280851198us : __i915_request_unsubmit: 0000:00:02.0 rcs0: fence 130:4696, current 4695 -^---- Note we unwind 2 requests from the same context - - -0 0d.s2 1280851208us : __i915_request_submit: 0000:00:02.0 rcs0: fence 130:4696, current 4695 - -0 0d.s2 1280851213us : __i915_request_submit: 0000:00:02.0 rcs0: fence 134:1508, current 1506 -^---- But to apply the new timeslice, we have to replay the first request - before the new client can start -- the unexpected RING_TAIL rewind - - -0 0d.s2 1280851219us : trace_ports: 0000:00:02.0 rcs0: submit { 130:4696*, 134:1508 } - synmark2-5425 2..s. 1280851239us : process_csb: 0000:00:02.0 rcs0: cs-irq head=5, tail=0 - synmark2-5425 2..s. 1280851240us : process_csb: 0000:00:02.0 rcs0: csb[0]: status=0x00008002:0x00000000 -^---- Preemption event for the ELSP update; note the lite-restore - - synmark2-5425 2..s. 1280851243us : trace_ports: 0000:00:02.0 rcs0: preempted { 130:4698, 66:119966 } - synmark2-5425 2..s. 1280851246us : trace_ports: 0000:00:02.0 rcs0: promote { 130:4696*, 134:1508 } - synmark2-5425 2.... 1280851462us : __i915_request_commit: 0000:00:02.0 rcs0: fence 130:4700, current 4695 - synmark2-5425 2.... 1280852111us : __i915_request_commit: 0000:00:02.0 rcs0: fence 130:4702, current 4695 - synmark2-5425 2.Ns1 1280852296us : process_csb: 0000:00:02.0 rcs0: cs-irq head=0, tail=2 - synmark2-5425 2.Ns1 1280852297us : process_csb: 0000:00:02.0 rcs0: csb[1]: status=0x00000814:0x00000000 - synmark2-5425 2.Ns1 1280852299us : trace_ports: 0000:00:02.0 rcs0: completed { 130:4696!, 134:1508 } - synmark2-5425 2.Ns1 1280852301us : process_csb: 0000:00:02.0 rcs0: csb[2]: status=0x00000818:0x00000040 - synmark2-5425 2.Ns1 1280852302us : trace_ports: 0000:00:02.0 rcs0: completed { 134:1508, 0:0 } - synmark2-5425 2.Ns1 1280852313us : process_csb: process_csb:2336 GEM_BUG_ON(!i915_request_completed(*execlists->active) && !reset_in_progress(execlists)) - -Fixes: 8ee36e048c98 ("drm/i915/execlists: Minimalistic timeslicing") -Referenecs: 82c69bf58650 ("drm/i915/gt: Detect if we miss WaIdleLiteRestore") -Signed-off-by: Chris Wilson -Cc: Mika Kuoppala -Reviewed-by: Mika Kuoppala -Cc: # v5.4+ -Link: https://patchwork.freedesktop.org/patch/msgid/20200207211452.2860634-1-chris@chris-wilson.co.uk ---- - drivers/gpu/drm/i915/gt/intel_lrc.c | 18 ++++++++---------- - drivers/gpu/drm/i915/gt/intel_ring.c | 1 + - drivers/gpu/drm/i915/gt/intel_ring.h | 8 ++++++++ - drivers/gpu/drm/i915/gt/intel_ring_types.h | 1 + - 4 files changed, 18 insertions(+), 10 deletions(-) - -diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c -index d925a1035c9d..1b4784bfa7e5 100644 ---- a/drivers/gpu/drm/i915/gt/intel_lrc.c -+++ b/drivers/gpu/drm/i915/gt/intel_lrc.c -@@ -1157,7 +1157,7 @@ static u64 execlists_update_context(struct i915_request *rq) - { - struct intel_context *ce = rq->hw_context; - u64 desc = ce->lrc_desc; -- u32 tail; -+ u32 tail, prev; - - /* - * WaIdleLiteRestore:bdw,skl -@@ -1170,9 +1170,15 @@ static u64 execlists_update_context(struct i915_request *rq) - * subsequent resubmissions (for lite restore). Should that fail us, - * and we try and submit the same tail again, force the context - * reload. -+ * -+ * If we need to return to a preempted context, we need to skip the -+ * lite-restore and force it to reload the RING_TAIL. Otherwise, the -+ * HW has a tendency to ignore us rewinding the TAIL to the end of -+ * an earlier request. - */ - tail = intel_ring_set_tail(rq->ring, rq->tail); -- if (unlikely(ce->lrc_reg_state[CTX_RING_TAIL] == tail)) -+ prev = ce->lrc_reg_state[CTX_RING_TAIL]; -+ if (unlikely(intel_ring_direction(rq->ring, tail, prev) <= 0)) - desc |= CTX_DESC_FORCE_RESTORE; - ce->lrc_reg_state[CTX_RING_TAIL] = tail; - rq->tail = rq->wa_tail; -@@ -1651,14 +1657,6 @@ static void execlists_dequeue(struct intel_engine_cs *engine) - */ - __unwind_incomplete_requests(engine); - -- /* -- * If we need to return to the preempted context, we -- * need to skip the lite-restore and force it to -- * reload the RING_TAIL. Otherwise, the HW has a -- * tendency to ignore us rewinding the TAIL to the -- * end of an earlier request. -- */ -- last->hw_context->lrc_desc |= CTX_DESC_FORCE_RESTORE; - last = NULL; - } else if (need_timeslice(engine, last) && - timer_expired(&engine->execlists.timer)) { -diff --git a/drivers/gpu/drm/i915/gt/intel_ring.c b/drivers/gpu/drm/i915/gt/intel_ring.c -index 374b28f13ca0..6ff803f397c4 100644 ---- a/drivers/gpu/drm/i915/gt/intel_ring.c -+++ b/drivers/gpu/drm/i915/gt/intel_ring.c -@@ -145,6 +145,7 @@ intel_engine_create_ring(struct intel_engine_cs *engine, int size) - - kref_init(&ring->ref); - ring->size = size; -+ ring->wrap = BITS_PER_TYPE(ring->size) - ilog2(size); - - /* - * Workaround an erratum on the i830 which causes a hang if -diff --git a/drivers/gpu/drm/i915/gt/intel_ring.h b/drivers/gpu/drm/i915/gt/intel_ring.h -index ea2839d9e044..5bdce24994aa 100644 ---- a/drivers/gpu/drm/i915/gt/intel_ring.h -+++ b/drivers/gpu/drm/i915/gt/intel_ring.h -@@ -56,6 +56,14 @@ static inline u32 intel_ring_wrap(const struct intel_ring *ring, u32 pos) - return pos & (ring->size - 1); - } - -+static inline int intel_ring_direction(const struct intel_ring *ring, -+ u32 next, u32 prev) -+{ -+ typecheck(typeof(ring->size), next); -+ typecheck(typeof(ring->size), prev); -+ return (next - prev) << ring->wrap; -+} -+ - static inline bool - intel_ring_offset_valid(const struct intel_ring *ring, - unsigned int pos) -diff --git a/drivers/gpu/drm/i915/gt/intel_ring_types.h b/drivers/gpu/drm/i915/gt/intel_ring_types.h -index d9f17f38e0cc..3cd7fec7fd8d 100644 ---- a/drivers/gpu/drm/i915/gt/intel_ring_types.h -+++ b/drivers/gpu/drm/i915/gt/intel_ring_types.h -@@ -45,6 +45,7 @@ struct intel_ring { - - u32 space; - u32 size; -+ u32 wrap; - u32 effective_size; - }; - --- -cgit v1.2.2-1-gc45e - diff --git a/PKGBUILD b/PKGBUILD index 473235b..5fb71a0 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -45,10 +45,10 @@ source=( https://www.kernel.org/pub/linux/kernel/v${_supver}.x/${_srcname}.tar.{xz,sign} 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch 0002-iwlwifi-pcie-restore-support-for-Killer-Qu-C0-NICs.patch - 0003-iwlwifi-mvm-Do-not-require-PHY_SKU-NVM-section-for-3168-devices.patch + 0003-iwlwifi-mvm-Do-not-require-PHY_SKU-NVM-section-for-3.patch 0004-drm-i915-Wean-off-drm_pci_alloc-drm_pci_free.patch - 0005-drm-Remove-PageReserved-manipulation-from-drm_pci_alloc.patch - 0006-drm-i915-execlists-Always-force-a-context-reload-when-rewinding.patch + 0005-drm-Remove-PageReserved-manipulation-from-drm_pci_al.patch + 0006-drm-i915-execlists-Always-force-a-context-reload-whe.patch linux-ck-patch-${_supver}.${_majver}-${_ckpatchversion}.xz::http://ck.kolivas.org/patches/${_supver}.0/${_supver}.${_majver}/${_supver}.${_majver}-${_ckpatchversion}/patch-${_supver}.${_majver}-${_ckpatchversion}.xz graysky_bdver2-hotfix.patch kernel_gcc_patch-${_gccpatchver}.tar.gz::https://github.com/graysky2/kernel_gcc_patch/archive/${_gccpatchver}.tar.gz @@ -94,10 +94,10 @@ prepare() { echo "Applying hotfixes" patch -p1 -i ../0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch patch -p1 -i ../0002-iwlwifi-pcie-restore-support-for-Killer-Qu-C0-NICs.patch - patch -p1 -i ../0003-iwlwifi-mvm-Do-not-require-PHY_SKU-NVM-section-for-3168-devices.patch + patch -p1 -i ../0003-iwlwifi-mvm-Do-not-require-PHY_SKU-NVM-section-for-3.patch patch -p1 -i ../0004-drm-i915-Wean-off-drm_pci_alloc-drm_pci_free.patch - patch -p1 -i ../0005-drm-Remove-PageReserved-manipulation-from-drm_pci_alloc.patch - patch -p1 -i ../0006-drm-i915-execlists-Always-force-a-context-reload-when-rewinding.patch + patch -p1 -i ../0005-drm-Remove-PageReserved-manipulation-from-drm_pci_al.patch + patch -p1 -i ../0006-drm-i915-execlists-Always-force-a-context-reload-whe.patch # fix naming schema in EXTRAVERSION of ck patch set -- cgit v1.2.1