All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Andrey Grodzovsky
	<andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Alexander.Deucher-5C7GfCeVMHo@public.gmane.org,
	michel-otUistvHUpPR7s880joybQ@public.gmane.org,
	hersenxs.wu-5C7GfCeVMHo@public.gmane.org,
	Christian.Koenig-5C7GfCeVMHo@public.gmane.org,
	shirish.s-5C7GfCeVMHo@public.gmane.org
Subject: Re: [PATCH v5 2/4] drm/amdgpu: Create helper to clear AMDGPU_GEM_CREATE_CPU_GTT_USWC
Date: Fri, 26 Jul 2019 09:11:41 +0200	[thread overview]
Message-ID: <1723b531-097f-2687-6dc9-9de6e3e378a1@gmail.com> (raw)
In-Reply-To: <1564064683-31796-3-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>

Am 25.07.19 um 16:24 schrieb Andrey Grodzovsky:
> Move the logic to clear AMDGPU_GEM_CREATE_CPU_GTT_USWC in
> amdgpu_bo_do_create into standalone helper so it can be reused
> in other functions.
>
> v4:
> Switch to return bool.
>
> v5: Fix typos.
>
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 61 +++++++++++++++++-------------
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.h |  2 +
>   2 files changed, 37 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 989b7b5..8702062 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -413,6 +413,40 @@ static bool amdgpu_bo_validate_size(struct amdgpu_device *adev,
>   	return false;
>   }
>   
> +bool amdgpu_bo_support_uswc(u64 bo_flags)
> +{
> +
> +#ifdef CONFIG_X86_32
> +	/* XXX: Write-combined CPU mappings of GTT seem broken on 32-bit
> +	 * See https://bugs.freedesktop.org/show_bug.cgi?id=84627
> +	 */
> +	return false;
> +#elif defined(CONFIG_X86) && !defined(CONFIG_X86_PAT)
> +	/* Don't try to enable write-combining when it can't work, or things
> +	 * may be slow
> +	 * See https://bugs.freedesktop.org/show_bug.cgi?id=88758
> +	 */
> +
> +#ifndef CONFIG_COMPILE_TEST
> +#warning Please enable CONFIG_MTRR and CONFIG_X86_PAT for better performance \
> +	 thanks to write-combining
> +#endif
> +
> +	if (bo_flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC)
> +		DRM_INFO_ONCE("Please enable CONFIG_MTRR and CONFIG_X86_PAT for "
> +			      "better performance thanks to write-combining\n");

I don't think this message belongs here.

> +	return false;
> +#else
> +	/* For architectures that don't support WC memory,
> +	 * mask out the WC flag from the BO
> +	 */
> +	if (!drm_arch_can_wc_memory())
> +		return false;
> +
> +	return true;
> +#endif
> +}
> +
>   static int amdgpu_bo_do_create(struct amdgpu_device *adev,
>   			       struct amdgpu_bo_param *bp,
>   			       struct amdgpu_bo **bo_ptr)
> @@ -466,33 +500,8 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
>   
>   	bo->flags = bp->flags;
>   
> -#ifdef CONFIG_X86_32
> -	/* XXX: Write-combined CPU mappings of GTT seem broken on 32-bit
> -	 * See https://bugs.freedesktop.org/show_bug.cgi?id=84627
> -	 */
> -	bo->flags &= ~AMDGPU_GEM_CREATE_CPU_GTT_USWC;
> -#elif defined(CONFIG_X86) && !defined(CONFIG_X86_PAT)
> -	/* Don't try to enable write-combining when it can't work, or things
> -	 * may be slow
> -	 * See https://bugs.freedesktop.org/show_bug.cgi?id=88758
> -	 */
> -
> -#ifndef CONFIG_COMPILE_TEST
> -#warning Please enable CONFIG_MTRR and CONFIG_X86_PAT for better performance \
> -	 thanks to write-combining
> -#endif
> -
> -	if (bo->flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC)
> -		DRM_INFO_ONCE("Please enable CONFIG_MTRR and CONFIG_X86_PAT for "
> -			      "better performance thanks to write-combining\n");
> -	bo->flags &= ~AMDGPU_GEM_CREATE_CPU_GTT_USWC;
> -#else
> -	/* For architectures that don't support WC memory,
> -	 * mask out the WC flag from the BO
> -	 */
> -	if (!drm_arch_can_wc_memory())
> +	if (!amdgpu_bo_support_uswc(bo->flags))
>   		bo->flags &= ~AMDGPU_GEM_CREATE_CPU_GTT_USWC;

Rather here we should do "if (bo_flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC 
&& !amdgpu_bo_support_uswc())" and then clear the flag and also print 
the warning.

Apart from that the series looks good to me,
Christian.

> -#endif
>   
>   	bo->tbo.bdev = &adev->mman.bdev;
>   	if (bp->domain & (AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA |
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> index d60593c..dc44cf3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> @@ -308,5 +308,7 @@ void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager,
>   					 struct seq_file *m);
>   #endif
>   
> +bool amdgpu_bo_support_uswc(u64 bo_flags);
> +
>   
>   #endif

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

  parent reply	other threads:[~2019-07-26  7:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-25 14:24 [PATCH v5 0/4] Enable S/G for Picasso Andrey Grodzovsky
     [not found] ` <1564064683-31796-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2019-07-25 14:24   ` [PATCH v5 1/4] drm/amdgpu: Fix hard hang for S/G display BOs Andrey Grodzovsky
2019-07-25 14:24   ` [PATCH v5 2/4] drm/amdgpu: Create helper to clear AMDGPU_GEM_CREATE_CPU_GTT_USWC Andrey Grodzovsky
     [not found]     ` <1564064683-31796-3-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2019-07-26  7:11       ` Christian König [this message]
     [not found]         ` <1723b531-097f-2687-6dc9-9de6e3e378a1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-07-26  8:54           ` Michel Dänzer
     [not found]             ` <fdf2600a-b0ef-bdca-f22b-51427bef9531-otUistvHUpPR7s880joybQ@public.gmane.org>
2019-07-26 11:55               ` Christian König
     [not found]                 ` <881edbab-df57-a1d7-bcf3-987fdbb384db-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-07-26 14:53                   ` Michel Dänzer
     [not found]                     ` <7c62edf1-0e3b-d57e-fd33-f98198b6c23a-otUistvHUpPR7s880joybQ@public.gmane.org>
2019-07-26 16:02                       ` Christian König
     [not found]                         ` <973beeaf-735c-777d-c493-cdfdde2dd2f1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-07-26 16:09                           ` Michel Dänzer
2019-07-25 14:24   ` [PATCH v5 3/4] drm/amdgpu: Add check for USWC support for amdgpu_display_supported_domains Andrey Grodzovsky
2019-07-25 14:24   ` [PATCH v5 4/4] drm/amd/display: enable S/G for RAVEN chip Andrey Grodzovsky
     [not found]     ` <1564064683-31796-5-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2019-07-25 14:33       ` Kazlauskas, Nicholas
2019-07-26  7:14       ` Christian König
     [not found]         ` <a1e2755c-142c-ceaf-9be4-1ffff4d25cea-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-07-26  9:03           ` Michel Dänzer
     [not found]             ` <8046a45b-bf49-ad47-8902-ad928dcc97b4-otUistvHUpPR7s880joybQ@public.gmane.org>
2019-07-26 12:47               ` Grodzovsky, Andrey
2019-07-25 14:39   ` [PATCH v5 0/4] Enable S/G for Picasso Michel Dänzer

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=1723b531-097f-2687-6dc9-9de6e3e378a1@gmail.com \
    --to=ckoenig.leichtzumerken-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=Alexander.Deucher-5C7GfCeVMHo@public.gmane.org \
    --cc=Christian.Koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org \
    --cc=hersenxs.wu-5C7GfCeVMHo@public.gmane.org \
    --cc=michel-otUistvHUpPR7s880joybQ@public.gmane.org \
    --cc=shirish.s-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.