From: Nirmoy Das <nirmoy.das@linux.intel.com>
To: Andrzej Hajda <andrzej.hajda@intel.com>, intel-gfx@lists.freedesktop.org
Cc: Chris Wilson <chris.p.wilson@linux.intel.com>,
Jonathan Cavitt <jonathan.cavitt@intel.com>
Subject: Re: [Intel-gfx] [PATCH v3 2/4] drm/i915: Reserve some kernel space per vm
Date: Mon, 23 Oct 2023 10:49:46 +0200 [thread overview]
Message-ID: <6090c205-04e3-84f9-bbf3-cc6318de4445@linux.intel.com> (raw)
In-Reply-To: <20231023-wabb-v3-2-1a4fbc632440@intel.com>
Hi Andrzej,
On 10/23/2023 9:41 AM, Andrzej Hajda wrote:
> Reserve two pages in each vm for kernel space to use for things
> such as workarounds.
>
> v2: use real memory, do not decrease vm.total
>
> Suggested-by: Chris Wilson <chris.p.wilson@linux.intel.com>
> Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
> Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
> ---
> drivers/gpu/drm/i915/gt/gen8_ppgtt.c | 38 ++++++++++++++++++++++++++++++++++++
> drivers/gpu/drm/i915/gt/intel_gtt.h | 1 +
> 2 files changed, 39 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/gt/gen8_ppgtt.c b/drivers/gpu/drm/i915/gt/gen8_ppgtt.c
> index 84aa29715e0aca..c25e1d4cceeb17 100644
> --- a/drivers/gpu/drm/i915/gt/gen8_ppgtt.c
> +++ b/drivers/gpu/drm/i915/gt/gen8_ppgtt.c
> @@ -5,6 +5,7 @@
>
> #include <linux/log2.h>
>
> +#include "gem/i915_gem_internal.h"
> #include "gem/i915_gem_lmem.h"
>
> #include "gen8_ppgtt.h"
> @@ -953,6 +954,39 @@ gen8_alloc_top_pd(struct i915_address_space *vm)
> return ERR_PTR(err);
> }
>
> +static int gen8_init_rsvd(struct i915_address_space *vm)
> +{
> + const resource_size_t size = 2 * PAGE_SIZE;
> + struct drm_i915_private *i915 = vm->i915;
> + struct drm_i915_gem_object *obj;
> + struct i915_vma *vma;
> + int ret;
> +
> + obj = i915_gem_object_create_lmem(i915, size,
> + I915_BO_ALLOC_VOLATILE |
> + I915_BO_ALLOC_GPU_ONLY);
Please add a comment why GPU_ONLY flag is used. It makes sense to me now
but good to have a comment for the future. Also why 2 pages are
reserved ?
Regards,
Nirmoy
> + if (IS_ERR(obj))
> + obj = i915_gem_object_create_internal(i915, size);
> + if (IS_ERR(obj))
> + return PTR_ERR(obj);
> +
> + vma = i915_vma_instance(obj, vm, NULL);
> + if (IS_ERR(vma)) {
> + ret = PTR_ERR(vma);
> + goto unref;
> + }
> +
> + ret = i915_vma_pin(vma, 0, 0, PIN_USER | PIN_HIGH);
> + if (ret)
> + goto unref;
> +
> + vm->rsvd = i915_vma_make_unshrinkable(vma);
> +
> +unref:
> + i915_gem_object_put(obj);
> + return ret;
> +}
> +
> /*
> * GEN8 legacy ppgtt programming is accomplished through a max 4 PDP registers
> * with a net effect resembling a 2-level page table in normal x86 terms. Each
> @@ -1034,6 +1068,10 @@ struct i915_ppgtt *gen8_ppgtt_create(struct intel_gt *gt,
> if (intel_vgpu_active(gt->i915))
> gen8_ppgtt_notify_vgt(ppgtt, true);
>
> + err = gen8_init_rsvd(&ppgtt->vm);
> + if (err)
> + goto err_put;
> +
> return ppgtt;
>
> err_put:
> diff --git a/drivers/gpu/drm/i915/gt/intel_gtt.h b/drivers/gpu/drm/i915/gt/intel_gtt.h
> index 15c71da14d1d27..4a35ef24501b5f 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gtt.h
> +++ b/drivers/gpu/drm/i915/gt/intel_gtt.h
> @@ -250,6 +250,7 @@ struct i915_address_space {
> struct work_struct release_work;
>
> struct drm_mm mm;
> + struct i915_vma *rsvd;
> struct intel_gt *gt;
> struct drm_i915_private *i915;
> struct device *dma;
>
next prev parent reply other threads:[~2023-10-23 8:49 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-23 7:41 [Intel-gfx] [PATCH v3 0/4] Apply Wa_16018031267 / Wa_16018063123 Andrzej Hajda
2023-10-23 7:41 ` [Intel-gfx] [PATCH v3 1/4] drm/i915: Enable NULL PTE support for vm scratch Andrzej Hajda
2023-10-23 12:23 ` Nirmoy Das
2023-10-23 14:54 ` Andrzej Hajda
2023-10-23 7:41 ` [Intel-gfx] [PATCH v3 2/4] drm/i915: Reserve some kernel space per vm Andrzej Hajda
2023-10-23 8:49 ` Nirmoy Das [this message]
2023-10-23 11:40 ` Andrzej Hajda
2023-10-23 7:41 ` [Intel-gfx] [PATCH v3 3/4] drm/i915: Add WABB blit for Wa_16018031267 / Wa_16018063123 Andrzej Hajda
2023-10-23 9:05 ` Nirmoy Das
2023-10-23 19:08 ` Andrzej Hajda
2023-10-23 7:41 ` [Intel-gfx] [PATCH v3 4/4] drm/i915: Set copy engine arbitration " Andrzej Hajda
2023-10-23 9:55 ` Nirmoy Das
2023-10-23 15:24 ` Andrzej Hajda
2023-10-23 16:06 ` Nirmoy Das
2023-10-23 8:38 ` [Intel-gfx] [PATCH v3 0/4] Apply " Nirmoy Das
2023-10-23 11:35 ` Andrzej Hajda
2023-10-23 12:20 ` Nirmoy Das
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=6090c205-04e3-84f9-bbf3-cc6318de4445@linux.intel.com \
--to=nirmoy.das@linux.intel.com \
--cc=andrzej.hajda@intel.com \
--cc=chris.p.wilson@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jonathan.cavitt@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