From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: Matthew Auld <matthew.auld@intel.com>
Subject: Re: [PATCH] drm/i915: Replace open-coded memset_p()
Date: Mon, 12 Feb 2018 15:54:13 +0200 [thread overview]
Message-ID: <87bmguuxdm.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20180212133118.16443-1-chris@chris-wilson.co.uk>
Chris Wilson <chris@chris-wilson.co.uk> writes:
> When initialising the page directories, we set the GTT entries and the
> tree to the scratch page. We have already replaced the DMA fill with
> memset64(), but we can similarly use memset_p() to set the pointer array.
>
> References: 4dd504f7d98a ("drm/i915: Use memset64() to prefill the GTT page")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Matthew Auld <matthew.auld@intel.com>
> Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> ---
> drivers/gpu/drm/i915/i915_gem_gtt.c | 14 +++-----------
> 1 file changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 0c0f1affddad..a44eccda7d48 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -673,27 +673,22 @@ static void free_pd(struct i915_address_space *vm,
> static void gen8_initialize_pd(struct i915_address_space *vm,
> struct i915_page_directory *pd)
> {
> - unsigned int i;
> -
> fill_px(vm, pd,
> gen8_pde_encode(px_dma(vm->scratch_pt), I915_CACHE_LLC));
> - for (i = 0; i < I915_PDES; i++)
> - pd->page_table[i] = vm->scratch_pt;
> + memset_p((void **)pd->page_table, vm->scratch_pt, I915_PDES);
> }
>
> static int __pdp_init(struct i915_address_space *vm,
> struct i915_page_directory_pointer *pdp)
> {
> const unsigned int pdpes = i915_pdpes_per_pdp(vm);
> - unsigned int i;
>
> pdp->page_directory = kmalloc_array(pdpes, sizeof(*pdp->page_directory),
> GFP_KERNEL | __GFP_NOWARN);
> if (unlikely(!pdp->page_directory))
> return -ENOMEM;
>
> - for (i = 0; i < pdpes; i++)
> - pdp->page_directory[i] = vm->scratch_pd;
> + memset_p((void **)pdp->page_directory, vm->scratch_pd, pdpes);
>
> return 0;
> }
> @@ -764,12 +759,9 @@ static void gen8_initialize_pdp(struct i915_address_space *vm,
> static void gen8_initialize_pml4(struct i915_address_space *vm,
> struct i915_pml4 *pml4)
> {
> - unsigned int i;
> -
> fill_px(vm, pml4,
> gen8_pml4e_encode(px_dma(vm->scratch_pdp), I915_CACHE_LLC));
> - for (i = 0; i < GEN8_PML4ES_PER_PML4; i++)
> - pml4->pdps[i] = vm->scratch_pdp;
> + memset_p((void **)pml4->pdps, vm->scratch_pdp, GEN8_PML4ES_PER_PML4);
> }
>
> /* Broadwell Page Directory Pointer Descriptors */
> --
> 2.16.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
next prev parent reply other threads:[~2018-02-12 13:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-12 13:31 [PATCH] drm/i915: Replace open-coded memset_p() Chris Wilson
2018-02-12 13:47 ` Matthew Auld
2018-02-12 13:54 ` Mika Kuoppala [this message]
2018-02-12 15:19 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-02-12 17:19 ` ✓ Fi.CI.IGT: " Patchwork
2018-02-12 17:32 ` Chris Wilson
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=87bmguuxdm.fsf@gaia.fi.intel.com \
--to=mika.kuoppala@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
--cc=matthew.auld@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox