All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
To: Michel Thierry <michel.thierry@intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH v8 6/8] drm/i915: create context image vma in kernel context
Date: Tue, 29 May 2018 22:35:08 +0100	[thread overview]
Message-ID: <3a754557-3e76-de37-8fa1-112768749fc0@intel.com> (raw)
In-Reply-To: <70957c18-704a-f4cd-f10b-0830469f98fa@intel.com>

On 29/05/18 21:26, Michel Thierry wrote:
> Hi,
>
> On 5/29/2018 12:16 PM, Lionel Landwerlin wrote:
>> We want to be able to modify other context images from the kernel
>> context in a following commit. To be able to do this we need to map
>> the context image into the kernel context's ppgtt.
>>
>> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
>> ---
>>   drivers/gpu/drm/i915/i915_gem_context.h |  1 +
>>   drivers/gpu/drm/i915/intel_lrc.c        | 19 ++++++++++++++-----
>>   2 files changed, 15 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_gem_context.h 
>> b/drivers/gpu/drm/i915/i915_gem_context.h
>> index f40d85448a28..9c313c2edb09 100644
>> --- a/drivers/gpu/drm/i915/i915_gem_context.h
>> +++ b/drivers/gpu/drm/i915/i915_gem_context.h
>> @@ -155,6 +155,7 @@ struct i915_gem_context {
>>       struct intel_context {
>>           struct i915_gem_context *gem_context;
>>           struct i915_vma *state;
>> +        struct i915_vma *kernel_state; /**/
>>           struct intel_ring *ring;
>>           u32 *lrc_reg_state;
>>           u64 lrc_desc;
>> diff --git a/drivers/gpu/drm/i915/intel_lrc.c 
>> b/drivers/gpu/drm/i915/intel_lrc.c
>> index 7314e548fb4e..8a49323f6672 100644
>> --- a/drivers/gpu/drm/i915/intel_lrc.c
>> +++ b/drivers/gpu/drm/i915/intel_lrc.c
>> @@ -2739,7 +2739,7 @@ static int 
>> execlists_context_deferred_alloc(struct i915_gem_context *ctx,
>>                           struct intel_context *ce)
>>   {
>>       struct drm_i915_gem_object *ctx_obj;
>> -    struct i915_vma *vma;
>> +    struct i915_vma *ggtt_vma, *ppgtt_vma;
>>       uint32_t context_size;
>>       struct intel_ring *ring;
>>       struct i915_timeline *timeline;
>> @@ -2762,9 +2762,17 @@ static int 
>> execlists_context_deferred_alloc(struct i915_gem_context *ctx,
>>           goto error_deref_obj;
>>       }
>>   -    vma = i915_vma_instance(ctx_obj, &ctx->i915->ggtt.base, NULL);
>> -    if (IS_ERR(vma)) {
>> -        ret = PTR_ERR(vma);
>> +    ggtt_vma = i915_vma_instance(ctx_obj, &ctx->i915->ggtt.base, NULL);
>> +    if (IS_ERR(ggtt_vma)) {
>> +        ret = PTR_ERR(ggtt_vma);
>> +        goto error_deref_obj;
>> +    }
>> +
>> +    ppgtt_vma = i915_vma_instance(ctx_obj,
>> + &ctx->i915->kernel_context->ppgtt->base,
> This is dangerous if someone decides to use 'aliasing ppgtt' 
> (enable_ppgtt=1 is still a valid option).
>
> You'll need something like this,
> struct i915_hw_ppgtt *ppgtt = ctx->i915->kernel_context->ppgtt ?:
>                     ctx->i915->mm.aliasing_ppgtt;

Thanks a lot of the tip, I'm very much new to this.
Will fix and see if they are tests that can exercise this in igt.

-
Lionel

>
>
>> +                      NULL);
>> +    if (IS_ERR(ppgtt_vma)) {
>> +        ret = PTR_ERR(ppgtt_vma);
>>           goto error_deref_obj;
>>       }
>>   @@ -2788,7 +2796,8 @@ static int 
>> execlists_context_deferred_alloc(struct i915_gem_context *ctx,
>>       }
>>         ce->ring = ring;
>> -    ce->state = vma;
>> +    ce->state = ggtt_vma;
>> +    ce->kernel_state = ppgtt_vma;
>>         return 0;
>>
>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-05-29 21:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-29 19:16 [PATCH v8 0/8] drm/i915: per context slice/subslice powergating Lionel Landwerlin
2018-05-29 19:16 ` [PATCH v8 1/8] drm/i915: Program RPCS for Broadwell Lionel Landwerlin
2018-05-29 19:16 ` [PATCH v8 2/8] drm/i915: Record the sseu configuration per-context & engine Lionel Landwerlin
2018-05-29 19:16 ` [PATCH v8 3/8] drm/i915/perf: simplify configure all context function Lionel Landwerlin
2018-05-29 19:16 ` [PATCH v8 4/8] drm/i915/perf: reuse intel_lrc ctx regs macro Lionel Landwerlin
2018-05-29 19:16 ` [PATCH v8 5/8] drm/i915/perf: lock powergating configuration to default when active Lionel Landwerlin
2018-05-29 19:16 ` [PATCH v8 6/8] drm/i915: create context image vma in kernel context Lionel Landwerlin
2018-05-29 20:26   ` Michel Thierry
2018-05-29 21:35     ` Lionel Landwerlin [this message]
2018-05-29 22:08       ` Chris Wilson
2018-05-30 10:05         ` Lionel Landwerlin
2018-05-30 10:11           ` Chris Wilson
2018-05-29 19:16 ` [PATCH v8 7/8] drm/i915: Expose RPCS (SSEU) configuration to userspace Lionel Landwerlin
2018-05-29 19:16 ` [PATCH v8 8/8] drm/i915: add a sysfs entry to let users set sseu configs Lionel Landwerlin
2018-05-29 19:29 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: per context slice/subslice powergating (rev7) Patchwork
2018-05-29 19:32 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-05-29 19:45 ` ✓ Fi.CI.BAT: success " Patchwork
2018-05-29 20:45 ` ✗ Fi.CI.IGT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3a754557-3e76-de37-8fa1-112768749fc0@intel.com \
    --to=lionel.g.landwerlin@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=michel.thierry@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.