[PATCH 1/3] drm/panfrost: Simplify lock_region calculation

2021-08-20 Thread Alyssa Rosenzweig
In lock_region, simplify the calculation of the region_width parameter. This field is the size, but encoded as log2(ceil(size)) - 1. log2(ceil(size)) may be computed directly as fls(size - 1). However, we want to use the 64-bit versions as the amount to lock can exceed 32-bits. This avoids undefin

[PATCH 2/3] drm/panfrost: Use u64 for size in lock_region

2021-08-20 Thread Alyssa Rosenzweig
Mali virtual addresses are 48-bit. Use a u64 instead of size_t to ensure we can express the "lock everything" condition as ~0ULL without relying on platform-specific behaviour. Signed-off-by: Alyssa Rosenzweig Suggested-by: Rob Herring Tested-by: Chris Morgan --- drivers/gpu/drm/panfrost/panfr

[PATCH 3/3] drm/panfrost: Clamp lock region to Bifrost minimum

2021-08-20 Thread Alyssa Rosenzweig
When locking a region, we currently clamp to a PAGE_SIZE as the minimum lock region. While this is valid for Midgard, it is invalid for Bifrost, where the minimum locking size is 8x larger than the 4k page size. Add a hardware definition for the minimum lock region size (corresponding to KBASE_LOCK

[PATCH 00/27] Parallel submission aka multi-bb execbuf

2021-08-20 Thread Matthew Brost
As discussed in [1] we are introducing a new parallel submission uAPI for the i915 which allows more than 1 BB to be submitted in an execbuf IOCTL. This is the implemenation for both GuC and execlists. In addition to selftests in the series, an IGT is available implemented in the first 4 patches [

[PATCH 08/27] drm/i915: Add logical engine mapping

2021-08-20 Thread Matthew Brost
Add logical engine mapping. This is required for split-frame, as workloads need to be placed on engines in a logically contiguous manner. v2: (Daniel Vetter) - Add kernel doc for new fields Signed-off-by: Matthew Brost --- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 60 --

[PATCH 09/27] drm/i915: Expose logical engine instance to user

2021-08-20 Thread Matthew Brost
Expose logical engine instance to user via query engine info IOCTL. This is required for split-frame workloads as these needs to be placed on engines in a logically contiguous order. The logical mapping can change based on fusing. Rather than having user have knowledge of the fusing we simply just

[PATCH 12/27] drm/i915/guc: Add multi-lrc context registration

2021-08-20 Thread Matthew Brost
Add multi-lrc context registration H2G. In addition a workqueue and process descriptor are setup during multi-lrc context registration as these data structures are needed for multi-lrc submission. Signed-off-by: Matthew Brost --- drivers/gpu/drm/i915/gt/intel_context_types.h | 12 ++ drivers/gp

[PATCH 15/27] drm/i915/guc: Implement multi-lrc submission

2021-08-20 Thread Matthew Brost
Implement multi-lrc submission via a single workqueue entry and single H2G. The workqueue entry contains an updated tail value for each request, of all the contexts in the multi-lrc submission, and updates these values simultaneously. As such, the tasklet and bypass path have been updated to coales

[PATCH 05/27] drm/i915: Add GT PM unpark worker

2021-08-20 Thread Matthew Brost
Sometimes it is desirable to queue work up for later if the GT PM isn't held and run that work on next GT PM unpark. Implemented with a list in the GT of all pending work, workqueues in the list, a callback to add a workqueue to the list, and finally a wakeref post_get callback that iterates / dra

[PATCH 11/27] drm/i915/guc: Implement parallel context pin / unpin functions

2021-08-20 Thread Matthew Brost
Parallel contexts are perma-pinned by the upper layers which makes the backend implementation rather simple. The parent pins the guc_id and children increment the parent's pin count on pin to ensure all the contexts are unpinned before we disable scheduling with the GuC / or deregister the context.

[PATCH 10/27] drm/i915/guc: Introduce context parent-child relationship

2021-08-20 Thread Matthew Brost
Introduce context parent-child relationship. Once this relationship is created all pinning / unpinning operations are directed to the parent context. The parent context is responsible for pinning all of its' children and itself. This is a precursor to the full GuC multi-lrc implementation but alig

[PATCH 07/27] drm/i915/guc: Don't call switch_to_kernel_context with GuC submission

2021-08-20 Thread Matthew Brost
Calling switch_to_kernel_context isn't needed if the engine PM reference is taken while all contexts are pinned. By not calling switch_to_kernel_context we save on issuing a request to the engine. v2: (Daniel Vetter) - Add FIXME comment about pushing switch_to_kernel_context to backend Signed-

[PATCH 02/27] drm/i915/guc: Allow flexible number of context ids

2021-08-20 Thread Matthew Brost
Number of available GuC contexts ids might be limited. Stop referring in code to macro and use variable instead. Signed-off-by: Michal Wajdeczko Signed-off-by: Matthew Brost --- drivers/gpu/drm/i915/gt/uc/intel_guc.h| 4 drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 15 +

[PATCH 03/27] drm/i915/guc: Connect the number of guc_ids to debugfs

2021-08-20 Thread Matthew Brost
For testing purposes it may make sense to reduce the number of guc_ids available to be allocated. Add debugfs support for setting the number of guc_ids. Signed-off-by: Matthew Brost --- .../gpu/drm/i915/gt/uc/intel_guc_debugfs.c| 31 +++ .../gpu/drm/i915/gt/uc/intel_guc_submi

[PATCH 01/27] drm/i915/guc: Squash Clean up GuC CI failures, simplify locking, and kernel DOC

2021-08-20 Thread Matthew Brost
https://patchwork.freedesktop.org/series/93704/ Signed-off-by: Matthew Brost --- drivers/gpu/drm/i915/gt/intel_context.c | 19 +- drivers/gpu/drm/i915/gt/intel_context_types.h | 81 +- .../drm/i915/gt/intel_execlists_submission.c | 4 - drivers/gpu/drm/i915/gt/selftest_hangcheck.c |

[PATCH 04/27] drm/i915/guc: Take GT PM ref when deregistering context

2021-08-20 Thread Matthew Brost
Taking a PM reference to prevent intel_gt_wait_for_idle from short circuiting while a deregister context H2G is in flight. FIXME: Move locking / structure changes into different patch Signed-off-by: Matthew Brost --- drivers/gpu/drm/i915/gt/intel_context.c | 2 + drivers/gpu/drm/i915/gt

[PATCH 27/27] drm/i915/execlists: Weak parallel submission support for execlists

2021-08-20 Thread Matthew Brost
A weak implementation of parallel submission (multi-bb execbuf IOCTL) for execlists. Basically doing as little as possible to support this interface for execlists - basically just passing submit fences between each request generated and virtual engines are not allowed. This is on par with what is t

[PATCH 06/27] drm/i915/guc: Take engine PM when a context is pinned with GuC submission

2021-08-20 Thread Matthew Brost
Taking a PM reference to prevent intel_gt_wait_for_idle from short circuiting while a scheduling of user context could be enabled. v2: (Daniel Vetter) - Add might_lock annotations to pin / unpin function Signed-off-by: Matthew Brost --- drivers/gpu/drm/i915/gt/intel_context.c | 3 ++

[PATCH 14/27] drm/i915/guc: Assign contexts in parent-child relationship consecutive guc_ids

2021-08-20 Thread Matthew Brost
Assign contexts in parent-child relationship consecutive guc_ids. This is accomplished by partitioning guc_id space between ones that need to be consecutive (1/16 available guc_ids) and ones that do not (15/16 of available guc_ids). The consecutive search is implemented via the bitmap API. This is

[PATCH 17/27] drm/i915/guc: Implement multi-lrc reset

2021-08-20 Thread Matthew Brost
Update context and full GPU reset to work with multi-lrc. The idea is parent context tracks all the active requests inflight for itself and its' children. The parent context owns the reset replaying / canceling requests as needed. Signed-off-by: Matthew Brost --- drivers/gpu/drm/i915/gt/intel_co

[PATCH 16/27] drm/i915/guc: Insert submit fences between requests in parent-child relationship

2021-08-20 Thread Matthew Brost
The GuC must receive requests in the order submitted for contexts in a parent-child relationship to function correctly. To ensure this, insert a submit fence between the current request and last request submitted for requests / contexts in a parent child relationship. This is conceptually similar t

[PATCH 23/27] drm/i915/guc: Implement no mid batch preemption for multi-lrc

2021-08-20 Thread Matthew Brost
For some users of multi-lrc, e.g. split frame, it isn't safe to preempt mid BB. To safely enable preemption at the BB boundary, a handshake between to parent and child is needed. This is implemented via custom emit_bb_start & emit_fini_breadcrumb functions and enabled via by default if a context is

[PATCH 21/27] drm/i915/doc: Update parallel submit doc to point to i915_drm.h

2021-08-20 Thread Matthew Brost
Update parallel submit doc to point to i915_drm.h Signed-off-by: Matthew Brost --- Documentation/gpu/rfc/i915_parallel_execbuf.h | 122 -- Documentation/gpu/rfc/i915_scheduler.rst | 4 +- 2 files changed, 2 insertions(+), 124 deletions(-) delete mode 100644 Documentation/

[PATCH 25/27] drm/i915/guc: Handle errors in multi-lrc requests

2021-08-20 Thread Matthew Brost
If an error occurs in the front end when multi-lrc requests are getting generated we need to skip these in the backend but we still need to emit the breadcrumbs seqno. An issues arrises because with multi-lrc breadcrumbs there is a handshake between the parent and children to make forwad progress.

[PATCH 13/27] drm/i915/guc: Ensure GuC schedule operations do not operate on child contexts

2021-08-20 Thread Matthew Brost
In GuC parent-child contexts the parent context controls the scheduling, ensure only the parent does the scheduling operations. Signed-off-by: Matthew Brost --- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 24 ++- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/

[PATCH 26/27] drm/i915: Enable multi-bb execbuf

2021-08-20 Thread Matthew Brost
Enable multi-bb execbuf by enabling the set_parallel extension. Signed-off-by: Matthew Brost --- drivers/gpu/drm/i915/gem/i915_gem_context.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c index de0f

[PATCH 24/27] drm/i915: Multi-BB execbuf

2021-08-20 Thread Matthew Brost
Allow multiple batch buffers to be submitted in a single execbuf IOCTL after a context has been configured with the 'set_parallel' extension. The number batches is implicit based on the contexts configuration. This is implemented with a series of loops. First a loop is used to find all the batches

[PATCH 22/27] drm/i915/guc: Add basic GuC multi-lrc selftest

2021-08-20 Thread Matthew Brost
Add very basic (single submission) multi-lrc selftest. Signed-off-by: Matthew Brost --- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 1 + .../drm/i915/gt/uc/selftest_guc_multi_lrc.c | 180 ++ .../drm/i915/selftests/i915_live_selftests.h | 1 + 3 files changed, 182 inser

[PATCH 19/27] drm/i915: Fix bug in user proto-context creation that leaked contexts

2021-08-20 Thread Matthew Brost
Set number of engines before attempting to create contexts so the function free_engines can clean up properly. Fixes: d4433c7600f7 ("drm/i915/gem: Use the proto-context to handle create parameters (v5)") Signed-off-by: Matthew Brost Cc: --- drivers/gpu/drm/i915/gem/i915_gem_context.c | 2 +- 1

[PATCH 20/27] drm/i915/guc: Connect UAPI to GuC multi-lrc interface

2021-08-20 Thread Matthew Brost
Introduce 'set parallel submit' extension to connect UAPI to GuC multi-lrc interface. Kernel doc in new uAPI should explain it all. IGT: https://patchwork.freedesktop.org/patch/447008/?series=93071&rev=1 media UMD: link to come v2: (Daniel Vetter) - Add IGT link and placeholder for media UMD l

[PATCH 18/27] drm/i915/guc: Update debugfs for GuC multi-lrc

2021-08-20 Thread Matthew Brost
Display the workqueue status in debugfs for GuC contexts that are in parent-child relationship. Signed-off-by: Matthew Brost --- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 51 ++- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/uc/inte

Re: [PATCH v3 15/15] drm/mediatek: add mediatek-drm of vdosys1 support for MT8195

2021-08-20 Thread Chun-Kuang Hu
Hi, Nancy: Nancy.Lin 於 2021年8月18日 週三 下午5:18寫道: > > Add driver data of mt8195 vdosys1 to mediatek-drm and modify drm for > multi-mmsys support. The two mmsys (vdosys0 and vdosys1) will bring > up two drm drivers, only one drm driver register as the drm device. > Each drm driver binds its own compo

Re: [PATCH 13/27] drm/i915/guc: Take context ref when cancelling request

2021-08-20 Thread Daniele Ceraolo Spurio
On 8/18/2021 11:16 PM, Matthew Brost wrote: A context can get destroyed after cancelling a request so take a reference to context when cancelling a request. What's the exact race? AFAICS __i915_request_skip does not have a context_put(). Daniele Fixes: 62eaf0ae217d ("drm/i915/guc: Supp

Re: [PATCH 15/27] drm/i915/guc: Reset LRC descriptor if register returns -ENODEV

2021-08-20 Thread Daniele Ceraolo Spurio
On 8/18/2021 11:16 PM, Matthew Brost wrote: Reset LRC descriptor if a context register returns -ENODEV as this means we are mid-reset. Fixes: eb5e7da736f3 ("drm/i915/guc: Reset implementation for new GuC interface") Signed-off-by: Matthew Brost Reviewed-by: Daniele Ceraolo Spurio Daniele

Re: [PATCH 17/27] drm/i915/guc: Flush G2H work queue during reset

2021-08-20 Thread Daniele Ceraolo Spurio
On 8/18/2021 11:16 PM, Matthew Brost wrote: It isn't safe to scrub for missing G2H or continue with the reset until all G2H processing is complete. Flush the G2H work queue during reset to ensure it is done running. Might be worth moving this patch closer to "drm/i915/guc: Process all G2H m

Re: [PATCH 19/27] drm/i915/guc: Move guc_blocked fence to struct guc_state

2021-08-20 Thread Daniele Ceraolo Spurio
On 8/18/2021 11:16 PM, Matthew Brost wrote: Move guc_blocked fence to struct guc_state as the lock which protects the fence lives there. s/ce->guc_blocked/ce->guc_state.blocked_fence/g Could also call it just ce->guc_state.blocked, blocked_fence sounds to me like the fence itself is blocke

Re: [PATCH linux-next] drm: drop unneeded assignment in the fx_v6_0_enable_mgcg()

2021-08-20 Thread Christophe JAILLET
Hi, Le 21/08/2021 à 04:08, CGEL a écrit : From: Luo penghao The first assignment is not used. In order to keep the code style consistency of the whole file, the first 'data' assignment should be deleted. The clang_analyzer complains as follows: drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c:2608:10:

<    1   2