public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Michel Thierry <michel.thierry@intel.com>
To: "intel-gfx@lists.freedesktop.org" <intel-gfx@lists.freedesktop.org>
Cc: "Goel, Akash" <akash.goel@intel.com>
Subject: Re: [PATCH 09/16] drm/i915/gen8: Add 4 level support in insert_entries and clear_range
Date: Tue, 26 May 2015 16:10:49 +0100	[thread overview]
Message-ID: <55648CF9.7090002@intel.com> (raw)
In-Reply-To: <1432650084-24491-10-git-send-email-michel.thierry@intel.com>

On 5/26/2015 3:21 PM, Michel Thierry wrote:
> When 48b is enabled, gen8_ppgtt_insert_entries needs to read the Page Map
> Level 4 (PML4), before it selects which Page Directory Pointer (PDP)
> it will write to.
>
> Similarly, gen8_ppgtt_clear_range needs to get the correct PDP/PD range.
>
> This patch was inspired by Ben's "Depend exclusively on map and
> unmap_vma".
>
> v2: Rebase after s/page_tables/page_table/.
> v3: Remove unnecessary pdpe loop in gen8_ppgtt_clear_range_4lvl and use
> clamp_pdp in gen8_ppgtt_insert_entries (Akash).
> v4: Merge gen8_ppgtt_clear_range_4lvl into gen8_ppgtt_clear_range to
> maintain symmetry with gen8_ppgtt_insert_entries (Akash).
> v5: Do not mix pages and bytes in insert_entries (Akash).
>
> Cc: Akash Goel <akash.goel@intel.com>
> Signed-off-by: Michel Thierry <michel.thierry@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_gem_gtt.c | 51 +++++++++++++++++++++++++++++++------
>   drivers/gpu/drm/i915/i915_gem_gtt.h | 11 ++++++++
>   2 files changed, 54 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 2b6ee8e..dbbf367 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -710,12 +725,31 @@ static void gen8_ppgtt_insert_entries(struct i915_address_space *vm,
>                                        enum i915_cache_level cache_level,
>                                        u32 unused)
>   {
> -       struct i915_hw_ppgtt *ppgtt = container_of(vm, struct i915_hw_ppgtt, base);
> -       struct i915_page_directory_pointer *pdp = &ppgtt->pdp; /* FIXME: 48b */
> +       struct i915_hw_ppgtt *ppgtt =
> +                       container_of(vm, struct i915_hw_ppgtt, base);
>          struct sg_page_iter sg_iter;
>
>          __sg_page_iter_start(&sg_iter, pages->sgl, sg_nents(pages->sgl), 0);
> -       gen8_ppgtt_insert_pte_entries(pdp, &sg_iter, start, cache_level, !HAS_LLC(vm->dev));
> +
> +       if (!USES_FULL_48BIT_PPGTT(vm->dev)) {
> +               gen8_ppgtt_insert_pte_entries(&ppgtt->pdp, &sg_iter, start,
> +                                             sg_nents(pages->sgl),
> +                                             cache_level, !HAS_LLC(vm->dev));
> +       } else {
> +               struct i915_page_directory_pointer *pdp;
> +               uint64_t templ4, pml4e;
> +               uint64_t length = sg_nents(pages->sgl) << PAGE_SHIFT;

Actually, this should be:

	uint64_t length = (uint64_t)sg_nents(pages->sgl) << PAGE_SHIFT;

Otherwise it will overflow if we're inserting 4GB at once.

> +
> +               gen8_for_each_pml4e(pdp, &ppgtt->pml4, start, length, templ4, pml4e) {
> +                       uint64_t pdp_len = gen8_clamp_pdp(start, length) >> PAGE_SHIFT;
> +                       uint64_t pdp_start = start;
> +
> +                       gen8_ppgtt_insert_pte_entries(pdp, &sg_iter,
> +                                                     pdp_start, pdp_len,
> +                                                     cache_level,
> +                                                     !HAS_LLC(vm->dev));
> +               }
> +       }
>   }
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-05-26 15:10 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-26 14:21 [PATCH 00/16] 48b PPGTT Michel Thierry
2015-05-26 14:21 ` [PATCH 01/16] drm/i915: Remove unnecessary gen8_clamp_pd Michel Thierry
2015-05-26 14:21 ` [PATCH 02/16] drm/i915/gen8: Make pdp allocation more dynamic Michel Thierry
2015-05-26 14:21 ` [PATCH 03/16] drm/i915/gen8: Abstract PDP usage Michel Thierry
2015-05-26 14:21 ` [PATCH 04/16] drm/i915/gen8: Add dynamic page trace events Michel Thierry
2015-05-26 14:21 ` [PATCH 05/16] drm/i915/gen8: implement alloc/free for 4lvl Michel Thierry
2015-05-26 14:21 ` [PATCH 06/16] drm/i915/gen8: Add 4 level switching infrastructure and lrc support Michel Thierry
2015-05-26 14:21 ` [PATCH 07/16] drm/i915/gen8: Generalize PTE writing for GEN8 PPGTT Michel Thierry
2015-05-26 14:21 ` [PATCH 08/16] drm/i915: Plumb sg_iter through va allocation ->maps Michel Thierry
2015-05-26 14:21 ` [PATCH 09/16] drm/i915/gen8: Add 4 level support in insert_entries and clear_range Michel Thierry
2015-05-26 15:10   ` Michel Thierry [this message]
2015-05-26 14:21 ` [PATCH 10/16] drm/i915/gen8: Initialize PDPs Michel Thierry
2015-05-26 14:21 ` [PATCH 11/16] drm/i915: Expand error state's address width to 64b Michel Thierry
2015-05-26 14:21 ` [PATCH 12/16] drm/i915/gen8: Add ppgtt info and debug_dump Michel Thierry
2015-05-26 14:21 ` [PATCH 13/16] drm/i915: object size needs to be u64 Michel Thierry
2015-05-26 14:21 ` [PATCH 14/16] drm/i915: Check against correct user_size limit in 48b ppgtt mode Michel Thierry
2015-05-26 14:21 ` [PATCH 15/16] drm/i915: Wa32bitGeneralStateOffset & Wa32bitInstructionBaseOffset Michel Thierry
2015-05-26 15:25   ` Daniel Vetter
2015-05-26 16:56     ` Michel Thierry
2015-05-26 20:16     ` Chris Wilson
2015-05-27 12:02       ` Daniel Vetter
2015-05-26 14:21 ` [PATCH 16/16] drm/i915/gen8: Flip the 48b switch Michel Thierry
2015-05-26 14:21 ` [PATCH] tests/gem_ppgtt: Check Wa32bitOffsets workarounds Michel Thierry

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=55648CF9.7090002@intel.com \
    --to=michel.thierry@intel.com \
    --cc=akash.goel@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox