From: "Christian König" <ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Chunming Zhou <david1.zhou-5C7GfCeVMHo@public.gmane.org>,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 2/2] drm/amdgpu: handle domain mask checking
Date: Tue, 17 Apr 2018 14:07:54 +0200 [thread overview]
Message-ID: <ce6c3ffd-1fe2-3e54-6aa9-d5a7d504274d@gmail.com> (raw)
In-Reply-To: <20180417103834.27656-2-david1.zhou-5C7GfCeVMHo@public.gmane.org>
Am 17.04.2018 um 12:38 schrieb Chunming Zhou:
> if domain is illegal, we should return error.
This check is already in amdgpu_gem_create_ioctl():
> if (args->in.domains & ~(AMDGPU_GEM_DOMAIN_CPU |
> AMDGPU_GEM_DOMAIN_GTT |
> AMDGPU_GEM_DOMAIN_VRAM |
> AMDGPU_GEM_DOMAIN_GDS |
> AMDGPU_GEM_DOMAIN_GWS |
> AMDGPU_GEM_DOMAIN_OA))
> return -EINVAL;
We should just check it at one place I think.
Either remove it in amdgpu_bo_do_create() or in amdgpu_gem_create_ioctl().
Regards,
Christian.
>
> Change-Id: I65a738f5ac4fc34be76de867afb0db1d4bd27c24
> Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 15 +++++++--------
> include/uapi/drm/amdgpu_drm.h | 6 ++++++
> 2 files changed, 13 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 9258f0694922..ddf1b3580d37 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -378,17 +378,16 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
> bo = kzalloc(sizeof(struct amdgpu_bo), GFP_KERNEL);
> if (bo == NULL)
> return -ENOMEM;
> + preferred_domains = bp->preferred_domain ? bp->preferred_domain :
> + bp->domain;
> + if (preferred_domains & ~AMDGPU_GEM_DOMAIN_MASK) {
> + kfree(bo);
> + return -EINVAL;
> + }
> drm_gem_private_object_init(adev->ddev, &bo->gem_base, size);
> INIT_LIST_HEAD(&bo->shadow_list);
> INIT_LIST_HEAD(&bo->va);
> - preferred_domains = bp->preferred_domain ? bp->preferred_domain :
> - bp->domain;
> - bo->preferred_domains = preferred_domains & (AMDGPU_GEM_DOMAIN_VRAM |
> - AMDGPU_GEM_DOMAIN_GTT |
> - AMDGPU_GEM_DOMAIN_CPU |
> - AMDGPU_GEM_DOMAIN_GDS |
> - AMDGPU_GEM_DOMAIN_GWS |
> - AMDGPU_GEM_DOMAIN_OA);
> + bo->preferred_domains = preferred_domains;
> bo->allowed_domains = bo->preferred_domains;
> if (bp->type != ttm_bo_type_kernel &&
> bo->allowed_domains == AMDGPU_GEM_DOMAIN_VRAM)
> diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
> index 0087799962cf..d023d3c4ee51 100644
> --- a/include/uapi/drm/amdgpu_drm.h
> +++ b/include/uapi/drm/amdgpu_drm.h
> @@ -81,6 +81,12 @@ extern "C" {
> #define AMDGPU_GEM_DOMAIN_GDS 0x8
> #define AMDGPU_GEM_DOMAIN_GWS 0x10
> #define AMDGPU_GEM_DOMAIN_OA 0x20
> +#define AMDGPU_GEM_DOMAIN_MASK (AMDGPU_GEM_DOMAIN_CPU | \
> + AMDGPU_GEM_DOMAIN_GTT | \
> + AMDGPU_GEM_DOMAIN_VRAM | \
> + AMDGPU_GEM_DOMAIN_GDS | \
> + AMDGPU_GEM_DOMAIN_GWS | \
> + AMDGPU_GEM_DOMAIN_OA)
>
> /* Flag that CPU access will be required for the case of VRAM domain */
> #define AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED (1 << 0)
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
prev parent reply other threads:[~2018-04-17 12:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-17 10:38 [PATCH 1/2] drm/amdgpu: set preferred_domain independent of fallback handling Chunming Zhou
[not found] ` <20180417103834.27656-1-david1.zhou-5C7GfCeVMHo@public.gmane.org>
2018-04-17 10:38 ` [PATCH 2/2] drm/amdgpu: handle domain mask checking Chunming Zhou
[not found] ` <20180417103834.27656-2-david1.zhou-5C7GfCeVMHo@public.gmane.org>
2018-04-17 12:07 ` Christian König [this message]
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=ce6c3ffd-1fe2-3e54-6aa9-d5a7d504274d@gmail.com \
--to=ckoenig.leichtzumerken-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
--cc=david1.zhou-5C7GfCeVMHo@public.gmane.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 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.