Re: [Intel-gfx] linux-next: manual merge of the drm-misc tree with Linus' tree
On Thu, May 23, 2019 at 11:10:39AM -0500, Rob Herring wrote: > On Thu, May 23, 2019 at 6:54 AM Maxime Ripard > wrote: > > > > On Tue, May 21, 2019 at 10:51:51AM +1000, Stephen Rothwell wrote: > > > Hi all, > > > > > > Today's linux-next merge of the drm-misc tree got a conflict in: > > > > > > Documentation/devicetree/bindings/vendor-prefixes.txt > > > > > > between commit: > > > > > > 8122de54602e ("dt-bindings: Convert vendor prefixes to json-schema") > > > > > > from Linus' tree and commits: > > > > > > b4a2c0055a4f ("dt-bindings: Add vendor prefix for VXT Ltd") > > > b1b0d36bdb15 ("dt-bindings: drm/panel: simple: Add binding for TFC > > > S9700RTWV43TR-01B") > > > fbd8b69ab616 ("dt-bindings: Add vendor prefix for Evervision > > > Electronics") > > > > > > from the drm-misc tree. > > > > > > I fixed it up (I deleted the file and added the patch below) and can > > > carry the fix as necessary. This is now fixed as far as linux-next is > > > concerned, but any non trivial conflicts should be mentioned to your > > > upstream maintainer when your tree is submitted for merging. You may > > > also want to consider cooperating with the maintainer of the conflicting > > > tree to minimise any particularly complex conflicts. > > > > I just took your patch and pushed a temp branch there: > > https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux.git/commit/?h=drm-misc-next&id=3832f2cad5307ebcedeead13fbd8d3cf06ba5e90 > > > > Rob, Stephen, are you ok with the change? If so, I'll push it. > > The 'tfc' line is missing a ':' on the end. That's on me, sorry. > Does the file pass dt_binding_check like that? No, it didn't but I overlooked it somehow. I've pushed that patch with the extra semi-column. Maxime -- Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com signature.asc Description: PGP signature ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH] drm/i915: Maintain consistent documentation subsection ordering
On Thu, 23 May 2019, Jonathan Corbet wrote: > With Sphinx 2.0 (or prior versions with the deprecation warnings fixed) the > docs build fails with: > > Documentation/gpu/i915.rst:403: WARNING: Title level inconsistent: > > Global GTT Fence Handling > ~ > > reST markup error: > Documentation/gpu/i915.rst:403: (SEVERE/4) Title level inconsistent: > > I "fixed" it by changing the subsections in i915.rst, but that didn't seem > like the correct change. It turns out that a couple of i915 files create > their own subsections in kerneldoc comments using apostrophes as the > heading marker: > > Layout > '' > > That breaks the normal subsection marker ordering, and newer Sphinx is > rather more strict about enforcing that ordering. So fix the offending > comments to make Sphinx happy. > > (This is unfortunate, in that kerneldoc comments shouldn't need to be aware > of where they might be included in the heading hierarchy, but I don't see > a better way around it). > > Signed-off-by: Jonathan Corbet > --- > [If I can possibly get an ack for this, I would like to send it up soon > with the other Sphinx-related fixes.] Thanks, whatever works, Acked-by: Jani Nikula > > drivers/gpu/drm/i915/i915_reg.h | 6 +++--- > drivers/gpu/drm/i915/intel_workarounds.c | 2 +- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h > index b74824f0b5b1..249d35c12a75 100644 > --- a/drivers/gpu/drm/i915/i915_reg.h > +++ b/drivers/gpu/drm/i915/i915_reg.h > @@ -35,7 +35,7 @@ > * macros. Do **not** mass change existing definitions just to update the > style. > * > * Layout > - * '' > + * ~~ > * > * Keep helper macros near the top. For example, _PIPE() and friends. > * > @@ -79,7 +79,7 @@ > * style. Use lower case in hexadecimal values. > * > * Naming > - * '' > + * ~~ > * > * Try to name registers according to the specs. If the register name > changes in > * the specs from platform to another, stick to the original name. > @@ -97,7 +97,7 @@ > * suffix to the name. For example, ``_SKL`` or ``_GEN8``. > * > * Examples > - * > + * > * > * (Note that the values in the example are indented using spaces instead of > * TABs to avoid misalignment in generated documentation. Use TABs in the > diff --git a/drivers/gpu/drm/i915/intel_workarounds.c > b/drivers/gpu/drm/i915/intel_workarounds.c > index 9682dd575152..6decd432f4d3 100644 > --- a/drivers/gpu/drm/i915/intel_workarounds.c > +++ b/drivers/gpu/drm/i915/intel_workarounds.c > @@ -37,7 +37,7 @@ > *costly and simplifies things. We can revisit this in the future. > * > * Layout > - * '' > + * ~~ > * > * Keep things in this file ordered by WA type, as per the above (context, > GT, > * display, register whitelist, batchbuffer). Then, inside each type, keep > the -- Jani Nikula, Intel Open Source Graphics Center ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH i-g-t] benchmarks/gem_wsim: Heap allocate VLA structs
Apparently VLA structs (e.g. struct { int array[count] }) is a gcc extension that clang refuses to support as handling memory layout is too difficult for it. Move the on-stack VLA to the heap. Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin --- benchmarks/gem_wsim.c | 146 +++--- 1 file changed, 95 insertions(+), 51 deletions(-) diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c index e2ffb93a9..0a0032bff 100644 --- a/benchmarks/gem_wsim.c +++ b/benchmarks/gem_wsim.c @@ -1441,6 +1441,48 @@ set_ctx_sseu(struct ctx *ctx, uint64_t slice_mask) return slice_mask; } +static size_t sizeof_load_balance(int count) +{ + struct i915_context_engines_load_balance *ptr; + + assert(sizeof(ptr->engines[count]) == count * sizeof(ptr->engines[0])); + return sizeof(*ptr) + sizeof(ptr->engines[count]); +} + +static struct i915_context_engines_load_balance * +alloc_load_balance(int count) +{ + return calloc(1, sizeof_load_balance(count)); +} + +static size_t sizeof_param_engines(int count) +{ + struct i915_context_param_engines *ptr; + + assert(sizeof(ptr->engines[count]) == count * sizeof(ptr->engines[0])); + return sizeof(*ptr) + sizeof(ptr->engines[count]); +} + +static struct i915_context_param_engines * +alloc_param_engines(int count) +{ + return calloc(1, sizeof_param_engines(count)); +} + +static size_t sizeof_engines_bond(int count) +{ + struct i915_context_engines_bond *ptr; + + assert(sizeof(ptr->engines[count]) == count * sizeof(ptr->engines[0])); + return sizeof(*ptr) + sizeof(ptr->engines[count]); +} + +static struct i915_context_engines_bond * +alloc_engines_bond(int count) +{ + return calloc(1, sizeof_engines_bond(count)); +} + static int prepare_workload(unsigned int id, struct workload *wrk, unsigned int flags) { @@ -1676,66 +1718,54 @@ prepare_workload(unsigned int id, struct workload *wrk, unsigned int flags) } if (ctx->engine_map) { - I915_DEFINE_CONTEXT_PARAM_ENGINES(set_engines, - ctx->engine_map_count + 1); - I915_DEFINE_CONTEXT_ENGINES_LOAD_BALANCE(load_balance, - ctx->engine_map_count); + struct i915_context_param_engines *set_engines = + alloc_param_engines(ctx->engine_map_count + 1); + struct i915_context_engines_load_balance *load_balance = + alloc_load_balance(ctx->engine_map_count); struct drm_i915_gem_context_param param = { .ctx_id = ctx_id, .param = I915_CONTEXT_PARAM_ENGINES, - .size = sizeof(set_engines), - .value = to_user_pointer(&set_engines), + .size = sizeof_param_engines(ctx->engine_map_count + 1), + .value = to_user_pointer(set_engines), }; + struct i915_context_engines_bond *last = NULL; if (ctx->wants_balance) { - set_engines.extensions = - to_user_pointer(&load_balance); + set_engines->extensions = + to_user_pointer(load_balance); - memset(&load_balance, 0, sizeof(load_balance)); - load_balance.base.name = + load_balance->base.name = I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE; - load_balance.num_siblings = + load_balance->num_siblings = ctx->engine_map_count; for (j = 0; j < ctx->engine_map_count; j++) - load_balance.engines[j] = + load_balance->engines[j] = get_engine(ctx->engine_map[j]); - } else { - set_engines.extensions = 0; } /* Reserve slot for virtual engine. */ - set_engines.engines[0].engine_class = + set_engines->engines[0].engine_class = I915_ENGINE_CLASS_INVALID; - set_engines.engines[0].engine_instance = + set_engines->engines[0].engine_instance = I915_ENGINE_CLASS_INVALID_NONE; for (j = 1; j <= ctx->engine_map_count; j++) - set_engines.engines[j]
Re: [Intel-gfx] [igt-dev] [PATCH i-g-t] benchmarks/gem_wsim: Heap allocate VLA structs
On Fri, 2019-05-24 at 08:25 +0100, Chris Wilson wrote: > Apparently VLA structs (e.g. struct { int array[count] }) is a gcc > extension that clang refuses to support as handling memory layout is too > difficult for it. > > Move the on-stack VLA to the heap. IMHO using an upper bound would be much simpler. > Signed-off-by: Chris Wilson > Cc: Tvrtko Ursulin > --- > benchmarks/gem_wsim.c | 146 +++--- > 1 file changed, 95 insertions(+), 51 deletions(-) > > diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c > index e2ffb93a9..0a0032bff 100644 > --- a/benchmarks/gem_wsim.c > +++ b/benchmarks/gem_wsim.c > @@ -1441,6 +1441,48 @@ set_ctx_sseu(struct ctx *ctx, uint64_t slice_mask) > return slice_mask; > } > > +static size_t sizeof_load_balance(int count) > +{ > + struct i915_context_engines_load_balance *ptr; > + > + assert(sizeof(ptr->engines[count]) == count * sizeof(ptr->engines[0])); > + return sizeof(*ptr) + sizeof(ptr->engines[count]); > +} > + > +static struct i915_context_engines_load_balance * > +alloc_load_balance(int count) > +{ > + return calloc(1, sizeof_load_balance(count)); > +} > + > +static size_t sizeof_param_engines(int count) > +{ > + struct i915_context_param_engines *ptr; > + > + assert(sizeof(ptr->engines[count]) == count * sizeof(ptr->engines[0])); > + return sizeof(*ptr) + sizeof(ptr->engines[count]); > +} > + > +static struct i915_context_param_engines * > +alloc_param_engines(int count) > +{ > + return calloc(1, sizeof_param_engines(count)); > +} > + > +static size_t sizeof_engines_bond(int count) > +{ > + struct i915_context_engines_bond *ptr; > + > + assert(sizeof(ptr->engines[count]) == count * sizeof(ptr->engines[0])); > + return sizeof(*ptr) + sizeof(ptr->engines[count]); > +} > + > +static struct i915_context_engines_bond * > +alloc_engines_bond(int count) > +{ > + return calloc(1, sizeof_engines_bond(count)); > +} > + > static int > prepare_workload(unsigned int id, struct workload *wrk, unsigned int flags) > { > @@ -1676,66 +1718,54 @@ prepare_workload(unsigned int id, struct workload > *wrk, unsigned int flags) > } > > if (ctx->engine_map) { > - I915_DEFINE_CONTEXT_PARAM_ENGINES(set_engines, > - ctx->engine_map_count > + 1); > - I915_DEFINE_CONTEXT_ENGINES_LOAD_BALANCE(load_balance, > - > ctx->engine_map_count); > + struct i915_context_param_engines *set_engines = > + alloc_param_engines(ctx->engine_map_count + 1); > + struct i915_context_engines_load_balance *load_balance = > + alloc_load_balance(ctx->engine_map_count); > struct drm_i915_gem_context_param param = { > .ctx_id = ctx_id, > .param = I915_CONTEXT_PARAM_ENGINES, > - .size = sizeof(set_engines), > - .value = to_user_pointer(&set_engines), > + .size = > sizeof_param_engines(ctx->engine_map_count + 1), > + .value = to_user_pointer(set_engines), > }; > + struct i915_context_engines_bond *last = NULL; > > if (ctx->wants_balance) { > - set_engines.extensions = > - to_user_pointer(&load_balance); > + set_engines->extensions = > + to_user_pointer(load_balance); > > - memset(&load_balance, 0, sizeof(load_balance)); > - load_balance.base.name = > + load_balance->base.name = > I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE; > - load_balance.num_siblings = > + load_balance->num_siblings = > ctx->engine_map_count; > > for (j = 0; j < ctx->engine_map_count; j++) > - load_balance.engines[j] = > + load_balance->engines[j] = > get_engine(ctx->engine_map[j]); > - } else { > - set_engines.extensions = 0; > } > > /* Reserve slot for virtual engine. */ > - set_engines.engines[0].engine_class = > + set_engines->engines[0].engine_class = > I915_ENGINE_CLASS_INVALID; > - set_engines.engines[0].engine_instance = > + set_e
Re: [Intel-gfx] [PATCH] drm/i915/gen11: enable support for headerless msgs
Chris Wilson writes: > From: Dongwon Kim > > Setting bit5 (headerless msg for preemptable GPGPU context) of SAMPLER_MODE > register to enable support for the headless msgs on gen11. None of existing > use cases will be affected by this as this change makes both types of message > - headerless and w/ header supported at the same time. It also complies with > the new recommendation for the default bit value for the next gen. > > v2: rewrote commit message to include more information > v3: setting the bit in icl_ctx_workarounds_init() > > Signed-off-by: Dongwon Kim Reviewed-by: Mika Kuoppala > --- > Merely kicking CI. > --- > drivers/gpu/drm/i915/gt/intel_workarounds.c | 4 > drivers/gpu/drm/i915/i915_reg.h | 1 + > 2 files changed, 5 insertions(+) > > diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c > b/drivers/gpu/drm/i915/gt/intel_workarounds.c > index 364696221fd7..e03181aeb451 100644 > --- a/drivers/gpu/drm/i915/gt/intel_workarounds.c > +++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c > @@ -575,6 +575,10 @@ static void icl_ctx_workarounds_init(struct > intel_engine_cs *engine) > WA_SET_FIELD_MASKED(GEN8_CS_CHICKEN1, > GEN9_PREEMPT_GPGPU_LEVEL_MASK, > GEN9_PREEMPT_GPGPU_THREAD_GROUP_LEVEL); > + > + /* allow headerless messages for preemptable GPGPU context */ > + WA_SET_BIT_MASKED(GEN10_SAMPLER_MODE, > + GEN11_SAMPLER_ENABLE_HEADLESS_MSG); > } > > void intel_engine_init_ctx_wa(struct intel_engine_cs *engine) > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h > index b74824f0b5b1..b45042f71c0a 100644 > --- a/drivers/gpu/drm/i915/i915_reg.h > +++ b/drivers/gpu/drm/i915/i915_reg.h > @@ -8862,6 +8862,7 @@ enum { > #define GEN11_LSN_UNSLCVC_GAFS_HALF_SF_MAXALLOC(1 << 7) > > #define GEN10_SAMPLER_MODE _MMIO(0xE18C) > +#define GEN11_SAMPLER_ENABLE_HEADLESS_MSG (1 << 5) > > /* IVYBRIDGE DPF */ > #define GEN7_L3CDERRST1(slice) _MMIO(0xB008 + (slice) * 0x200) > /* L3CD Error Status 1 */ > -- > 2.20.1 > > ___ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gfx ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [BrownBag] drm/i915/gtt: Neuter the deferred unbind callback from gen6_ppgtt_cleanup
On 24/05/2019 07:45, Chris Wilson wrote: Having deferred the vma destruction to a worker where we can acquire the struct_mutex, we have to avoid chasing back into the now destroyed ppgtt. The pd_vma is special in having a custom unbind function to scan for unused pages despite the VMA itself being notionally part of the GGTT. As such, we need to disable that callback to avoid a use-after-free. This unfortunately blew up so early during boot that CI declared the machine unreachable as opposed to being the major failure it was. Oops. Fixes: d3622099c76f ("drm/i915/gtt: Always acquire struct_mutex for gen6_ppgtt_cleanup") Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin Cc: Tomi Sarvela --- drivers/gpu/drm/i915/i915_gem_gtt.c | 28 1 file changed, 28 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 8d8a4b0ad4d9..266baa11df64 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c @@ -1847,6 +1847,33 @@ static void gen6_ppgtt_cleanup_work(struct work_struct *wrk) kfree(work); } +static int nop_set_pages(struct i915_vma *vma) +{ + return -ENODEV; +} + +static void nop_clear_pages(struct i915_vma *vma) +{ +} + +static int nop_bind(struct i915_vma *vma, + enum i915_cache_level cache_level, + u32 unused) +{ + return -ENODEV; +} + +static void nop_unbind(struct i915_vma *vma) +{ +} + +static const struct i915_vma_ops nop_vma_ops = { + .set_pages = nop_set_pages, + .clear_pages = nop_clear_pages, + .bind_vma = nop_bind, + .unbind_vma = nop_unbind, +}; + static void gen6_ppgtt_cleanup(struct i915_address_space *vm) { struct gen6_hw_ppgtt *ppgtt = to_gen6_ppgtt(i915_vm_to_ppgtt(vm)); @@ -1855,6 +1882,7 @@ static void gen6_ppgtt_cleanup(struct i915_address_space *vm) /* FIXME remove the struct_mutex to bring the locking under control */ INIT_WORK(&work->base, gen6_ppgtt_cleanup_work); work->vma = ppgtt->vma; + work->vma->ops = &nop_vma_ops; Could we use some asserts before overriding the vma ops? Like GEM_BUG_ON(vma->pages)? And something for still bound? schedule_work(&work->base); gen6_ppgtt_free_pd(ppgtt); Regards, Tvrtko ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [BrownBag] drm/i915/gtt: Neuter the deferred unbind callback from gen6_ppgtt_cleanup
Quoting Tvrtko Ursulin (2019-05-24 09:13:14) > > On 24/05/2019 07:45, Chris Wilson wrote: > > Having deferred the vma destruction to a worker where we can acquire the > > struct_mutex, we have to avoid chasing back into the now destroyed > > ppgtt. The pd_vma is special in having a custom unbind function to scan > > for unused pages despite the VMA itself being notionally part of the > > GGTT. As such, we need to disable that callback to avoid a > > use-after-free. > > > > This unfortunately blew up so early during boot that CI declared the > > machine unreachable as opposed to being the major failure it was. Oops. > > > > Fixes: d3622099c76f ("drm/i915/gtt: Always acquire struct_mutex for > > gen6_ppgtt_cleanup") > > Signed-off-by: Chris Wilson > > Cc: Tvrtko Ursulin > > Cc: Tomi Sarvela > > --- > > drivers/gpu/drm/i915/i915_gem_gtt.c | 28 > > 1 file changed, 28 insertions(+) > > > > diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c > > b/drivers/gpu/drm/i915/i915_gem_gtt.c > > index 8d8a4b0ad4d9..266baa11df64 100644 > > --- a/drivers/gpu/drm/i915/i915_gem_gtt.c > > +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c > > @@ -1847,6 +1847,33 @@ static void gen6_ppgtt_cleanup_work(struct > > work_struct *wrk) > > kfree(work); > > } > > > > +static int nop_set_pages(struct i915_vma *vma) > > +{ > > + return -ENODEV; > > +} > > + > > +static void nop_clear_pages(struct i915_vma *vma) > > +{ > > +} > > + > > +static int nop_bind(struct i915_vma *vma, > > + enum i915_cache_level cache_level, > > + u32 unused) > > +{ > > + return -ENODEV; > > +} > > + > > +static void nop_unbind(struct i915_vma *vma) > > +{ > > +} > > + > > +static const struct i915_vma_ops nop_vma_ops = { > > + .set_pages = nop_set_pages, > > + .clear_pages = nop_clear_pages, > > + .bind_vma = nop_bind, > > + .unbind_vma = nop_unbind, > > +}; > > + > > static void gen6_ppgtt_cleanup(struct i915_address_space *vm) > > { > > struct gen6_hw_ppgtt *ppgtt = to_gen6_ppgtt(i915_vm_to_ppgtt(vm)); > > @@ -1855,6 +1882,7 @@ static void gen6_ppgtt_cleanup(struct > > i915_address_space *vm) > > /* FIXME remove the struct_mutex to bring the locking under control */ > > INIT_WORK(&work->base, gen6_ppgtt_cleanup_work); > > work->vma = ppgtt->vma; > > + work->vma->ops = &nop_vma_ops; > > Could we use some asserts before overriding the vma ops? Like > GEM_BUG_ON(vma->pages)? And something for still bound? It technically still is bound as it is in the GGTT but currently unpinned -- that will be checked on destroy, it's just we also get an unbind callback. vma->pages doesn't exist for this (set to ERR_PTR). -Chris ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH i-g-t] benchmarks/gem_wsim: Heap allocate VLA structs
On 24/05/2019 08:25, Chris Wilson wrote: Apparently VLA structs (e.g. struct { int array[count] }) is a gcc extension that clang refuses to support as handling memory layout is too difficult for it. Move the on-stack VLA to the heap. Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin --- benchmarks/gem_wsim.c | 146 +++--- 1 file changed, 95 insertions(+), 51 deletions(-) diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c index e2ffb93a9..0a0032bff 100644 --- a/benchmarks/gem_wsim.c +++ b/benchmarks/gem_wsim.c @@ -1441,6 +1441,48 @@ set_ctx_sseu(struct ctx *ctx, uint64_t slice_mask) return slice_mask; } +static size_t sizeof_load_balance(int count) +{ + struct i915_context_engines_load_balance *ptr; + + assert(sizeof(ptr->engines[count]) == count * sizeof(ptr->engines[0])); This seems wrong - is bound to trigger. + return sizeof(*ptr) + sizeof(ptr->engines[count]); So size of of engine needs to be multiplied by count. +} + +static struct i915_context_engines_load_balance * +alloc_load_balance(int count) +{ + return calloc(1, sizeof_load_balance(count)); How about alloca so cleanup is simpler? Or is alloca also on the unpopular list? Or possibly what Simon suggested, just a large temporary stack arrays would be enough and easiest diff. Just with an assert that it fits. I can do that if you want? Regards, Tvrtko +} + +static size_t sizeof_param_engines(int count) +{ + struct i915_context_param_engines *ptr; + + assert(sizeof(ptr->engines[count]) == count * sizeof(ptr->engines[0])); + return sizeof(*ptr) + sizeof(ptr->engines[count]); +} + +static struct i915_context_param_engines * +alloc_param_engines(int count) +{ + return calloc(1, sizeof_param_engines(count)); +} + +static size_t sizeof_engines_bond(int count) +{ + struct i915_context_engines_bond *ptr; + + assert(sizeof(ptr->engines[count]) == count * sizeof(ptr->engines[0])); + return sizeof(*ptr) + sizeof(ptr->engines[count]); +} + +static struct i915_context_engines_bond * +alloc_engines_bond(int count) +{ + return calloc(1, sizeof_engines_bond(count)); +} + static int prepare_workload(unsigned int id, struct workload *wrk, unsigned int flags) { @@ -1676,66 +1718,54 @@ prepare_workload(unsigned int id, struct workload *wrk, unsigned int flags) } if (ctx->engine_map) { - I915_DEFINE_CONTEXT_PARAM_ENGINES(set_engines, - ctx->engine_map_count + 1); - I915_DEFINE_CONTEXT_ENGINES_LOAD_BALANCE(load_balance, - ctx->engine_map_count); + struct i915_context_param_engines *set_engines = + alloc_param_engines(ctx->engine_map_count + 1); + struct i915_context_engines_load_balance *load_balance = + alloc_load_balance(ctx->engine_map_count); struct drm_i915_gem_context_param param = { .ctx_id = ctx_id, .param = I915_CONTEXT_PARAM_ENGINES, - .size = sizeof(set_engines), - .value = to_user_pointer(&set_engines), + .size = sizeof_param_engines(ctx->engine_map_count + 1), + .value = to_user_pointer(set_engines), }; + struct i915_context_engines_bond *last = NULL; if (ctx->wants_balance) { - set_engines.extensions = - to_user_pointer(&load_balance); + set_engines->extensions = + to_user_pointer(load_balance); -memset(&load_balance, 0, sizeof(load_balance)); - load_balance.base.name = + load_balance->base.name = I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE; - load_balance.num_siblings = + load_balance->num_siblings = ctx->engine_map_count; for (j = 0; j < ctx->engine_map_count; j++) - load_balance.engines[j] = + load_balance->engines[j] = get_engine(ctx->engine_map[j]); - } else { - set_engines.extensions = 0; } /* Reserve slot for virtual engine. */ - set_engines.engines[0].engine_class = + set_engines->engines[0].engine_class = I915_ENGINE_C
Re: [Intel-gfx] [BrownBag] drm/i915/gtt: Neuter the deferred unbind callback from gen6_ppgtt_cleanup
On 24/05/2019 09:17, Chris Wilson wrote: Quoting Tvrtko Ursulin (2019-05-24 09:13:14) On 24/05/2019 07:45, Chris Wilson wrote: Having deferred the vma destruction to a worker where we can acquire the struct_mutex, we have to avoid chasing back into the now destroyed ppgtt. The pd_vma is special in having a custom unbind function to scan for unused pages despite the VMA itself being notionally part of the GGTT. As such, we need to disable that callback to avoid a use-after-free. This unfortunately blew up so early during boot that CI declared the machine unreachable as opposed to being the major failure it was. Oops. Fixes: d3622099c76f ("drm/i915/gtt: Always acquire struct_mutex for gen6_ppgtt_cleanup") Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin Cc: Tomi Sarvela --- drivers/gpu/drm/i915/i915_gem_gtt.c | 28 1 file changed, 28 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 8d8a4b0ad4d9..266baa11df64 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c @@ -1847,6 +1847,33 @@ static void gen6_ppgtt_cleanup_work(struct work_struct *wrk) kfree(work); } +static int nop_set_pages(struct i915_vma *vma) +{ + return -ENODEV; +} + +static void nop_clear_pages(struct i915_vma *vma) +{ +} + +static int nop_bind(struct i915_vma *vma, + enum i915_cache_level cache_level, + u32 unused) +{ + return -ENODEV; +} + +static void nop_unbind(struct i915_vma *vma) +{ +} + +static const struct i915_vma_ops nop_vma_ops = { + .set_pages = nop_set_pages, + .clear_pages = nop_clear_pages, + .bind_vma = nop_bind, + .unbind_vma = nop_unbind, +}; + static void gen6_ppgtt_cleanup(struct i915_address_space *vm) { struct gen6_hw_ppgtt *ppgtt = to_gen6_ppgtt(i915_vm_to_ppgtt(vm)); @@ -1855,6 +1882,7 @@ static void gen6_ppgtt_cleanup(struct i915_address_space *vm) /* FIXME remove the struct_mutex to bring the locking under control */ INIT_WORK(&work->base, gen6_ppgtt_cleanup_work); work->vma = ppgtt->vma; + work->vma->ops = &nop_vma_ops; Could we use some asserts before overriding the vma ops? Like GEM_BUG_ON(vma->pages)? And something for still bound? It technically still is bound as it is in the GGTT but currently unpinned -- that will be checked on destroy, it's just we also get an unbind callback. vma->pages doesn't exist for this (set to ERR_PTR). If we are getting the unbind callback and we nop-ed it, who will actually do it's job? Regards, Tvrtko ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [igt-dev] [PATCH i-g-t] benchmarks/gem_wsim: Heap allocate VLA structs
On Fri, 2019-05-24 at 09:20 +0100, Tvrtko Ursulin wrote: > On 24/05/2019 08:25, Chris Wilson wrote: > > Apparently VLA structs (e.g. struct { int array[count] }) is a gcc > > extension that clang refuses to support as handling memory layout is too > > difficult for it. > > > > Move the on-stack VLA to the heap. > > > > Signed-off-by: Chris Wilson > > Cc: Tvrtko Ursulin > > --- > > benchmarks/gem_wsim.c | 146 +++--- > > 1 file changed, 95 insertions(+), 51 deletions(-) > > > > diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c > > index e2ffb93a9..0a0032bff 100644 > > --- a/benchmarks/gem_wsim.c > > +++ b/benchmarks/gem_wsim.c > > @@ -1441,6 +1441,48 @@ set_ctx_sseu(struct ctx *ctx, uint64_t slice_mask) > > return slice_mask; > > } > > > > +static size_t sizeof_load_balance(int count) > > +{ > > + struct i915_context_engines_load_balance *ptr; > > + > > + assert(sizeof(ptr->engines[count]) == count * sizeof(ptr->engines[0])); > > This seems wrong - is bound to trigger. > > > + return sizeof(*ptr) + sizeof(ptr->engines[count]); > > So size of of engine needs to be multiplied by count. > > > +} > > + > > +static struct i915_context_engines_load_balance * > > +alloc_load_balance(int count) > > +{ > > + return calloc(1, sizeof_load_balance(count)); > > How about alloca so cleanup is simpler? Or is alloca also on the > unpopular list? > > Or possibly what Simon suggested, just a large temporary stack arrays > would be enough and easiest diff. Just with an assert that it fits. > > I can do that if you want? I think Arek already has a patch for this. > Regards, > > Tvrtko > > > +} > > + > > +static size_t sizeof_param_engines(int count) > > +{ > > + struct i915_context_param_engines *ptr; > > + > > + assert(sizeof(ptr->engines[count]) == count * sizeof(ptr->engines[0])); > > + return sizeof(*ptr) + sizeof(ptr->engines[count]); > > +} > > + > > +static struct i915_context_param_engines * > > +alloc_param_engines(int count) > > +{ > > + return calloc(1, sizeof_param_engines(count)); > > +} > > + > > +static size_t sizeof_engines_bond(int count) > > +{ > > + struct i915_context_engines_bond *ptr; > > + > > + assert(sizeof(ptr->engines[count]) == count * sizeof(ptr->engines[0])); > > + return sizeof(*ptr) + sizeof(ptr->engines[count]); > > +} > > + > > +static struct i915_context_engines_bond * > > +alloc_engines_bond(int count) > > +{ > > + return calloc(1, sizeof_engines_bond(count)); > > +} > > + > > static int > > prepare_workload(unsigned int id, struct workload *wrk, unsigned int > > flags) > > { > > @@ -1676,66 +1718,54 @@ prepare_workload(unsigned int id, struct workload > > *wrk, unsigned int flags) > > } > > > > if (ctx->engine_map) { > > - I915_DEFINE_CONTEXT_PARAM_ENGINES(set_engines, > > - ctx->engine_map_count > > + 1); > > - I915_DEFINE_CONTEXT_ENGINES_LOAD_BALANCE(load_balance, > > - > > ctx->engine_map_count); > > + struct i915_context_param_engines *set_engines = > > + alloc_param_engines(ctx->engine_map_count + 1); > > + struct i915_context_engines_load_balance *load_balance = > > + alloc_load_balance(ctx->engine_map_count); > > struct drm_i915_gem_context_param param = { > > .ctx_id = ctx_id, > > .param = I915_CONTEXT_PARAM_ENGINES, > > - .size = sizeof(set_engines), > > - .value = to_user_pointer(&set_engines), > > + .size = > > sizeof_param_engines(ctx->engine_map_count + 1), > > + .value = to_user_pointer(set_engines), > > }; > > + struct i915_context_engines_bond *last = NULL; > > > > if (ctx->wants_balance) { > > - set_engines.extensions = > > - to_user_pointer(&load_balance); > > + set_engines->extensions = > > + to_user_pointer(load_balance); > > > > - memset(&load_balance, 0, sizeof(load_balance)); > > - load_balance.base.name = > > + load_balance->base.name = > > I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE; > > - load_balance.num_siblings = > > + load_balance->num_siblings = > > ctx->engine_map_count; > > > > for (j = 0; j < ctx->engine_map_count; j++) > > - load_balance.engines[j] = > > +
Re: [Intel-gfx] [BrownBag] drm/i915/gtt: Neuter the deferred unbind callback from gen6_ppgtt_cleanup
Quoting Tvrtko Ursulin (2019-05-24 09:23:40) > > On 24/05/2019 09:17, Chris Wilson wrote: > > Quoting Tvrtko Ursulin (2019-05-24 09:13:14) > >> > >> On 24/05/2019 07:45, Chris Wilson wrote: > >>> Having deferred the vma destruction to a worker where we can acquire the > >>> struct_mutex, we have to avoid chasing back into the now destroyed > >>> ppgtt. The pd_vma is special in having a custom unbind function to scan > >>> for unused pages despite the VMA itself being notionally part of the > >>> GGTT. As such, we need to disable that callback to avoid a > >>> use-after-free. > >>> > >>> This unfortunately blew up so early during boot that CI declared the > >>> machine unreachable as opposed to being the major failure it was. Oops. > >>> > >>> Fixes: d3622099c76f ("drm/i915/gtt: Always acquire struct_mutex for > >>> gen6_ppgtt_cleanup") > >>> Signed-off-by: Chris Wilson > >>> Cc: Tvrtko Ursulin > >>> Cc: Tomi Sarvela > >>> --- > >>>drivers/gpu/drm/i915/i915_gem_gtt.c | 28 > >>>1 file changed, 28 insertions(+) > >>> > >>> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c > >>> b/drivers/gpu/drm/i915/i915_gem_gtt.c > >>> index 8d8a4b0ad4d9..266baa11df64 100644 > >>> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c > >>> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c > >>> @@ -1847,6 +1847,33 @@ static void gen6_ppgtt_cleanup_work(struct > >>> work_struct *wrk) > >>>kfree(work); > >>>} > >>> > >>> +static int nop_set_pages(struct i915_vma *vma) > >>> +{ > >>> + return -ENODEV; > >>> +} > >>> + > >>> +static void nop_clear_pages(struct i915_vma *vma) > >>> +{ > >>> +} > >>> + > >>> +static int nop_bind(struct i915_vma *vma, > >>> + enum i915_cache_level cache_level, > >>> + u32 unused) > >>> +{ > >>> + return -ENODEV; > >>> +} > >>> + > >>> +static void nop_unbind(struct i915_vma *vma) > >>> +{ > >>> +} > >>> + > >>> +static const struct i915_vma_ops nop_vma_ops = { > >>> + .set_pages = nop_set_pages, > >>> + .clear_pages = nop_clear_pages, > >>> + .bind_vma = nop_bind, > >>> + .unbind_vma = nop_unbind, > >>> +}; > >>> + > >>>static void gen6_ppgtt_cleanup(struct i915_address_space *vm) > >>>{ > >>>struct gen6_hw_ppgtt *ppgtt = to_gen6_ppgtt(i915_vm_to_ppgtt(vm)); > >>> @@ -1855,6 +1882,7 @@ static void gen6_ppgtt_cleanup(struct > >>> i915_address_space *vm) > >>>/* FIXME remove the struct_mutex to bring the locking under > >>> control */ > >>>INIT_WORK(&work->base, gen6_ppgtt_cleanup_work); > >>>work->vma = ppgtt->vma; > >>> + work->vma->ops = &nop_vma_ops; > >> > >> Could we use some asserts before overriding the vma ops? Like > >> GEM_BUG_ON(vma->pages)? And something for still bound? > > > > It technically still is bound as it is in the GGTT but currently > > unpinned -- that will be checked on destroy, it's just we also get an > > unbind callback. vma->pages doesn't exist for this (set to ERR_PTR). > > If we are getting the unbind callback and we nop-ed it, who will > actually do it's job? The callback is just a hook for us to prune within the ppgtt. It still is removed from GGTT by i915_vma_unbind(). -Chris ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/gtt: Neuter the deferred unbind callback from gen6_ppgtt_cleanup
== Series Details == Series: drm/i915/gtt: Neuter the deferred unbind callback from gen6_ppgtt_cleanup URL : https://patchwork.freedesktop.org/series/61084/ State : failure == Summary == CI Bug Log - changes from CI_DRM_6138 -> Patchwork_13087 Summary --- **FAILURE** Serious unknown changes coming with Patchwork_13087 absolutely need to be verified manually. If you think the reported changes have nothing to do with the changes introduced in Patchwork_13087, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI. External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13087/ Possible new issues --- Here are the unknown changes that may have been introduced in Patchwork_13087: ### IGT changes ### Possible regressions * igt@i915_module_load@reload: - fi-apl-guc: NOTRUN -> [DMESG-WARN][1] [1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13087/fi-apl-guc/igt@i915_module_l...@reload.html * igt@runner@aborted: - fi-apl-guc: NOTRUN -> [FAIL][2] [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13087/fi-apl-guc/igt@run...@aborted.html Known issues Here are the changes found in Patchwork_13087 that come from known issues: ### IGT changes ### Issues hit * igt@gem_exec_suspend@basic-s4-devices: - fi-blb-e6850: [PASS][3] -> [INCOMPLETE][4] ([fdo#107718]) [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6138/fi-blb-e6850/igt@gem_exec_susp...@basic-s4-devices.html [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13087/fi-blb-e6850/igt@gem_exec_susp...@basic-s4-devices.html * igt@i915_pm_rpm@module-reload: - fi-skl-6770hq: [PASS][5] -> [FAIL][6] ([fdo#108511]) [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6138/fi-skl-6770hq/igt@i915_pm_...@module-reload.html [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13087/fi-skl-6770hq/igt@i915_pm_...@module-reload.html * igt@kms_flip@basic-flip-vs-dpms: - fi-bxt-dsi: [PASS][7] -> [INCOMPLETE][8] ([fdo#103927]) [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6138/fi-bxt-dsi/igt@kms_f...@basic-flip-vs-dpms.html [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13087/fi-bxt-dsi/igt@kms_f...@basic-flip-vs-dpms.html Possible fixes * {igt@gem_busy@busy-all}: - {fi-icl-y}: [INCOMPLETE][9] ([fdo#107713]) -> [PASS][10] [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6138/fi-icl-y/igt@gem_b...@busy-all.html [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13087/fi-icl-y/igt@gem_b...@busy-all.html * igt@gem_ctx_create@basic-files: - {fi-icl-u2}:[INCOMPLETE][11] ([fdo#107713] / [fdo#109100]) -> [PASS][12] [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6138/fi-icl-u2/igt@gem_ctx_cre...@basic-files.html [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13087/fi-icl-u2/igt@gem_ctx_cre...@basic-files.html * igt@i915_selftest@live_contexts: - fi-skl-gvtdvm: [DMESG-FAIL][13] ([fdo#110235]) -> [PASS][14] [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6138/fi-skl-gvtdvm/igt@i915_selftest@live_contexts.html [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13087/fi-skl-gvtdvm/igt@i915_selftest@live_contexts.html * igt@i915_selftest@live_hangcheck: - {fi-icl-u3}:[INCOMPLETE][15] ([fdo#107713] / [fdo#108569]) -> [PASS][16] [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6138/fi-icl-u3/igt@i915_selftest@live_hangcheck.html [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13087/fi-icl-u3/igt@i915_selftest@live_hangcheck.html * {igt@i915_selftest@live_reset}: - fi-skl-iommu: [INCOMPLETE][17] -> [PASS][18] [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6138/fi-skl-iommu/igt@i915_selftest@live_reset.html [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13087/fi-skl-iommu/igt@i915_selftest@live_reset.html * igt@kms_frontbuffer_tracking@basic: - {fi-icl-u3}:[FAIL][19] ([fdo#103167]) -> [PASS][20] [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6138/fi-icl-u3/igt@kms_frontbuffer_track...@basic.html [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13087/fi-icl-u3/igt@kms_frontbuffer_track...@basic.html * igt@prime_vgem@basic-sync-default: - fi-pnv-d510:[INCOMPLETE][21] ([fdo#110740]) -> [PASS][22] [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6138/fi-pnv-d510/igt@prime_v...@basic-sync-default.html [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13087/fi-pnv-d510/igt@prime_v...@basic-sync-default.html {name}: This element is suppressed. This means it is ignored when computing the status of the difference (SUCCESS, WARNING, or FAILURE). [fdo#103167]: https://bugs.f
Re: [Intel-gfx] [BrownBag] drm/i915/gtt: Neuter the deferred unbind callback from gen6_ppgtt_cleanup
On 24/05/2019 09:29, Chris Wilson wrote: Quoting Tvrtko Ursulin (2019-05-24 09:23:40) On 24/05/2019 09:17, Chris Wilson wrote: Quoting Tvrtko Ursulin (2019-05-24 09:13:14) On 24/05/2019 07:45, Chris Wilson wrote: Having deferred the vma destruction to a worker where we can acquire the struct_mutex, we have to avoid chasing back into the now destroyed ppgtt. The pd_vma is special in having a custom unbind function to scan for unused pages despite the VMA itself being notionally part of the GGTT. As such, we need to disable that callback to avoid a use-after-free. This unfortunately blew up so early during boot that CI declared the machine unreachable as opposed to being the major failure it was. Oops. Fixes: d3622099c76f ("drm/i915/gtt: Always acquire struct_mutex for gen6_ppgtt_cleanup") Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin Cc: Tomi Sarvela --- drivers/gpu/drm/i915/i915_gem_gtt.c | 28 1 file changed, 28 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 8d8a4b0ad4d9..266baa11df64 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c @@ -1847,6 +1847,33 @@ static void gen6_ppgtt_cleanup_work(struct work_struct *wrk) kfree(work); } +static int nop_set_pages(struct i915_vma *vma) +{ + return -ENODEV; +} + +static void nop_clear_pages(struct i915_vma *vma) +{ +} + +static int nop_bind(struct i915_vma *vma, + enum i915_cache_level cache_level, + u32 unused) +{ + return -ENODEV; +} + +static void nop_unbind(struct i915_vma *vma) +{ +} + +static const struct i915_vma_ops nop_vma_ops = { + .set_pages = nop_set_pages, + .clear_pages = nop_clear_pages, + .bind_vma = nop_bind, + .unbind_vma = nop_unbind, +}; + static void gen6_ppgtt_cleanup(struct i915_address_space *vm) { struct gen6_hw_ppgtt *ppgtt = to_gen6_ppgtt(i915_vm_to_ppgtt(vm)); @@ -1855,6 +1882,7 @@ static void gen6_ppgtt_cleanup(struct i915_address_space *vm) /* FIXME remove the struct_mutex to bring the locking under control */ INIT_WORK(&work->base, gen6_ppgtt_cleanup_work); work->vma = ppgtt->vma; + work->vma->ops = &nop_vma_ops; Could we use some asserts before overriding the vma ops? Like GEM_BUG_ON(vma->pages)? And something for still bound? It technically still is bound as it is in the GGTT but currently unpinned -- that will be checked on destroy, it's just we also get an unbind callback. vma->pages doesn't exist for this (set to ERR_PTR). If we are getting the unbind callback and we nop-ed it, who will actually do it's job? The callback is just a hook for us to prune within the ppgtt. It still is removed from GGTT by i915_vma_unbind(). So it needs GEM_BUG_ON(ppgtt->scan_for_unused_pt) before overriding the unbind? Regards, Tvrtko ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH i-g-t] benchmarks/gem_wsim: Heap allocate VLA structs
Quoting Tvrtko Ursulin (2019-05-24 09:20:47) > > On 24/05/2019 08:25, Chris Wilson wrote: > > Apparently VLA structs (e.g. struct { int array[count] }) is a gcc > > extension that clang refuses to support as handling memory layout is too > > difficult for it. > > > > Move the on-stack VLA to the heap. > > > > Signed-off-by: Chris Wilson > > Cc: Tvrtko Ursulin > > --- > > benchmarks/gem_wsim.c | 146 +++--- > > 1 file changed, 95 insertions(+), 51 deletions(-) > > > > diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c > > index e2ffb93a9..0a0032bff 100644 > > --- a/benchmarks/gem_wsim.c > > +++ b/benchmarks/gem_wsim.c > > @@ -1441,6 +1441,48 @@ set_ctx_sseu(struct ctx *ctx, uint64_t slice_mask) > > return slice_mask; > > } > > > > +static size_t sizeof_load_balance(int count) > > +{ > > + struct i915_context_engines_load_balance *ptr; > > + > > + assert(sizeof(ptr->engines[count]) == count * > > sizeof(ptr->engines[0])); > > This seems wrong - is bound to trigger. Why does it seem wrong? That's the calculation used previously, and the ptr->engines[] was meant to be packed in order for sizeof(ptr->engines[count]) == count * sizeof(ptr->engines[0]). Anyway, I threw it in there to check if the calculation was sane. > > + return sizeof(*ptr) + sizeof(ptr->engines[count]); > > So size of of engine needs to be multiplied by count. (Just note this is the what the current VLA evaluates to :) > > +} > > + > > +static struct i915_context_engines_load_balance * > > +alloc_load_balance(int count) > > +{ > > + return calloc(1, sizeof_load_balance(count)); > > How about alloca so cleanup is simpler? Or is alloca also on the > unpopular list? I don't mind. Would shave a few lines indeed, but we need the memsets back. #define alloca0()? > Or possibly what Simon suggested, just a large temporary stack arrays > would be enough and easiest diff. Just with an assert that it fits. I don't think that is as clean for the long term. -Chris ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [BrownBag] drm/i915/gtt: Neuter the deferred unbind callback from gen6_ppgtt_cleanup
Quoting Tvrtko Ursulin (2019-05-24 09:31:45) > > On 24/05/2019 09:29, Chris Wilson wrote: > > Quoting Tvrtko Ursulin (2019-05-24 09:23:40) > >> > >> On 24/05/2019 09:17, Chris Wilson wrote: > >>> Quoting Tvrtko Ursulin (2019-05-24 09:13:14) > > On 24/05/2019 07:45, Chris Wilson wrote: > > Having deferred the vma destruction to a worker where we can acquire the > > struct_mutex, we have to avoid chasing back into the now destroyed > > ppgtt. The pd_vma is special in having a custom unbind function to scan > > for unused pages despite the VMA itself being notionally part of the > > GGTT. As such, we need to disable that callback to avoid a > > use-after-free. > > > > This unfortunately blew up so early during boot that CI declared the > > machine unreachable as opposed to being the major failure it was. Oops. > > > > Fixes: d3622099c76f ("drm/i915/gtt: Always acquire struct_mutex for > > gen6_ppgtt_cleanup") > > Signed-off-by: Chris Wilson > > Cc: Tvrtko Ursulin > > Cc: Tomi Sarvela > > --- > > drivers/gpu/drm/i915/i915_gem_gtt.c | 28 > > > > 1 file changed, 28 insertions(+) > > > > diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c > > b/drivers/gpu/drm/i915/i915_gem_gtt.c > > index 8d8a4b0ad4d9..266baa11df64 100644 > > --- a/drivers/gpu/drm/i915/i915_gem_gtt.c > > +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c > > @@ -1847,6 +1847,33 @@ static void gen6_ppgtt_cleanup_work(struct > > work_struct *wrk) > > kfree(work); > > } > > > > +static int nop_set_pages(struct i915_vma *vma) > > +{ > > + return -ENODEV; > > +} > > + > > +static void nop_clear_pages(struct i915_vma *vma) > > +{ > > +} > > + > > +static int nop_bind(struct i915_vma *vma, > > + enum i915_cache_level cache_level, > > + u32 unused) > > +{ > > + return -ENODEV; > > +} > > + > > +static void nop_unbind(struct i915_vma *vma) > > +{ > > +} > > + > > +static const struct i915_vma_ops nop_vma_ops = { > > + .set_pages = nop_set_pages, > > + .clear_pages = nop_clear_pages, > > + .bind_vma = nop_bind, > > + .unbind_vma = nop_unbind, > > +}; > > + > > static void gen6_ppgtt_cleanup(struct i915_address_space *vm) > > { > > struct gen6_hw_ppgtt *ppgtt = > > to_gen6_ppgtt(i915_vm_to_ppgtt(vm)); > > @@ -1855,6 +1882,7 @@ static void gen6_ppgtt_cleanup(struct > > i915_address_space *vm) > > /* FIXME remove the struct_mutex to bring the locking under > > control */ > > INIT_WORK(&work->base, gen6_ppgtt_cleanup_work); > > work->vma = ppgtt->vma; > > + work->vma->ops = &nop_vma_ops; > > Could we use some asserts before overriding the vma ops? Like > GEM_BUG_ON(vma->pages)? And something for still bound? > >>> > >>> It technically still is bound as it is in the GGTT but currently > >>> unpinned -- that will be checked on destroy, it's just we also get an > >>> unbind callback. vma->pages doesn't exist for this (set to ERR_PTR). > >> > >> If we are getting the unbind callback and we nop-ed it, who will > >> actually do it's job? > > > > The callback is just a hook for us to prune within the ppgtt. > > It still is removed from GGTT by i915_vma_unbind(). > > So it needs GEM_BUG_ON(ppgtt->scan_for_unused_pt) before overriding the > unbind? No. They get freed by the cleanup itself. The scan is just an opportunistic prune if either the context/mm is evicted but still alive. -Chris ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [igt-dev] [PATCH i-g-t] benchmarks/gem_wsim: Heap allocate VLA structs
On Fri, 2019-05-24 at 09:33 +0100, Chris Wilson wrote: > Quoting Tvrtko Ursulin (2019-05-24 09:20:47) > > On 24/05/2019 08:25, Chris Wilson wrote: > > > Apparently VLA structs (e.g. struct { int array[count] }) is a gcc > > > extension that clang refuses to support as handling memory layout is too > > > difficult for it. > > > > > > Move the on-stack VLA to the heap. > > > > > > Signed-off-by: Chris Wilson > > > Cc: Tvrtko Ursulin > > > --- > > > benchmarks/gem_wsim.c | 146 +++--- > > > 1 file changed, 95 insertions(+), 51 deletions(-) > > > > > > diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c > > > index e2ffb93a9..0a0032bff 100644 > > > --- a/benchmarks/gem_wsim.c > > > +++ b/benchmarks/gem_wsim.c > > > @@ -1441,6 +1441,48 @@ set_ctx_sseu(struct ctx *ctx, uint64_t slice_mask) > > > return slice_mask; > > > } > > > > > > +static size_t sizeof_load_balance(int count) > > > +{ > > > + struct i915_context_engines_load_balance *ptr; > > > + > > > + assert(sizeof(ptr->engines[count]) == count * > > > sizeof(ptr->engines[0])); > > > > This seems wrong - is bound to trigger. > > Why does it seem wrong? That's the calculation used previously, and the > ptr->engines[] was meant to be packed in order for > sizeof(ptr->engines[count]) == count * sizeof(ptr->engines[0]). Anyway, > I threw it in there to check if the calculation was sane. > > > > + return sizeof(*ptr) + sizeof(ptr->engines[count]); > > > > So size of of engine needs to be multiplied by count. > > (Just note this is the what the current VLA evaluates to :) > > > > +} > > > + > > > +static struct i915_context_engines_load_balance * > > > +alloc_load_balance(int count) > > > +{ > > > + return calloc(1, sizeof_load_balance(count)); > > > > How about alloca so cleanup is simpler? Or is alloca also on the > > unpopular list? > > I don't mind. Would shave a few lines indeed, but we need the memsets > back. #define alloca0()? > > > Or possibly what Simon suggested, just a large temporary stack arrays > > would be enough and easiest diff. Just with an assert that it fits. > > I don't think that is as clean for the long term. I don't understand the motivation here. Can you elaborate? ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH i-g-t] benchmarks/gem_wsim: Heap allocate VLA structs
On 24/05/2019 09:33, Chris Wilson wrote: Quoting Tvrtko Ursulin (2019-05-24 09:20:47) On 24/05/2019 08:25, Chris Wilson wrote: Apparently VLA structs (e.g. struct { int array[count] }) is a gcc extension that clang refuses to support as handling memory layout is too difficult for it. Move the on-stack VLA to the heap. Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin --- benchmarks/gem_wsim.c | 146 +++--- 1 file changed, 95 insertions(+), 51 deletions(-) diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c index e2ffb93a9..0a0032bff 100644 --- a/benchmarks/gem_wsim.c +++ b/benchmarks/gem_wsim.c @@ -1441,6 +1441,48 @@ set_ctx_sseu(struct ctx *ctx, uint64_t slice_mask) return slice_mask; } +static size_t sizeof_load_balance(int count) +{ + struct i915_context_engines_load_balance *ptr; + + assert(sizeof(ptr->engines[count]) == count * sizeof(ptr->engines[0])); This seems wrong - is bound to trigger. Why does it seem wrong? That's the calculation used previously, and the ptr->engines[] was meant to be packed in order for sizeof(ptr->engines[count]) == count * sizeof(ptr->engines[0]). Anyway, I threw it in there to check if the calculation was sane. Because sizeof(ptr->engines[0]) == sizeof(ptr->engines[N]), since the code is not declaring N big array, just referencing the element N. So for more than one engine I expect it explodes. Unless I am way wrong.. I guess someone needs to run it.. :) + return sizeof(*ptr) + sizeof(ptr->engines[count]); So size of of engine needs to be multiplied by count. (Just note this is the what the current VLA evaluates to :) +} + +static struct i915_context_engines_load_balance * +alloc_load_balance(int count) +{ + return calloc(1, sizeof_load_balance(count)); How about alloca so cleanup is simpler? Or is alloca also on the unpopular list? I don't mind. Would shave a few lines indeed, but we need the memsets back. #define alloca0()? And a helper macro to generically deal with struct header + engines array so it doesn't need to be repeated three times. Yadayada too much work.. :) ... Or possibly what Simon suggested, just a large temporary stack arrays would be enough and easiest diff. Just with an assert that it fits. I don't think that is as clean for the long term. ... this should be just fine for now so I'd vote for it. Regards, Tvrtko ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH i-g-t v2] benchmarks/gem_wsim: Manually calculate VLA struct sizes
Apparently VLA structs (e.g. struct { int array[count] }) is a gcc extension that clang refuses to support as handling memory layout is too difficult for it. So calculate the size by hand! v2: Use alloca(). Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin --- benchmarks/gem_wsim.c | 115 +++--- 1 file changed, 64 insertions(+), 51 deletions(-) diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c index e2ffb93a9..db19925b1 100644 --- a/benchmarks/gem_wsim.c +++ b/benchmarks/gem_wsim.c @@ -1441,6 +1441,29 @@ set_ctx_sseu(struct ctx *ctx, uint64_t slice_mask) return slice_mask; } +static size_t sizeof_load_balance(int count) +{ + struct i915_context_engines_load_balance *ptr; + + return sizeof(*ptr) + count * sizeof(ptr->engines[0]); +} + +static size_t sizeof_param_engines(int count) +{ + struct i915_context_param_engines *ptr; + + return sizeof(*ptr) + count * sizeof(ptr->engines[0]); +} + +static size_t sizeof_engines_bond(int count) +{ + struct i915_context_engines_bond *ptr; + + return sizeof(*ptr) + count * sizeof(ptr->engines[0]); +} + +#define alloca0(sz) ({ size_t sz__ = (sz); memset(alloca(sz__), 0, sz__); }) + static int prepare_workload(unsigned int id, struct workload *wrk, unsigned int flags) { @@ -1676,66 +1699,54 @@ prepare_workload(unsigned int id, struct workload *wrk, unsigned int flags) } if (ctx->engine_map) { - I915_DEFINE_CONTEXT_PARAM_ENGINES(set_engines, - ctx->engine_map_count + 1); - I915_DEFINE_CONTEXT_ENGINES_LOAD_BALANCE(load_balance, - ctx->engine_map_count); + struct i915_context_param_engines *set_engines = + alloca0(sizeof_param_engines(ctx->engine_map_count + 1)); + struct i915_context_engines_load_balance *load_balance = + alloca0(sizeof_load_balance(ctx->engine_map_count)); struct drm_i915_gem_context_param param = { .ctx_id = ctx_id, .param = I915_CONTEXT_PARAM_ENGINES, - .size = sizeof(set_engines), - .value = to_user_pointer(&set_engines), + .size = sizeof_param_engines(ctx->engine_map_count + 1), + .value = to_user_pointer(set_engines), }; + struct i915_context_engines_bond *last = NULL; if (ctx->wants_balance) { - set_engines.extensions = - to_user_pointer(&load_balance); + set_engines->extensions = + to_user_pointer(load_balance); - memset(&load_balance, 0, sizeof(load_balance)); - load_balance.base.name = + load_balance->base.name = I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE; - load_balance.num_siblings = + load_balance->num_siblings = ctx->engine_map_count; for (j = 0; j < ctx->engine_map_count; j++) - load_balance.engines[j] = + load_balance->engines[j] = get_engine(ctx->engine_map[j]); - } else { - set_engines.extensions = 0; } /* Reserve slot for virtual engine. */ - set_engines.engines[0].engine_class = + set_engines->engines[0].engine_class = I915_ENGINE_CLASS_INVALID; - set_engines.engines[0].engine_instance = + set_engines->engines[0].engine_instance = I915_ENGINE_CLASS_INVALID_NONE; for (j = 1; j <= ctx->engine_map_count; j++) - set_engines.engines[j] = + set_engines->engines[j] = get_engine(ctx->engine_map[j - 1]); + last = NULL; for (j = 0; j < ctx->bond_count; j++) { unsigned long mask = ctx->bonds[j].mask; - I915_DEFINE_CONTEXT_ENGINES_BOND(bond, - __builtin_popcount(mask)); - struct i915_context_eng
Re: [Intel-gfx] [BrownBag] drm/i915/gtt: Neuter the deferred unbind callback from gen6_ppgtt_cleanup
On 24/05/2019 09:36, Chris Wilson wrote: Quoting Tvrtko Ursulin (2019-05-24 09:31:45) On 24/05/2019 09:29, Chris Wilson wrote: Quoting Tvrtko Ursulin (2019-05-24 09:23:40) On 24/05/2019 09:17, Chris Wilson wrote: Quoting Tvrtko Ursulin (2019-05-24 09:13:14) On 24/05/2019 07:45, Chris Wilson wrote: Having deferred the vma destruction to a worker where we can acquire the struct_mutex, we have to avoid chasing back into the now destroyed ppgtt. The pd_vma is special in having a custom unbind function to scan for unused pages despite the VMA itself being notionally part of the GGTT. As such, we need to disable that callback to avoid a use-after-free. This unfortunately blew up so early during boot that CI declared the machine unreachable as opposed to being the major failure it was. Oops. Fixes: d3622099c76f ("drm/i915/gtt: Always acquire struct_mutex for gen6_ppgtt_cleanup") Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin Cc: Tomi Sarvela --- drivers/gpu/drm/i915/i915_gem_gtt.c | 28 1 file changed, 28 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 8d8a4b0ad4d9..266baa11df64 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c @@ -1847,6 +1847,33 @@ static void gen6_ppgtt_cleanup_work(struct work_struct *wrk) kfree(work); } +static int nop_set_pages(struct i915_vma *vma) +{ + return -ENODEV; +} + +static void nop_clear_pages(struct i915_vma *vma) +{ +} + +static int nop_bind(struct i915_vma *vma, + enum i915_cache_level cache_level, + u32 unused) +{ + return -ENODEV; +} + +static void nop_unbind(struct i915_vma *vma) +{ +} + +static const struct i915_vma_ops nop_vma_ops = { + .set_pages = nop_set_pages, + .clear_pages = nop_clear_pages, + .bind_vma = nop_bind, + .unbind_vma = nop_unbind, +}; + static void gen6_ppgtt_cleanup(struct i915_address_space *vm) { struct gen6_hw_ppgtt *ppgtt = to_gen6_ppgtt(i915_vm_to_ppgtt(vm)); @@ -1855,6 +1882,7 @@ static void gen6_ppgtt_cleanup(struct i915_address_space *vm) /* FIXME remove the struct_mutex to bring the locking under control */ INIT_WORK(&work->base, gen6_ppgtt_cleanup_work); work->vma = ppgtt->vma; + work->vma->ops = &nop_vma_ops; Could we use some asserts before overriding the vma ops? Like GEM_BUG_ON(vma->pages)? And something for still bound? It technically still is bound as it is in the GGTT but currently unpinned -- that will be checked on destroy, it's just we also get an unbind callback. vma->pages doesn't exist for this (set to ERR_PTR). If we are getting the unbind callback and we nop-ed it, who will actually do it's job? The callback is just a hook for us to prune within the ppgtt. It still is removed from GGTT by i915_vma_unbind(). So it needs GEM_BUG_ON(ppgtt->scan_for_unused_pt) before overriding the unbind? No. They get freed by the cleanup itself. The scan is just an opportunistic prune if either the context/mm is evicted but still alive. Then the same assert in gen6_ppgtt_cleanup_work? :) Regards, Tvrtko ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 00/33] fbcon notifier begone!
Hi all, I fixed the fbcon_exited mess that CI spotted (hopefully it works now, the code is still rather brittle imo). Plus all the little nits 0day and people found. Maarten slapped an rb onto the entire pile, but I feel like enough has changed that a 2nd look from him is warranted. I also added a backlight patch on top, I think that nicely highlights how the fb notifier is now only used for backlight notifications. Maybe we could rename it as a follow-up to make that clear. Oh and one rather badly looking thing: am200epd is abusing the notifier in very interesting ways. I guess a proper fix would be to figure out where the display boot memory reservation is some more direct way, instead of listening to the fw fb driver. But that's definitely outside of my knowledge, so I left it at a bunch of #ifdef and comments. I think we also still need an ack from Greg KH for the vt and staging bits. As usual, comments, review and testing very much welcome. btw for future plans: I think this is tricky enough (it's old code and all that) that we should let this soak for 2-3 kernel releases. I think the following would be nice subsequent cleanup/fixes: - push the console lock completely from fbmem.c to fbcon.c. I think we're mostly there with prep, but needs to pondering of corner cases. - move fbcon.c from using indices for tracking fb_info (and accessing registered_fbs without proper locking all the time) to real fb_info pointers with the right amount of refcounting. Mostly motivated by the fun I had trying to simplify fbcon_exit(). - make sure that fbcon call lock/unlock_fb when it calls fbmem.c functions, and sprinkle assert_lockdep_held around in fbmem.c. This needs the console_lock cleanups first. But I think that's material for maybe next year or so. Cheers, Daniel Daniel Vetter (33): dummycon: Sprinkle locking checks fbdev: locking check for fb_set_suspend vt: might_sleep() annotation for do_blank_screen vt: More locking checks fbdev/sa1100fb: Remove dead code fbdev/cyber2000: Remove struct display fbdev/aty128fb: Remove dead code fbcon: s/struct display/struct fbcon_display/ fbcon: Remove fbcon_has_exited fbcon: call fbcon_fb_(un)registered directly fbdev/sh_mobile: remove sh_mobile_lcdc_display_notify fbdev/omap: sysfs files can't disappear before the device is gone fbdev: sysfs files can't disappear before the device is gone staging/olpc: lock_fb_info can't fail fbdev/atyfb: lock_fb_info can't fail fbdev: lock_fb_info cannot fail fbcon: call fbcon_fb_bind directly fbdev: make unregister/unlink functions not fail fbdev: unify unlink_framebuffer paths fbdev/sh_mob: Remove fb notifier callback fbdev: directly call fbcon_suspended/resumed fbcon: Call fbcon_mode_deleted/new_modelist directly fbdev: Call fbcon_get_requirement directly Revert "backlight/fbcon: Add FB_EVENT_CONBLANK" fbmem: pull fbcon_fb_blanked out of fb_blank fbdev: remove FBINFO_MISC_USEREVENT around fb_blank fb: Flatten control flow in fb_set_var fbcon: replace FB_EVENT_MODE_CHANGE/_ALL with direct calls vgaswitcheroo: call fbcon_remap_all directly fbcon: Call con2fb_map functions directly fbcon: Document what I learned about fbcon locking staging/olpc_dcon: Add drm conversion to TODO backlight: simplify lcd notifier arch/arm/mach-pxa/am200epd.c | 13 +- drivers/gpu/vga/vga_switcheroo.c | 11 +- drivers/media/pci/ivtv/ivtvfb.c | 6 +- drivers/staging/fbtft/fbtft-core.c| 4 +- drivers/staging/olpc_dcon/TODO| 7 + drivers/staging/olpc_dcon/olpc_dcon.c | 6 +- drivers/tty/vt/vt.c | 18 + drivers/video/backlight/backlight.c | 2 +- drivers/video/backlight/lcd.c | 12 - drivers/video/console/dummycon.c | 6 + drivers/video/fbdev/aty/aty128fb.c| 64 --- drivers/video/fbdev/aty/atyfb_base.c | 3 +- drivers/video/fbdev/core/fbcmap.c | 6 +- drivers/video/fbdev/core/fbcon.c | 311 ++ drivers/video/fbdev/core/fbcon.h | 6 +- drivers/video/fbdev/core/fbmem.c | 399 +++--- drivers/video/fbdev/core/fbsysfs.c| 20 +- drivers/video/fbdev/cyber2000fb.c | 1 - drivers/video/fbdev/neofb.c | 9 +- .../video/fbdev/omap2/omapfb/omapfb-sysfs.c | 21 +- drivers/video/fbdev/sa1100fb.c| 25 -- drivers/video/fbdev/savage/savagefb_driver.c | 9 +- drivers/video/fbdev/sh_mobile_lcdcfb.c| 112 + drivers/video/fbdev/sh_mobile_lcdcfb.h| 5 - include/linux/console_struct.h| 5 +- include/linux/fb.h| 45 +- include/linux/fbcon.h | 30 ++ 27 files changed, 394 insertions(+), 762 deletions(-) -- 2.20.1 ___ Intel-gfx mailing
[Intel-gfx] [PATCH 01/33] dummycon: Sprinkle locking checks
As part of trying to understand the locking (or lack thereof) in the fbcon/vt/fbdev maze, annotate everything. Signed-off-by: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Hans de Goede Cc: Daniel Vetter Cc: Greg Kroah-Hartman Cc: Kees Cook Cc: Nicolas Pitre --- drivers/video/console/dummycon.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c index 45ad925ad5f8..2352b4c37826 100644 --- a/drivers/video/console/dummycon.c +++ b/drivers/video/console/dummycon.c @@ -33,6 +33,8 @@ static bool dummycon_putc_called; void dummycon_register_output_notifier(struct notifier_block *nb) { + WARN_CONSOLE_UNLOCKED(); + raw_notifier_chain_register(&dummycon_output_nh, nb); if (dummycon_putc_called) @@ -41,11 +43,15 @@ void dummycon_register_output_notifier(struct notifier_block *nb) void dummycon_unregister_output_notifier(struct notifier_block *nb) { + WARN_CONSOLE_UNLOCKED(); + raw_notifier_chain_unregister(&dummycon_output_nh, nb); } static void dummycon_putc(struct vc_data *vc, int c, int ypos, int xpos) { + WARN_CONSOLE_UNLOCKED(); + dummycon_putc_called = true; raw_notifier_call_chain(&dummycon_output_nh, 0, NULL); } -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 02/33] fbdev: locking check for fb_set_suspend
Just drive-by, nothing systematic yet. Signed-off-by: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: "Michał Mirosław" Cc: Peter Rosin Cc: Hans de Goede Cc: Thomas Zimmermann Cc: Manfred Schlaegl Cc: Mikulas Patocka Cc: Kees Cook --- drivers/video/fbdev/core/fbmem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index d1949c92be98..8ba674ffb3c9 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1985,6 +1985,8 @@ void fb_set_suspend(struct fb_info *info, int state) { struct fb_event event; + WARN_CONSOLE_UNLOCKED(); + event.info = info; if (state) { fb_notifier_call_chain(FB_EVENT_SUSPEND, &event); -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 04/33] vt: More locking checks
I honestly have no idea what the subtle differences between con_is_visible, con_is_fg (internal to vt.c) and con_is_bound are. But it looks like both vc->vc_display_fg and con_driver_map are protected by the console_lock, so probably better if we hold that when checking this. To do that I had to deinline the con_is_visible function. Signed-off-by: Daniel Vetter Cc: Greg Kroah-Hartman Cc: Nicolas Pitre Cc: Martin Hostettler Cc: Adam Borowski Cc: Daniel Vetter Cc: Mikulas Patocka --- drivers/tty/vt/vt.c| 16 include/linux/console_struct.h | 5 + 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index bc9813b14c58..a8988a085138 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -3815,6 +3815,8 @@ int con_is_bound(const struct consw *csw) { int i, bound = 0; + WARN_CONSOLE_UNLOCKED(); + for (i = 0; i < MAX_NR_CONSOLES; i++) { if (con_driver_map[i] == csw) { bound = 1; @@ -3826,6 +3828,20 @@ int con_is_bound(const struct consw *csw) } EXPORT_SYMBOL(con_is_bound); +/** + * con_is_visible - checks whether the current console is visible + * @vc: virtual console + * + * RETURNS: zero if not visible, nonzero if visible + */ +bool con_is_visible(const struct vc_data *vc) +{ + WARN_CONSOLE_UNLOCKED(); + + return *vc->vc_display_fg == vc; +} +EXPORT_SYMBOL(con_is_visible); + /** * con_debug_enter - prepare the console for the kernel debugger * @sw: console driver diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h index ed798e114663..24d4c16e3ae0 100644 --- a/include/linux/console_struct.h +++ b/include/linux/console_struct.h @@ -168,9 +168,6 @@ extern void vc_SAK(struct work_struct *work); #define CUR_DEFAULT CUR_UNDERLINE -static inline bool con_is_visible(const struct vc_data *vc) -{ - return *vc->vc_display_fg == vc; -} +bool con_is_visible(const struct vc_data *vc); #endif /* _LINUX_CONSOLE_STRUCT_H */ -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 10/33] fbcon: call fbcon_fb_(un)registered directly
With commit 6104c37094e729f3d4ce65797002112735d49cd1 Author: Daniel Vetter Date: Tue Aug 1 17:32:07 2017 +0200 fbcon: Make fbcon a built-time depency for fbdev we have a static dependency between fbcon and fbdev, and we can replace the indirection through the notifier chain with a function call. v2: Sam Ravnborg noticed that mach-pxa/am200epd.c has a notifier too, and listens to this. ... Looking at the code it seems to wait for some fb to show up, so that it can get the framebuffer base address from the fb_info struct. I suspect his is some firmware fbdev. Then it uses that information to let the real fbdev driver (metronomefb.c by the looks) get at the framebuffer memory. This doesn't looke like it's easy to fix (except by deleting the entire thing, seems untouched since 2008, we might be able to get away with that), so let's just stuff a few #ifdef into fb.h and fbmem.c and cry over them for a bit. Signed-off-by: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: Hans de Goede Cc: Greg Kroah-Hartman Cc: "Noralf Trønnes" Cc: Yisheng Xie Cc: Peter Rosin Cc: "Michał Mirosław" Cc: Thomas Zimmermann Cc: Mikulas Patocka Cc: linux-fb...@vger.kernel.org Cc: Daniel Mack Cc: Haojian Zhuang Cc: Robert Jarzmik Cc: Konstantin Khorenko Cc: Prarit Bhargava Cc: Gerd Hoffmann Cc: Steve Sakoman Cc: Steve Sakoman Cc: linux-arm-ker...@lists.infradead.org --- arch/arm/mach-pxa/am200epd.c | 13 +++-- drivers/video/fbdev/core/fbcon.c | 14 +++--- drivers/video/fbdev/core/fbmem.c | 24 +--- include/linux/fb.h | 7 +-- include/linux/fbcon.h| 4 5 files changed, 40 insertions(+), 22 deletions(-) diff --git a/arch/arm/mach-pxa/am200epd.c b/arch/arm/mach-pxa/am200epd.c index 50e18ed37fa6..cac0bb09db14 100644 --- a/arch/arm/mach-pxa/am200epd.c +++ b/arch/arm/mach-pxa/am200epd.c @@ -347,8 +347,17 @@ int __init am200_init(void) { int ret; - /* before anything else, we request notification for any fb -* creation events */ + /* +* Before anything else, we request notification for any fb +* creation events. +* +* FIXME: This is terrible and needs to be nuked. The notifier is used +* to get at the fb base address from the boot splash fb driver, which +* is then passed to metronomefb. Instaed of metronomfb or this board +* support file here figuring this out on their own. +* +* See also the #ifdef in fbmem.c. +*/ fb_register_client(&am200_fb_notif); pxa2xx_mfp_config(ARRAY_AND_SIZE(am200_pin_config)); diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 622d336cfc81..54d01f7284cb 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3119,14 +3119,14 @@ static int fbcon_fb_unbind(int idx) } /* called with console_lock held */ -static int fbcon_fb_unregistered(struct fb_info *info) +void fbcon_fb_unregistered(struct fb_info *info) { int i, idx; WARN_CONSOLE_UNLOCKED(); if (deferred_takeover) - return 0; + return; idx = info->node; for (i = first_fb_vc; i <= last_fb_vc; i++) { @@ -3155,8 +3155,6 @@ static int fbcon_fb_unregistered(struct fb_info *info) if (!num_registered_fb) do_unregister_con_driver(&fb_con); - - return 0; } /* called with console_lock held */ @@ -3215,7 +3213,7 @@ static inline void fbcon_select_primary(struct fb_info *info) #endif /* CONFIG_FRAMEBUFFER_DETECT_PRIMARY */ /* called with console_lock held */ -static int fbcon_fb_registered(struct fb_info *info) +int fbcon_fb_registered(struct fb_info *info) { int ret = 0, i, idx; @@ -3359,12 +3357,6 @@ static int fbcon_event_notify(struct notifier_block *self, idx = info->node; ret = fbcon_fb_unbind(idx); break; - case FB_EVENT_FB_REGISTERED: - ret = fbcon_fb_registered(info); - break; - case FB_EVENT_FB_UNREGISTERED: - ret = fbcon_fb_unregistered(info); - break; case FB_EVENT_SET_CONSOLE_MAP: /* called with console lock held */ con2fb = event->data; diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 8ba674ffb3c9..bed7698ad18a 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1660,7 +1660,6 @@ MODULE_PARM_DESC(lockless_register_fb, static int do_register_framebuffer(struct fb_info *fb_info) { int i, ret; - struct fb_event event; struct fb_videomode mode; if (fb_check_foreignness(fb_info)) @@ -1723,7 +1722,14 @@ static int do_register_framebuffer(struct fb_info *fb_info) fb_add_videomode(&mode, &fb_info->modelist); registered_fb[i] = fb_info; -
[Intel-gfx] [PATCH 07/33] fbdev/aty128fb: Remove dead code
Motivated because it contains a struct display, which is a fbcon internal data structure that I want to rename. It seems to have been formerly used in drivers, but that's very long time ago. Signed-off-by: Daniel Vetter Cc: Paul Mackerras Cc: linux-fb...@vger.kernel.org --- drivers/video/fbdev/aty/aty128fb.c | 64 -- 1 file changed, 64 deletions(-) diff --git a/drivers/video/fbdev/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c index 6cc46867ff57..c022ad7a49c2 100644 --- a/drivers/video/fbdev/aty/aty128fb.c +++ b/drivers/video/fbdev/aty/aty128fb.c @@ -2349,70 +2349,6 @@ static int aty128fb_ioctl(struct fb_info *info, u_int cmd, u_long arg) return -EINVAL; } -#if 0 -/* - * Accelerated functions - */ - -static inline void aty128_rectcopy(int srcx, int srcy, int dstx, int dsty, - u_int width, u_int height, - struct fb_info_aty128 *par) -{ - u32 save_dp_datatype, save_dp_cntl, dstval; - - if (!width || !height) - return; - - dstval = depth_to_dst(par->current_par.crtc.depth); - if (dstval == DST_24BPP) { - srcx *= 3; - dstx *= 3; - width *= 3; - } else if (dstval == -EINVAL) { - printk("aty128fb: invalid depth or RGBA\n"); - return; - } - - wait_for_fifo(2, par); - save_dp_datatype = aty_ld_le32(DP_DATATYPE); - save_dp_cntl = aty_ld_le32(DP_CNTL); - - wait_for_fifo(6, par); - aty_st_le32(SRC_Y_X, (srcy << 16) | srcx); - aty_st_le32(DP_MIX, ROP3_SRCCOPY | DP_SRC_RECT); - aty_st_le32(DP_CNTL, DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM); - aty_st_le32(DP_DATATYPE, save_dp_datatype | dstval | SRC_DSTCOLOR); - - aty_st_le32(DST_Y_X, (dsty << 16) | dstx); - aty_st_le32(DST_HEIGHT_WIDTH, (height << 16) | width); - - par->blitter_may_be_busy = 1; - - wait_for_fifo(2, par); - aty_st_le32(DP_DATATYPE, save_dp_datatype); - aty_st_le32(DP_CNTL, save_dp_cntl); -} - - -/* - * Text mode accelerated functions - */ - -static void fbcon_aty128_bmove(struct display *p, int sy, int sx, int dy, - int dx, int height, int width) -{ - sx *= fontwidth(p); - sy *= fontheight(p); - dx *= fontwidth(p); - dy *= fontheight(p); - width *= fontwidth(p); - height *= fontheight(p); - - aty128_rectcopy(sx, sy, dx, dy, width, height, - (struct fb_info_aty128 *)p->fb_info); -} -#endif /* 0 */ - static void aty128_set_suspend(struct aty128fb_par *par, int suspend) { u32 pmgt; -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 06/33] fbdev/cyber2000: Remove struct display
Entirely unused. Signed-off-by: Daniel Vetter Cc: Russell King Cc: linux-arm-ker...@lists.infradead.org --- drivers/video/fbdev/cyber2000fb.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/video/fbdev/cyber2000fb.c b/drivers/video/fbdev/cyber2000fb.c index 9a5751cb4e16..452ef07b3a06 100644 --- a/drivers/video/fbdev/cyber2000fb.c +++ b/drivers/video/fbdev/cyber2000fb.c @@ -61,7 +61,6 @@ struct cfb_info { struct fb_info fb; struct display_switch *dispsw; - struct display *display; unsigned char __iomem *region; unsigned char __iomem *regs; u_int id; -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 03/33] vt: might_sleep() annotation for do_blank_screen
For symmetry reasons with do_unblank_screen, except without the oops_in_progress special case. Just a drive-by annotation while I'm trying to untangle the fbcon vs. fbdev screen blank/unblank maze. Signed-off-by: Daniel Vetter Cc: Greg Kroah-Hartman Cc: Nicolas Pitre Cc: Adam Borowski Cc: Martin Hostettler Cc: Daniel Vetter Cc: Mikulas Patocka --- drivers/tty/vt/vt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index fdd12f8c3deb..bc9813b14c58 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -4159,6 +4159,8 @@ void do_blank_screen(int entering_gfx) struct vc_data *vc = vc_cons[fg_console].d; int i; + might_sleep(); + WARN_CONSOLE_UNLOCKED(); if (console_blanked) { -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 15/33] fbdev/atyfb: lock_fb_info can't fail
It's properly protected by reboot_lock. Signed-off-by: Daniel Vetter Cc: Mikulas Patocka Cc: "David S. Miller" Cc: "Ville Syrjälä" Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter --- drivers/video/fbdev/aty/atyfb_base.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c index b6fe103df145..eebb62d82a23 100644 --- a/drivers/video/fbdev/aty/atyfb_base.c +++ b/drivers/video/fbdev/aty/atyfb_base.c @@ -3916,8 +3916,7 @@ static int atyfb_reboot_notify(struct notifier_block *nb, if (!reboot_info) goto out; - if (!lock_fb_info(reboot_info)) - goto out; + lock_fb_info(reboot_info); par = reboot_info->par; -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 13/33] fbdev: sysfs files can't disappear before the device is gone
Which means lock_fb_info can never fail. Remove the error handling. Signed-off-by: Daniel Vetter Cc: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Rob Clark --- drivers/video/fbdev/core/fbsysfs.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c index 44cca39f2b51..5f329278e55f 100644 --- a/drivers/video/fbdev/core/fbsysfs.c +++ b/drivers/video/fbdev/core/fbsysfs.c @@ -179,10 +179,7 @@ static ssize_t store_modes(struct device *device, return -EINVAL; console_lock(); - if (!lock_fb_info(fb_info)) { - console_unlock(); - return -ENODEV; - } + lock_fb_info(fb_info); list_splice(&fb_info->modelist, &old_list); fb_videomode_to_modelist((const struct fb_videomode *)buf, i, @@ -409,10 +406,7 @@ static ssize_t store_fbstate(struct device *device, state = simple_strtoul(buf, &last, 0); console_lock(); - if (!lock_fb_info(fb_info)) { - console_unlock(); - return -ENODEV; - } + lock_fb_info(fb_info); fb_set_suspend(fb_info, (int)state); -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 05/33] fbdev/sa1100fb: Remove dead code
Motivated because it contains a struct display, which is a fbcon internal data structure that I want to rename. It seems to have been formerly used in drivers, but that's very long time ago. Signed-off-by: Daniel Vetter Cc: Daniel Vetter --- drivers/video/fbdev/sa1100fb.c | 25 - 1 file changed, 25 deletions(-) diff --git a/drivers/video/fbdev/sa1100fb.c b/drivers/video/fbdev/sa1100fb.c index 15ae50063296..f7f8dee044b1 100644 --- a/drivers/video/fbdev/sa1100fb.c +++ b/drivers/video/fbdev/sa1100fb.c @@ -974,35 +974,10 @@ static void sa1100fb_task(struct work_struct *w) */ static unsigned int sa1100fb_min_dma_period(struct sa1100fb_info *fbi) { -#if 0 - unsigned int min_period = (unsigned int)-1; - int i; - - for (i = 0; i < MAX_NR_CONSOLES; i++) { - struct display *disp = &fb_display[i]; - unsigned int period; - - /* -* Do we own this display? -*/ - if (disp->fb_info != &fbi->fb) - continue; - - /* -* Ok, calculate its DMA period -*/ - period = sa1100fb_display_dma_period(&disp->var); - if (period < min_period) - min_period = period; - } - - return min_period; -#else /* * FIXME: we need to verify _all_ consoles. */ return sa1100fb_display_dma_period(&fbi->fb.var); -#endif } /* -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 08/33] fbcon: s/struct display/struct fbcon_display/
This was formerly used in fbdev drivers (not sure why, predates most git history), but now it's entirely an fbcon internal thing. Give it a more specific name. Signed-off-by: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: Hans de Goede Cc: Greg Kroah-Hartman Cc: Kees Cook Cc: Prarit Bhargava Cc: Konstantin Khorenko Cc: Peter Rosin Cc: Yisheng Xie --- drivers/video/fbdev/core/fbcon.c | 74 drivers/video/fbdev/core/fbcon.h | 6 +-- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 786f9aab55df..5424051c8e1a 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -93,7 +93,7 @@ enum { FBCON_LOGO_DONTSHOW = -3/* do not show the logo */ }; -static struct display fb_display[MAX_NR_CONSOLES]; +static struct fbcon_display fb_display[MAX_NR_CONSOLES]; static signed char con2fb_map[MAX_NR_CONSOLES]; static signed char con2fb_map_boot[MAX_NR_CONSOLES]; @@ -185,11 +185,11 @@ static __inline__ void ywrap_up(struct vc_data *vc, int count); static __inline__ void ywrap_down(struct vc_data *vc, int count); static __inline__ void ypan_up(struct vc_data *vc, int count); static __inline__ void ypan_down(struct vc_data *vc, int count); -static void fbcon_bmove_rec(struct vc_data *vc, struct display *p, int sy, int sx, +static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx, int dy, int dx, int height, int width, u_int y_break); static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var, int unit); -static void fbcon_redraw_move(struct vc_data *vc, struct display *p, +static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p, int line, int count, int dy); static void fbcon_modechanged(struct fb_info *info); static void fbcon_set_all_vcs(struct fb_info *info); @@ -220,7 +220,7 @@ static void fbcon_rotate(struct fb_info *info, u32 rotate) fb_info = registered_fb[con2fb_map[ops->currcon]]; if (info == fb_info) { - struct display *p = &fb_display[ops->currcon]; + struct fbcon_display *p = &fb_display[ops->currcon]; if (rotate < 4) p->con_rotate = rotate; @@ -235,7 +235,7 @@ static void fbcon_rotate_all(struct fb_info *info, u32 rotate) { struct fbcon_ops *ops = info->fbcon_par; struct vc_data *vc; - struct display *p; + struct fbcon_display *p; int i; if (!ops || ops->currcon < 0 || rotate > 3) @@ -900,7 +900,7 @@ static int set_con2fb_map(int unit, int newidx, int user) * Low Level Operations */ /* NOTE: fbcon cannot be __init: it may be called from do_take_over_console later */ -static int var_to_display(struct display *disp, +static int var_to_display(struct fbcon_display *disp, struct fb_var_screeninfo *var, struct fb_info *info) { @@ -925,7 +925,7 @@ static int var_to_display(struct display *disp, } static void display_to_var(struct fb_var_screeninfo *var, - struct display *disp) + struct fbcon_display *disp) { fb_videomode_to_var(var, disp->mode); var->xres_virtual = disp->xres_virtual; @@ -946,7 +946,7 @@ static void display_to_var(struct fb_var_screeninfo *var, static const char *fbcon_startup(void) { const char *display_desc = "frame buffer device"; - struct display *p = &fb_display[fg_console]; + struct fbcon_display *p = &fb_display[fg_console]; struct vc_data *vc = vc_cons[fg_console].d; const struct font_desc *font = NULL; struct module *owner; @@ -1060,7 +1060,7 @@ static void fbcon_init(struct vc_data *vc, int init) struct fbcon_ops *ops; struct vc_data **default_mode = vc->vc_display_fg; struct vc_data *svc = *default_mode; - struct display *t, *p = &fb_display[vc->vc_num]; + struct fbcon_display *t, *p = &fb_display[vc->vc_num]; int logo = 1, new_rows, new_cols, rows, cols, charcnt = 256; int cap, ret; @@ -1203,7 +1203,7 @@ static void fbcon_init(struct vc_data *vc, int init) ops->p = &fb_display[fg_console]; } -static void fbcon_free_font(struct display *p, bool freefont) +static void fbcon_free_font(struct fbcon_display *p, bool freefont) { if (freefont && p->userfont && p->fontdata && (--REFCOUNT(p->fontdata) == 0)) kfree(p->fontdata - FONT_EXTRA_WORDS * sizeof(int)); @@ -1215,7 +1215,7 @@ static void set_vc_hi_font(struct vc_data *vc, bool set); static void fbcon_deinit(struct vc_data *vc) { - struct display *p = &fb_display[vc->vc_num]; + struct fbcon_display *p = &fb_display[vc->vc_num]; struct fb_info *info; struc
[Intel-gfx] [PATCH 09/33] fbcon: Remove fbcon_has_exited
This is unused code since commit 6104c37094e729f3d4ce65797002112735d49cd1 Author: Daniel Vetter Date: Tue Aug 1 17:32:07 2017 +0200 fbcon: Make fbcon a built-time depency for fbdev when fbcon was made a compile-time static dependency of fbdev. We can't exit fbcon anymore without exiting fbdev first, which only works if all fbdev drivers have unloaded already. Hence this is all dead code. v2: I missed that fbcon_exit is also called from con_deinit stuff, and there fbcon_has_exited prevents double-cleanup. But we can fix that by properly resetting con2fb_map[] to all -1, which is used everywhere else to indicate "no fb_info allocate to this console". With that change the double-cleanup (which resulted in a module refcount underflow, among other things) is prevented. Aside: con2fb_map is a signed char, so don't register more than 128 fb_info or hilarity will ensue. v3: CI showed me that I still didn't fully understand what's going on here. The leaked references in con2fb_map have been used upon rebinding the fb console in fbcon_init. It worked because fbdev unregistering still cleaned out con2fb_map, and reset it to info_idx. If the last fbdev driver unregistered, then it also reset info_idx, and unregistered the fbcon driver. Imo that's all a bit fragile, so let's keep the con2fb_map reset to -1, and in fbcon_init pick info_idx if we're starting fresh. That means unbinding and rebinding will cleanse the mapping, but why are you doing that if you want to retain the mapping, so should be fine. Also, I think info_idx == -1 is impossible in fbcon_init - we unregister the fbcon in that case. So catch&warn about that. Signed-off-by: Daniel Vetter Cc: Maarten Lankhorst Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: Hans de Goede Cc: "Noralf Trønnes" Cc: Yisheng Xie Cc: Konstantin Khorenko Cc: Prarit Bhargava Cc: Kees Cook --- drivers/video/fbdev/core/fbcon.c | 39 +--- 1 file changed, 6 insertions(+), 33 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 5424051c8e1a..622d336cfc81 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -112,7 +112,6 @@ static int softback_lines; static int first_fb_vc; static int last_fb_vc = MAX_NR_CONSOLES - 1; static int fbcon_is_default = 1; -static int fbcon_has_exited; static int primary_device = -1; static int fbcon_has_console_bind; @@ -1050,7 +1049,6 @@ static const char *fbcon_startup(void) info->var.bits_per_pixel); fbcon_add_cursor_timer(info); - fbcon_has_exited = 0; return display_desc; } @@ -1064,9 +1062,13 @@ static void fbcon_init(struct vc_data *vc, int init) int logo = 1, new_rows, new_cols, rows, cols, charcnt = 256; int cap, ret; - if (info_idx == -1 || info == NULL) + if (WARN_ON(info_idx == -1)) return; + if (con2fb_map[vc->vc_num] == -1) + con2fb_map[vc->vc_num] = info_idx; + + info = registered_fb[con2fb_map[vc->vc_num]]; cap = info->flags; if (logo_shown < 0 && console_loglevel <= CONSOLE_LOGLEVEL_QUIET) @@ -3336,14 +3338,6 @@ static int fbcon_event_notify(struct notifier_block *self, struct fb_blit_caps *caps; int idx, ret = 0; - /* -* ignore all events except driver registration and deregistration -* if fbcon is not active -*/ - if (fbcon_has_exited && !(action == FB_EVENT_FB_REGISTERED || - action == FB_EVENT_FB_UNREGISTERED)) - goto done; - switch(action) { case FB_EVENT_SUSPEND: fbcon_suspended(info); @@ -3396,7 +3390,6 @@ static int fbcon_event_notify(struct notifier_block *self, fbcon_remap_all(idx); break; } -done: return ret; } @@ -3443,9 +3436,6 @@ static ssize_t store_rotate(struct device *device, int rotate, idx; char **last = NULL; - if (fbcon_has_exited) - return count; - console_lock(); idx = con2fb_map[fg_console]; @@ -3468,9 +3458,6 @@ static ssize_t store_rotate_all(struct device *device, int rotate, idx; char **last = NULL; - if (fbcon_has_exited) - return count; - console_lock(); idx = con2fb_map[fg_console]; @@ -3491,9 +3478,6 @@ static ssize_t show_rotate(struct device *device, struct fb_info *info; int rotate = 0, idx; - if (fbcon_has_exited) - return 0; - console_lock(); idx = con2fb_map[fg_console]; @@ -3514,9 +3498,6 @@ static ssize_t show_cursor_blink(struct device *device, struct fbcon_ops *ops; int idx, blink = -1; - if (fbcon_has_exited) - return 0; - console_lock(); idx = con2fb_map[fg_console]; @@ -3543,9 +3524,6 @@ static ssize_t store_cursor_blink
[Intel-gfx] [PATCH 12/33] fbdev/omap: sysfs files can't disappear before the device is gone
Which means lock_fb_info can never fail. Remove the error handling. Signed-off-by: Daniel Vetter Cc: Daniel Vetter --- .../video/fbdev/omap2/omapfb/omapfb-sysfs.c | 21 +++ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c b/drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c index 8087a009c54f..bd0d20283372 100644 --- a/drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c +++ b/drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c @@ -60,8 +60,7 @@ static ssize_t store_rotate_type(struct device *dev, if (rot_type != OMAP_DSS_ROT_DMA && rot_type != OMAP_DSS_ROT_VRFB) return -EINVAL; - if (!lock_fb_info(fbi)) - return -ENODEV; + lock_fb_info(fbi); r = 0; if (rot_type == ofbi->rotation_type) @@ -112,8 +111,7 @@ static ssize_t store_mirror(struct device *dev, if (r) return r; - if (!lock_fb_info(fbi)) - return -ENODEV; + lock_fb_info(fbi); ofbi->mirror = mirror; @@ -149,8 +147,7 @@ static ssize_t show_overlays(struct device *dev, ssize_t l = 0; int t; - if (!lock_fb_info(fbi)) - return -ENODEV; + lock_fb_info(fbi); omapfb_lock(fbdev); for (t = 0; t < ofbi->num_overlays; t++) { @@ -208,8 +205,7 @@ static ssize_t store_overlays(struct device *dev, struct device_attribute *attr, if (buf[len - 1] == '\n') len = len - 1; - if (!lock_fb_info(fbi)) - return -ENODEV; + lock_fb_info(fbi); omapfb_lock(fbdev); if (len > 0) { @@ -340,8 +336,7 @@ static ssize_t show_overlays_rotate(struct device *dev, ssize_t l = 0; int t; - if (!lock_fb_info(fbi)) - return -ENODEV; + lock_fb_info(fbi); for (t = 0; t < ofbi->num_overlays; t++) { l += snprintf(buf + l, PAGE_SIZE - l, "%s%d", @@ -369,8 +364,7 @@ static ssize_t store_overlays_rotate(struct device *dev, if (buf[len - 1] == '\n') len = len - 1; - if (!lock_fb_info(fbi)) - return -ENODEV; + lock_fb_info(fbi); if (len > 0) { char *p = (char *)buf; @@ -453,8 +447,7 @@ static ssize_t store_size(struct device *dev, struct device_attribute *attr, size = PAGE_ALIGN(size); - if (!lock_fb_info(fbi)) - return -ENODEV; + lock_fb_info(fbi); if (display && display->driver->sync) display->driver->sync(display); -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 33/33] backlight: simplify lcd notifier
With all the work I've done on replacing fb notifier calls with direct calls into fbcon the backlight/lcd notifier is the only user left. It will only receive events now that it cares about, hence we can remove this check. Signed-off-by: Daniel Vetter Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- drivers/video/backlight/lcd.c | 11 --- 1 file changed, 11 deletions(-) diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c index a758039475d0..8ea5e5937ae2 100644 --- a/drivers/video/backlight/lcd.c +++ b/drivers/video/backlight/lcd.c @@ -29,17 +29,6 @@ static int fb_notifier_callback(struct notifier_block *self, struct lcd_device *ld; struct fb_event *evdata = data; - /* If we aren't interested in this event, skip it immediately ... */ - switch (event) { - case FB_EVENT_BLANK: - case FB_EVENT_MODE_CHANGE: - case FB_EARLY_EVENT_BLANK: - case FB_R_EARLY_EVENT_BLANK: - break; - default: - return 0; - } - ld = container_of(self, struct lcd_device, fb_notif); if (!ld->ops) return 0; -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [BrownBag] drm/i915/gtt: Neuter the deferred unbind callback from gen6_ppgtt_cleanup
Quoting Tvrtko Ursulin (2019-05-24 09:51:46) > > On 24/05/2019 09:36, Chris Wilson wrote: > > Quoting Tvrtko Ursulin (2019-05-24 09:31:45) > >> > >> On 24/05/2019 09:29, Chris Wilson wrote: > >>> Quoting Tvrtko Ursulin (2019-05-24 09:23:40) > > On 24/05/2019 09:17, Chris Wilson wrote: > > Quoting Tvrtko Ursulin (2019-05-24 09:13:14) > >> > >> On 24/05/2019 07:45, Chris Wilson wrote: > >>> Having deferred the vma destruction to a worker where we can acquire > >>> the > >>> struct_mutex, we have to avoid chasing back into the now destroyed > >>> ppgtt. The pd_vma is special in having a custom unbind function to > >>> scan > >>> for unused pages despite the VMA itself being notionally part of the > >>> GGTT. As such, we need to disable that callback to avoid a > >>> use-after-free. > >>> > >>> This unfortunately blew up so early during boot that CI declared the > >>> machine unreachable as opposed to being the major failure it was. > >>> Oops. > >>> > >>> Fixes: d3622099c76f ("drm/i915/gtt: Always acquire struct_mutex for > >>> gen6_ppgtt_cleanup") > >>> Signed-off-by: Chris Wilson > >>> Cc: Tvrtko Ursulin > >>> Cc: Tomi Sarvela > >>> --- > >>> drivers/gpu/drm/i915/i915_gem_gtt.c | 28 > >>> > >>> 1 file changed, 28 insertions(+) > >>> > >>> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c > >>> b/drivers/gpu/drm/i915/i915_gem_gtt.c > >>> index 8d8a4b0ad4d9..266baa11df64 100644 > >>> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c > >>> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c > >>> @@ -1847,6 +1847,33 @@ static void gen6_ppgtt_cleanup_work(struct > >>> work_struct *wrk) > >>> kfree(work); > >>> } > >>> > >>> +static int nop_set_pages(struct i915_vma *vma) > >>> +{ > >>> + return -ENODEV; > >>> +} > >>> + > >>> +static void nop_clear_pages(struct i915_vma *vma) > >>> +{ > >>> +} > >>> + > >>> +static int nop_bind(struct i915_vma *vma, > >>> + enum i915_cache_level cache_level, > >>> + u32 unused) > >>> +{ > >>> + return -ENODEV; > >>> +} > >>> + > >>> +static void nop_unbind(struct i915_vma *vma) > >>> +{ > >>> +} > >>> + > >>> +static const struct i915_vma_ops nop_vma_ops = { > >>> + .set_pages = nop_set_pages, > >>> + .clear_pages = nop_clear_pages, > >>> + .bind_vma = nop_bind, > >>> + .unbind_vma = nop_unbind, > >>> +}; > >>> + > >>> static void gen6_ppgtt_cleanup(struct i915_address_space *vm) > >>> { > >>> struct gen6_hw_ppgtt *ppgtt = > >>> to_gen6_ppgtt(i915_vm_to_ppgtt(vm)); > >>> @@ -1855,6 +1882,7 @@ static void gen6_ppgtt_cleanup(struct > >>> i915_address_space *vm) > >>> /* FIXME remove the struct_mutex to bring the locking under > >>> control */ > >>> INIT_WORK(&work->base, gen6_ppgtt_cleanup_work); > >>> work->vma = ppgtt->vma; > >>> + work->vma->ops = &nop_vma_ops; > >> > >> Could we use some asserts before overriding the vma ops? Like > >> GEM_BUG_ON(vma->pages)? And something for still bound? > > > > It technically still is bound as it is in the GGTT but currently > > unpinned -- that will be checked on destroy, it's just we also get an > > unbind callback. vma->pages doesn't exist for this (set to ERR_PTR). > > If we are getting the unbind callback and we nop-ed it, who will > actually do it's job? > >>> > >>> The callback is just a hook for us to prune within the ppgtt. > >>> It still is removed from GGTT by i915_vma_unbind(). > >> > >> So it needs GEM_BUG_ON(ppgtt->scan_for_unused_pt) before overriding the > >> unbind? > > > > No. They get freed by the cleanup itself. The scan is just an > > opportunistic prune if either the context/mm is evicted but still alive. > > Then the same assert in gen6_ppgtt_cleanup_work? :) ppgtt is dead. -Chris ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 31/33] fbcon: Document what I learned about fbcon locking
It's not pretty. Signed-off-by: Daniel Vetter Cc: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Hans de Goede Cc: Yisheng Xie --- drivers/video/fbdev/core/fbcon.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 6a4bbb8407c0..8444d5151c2d 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -88,6 +88,25 @@ # define DPRINTK(fmt, args...) #endif +/* + * FIXME: Locking + * + * - fbcon state itself is protected by the console_lock, and the code does a + * pretty good job at making sure that lock is held everywhere it's needed. + * + * - access to the registered_fb array is entirely unprotected. This should use + * proper object lifetime handling, i.e. get/put_fb_info. This also means + * switching from indices to proper pointers for fb_info everywhere. + * + * - fbcon doesn't bother with fb_lock/unlock at all. This is buggy, since it + * means concurrent access to the same fbdev from both fbcon and userspace + * will blow up. To fix this all fbcon calls from fbmem.c need to be moved out + * of fb_lock/unlock protected sections, since otherwise we'll recurse and + * deadlock eventually. Aside: Due to these deadlock issues the fbdev code in + * fbmem.c cannot use locking asserts, and there's lots of callers which get + * the rules wrong, e.g. fbsysfs.c entirely missed fb_lock/unlock calls too. + */ + enum { FBCON_LOGO_CANSHOW = -1, /* the logo can be shown */ FBCON_LOGO_DRAW = -2, /* draw the logo to a console */ -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 23/33] fbdev: Call fbcon_get_requirement directly
Pretty simple case really. v2: Forgot to remove a break; v3: Add static inline to the dummy versions. Signed-off-by: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: Hans de Goede Cc: "Steven Rostedt (VMware)" Cc: Prarit Bhargava Cc: Kees Cook Cc: Yisheng Xie Cc: "Michał Mirosław" Cc: Peter Rosin Cc: Mikulas Patocka Cc: linux-fb...@vger.kernel.org --- drivers/video/fbdev/core/fbcon.c | 9 ++--- drivers/video/fbdev/core/fbmem.c | 5 + include/linux/fb.h | 2 -- include/linux/fbcon.h| 4 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 35ecd25b385c..259cdd118475 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3283,8 +3283,8 @@ void fbcon_new_modelist(struct fb_info *info) } } -static void fbcon_get_requirement(struct fb_info *info, - struct fb_blit_caps *caps) +void fbcon_get_requirement(struct fb_info *info, + struct fb_blit_caps *caps) { struct vc_data *vc; struct fbcon_display *p; @@ -3325,7 +3325,6 @@ static int fbcon_event_notify(struct notifier_block *self, struct fb_event *event = data; struct fb_info *info = event->info; struct fb_con2fbmap *con2fb; - struct fb_blit_caps *caps; int idx, ret = 0; switch(action) { @@ -3348,10 +3347,6 @@ static int fbcon_event_notify(struct notifier_block *self, case FB_EVENT_BLANK: fbcon_fb_blanked(info, *(int *)event->data); break; - case FB_EVENT_GET_REQ: - caps = event->data; - fbcon_get_requirement(info, caps); - break; case FB_EVENT_REMAP_ALL_CONSOLE: idx = info->node; fbcon_remap_all(idx); diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index cbdd141e7695..ddc0c16b8bbf 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -932,16 +932,13 @@ EXPORT_SYMBOL(fb_pan_display); static int fb_check_caps(struct fb_info *info, struct fb_var_screeninfo *var, u32 activate) { - struct fb_event event; struct fb_blit_caps caps, fbcaps; int err = 0; memset(&caps, 0, sizeof(caps)); memset(&fbcaps, 0, sizeof(fbcaps)); caps.flags = (activate & FB_ACTIVATE_ALL) ? 1 : 0; - event.info = info; - event.data = ∩︀ - fb_notifier_call_chain(FB_EVENT_GET_REQ, &event); + fbcon_get_requirement(info, &caps); info->fbops->fb_get_caps(info, &fbcaps, var); if (((fbcaps.x ^ caps.x) & caps.x) || diff --git a/include/linux/fb.h b/include/linux/fb.h index 7a788ed8c7b5..0d86aa31bf8d 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -143,8 +143,6 @@ struct fb_cursor_user { #define FB_EVENT_MODE_CHANGE_ALL 0x0B /* A software display blank change occurred */ #define FB_EVENT_CONBLANK 0x0C -/* Get drawing requirements*/ -#define FB_EVENT_GET_REQ0x0D /* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */ #define FB_EVENT_REMAP_ALL_CONSOLE 0x0F /* A hardware display blank early change occurred */ diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h index c139834342f5..305e4f2eddac 100644 --- a/include/linux/fbcon.h +++ b/include/linux/fbcon.h @@ -12,6 +12,8 @@ void fbcon_resumed(struct fb_info *info); int fbcon_mode_deleted(struct fb_info *info, struct fb_videomode *mode); void fbcon_new_modelist(struct fb_info *info); +void fbcon_get_requirement(struct fb_info *info, + struct fb_blit_caps *caps); #else static inline void fb_console_init(void) {} static inline void fb_console_exit(void) {} @@ -23,6 +25,8 @@ static inline void fbcon_resumed(struct fb_info *info) {} static inline int fbcon_mode_deleted(struct fb_info *info, struct fb_videomode *mode) { return 0; } static inline void fbcon_new_modelist(struct fb_info *info) {} +static inline void fbcon_get_requirement(struct fb_info *info, +struct fb_blit_caps *caps) {} #endif #endif /* _LINUX_FBCON_H */ -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 19/33] fbdev: unify unlink_framebuffer paths
For some reasons the pm_vt_switch_unregister call was missing from the direct unregister_framebuffer path. Fix this. v2: fbinfo->dev is used to decided whether unlink_framebuffer has been called already. I botched that in v1. Make this all clearer by inlining __unlink_framebuffer. v3: Fix typoe in subject (Maarten). Signed-off-by: Daniel Vetter Cc: Maarten Lankhorst Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: "Michał Mirosław" Cc: Peter Rosin Cc: Hans de Goede Cc: Mikulas Patocka --- drivers/video/fbdev/core/fbmem.c | 47 ++-- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index f3bcad30d3ba..bee45e9405b8 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1722,15 +1722,30 @@ static void unbind_console(struct fb_info *fb_info) console_unlock(); } -static void __unlink_framebuffer(struct fb_info *fb_info); - -static void do_unregister_framebuffer(struct fb_info *fb_info) +void unlink_framebuffer(struct fb_info *fb_info) { - unbind_console(fb_info); + int i; + + i = fb_info->node; + if (WARN_ON(i < 0 || i >= FB_MAX || registered_fb[i] != fb_info)) + return; + + if (!fb_info->dev) + return; + + device_destroy(fb_class, MKDEV(FB_MAJOR, i)); pm_vt_switch_unregister(fb_info->dev); - __unlink_framebuffer(fb_info); + unbind_console(fb_info); + + fb_info->dev = NULL; +} +EXPORT_SYMBOL(unlink_framebuffer); + +static void do_unregister_framebuffer(struct fb_info *fb_info) +{ + unlink_framebuffer(fb_info); if (fb_info->pixmap.addr && (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT)) kfree(fb_info->pixmap.addr); @@ -1753,28 +1768,6 @@ static void do_unregister_framebuffer(struct fb_info *fb_info) put_fb_info(fb_info); } -static void __unlink_framebuffer(struct fb_info *fb_info) -{ - int i; - - i = fb_info->node; - if (WARN_ON(i < 0 || i >= FB_MAX || registered_fb[i] != fb_info)) - return; - - if (fb_info->dev) { - device_destroy(fb_class, MKDEV(FB_MAJOR, i)); - fb_info->dev = NULL; - } -} - -void unlink_framebuffer(struct fb_info *fb_info) -{ - __unlink_framebuffer(fb_info); - - unbind_console(fb_info); -} -EXPORT_SYMBOL(unlink_framebuffer); - /** * remove_conflicting_framebuffers - remove firmware-configured framebuffers * @a: memory range, users of which are to be removed -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 32/33] staging/olpc_dcon: Add drm conversion to TODO
this driver is pretty horrible from a design pov, and needs a complete overhaul. Concrete thing that annoys me is that it looks at registered_fb, which is an internal thing to fbmem.c and fbcon.c. And ofc it gets the lifetime rules all wrong (it should at least use get/put_fb_info). Looking at the history, there's been an attempt at dropping this from staging in 2016, but that had to be reverted. Since then not real effort except the usual stream of trivial patches, and fbdev has been formally closed for any new hw support. Time to try again and drop this? Signed-off-by: Daniel Vetter Cc: Jens Frederich Cc: Daniel Drake Cc: Jon Nettleton --- drivers/staging/olpc_dcon/TODO | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/staging/olpc_dcon/TODO b/drivers/staging/olpc_dcon/TODO index 665a0b061719..fe09efbc7f77 100644 --- a/drivers/staging/olpc_dcon/TODO +++ b/drivers/staging/olpc_dcon/TODO @@ -1,4 +1,11 @@ TODO: + - complete rewrite: + 1. The underlying fbdev drivers need to be converted into drm kernel +modesetting drivers. + 2. The dcon low-power display mode can then be integrated using the +drm damage tracking and self-refresh helpers. + This bolted-on self-refresh support that digs around in fbdev + internals, but isn't properly integrated, is not the correct solution. - see if vx855 gpio API can be made similar enough to cs5535 so we can share more code - convert all uses of the old GPIO API from to the -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 27/33] fb: Flatten control flow in fb_set_var
Instead of wiring almost everything down to the very last line using goto soup (but not consistently, where would the fun be otherwise) drop out early when checks fail. This allows us to flatten the huge indent levels to just 1. Aside: If a driver doesn't set ->fb_check_var, then FB_ACTIVATE_NOW does nothing. This bug exists ever since this code was extracted as a common helper in 2002, hence I decided against fixing it. Everyone just better have a fb_check_var to make sure things work correctly. Signed-off-by: Daniel Vetter Cc: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: "Michał Mirosław" Cc: Peter Rosin Cc: Hans de Goede Cc: Mikulas Patocka --- drivers/video/fbdev/core/fbmem.c | 126 +++ 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 25ae466ba593..96805fe85332 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -954,6 +954,9 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) { int flags = info->flags; int ret = 0; + u32 activate; + struct fb_var_screeninfo old_var; + struct fb_videomode mode; if (var->activate & FB_ACTIVATE_INV_MODE) { struct fb_videomode mode1, mode2; @@ -970,87 +973,84 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) fb_delete_videomode(&mode1, &info->modelist); - ret = (ret) ? -EINVAL : 0; - goto done; + return ret ? -EINVAL : 0; } - if ((var->activate & FB_ACTIVATE_FORCE) || - memcmp(&info->var, var, sizeof(struct fb_var_screeninfo))) { - u32 activate = var->activate; + if (!(var->activate & FB_ACTIVATE_FORCE) && + !memcmp(&info->var, var, sizeof(struct fb_var_screeninfo))) + return 0; - /* When using FOURCC mode, make sure the red, green, blue and -* transp fields are set to 0. -*/ - if ((info->fix.capabilities & FB_CAP_FOURCC) && - var->grayscale > 1) { - if (var->red.offset || var->green.offset|| - var->blue.offset|| var->transp.offset || - var->red.length || var->green.length|| - var->blue.length|| var->transp.length || - var->red.msb_right || var->green.msb_right || - var->blue.msb_right || var->transp.msb_right) - return -EINVAL; - } + activate = var->activate; - if (!info->fbops->fb_check_var) { - *var = info->var; - goto done; - } + /* When using FOURCC mode, make sure the red, green, blue and +* transp fields are set to 0. +*/ + if ((info->fix.capabilities & FB_CAP_FOURCC) && + var->grayscale > 1) { + if (var->red.offset || var->green.offset|| + var->blue.offset|| var->transp.offset || + var->red.length || var->green.length|| + var->blue.length|| var->transp.length || + var->red.msb_right || var->green.msb_right || + var->blue.msb_right || var->transp.msb_right) + return -EINVAL; + } - ret = info->fbops->fb_check_var(var, info); + if (!info->fbops->fb_check_var) { + *var = info->var; + return 0; + } - if (ret) - goto done; + ret = info->fbops->fb_check_var(var, info); - if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) { - struct fb_var_screeninfo old_var; - struct fb_videomode mode; + if (ret) + return ret; - if (info->fbops->fb_get_caps) { - ret = fb_check_caps(info, var, activate); + if ((var->activate & FB_ACTIVATE_MASK) != FB_ACTIVATE_NOW) + return 0; - if (ret) - goto done; - } + if (info->fbops->fb_get_caps) { + ret = fb_check_caps(info, var, activate); - old_var = info->var; - info->var = *var; + if (ret) + return ret; + } - if (info->fbops->fb_set_par) { - ret = info->fbops->fb_set_par(info); + old_var = info->var; + info->var = *var; - if (ret) { - info->var = old_var; -
[Intel-gfx] [PATCH 25/33] fbmem: pull fbcon_fb_blanked out of fb_blank
There's a callchain of: fbcon_fb_blaned -> do_(un)blank_screen -> consw->con_blank -> fbcon_blank -> fb_blank Things don't go horribly wrong because the BKL console_lock safes the day, but that's about it. And the seeming recursion is broken in 2 ways: - Starting from the fbdev ioctl we set FBINFO_MISC_USEREVENT, which tells the fbcon_blank code to not call fb_blank. This was required to not deadlock when recursing on the fb_notifier_chain mutex. - Starting from the con_blank hook we're getting saved by the console_blanked checks in do_blank/unblank_screen. Or at least that's my theory. Anyway, recursion isn't awesome, so let's stop it. Breaking the recursion avoids the need to be in the FBINFO_MISC_USEREVENT critical section, so lets move it out of that too. The astute reader will notice that fb_blank seems to require lock_fb_info(), which the fbcon code seems to ignore. I have no idea how to fix that problem, so let's keep ignoring it. v2: I forgot the sysfs blanking code. Signed-off-by: Daniel Vetter Cc: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: "Michał Mirosław" Cc: Peter Rosin Cc: Hans de Goede Cc: Mikulas Patocka Cc: Rob Clark --- drivers/video/fbdev/core/fbmem.c | 4 +++- drivers/video/fbdev/core/fbsysfs.c | 8 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 9366fbe99a58..d6713dce9e31 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1068,7 +1068,6 @@ fb_blank(struct fb_info *info, int blank) event.data = ␣ early_ret = fb_notifier_call_chain(FB_EARLY_EVENT_BLANK, &event); - fbcon_fb_blanked(info, blank); if (info->fbops->fb_blank) ret = info->fbops->fb_blank(blank, info); @@ -1198,6 +1197,9 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, info->flags |= FBINFO_MISC_USEREVENT; ret = fb_blank(info, arg); info->flags &= ~FBINFO_MISC_USEREVENT; + + /* might again call into fb_blank */ + fbcon_fb_blanked(info, arg); unlock_fb_info(info); console_unlock(); break; diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c index 5f329278e55f..252d4f52d2a5 100644 --- a/drivers/video/fbdev/core/fbsysfs.c +++ b/drivers/video/fbdev/core/fbsysfs.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -305,12 +306,15 @@ static ssize_t store_blank(struct device *device, { struct fb_info *fb_info = dev_get_drvdata(device); char *last = NULL; - int err; + int err, arg; + arg = simple_strtoul(buf, &last, 0); console_lock(); fb_info->flags |= FBINFO_MISC_USEREVENT; - err = fb_blank(fb_info, simple_strtoul(buf, &last, 0)); + err = fb_blank(fb_info, arg); fb_info->flags &= ~FBINFO_MISC_USEREVENT; + /* might again call into fb_blank */ + fbcon_fb_blanked(fb_info, arg); console_unlock(); if (err < 0) return err; -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 26/33] fbdev: remove FBINFO_MISC_USEREVENT around fb_blank
With the recursion broken in the previous patch we can drop the FBINFO_MISC_USEREVENT flag around calls to fb_blank - recursion prevention was it's only job. Signed-off-by: Daniel Vetter Cc: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Hans de Goede Cc: Yisheng Xie Cc: "Michał Mirosław" Cc: Peter Rosin Cc: Mikulas Patocka Cc: Rob Clark --- drivers/video/fbdev/core/fbcon.c | 5 ++--- drivers/video/fbdev/core/fbmem.c | 3 --- drivers/video/fbdev/core/fbsysfs.c | 2 -- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index d9f545f1a81b..8a67505167ae 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -2386,9 +2386,8 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW); ops->cursor_flash = (!blank); - if (!(info->flags & FBINFO_MISC_USEREVENT)) - if (fb_blank(info, blank)) - fbcon_generic_blank(vc, info, blank); + if (fb_blank(info, blank)) + fbcon_generic_blank(vc, info, blank); } if (!blank) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index d6713dce9e31..25ae466ba593 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1194,10 +1194,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, case FBIOBLANK: console_lock(); lock_fb_info(info); - info->flags |= FBINFO_MISC_USEREVENT; ret = fb_blank(info, arg); - info->flags &= ~FBINFO_MISC_USEREVENT; - /* might again call into fb_blank */ fbcon_fb_blanked(info, arg); unlock_fb_info(info); diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c index 252d4f52d2a5..882b471d619e 100644 --- a/drivers/video/fbdev/core/fbsysfs.c +++ b/drivers/video/fbdev/core/fbsysfs.c @@ -310,9 +310,7 @@ static ssize_t store_blank(struct device *device, arg = simple_strtoul(buf, &last, 0); console_lock(); - fb_info->flags |= FBINFO_MISC_USEREVENT; err = fb_blank(fb_info, arg); - fb_info->flags &= ~FBINFO_MISC_USEREVENT; /* might again call into fb_blank */ fbcon_fb_blanked(fb_info, arg); console_unlock(); -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 29/33] vgaswitcheroo: call fbcon_remap_all directly
While at it, clean up the interface a bit and push the console locking into fbcon.c. v2: Remove now outdated comment (Lukas). v3: Forgot to add static inline to the dummy function. Acked-by: Lukas Wunner Signed-off-by: Daniel Vetter Cc: Lukas Wunner Cc: David Airlie Cc: Daniel Vetter Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Sean Paul Cc: Bartlomiej Zolnierkiewicz Cc: Hans de Goede Cc: Yisheng Xie Cc: linux-fb...@vger.kernel.org --- drivers/gpu/vga/vga_switcheroo.c | 11 +++ drivers/video/fbdev/core/fbcon.c | 14 +- include/linux/fb.h | 2 -- include/linux/fbcon.h| 2 ++ 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c index a132c37d7334..65d7541c413a 100644 --- a/drivers/gpu/vga/vga_switcheroo.c +++ b/drivers/gpu/vga/vga_switcheroo.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -736,14 +737,8 @@ static int vga_switchto_stage2(struct vga_switcheroo_client *new_client) if (!active->driver_power_control) set_audio_state(active->id, VGA_SWITCHEROO_OFF); - if (new_client->fb_info) { - struct fb_event event; - - console_lock(); - event.info = new_client->fb_info; - fb_notifier_call_chain(FB_EVENT_REMAP_ALL_CONSOLE, &event); - console_unlock(); - } + if (new_client->fb_info) + fbcon_remap_all(new_client->fb_info); mutex_lock(&vgasr_priv.mux_hw_lock); ret = vgasr_priv.handler->switchto(new_client->id); diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index a07c261da53a..e08e984e2511 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3149,17 +3149,16 @@ void fbcon_fb_unregistered(struct fb_info *info) do_unregister_con_driver(&fb_con); } -/* called with console_lock held */ -static void fbcon_remap_all(int idx) +void fbcon_remap_all(struct fb_info *info) { - int i; - - WARN_CONSOLE_UNLOCKED(); + int i, idx = info->node; + console_lock(); if (deferred_takeover) { for (i = first_fb_vc; i <= last_fb_vc; i++) con2fb_map_boot[i] = idx; fbcon_map_override(); + console_unlock(); return; } @@ -3172,6 +3171,7 @@ static void fbcon_remap_all(int idx) first_fb_vc + 1, last_fb_vc + 1); info_idx = idx; } + console_unlock(); } #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY @@ -3337,10 +3337,6 @@ static int fbcon_event_notify(struct notifier_block *self, con2fb = event->data; con2fb->framebuffer = con2fb_map[con2fb->console - 1]; break; - case FB_EVENT_REMAP_ALL_CONSOLE: - idx = info->node; - fbcon_remap_all(idx); - break; } return ret; } diff --git a/include/linux/fb.h b/include/linux/fb.h index f9c212f9b661..25e4b885f5b3 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -139,8 +139,6 @@ struct fb_cursor_user { #define FB_EVENT_SET_CONSOLE_MAP0x08 /* A display blank is requested */ #define FB_EVENT_BLANK 0x09 -/* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */ -#define FB_EVENT_REMAP_ALL_CONSOLE 0x0F /* A hardware display blank early change occurred */ #define FB_EARLY_EVENT_BLANK 0x10 /* A hardware display blank revert early change occurred */ diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h index de31eeb22c97..69f900d289b2 100644 --- a/include/linux/fbcon.h +++ b/include/linux/fbcon.h @@ -16,6 +16,7 @@ void fbcon_get_requirement(struct fb_info *info, struct fb_blit_caps *caps); void fbcon_fb_blanked(struct fb_info *info, int blank); void fbcon_update_vcs(struct fb_info *info, bool all); +void fbcon_remap_all(struct fb_info *info); #else static inline void fb_console_init(void) {} static inline void fb_console_exit(void) {} @@ -31,6 +32,7 @@ static inline void fbcon_get_requirement(struct fb_info *info, struct fb_blit_caps *caps) {} static inline void fbcon_fb_blanked(struct fb_info *info, int blank) {} static inline void fbcon_update_vcs(struct fb_info *info, bool all) {} +static inline void fbcon_remap_all(struct fb_info *info) {} #endif #endif /* _LINUX_FBCON_H */ -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PULL] drm-misc-next, v2!
drm-misc-next-2019-05-24: drm-misc-next for v5.3, try #2: Cross-subsystem Changes: - Fix device tree bindings in drm-misc-next after a botched merge. Core Changes: - Docbook fix for drm_hdmi_infoframe_set_hdr_metadata. Driver Changes: - mediatek: Fix compiler warning after merging the HDR series. - vc4: Rework binner bo handling. drm-misc-next-2019-05-23: drm-misc-next for v5.3: UAPI Changes: - Add HDR source metadata property. - Make drm.h compile on GNU/kFreeBSD by including stdint.h - Clarify how the userspace reviewer has to review new kernel UAPI. - Clarify that for using new UAPI, merging to drm-next or drm-misc-next should be enough. Cross-subsystem Changes: - video/hdmi: Add unpack function for DRM infoframes. - Device tree bindings: * Updating a property for Mali Midgard GPUs * Updating a property for STM32 DSI panel * Adding support for FriendlyELEC HD702E 800x1280 panel * Adding support for Evervision VGG804821 800x480 5.0" WVGA TFT panel * Adding support for the EDT ET035012DM6 3.5" 320x240 QVGA 24-bit RGB TFT. * Adding support for Three Five displays TFC S9700RTWV43TR-01B 800x480 panel with resistive touch found on TI's AM335X-EVM. * Adding support for EDT ETM0430G0DH6 480x272 panel. - Add OSD101T2587-53TS driver with DT bindings. - Add Samsung S6E63M0 panel driver with DT bindings. - Add VXT VL050-8048NT-C01 800x480 panel with DT bindings. - Dma-buf: - Make mmap callback actually optional. - Documentation updates. - Fix debugfs refcount inbalance. - Remove unused sync_dump function. Core Changes: - Add support for HDR infoframes and related EDID parsing. - Remove prime sg_table caching, now done inside dma-buf. - Add shiny new drm_gem_vram helpers for simple VRAM drivers; with some fixes to the new API on top. - Small fix to job cleanup without timeout handler. - Documentation fixes to drm_fourcc. - Replace lookups of drm_format with struct drm_format_info; remove functions that become obsolete by this conversion. - Remove double include in bridge/panel.c and some drivers. - Remove drmP.h include from drm/edid and drm/dp. - Fix null pointer deref in drm_fb_helper_hotplug_event(). - Remove most members from drm_fb_helper_crtc, only mode_set is kept. - Remove race of fb helpers with userspace; only restore mode when userspace is not master. - Move legacy setup from drm_file.c to drm_legacy_misc.c - Rework scheduler job destruction. - drm/bus was removed, remove from TODO. - Add __drm_atomic_helper_crtc_reset() to subclass crtc_state, and convert some drivers to use it (conversion is not complete yet). - Bump vblank timeout wait to 100 ms for atomic. Driver Changes: - sun4i: Use DRM_GEM_CMA_VMAP_DRIVER_OPS instead of definining manually. - v3d: Small cleanups, adding support for compute shaders, reservation/synchronization fixes and job management refactoring, fixes MMU and debugfs. - lima: Fix null pointer in irq handler on startup, set default timeout for scheduled jobs. - stm/ltdc: Assorted fixes and adding FB modifier support. - amdgpu: Avoid hw reset if guilty job was already signaled. - virtio: Add seqno to fences, add trace events, use correct flags for fence allocation. - Convert AST, bochs, mgag200, vboxvideo, hisilicon to the new drm_gem_vram API. - sun6i_mipi_dsi: Support DSI GENERIC_SHORT_WRITE_2 transfers. - bochs: Small fix to use PTR_RET_OR_ZERO and driver unload. - gma500: header fixes - cirrus: Remove unused files. The following changes since commit a188339ca5a396acc588e5851ed7e19f66b0ebd9: Linux 5.2-rc1 (2019-05-19 15:47:09 -0700) are available in the Git repository at: git://anongit.freedesktop.org/drm/drm-misc tags/drm-misc-next-2019-05-24 for you to fetch changes up to 909fa3321d348ef69366aad9e84e1dd9ee0bd060: dt-bindings: fix up for vendor prefixes file conversion (2019-05-24 09:13:52 +0200) Andreas Pretzsch (1): drm/panel: simple: Add support for EDT ET035012DM6 Andrew F. Davis (3): dma-buf: Remove leftover [un]map_atomic comments dma-buf: Update [un]map documentation to match the other functions dma-buf: Make mmap callback actually optional Andrey Grodzovsky (3): drm/sched: Keep s_fence->parent pointer drm/scheduler: Add flag to hint the release of guilty job. drm/amdgpu: Avoid HW reset if guilty job already signaled. Chia-I Wu (4): drm/virtio: set seqno for dma-fence drm/virtio: trace drm_fence_emit drm/virtio: add trace events for commands drm/virtio: allocate fences with GFP_KERNEL Chris Wilson (1): dma-buf: Remove unused sync_dump() Christian König (4): drm/scheduler: rework job destruction MAINTAINERS: drop Jerry as TTM maintainer dma-buf: start caching of sg_table objects v2 drm: remove prime sg_table caching Clément Péron (2): drm: panfrost: add optional bus_clock dt-bindings: gpu: mali-midgard: Add H6 m
[Intel-gfx] [PATCH 21/33] fbdev: directly call fbcon_suspended/resumed
With the sh_mobile notifier removed we can just directly call the fbcon code here. v2: Remove now unused local variable. v3: fixup !CONFIG_FRAMEBUFFER_CONSOLE, noticed by kbuild Signed-off-by: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: Hans de Goede Cc: Greg Kroah-Hartman Cc: Prarit Bhargava Cc: Kees Cook Cc: Konstantin Khorenko Cc: Yisheng Xie Cc: "Michał Mirosław" Cc: Peter Rosin Cc: Mikulas Patocka Cc: linux-fb...@vger.kernel.org --- drivers/video/fbdev/core/fbcon.c | 10 ++ drivers/video/fbdev/core/fbmem.c | 7 ++- include/linux/fb.h | 8 include/linux/fbcon.h| 4 4 files changed, 8 insertions(+), 21 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index f114b4c88796..24ea6e4fbee0 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -2919,7 +2919,7 @@ static int fbcon_set_origin(struct vc_data *vc) return 0; } -static void fbcon_suspended(struct fb_info *info) +void fbcon_suspended(struct fb_info *info) { struct vc_data *vc = NULL; struct fbcon_ops *ops = info->fbcon_par; @@ -2932,7 +2932,7 @@ static void fbcon_suspended(struct fb_info *info) fbcon_cursor(vc, CM_ERASE); } -static void fbcon_resumed(struct fb_info *info) +void fbcon_resumed(struct fb_info *info) { struct vc_data *vc; struct fbcon_ops *ops = info->fbcon_par; @@ -3330,12 +3330,6 @@ static int fbcon_event_notify(struct notifier_block *self, int idx, ret = 0; switch(action) { - case FB_EVENT_SUSPEND: - fbcon_suspended(info); - break; - case FB_EVENT_RESUME: - fbcon_resumed(info); - break; case FB_EVENT_MODE_CHANGE: fbcon_modechanged(info); break; diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index bee45e9405b8..73269dedcd45 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1917,17 +1917,14 @@ EXPORT_SYMBOL(unregister_framebuffer); */ void fb_set_suspend(struct fb_info *info, int state) { - struct fb_event event; - WARN_CONSOLE_UNLOCKED(); - event.info = info; if (state) { - fb_notifier_call_chain(FB_EVENT_SUSPEND, &event); + fbcon_suspended(info); info->state = FBINFO_STATE_SUSPENDED; } else { info->state = FBINFO_STATE_RUNNING; - fb_notifier_call_chain(FB_EVENT_RESUME, &event); + fbcon_resumed(info); } } EXPORT_SYMBOL(fb_set_suspend); diff --git a/include/linux/fb.h b/include/linux/fb.h index b90cf7d56bd8..794b386415b7 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -126,14 +126,6 @@ struct fb_cursor_user { /* The resolution of the passed in fb_info about to change */ #define FB_EVENT_MODE_CHANGE 0x01 -/* The display on this fb_info is being suspended, no access to the - * framebuffer is allowed any more after that call returns - */ -#define FB_EVENT_SUSPEND 0x02 -/* The display on this fb_info was resumed, you can restore the display - * if you own it - */ -#define FB_EVENT_RESUME0x03 /* An entry from the modelist was removed */ #define FB_EVENT_MODE_DELETE0x04 diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h index 38d44fdb6d14..790c42ec7b5d 100644 --- a/include/linux/fbcon.h +++ b/include/linux/fbcon.h @@ -7,12 +7,16 @@ void __exit fb_console_exit(void); int fbcon_fb_registered(struct fb_info *info); void fbcon_fb_unregistered(struct fb_info *info); void fbcon_fb_unbind(struct fb_info *info); +void fbcon_suspended(struct fb_info *info); +void fbcon_resumed(struct fb_info *info); #else static inline void fb_console_init(void) {} static inline void fb_console_exit(void) {} static inline int fbcon_fb_registered(struct fb_info *info) { return 0; } static inline void fbcon_fb_unregistered(struct fb_info *info) {} static inline void fbcon_fb_unbind(struct fb_info *info) {} +static inline void fbcon_suspended(struct fb_info *info) {} +static inline void fbcon_resumed(struct fb_info *info) {} #endif #endif /* _LINUX_FBCON_H */ -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 28/33] fbcon: replace FB_EVENT_MODE_CHANGE/_ALL with direct calls
Create a new wrapper function for this, feels like there's some refactoring room here between the two modes. v2: backlight notifier is also interested in the mode change event, it calls lcd->set_mode, of which there are 3 implementations. Thanks to Maarten for spotting this. So we keep that. We can ditch the differentiation between mode change and all mode changes (because backlight notifier doesn't care), and we can drop the FBINFO_MISC_USEREVENT stuff too, because that's just to prevent recursion between fbmem.c and fbcon.c. While at it flatten the control flow a bit. v3: Need to add a static inline to the dummy function. Signed-off-by: Daniel Vetter Cc: Maarten Lankhorst Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: Hans de Goede Cc: Yisheng Xie Cc: "Michał Mirosław" Cc: Peter Rosin Cc: Mikulas Patocka Cc: linux-fb...@vger.kernel.org --- drivers/video/backlight/lcd.c | 1 - drivers/video/fbdev/core/fbcon.c | 15 +-- drivers/video/fbdev/core/fbmem.c | 21 ++--- drivers/video/fbdev/sh_mobile_lcdcfb.c | 11 +-- include/linux/fb.h | 2 -- include/linux/fbcon.h | 2 ++ 6 files changed, 22 insertions(+), 30 deletions(-) diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c index 4b40c6a4d441..a758039475d0 100644 --- a/drivers/video/backlight/lcd.c +++ b/drivers/video/backlight/lcd.c @@ -33,7 +33,6 @@ static int fb_notifier_callback(struct notifier_block *self, switch (event) { case FB_EVENT_BLANK: case FB_EVENT_MODE_CHANGE: - case FB_EVENT_MODE_CHANGE_ALL: case FB_EARLY_EVENT_BLANK: case FB_R_EARLY_EVENT_BLANK: break; diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 8a67505167ae..a07c261da53a 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3009,6 +3009,15 @@ static void fbcon_set_all_vcs(struct fb_info *info) fbcon_modechanged(info); } + +void fbcon_update_vcs(struct fb_info *info, bool all) +{ + if (all) + fbcon_set_all_vcs(info); + else + fbcon_modechanged(info); +} + int fbcon_mode_deleted(struct fb_info *info, struct fb_videomode *mode) { @@ -3318,12 +3327,6 @@ static int fbcon_event_notify(struct notifier_block *self, int idx, ret = 0; switch(action) { - case FB_EVENT_MODE_CHANGE: - fbcon_modechanged(info); - break; - case FB_EVENT_MODE_CHANGE_ALL: - fbcon_set_all_vcs(info); - break; case FB_EVENT_SET_CONSOLE_MAP: /* called with console lock held */ con2fb = event->data; diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 96805fe85332..dd1a708df1a7 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -957,6 +957,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) u32 activate; struct fb_var_screeninfo old_var; struct fb_videomode mode; + struct fb_event event; if (var->activate & FB_ACTIVATE_INV_MODE) { struct fb_videomode mode1, mode2; @@ -1039,19 +1040,17 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) !list_empty(&info->modelist)) ret = fb_add_videomode(&mode, &info->modelist); - if (!ret && (flags & FBINFO_MISC_USEREVENT)) { - struct fb_event event; - int evnt = (activate & FB_ACTIVATE_ALL) ? - FB_EVENT_MODE_CHANGE_ALL : - FB_EVENT_MODE_CHANGE; + if (ret) + return ret; - info->flags &= ~FBINFO_MISC_USEREVENT; - event.info = info; - event.data = &mode; - fb_notifier_call_chain(evnt, &event); - } + event.info = info; + event.data = &mode; + fb_notifier_call_chain(FB_EVENT_MODE_CHANGE, &event); - return ret; + if (flags & FBINFO_MISC_USEREVENT) + fbcon_update_vcs(info, activate & FB_ACTIVATE_ALL); + + return 0; } EXPORT_SYMBOL(fb_set_var); diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c index 0d7a044852d7..bb1a610d0363 100644 --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c @@ -1776,8 +1776,6 @@ static void sh_mobile_fb_reconfig(struct fb_info *info) struct sh_mobile_lcdc_chan *ch = info->par; struct fb_var_screeninfo var; struct fb_videomode mode; - struct fb_event event; - int evnt = FB_EVENT_MODE_CHANGE_ALL; if (ch->use_count > 1 || (ch->use_count == 1 && !info->fbcon_par)) /* More framebuffer users are active */ @@ -
[Intel-gfx] [PATCH 24/33] Revert "backlight/fbcon: Add FB_EVENT_CONBLANK"
This reverts commit 994efacdf9a087b52f71e620b58dfa526b0cf928. The justification is that if hw blanking fails (i.e. fbops->fb_blank) fails, then we still want to shut down the backlight. Which is exactly _not_ what fb_blank() does and so rather inconsistent if we end up with different behaviour between fbcon and direct fbdev usage. Given that the entire notifier maze is getting in the way anyway I figured it's simplest to revert this not well justified commit. v2: Add static inline to the dummy version. Cc: Richard Purdie Signed-off-by: Daniel Vetter Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: Hans de Goede Cc: Yisheng Xie Cc: linux-fb...@vger.kernel.org --- drivers/video/backlight/backlight.c | 2 +- drivers/video/fbdev/core/fbcon.c| 14 +- drivers/video/fbdev/core/fbmem.c| 1 + include/linux/fb.h | 4 +--- include/linux/fbcon.h | 2 ++ 5 files changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index deb824bef6e2..c55590ec0057 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -46,7 +46,7 @@ static int fb_notifier_callback(struct notifier_block *self, int fb_blank = 0; /* If we aren't interested in this event, skip it immediately ... */ - if (event != FB_EVENT_BLANK && event != FB_EVENT_CONBLANK) + if (event != FB_EVENT_BLANK) return 0; bd = container_of(self, struct backlight_device, fb_notif); diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 259cdd118475..d9f545f1a81b 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -2350,8 +2350,6 @@ static int fbcon_switch(struct vc_data *vc) static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, int blank) { - struct fb_event event; - if (blank) { unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; @@ -2362,13 +2360,6 @@ static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, fbcon_clear(vc, 0, 0, vc->vc_rows, vc->vc_cols); vc->vc_video_erase_char = oldc; } - - - lock_fb_info(info); - event.info = info; - event.data = ␣ - fb_notifier_call_chain(FB_EVENT_CONBLANK, &event); - unlock_fb_info(info); } static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) @@ -3240,7 +3231,7 @@ int fbcon_fb_registered(struct fb_info *info) return ret; } -static void fbcon_fb_blanked(struct fb_info *info, int blank) +void fbcon_fb_blanked(struct fb_info *info, int blank) { struct fbcon_ops *ops = info->fbcon_par; struct vc_data *vc; @@ -3344,9 +3335,6 @@ static int fbcon_event_notify(struct notifier_block *self, con2fb = event->data; con2fb->framebuffer = con2fb_map[con2fb->console - 1]; break; - case FB_EVENT_BLANK: - fbcon_fb_blanked(info, *(int *)event->data); - break; case FB_EVENT_REMAP_ALL_CONSOLE: idx = info->node; fbcon_remap_all(idx); diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index ddc0c16b8bbf..9366fbe99a58 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1068,6 +1068,7 @@ fb_blank(struct fb_info *info, int blank) event.data = ␣ early_ret = fb_notifier_call_chain(FB_EARLY_EVENT_BLANK, &event); + fbcon_fb_blanked(info, blank); if (info->fbops->fb_blank) ret = info->fbops->fb_blank(blank, info); diff --git a/include/linux/fb.h b/include/linux/fb.h index 0d86aa31bf8d..1e66fac3124f 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -137,12 +137,10 @@ struct fb_cursor_user { #define FB_EVENT_GET_CONSOLE_MAP0x07 /* CONSOLE-SPECIFIC: set console to framebuffer mapping */ #define FB_EVENT_SET_CONSOLE_MAP0x08 -/* A hardware display blank change occurred */ +/* A display blank is requested */ #define FB_EVENT_BLANK 0x09 /* Private modelist is to be replaced */ #define FB_EVENT_MODE_CHANGE_ALL 0x0B -/* A software display blank change occurred */ -#define FB_EVENT_CONBLANK 0x0C /* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */ #define FB_EVENT_REMAP_ALL_CONSOLE 0x0F /* A hardware display blank early change occurred */ diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h index 305e4f2eddac..d67d7ec51ef9 100644 --- a/include/linux/fbcon.h +++ b/include/linux/fbcon.h @@ -14,6 +14,7 @@ int fbcon_mode_deleted(struct fb_info *info, void fbcon_new_modelist(struct fb_info *info); void f
[Intel-gfx] [PATCH 11/33] fbdev/sh_mobile: remove sh_mobile_lcdc_display_notify
It's dead code, and removing it avoids me having to understand what it's doing with lock_fb_info. Signed-off-by: Daniel Vetter Reviewed-by: Geert Uytterhoeven Cc: Geert Uytterhoeven Cc: Daniel Vetter --- drivers/video/fbdev/sh_mobile_lcdcfb.c | 63 -- drivers/video/fbdev/sh_mobile_lcdcfb.h | 5 -- 2 files changed, 68 deletions(-) diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c index dc46be38c970..c5924f5e98c6 100644 --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c @@ -556,67 +556,6 @@ sh_mobile_lcdc_must_reconfigure(struct sh_mobile_lcdc_chan *ch, static int sh_mobile_lcdc_check_var(struct fb_var_screeninfo *var, struct fb_info *info); -static int sh_mobile_lcdc_display_notify(struct sh_mobile_lcdc_chan *ch, -enum sh_mobile_lcdc_entity_event event, -const struct fb_videomode *mode, -const struct fb_monspecs *monspec) -{ - struct fb_info *info = ch->info; - struct fb_var_screeninfo var; - int ret = 0; - - switch (event) { - case SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT: - /* HDMI plug in */ - console_lock(); - if (lock_fb_info(info)) { - - - ch->display.width = monspec->max_x * 10; - ch->display.height = monspec->max_y * 10; - - if (!sh_mobile_lcdc_must_reconfigure(ch, mode) && - info->state == FBINFO_STATE_RUNNING) { - /* First activation with the default monitor. -* Just turn on, if we run a resume here, the -* logo disappears. -*/ - info->var.width = ch->display.width; - info->var.height = ch->display.height; - sh_mobile_lcdc_display_on(ch); - } else { - /* New monitor or have to wake up */ - fb_set_suspend(info, 0); - } - - - unlock_fb_info(info); - } - console_unlock(); - break; - - case SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT: - /* HDMI disconnect */ - console_lock(); - if (lock_fb_info(info)) { - fb_set_suspend(info, 1); - unlock_fb_info(info); - } - console_unlock(); - break; - - case SH_MOBILE_LCDC_EVENT_DISPLAY_MODE: - /* Validate a proposed new mode */ - fb_videomode_to_var(&var, mode); - var.bits_per_pixel = info->var.bits_per_pixel; - var.grayscale = info->var.grayscale; - ret = sh_mobile_lcdc_check_var(&var, info); - break; - } - - return ret; -} - /* - * Format helpers */ @@ -2540,8 +2479,6 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch) unsigned int max_size; unsigned int i; - ch->notify = sh_mobile_lcdc_display_notify; - /* Validate the format. */ format = sh_mobile_format_info(cfg->fourcc); if (format == NULL) { diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.h b/drivers/video/fbdev/sh_mobile_lcdcfb.h index b8e47a8bd8ab..589400372098 100644 --- a/drivers/video/fbdev/sh_mobile_lcdcfb.h +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.h @@ -87,11 +87,6 @@ struct sh_mobile_lcdc_chan { unsigned long base_addr_c; unsigned int line_size; - int (*notify)(struct sh_mobile_lcdc_chan *ch, - enum sh_mobile_lcdc_entity_event event, - const struct fb_videomode *mode, - const struct fb_monspecs *monspec); - /* Backlight */ struct backlight_device *bl; unsigned int bl_brightness; -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 14/33] staging/olpc: lock_fb_info can't fail
Simply because olpc never unregisters the damn thing. It also registers the framebuffer directly by poking around in fbdev core internals, so it's all around rather broken. Signed-off-by: Daniel Vetter Cc: Jens Frederich Cc: Daniel Drake Cc: Jon Nettleton --- drivers/staging/olpc_dcon/olpc_dcon.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c index 6b714f740ac3..a254238be181 100644 --- a/drivers/staging/olpc_dcon/olpc_dcon.c +++ b/drivers/staging/olpc_dcon/olpc_dcon.c @@ -250,11 +250,7 @@ static bool dcon_blank_fb(struct dcon_priv *dcon, bool blank) int err; console_lock(); - if (!lock_fb_info(dcon->fbinfo)) { - console_unlock(); - dev_err(&dcon->client->dev, "unable to lock framebuffer\n"); - return false; - } + lock_fb_info(dcon->fbinfo); dcon->ignore_fb_events = true; err = fb_blank(dcon->fbinfo, -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 20/33] fbdev/sh_mob: Remove fb notifier callback
This seems to be entirely defunct: - The FB_EVEN_SUSPEND/RESUME events are only sent out by fb_set_suspend. Which is supposed to be called by drivers in their suspend/resume hooks, and not itself call into drivers. Luckily sh_mob doesn't call fb_set_suspend, so this seems to do nothing useful. - The notify hook calls sh_mobile_fb_reconfig() which in turn can call into the fb notifier. Or attempt too, since that would deadlock. So looks like leftover hacks from when this was originally introduced in commit 6011bdeaa6089d49c02de69f05980da7bad314ab Author: Guennadi Liakhovetski Date: Wed Jul 21 10:13:21 2010 + fbdev: sh-mobile: HDMI support for SH-Mobile SoCs So let's just remove it. Signed-off-by: Daniel Vetter Reviewed-by: Geert Uytterhoeven Tested-by: Geert Uytterhoeven Cc: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Markus Elfring Cc: Geert Uytterhoeven Cc: Wolfram Sang --- drivers/video/fbdev/sh_mobile_lcdcfb.c | 38 -- 1 file changed, 38 deletions(-) diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c index c5924f5e98c6..0d7a044852d7 100644 --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c @@ -213,7 +213,6 @@ struct sh_mobile_lcdc_priv { struct sh_mobile_lcdc_chan ch[2]; struct sh_mobile_lcdc_overlay overlays[4]; - struct notifier_block notifier; int started; int forced_fourcc; /* 2 channel LCDC must share fourcc setting */ }; @@ -2258,37 +2257,6 @@ static const struct dev_pm_ops sh_mobile_lcdc_dev_pm_ops = { * Framebuffer notifier */ -/* locking: called with info->lock held */ -static int sh_mobile_lcdc_notify(struct notifier_block *nb, -unsigned long action, void *data) -{ - struct fb_event *event = data; - struct fb_info *info = event->info; - struct sh_mobile_lcdc_chan *ch = info->par; - - if (&ch->lcdc->notifier != nb) - return NOTIFY_DONE; - - dev_dbg(info->dev, "%s(): action = %lu, data = %p\n", - __func__, action, event->data); - - switch(action) { - case FB_EVENT_SUSPEND: - sh_mobile_lcdc_display_off(ch); - sh_mobile_lcdc_stop(ch->lcdc); - break; - case FB_EVENT_RESUME: - mutex_lock(&ch->open_lock); - sh_mobile_fb_reconfig(info); - mutex_unlock(&ch->open_lock); - - sh_mobile_lcdc_display_on(ch); - sh_mobile_lcdc_start(ch->lcdc); - } - - return NOTIFY_OK; -} - /* - * Probe/remove and driver init/exit */ @@ -2316,8 +2284,6 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev) struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev); unsigned int i; - fb_unregister_client(&priv->notifier); - for (i = 0; i < ARRAY_SIZE(priv->overlays); i++) sh_mobile_lcdc_overlay_fb_unregister(&priv->overlays[i]); for (i = 0; i < ARRAY_SIZE(priv->ch); i++) @@ -2707,10 +2673,6 @@ static int sh_mobile_lcdc_probe(struct platform_device *pdev) goto err1; } - /* Failure ignored */ - priv->notifier.notifier_call = sh_mobile_lcdc_notify; - fb_register_client(&priv->notifier); - return 0; err1: sh_mobile_lcdc_remove(pdev); -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 17/33] fbcon: call fbcon_fb_bind directly
Also remove the error return value. That's all errors for either driver bugs (trying to unbind something that isn't bound), or errors of the new driver that will take over. There's nothing the outgoing driver can do about this anyway, so switch over to void. Signed-off-by: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: Hans de Goede Cc: Sergey Senozhatsky Cc: Peter Rosin Cc: Kees Cook Cc: Konstantin Khorenko Cc: Yisheng Xie Cc: "Michał Mirosław" Cc: Mikulas Patocka Cc: Thomas Zimmermann Cc: linux-fb...@vger.kernel.org --- drivers/video/fbdev/core/fbcon.c | 24 +++- drivers/video/fbdev/core/fbmem.c | 7 ++- include/linux/fb.h | 2 -- include/linux/fbcon.h| 2 ++ 4 files changed, 11 insertions(+), 24 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index c3353db35adc..f114b4c88796 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3046,7 +3046,7 @@ static int fbcon_mode_deleted(struct fb_info *info, } #ifdef CONFIG_VT_HW_CONSOLE_BINDING -static int fbcon_unbind(void) +static void fbcon_unbind(void) { int ret; @@ -3055,25 +3055,21 @@ static int fbcon_unbind(void) if (!ret) fbcon_has_console_bind = 0; - - return ret; } #else -static inline int fbcon_unbind(void) -{ - return -EINVAL; -} +static inline void fbcon_unbind(void) {} #endif /* CONFIG_VT_HW_CONSOLE_BINDING */ /* called with console_lock held */ -static int fbcon_fb_unbind(int idx) +void fbcon_fb_unbind(struct fb_info *info) { int i, new_idx = -1, ret = 0; + int idx = info->node; WARN_CONSOLE_UNLOCKED(); if (!fbcon_has_console_bind) - return 0; + return; for (i = first_fb_vc; i <= last_fb_vc; i++) { if (con2fb_map[i] != idx && @@ -3106,15 +3102,13 @@ static int fbcon_fb_unbind(int idx) idx, 0); if (ret) { con2fb_map[i] = idx; - return ret; + return; } } } } - ret = fbcon_unbind(); + fbcon_unbind(); } - - return ret; } /* called with console_lock held */ @@ -3352,10 +3346,6 @@ static int fbcon_event_notify(struct notifier_block *self, mode = event->data; ret = fbcon_mode_deleted(info, mode); break; - case FB_EVENT_FB_UNBIND: - idx = info->node; - ret = fbcon_fb_unbind(idx); - break; case FB_EVENT_SET_CONSOLE_MAP: /* called with console lock held */ con2fb = event->data; diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index d73762324ca2..f3fc2e5b193c 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1716,8 +1716,6 @@ static int do_register_framebuffer(struct fb_info *fb_info) static int unbind_console(struct fb_info *fb_info) { - struct fb_event event; - int ret; int i = fb_info->node; if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info) @@ -1725,12 +1723,11 @@ static int unbind_console(struct fb_info *fb_info) console_lock(); lock_fb_info(fb_info); - event.info = fb_info; - ret = fb_notifier_call_chain(FB_EVENT_FB_UNBIND, &event); + fbcon_fb_unbind(fb_info); unlock_fb_info(fb_info); console_unlock(); - return ret; + return 0; } static int __unlink_framebuffer(struct fb_info *fb_info); diff --git a/include/linux/fb.h b/include/linux/fb.h index aa8f18163151..b6ce041d9e13 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -158,8 +158,6 @@ struct fb_cursor_user { #define FB_EVENT_CONBLANK 0x0C /* Get drawing requirements*/ #define FB_EVENT_GET_REQ0x0D -/* Unbind from the console if possible */ -#define FB_EVENT_FB_UNBIND 0x0E /* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */ #define FB_EVENT_REMAP_ALL_CONSOLE 0x0F /* A hardware display blank early change occurred */ diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h index 94a71e9e1257..38d44fdb6d14 100644 --- a/include/linux/fbcon.h +++ b/include/linux/fbcon.h @@ -6,11 +6,13 @@ void __init fb_console_init(void); void __exit fb_console_exit(void); int fbcon_fb_registered(struct fb_info *info); void fbcon_fb_unregistered(struct fb_info *info); +void fbcon_fb_unbind(struct fb_info *info); #else static inline void fb_console_init(void) {} static inline void fb_
[Intel-gfx] [PATCH 30/33] fbcon: Call con2fb_map functions directly
These are actually fbcon ioctls which just happen to be exposed through /dev/fb*. They completely ignore which fb_info they're called on, and I think the userspace tool even hardcodes to /dev/fb0. Hence just forward the entire thing to fbcon.c wholesale. Note that this patch drops the fb_lock/unlock on the set side. Since the ioctl can operate on any fb (as passed in through con2fb.framebuffer) this is bogus. Also note that fbcon.c in general never calls fb_lock on anything, so this has been badly broken already. With this the last user of the fbcon notifier callback is gone, and we can garbage collect that too. v2: add missing uaccess.h include (alpha fails to compile otherwise), reported by kbuild. v3: Remember to also drop the #defines (Maarten) v4: Add the static inline to dummy functions. Signed-off-by: Daniel Vetter Cc: Maarten Lankhorst Cc: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Hans de Goede Cc: Yisheng Xie Cc: "Michał Mirosław" Cc: Peter Rosin Cc: Mikulas Patocka --- drivers/video/fbdev/core/fbcon.c | 59 +++- drivers/video/fbdev/core/fbmem.c | 34 ++ include/linux/fb.h | 4 --- include/linux/fbcon.h| 4 +++ 4 files changed, 42 insertions(+), 59 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index e08e984e2511..6a4bbb8407c0 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -76,6 +76,7 @@ #include #include #include /* For counting font checksums */ +#include #include #include @@ -3318,29 +3319,47 @@ void fbcon_get_requirement(struct fb_info *info, } } -static int fbcon_event_notify(struct notifier_block *self, - unsigned long action, void *data) +int fbcon_set_con2fb_map_ioctl(void __user *argp) { - struct fb_event *event = data; - struct fb_info *info = event->info; - struct fb_con2fbmap *con2fb; - int idx, ret = 0; + struct fb_con2fbmap con2fb; + int ret; - switch(action) { - case FB_EVENT_SET_CONSOLE_MAP: - /* called with console lock held */ - con2fb = event->data; - ret = set_con2fb_map(con2fb->console - 1, -con2fb->framebuffer, 1); - break; - case FB_EVENT_GET_CONSOLE_MAP: - con2fb = event->data; - con2fb->framebuffer = con2fb_map[con2fb->console - 1]; - break; + if (copy_from_user(&con2fb, argp, sizeof(con2fb))) + return -EFAULT; + if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES) + return -EINVAL; + if (con2fb.framebuffer >= FB_MAX) + return -EINVAL; + if (!registered_fb[con2fb.framebuffer]) + request_module("fb%d", con2fb.framebuffer); + if (!registered_fb[con2fb.framebuffer]) { + return -EINVAL; } + + console_lock(); + ret = set_con2fb_map(con2fb.console - 1, +con2fb.framebuffer, 1); + console_unlock(); + return ret; } +int fbcon_get_con2fb_map_ioctl(void __user *argp) +{ + struct fb_con2fbmap con2fb; + + if (copy_from_user(&con2fb, argp, sizeof(con2fb))) + return -EFAULT; + if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES) + return -EINVAL; + + console_lock(); + con2fb.framebuffer = con2fb_map[con2fb.console - 1]; + console_unlock(); + + return copy_to_user(argp, &con2fb, sizeof(con2fb)) ? -EFAULT : 0; +} + /* * The console `switch' structure for the frame buffer based console */ @@ -3372,10 +3391,6 @@ static const struct consw fb_con = { .con_debug_leave= fbcon_debug_leave, }; -static struct notifier_block fbcon_event_notifier = { - .notifier_call = fbcon_event_notify, -}; - static ssize_t store_rotate(struct device *device, struct device_attribute *attr, const char *buf, size_t count) @@ -3648,7 +3663,6 @@ void __init fb_console_init(void) int i; console_lock(); - fb_register_client(&fbcon_event_notifier); fbcon_device = device_create(fb_class, NULL, MKDEV(0, 0), NULL, "fbcon"); @@ -3684,7 +3698,6 @@ static void __exit fbcon_deinit_device(void) void __exit fb_console_exit(void) { console_lock(); - fb_unregister_client(&fbcon_event_notifier); fbcon_deinit_device(); device_destroy(fb_class, MKDEV(0, 0)); fbcon_exit(); diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index dd1a708df1a7..64dd732021d8 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1092,10 +1092,8 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, struct fb_ops *
[Intel-gfx] [PATCH 16/33] fbdev: lock_fb_info cannot fail
Ever since commit c47747fde931c02455683bd00ea43eaa62f35b0e Author: Linus Torvalds Date: Wed May 11 14:58:34 2011 -0700 fbmem: make read/write/ioctl use the frame buffer at open time fbdev has gained proper refcounting for the fbinfo attached to any open files, which means that the backing driver (stored in fb_info->fbops) cannot untimely disappear anymore. The only thing that can happen is that the entire device just outright disappears and gets unregistered, but file_fb_info does check for that. Except that it's racy - it only checks once at the start of a file_ops, there's no guarantee that the underlying fbdev won't untimely disappear. Aside: A proper way to fix that race is probably to replicate the srcu trickery we've rolled out in drm. But given that this race has existed since forever it's probably not one we need to fix right away. do_unregister_framebuffer also nowhere clears fb_info->fbops, hence the check in lock_fb_info can't possible catch a disappearing fbdev later on. Long story short: Ever since the above commit the fb_info->fbops checks have essentially become dead code. Remove this all. Aside from the file_ops callbacks, and stuff called from there there's only register/unregister code left. If that goes wrong a driver managed to register/unregister a device instance twice or in the wrong order. That's just a driver bug. v2: - fb_mmap had an open-coded version of the fbinfo->fops check, because it doesn't need the fbinfo->lock. Delete that too. - Use the wrapper function in fb_open/release now, since no difference anymore. Signed-off-by: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: Hans de Goede Cc: Yisheng Xie Cc: Sergey Senozhatsky Cc: "Noralf Trønnes" Cc: Peter Rosin Cc: "Michał Mirosław" Cc: Mikulas Patocka Cc: "Gustavo A. R. Silva" Cc: linux-fb...@vger.kernel.org --- drivers/video/fbdev/core/fbcmap.c | 6 +-- drivers/video/fbdev/core/fbcon.c | 3 +- drivers/video/fbdev/core/fbmem.c | 73 +++ include/linux/fb.h| 5 ++- 4 files changed, 23 insertions(+), 64 deletions(-) diff --git a/drivers/video/fbdev/core/fbcmap.c b/drivers/video/fbdev/core/fbcmap.c index 2811c4afde01..e5ae33c1a8e8 100644 --- a/drivers/video/fbdev/core/fbcmap.c +++ b/drivers/video/fbdev/core/fbcmap.c @@ -285,11 +285,7 @@ int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info) goto out; } umap.start = cmap->start; - if (!lock_fb_info(info)) { - rc = -ENODEV; - goto out; - } - + lock_fb_info(info); rc = fb_set_cmap(&umap, info); unlock_fb_info(info); out: diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 54d01f7284cb..c3353db35adc 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -2364,8 +2364,7 @@ static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, } - if (!lock_fb_info(info)) - return; + lock_fb_info(info); event.info = info; event.data = ␣ fb_notifier_call_chain(FB_EVENT_CONBLANK, &event); diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index bed7698ad18a..d73762324ca2 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -80,17 +80,6 @@ static void put_fb_info(struct fb_info *fb_info) fb_info->fbops->fb_destroy(fb_info); } -int lock_fb_info(struct fb_info *info) -{ - mutex_lock(&info->lock); - if (!info->fbops) { - mutex_unlock(&info->lock); - return 0; - } - return 1; -} -EXPORT_SYMBOL(lock_fb_info); - /* * Helpers */ @@ -1121,8 +1110,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, switch (cmd) { case FBIOGET_VSCREENINFO: - if (!lock_fb_info(info)) - return -ENODEV; + lock_fb_info(info); var = info->var; unlock_fb_info(info); @@ -1132,10 +1120,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, if (copy_from_user(&var, argp, sizeof(var))) return -EFAULT; console_lock(); - if (!lock_fb_info(info)) { - console_unlock(); - return -ENODEV; - } + lock_fb_info(info); info->flags |= FBINFO_MISC_USEREVENT; ret = fb_set_var(info, &var); info->flags &= ~FBINFO_MISC_USEREVENT; @@ -1145,8 +1130,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, ret = -EFAULT; break; case FBIOGET_FSCREENINFO: - if (!lock_fb_info(info)) - return -ENODEV; + lock_fb_info(info); fix
[Intel-gfx] [PATCH 22/33] fbcon: Call fbcon_mode_deleted/new_modelist directly
I'm not entirely clear on what new_modelist actually does, it seems exclusively for a sysfs interface. Which in the end does amount to a normal fb_set_par to check the mode, but then takes a different path in both fbmem.c and fbcon.c. I have no idea why these 2 paths are different, but then I also don't really want to find out. So just do the simple conversion to a direct function call. v2: static inline for the dummy versions, I forgot. Signed-off-by: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: Hans de Goede Cc: Mikulas Patocka Cc: Sergey Senozhatsky Cc: Kees Cook Cc: Peter Rosin Cc: Yisheng Xie Cc: "Michał Mirosław" Cc: linux-fb...@vger.kernel.org --- drivers/video/fbdev/core/fbcon.c | 14 +++--- drivers/video/fbdev/core/fbmem.c | 22 +++--- include/linux/fb.h | 5 - include/linux/fbcon.h| 6 ++ 4 files changed, 16 insertions(+), 31 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 24ea6e4fbee0..35ecd25b385c 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3019,8 +3019,8 @@ static void fbcon_set_all_vcs(struct fb_info *info) fbcon_modechanged(info); } -static int fbcon_mode_deleted(struct fb_info *info, - struct fb_videomode *mode) +int fbcon_mode_deleted(struct fb_info *info, + struct fb_videomode *mode) { struct fb_info *fb_info; struct fbcon_display *p; @@ -3262,7 +3262,7 @@ static void fbcon_fb_blanked(struct fb_info *info, int blank) ops->blank_state = blank; } -static void fbcon_new_modelist(struct fb_info *info) +void fbcon_new_modelist(struct fb_info *info) { int i; struct vc_data *vc; @@ -3324,7 +3324,6 @@ static int fbcon_event_notify(struct notifier_block *self, { struct fb_event *event = data; struct fb_info *info = event->info; - struct fb_videomode *mode; struct fb_con2fbmap *con2fb; struct fb_blit_caps *caps; int idx, ret = 0; @@ -3336,10 +3335,6 @@ static int fbcon_event_notify(struct notifier_block *self, case FB_EVENT_MODE_CHANGE_ALL: fbcon_set_all_vcs(info); break; - case FB_EVENT_MODE_DELETE: - mode = event->data; - ret = fbcon_mode_deleted(info, mode); - break; case FB_EVENT_SET_CONSOLE_MAP: /* called with console lock held */ con2fb = event->data; @@ -3353,9 +3348,6 @@ static int fbcon_event_notify(struct notifier_block *self, case FB_EVENT_BLANK: fbcon_fb_blanked(info, *(int *)event->data); break; - case FB_EVENT_NEW_MODELIST: - fbcon_new_modelist(info); - break; case FB_EVENT_GET_REQ: caps = event->data; fbcon_get_requirement(info, caps); diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 73269dedcd45..cbdd141e7695 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -966,16 +966,11 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) /* make sure we don't delete the videomode of current var */ ret = fb_mode_is_equal(&mode1, &mode2); - if (!ret) { - struct fb_event event; - - event.info = info; - event.data = &mode1; - ret = fb_notifier_call_chain(FB_EVENT_MODE_DELETE, &event); - } + if (!ret) + fbcon_mode_deleted(info, &mode1); if (!ret) - fb_delete_videomode(&mode1, &info->modelist); + fb_delete_videomode(&mode1, &info->modelist); ret = (ret) ? -EINVAL : 0; @@ -1992,7 +1987,6 @@ subsys_initcall(fbmem_init); int fb_new_modelist(struct fb_info *info) { - struct fb_event event; struct fb_var_screeninfo var = info->var; struct list_head *pos, *n; struct fb_modelist *modelist; @@ -2012,14 +2006,12 @@ int fb_new_modelist(struct fb_info *info) } } - err = 1; + if (list_empty(&info->modelist)) + return 1; - if (!list_empty(&info->modelist)) { - event.info = info; - err = fb_notifier_call_chain(FB_EVENT_NEW_MODELIST, &event); - } + fbcon_new_modelist(info); - return err; + return 0; } MODULE_LICENSE("GPL"); diff --git a/include/linux/fb.h b/include/linux/fb.h index 794b386415b7..7a788ed8c7b5 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -126,8 +126,6 @@ struct fb_cursor_user { /* The resolution of the passed in fb_info about to change */ #define FB_EVENT_MODE_CHANGE 0x01 -/* An entry from the m
[Intel-gfx] [PATCH 18/33] fbdev: make unregister/unlink functions not fail
Except for driver bugs (which we'll catch with a WARN_ON) this is only to report failures of the new driver taking over the console. There's nothing the outgoing driver can do about that, and no one ever bothered to actually look at these return values. So remove them all. v2: fixup unregister_framebuffer in savagefb, fbtft, ivtvfb, and neofb drivers, reported by kbuild. Signed-off-by: Daniel Vetter Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: "Michał Mirosław" Cc: Peter Rosin Cc: Hans de Goede Cc: Mikulas Patocka Cc: linux-fb...@vger.kernel.org --- drivers/media/pci/ivtv/ivtvfb.c | 6 +- drivers/staging/fbtft/fbtft-core.c | 4 +- drivers/video/fbdev/core/fbmem.c | 73 ++-- drivers/video/fbdev/neofb.c | 9 +-- drivers/video/fbdev/savage/savagefb_driver.c | 9 +-- include/linux/fb.h | 4 +- 6 files changed, 31 insertions(+), 74 deletions(-) diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c index cfd21040d0e3..6435c72ff58e 100644 --- a/drivers/media/pci/ivtv/ivtvfb.c +++ b/drivers/media/pci/ivtv/ivtvfb.c @@ -1258,11 +1258,7 @@ static int ivtvfb_callback_cleanup(struct device *dev, void *p) struct osd_info *oi = itv->osd_info; if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { - if (unregister_framebuffer(&itv->osd_info->ivtvfb_info)) { - IVTVFB_WARN("Framebuffer %d is in use, cannot unload\n", - itv->instance); - return 0; - } + unregister_framebuffer(&itv->osd_info->ivtvfb_info); IVTVFB_INFO("Unregister framebuffer %d\n", itv->instance); itv->ivtvfb_restore = NULL; ivtvfb_blank(FB_BLANK_VSYNC_SUSPEND, &oi->ivtvfb_info); diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index 9b07badf4c6c..7cbc1bdd2d8a 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -891,7 +891,9 @@ int fbtft_unregister_framebuffer(struct fb_info *fb_info) if (par->fbtftops.unregister_backlight) par->fbtftops.unregister_backlight(par); fbtft_sysfs_exit(par); - return unregister_framebuffer(fb_info); + unregister_framebuffer(fb_info); + + return 0; } EXPORT_SYMBOL(fbtft_unregister_framebuffer); diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index f3fc2e5b193c..f3bcad30d3ba 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1590,13 +1590,13 @@ static bool fb_do_apertures_overlap(struct apertures_struct *gena, return false; } -static int do_unregister_framebuffer(struct fb_info *fb_info); +static void do_unregister_framebuffer(struct fb_info *fb_info); #define VGA_FB_PHYS 0xA -static int do_remove_conflicting_framebuffers(struct apertures_struct *a, - const char *name, bool primary) +static void do_remove_conflicting_framebuffers(struct apertures_struct *a, + const char *name, bool primary) { - int i, ret; + int i; /* check all firmware fbs and kick off if the base addr overlaps */ for_each_registered_fb(i) { @@ -1612,13 +1612,9 @@ static int do_remove_conflicting_framebuffers(struct apertures_struct *a, printk(KERN_INFO "fb%d: switching to %s from %s\n", i, name, registered_fb[i]->fix.id); - ret = do_unregister_framebuffer(registered_fb[i]); - if (ret) - return ret; + do_unregister_framebuffer(registered_fb[i]); } } - - return 0; } static bool lockless_register_fb; @@ -1634,11 +1630,9 @@ static int do_register_framebuffer(struct fb_info *fb_info) if (fb_check_foreignness(fb_info)) return -ENOSYS; - ret = do_remove_conflicting_framebuffers(fb_info->apertures, -fb_info->fix.id, -fb_is_primary_device(fb_info)); - if (ret) - return ret; + do_remove_conflicting_framebuffers(fb_info->apertures, + fb_info->fix.id, + fb_is_primary_device(fb_info)); if (num_registered_fb == FB_MAX) return -ENXIO; @@ -1714,32 +1708,25 @@ static int do_register_framebuffer(struct fb_info *fb_info) return ret; } -static int unbind_console(struct fb_info *fb_info) +static void unbind_console(struct fb_info *fb_info) { int i = fb_info->node; - if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info) - return -EINVAL; + if
Re: [Intel-gfx] [BrownBag] drm/i915/gtt: Neuter the deferred unbind callback from gen6_ppgtt_cleanup
On 24/05/2019 09:51, Tvrtko Ursulin wrote: On 24/05/2019 09:36, Chris Wilson wrote: Quoting Tvrtko Ursulin (2019-05-24 09:31:45) On 24/05/2019 09:29, Chris Wilson wrote: Quoting Tvrtko Ursulin (2019-05-24 09:23:40) On 24/05/2019 09:17, Chris Wilson wrote: Quoting Tvrtko Ursulin (2019-05-24 09:13:14) On 24/05/2019 07:45, Chris Wilson wrote: Having deferred the vma destruction to a worker where we can acquire the struct_mutex, we have to avoid chasing back into the now destroyed ppgtt. The pd_vma is special in having a custom unbind function to scan for unused pages despite the VMA itself being notionally part of the GGTT. As such, we need to disable that callback to avoid a use-after-free. This unfortunately blew up so early during boot that CI declared the machine unreachable as opposed to being the major failure it was. Oops. Fixes: d3622099c76f ("drm/i915/gtt: Always acquire struct_mutex for gen6_ppgtt_cleanup") Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin Cc: Tomi Sarvela --- drivers/gpu/drm/i915/i915_gem_gtt.c | 28 1 file changed, 28 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 8d8a4b0ad4d9..266baa11df64 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c @@ -1847,6 +1847,33 @@ static void gen6_ppgtt_cleanup_work(struct work_struct *wrk) kfree(work); } +static int nop_set_pages(struct i915_vma *vma) +{ + return -ENODEV; +} + +static void nop_clear_pages(struct i915_vma *vma) +{ +} + +static int nop_bind(struct i915_vma *vma, + enum i915_cache_level cache_level, + u32 unused) +{ + return -ENODEV; +} + +static void nop_unbind(struct i915_vma *vma) +{ +} + +static const struct i915_vma_ops nop_vma_ops = { + .set_pages = nop_set_pages, + .clear_pages = nop_clear_pages, + .bind_vma = nop_bind, + .unbind_vma = nop_unbind, +}; + static void gen6_ppgtt_cleanup(struct i915_address_space *vm) { struct gen6_hw_ppgtt *ppgtt = to_gen6_ppgtt(i915_vm_to_ppgtt(vm)); @@ -1855,6 +1882,7 @@ static void gen6_ppgtt_cleanup(struct i915_address_space *vm) /* FIXME remove the struct_mutex to bring the locking under control */ INIT_WORK(&work->base, gen6_ppgtt_cleanup_work); work->vma = ppgtt->vma; + work->vma->ops = &nop_vma_ops; Could we use some asserts before overriding the vma ops? Like GEM_BUG_ON(vma->pages)? And something for still bound? It technically still is bound as it is in the GGTT but currently unpinned -- that will be checked on destroy, it's just we also get an unbind callback. vma->pages doesn't exist for this (set to ERR_PTR). If we are getting the unbind callback and we nop-ed it, who will actually do it's job? The callback is just a hook for us to prune within the ppgtt. It still is removed from GGTT by i915_vma_unbind(). So it needs GEM_BUG_ON(ppgtt->scan_for_unused_pt) before overriding the unbind? No. They get freed by the cleanup itself. The scan is just an opportunistic prune if either the context/mm is evicted but still alive. Then the same assert in gen6_ppgtt_cleanup_work? :) Okay ppgtt is gone so can't do it.. annoying.. Cleanup seems to support your claims but I think we need a BFC (big fat comment) above the vma ops override to explains this. With that: Reviewed-by: Tvrtko Ursulin Regards, Tvrtko ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [BrownBag] drm/i915/gtt: Neuter the deferred unbind callback from gen6_ppgtt_cleanup
Quoting Tvrtko Ursulin (2019-05-24 09:57:42) > > On 24/05/2019 09:51, Tvrtko Ursulin wrote: > > > > On 24/05/2019 09:36, Chris Wilson wrote: > >> Quoting Tvrtko Ursulin (2019-05-24 09:31:45) > >>> > >>> On 24/05/2019 09:29, Chris Wilson wrote: > Quoting Tvrtko Ursulin (2019-05-24 09:23:40) > > > > On 24/05/2019 09:17, Chris Wilson wrote: > >> Quoting Tvrtko Ursulin (2019-05-24 09:13:14) > >>> > >>> On 24/05/2019 07:45, Chris Wilson wrote: > Having deferred the vma destruction to a worker where we can > acquire the > struct_mutex, we have to avoid chasing back into the now destroyed > ppgtt. The pd_vma is special in having a custom unbind function > to scan > for unused pages despite the VMA itself being notionally part of > the > GGTT. As such, we need to disable that callback to avoid a > use-after-free. > > This unfortunately blew up so early during boot that CI declared > the > machine unreachable as opposed to being the major failure it > was. Oops. > > Fixes: d3622099c76f ("drm/i915/gtt: Always acquire struct_mutex > for gen6_ppgtt_cleanup") > Signed-off-by: Chris Wilson > Cc: Tvrtko Ursulin > Cc: Tomi Sarvela > --- > drivers/gpu/drm/i915/i915_gem_gtt.c | 28 > > 1 file changed, 28 insertions(+) > > diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c > b/drivers/gpu/drm/i915/i915_gem_gtt.c > index 8d8a4b0ad4d9..266baa11df64 100644 > --- a/drivers/gpu/drm/i915/i915_gem_gtt.c > +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c > @@ -1847,6 +1847,33 @@ static void > gen6_ppgtt_cleanup_work(struct work_struct *wrk) > kfree(work); > } > +static int nop_set_pages(struct i915_vma *vma) > +{ > + return -ENODEV; > +} > + > +static void nop_clear_pages(struct i915_vma *vma) > +{ > +} > + > +static int nop_bind(struct i915_vma *vma, > + enum i915_cache_level cache_level, > + u32 unused) > +{ > + return -ENODEV; > +} > + > +static void nop_unbind(struct i915_vma *vma) > +{ > +} > + > +static const struct i915_vma_ops nop_vma_ops = { > + .set_pages = nop_set_pages, > + .clear_pages = nop_clear_pages, > + .bind_vma = nop_bind, > + .unbind_vma = nop_unbind, > +}; > + > static void gen6_ppgtt_cleanup(struct i915_address_space *vm) > { > struct gen6_hw_ppgtt *ppgtt = > to_gen6_ppgtt(i915_vm_to_ppgtt(vm)); > @@ -1855,6 +1882,7 @@ static void gen6_ppgtt_cleanup(struct > i915_address_space *vm) > /* FIXME remove the struct_mutex to bring the locking > under control */ > INIT_WORK(&work->base, gen6_ppgtt_cleanup_work); > work->vma = ppgtt->vma; > + work->vma->ops = &nop_vma_ops; > >>> > >>> Could we use some asserts before overriding the vma ops? Like > >>> GEM_BUG_ON(vma->pages)? And something for still bound? > >> > >> It technically still is bound as it is in the GGTT but currently > >> unpinned -- that will be checked on destroy, it's just we also get an > >> unbind callback. vma->pages doesn't exist for this (set to ERR_PTR). > > > > If we are getting the unbind callback and we nop-ed it, who will > > actually do it's job? > > The callback is just a hook for us to prune within the ppgtt. > It still is removed from GGTT by i915_vma_unbind(). > >>> > >>> So it needs GEM_BUG_ON(ppgtt->scan_for_unused_pt) before overriding the > >>> unbind? > >> > >> No. They get freed by the cleanup itself. The scan is just an > >> opportunistic prune if either the context/mm is evicted but still alive. > > > > Then the same assert in gen6_ppgtt_cleanup_work? :) > > Okay ppgtt is gone so can't do it.. annoying.. Cleanup seems to support > your claims but I think we need a BFC (big fat comment) above the vma > ops override to explains this. With that: It has FIXME! I really do hope this is short term... -Chris ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH] drm/i915/gen11: enable support for headerless msgs
Quoting Mika Kuoppala (2019-05-24 09:03:00) > Chris Wilson writes: > > > From: Dongwon Kim > > > > Setting bit5 (headerless msg for preemptable GPGPU context) of SAMPLER_MODE > > register to enable support for the headless msgs on gen11. None of existing > > use cases will be affected by this as this change makes both types of > > message > > - headerless and w/ header supported at the same time. It also complies with > > the new recommendation for the default bit value for the next gen. > > > > v2: rewrote commit message to include more information > > v3: setting the bit in icl_ctx_workarounds_init() > > > > Signed-off-by: Dongwon Kim > > Reviewed-by: Mika Kuoppala And pushed. Thanks for the patch and review, -Chris ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [BrownBag] drm/i915/gtt: Neuter the deferred unbind callback from gen6_ppgtt_cleanup
On 24/05/2019 10:01, Chris Wilson wrote: Quoting Tvrtko Ursulin (2019-05-24 09:57:42) On 24/05/2019 09:51, Tvrtko Ursulin wrote: On 24/05/2019 09:36, Chris Wilson wrote: Quoting Tvrtko Ursulin (2019-05-24 09:31:45) On 24/05/2019 09:29, Chris Wilson wrote: Quoting Tvrtko Ursulin (2019-05-24 09:23:40) On 24/05/2019 09:17, Chris Wilson wrote: Quoting Tvrtko Ursulin (2019-05-24 09:13:14) On 24/05/2019 07:45, Chris Wilson wrote: Having deferred the vma destruction to a worker where we can acquire the struct_mutex, we have to avoid chasing back into the now destroyed ppgtt. The pd_vma is special in having a custom unbind function to scan for unused pages despite the VMA itself being notionally part of the GGTT. As such, we need to disable that callback to avoid a use-after-free. This unfortunately blew up so early during boot that CI declared the machine unreachable as opposed to being the major failure it was. Oops. Fixes: d3622099c76f ("drm/i915/gtt: Always acquire struct_mutex for gen6_ppgtt_cleanup") Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin Cc: Tomi Sarvela --- drivers/gpu/drm/i915/i915_gem_gtt.c | 28 1 file changed, 28 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 8d8a4b0ad4d9..266baa11df64 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c @@ -1847,6 +1847,33 @@ static void gen6_ppgtt_cleanup_work(struct work_struct *wrk) kfree(work); } +static int nop_set_pages(struct i915_vma *vma) +{ + return -ENODEV; +} + +static void nop_clear_pages(struct i915_vma *vma) +{ +} + +static int nop_bind(struct i915_vma *vma, + enum i915_cache_level cache_level, + u32 unused) +{ + return -ENODEV; +} + +static void nop_unbind(struct i915_vma *vma) +{ +} + +static const struct i915_vma_ops nop_vma_ops = { + .set_pages = nop_set_pages, + .clear_pages = nop_clear_pages, + .bind_vma = nop_bind, + .unbind_vma = nop_unbind, +}; + static void gen6_ppgtt_cleanup(struct i915_address_space *vm) { struct gen6_hw_ppgtt *ppgtt = to_gen6_ppgtt(i915_vm_to_ppgtt(vm)); @@ -1855,6 +1882,7 @@ static void gen6_ppgtt_cleanup(struct i915_address_space *vm) /* FIXME remove the struct_mutex to bring the locking under control */ INIT_WORK(&work->base, gen6_ppgtt_cleanup_work); work->vma = ppgtt->vma; + work->vma->ops = &nop_vma_ops; Could we use some asserts before overriding the vma ops? Like GEM_BUG_ON(vma->pages)? And something for still bound? It technically still is bound as it is in the GGTT but currently unpinned -- that will be checked on destroy, it's just we also get an unbind callback. vma->pages doesn't exist for this (set to ERR_PTR). If we are getting the unbind callback and we nop-ed it, who will actually do it's job? The callback is just a hook for us to prune within the ppgtt. It still is removed from GGTT by i915_vma_unbind(). So it needs GEM_BUG_ON(ppgtt->scan_for_unused_pt) before overriding the unbind? No. They get freed by the cleanup itself. The scan is just an opportunistic prune if either the context/mm is evicted but still alive. Then the same assert in gen6_ppgtt_cleanup_work? :) Okay ppgtt is gone so can't do it.. annoying.. Cleanup seems to support your claims but I think we need a BFC (big fat comment) above the vma ops override to explains this. With that: It has FIXME! I really do hope this is short term... Ok, that's good enough. Regards, Tvrtko ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 2/5] drm/i915/perf: allow holding preemption on filtered ctx
On 21/05/2019 17:36, Chris Wilson wrote: Quoting Lionel Landwerlin (2019-05-21 15:08:52) diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c index f263a8374273..2ad95977f7a8 100644 --- a/drivers/gpu/drm/i915/gt/intel_lrc.c +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c @@ -2085,7 +2085,7 @@ static int gen9_emit_bb_start(struct i915_request *rq, if (IS_ERR(cs)) return PTR_ERR(cs); - *cs++ = MI_ARB_ON_OFF | MI_ARB_ENABLE; + *cs++ = MI_ARB_ON_OFF | rq->hw_context->arb_enable; My prediction is that this will result in this context being reset due to preemption timeouts and the context under profile being banned. Note that preemption timeouts will be the primary means for hang detection for endless batches. -Chris Another thought : What if we ran with the max priority? It would be fine to have the hangcheck preempt the workload (it's pretty short and shouldn't affect perf counters from 3d/compute pipeline much) as long as ensure nothing else runs. -Lionel ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH i-g-t v2] benchmarks/gem_wsim: Manually calculate VLA struct sizes
On 24/05/2019 09:45, Chris Wilson wrote: Apparently VLA structs (e.g. struct { int array[count] }) is a gcc extension that clang refuses to support as handling memory layout is too difficult for it. So calculate the size by hand! v2: Use alloca(). Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin --- benchmarks/gem_wsim.c | 115 +++--- 1 file changed, 64 insertions(+), 51 deletions(-) diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c index e2ffb93a9..db19925b1 100644 --- a/benchmarks/gem_wsim.c +++ b/benchmarks/gem_wsim.c @@ -1441,6 +1441,29 @@ set_ctx_sseu(struct ctx *ctx, uint64_t slice_mask) return slice_mask; } +static size_t sizeof_load_balance(int count) +{ + struct i915_context_engines_load_balance *ptr; + + return sizeof(*ptr) + count * sizeof(ptr->engines[0]); +} + +static size_t sizeof_param_engines(int count) +{ + struct i915_context_param_engines *ptr; + + return sizeof(*ptr) + count * sizeof(ptr->engines[0]); +} + +static size_t sizeof_engines_bond(int count) +{ + struct i915_context_engines_bond *ptr; + + return sizeof(*ptr) + count * sizeof(ptr->engines[0]); +} + +#define alloca0(sz) ({ size_t sz__ = (sz); memset(alloca(sz__), 0, sz__); }) + static int prepare_workload(unsigned int id, struct workload *wrk, unsigned int flags) { @@ -1676,66 +1699,54 @@ prepare_workload(unsigned int id, struct workload *wrk, unsigned int flags) } if (ctx->engine_map) { - I915_DEFINE_CONTEXT_PARAM_ENGINES(set_engines, - ctx->engine_map_count + 1); - I915_DEFINE_CONTEXT_ENGINES_LOAD_BALANCE(load_balance, - ctx->engine_map_count); + struct i915_context_param_engines *set_engines = + alloca0(sizeof_param_engines(ctx->engine_map_count + 1)); + struct i915_context_engines_load_balance *load_balance = + alloca0(sizeof_load_balance(ctx->engine_map_count)); struct drm_i915_gem_context_param param = { .ctx_id = ctx_id, .param = I915_CONTEXT_PARAM_ENGINES, - .size = sizeof(set_engines), - .value = to_user_pointer(&set_engines), + .size = sizeof_param_engines(ctx->engine_map_count + 1), + .value = to_user_pointer(set_engines), }; + struct i915_context_engines_bond *last = NULL; if (ctx->wants_balance) { - set_engines.extensions = - to_user_pointer(&load_balance); + set_engines->extensions = + to_user_pointer(load_balance); -memset(&load_balance, 0, sizeof(load_balance)); - load_balance.base.name = + load_balance->base.name = I915_CONTEXT_ENGINES_EXT_LOAD_BALANCE; - load_balance.num_siblings = + load_balance->num_siblings = ctx->engine_map_count; for (j = 0; j < ctx->engine_map_count; j++) - load_balance.engines[j] = + load_balance->engines[j] = get_engine(ctx->engine_map[j]); - } else { - set_engines.extensions = 0; } /* Reserve slot for virtual engine. */ - set_engines.engines[0].engine_class = + set_engines->engines[0].engine_class = I915_ENGINE_CLASS_INVALID; - set_engines.engines[0].engine_instance = + set_engines->engines[0].engine_instance = I915_ENGINE_CLASS_INVALID_NONE; for (j = 1; j <= ctx->engine_map_count; j++) - set_engines.engines[j] = + set_engines->engines[j] = get_engine(ctx->engine_map[j - 1]); + last = NULL; for (j = 0; j < ctx->bond_count; j++) { unsigned long mask = ctx->bonds[j].mask; - I915_DEFINE_CONTEXT_ENGINES_BOND(bond, - __builtin_popcount(mask)); - struct i915_context_engines_bond *p = NULL, *prev; + struct i915_con
Re: [Intel-gfx] [PATCH 2/5] drm/i915/perf: allow holding preemption on filtered ctx
Quoting Lionel Landwerlin (2019-05-24 10:28:16) > On 21/05/2019 17:36, Chris Wilson wrote: > > Quoting Lionel Landwerlin (2019-05-21 15:08:52) > >> diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c > >> b/drivers/gpu/drm/i915/gt/intel_lrc.c > >> index f263a8374273..2ad95977f7a8 100644 > >> --- a/drivers/gpu/drm/i915/gt/intel_lrc.c > >> +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c > >> @@ -2085,7 +2085,7 @@ static int gen9_emit_bb_start(struct i915_request > >> *rq, > >> if (IS_ERR(cs)) > >> return PTR_ERR(cs); > >> > >> - *cs++ = MI_ARB_ON_OFF | MI_ARB_ENABLE; > >> + *cs++ = MI_ARB_ON_OFF | rq->hw_context->arb_enable; > > My prediction is that this will result in this context being reset due > > to preemption timeouts and the context under profile being banned. Note > > that preemption timeouts will be the primary means for hang detection > > for endless batches. > > -Chris > > > > Another thought : > > What if we ran with the max priority? > It would be fine to have the hangcheck preempt the workload (it's pretty > short and shouldn't affect perf counters from 3d/compute pipeline much) > as long as ensure nothing else runs. It's certainly safer from the pov that we don't block preemption and so don't incur forced resets. Not keen on the system being perturbed by the act of observing it, and I still dislike the notion of permitting one client to hog the GPU so easily. Makes me think of RT throttling, and generally throwing out the absolute priority system (in exchange for computed deadlines or something). -Chris ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 2/5] drm/i915/perf: allow holding preemption on filtered ctx
On 24/05/2019 10:42, Chris Wilson wrote: Quoting Lionel Landwerlin (2019-05-24 10:28:16) On 21/05/2019 17:36, Chris Wilson wrote: Quoting Lionel Landwerlin (2019-05-21 15:08:52) diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c index f263a8374273..2ad95977f7a8 100644 --- a/drivers/gpu/drm/i915/gt/intel_lrc.c +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c @@ -2085,7 +2085,7 @@ static int gen9_emit_bb_start(struct i915_request *rq, if (IS_ERR(cs)) return PTR_ERR(cs); - *cs++ = MI_ARB_ON_OFF | MI_ARB_ENABLE; + *cs++ = MI_ARB_ON_OFF | rq->hw_context->arb_enable; My prediction is that this will result in this context being reset due to preemption timeouts and the context under profile being banned. Note that preemption timeouts will be the primary means for hang detection for endless batches. -Chris Another thought : What if we ran with the max priority? It would be fine to have the hangcheck preempt the workload (it's pretty short and shouldn't affect perf counters from 3d/compute pipeline much) as long as ensure nothing else runs. It's certainly safer from the pov that we don't block preemption and so don't incur forced resets. Not keen on the system being perturbed by the act of observing it, and I still dislike the notion of permitting one client to hog the GPU so easily. Makes me think of RT throttling, and generally throwing out the absolute priority system (in exchange for computed deadlines or something). -Chris I don't like it much either but I can't see how to do otherwise with the hardware we currently have. I'm thinking of 2 priorities values one of scheduling, one once running. Most contexts would have both values equal. Could mitigate the issue a bit? -Lionel ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 2/5] drm/i915/perf: allow holding preemption on filtered ctx
Quoting Lionel Landwerlin (2019-05-24 10:51:49) > On 24/05/2019 10:42, Chris Wilson wrote: > > Quoting Lionel Landwerlin (2019-05-24 10:28:16) > >> On 21/05/2019 17:36, Chris Wilson wrote: > >>> Quoting Lionel Landwerlin (2019-05-21 15:08:52) > diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c > b/drivers/gpu/drm/i915/gt/intel_lrc.c > index f263a8374273..2ad95977f7a8 100644 > --- a/drivers/gpu/drm/i915/gt/intel_lrc.c > +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c > @@ -2085,7 +2085,7 @@ static int gen9_emit_bb_start(struct i915_request > *rq, > if (IS_ERR(cs)) > return PTR_ERR(cs); > > - *cs++ = MI_ARB_ON_OFF | MI_ARB_ENABLE; > + *cs++ = MI_ARB_ON_OFF | rq->hw_context->arb_enable; > >>> My prediction is that this will result in this context being reset due > >>> to preemption timeouts and the context under profile being banned. Note > >>> that preemption timeouts will be the primary means for hang detection > >>> for endless batches. > >>> -Chris > >>> > >> Another thought : > >> > >> What if we ran with the max priority? > >> It would be fine to have the hangcheck preempt the workload (it's pretty > >> short and shouldn't affect perf counters from 3d/compute pipeline much) > >> as long as ensure nothing else runs. > > It's certainly safer from the pov that we don't block preemption and so > > don't incur forced resets. Not keen on the system being perturbed by the > > act of observing it, and I still dislike the notion of permitting one > > client to hog the GPU so easily. Makes me think of RT throttling, and > > generally throwing out the absolute priority system (in exchange for > > computed deadlines or something). > > -Chris > > > I don't like it much either but I can't see how to do otherwise with the > hardware we currently have. > > I'm thinking of 2 priorities values one of scheduling, one once running. It's not quite that easy as you may start running concurrently with one of your dependencies and must therefore manage the priority inversion if you boost yourself. And I've just gone through and thrown out the current complexity of manipulating priority as they run because it made timeslicing much harder (where the priority was changing between evaluating the need for the context switch and the context switch occurring -- such mistakes can be noticed in throughput sensitive transcode workloads). > Most contexts would have both values equal. > > Could mitigate the issue a bit? A bit, it gives you a soft notion of a no-preempt flag without queue jumping. rq_prio(rq) | intel_context->effective_priority or somesuch. -Chris ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for fbcon notifier begone! (rev3)
== Series Details == Series: fbcon notifier begone! (rev3) URL : https://patchwork.freedesktop.org/series/60843/ State : warning == Summary == $ dim checkpatch origin/drm-tip 9f0a699de21c dummycon: Sprinkle locking checks -:45: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Daniel Vetter ' total: 0 errors, 1 warnings, 0 checks, 23 lines checked f22835ba447d fbdev: locking check for fb_set_suspend -:34: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Daniel Vetter ' total: 0 errors, 1 warnings, 0 checks, 8 lines checked 8a48cbffe81f vt: might_sleep() annotation for do_blank_screen -:32: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Daniel Vetter ' total: 0 errors, 1 warnings, 0 checks, 8 lines checked cbd84611f343 vt: More locking checks -:70: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Daniel Vetter ' total: 0 errors, 1 warnings, 0 checks, 38 lines checked 2b513d008252 fbdev/sa1100fb: Remove dead code -:52: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Daniel Vetter ' total: 0 errors, 1 warnings, 0 checks, 35 lines checked a3b67c702b95 fbdev/cyber2000: Remove struct display -:23: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Daniel Vetter ' total: 0 errors, 1 warnings, 0 checks, 7 lines checked 995b6d6edd33 fbdev/aty128fb: Remove dead code -:88: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Daniel Vetter ' total: 0 errors, 1 warnings, 0 checks, 70 lines checked d93edf952696 fbcon: s/struct display/struct fbcon_display/ -:270: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #270: FILE: drivers/video/fbdev/core/fbcon.c:2117: +static void updatescrollmode(struct fbcon_display *p, struct fb_info *info, -:384: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Daniel Vetter ' total: 0 errors, 1 warnings, 1 checks, 317 lines checked f74ffc508b81 fbcon: Remove fbcon_has_exited -:11: ERROR:GIT_COMMIT_ID: Please use git commit description style 'commit <12+ chars of sha1> ("")' - ie: 'commit 6104c37094e7 ("fbcon: Make fbcon a built-time depency for fbdev")' #11: commit 6104c37094e729f3d4ce65797002112735d49cd1 -:83: WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (8, 12) #83: FILE: drivers/video/fbdev/core/fbcon.c:1065: + if (WARN_ON(info_idx == -1)) return; -:193: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Daniel Vetter ' total: 1 errors, 2 warnings, 0 checks, 119 lines checked 65e571416e0a fbcon: call fbcon_fb_(un)registered directly -:11: ERROR:GIT_COMMIT_ID: Please use git commit description style 'commit <12+ chars of sha1> ("")' - ie: 'commit 6104c37094e7 ("fbcon: Make fbcon a built-time depency for fbdev")' #11: commit 6104c37094e729f3d4ce65797002112735d49cd1 -:155: WARNING:LINE_SPACING: Missing a blank line after declarations #155: FILE: drivers/video/fbdev/core/fbmem.c:1728: + struct fb_event event; + event.info = fb_info; -:190: WARNING:LINE_SPACING: Missing a blank line after declarations #190: FILE: drivers/video/fbdev/core/fbmem.c:1799: + struct fb_event event; + event.info = fb_info; -:237: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Daniel Vetter ' total: 1 errors, 3 warnings, 0 checks, 147 lines checked 554aa48edb9f fbdev/sh_mobile: remove sh_mobile_lcdc_display_notify 742b35bae46d fbdev/omap: sysfs files can't disappear before the device is gone b80c8e5422b0 fbdev: sysfs files can't disappear before the device is gone 5e8820c9a8f6 staging/olpc: lock_fb_info can't fail 9d0c020031cf fbdev/atyfb: lock_fb_info can't fail 7b36ca43f945 fbdev: lock_fb_info cannot fail -:11: ERROR:GIT_COMMIT_ID: Please use git commit description style 'commit <12+ chars of sha1> ("")' - ie: 'commit c47747fde931 ("fbmem: make read/write/ioctl use the frame buffer at open time")' #11: commit c47747fde931c02455683bd00ea43eaa62f35b0e -:307: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Daniel Vetter ' total: 1 errors, 1 warnings, 0 checks, 212 lines checked 6206f93346b9 fbcon: call fbcon_fb_bind directly -:160: WARNING:NO_AUTHOR_SIGN_OFF: Missing Signed-off-by: line by nominal patch author 'Daniel Vetter ' total: 0 errors, 1 warnings, 0 checks, 107 lines checked c00611f73ad1 fbdev: make unregister/unlink functions not fail -:284: CHECK:AVOID_EXTERNS: extern prototypes should be avoided in .h files #284: FILE: include/linux/fb.h:637: +extern void unregister_framebuffer(struct fb_info *fb_info); -:285: CHECK:AVOID_EXTERNS: extern prototypes should be avoided in .h files #285: FILE: include/linux/fb.h:638: +extern void unlink_framebuffer(struct fb_
[Intel-gfx] ✗ Fi.CI.SPARSE: warning for fbcon notifier begone! (rev3)
== Series Details == Series: fbcon notifier begone! (rev3) URL : https://patchwork.freedesktop.org/series/60843/ State : warning == Summary == $ dim sparse origin/drm-tip Sparse version: v0.5.2 Commit: dummycon: Sprinkle locking checks Okay! Commit: fbdev: locking check for fb_set_suspend Okay! Commit: vt: might_sleep() annotation for do_blank_screen Okay! Commit: vt: More locking checks Okay! Commit: fbdev/sa1100fb: Remove dead code Okay! Commit: fbdev/cyber2000: Remove struct display Okay! Commit: fbdev/aty128fb: Remove dead code Okay! Commit: fbcon: s/struct display/struct fbcon_display/ Okay! Commit: fbcon: Remove fbcon_has_exited Okay! Commit: fbcon: call fbcon_fb_(un)registered directly Okay! Commit: fbdev/sh_mobile: remove sh_mobile_lcdc_display_notify Okay! Commit: fbdev/omap: sysfs files can't disappear before the device is gone Okay! Commit: fbdev: sysfs files can't disappear before the device is gone Okay! Commit: staging/olpc: lock_fb_info can't fail Okay! Commit: fbdev/atyfb: lock_fb_info can't fail Okay! Commit: fbdev: lock_fb_info cannot fail Okay! Commit: fbcon: call fbcon_fb_bind directly Okay! Commit: fbdev: make unregister/unlink functions not fail Okay! Commit: fbdev: unify unlink_framebuffer paths Okay! Commit: fbdev/sh_mob: Remove fb notifier callback Okay! Commit: fbdev: directly call fbcon_suspended/resumed Okay! Commit: fbcon: Call fbcon_mode_deleted/new_modelist directly Okay! Commit: fbdev: Call fbcon_get_requirement directly Okay! Commit: Revert "backlight/fbcon: Add FB_EVENT_CONBLANK" Okay! Commit: fbmem: pull fbcon_fb_blanked out of fb_blank Okay! Commit: fbdev: remove FBINFO_MISC_USEREVENT around fb_blank Okay! Commit: fb: Flatten control flow in fb_set_var Okay! Commit: fbcon: replace FB_EVENT_MODE_CHANGE/_ALL with direct calls Okay! Commit: vgaswitcheroo: call fbcon_remap_all directly Okay! ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] ✓ Fi.CI.BAT: success for fbcon notifier begone! (rev3)
== Series Details == Series: fbcon notifier begone! (rev3) URL : https://patchwork.freedesktop.org/series/60843/ State : success == Summary == CI Bug Log - changes from CI_DRM_6140 -> Patchwork_13088 Summary --- **SUCCESS** No regressions found. External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13088/ Known issues Here are the changes found in Patchwork_13088 that come from known issues: ### IGT changes ### Issues hit * igt@i915_selftest@live_contexts: - fi-bdw-gvtdvm: [PASS][1] -> [DMESG-FAIL][2] ([fdo#110235]) [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6140/fi-bdw-gvtdvm/igt@i915_selftest@live_contexts.html [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13088/fi-bdw-gvtdvm/igt@i915_selftest@live_contexts.html Possible fixes * igt@gem_ctx_param@basic: - {fi-icl-u3}:[DMESG-WARN][3] ([fdo#107724]) -> [PASS][4] [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6140/fi-icl-u3/igt@gem_ctx_pa...@basic.html [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13088/fi-icl-u3/igt@gem_ctx_pa...@basic.html * igt@gem_exec_suspend@basic-s3: - fi-blb-e6850: [INCOMPLETE][5] ([fdo#107718]) -> [PASS][6] [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6140/fi-blb-e6850/igt@gem_exec_susp...@basic-s3.html [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13088/fi-blb-e6850/igt@gem_exec_susp...@basic-s3.html * igt@i915_selftest@live_contexts: - {fi-icl-dsi}: [INCOMPLETE][7] ([fdo#107713] / [fdo#108569]) -> [PASS][8] [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6140/fi-icl-dsi/igt@i915_selftest@live_contexts.html [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13088/fi-icl-dsi/igt@i915_selftest@live_contexts.html * igt@i915_selftest@live_hangcheck: - fi-skl-iommu: [INCOMPLETE][9] ([fdo#108602] / [fdo#108744]) -> [PASS][10] [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6140/fi-skl-iommu/igt@i915_selftest@live_hangcheck.html [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13088/fi-skl-iommu/igt@i915_selftest@live_hangcheck.html * igt@i915_selftest@live_requests: - fi-bsw-n3050: [INCOMPLETE][11] ([fdo#105876]) -> [PASS][12] [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6140/fi-bsw-n3050/igt@i915_selftest@live_requests.html [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13088/fi-bsw-n3050/igt@i915_selftest@live_requests.html {name}: This element is suppressed. This means it is ignored when computing the status of the difference (SUCCESS, WARNING, or FAILURE). [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167 [fdo#105876]: https://bugs.freedesktop.org/show_bug.cgi?id=105876 [fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713 [fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718 [fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724 [fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569 [fdo#108602]: https://bugs.freedesktop.org/show_bug.cgi?id=108602 [fdo#108744]: https://bugs.freedesktop.org/show_bug.cgi?id=108744 [fdo#110235]: https://bugs.freedesktop.org/show_bug.cgi?id=110235 [fdo#110718]: https://bugs.freedesktop.org/show_bug.cgi?id=110718 Participating hosts (52 -> 46) -- Additional (1): fi-apl-guc Missing(7): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-byt-clapper fi-bdw-samus Build changes - * Linux: CI_DRM_6140 -> Patchwork_13088 CI_DRM_6140: 0dc04d35a90b3a884e00a31f0c843c433cb5540f @ git://anongit.freedesktop.org/gfx-ci/linux IGT_5012: 996b4346b6a7f2bd0919817648a4f7a382e59757 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools Patchwork_13088: 23cf8c0c6470c7cad54f1c7dd2bed6e7bc63e468 @ git://anongit.freedesktop.org/gfx-ci/linux == Linux commits == 23cf8c0c6470 backlight: simplify lcd notifier 75caa7472f10 staging/olpc_dcon: Add drm conversion to TODO a3dba88493a1 fbcon: Document what I learned about fbcon locking d1f28ba00574 fbcon: Call con2fb_map functions directly ab33022e9599 vgaswitcheroo: call fbcon_remap_all directly 94a654b31b8a fbcon: replace FB_EVENT_MODE_CHANGE/_ALL with direct calls 5d9e17ceb619 fb: Flatten control flow in fb_set_var c740c3c17833 fbdev: remove FBINFO_MISC_USEREVENT around fb_blank 0e234a059fe0 fbmem: pull fbcon_fb_blanked out of fb_blank e7c5a8669273 Revert "backlight/fbcon: Add FB_EVENT_CONBLANK" 469f9d259776 fbdev: Call fbcon_get_requirement directly ec8cda3f49fb fbcon: Call fbcon_mode_deleted/new_modelist directly dccfc685e1dc fbdev: directly call fbcon_suspended/resumed e81fd595bc00 fbdev/sh_mob: Remove fb notifier callback 63e5a6ca8ea7 fbdev: unify unlink_framebuffer paths c00611f73ad1 fbdev: make unregister/unlink functions not fail 6206f93346b9 fbc
Re: [Intel-gfx] [PATCH v6 0/8] drm/fb-helper: Move modesetting code to drm_client
On Thu, May 23, 2019 at 06:53:20PM +0200, Sam Ravnborg wrote: > Hi Linus, Gerd. > > > This moves the modesetting code from drm_fb_helper to drm_client so it > > can be shared by all internal clients. > > Could one of you take a look at this series. > Daniel already ack'ed the series on irc, but an extra pair of eyes > is never bad. > > For my part I have been through them all, but I still do not have > the full picture of the DRM subsystem so my review may not > suffice. Looks sane to me overall. Tried to give the series a spin in qemu, but: ERROR: "drm_client_panel_rotation" [drivers/gpu/drm/drm_kms_helper.ko] undefined! EXPORT_SYMBOL() missing? cheers, Gerd ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH] drm/i915/dsi: Use a fuzzy check for burst mode clock check
Prior to this commit we fail to init the DSI panel on the GPD MicroPC: https://www.indiegogo.com/projects/gpd-micropc-6-inch-handheld-industry-laptop#/ The problem is intel_dsi_vbt_init() failing with the following error: *ERROR* Burst mode freq is less than computed The pclk in the VBT panel modeline is 7, together with 24 bpp and 4 lines this results in a bitrate value of 7 * 24 / 4 = 42. But the target_burst_mode_freq in the VBT is 418000. This commit works around this problem by adding an intel_fuzzy_clock_check when target_burst_mode_freq < bitrate and setting target_burst_mode_freq to bitrate when that checks succeeds, fixing the panel not working. Cc: sta...@vger.kernel.org Signed-off-by: Hans de Goede --- drivers/gpu/drm/i915/intel_dsi_vbt.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_dsi_vbt.c b/drivers/gpu/drm/i915/intel_dsi_vbt.c index 022bf59418df..a2a9b9d0eeaa 100644 --- a/drivers/gpu/drm/i915/intel_dsi_vbt.c +++ b/drivers/gpu/drm/i915/intel_dsi_vbt.c @@ -895,6 +895,17 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id) if (mipi_config->target_burst_mode_freq) { u32 bitrate = intel_dsi_bitrate(intel_dsi); + /* +* Sometimes the VBT contains a slightly lower clock, +* then the bitrate we have calculated, in this case +* just replace it with the calculated bitrate. +*/ + if (mipi_config->target_burst_mode_freq < bitrate && + intel_fuzzy_clock_check( + mipi_config->target_burst_mode_freq, + bitrate)) + mipi_config->target_burst_mode_freq = bitrate; + if (mipi_config->target_burst_mode_freq < bitrate) { DRM_ERROR("Burst mode freq is less than computed\n"); return false; -- 2.21.0 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH v2] drm/i915/huc: Don't try to check HuC status if it's not loaded
Quoting Ye, Tony (2019-05-22 14:32:41) > From UMD perspective, when HuC is not working as expected, usually we > look into the kernel log and i915_huc_load_status debugfs to find out > why it's not working. It will be helpful to know the reason of the > failure from the error code. The typically failures we encountered are > "HuC FW not loaded (FW not built into initramfs)" and "HuC FW > authentication failed". > > And it looks clearer to me if we can define 0 as "disabled by user" to > distinguish it from other errors like ENODEV, ENOPKG and "not > authenticated". Suggestion by Chris for 0/1 for huc_status makes sense to me to reflect if HuC authentication was succesful or not. Mostly because the name of the debugfs and func is huc_status. It also nicely maps to a register. One could have huc_enabled which would then collapse to easy 0/1, but that'd be bit redundant. Regards, Joonas ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 24/33] Revert "backlight/fbcon: Add FB_EVENT_CONBLANK"
On Fri, May 24, 2019 at 10:53:45AM +0200, Daniel Vetter wrote: > This reverts commit 994efacdf9a087b52f71e620b58dfa526b0cf928. > > The justification is that if hw blanking fails (i.e. fbops->fb_blank) > fails, then we still want to shut down the backlight. Which is exactly > _not_ what fb_blank() does and so rather inconsistent if we end up > with different behaviour between fbcon and direct fbdev usage. Given > that the entire notifier maze is getting in the way anyway I figured > it's simplest to revert this not well justified commit. > > v2: Add static inline to the dummy version. > > Cc: Richard Purdie > Signed-off-by: Daniel Vetter > Cc: Lee Jones > Cc: Daniel Thompson > Cc: Jingoo Han > Cc: Bartlomiej Zolnierkiewicz > Cc: Daniel Vetter > Cc: Hans de Goede > Cc: Yisheng Xie > Cc: linux-fb...@vger.kernel.org Hi Daniel When this goes round again could you add me to the covering letter? I looked at all three of the patches and no objections on my side but I'm reluctant to send out acks because I'm not sure I understood the wider picture well enough. Daniel. > --- > drivers/video/backlight/backlight.c | 2 +- > drivers/video/fbdev/core/fbcon.c| 14 +- > drivers/video/fbdev/core/fbmem.c| 1 + > include/linux/fb.h | 4 +--- > include/linux/fbcon.h | 2 ++ > 5 files changed, 6 insertions(+), 17 deletions(-) > > diff --git a/drivers/video/backlight/backlight.c > b/drivers/video/backlight/backlight.c > index deb824bef6e2..c55590ec0057 100644 > --- a/drivers/video/backlight/backlight.c > +++ b/drivers/video/backlight/backlight.c > @@ -46,7 +46,7 @@ static int fb_notifier_callback(struct notifier_block *self, > int fb_blank = 0; > > /* If we aren't interested in this event, skip it immediately ... */ > - if (event != FB_EVENT_BLANK && event != FB_EVENT_CONBLANK) > + if (event != FB_EVENT_BLANK) > return 0; > > bd = container_of(self, struct backlight_device, fb_notif); > diff --git a/drivers/video/fbdev/core/fbcon.c > b/drivers/video/fbdev/core/fbcon.c > index 259cdd118475..d9f545f1a81b 100644 > --- a/drivers/video/fbdev/core/fbcon.c > +++ b/drivers/video/fbdev/core/fbcon.c > @@ -2350,8 +2350,6 @@ static int fbcon_switch(struct vc_data *vc) > static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, > int blank) > { > - struct fb_event event; > - > if (blank) { > unsigned short charmask = vc->vc_hi_font_mask ? > 0x1ff : 0xff; > @@ -2362,13 +2360,6 @@ static void fbcon_generic_blank(struct vc_data *vc, > struct fb_info *info, > fbcon_clear(vc, 0, 0, vc->vc_rows, vc->vc_cols); > vc->vc_video_erase_char = oldc; > } > - > - > - lock_fb_info(info); > - event.info = info; > - event.data = ␣ > - fb_notifier_call_chain(FB_EVENT_CONBLANK, &event); > - unlock_fb_info(info); > } > > static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) > @@ -3240,7 +3231,7 @@ int fbcon_fb_registered(struct fb_info *info) > return ret; > } > > -static void fbcon_fb_blanked(struct fb_info *info, int blank) > +void fbcon_fb_blanked(struct fb_info *info, int blank) > { > struct fbcon_ops *ops = info->fbcon_par; > struct vc_data *vc; > @@ -3344,9 +3335,6 @@ static int fbcon_event_notify(struct notifier_block > *self, > con2fb = event->data; > con2fb->framebuffer = con2fb_map[con2fb->console - 1]; > break; > - case FB_EVENT_BLANK: > - fbcon_fb_blanked(info, *(int *)event->data); > - break; > case FB_EVENT_REMAP_ALL_CONSOLE: > idx = info->node; > fbcon_remap_all(idx); > diff --git a/drivers/video/fbdev/core/fbmem.c > b/drivers/video/fbdev/core/fbmem.c > index ddc0c16b8bbf..9366fbe99a58 100644 > --- a/drivers/video/fbdev/core/fbmem.c > +++ b/drivers/video/fbdev/core/fbmem.c > @@ -1068,6 +1068,7 @@ fb_blank(struct fb_info *info, int blank) > event.data = ␣ > > early_ret = fb_notifier_call_chain(FB_EARLY_EVENT_BLANK, &event); > + fbcon_fb_blanked(info, blank); > > if (info->fbops->fb_blank) > ret = info->fbops->fb_blank(blank, info); > diff --git a/include/linux/fb.h b/include/linux/fb.h > index 0d86aa31bf8d..1e66fac3124f 100644 > --- a/include/linux/fb.h > +++ b/include/linux/fb.h > @@ -137,12 +137,10 @@ struct fb_cursor_user { > #define FB_EVENT_GET_CONSOLE_MAP0x07 > /* CONSOLE-SPECIFIC: set console to framebuffer mapping */ > #define FB_EVENT_SET_CONSOLE_MAP0x08 > -/* A hardware display blank change occurred */ > +/* A display blank is requested */ > #define FB_EVENT_BLANK 0x09 > /* Private modelist is to be replaced */ > #define FB_EVENT_MODE_CHANGE_ALL 0x0B > -/* A software display blank change occurred */ > -#define FB_EVE
[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/dsi: Use a fuzzy check for burst mode clock check
== Series Details == Series: drm/i915/dsi: Use a fuzzy check for burst mode clock check URL : https://patchwork.freedesktop.org/series/61105/ State : failure == Summary == CALLscripts/checksyscalls.sh CALLscripts/atomic/check-atomics.sh DESCEND objtool CHK include/generated/compile.h AR drivers/gpu/drm/i915/built-in.a CC [M] drivers/gpu/drm/i915/header_test_i915_active_types.o CC [M] drivers/gpu/drm/i915/header_test_i915_debugfs.o CC [M] drivers/gpu/drm/i915/header_test_i915_drv.o CC [M] drivers/gpu/drm/i915/header_test_i915_gem_context_types.o CC [M] drivers/gpu/drm/i915/header_test_i915_gem_pm.o CC [M] drivers/gpu/drm/i915/header_test_i915_irq.o CC [M] drivers/gpu/drm/i915/header_test_i915_params.o CC [M] drivers/gpu/drm/i915/header_test_i915_priolist_types.o CC [M] drivers/gpu/drm/i915/header_test_i915_reg.o CC [M] drivers/gpu/drm/i915/header_test_i915_scheduler_types.o CC [M] drivers/gpu/drm/i915/header_test_i915_timeline_types.o CC [M] drivers/gpu/drm/i915/header_test_i915_utils.o CC [M] drivers/gpu/drm/i915/header_test_intel_acpi.o CC [M] drivers/gpu/drm/i915/header_test_intel_atomic.o CC [M] drivers/gpu/drm/i915/header_test_intel_atomic_plane.o CC [M] drivers/gpu/drm/i915/header_test_intel_audio.o CC [M] drivers/gpu/drm/i915/header_test_intel_bios.o CC [M] drivers/gpu/drm/i915/header_test_intel_cdclk.o CC [M] drivers/gpu/drm/i915/header_test_intel_color.o CC [M] drivers/gpu/drm/i915/header_test_intel_combo_phy.o CC [M] drivers/gpu/drm/i915/header_test_intel_connector.o CC [M] drivers/gpu/drm/i915/header_test_intel_crt.o CC [M] drivers/gpu/drm/i915/header_test_intel_csr.o CC [M] drivers/gpu/drm/i915/header_test_intel_ddi.o CC [M] drivers/gpu/drm/i915/header_test_intel_dp.o CC [M] drivers/gpu/drm/i915/header_test_intel_dp_aux_backlight.o CC [M] drivers/gpu/drm/i915/header_test_intel_dp_link_training.o CC [M] drivers/gpu/drm/i915/header_test_intel_dp_mst.o CC [M] drivers/gpu/drm/i915/header_test_intel_dpio_phy.o CC [M] drivers/gpu/drm/i915/header_test_intel_dpll_mgr.o CC [M] drivers/gpu/drm/i915/header_test_intel_drv.o CC [M] drivers/gpu/drm/i915/header_test_intel_dsi.o CC [M] drivers/gpu/drm/i915/header_test_intel_dsi_dcs_backlight.o CC [M] drivers/gpu/drm/i915/header_test_intel_dvo.o CC [M] drivers/gpu/drm/i915/header_test_intel_dvo_dev.o CC [M] drivers/gpu/drm/i915/header_test_intel_fbc.o CC [M] drivers/gpu/drm/i915/header_test_intel_fbdev.o CC [M] drivers/gpu/drm/i915/header_test_intel_fifo_underrun.o CC [M] drivers/gpu/drm/i915/header_test_intel_frontbuffer.o CC [M] drivers/gpu/drm/i915/header_test_intel_gmbus.o CC [M] drivers/gpu/drm/i915/header_test_intel_hdcp.o CC [M] drivers/gpu/drm/i915/header_test_intel_hdmi.o CC [M] drivers/gpu/drm/i915/header_test_intel_hotplug.o CC [M] drivers/gpu/drm/i915/header_test_intel_lpe_audio.o CC [M] drivers/gpu/drm/i915/header_test_intel_lspcon.o CC [M] drivers/gpu/drm/i915/header_test_intel_lvds.o CC [M] drivers/gpu/drm/i915/header_test_intel_overlay.o CC [M] drivers/gpu/drm/i915/header_test_intel_panel.o CC [M] drivers/gpu/drm/i915/header_test_intel_pipe_crc.o CC [M] drivers/gpu/drm/i915/header_test_intel_pm.o CC [M] drivers/gpu/drm/i915/header_test_intel_psr.o CC [M] drivers/gpu/drm/i915/header_test_intel_quirks.o CC [M] drivers/gpu/drm/i915/header_test_intel_runtime_pm.o CC [M] drivers/gpu/drm/i915/header_test_intel_sdvo.o CC [M] drivers/gpu/drm/i915/header_test_intel_sideband.o CC [M] drivers/gpu/drm/i915/header_test_intel_sprite.o CC [M] drivers/gpu/drm/i915/header_test_intel_tv.o CC [M] drivers/gpu/drm/i915/header_test_intel_uncore.o CC [M] drivers/gpu/drm/i915/header_test_intel_vdsc.o CC [M] drivers/gpu/drm/i915/header_test_intel_wakeref.o CC [M] drivers/gpu/drm/i915/intel_dsi_vbt.o drivers/gpu/drm/i915/intel_dsi_vbt.c: In function ‘intel_dsi_vbt_init’: drivers/gpu/drm/i915/intel_dsi_vbt.c:867:8: error: implicit declaration of function ‘intel_fuzzy_clock_check’; did you mean ‘intel_guc_log_create’? [-Werror=implicit-function-declaration] intel_fuzzy_clock_check( ^~~ intel_guc_log_create cc1: all warnings being treated as errors scripts/Makefile.build:278: recipe for target 'drivers/gpu/drm/i915/intel_dsi_vbt.o' failed make[4]: *** [drivers/gpu/drm/i915/intel_dsi_vbt.o] Error 1 scripts/Makefile.build:489: recipe for target 'drivers/gpu/drm/i915' failed make[3]: *** [drivers/gpu/drm/i915] Error 2 scripts/Makefile.build:489: recipe for target 'drivers/gpu/drm' failed make[2]: *** [drivers/gpu/drm] Error 2 scripts/Makefile.build:489: recipe for target 'drivers/gpu' failed make[1]: *** [drivers/gpu] Error 2 Makefile:1071: recipe for target 'drivers' failed make: *** [drivers] Error 2 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.fre
Re: [Intel-gfx] [PATCH v2] drm/i915/huc: Don't try to check HuC status if it's not loaded
On Fri, 24 May 2019 15:10:58 +0200, Joonas Lahtinen wrote: Quoting Ye, Tony (2019-05-22 14:32:41) From UMD perspective, when HuC is not working as expected, usually we look into the kernel log and i915_huc_load_status debugfs to find out why it's not working. It will be helpful to know the reason of the failure from the error code. The typically failures we encountered are "HuC FW not loaded (FW not built into initramfs)" and "HuC FW authentication failed". And it looks clearer to me if we can define 0 as "disabled by user" to distinguish it from other errors like ENODEV, ENOPKG and "not authenticated". Suggestion by Chris for 0/1 for huc_status makes sense to me to reflect if HuC authentication was succesful or not. Mostly because the name of the debugfs and func is huc_status. It also nicely maps to a register. But this entry is not limited to "huc authentication status", as then we should even not try to introduce new errors, but return 0 to match register. On other hand, under normal conditions, we expect HuC to be authenticated and running or explicitly disabled by the user. Other cases are unexpected error conditions. I would expect from the ABI that these error conditions will be reported as errors. For me ABI is something more than reg value. One could have huc_enabled which would then collapse to easy 0/1, but that'd be bit redundant. that's why we wanted to provide more details in new error codes for existing GETPARAM, without breaking current usages. Michal Regards, Joonas ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH i-g-t] i915/gem_busy: Fix typo killing snb!
Check the right engine to see if it is the one that explodes! Fixes: 88318b0771f9 ("test/i915: gem_busy: use the gem_engine_topology library") Signed-off-by: Chris Wilson Cc: Andi Shyti Cc: Tvrtko Ursulin --- tests/i915/gem_busy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/i915/gem_busy.c b/tests/i915/gem_busy.c index f3ebb37a3..a55358708 100644 --- a/tests/i915/gem_busy.c +++ b/tests/i915/gem_busy.c @@ -256,7 +256,7 @@ static void one(int fd, const struct intel_execution_engine2 *e, unsigned test_f e2->instance == e->instance) continue; - if (!gem_class_can_store_dword(fd, e->class)) + if (!gem_class_can_store_dword(fd, e2->class)) continue; igt_debug("Testing %s in parallel\n", e2->name); -- 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH i-g-t] i915/gem_busy: Fix typo killing snb!
> - if (!gem_class_can_store_dword(fd, e->class)) > + if (!gem_class_can_store_dword(fd, e2->class)) > continue; ops! Reviewed-by: Andi Shyti Thanks, Andi > igt_debug("Testing %s in parallel\n", e2->name); > -- > 2.20.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH] drm/i915/dsi: Use a fuzzy check for burst mode clock check
Hi, On 5/24/19 3:06 PM, Hans de Goede wrote: Prior to this commit we fail to init the DSI panel on the GPD MicroPC: https://www.indiegogo.com/projects/gpd-micropc-6-inch-handheld-industry-laptop#/ The problem is intel_dsi_vbt_init() failing with the following error: *ERROR* Burst mode freq is less than computed The pclk in the VBT panel modeline is 7, together with 24 bpp and 4 lines this results in a bitrate value of 7 * 24 / 4 = 42. But the target_burst_mode_freq in the VBT is 418000. This commit works around this problem by adding an intel_fuzzy_clock_check when target_burst_mode_freq < bitrate and setting target_burst_mode_freq to bitrate when that checks succeeds, fixing the panel not working. Cc: sta...@vger.kernel.org Signed-off-by: Hans de Goede I just realized that this patch depends on a patch from another series of mine which exports intel_fuzzy_clock_check, I will resend this as a series with the patch doing the exporting as first patch, so that the CI can test this. Regards, Hans --- drivers/gpu/drm/i915/intel_dsi_vbt.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_dsi_vbt.c b/drivers/gpu/drm/i915/intel_dsi_vbt.c index 022bf59418df..a2a9b9d0eeaa 100644 --- a/drivers/gpu/drm/i915/intel_dsi_vbt.c +++ b/drivers/gpu/drm/i915/intel_dsi_vbt.c @@ -895,6 +895,17 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id) if (mipi_config->target_burst_mode_freq) { u32 bitrate = intel_dsi_bitrate(intel_dsi); + /* +* Sometimes the VBT contains a slightly lower clock, +* then the bitrate we have calculated, in this case +* just replace it with the calculated bitrate. +*/ + if (mipi_config->target_burst_mode_freq < bitrate && + intel_fuzzy_clock_check( + mipi_config->target_burst_mode_freq, + bitrate)) + mipi_config->target_burst_mode_freq = bitrate; + if (mipi_config->target_burst_mode_freq < bitrate) { DRM_ERROR("Burst mode freq is less than computed\n"); return false; ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH] drm/i915: Keep user GGTT alive for a minimum of 250ms
Do not allow runtime pm autosuspend to remove userspace GGTT mmaps too quickly. For example, igt sets the autosuspend delay to 0, and so we immediately attempt to perform runtime suspend upon releasing the wakeref. Unfortunately, that involves tearing down GGTT mmaps as they require an active device. Override the autosuspend for GGTT mmaps, by keeping the wakeref around for 250ms after populating the PTE for a fresh mmap. Signed-off-by: Chris Wilson Cc: Mika Kuoppala --- drivers/gpu/drm/i915/Kconfig.profile | 14 +++ drivers/gpu/drm/i915/i915_drv.h | 3 ++ drivers/gpu/drm/i915/i915_gem.c | 7 drivers/gpu/drm/i915/intel_wakeref.c | 55 drivers/gpu/drm/i915/intel_wakeref.h | 27 ++ 5 files changed, 106 insertions(+) diff --git a/drivers/gpu/drm/i915/Kconfig.profile b/drivers/gpu/drm/i915/Kconfig.profile index 0e5db98da8f3..4fd1ea639d0f 100644 --- a/drivers/gpu/drm/i915/Kconfig.profile +++ b/drivers/gpu/drm/i915/Kconfig.profile @@ -1,3 +1,17 @@ +config DRM_I915_USERFAULT_AUTOSUSPEND + int "Runtime autosuspend delay for userspace GGTT mmaps (ms)" + default 250 # milliseconds + help + On runtime suspend, as we suspend the device, we have to revoke + userspace GGTT mmaps and force userspace to take a pagefault on + their next access. The revocation and subsequent recreation of + the GGTT mmap can be very slow and so we impose a small hysteris + that complements the runtime-pm autosuspend and provides a lower + floor on the autosuspend delay. + + May be 0 to disable the extra delay and solely use the device level + runtime pm autosuspend delay tunable. + config DRM_I915_SPIN_REQUEST int default 5 # microseconds diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 311e19154672..41dad8889eaa 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -874,6 +874,9 @@ struct i915_gem_mm { */ struct list_head userfault_list; + /* Manual runtime pm autosuspend delay for user GGTT mmaps */ + struct intel_wakeref_auto userfault_wakeref; + /** * List of objects which are pending destruction. */ diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index d3b7dac527dc..cb786582e2fe 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -1834,6 +1834,9 @@ vm_fault_t i915_gem_fault(struct vm_fault *vmf) assert_rpm_wakelock_held(dev_priv); if (!i915_vma_set_userfault(vma) && !obj->userfault_count++) list_add(&obj->userfault_link, &dev_priv->mm.userfault_list); + if (CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND) + intel_wakeref_auto(&dev_priv->mm.userfault_wakeref, + msecs_to_jiffies_timeout(CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND)); GEM_BUG_ON(!obj->userfault_count); i915_vma_set_ggtt_write(vma); @@ -4671,6 +4674,8 @@ void i915_gem_fini(struct drm_i915_private *dev_priv) { GEM_BUG_ON(dev_priv->gt.awake); + intel_wakeref_auto_fini(&dev_priv->mm.userfault_wakeref); + i915_gem_suspend_late(dev_priv); intel_disable_gt_powersave(dev_priv); @@ -4748,6 +4753,8 @@ static void i915_gem_init__mm(struct drm_i915_private *i915) INIT_LIST_HEAD(&i915->mm.fence_list); INIT_LIST_HEAD(&i915->mm.userfault_list); + intel_wakeref_auto_init(&i915->mm.userfault_wakeref, i915); + INIT_WORK(&i915->mm.free_work, __i915_gem_free_work); } diff --git a/drivers/gpu/drm/i915/intel_wakeref.c b/drivers/gpu/drm/i915/intel_wakeref.c index 91196d9612bb..34693b74c67a 100644 --- a/drivers/gpu/drm/i915/intel_wakeref.c +++ b/drivers/gpu/drm/i915/intel_wakeref.c @@ -73,3 +73,58 @@ void __intel_wakeref_init(struct intel_wakeref *wf, struct lock_class_key *key) atomic_set(&wf->count, 0); wf->wakeref = 0; } + +static void wakeref_auto_timeout(struct timer_list *t) +{ + struct intel_wakeref_auto *wf = from_timer(wf, t, timer); + intel_wakeref_t wakeref; + unsigned long flags; + + if (!atomic_dec_and_lock_irqsave(&wf->count, &wf->lock, flags)) + return; + + wakeref = fetch_and_zero(&wf->wakeref); + spin_unlock_irqrestore(&wf->lock, flags); + + intel_runtime_pm_put(wf->i915, wakeref); +} + +void intel_wakeref_auto_init(struct intel_wakeref_auto *wf, +struct drm_i915_private *i915) +{ + spin_lock_init(&wf->lock); + timer_setup(&wf->timer, wakeref_auto_timeout, 0); + atomic_set(&wf->count, 0); + wf->wakeref = 0; + wf->i915 = i915; +} + +void intel_wakeref_auto(struct intel_wakeref_auto *wf, long timeout) +{ + unsigned long flags; + + assert_rpm_wakelock_held(wf->i915); + + spin_lock_irqsave(&wf->lock, flags); + if (!atomic_
Re: [Intel-gfx] [PATCH v6 0/8] drm/fb-helper: Move modesetting code to drm_client
On Thu, May 23, 2019 at 6:53 PM Sam Ravnborg wrote: > Could one of you take a look at this series. > Daniel already ack'ed the series on irc, but an extra pair of eyes > is never bad. I would if I had a chance of understanding them. I am still pretty novice with DRM so what I do is trace down to the calls I need and understand the small pieces I use. Yours, Linus Walleij ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [v6][PATCH 03/12] drm/i915: Add intel_color_lut_equal() to compare hw and sw gamma/degamma lut values
On Tue, May 21, 2019 at 07:12:28PM +0530, Sharma, Swati2 wrote: > On 14-May-19 9:40 PM, Ville Syrjälä wrote: > > > On Tue, May 14, 2019 at 03:13:21PM +0530, Swati Sharma wrote: > >> v3: -Rebase > >> v4: -Renamed intel_compare_color_lut() to intel_color_lut_equal() [Jani] > >> -Added the default label above the correct label [Jani] > >> -Corrected smatch warn "variable dereferenced before check" [Dan > >> Carpenter] > >> v5: -Added condition (!blob1 && !blob2) return true [Jani] > >> -Called PIPE_CONF_CHECK_COLOR_LUT inside if (!adjust) [Jani] > >> -Added #undef PIPE_CONF_CHECK_COLOR_LUT [Jani] > >> v6: -Added func intel_color_get_bit_precision() to get bit precision for > >> gamma and degamma lut readout depending upon platform and > >> corresponding to load_luts() [Ankit] > >> -Added debug log for color para in intel_dump_pipe_config [Jani] > >> -Made patch11 as patch3 [Jani] > >> > >> I could think of adding intel_color_get_bit_precision() to be the way > >> to get away with bit precision problem for degamma and gamma (its like a > >> table > >> having hard coded values depening on gamma_mode). > >> If anybody could think of better way then this then please guide. > >> > >> Signed-off-by: Swati Sharma > >> --- > >> drivers/gpu/drm/i915/intel_color.c | 93 > >> > >> drivers/gpu/drm/i915/intel_color.h | 7 +++ > >> drivers/gpu/drm/i915/intel_display.c | 24 ++ > >> 3 files changed, 124 insertions(+) > >> > >> diff --git a/drivers/gpu/drm/i915/intel_color.c > >> b/drivers/gpu/drm/i915/intel_color.c > >> index 50b98ee..1e60369 100644 > >> --- a/drivers/gpu/drm/i915/intel_color.c > >> +++ b/drivers/gpu/drm/i915/intel_color.c > >> @@ -1251,6 +1251,99 @@ static int icl_color_check(struct intel_crtc_state > >> *crtc_state) > >>return 0; > >> } > >> > >> +void intel_color_get_bit_precision(struct intel_crtc_state *crtc_state, > >> int *bp_gamma) > >> +{ > >> + struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc); > >> + struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); > >> + > >> + if (HAS_GMCH(dev_priv)) { > >> + if (IS_CHERRYVIEW(dev_priv)) { > >> + if (crtc_state->gamma_mode == GAMMA_MODE_MODE_8BIT) { > >> + *bp_gamma = 8; > >> + return; > > Functions can actually return values. > > > > Not sure I particularly like this function though. We can't fit > > the gamma vs. degamm stuff in here neatly. I think per-platform > > stuff to determine the precision is required to make this sane. > > And it should probably got into intel_color.c to keep things > > neatly contained. > > > > Something along the lines of: > > > > i9xx_gamma_precision() > > { > > if (!gamma_enable) > > return 0; > > > > switch (gamma_mode) { > > case GAMMA_MODE_MODE_8BIT: > > return 8; > > case GAMMA_MODE_MODE_10BIT: > > return 16; > > } > > } > > > > chv_gamma_precision() > > { > > if (cgm_mode & CGM_PIPE_MODE_GAMMA) > > return 10; > > else > > return i9xx_gamma_precision(); > > } > > > > chv_degamma_precision(crtc_state) > > { > > if (cgm_mode & CGM_PIPE_MODE_DEGAMMA) > > return 14; > > else > > return 0 > > } > > > > ilk_gamma_precision() > > { > > if (!gamma_enable) > > return 0; > > > > if ((csc_mode & CSC_POSITION_BEFORE_GAMMA) == 0) > > return 0; > > > > switch (gamma_mode) { > > case GAMMA_MODE_MODE_8BIT: > > return 8; > > case GAMMA_MODE_MODE_10BIT: > > return 10; > > } > > } > > > > ilk_degamma_precision() > > { > > if (!gamma_enable) > > return 0; > > > > if ((csc_mode & CSC_POSITION_BEFORE_GAMMA) != 0) > > return 0; > > > > switch (gamma_mode) { > > case GAMMA_MODE_MODE_8BIT: > > return 8; > > case GAMMA_MODE_MODE_10BIT: > > return 10; > > } > > } > > > > ... extend to ivb, glk, and icl variants too. > > ok..will do like this. thanks! sorry i was on leave. > 2 queries: > (1) Since intel_color_get_bit_precision() will be used to set bit precision > for gamma and degamma both, it will > return multiple values..should i return values as struct? or sending as > pointer is ok? > if (HAS_GMCH(dev_priv)) { > if (IS_CHERRYVIEW(dev_priv)) > *bp_gamma = chv_gamma_precision(crtc_state); > (2) (or) if this method is not fine, should we have function ptr for the same? > Please suggest the best method? I would go for separate functions for gamma and degamma. > > > > >> + } > >> + if (crtc_state->cgm_mode == CGM_PIPE_MODE_GAMMA) > >> + *bp_gamma = 10; > >> + } else if (INTEL_GEN(dev_priv) >= 4) { > >> + if (crtc_state->gamma_mode == GAMMA_MOD
Re: [Intel-gfx] [PATCH v6 0/8] drm/fb-helper: Move modesetting code to drm_client
Hi Linus. Thanks for the response. > > Could one of you take a look at this series. > > Daniel already ack'ed the series on irc, but an extra pair of eyes > > is never bad. > > I would if I had a chance of understanding them. I am still pretty > novice with DRM so what I do is trace down to the calls I > need and understand the small pieces I use. We are almost on the same page here, expect that I am sometimes at loss understanding :-) Sam ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 24/33] Revert "backlight/fbcon: Add FB_EVENT_CONBLANK"
Hi Daniel, On Fri, May 24, 2019 at 3:14 PM Daniel Thompson wrote: > > On Fri, May 24, 2019 at 10:53:45AM +0200, Daniel Vetter wrote: > > This reverts commit 994efacdf9a087b52f71e620b58dfa526b0cf928. > > > > The justification is that if hw blanking fails (i.e. fbops->fb_blank) > > fails, then we still want to shut down the backlight. Which is exactly > > _not_ what fb_blank() does and so rather inconsistent if we end up > > with different behaviour between fbcon and direct fbdev usage. Given > > that the entire notifier maze is getting in the way anyway I figured > > it's simplest to revert this not well justified commit. > > > > v2: Add static inline to the dummy version. > > > > Cc: Richard Purdie > > Signed-off-by: Daniel Vetter > > Cc: Lee Jones > > Cc: Daniel Thompson > > Cc: Jingoo Han > > Cc: Bartlomiej Zolnierkiewicz > > Cc: Daniel Vetter > > Cc: Hans de Goede > > Cc: Yisheng Xie > > Cc: linux-fb...@vger.kernel.org > > Hi Daniel > > When this goes round again could you add me to the covering letter? > > I looked at all three of the patches and no objections on my side but > I'm reluctant to send out acks because I'm not sure I understood the > wider picture well enough. It's one of these patch series with some many different subsystems and people you can't cc the cover to all of them or mailing lists start rejecting you because too many recipients. I tried to spam sufficient mailng lists, but I guess not enough. Cover letter of version one, which tries to explain the full big picture: https://lists.freedesktop.org/archives/dri-devel/2019-May/218362.html tldr; I have a multi-year plan to improve fbcon locking, because the current thing is a bit a mess. Cover letter of this version, where I detail a bit more the details fixed in this one here: https://lists.freedesktop.org/archives/dri-devel/2019-May/218984.html I can also bounce these to you if you want. Thanks, Daniel > > > Daniel. > > > > --- > > drivers/video/backlight/backlight.c | 2 +- > > drivers/video/fbdev/core/fbcon.c| 14 +- > > drivers/video/fbdev/core/fbmem.c| 1 + > > include/linux/fb.h | 4 +--- > > include/linux/fbcon.h | 2 ++ > > 5 files changed, 6 insertions(+), 17 deletions(-) > > > > diff --git a/drivers/video/backlight/backlight.c > > b/drivers/video/backlight/backlight.c > > index deb824bef6e2..c55590ec0057 100644 > > --- a/drivers/video/backlight/backlight.c > > +++ b/drivers/video/backlight/backlight.c > > @@ -46,7 +46,7 @@ static int fb_notifier_callback(struct notifier_block > > *self, > > int fb_blank = 0; > > > > /* If we aren't interested in this event, skip it immediately ... */ > > - if (event != FB_EVENT_BLANK && event != FB_EVENT_CONBLANK) > > + if (event != FB_EVENT_BLANK) > > return 0; > > > > bd = container_of(self, struct backlight_device, fb_notif); > > diff --git a/drivers/video/fbdev/core/fbcon.c > > b/drivers/video/fbdev/core/fbcon.c > > index 259cdd118475..d9f545f1a81b 100644 > > --- a/drivers/video/fbdev/core/fbcon.c > > +++ b/drivers/video/fbdev/core/fbcon.c > > @@ -2350,8 +2350,6 @@ static int fbcon_switch(struct vc_data *vc) > > static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, > > int blank) > > { > > - struct fb_event event; > > - > > if (blank) { > > unsigned short charmask = vc->vc_hi_font_mask ? > > 0x1ff : 0xff; > > @@ -2362,13 +2360,6 @@ static void fbcon_generic_blank(struct vc_data *vc, > > struct fb_info *info, > > fbcon_clear(vc, 0, 0, vc->vc_rows, vc->vc_cols); > > vc->vc_video_erase_char = oldc; > > } > > - > > - > > - lock_fb_info(info); > > - event.info = info; > > - event.data = ␣ > > - fb_notifier_call_chain(FB_EVENT_CONBLANK, &event); > > - unlock_fb_info(info); > > } > > > > static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) > > @@ -3240,7 +3231,7 @@ int fbcon_fb_registered(struct fb_info *info) > > return ret; > > } > > > > -static void fbcon_fb_blanked(struct fb_info *info, int blank) > > +void fbcon_fb_blanked(struct fb_info *info, int blank) > > { > > struct fbcon_ops *ops = info->fbcon_par; > > struct vc_data *vc; > > @@ -3344,9 +3335,6 @@ static int fbcon_event_notify(struct notifier_block > > *self, > > con2fb = event->data; > > con2fb->framebuffer = con2fb_map[con2fb->console - 1]; > > break; > > - case FB_EVENT_BLANK: > > - fbcon_fb_blanked(info, *(int *)event->data); > > - break; > > case FB_EVENT_REMAP_ALL_CONSOLE: > > idx = info->node; > > fbcon_remap_all(idx); > > diff --git a/drivers/video/fbdev/core/fbmem.c > > b/drivers/video/fbdev/core/fbmem.c > > index ddc0c16b8bbf..9366fbe99a58 100644 > > --- a/drivers/video/fbdev/core/fbmem.c > > +++ b/drivers/video/
[Intel-gfx] [PATCH] drm/i915: Keep user GGTT alive for a minimum of 250ms
Do not allow runtime pm autosuspend to remove userspace GGTT mmaps too quickly. For example, igt sets the autosuspend delay to 0, and so we immediately attempt to perform runtime suspend upon releasing the wakeref. Unfortunately, that involves tearing down GGTT mmaps as they require an active device. Override the autosuspend for GGTT mmaps, by keeping the wakeref around for 250ms after populating the PTE for a fresh mmap. v2: Prefer refcount_t for its under/overflow error detection Signed-off-by: Chris Wilson Cc: Mika Kuoppala --- drivers/gpu/drm/i915/Kconfig.profile | 14 +++ drivers/gpu/drm/i915/i915_drv.h | 3 ++ drivers/gpu/drm/i915/i915_gem.c | 7 drivers/gpu/drm/i915/intel_wakeref.c | 58 drivers/gpu/drm/i915/intel_wakeref.h | 28 ++ 5 files changed, 110 insertions(+) diff --git a/drivers/gpu/drm/i915/Kconfig.profile b/drivers/gpu/drm/i915/Kconfig.profile index 0e5db98da8f3..4fd1ea639d0f 100644 --- a/drivers/gpu/drm/i915/Kconfig.profile +++ b/drivers/gpu/drm/i915/Kconfig.profile @@ -1,3 +1,17 @@ +config DRM_I915_USERFAULT_AUTOSUSPEND + int "Runtime autosuspend delay for userspace GGTT mmaps (ms)" + default 250 # milliseconds + help + On runtime suspend, as we suspend the device, we have to revoke + userspace GGTT mmaps and force userspace to take a pagefault on + their next access. The revocation and subsequent recreation of + the GGTT mmap can be very slow and so we impose a small hysteris + that complements the runtime-pm autosuspend and provides a lower + floor on the autosuspend delay. + + May be 0 to disable the extra delay and solely use the device level + runtime pm autosuspend delay tunable. + config DRM_I915_SPIN_REQUEST int default 5 # microseconds diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 311e19154672..41dad8889eaa 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -874,6 +874,9 @@ struct i915_gem_mm { */ struct list_head userfault_list; + /* Manual runtime pm autosuspend delay for user GGTT mmaps */ + struct intel_wakeref_auto userfault_wakeref; + /** * List of objects which are pending destruction. */ diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index d3b7dac527dc..cb786582e2fe 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -1834,6 +1834,9 @@ vm_fault_t i915_gem_fault(struct vm_fault *vmf) assert_rpm_wakelock_held(dev_priv); if (!i915_vma_set_userfault(vma) && !obj->userfault_count++) list_add(&obj->userfault_link, &dev_priv->mm.userfault_list); + if (CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND) + intel_wakeref_auto(&dev_priv->mm.userfault_wakeref, + msecs_to_jiffies_timeout(CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND)); GEM_BUG_ON(!obj->userfault_count); i915_vma_set_ggtt_write(vma); @@ -4671,6 +4674,8 @@ void i915_gem_fini(struct drm_i915_private *dev_priv) { GEM_BUG_ON(dev_priv->gt.awake); + intel_wakeref_auto_fini(&dev_priv->mm.userfault_wakeref); + i915_gem_suspend_late(dev_priv); intel_disable_gt_powersave(dev_priv); @@ -4748,6 +4753,8 @@ static void i915_gem_init__mm(struct drm_i915_private *i915) INIT_LIST_HEAD(&i915->mm.fence_list); INIT_LIST_HEAD(&i915->mm.userfault_list); + intel_wakeref_auto_init(&i915->mm.userfault_wakeref, i915); + INIT_WORK(&i915->mm.free_work, __i915_gem_free_work); } diff --git a/drivers/gpu/drm/i915/intel_wakeref.c b/drivers/gpu/drm/i915/intel_wakeref.c index 91196d9612bb..78b624c1ed59 100644 --- a/drivers/gpu/drm/i915/intel_wakeref.c +++ b/drivers/gpu/drm/i915/intel_wakeref.c @@ -73,3 +73,61 @@ void __intel_wakeref_init(struct intel_wakeref *wf, struct lock_class_key *key) atomic_set(&wf->count, 0); wf->wakeref = 0; } + +static void wakeref_auto_timeout(struct timer_list *t) +{ + struct intel_wakeref_auto *wf = from_timer(wf, t, timer); + intel_wakeref_t wakeref; + unsigned long flags; + + if (!refcount_dec_and_lock_irqsave(&wf->count, &wf->lock, &flags)) + return; + + wakeref = fetch_and_zero(&wf->wakeref); + spin_unlock_irqrestore(&wf->lock, flags); + + intel_runtime_pm_put(wf->i915, wakeref); +} + +void intel_wakeref_auto_init(struct intel_wakeref_auto *wf, +struct drm_i915_private *i915) +{ + spin_lock_init(&wf->lock); + timer_setup(&wf->timer, wakeref_auto_timeout, 0); + refcount_set(&wf->count, 0); + wf->wakeref = 0; + wf->i915 = i915; +} + +void intel_wakeref_auto(struct intel_wakeref_auto *wf, long timeout) +{ + unsigned long flags; + + assert_rpm_wakelock_held(wf->i915);
[Intel-gfx] [PATCH v6 2/2] drm/i915: Make sure we have enough memory bandwidth on ICL
From: Ville Syrjälä ICL has so many planes that it can easily exceed the maximum effective memory bandwidth of the system. We must therefore check that we don't exceed that limit. The algorithm is very magic number heavy and lacks sufficient explanation for now. We also have no sane way to query the memory clock and timings, so we must rely on a combination of raw readout from the memory controller and hardcoded assumptions. The memory controller values obviously change as the system jumps between the different SAGV points, so we try to stabilize it first by disabling SAGV for the duration of the readout. The utilized bandwidth is tracked via a device wide atomic private object. That is actually not robust because we can't afford to enforce strict global ordering between the pipes. Thus I think I'll need to change this to simply chop up the available bandwidth between all the active pipes. Each pipe can then do whatever it wants as long as it doesn't exceed its budget. That scheme will also require that we assume that any number of planes could be active at any time. TODO: make it robust and deal with all the open questions v2: Sleep longer after disabling SAGV v3: Poll for the dclk to get raised (seen it take 250ms!) If the system has 2133MT/s memory then we pointlessly wait one full second :( v4: Use the new pcode interface to get the qgv points rather that using hardcoded numbers v5: Move the pcode stuff into intel_bw.c (Matt) s/intel_sagv_info/intel_qgv_info/ Do the NV12/P010 as per spec for now (Matt) s/IS_ICELAKE/IS_GEN11/ v6: Ignore bandwidth limits if the pcode query fails Signed-off-by: Ville Syrjälä Reviewed-by: Matt Roper Acked-by: Clint Taylor --- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/i915_drv.c | 2 + drivers/gpu/drm/i915/i915_drv.h | 8 + drivers/gpu/drm/i915/i915_reg.h | 3 + drivers/gpu/drm/i915/intel_atomic_plane.c | 27 ++ drivers/gpu/drm/i915/intel_atomic_plane.h | 2 + drivers/gpu/drm/i915/intel_bw.c | 421 ++ drivers/gpu/drm/i915/intel_bw.h | 47 +++ drivers/gpu/drm/i915/intel_display.c | 40 +- drivers/gpu/drm/i915/intel_drv.h | 2 + 10 files changed, 552 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/i915/intel_bw.c create mode 100644 drivers/gpu/drm/i915/intel_bw.h diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index 68106fe35a04..139a0fc19390 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -138,6 +138,7 @@ i915-y += intel_audio.o \ intel_atomic.o \ intel_atomic_plane.o \ intel_bios.o \ + intel_bw.o \ intel_cdclk.o \ intel_color.o \ intel_combo_phy.o \ diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 83d2eb9e74cb..6699e3a94272 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -60,6 +60,7 @@ #include "i915_vgpu.h" #include "intel_acpi.h" #include "intel_audio.h" +#include "intel_bw.h" #include "intel_cdclk.h" #include "intel_csr.h" #include "intel_dp.h" @@ -1657,6 +1658,7 @@ static int i915_driver_init_hw(struct drm_i915_private *dev_priv) */ intel_get_dram_info(dev_priv); + intel_bw_init_hw(dev_priv); return 0; diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 311e19154672..158023cf3217 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -54,6 +54,7 @@ #include #include #include +#include #include #include @@ -1841,6 +1842,13 @@ struct drm_i915_private { } type; } dram_info; + struct intel_bw_info { + int num_planes; + int deratedbw[3]; + } max_bw[6]; + + struct drm_private_obj bw_obj; + struct i915_runtime_pm runtime_pm; struct { diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 49dce04dd688..511a0c758bdd 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -8777,6 +8777,9 @@ enum { #define GEN6_PCODE_WRITE_MIN_FREQ_TABLE 0x8 #define GEN6_PCODE_READ_MIN_FREQ_TABLE 0x9 #define GEN6_READ_OC_PARAMS 0xc +#define ICL_PCODE_MEM_SUBSYSYSTEM_INFO 0xd +#define ICL_PCODE_MEM_SS_READ_GLOBAL_INFO (0x0 << 8) +#define ICL_PCODE_MEM_SS_READ_QGV_POINT_INFO(point)(((point) << 16) | (0x1 << 8)) #define GEN6_PCODE_READ_D_COMP 0x10 #define GEN6_PCODE_WRITE_D_COMP 0x11 #define HSW_PCODE_DE_WRITE_FREQ_REQ 0x17 diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c index d11681d71add..58ea1b672a1a 100644 --- a/drivers/gpu/drm/i915/intel_atomic_plane.c +++ b/drivers/gpu/drm/i915/intel_atomic_plan
[Intel-gfx] [CI 0/5] Refactor to expand subslice mask
This patch series contains a few code clean-up patches, followed by a patch which changes the storage of the subslice mask to better match the userspace access through the I915_QUERY_TOPOLOGY_INFO ioctl. The index into the subslice_mask array is then calculated: slice * subslice stride + subslice index / 8 v2: fix i915_pm_sseu test failure v3: no changes to patches in the series, just resending to pick up in CI correctly v4: rebase v5: fix header test v6: address review comments from Jari address minor checkpatch warning in existing code use eu_stride for EU div-by-8 v7: another rebase v8: address review comments from Tvrtko and Daniele v9: address review comments from Daniele v10: add reviewed-by on last patch with minor suggested change, rebase, and repost for CI Stuart Summers (5): drm/i915: Use local variable for SSEU info in GETPARAM ioctl drm/i915: Add macro for SSEU stride calculation drm/i915: Move calculation of subslices per slice to new function drm/i915: Refactor sseu helper functions drm/i915: Expand subslice mask drivers/gpu/drm/i915/gt/intel_engine_cs.c| 24 ++- drivers/gpu/drm/i915/gt/intel_engine_types.h | 30 ++-- drivers/gpu/drm/i915/gt/intel_hangcheck.c| 3 +- drivers/gpu/drm/i915/gt/intel_sseu.c | 62 +++ drivers/gpu/drm/i915/gt/intel_sseu.h | 35 +++- drivers/gpu/drm/i915/gt/intel_workarounds.c | 2 +- drivers/gpu/drm/i915/i915_debugfs.c | 46 ++--- drivers/gpu/drm/i915/i915_drv.c | 15 +- drivers/gpu/drm/i915/i915_gpu_error.c| 5 +- drivers/gpu/drm/i915/i915_query.c| 15 +- drivers/gpu/drm/i915/intel_device_info.c | 176 +++ drivers/gpu/drm/i915/intel_device_info.h | 47 - 12 files changed, 280 insertions(+), 180 deletions(-) -- 2.21.0.5.gaeb582a983 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [CI 3/5] drm/i915: Move calculation of subslices per slice to new function
Add a new function to return the number of subslices per slice to consolidate code usage. v2: rebase on changes to move sseu struct to intel_sseu.h v3: add intel_* prefix to sseu_subslices_per_slice Cc: Daniele Ceraolo Spurio Reviewed-by: Daniele Ceraolo Spurio Signed-off-by: Stuart Summers --- drivers/gpu/drm/i915/gt/intel_sseu.h | 6 ++ drivers/gpu/drm/i915/i915_debugfs.c | 2 +- drivers/gpu/drm/i915/intel_device_info.c | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_sseu.h b/drivers/gpu/drm/i915/gt/intel_sseu.h index d20b7f96907d..9618dff46d83 100644 --- a/drivers/gpu/drm/i915/gt/intel_sseu.h +++ b/drivers/gpu/drm/i915/gt/intel_sseu.h @@ -63,6 +63,12 @@ intel_sseu_from_device_info(const struct sseu_dev_info *sseu) return value; } +static inline unsigned int +intel_sseu_subslices_per_slice(const struct sseu_dev_info *sseu, u8 slice) +{ + return hweight8(sseu->subslice_mask[slice]); +} + u32 intel_sseu_make_rpcs(struct drm_i915_private *i915, const struct intel_sseu *req_sseu); diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 633a08c0f907..73cc6d9f9157 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -4203,7 +4203,7 @@ static void i915_print_sseu_info(struct seq_file *m, bool is_available_info, sseu_subslice_total(sseu)); for (s = 0; s < fls(sseu->slice_mask); s++) { seq_printf(m, " %s Slice%i subslices: %u\n", type, - s, hweight8(sseu->subslice_mask[s])); + s, intel_sseu_subslices_per_slice(sseu, s)); } seq_printf(m, " %s EU Total: %u\n", type, sseu->eu_total); diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c index 6af480b95bc6..9d6b9c45bc5e 100644 --- a/drivers/gpu/drm/i915/intel_device_info.c +++ b/drivers/gpu/drm/i915/intel_device_info.c @@ -93,7 +93,7 @@ static void sseu_dump(const struct sseu_dev_info *sseu, struct drm_printer *p) drm_printf(p, "subslice total: %u\n", sseu_subslice_total(sseu)); for (s = 0; s < sseu->max_slices; s++) { drm_printf(p, "slice%d: %u subslices, mask=%04x\n", - s, hweight8(sseu->subslice_mask[s]), + s, intel_sseu_subslices_per_slice(sseu, s), sseu->subslice_mask[s]); } drm_printf(p, "EU total: %u\n", sseu->eu_total); @@ -126,7 +126,7 @@ void intel_device_info_dump_topology(const struct sseu_dev_info *sseu, for (s = 0; s < sseu->max_slices; s++) { drm_printf(p, "slice%d: %u subslice(s) (0x%hhx):\n", - s, hweight8(sseu->subslice_mask[s]), + s, intel_sseu_subslices_per_slice(sseu, s), sseu->subslice_mask[s]); for (ss = 0; ss < sseu->max_subslices; ss++) { -- 2.21.0.5.gaeb582a983 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [CI 2/5] drm/i915: Add macro for SSEU stride calculation
Subslice stride and EU stride are calculated multiple times in i915_query. Move this calculation to a macro to reduce code duplication. v2: update headers in intel_sseu.h v3: use GEN_SSEU_STRIDE for stride calculations in intel_sseu.h apply s/bits/max_entries/ to GEN_SSEU_STRIDE parameter Cc: Daniele Ceraolo Spurio Reviewed-by: Daniele Ceraolo Spurio Signed-off-by: Stuart Summers --- drivers/gpu/drm/i915/gt/intel_sseu.h | 2 ++ drivers/gpu/drm/i915/i915_query.c| 17 - drivers/gpu/drm/i915/intel_device_info.h | 9 +++-- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_sseu.h b/drivers/gpu/drm/i915/gt/intel_sseu.h index 73bc824094e8..d20b7f96907d 100644 --- a/drivers/gpu/drm/i915/gt/intel_sseu.h +++ b/drivers/gpu/drm/i915/gt/intel_sseu.h @@ -8,11 +8,13 @@ #define __INTEL_SSEU_H__ #include +#include struct drm_i915_private; #define GEN_MAX_SLICES (6) /* CNL upper bound */ #define GEN_MAX_SUBSLICES (8) /* ICL upper bound */ +#define GEN_SSEU_STRIDE(max_entries) DIV_ROUND_UP(max_entries, BITS_PER_BYTE) struct sseu_dev_info { u8 slice_mask; diff --git a/drivers/gpu/drm/i915/i915_query.c b/drivers/gpu/drm/i915/i915_query.c index 414d0a6d1f70..7b7016171057 100644 --- a/drivers/gpu/drm/i915/i915_query.c +++ b/drivers/gpu/drm/i915/i915_query.c @@ -37,6 +37,8 @@ static int query_topology_info(struct drm_i915_private *dev_priv, const struct sseu_dev_info *sseu = &RUNTIME_INFO(dev_priv)->sseu; struct drm_i915_query_topology_info topo; u32 slice_length, subslice_length, eu_length, total_length; + u8 subslice_stride = GEN_SSEU_STRIDE(sseu->max_subslices); + u8 eu_stride = GEN_SSEU_STRIDE(sseu->max_eus_per_subslice); int ret; if (query_item->flags != 0) @@ -48,12 +50,10 @@ static int query_topology_info(struct drm_i915_private *dev_priv, BUILD_BUG_ON(sizeof(u8) != sizeof(sseu->slice_mask)); slice_length = sizeof(sseu->slice_mask); - subslice_length = sseu->max_slices * - DIV_ROUND_UP(sseu->max_subslices, BITS_PER_BYTE); - eu_length = sseu->max_slices * sseu->max_subslices * - DIV_ROUND_UP(sseu->max_eus_per_subslice, BITS_PER_BYTE); - - total_length = sizeof(topo) + slice_length + subslice_length + eu_length; + subslice_length = sseu->max_slices * subslice_stride; + eu_length = sseu->max_slices * sseu->max_subslices * eu_stride; + total_length = sizeof(topo) + slice_length + subslice_length + + eu_length; ret = copy_query_item(&topo, sizeof(topo), total_length, query_item); @@ -69,10 +69,9 @@ static int query_topology_info(struct drm_i915_private *dev_priv, topo.max_eus_per_subslice = sseu->max_eus_per_subslice; topo.subslice_offset = slice_length; - topo.subslice_stride = DIV_ROUND_UP(sseu->max_subslices, BITS_PER_BYTE); + topo.subslice_stride = subslice_stride; topo.eu_offset = slice_length + subslice_length; - topo.eu_stride = - DIV_ROUND_UP(sseu->max_eus_per_subslice, BITS_PER_BYTE); + topo.eu_stride = eu_stride; if (__copy_to_user(u64_to_user_ptr(query_item->data_ptr), &topo, sizeof(topo))) diff --git a/drivers/gpu/drm/i915/intel_device_info.h b/drivers/gpu/drm/i915/intel_device_info.h index 5a2e17d6146b..9d43f7edfd63 100644 --- a/drivers/gpu/drm/i915/intel_device_info.h +++ b/drivers/gpu/drm/i915/intel_device_info.h @@ -231,8 +231,7 @@ static inline unsigned int sseu_subslice_total(const struct sseu_dev_info *sseu) static inline int sseu_eu_idx(const struct sseu_dev_info *sseu, int slice, int subslice) { - int subslice_stride = DIV_ROUND_UP(sseu->max_eus_per_subslice, - BITS_PER_BYTE); + int subslice_stride = GEN_SSEU_STRIDE(sseu->max_eus_per_subslice); int slice_stride = sseu->max_subslices * subslice_stride; return slice * slice_stride + subslice * subslice_stride; @@ -244,8 +243,7 @@ static inline u16 sseu_get_eus(const struct sseu_dev_info *sseu, int i, offset = sseu_eu_idx(sseu, slice, subslice); u16 eu_mask = 0; - for (i = 0; -i < DIV_ROUND_UP(sseu->max_eus_per_subslice, BITS_PER_BYTE); i++) { + for (i = 0; i < GEN_SSEU_STRIDE(sseu->max_eus_per_subslice); i++) { eu_mask |= ((u16) sseu->eu_mask[offset + i]) << (i * BITS_PER_BYTE); } @@ -258,8 +256,7 @@ static inline void sseu_set_eus(struct sseu_dev_info *sseu, { int i, offset = sseu_eu_idx(sseu, slice, subslice); - for (i = 0; -i < DIV_ROUND_UP(sseu->max_eus_per_subslice, BITS_PER_BYTE); i++) { + for (i = 0; i < GEN_SSEU_STRIDE(sseu->max_eus_per_subslice); i++) { sseu->eu_mask[offset + i] =
[Intel-gfx] [CI 1/5] drm/i915: Use local variable for SSEU info in GETPARAM ioctl
In the GETPARAM ioctl handler, use a local variable to consolidate usage of SSEU runtime info. v2: add const to sseu_dev_info variable Cc: Daniele Ceraolo Spurio Reviewed-by: Daniele Ceraolo Spurio Signed-off-by: Stuart Summers --- drivers/gpu/drm/i915/i915_drv.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 83d2eb9e74cb..712d48936e8a 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -329,6 +329,7 @@ static int i915_getparam_ioctl(struct drm_device *dev, void *data, { struct drm_i915_private *dev_priv = to_i915(dev); struct pci_dev *pdev = dev_priv->drm.pdev; + const struct sseu_dev_info *sseu = &RUNTIME_INFO(dev_priv)->sseu; drm_i915_getparam_t *param = data; int value; @@ -382,12 +383,12 @@ static int i915_getparam_ioctl(struct drm_device *dev, void *data, value = i915_cmd_parser_get_version(dev_priv); break; case I915_PARAM_SUBSLICE_TOTAL: - value = sseu_subslice_total(&RUNTIME_INFO(dev_priv)->sseu); + value = sseu_subslice_total(sseu); if (!value) return -ENODEV; break; case I915_PARAM_EU_TOTAL: - value = RUNTIME_INFO(dev_priv)->sseu.eu_total; + value = sseu->eu_total; if (!value) return -ENODEV; break; @@ -404,7 +405,7 @@ static int i915_getparam_ioctl(struct drm_device *dev, void *data, value = HAS_POOLED_EU(dev_priv); break; case I915_PARAM_MIN_EU_IN_POOL: - value = RUNTIME_INFO(dev_priv)->sseu.min_eu_in_pool; + value = sseu->min_eu_in_pool; break; case I915_PARAM_HUC_STATUS: value = intel_huc_check_status(&dev_priv->huc); @@ -455,12 +456,12 @@ static int i915_getparam_ioctl(struct drm_device *dev, void *data, value = intel_engines_has_context_isolation(dev_priv); break; case I915_PARAM_SLICE_MASK: - value = RUNTIME_INFO(dev_priv)->sseu.slice_mask; + value = sseu->slice_mask; if (!value) return -ENODEV; break; case I915_PARAM_SUBSLICE_MASK: - value = RUNTIME_INFO(dev_priv)->sseu.subslice_mask[0]; + value = sseu->subslice_mask[0]; if (!value) return -ENODEV; break; -- 2.21.0.5.gaeb582a983 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [CI 5/5] drm/i915: Expand subslice mask
Currently, the subslice_mask runtime parameter is stored as an array of subslices per slice. Expand the subslice mask array to better match what is presented to userspace through the I915_QUERY_TOPOLOGY_INFO ioctl. The index into this array is then calculated: slice * subslice stride + subslice index / 8 v2: fix spacing in set_sseu_info args use set_sseu_info to initialize sseu data when building device status in debugfs rename variables in intel_engine_types.h to avoid checkpatch warnings v3: update headers in intel_sseu.h v4: add const to some sseu_dev_info variables use sseu->eu_stride for EU stride calculations v5: address review comments from Tvrtko and Daniele v6: remove extra space in intel_sseu_get_subslices return the correct subslice enable in for_each_instdone add GEM_BUG_ON to ensure user doesn't pass invalid ss_mask size use printk formatted string for subslice mask v7: remove string.h header and rebase Cc: Daniele Ceraolo Spurio Cc: Lionel Landwerlin Acked-by: Lionel Landwerlin Reviewed-by: Daniele Ceraolo Spurio Signed-off-by: Stuart Summers --- drivers/gpu/drm/i915/gt/intel_engine_cs.c| 24 +++- drivers/gpu/drm/i915/gt/intel_engine_types.h | 30 ++--- drivers/gpu/drm/i915/gt/intel_hangcheck.c| 3 +- drivers/gpu/drm/i915/gt/intel_sseu.c | 47 ++- drivers/gpu/drm/i915/gt/intel_sseu.h | 27 +++- drivers/gpu/drm/i915/gt/intel_workarounds.c | 2 +- drivers/gpu/drm/i915/i915_debugfs.c | 40 +++--- drivers/gpu/drm/i915/i915_drv.c | 6 +- drivers/gpu/drm/i915/i915_gpu_error.c| 5 +- drivers/gpu/drm/i915/i915_query.c| 10 +- drivers/gpu/drm/i915/intel_device_info.c | 122 +-- 11 files changed, 200 insertions(+), 116 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c index 2590f5904b67..509f02a65408 100644 --- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c +++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c @@ -951,12 +951,30 @@ const char *i915_cache_level_str(struct drm_i915_private *i915, int type) } } +static inline u32 +intel_sseu_fls_subslice(const struct sseu_dev_info *sseu, u32 slice) +{ + u32 subslice; + int i; + + for (i = sseu->ss_stride - 1; i >= 0; i--) { + subslice = fls(sseu->subslice_mask[slice * sseu->ss_stride + + i]); + if (subslice) { + subslice += i * BITS_PER_BYTE; + break; + } + } + + return subslice; +} + u32 intel_calculate_mcr_s_ss_select(struct drm_i915_private *dev_priv) { const struct sseu_dev_info *sseu = &RUNTIME_INFO(dev_priv)->sseu; u32 mcr_s_ss_select; u32 slice = fls(sseu->slice_mask); - u32 subslice = fls(sseu->subslice_mask[slice]); + u32 subslice = intel_sseu_fls_subslice(sseu, slice); if (IS_GEN(dev_priv, 10)) mcr_s_ss_select = GEN8_MCR_SLICE(slice) | @@ -1032,6 +1050,7 @@ void intel_engine_get_instdone(struct intel_engine_cs *engine, struct intel_instdone *instdone) { struct drm_i915_private *dev_priv = engine->i915; + const struct sseu_dev_info *sseu = &RUNTIME_INFO(dev_priv)->sseu; struct intel_uncore *uncore = engine->uncore; u32 mmio_base = engine->mmio_base; int slice; @@ -1049,7 +1068,8 @@ void intel_engine_get_instdone(struct intel_engine_cs *engine, instdone->slice_common = intel_uncore_read(uncore, GEN7_SC_INSTDONE); - for_each_instdone_slice_subslice(dev_priv, slice, subslice) { + for_each_instdone_slice_subslice(dev_priv, sseu, slice, +subslice) { instdone->sampler[slice][subslice] = read_subslice_reg(dev_priv, slice, subslice, GEN7_SAMPLER_INSTDONE); diff --git a/drivers/gpu/drm/i915/gt/intel_engine_types.h b/drivers/gpu/drm/i915/gt/intel_engine_types.h index 40e774acc2cd..41c257f6a560 100644 --- a/drivers/gpu/drm/i915/gt/intel_engine_types.h +++ b/drivers/gpu/drm/i915/gt/intel_engine_types.h @@ -551,20 +551,20 @@ intel_engine_is_virtual(const struct intel_engine_cs *engine) return engine->flags & I915_ENGINE_IS_VIRTUAL; } -#define instdone_slice_mask(dev_priv__) \ - (IS_GEN(dev_priv__, 7) ? \ -1 : RUNTIME_INFO(dev_priv__)->sseu.slice_mask) - -#define instdone_subslice_mask(dev_priv__) \ - (IS_GEN(dev_priv__, 7) ? \ -1 : RUNTIME_INFO(dev_priv__)->sseu.subslice_mask[0]) - -#define for_each_instdone_slice_subslice(dev_priv__, slice__, subslice__) \ - for ((slice__) = 0, (subslice__) = 0; \ -(slice__) < I915_MAX_SLICES; \ -(subslice__) = ((subslice__) + 1)
[Intel-gfx] [CI 4/5] drm/i915: Refactor sseu helper functions
Move functions to intel_sseu.h and remove inline qualifier. Additionally, ensure these are all prefixed with intel_sseu_* to match the convention of other functions in i915. v2: fix spacing from checkpatch warning v3: squash helper function changes into a single patch break 80 character line to fix checkpatch warning move get/set_eus helpers to intel_device_info.c v4: Remove intel_ prefix from static functions in intel_device_info.c and correctly copy changes to stride calculation in those functions. Acked-by: Jani Nikula Cc: Daniele Ceraolo Spurio Reviewed-by: Daniele Ceraolo Spurio Signed-off-by: Stuart Summers --- drivers/gpu/drm/i915/gt/intel_sseu.c | 17 +++ drivers/gpu/drm/i915/gt/intel_sseu.h | 10 ++-- drivers/gpu/drm/i915/i915_debugfs.c | 4 +- drivers/gpu/drm/i915/i915_drv.c | 2 +- drivers/gpu/drm/i915/intel_device_info.c | 60 +++- drivers/gpu/drm/i915/intel_device_info.h | 44 - 6 files changed, 74 insertions(+), 63 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_sseu.c b/drivers/gpu/drm/i915/gt/intel_sseu.c index 7f448f3bea0b..a0756f006f5f 100644 --- a/drivers/gpu/drm/i915/gt/intel_sseu.c +++ b/drivers/gpu/drm/i915/gt/intel_sseu.c @@ -8,6 +8,23 @@ #include "intel_lrc_reg.h" #include "intel_sseu.h" +unsigned int +intel_sseu_subslice_total(const struct sseu_dev_info *sseu) +{ + unsigned int i, total = 0; + + for (i = 0; i < ARRAY_SIZE(sseu->subslice_mask); i++) + total += hweight8(sseu->subslice_mask[i]); + + return total; +} + +unsigned int +intel_sseu_subslices_per_slice(const struct sseu_dev_info *sseu, u8 slice) +{ + return hweight8(sseu->subslice_mask[slice]); +} + u32 intel_sseu_make_rpcs(struct drm_i915_private *i915, const struct intel_sseu *req_sseu) { diff --git a/drivers/gpu/drm/i915/gt/intel_sseu.h b/drivers/gpu/drm/i915/gt/intel_sseu.h index 9618dff46d83..b50d0401a4e2 100644 --- a/drivers/gpu/drm/i915/gt/intel_sseu.h +++ b/drivers/gpu/drm/i915/gt/intel_sseu.h @@ -63,11 +63,11 @@ intel_sseu_from_device_info(const struct sseu_dev_info *sseu) return value; } -static inline unsigned int -intel_sseu_subslices_per_slice(const struct sseu_dev_info *sseu, u8 slice) -{ - return hweight8(sseu->subslice_mask[slice]); -} +unsigned int +intel_sseu_subslice_total(const struct sseu_dev_info *sseu); + +unsigned int +intel_sseu_subslices_per_slice(const struct sseu_dev_info *sseu, u8 slice); u32 intel_sseu_make_rpcs(struct drm_i915_private *i915, const struct intel_sseu *req_sseu); diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 73cc6d9f9157..7556a205f677 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -4176,7 +4176,7 @@ static void broadwell_sseu_device_status(struct drm_i915_private *dev_priv, RUNTIME_INFO(dev_priv)->sseu.subslice_mask[s]; } sseu->eu_total = sseu->eu_per_subslice * -sseu_subslice_total(sseu); +intel_sseu_subslice_total(sseu); /* subtract fused off EU(s) from enabled slice(s) */ for (s = 0; s < fls(sseu->slice_mask); s++) { @@ -4200,7 +4200,7 @@ static void i915_print_sseu_info(struct seq_file *m, bool is_available_info, seq_printf(m, " %s Slice Total: %u\n", type, hweight8(sseu->slice_mask)); seq_printf(m, " %s Subslice Total: %u\n", type, - sseu_subslice_total(sseu)); + intel_sseu_subslice_total(sseu)); for (s = 0; s < fls(sseu->slice_mask); s++) { seq_printf(m, " %s Slice%i subslices: %u\n", type, s, intel_sseu_subslices_per_slice(sseu, s)); diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 712d48936e8a..f3eea5676123 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -383,7 +383,7 @@ static int i915_getparam_ioctl(struct drm_device *dev, void *data, value = i915_cmd_parser_get_version(dev_priv); break; case I915_PARAM_SUBSLICE_TOTAL: - value = sseu_subslice_total(sseu); + value = intel_sseu_subslice_total(sseu); if (!value) return -ENODEV; break; diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c index 9d6b9c45bc5e..97f742530fa1 100644 --- a/drivers/gpu/drm/i915/intel_device_info.c +++ b/drivers/gpu/drm/i915/intel_device_info.c @@ -90,7 +90,7 @@ static void sseu_dump(const struct sseu_dev_info *sseu, struct drm_printer *p) drm_printf(p, "slice total: %u, mask=%04x\n", hweight8(sseu->slice_mask), sseu->slice_mask); - drm_prin
Re: [Intel-gfx] [PATCH] drm/i915: Keep user GGTT alive for a minimum of 250ms
Chris Wilson writes: > Do not allow runtime pm autosuspend to remove userspace GGTT mmaps too > quickly. For example, igt sets the autosuspend delay to 0, and so we > immediately attempt to perform runtime suspend upon releasing the > wakeref. Unfortunately, that involves tearing down GGTT mmaps as they > require an active device. > > Override the autosuspend for GGTT mmaps, by keeping the wakeref around > for 250ms after populating the PTE for a fresh mmap. > > v2: Prefer refcount_t for its under/overflow error detection > > Signed-off-by: Chris Wilson > Cc: Mika Kuoppala > --- > drivers/gpu/drm/i915/Kconfig.profile | 14 +++ > drivers/gpu/drm/i915/i915_drv.h | 3 ++ > drivers/gpu/drm/i915/i915_gem.c | 7 > drivers/gpu/drm/i915/intel_wakeref.c | 58 > drivers/gpu/drm/i915/intel_wakeref.h | 28 ++ > 5 files changed, 110 insertions(+) > > diff --git a/drivers/gpu/drm/i915/Kconfig.profile > b/drivers/gpu/drm/i915/Kconfig.profile > index 0e5db98da8f3..4fd1ea639d0f 100644 > --- a/drivers/gpu/drm/i915/Kconfig.profile > +++ b/drivers/gpu/drm/i915/Kconfig.profile > @@ -1,3 +1,17 @@ > +config DRM_I915_USERFAULT_AUTOSUSPEND > + int "Runtime autosuspend delay for userspace GGTT mmaps (ms)" > + default 250 # milliseconds > + help > + On runtime suspend, as we suspend the device, we have to revoke > + userspace GGTT mmaps and force userspace to take a pagefault on > + their next access. The revocation and subsequent recreation of > + the GGTT mmap can be very slow and so we impose a small hysteris > + that complements the runtime-pm autosuspend and provides a lower > + floor on the autosuspend delay. > + > + May be 0 to disable the extra delay and solely use the device level > + runtime pm autosuspend delay tunable. > + > config DRM_I915_SPIN_REQUEST > int > default 5 # microseconds > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h > index 311e19154672..41dad8889eaa 100644 > --- a/drivers/gpu/drm/i915/i915_drv.h > +++ b/drivers/gpu/drm/i915/i915_drv.h > @@ -874,6 +874,9 @@ struct i915_gem_mm { >*/ > struct list_head userfault_list; > > + /* Manual runtime pm autosuspend delay for user GGTT mmaps */ > + struct intel_wakeref_auto userfault_wakeref; > + > /** >* List of objects which are pending destruction. >*/ > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c > index d3b7dac527dc..cb786582e2fe 100644 > --- a/drivers/gpu/drm/i915/i915_gem.c > +++ b/drivers/gpu/drm/i915/i915_gem.c > @@ -1834,6 +1834,9 @@ vm_fault_t i915_gem_fault(struct vm_fault *vmf) > assert_rpm_wakelock_held(dev_priv); > if (!i915_vma_set_userfault(vma) && !obj->userfault_count++) > list_add(&obj->userfault_link, &dev_priv->mm.userfault_list); > + if (CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND) > + intel_wakeref_auto(&dev_priv->mm.userfault_wakeref, > + > msecs_to_jiffies_timeout(CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND)); > GEM_BUG_ON(!obj->userfault_count); > > i915_vma_set_ggtt_write(vma); > @@ -4671,6 +4674,8 @@ void i915_gem_fini(struct drm_i915_private *dev_priv) > { > GEM_BUG_ON(dev_priv->gt.awake); > > + intel_wakeref_auto_fini(&dev_priv->mm.userfault_wakeref); > + > i915_gem_suspend_late(dev_priv); > intel_disable_gt_powersave(dev_priv); > > @@ -4748,6 +4753,8 @@ static void i915_gem_init__mm(struct drm_i915_private > *i915) > INIT_LIST_HEAD(&i915->mm.fence_list); > INIT_LIST_HEAD(&i915->mm.userfault_list); > > + intel_wakeref_auto_init(&i915->mm.userfault_wakeref, i915); > + > INIT_WORK(&i915->mm.free_work, __i915_gem_free_work); > } > > diff --git a/drivers/gpu/drm/i915/intel_wakeref.c > b/drivers/gpu/drm/i915/intel_wakeref.c > index 91196d9612bb..78b624c1ed59 100644 > --- a/drivers/gpu/drm/i915/intel_wakeref.c > +++ b/drivers/gpu/drm/i915/intel_wakeref.c > @@ -73,3 +73,61 @@ void __intel_wakeref_init(struct intel_wakeref *wf, struct > lock_class_key *key) > atomic_set(&wf->count, 0); > wf->wakeref = 0; > } > + > +static void wakeref_auto_timeout(struct timer_list *t) > +{ > + struct intel_wakeref_auto *wf = from_timer(wf, t, timer); > + intel_wakeref_t wakeref; > + unsigned long flags; > + > + if (!refcount_dec_and_lock_irqsave(&wf->count, &wf->lock, &flags)) > + return; > + > + wakeref = fetch_and_zero(&wf->wakeref); > + spin_unlock_irqrestore(&wf->lock, flags); > + > + intel_runtime_pm_put(wf->i915, wakeref); > +} > + > +void intel_wakeref_auto_init(struct intel_wakeref_auto *wf, > + struct drm_i915_private *i915) > +{ > + spin_lock_init(&wf->lock); > + timer_setup(&wf->timer, wakeref_auto_timeout, 0); > + refcount_set(&wf->count, 0); > + wf->wakeref = 0; > + wf-
Re: [Intel-gfx] [PATCH] drm/i915: Tune down link train error messages due to IO failure
On 23/05/2019 16:08, Imre Deak wrote: > An IO failure happens if the sink is unplugged. This scenario shouldn't > be logged with error level, since it is not a user visible problem. > Converting the corresponding error messages to be debug messages also > ensures that we don't fail some CI test incorrectly that tests the > unplugging while a mode is still active on the given connector (like the > kms_chamelium tests imititating such an unplug during being suspended). > > Leave those link training error messages that are due to an actual > transfer rate error (and not an IO error) as-is, as that kind of problem > is related to the user's configuration (cable, mode, monitor) and so it > is really user visible. Are there some scenarios that would be warranting a DRM_ERROR? If so, then we should decide on the verbosity based on wether the connector is connected or disconnected, don't you think? Martin > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110390 > Signed-off-by: Imre Deak > --- > drivers/gpu/drm/i915/intel_dp_link_training.c | 12 ++-- > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c > b/drivers/gpu/drm/i915/intel_dp_link_training.c > index 9b1fccea966b..392ebeb89ce8 100644 > --- a/drivers/gpu/drm/i915/intel_dp_link_training.c > +++ b/drivers/gpu/drm/i915/intel_dp_link_training.c > @@ -169,7 +169,7 @@ intel_dp_link_training_clock_recovery(struct intel_dp > *intel_dp) > if (!intel_dp_reset_link_train(intel_dp, > DP_TRAINING_PATTERN_1 | > DP_LINK_SCRAMBLING_DISABLE)) { > - DRM_ERROR("failed to enable link training\n"); > + DRM_DEBUG_KMS("failed to enable link training\n"); > return false; > } > > @@ -193,7 +193,7 @@ intel_dp_link_training_clock_recovery(struct intel_dp > *intel_dp) > drm_dp_link_train_clock_recovery_delay(intel_dp->dpcd); > > if (!intel_dp_get_link_status(intel_dp, link_status)) { > - DRM_ERROR("failed to get link status\n"); > + DRM_DEBUG_KMS("failed to get link status\n"); > return false; > } > > @@ -217,7 +217,7 @@ intel_dp_link_training_clock_recovery(struct intel_dp > *intel_dp) > /* Update training set as requested by target */ > intel_get_adjust_train(intel_dp, link_status); > if (!intel_dp_update_link_train(intel_dp)) { > - DRM_ERROR("failed to update link training\n"); > + DRM_DEBUG_KMS("failed to update link training\n"); > return false; > } > > @@ -295,7 +295,7 @@ intel_dp_link_training_channel_equalization(struct > intel_dp *intel_dp) > /* channel equalization */ > if (!intel_dp_set_link_train(intel_dp, >training_pattern)) { > - DRM_ERROR("failed to start channel equalization\n"); > + DRM_DEBUG_KMS("failed to start channel equalization\n"); > return false; > } > > @@ -303,7 +303,7 @@ intel_dp_link_training_channel_equalization(struct > intel_dp *intel_dp) > > drm_dp_link_train_channel_eq_delay(intel_dp->dpcd); > if (!intel_dp_get_link_status(intel_dp, link_status)) { > - DRM_ERROR("failed to get link status\n"); > + DRM_DEBUG_KMS("failed to get link status\n"); > break; > } > > @@ -327,7 +327,7 @@ intel_dp_link_training_channel_equalization(struct > intel_dp *intel_dp) > /* Update training set as requested by target */ > intel_get_adjust_train(intel_dp, link_status); > if (!intel_dp_update_link_train(intel_dp)) { > - DRM_ERROR("failed to update link training\n"); > + DRM_DEBUG_KMS("failed to update link training\n"); > break; > } > } > ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [[PATCH 0/4] drm/i915/dsi: Read back pclk set by GOP and use that as pclk (version 3)
Hi All, This is a resend of my 3th attempt to fix the pclk we calculate for DSI panels and the pclk which the GOP has configured, causing fastboot to not work. As requested in the review of earlier versions, this version moves the overriding of the pclk out of intel_dsi_vbt.c and into vlv_dsi.c. This series was first posted in December 2018, but has gotten 0 comments. This resend is rebased on top of 4.12-rc1 and applies cleanly to the current drm-tip. Regards, Hans ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 4/4] drm/i915/dsi: Read back pclk set by GOP and use that as pclk (v3)
The GOP sometimes initializes the pclk at a (slightly) different frequency then the pclk which we've calculated. This commit makes the DSI code read-back the pclk set by the GOP and if that is within a reasonable margin of the calculated pclk, uses that instead. This fixes the first modeset being a full modeset instead of a fast modeset on systems where the GOP pclk is different. Changes in v2: -Use intel_encoder_current_mode() to get the pclk setup by the GOP Changes in v3: -Back to the readback approach, skipping the dsi_pll.ctrl / .dev checks in intel_pipe_config_compare() when adjust is set leads to: [drm:pipe_config_err [i915]] *ERROR* mismatch in dsi_pll.ctrl (...) [drm:pipe_config_err [i915]] *ERROR* mismatch in dsi_pll.div (...) -Do the readback and pclk overriding from vlv_dsi_init(), rather then from intel_dsi_vbt_init() as the vbt code should not be touching the hw Signed-off-by: Hans de Goede --- drivers/gpu/drm/i915/vlv_dsi.c | 22 ++ 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c index 3329ccf3b346..49975dd84ff4 100644 --- a/drivers/gpu/drm/i915/vlv_dsi.c +++ b/drivers/gpu/drm/i915/vlv_dsi.c @@ -1701,7 +1701,7 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv) struct drm_encoder *encoder; struct intel_connector *intel_connector; struct drm_connector *connector; - struct drm_display_mode *fixed_mode; + struct drm_display_mode *current_mode, *fixed_mode; enum port port; DRM_DEBUG_KMS("\n"); @@ -1745,6 +1745,9 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv) intel_connector->get_hw_state = intel_connector_get_hw_state; intel_encoder->port = port; + intel_encoder->type = INTEL_OUTPUT_DSI; + intel_encoder->power_domain = POWER_DOMAIN_PORT_DSI; + intel_encoder->cloneable = 0; /* * On BYT/CHV, pipe A maps to MIPI DSI port A, pipe B maps to MIPI DSI @@ -1782,6 +1785,20 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv) goto err; } + /* Use clock read-back from current hw-state for fastboot */ + current_mode = intel_encoder_current_mode(intel_encoder); + if (current_mode) { + DRM_DEBUG_KMS("Calculated pclk %d GOP %d\n", + intel_dsi->pclk, current_mode->clock); + if (intel_fuzzy_clock_check(intel_dsi->pclk, + current_mode->clock)) { + DRM_DEBUG_KMS("Using GOP pclk\n"); + intel_dsi->pclk = current_mode->clock; + } + + kfree(current_mode); + } + vlv_dphy_param_init(intel_dsi); /* @@ -1799,9 +1816,6 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv) } } - intel_encoder->type = INTEL_OUTPUT_DSI; - intel_encoder->power_domain = POWER_DOMAIN_PORT_DSI; - intel_encoder->cloneable = 0; drm_connector_init(dev, connector, &intel_dsi_connector_funcs, DRM_MODE_CONNECTOR_DSI); -- 2.21.0 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 1/4] drm/i915: Make intel_fuzzy_clock_check available outside of intel_display.c
The next patch in this series uses intel_fuzzy_clock_check from the vlv_dsi.c code. Signed-off-by: Hans de Goede --- drivers/gpu/drm/i915/intel_display.c | 2 +- drivers/gpu/drm/i915/intel_drv.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 5098228f1302..ceb78f44f087 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -11942,7 +11942,7 @@ intel_modeset_pipe_config(struct drm_crtc *crtc, return 0; } -static bool intel_fuzzy_clock_check(int clock1, int clock2) +bool intel_fuzzy_clock_check(int clock1, int clock2) { int diff; diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index a38b9cff5cd0..e85cd377a652 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1742,6 +1742,7 @@ int vlv_force_pll_on(struct drm_i915_private *dev_priv, enum pipe pipe, const struct dpll *dpll); void vlv_force_pll_off(struct drm_i915_private *dev_priv, enum pipe pipe); int lpt_get_iclkip(struct drm_i915_private *dev_priv); +bool intel_fuzzy_clock_check(int clock1, int clock2); /* modesetting asserts */ void assert_panel_unlocked(struct drm_i915_private *dev_priv, -- 2.21.0 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 3/4] drm/i915/dsi: Move vlv/icl_dphy_param_init call out of intel_dsi_vbt_init
The vlv/icl_dphy_param_init calls do various calculations to set dphy parameters based on the pclk. Move the calling of vlv/icl_dphy_param_init to vlv_dsi_init to give vlv_dsi_init a chance to tweak the pclk before these calculations are done. This also removes the single "if (IS_ICELAKE(dev_priv))" check from intel_dsi_vbt_init making it fully platform agnostic. Signed-off-by: Hans de Goede --- drivers/gpu/drm/i915/icl_dsi.c | 1 + drivers/gpu/drm/i915/intel_dsi.h | 2 ++ drivers/gpu/drm/i915/intel_dsi_vbt.c | 9 ++--- drivers/gpu/drm/i915/vlv_dsi.c | 2 ++ 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/icl_dsi.c b/drivers/gpu/drm/i915/icl_dsi.c index 9d962ea1e635..0f43ef07efec 100644 --- a/drivers/gpu/drm/i915/icl_dsi.c +++ b/drivers/gpu/drm/i915/icl_dsi.c @@ -1455,6 +1455,7 @@ void icl_dsi_init(struct drm_i915_private *dev_priv) goto err; } + icl_dphy_param_init(intel_dsi); return; err: diff --git a/drivers/gpu/drm/i915/intel_dsi.h b/drivers/gpu/drm/i915/intel_dsi.h index 705a609050c0..a58d3d988d9f 100644 --- a/drivers/gpu/drm/i915/intel_dsi.h +++ b/drivers/gpu/drm/i915/intel_dsi.h @@ -192,5 +192,7 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id); void intel_dsi_vbt_exec_sequence(struct intel_dsi *intel_dsi, enum mipi_seq seq_id); void intel_dsi_msleep(struct intel_dsi *intel_dsi, int msec); +void icl_dphy_param_init(struct intel_dsi *intel_dsi); +void vlv_dphy_param_init(struct intel_dsi *intel_dsi); #endif /* _INTEL_DSI_H */ diff --git a/drivers/gpu/drm/i915/intel_dsi_vbt.c b/drivers/gpu/drm/i915/intel_dsi_vbt.c index 3448e8d51057..022bf59418df 100644 --- a/drivers/gpu/drm/i915/intel_dsi_vbt.c +++ b/drivers/gpu/drm/i915/intel_dsi_vbt.c @@ -578,7 +578,7 @@ static void intel_dsi_log_params(struct intel_dsi *intel_dsi) #define ICL_HS_ZERO_CNT_MAX0xf #define ICL_EXIT_ZERO_CNT_MAX 0x7 -static void icl_dphy_param_init(struct intel_dsi *intel_dsi) +void icl_dphy_param_init(struct intel_dsi *intel_dsi) { struct drm_device *dev = intel_dsi->base.base.dev; struct drm_i915_private *dev_priv = to_i915(dev); @@ -677,7 +677,7 @@ static void icl_dphy_param_init(struct intel_dsi *intel_dsi) intel_dsi_log_params(intel_dsi); } -static void vlv_dphy_param_init(struct intel_dsi *intel_dsi) +void vlv_dphy_param_init(struct intel_dsi *intel_dsi) { struct drm_device *dev = intel_dsi->base.base.dev; struct drm_i915_private *dev_priv = to_i915(dev); @@ -914,11 +914,6 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id) intel_dsi->burst_mode_ratio = burst_mode_ratio; - if (INTEL_GEN(dev_priv) >= 11) - icl_dphy_param_init(intel_dsi); - else - vlv_dphy_param_init(intel_dsi); - /* delays in VBT are in unit of 100us, so need to convert * here in ms * Delay (100us) * 100 /1000 = Delay / 10 (ms) */ diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c index fce8b58f7f93..3329ccf3b346 100644 --- a/drivers/gpu/drm/i915/vlv_dsi.c +++ b/drivers/gpu/drm/i915/vlv_dsi.c @@ -1782,6 +1782,8 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv) goto err; } + vlv_dphy_param_init(intel_dsi); + /* * In case of BYT with CRC PMIC, we need to use GPIO for * Panel control. -- 2.21.0 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH 2/4] drm/i915/dsi: Move logging of DSI VBT parameters to a helper function
This is a preparation patch for moving the calling of *_dphy_param_init() out of intel_dsi_vbt_init. Signed-off-by: Hans de Goede --- drivers/gpu/drm/i915/intel_dsi_vbt.c | 77 +++- 1 file changed, 42 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dsi_vbt.c b/drivers/gpu/drm/i915/intel_dsi_vbt.c index 3074448446bc..3448e8d51057 100644 --- a/drivers/gpu/drm/i915/intel_dsi_vbt.c +++ b/drivers/gpu/drm/i915/intel_dsi_vbt.c @@ -532,6 +532,44 @@ void intel_dsi_msleep(struct intel_dsi *intel_dsi, int msec) msleep(msec); } +static void intel_dsi_log_params(struct intel_dsi *intel_dsi) +{ + DRM_DEBUG_KMS("Pclk %d\n", intel_dsi->pclk); + DRM_DEBUG_KMS("Pixel overlap %d\n", intel_dsi->pixel_overlap); + DRM_DEBUG_KMS("Lane count %d\n", intel_dsi->lane_count); + DRM_DEBUG_KMS("DPHY param reg 0x%x\n", intel_dsi->dphy_reg); + DRM_DEBUG_KMS("Video mode format %s\n", + intel_dsi->video_mode_format == VIDEO_MODE_NON_BURST_WITH_SYNC_PULSE ? + "non-burst with sync pulse" : + intel_dsi->video_mode_format == VIDEO_MODE_NON_BURST_WITH_SYNC_EVENTS ? + "non-burst with sync events" : + intel_dsi->video_mode_format == VIDEO_MODE_BURST ? + "burst" : ""); + DRM_DEBUG_KMS("Burst mode ratio %d\n", intel_dsi->burst_mode_ratio); + DRM_DEBUG_KMS("Reset timer %d\n", intel_dsi->rst_timer_val); + DRM_DEBUG_KMS("Eot %s\n", enableddisabled(intel_dsi->eotp_pkt)); + DRM_DEBUG_KMS("Clockstop %s\n", enableddisabled(!intel_dsi->clock_stop)); + DRM_DEBUG_KMS("Mode %s\n", intel_dsi->operation_mode ? "command" : "video"); + if (intel_dsi->dual_link == DSI_DUAL_LINK_FRONT_BACK) + DRM_DEBUG_KMS("Dual link: DSI_DUAL_LINK_FRONT_BACK\n"); + else if (intel_dsi->dual_link == DSI_DUAL_LINK_PIXEL_ALT) + DRM_DEBUG_KMS("Dual link: DSI_DUAL_LINK_PIXEL_ALT\n"); + else + DRM_DEBUG_KMS("Dual link: NONE\n"); + DRM_DEBUG_KMS("Pixel Format %d\n", intel_dsi->pixel_format); + DRM_DEBUG_KMS("TLPX %d\n", intel_dsi->escape_clk_div); + DRM_DEBUG_KMS("LP RX Timeout 0x%x\n", intel_dsi->lp_rx_timeout); + DRM_DEBUG_KMS("Turnaround Timeout 0x%x\n", intel_dsi->turn_arnd_val); + DRM_DEBUG_KMS("Init Count 0x%x\n", intel_dsi->init_count); + DRM_DEBUG_KMS("HS to LP Count 0x%x\n", intel_dsi->hs_to_lp_count); + DRM_DEBUG_KMS("LP Byte Clock %d\n", intel_dsi->lp_byte_clk); + DRM_DEBUG_KMS("DBI BW Timer 0x%x\n", intel_dsi->bw_timer); + DRM_DEBUG_KMS("LP to HS Clock Count 0x%x\n", intel_dsi->clk_lp_to_hs_count); + DRM_DEBUG_KMS("HS to LP Clock Count 0x%x\n", intel_dsi->clk_hs_to_lp_count); + DRM_DEBUG_KMS("BTA %s\n", + enableddisabled(!(intel_dsi->video_frmt_cfg_bits & DISABLE_VIDEO_BTA))); +} + #define ICL_PREPARE_CNT_MAX0x7 #define ICL_CLK_ZERO_CNT_MAX 0xf #define ICL_TRAIL_CNT_MAX 0x7 @@ -635,6 +673,8 @@ static void icl_dphy_param_init(struct intel_dsi *intel_dsi) HS_TRAIL(trail_cnt) | HS_EXIT_OVERRIDE | HS_EXIT(exit_zero_cnt)); + + intel_dsi_log_params(intel_dsi); } static void vlv_dphy_param_init(struct intel_dsi *intel_dsi) @@ -794,6 +834,8 @@ static void vlv_dphy_param_init(struct intel_dsi *intel_dsi) DIV_ROUND_UP(2 * tlpx_ui + trail_cnt * 2 + 8, 8); intel_dsi->clk_hs_to_lp_count += extra_byte_count; + + intel_dsi_log_params(intel_dsi); } bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id) @@ -877,41 +919,6 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id) else vlv_dphy_param_init(intel_dsi); - DRM_DEBUG_KMS("Pclk %d\n", intel_dsi->pclk); - DRM_DEBUG_KMS("Pixel overlap %d\n", intel_dsi->pixel_overlap); - DRM_DEBUG_KMS("Lane count %d\n", intel_dsi->lane_count); - DRM_DEBUG_KMS("DPHY param reg 0x%x\n", intel_dsi->dphy_reg); - DRM_DEBUG_KMS("Video mode format %s\n", - intel_dsi->video_mode_format == VIDEO_MODE_NON_BURST_WITH_SYNC_PULSE ? - "non-burst with sync pulse" : - intel_dsi->video_mode_format == VIDEO_MODE_NON_BURST_WITH_SYNC_EVENTS ? - "non-burst with sync events" : - intel_dsi->video_mode_format == VIDEO_MODE_BURST ? - "burst" : ""); - DRM_DEBUG_KMS("Burst mode ratio %d\n", intel_dsi->burst_mode_ratio); - DRM_DEBUG_KMS("Reset timer %d\n", intel_dsi->rst_timer_val); - DRM_DEBUG_KMS("Eot %s\n", enableddisabled(intel_dsi->eotp_pkt)); - DRM_DEBUG_KMS("Clockstop %s\n", enableddisabled(!intel_dsi->clock_stop)); - DRM_DEBUG_KMS("Mode %s\n", intel_dsi-
[Intel-gfx] [PATCH resend for CI] drm/i915/dsi: Call drm_connector_cleanup on vlv_dsi_init error exit path
If we exit vlv_dsi_init() because we failed to find a fixed_mode, then we've already called drm_connector_init() and we should call drm_connector_cleanup() to unregister the connector object. Reviewed-by: Ville Syrjälä Signed-off-by: Hans de Goede --- drivers/gpu/drm/i915/vlv_dsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c index 7ecffd4b9f6b..fce8b58f7f93 100644 --- a/drivers/gpu/drm/i915/vlv_dsi.c +++ b/drivers/gpu/drm/i915/vlv_dsi.c @@ -1817,7 +1817,7 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv) if (!fixed_mode) { DRM_DEBUG_KMS("no fixed mode\n"); - goto err; + goto err_cleanup_connector; } intel_panel_init(&intel_connector->panel, fixed_mode, NULL); @@ -1827,6 +1827,8 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv) return; +err_cleanup_connector: + drm_connector_cleanup(&intel_connector->base); err: drm_encoder_cleanup(&intel_encoder->base); kfree(intel_dsi); -- 2.21.0 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH] drm/i915: Tune down link train error messages due to IO failure
On Fri, May 24, 2019 at 07:27:54PM +0300, Martin Peres wrote: > On 23/05/2019 16:08, Imre Deak wrote: > > An IO failure happens if the sink is unplugged. This scenario shouldn't > > be logged with error level, since it is not a user visible problem. > > Converting the corresponding error messages to be debug messages also > > ensures that we don't fail some CI test incorrectly that tests the > > unplugging while a mode is still active on the given connector (like the > > kms_chamelium tests imititating such an unplug during being suspended). > > > > Leave those link training error messages that are due to an actual > > transfer rate error (and not an IO error) as-is, as that kind of problem > > is related to the user's configuration (cable, mode, monitor) and so it > > is really user visible. > > Are there some scenarios that would be warranting a DRM_ERROR? If so, > then we should decide on the verbosity based on wether the connector is > connected or disconnected, don't you think? I don't think we should depend on the correctness of setting the message level correctly based on the live state, since the live state itself is flaky/unreliable based on the timing of the unplug vs. the settling of the live state flag. For instance we could see the AUX IO failing already but live state still indicating that the sink is plugged, so we'd print again an error instead of the correct tuned-down note. > > Martin > > > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110390 > > Signed-off-by: Imre Deak > > --- > > drivers/gpu/drm/i915/intel_dp_link_training.c | 12 ++-- > > 1 file changed, 6 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c > > b/drivers/gpu/drm/i915/intel_dp_link_training.c > > index 9b1fccea966b..392ebeb89ce8 100644 > > --- a/drivers/gpu/drm/i915/intel_dp_link_training.c > > +++ b/drivers/gpu/drm/i915/intel_dp_link_training.c > > @@ -169,7 +169,7 @@ intel_dp_link_training_clock_recovery(struct intel_dp > > *intel_dp) > > if (!intel_dp_reset_link_train(intel_dp, > >DP_TRAINING_PATTERN_1 | > >DP_LINK_SCRAMBLING_DISABLE)) { > > - DRM_ERROR("failed to enable link training\n"); > > + DRM_DEBUG_KMS("failed to enable link training\n"); > > return false; > > } > > > > @@ -193,7 +193,7 @@ intel_dp_link_training_clock_recovery(struct intel_dp > > *intel_dp) > > drm_dp_link_train_clock_recovery_delay(intel_dp->dpcd); > > > > if (!intel_dp_get_link_status(intel_dp, link_status)) { > > - DRM_ERROR("failed to get link status\n"); > > + DRM_DEBUG_KMS("failed to get link status\n"); > > return false; > > } > > > > @@ -217,7 +217,7 @@ intel_dp_link_training_clock_recovery(struct intel_dp > > *intel_dp) > > /* Update training set as requested by target */ > > intel_get_adjust_train(intel_dp, link_status); > > if (!intel_dp_update_link_train(intel_dp)) { > > - DRM_ERROR("failed to update link training\n"); > > + DRM_DEBUG_KMS("failed to update link training\n"); > > return false; > > } > > > > @@ -295,7 +295,7 @@ intel_dp_link_training_channel_equalization(struct > > intel_dp *intel_dp) > > /* channel equalization */ > > if (!intel_dp_set_link_train(intel_dp, > > training_pattern)) { > > - DRM_ERROR("failed to start channel equalization\n"); > > + DRM_DEBUG_KMS("failed to start channel equalization\n"); > > return false; > > } > > > > @@ -303,7 +303,7 @@ intel_dp_link_training_channel_equalization(struct > > intel_dp *intel_dp) > > > > drm_dp_link_train_channel_eq_delay(intel_dp->dpcd); > > if (!intel_dp_get_link_status(intel_dp, link_status)) { > > - DRM_ERROR("failed to get link status\n"); > > + DRM_DEBUG_KMS("failed to get link status\n"); > > break; > > } > > > > @@ -327,7 +327,7 @@ intel_dp_link_training_channel_equalization(struct > > intel_dp *intel_dp) > > /* Update training set as requested by target */ > > intel_get_adjust_train(intel_dp, link_status); > > if (!intel_dp_update_link_train(intel_dp)) { > > - DRM_ERROR("failed to update link training\n"); > > + DRM_DEBUG_KMS("failed to update link training\n"); > > break; > > } > > } > > > ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [PATCH] drm/i915/icl: Fix AUX-B HW not done issue w/o AUX-A
Atm AUX-B transfers can fail with the following error if AUX-A is not enabled: [ 594.594108] [drm:intel_dp_aux_xfer [i915]] dp_aux_ch timeout status 0x7c2003ff [ 594.615854] [drm:intel_dp_aux_xfer [i915]] *ERROR* dp aux hw did not signal timeout! [ 594.632851] [drm:intel_dp_aux_xfer [i915]] *ERROR* dp aux hw did not signal timeout! [ 594.632915] [drm:intel_dp_aux_xfer [i915]] *ERROR* dp_aux_ch not done status 0xac2003ff [ 594.641786] [ cut here ] [ 594.641790] dp_aux_ch not started status 0xac2003ff [ 594.641874] WARNING: CPU: 4 PID: 1366 at drivers/gpu/drm/i915/intel_dp.c:1268 intel_dp_aux_xfer+0x232/0x890 [i915] Ville noticed this issue already earlier and managed to work around it by keeping AUX-A always powered whenever AUX-B was used. He also reported the issue to HW folks and they have now root caused the problem and updated BSpec with a fix (see internal BSpec/Index/21257, HSD/1607152412). I noticed the same error - even with the WA being applied - while doing AUX transfers with Chamelium being connected with a DP cable to the source but letting Chamelium imitate an unplug. This is probably some unstandard way on Chamelium's behalf of disconnecting itself from the AUX pins. For instance it could still pull on the AUX pins which would prevent the source from detecting AUX timeouts in the proper way, leading to the ERRORs or WARNs seen in the logs in the Reference: bug below. In case I disconnect the sink properly (the cable itself, not via the Chamelium unplug xmlrpc command) then the AUX timeout signaling works properly and so there won't be any ERRORs/WARNs emitted. Reference: https://bugs.freedesktop.org/show_bug.cgi?id=110718 Cc: Ville Syrjälä Reported-by: Ville Syrjälä Signed-off-by: Imre Deak --- drivers/gpu/drm/i915/i915_reg.h| 3 +++ drivers/gpu/drm/i915/intel_combo_phy.c | 6 ++ 2 files changed, 9 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 87e8780711d7..bae4a2547eb2 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -1846,6 +1846,9 @@ enum i915_power_well_id { #define VOLTAGE_INFO_MASK(3 << 24) #define VOLTAGE_INFO_SHIFT 24 +#define ICL_PORT_COMP_DW8(port)_MMIO(_ICL_PORT_COMP_DW(8, port)) +#define IREFGEN (1 << 24) + #define CNL_PORT_COMP_DW9 _MMIO(0x162124) #define ICL_PORT_COMP_DW9(port)_MMIO(_ICL_PORT_COMP_DW(9, port)) diff --git a/drivers/gpu/drm/i915/intel_combo_phy.c b/drivers/gpu/drm/i915/intel_combo_phy.c index 19a9333b727a..98213cc58736 100644 --- a/drivers/gpu/drm/i915/intel_combo_phy.c +++ b/drivers/gpu/drm/i915/intel_combo_phy.c @@ -275,6 +275,12 @@ static void icl_combo_phys_init(struct drm_i915_private *dev_priv) cnl_set_procmon_ref_values(dev_priv, port); + if (port == PORT_A) { + val = I915_READ(ICL_PORT_COMP_DW8(port)); + val |= IREFGEN; + I915_WRITE(ICL_PORT_COMP_DW8(port), val); + } + val = I915_READ(ICL_PORT_COMP_DW0(port)); val |= COMP_INIT; I915_WRITE(ICL_PORT_COMP_DW0(port), val); -- 2.17.1 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH v4 11/22] drm/i915/guc: Define GuC firmware version for Geminilake
>-Original Message- >From: Wajdeczko, Michal >Sent: Thursday, May 23, 2019 4:31 PM >To: intel-gfx@lists.freedesktop.org >Cc: Wajdeczko, Michal ; Ceraolo Spurio, Daniele >; Srivatsa, Anusha > >Subject: [PATCH v4 11/22] drm/i915/guc: Define GuC firmware version for >Geminilake > >Define GuC firmware version for Geminilake. Thanks for this patch Michal. Reviewed-by: Anusha Srivatsa >Signed-off-by: Michal Wajdeczko >Cc: Daniele Ceraolo Spurio >Cc: Anusha Srivatsa >--- > drivers/gpu/drm/i915/intel_guc_fw.c | 11 +++ > 1 file changed, 11 insertions(+) > >diff --git a/drivers/gpu/drm/i915/intel_guc_fw.c >b/drivers/gpu/drm/i915/intel_guc_fw.c >index c740bf3731de..c1e9bb4e04fd 100644 >--- a/drivers/gpu/drm/i915/intel_guc_fw.c >+++ b/drivers/gpu/drm/i915/intel_guc_fw.c >@@ -58,6 +58,13 @@ MODULE_FIRMWARE(BXT_GUC_FIRMWARE_PATH); > #define KBL_GUC_FIRMWARE_PATH __MAKE_GUC_FW_PATH(KBL) >MODULE_FIRMWARE(KBL_GUC_FIRMWARE_PATH); > >+#define GLK_GUC_FW_PREFIX glk >+#define GLK_GUC_FW_MAJOR 32 >+#define GLK_GUC_FW_MINOR 0 >+#define GLK_GUC_FW_PATCH 3 >+#define GLK_GUC_FIRMWARE_PATH __MAKE_GUC_FW_PATH(GLK) >+MODULE_FIRMWARE(GLK_GUC_FIRMWARE_PATH); >+ > static void guc_fw_select(struct intel_uc_fw *guc_fw) { > struct intel_guc *guc = container_of(guc_fw, struct intel_guc, fw); @@ - >72,6 +79,10 @@ static void guc_fw_select(struct intel_uc_fw *guc_fw) > guc_fw->path = i915_modparams.guc_firmware_path; > guc_fw->major_ver_wanted = 0; > guc_fw->minor_ver_wanted = 0; >+ } else if (IS_GEMINILAKE(i915)) { >+ guc_fw->path = GLK_GUC_FIRMWARE_PATH; >+ guc_fw->major_ver_wanted = GLK_GUC_FW_MAJOR; >+ guc_fw->minor_ver_wanted = GLK_GUC_FW_MINOR; > } else if (IS_KABYLAKE(i915) || IS_COFFEELAKE(i915)) { > guc_fw->path = KBL_GUC_FIRMWARE_PATH; > guc_fw->major_ver_wanted = KBL_GUC_FW_MAJOR; >-- >2.19.2 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx