linux-snps-arc.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: ira.weiny@intel.com, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Huang Rui <ray.huang@amd.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	dri-devel@lists.freedesktop.org,
	"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
	Max Filippov <jcmvbkbc@gmail.com>,
	Paul Mackerras <paulus@samba.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	sparclinux@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>,
	Helge Deller <deller@gmx.de>,
	x86@kernel.org, linux-csky@vger.kernel.org,
	Ingo Molnar <mingo@redhat.com>,
	linux-snps-arc@lists.infradead.org,
	linux-xtensa@linux-xtensa.org, Borislav Petkov <bp@alien8.de>,
	Andy Lutomirski <luto@kernel.org>,
	Dan Williams <dan.j.williams@intel.com>,
	linux-arm-kernel@lists.infradead.org,
	Chris Zankel <chris@zankel.net>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	linux-parisc@vger.kernel.org, linux-mips@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH V1 10/10] drm: Remove drm specific kmap_atomic code
Date: Fri, 1 May 2020 09:23:50 +0200	[thread overview]
Message-ID: <d6d5ab74-5e16-6541-391b-63d993041fb8@amd.com> (raw)
In-Reply-To: <20200430203845.582900-11-ira.weiny@intel.com>

Am 30.04.20 um 22:38 schrieb ira.weiny@intel.com:
> From: Ira Weiny <ira.weiny@intel.com>
>
> kmap_atomic_prot() is now exported by all architectures.  Use this
> function rather than open coding a driver specific kmap_atomic.
>
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>

Ah, yes looking into this once more this was on my TODO list for quite a 
while as well.

Patch is Reviewed-by: Christian König <christian.koenig@amd.com>, feel 
free to push it upstream through whatever channel you like or ping me if 
I should pick it up into drm-misc-next.

Regards,
Christian.

> ---
>   drivers/gpu/drm/ttm/ttm_bo_util.c    | 56 ++--------------------------
>   drivers/gpu/drm/vmwgfx/vmwgfx_blit.c | 16 ++++----
>   include/drm/ttm/ttm_bo_api.h         |  4 --
>   3 files changed, 12 insertions(+), 64 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index 52d2b71f1588..f09b096ba4fd 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -257,54 +257,6 @@ static int ttm_copy_io_page(void *dst, void *src, unsigned long page)
>   	return 0;
>   }
>   
> -#ifdef CONFIG_X86
> -#define __ttm_kmap_atomic_prot(__page, __prot) kmap_atomic_prot(__page, __prot)
> -#define __ttm_kunmap_atomic(__addr) kunmap_atomic(__addr)
> -#else
> -#define __ttm_kmap_atomic_prot(__page, __prot) vmap(&__page, 1, 0,  __prot)
> -#define __ttm_kunmap_atomic(__addr) vunmap(__addr)
> -#endif
> -
> -
> -/**
> - * ttm_kmap_atomic_prot - Efficient kernel map of a single page with
> - * specified page protection.
> - *
> - * @page: The page to map.
> - * @prot: The page protection.
> - *
> - * This function maps a TTM page using the kmap_atomic api if available,
> - * otherwise falls back to vmap. The user must make sure that the
> - * specified page does not have an aliased mapping with a different caching
> - * policy unless the architecture explicitly allows it. Also mapping and
> - * unmapping using this api must be correctly nested. Unmapping should
> - * occur in the reverse order of mapping.
> - */
> -void *ttm_kmap_atomic_prot(struct page *page, pgprot_t prot)
> -{
> -	if (pgprot_val(prot) == pgprot_val(PAGE_KERNEL))
> -		return kmap_atomic(page);
> -	else
> -		return __ttm_kmap_atomic_prot(page, prot);
> -}
> -EXPORT_SYMBOL(ttm_kmap_atomic_prot);
> -
> -/**
> - * ttm_kunmap_atomic_prot - Unmap a page that was mapped using
> - * ttm_kmap_atomic_prot.
> - *
> - * @addr: The virtual address from the map.
> - * @prot: The page protection.
> - */
> -void ttm_kunmap_atomic_prot(void *addr, pgprot_t prot)
> -{
> -	if (pgprot_val(prot) == pgprot_val(PAGE_KERNEL))
> -		kunmap_atomic(addr);
> -	else
> -		__ttm_kunmap_atomic(addr);
> -}
> -EXPORT_SYMBOL(ttm_kunmap_atomic_prot);
> -
>   static int ttm_copy_io_ttm_page(struct ttm_tt *ttm, void *src,
>   				unsigned long page,
>   				pgprot_t prot)
> @@ -316,13 +268,13 @@ static int ttm_copy_io_ttm_page(struct ttm_tt *ttm, void *src,
>   		return -ENOMEM;
>   
>   	src = (void *)((unsigned long)src + (page << PAGE_SHIFT));
> -	dst = ttm_kmap_atomic_prot(d, prot);
> +	dst = kmap_atomic_prot(d, prot);
>   	if (!dst)
>   		return -ENOMEM;
>   
>   	memcpy_fromio(dst, src, PAGE_SIZE);
>   
> -	ttm_kunmap_atomic_prot(dst, prot);
> +	kunmap_atomic(dst);
>   
>   	return 0;
>   }
> @@ -338,13 +290,13 @@ static int ttm_copy_ttm_io_page(struct ttm_tt *ttm, void *dst,
>   		return -ENOMEM;
>   
>   	dst = (void *)((unsigned long)dst + (page << PAGE_SHIFT));
> -	src = ttm_kmap_atomic_prot(s, prot);
> +	src = kmap_atomic_prot(s, prot);
>   	if (!src)
>   		return -ENOMEM;
>   
>   	memcpy_toio(dst, src, PAGE_SIZE);
>   
> -	ttm_kunmap_atomic_prot(src, prot);
> +	kunmap_atomic(src);
>   
>   	return 0;
>   }
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_blit.c b/drivers/gpu/drm/vmwgfx/vmwgfx_blit.c
> index bb46ca0c458f..94d456a1d1a9 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_blit.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_blit.c
> @@ -374,12 +374,12 @@ static int vmw_bo_cpu_blit_line(struct vmw_bo_blit_line_data *d,
>   		copy_size = min_t(u32, copy_size, PAGE_SIZE - src_page_offset);
>   
>   		if (unmap_src) {
> -			ttm_kunmap_atomic_prot(d->src_addr, d->src_prot);
> +			kunmap_atomic(d->src_addr);
>   			d->src_addr = NULL;
>   		}
>   
>   		if (unmap_dst) {
> -			ttm_kunmap_atomic_prot(d->dst_addr, d->dst_prot);
> +			kunmap_atomic(d->dst_addr);
>   			d->dst_addr = NULL;
>   		}
>   
> @@ -388,8 +388,8 @@ static int vmw_bo_cpu_blit_line(struct vmw_bo_blit_line_data *d,
>   				return -EINVAL;
>   
>   			d->dst_addr =
> -				ttm_kmap_atomic_prot(d->dst_pages[dst_page],
> -						     d->dst_prot);
> +				kmap_atomic_prot(d->dst_pages[dst_page],
> +						 d->dst_prot);
>   			if (!d->dst_addr)
>   				return -ENOMEM;
>   
> @@ -401,8 +401,8 @@ static int vmw_bo_cpu_blit_line(struct vmw_bo_blit_line_data *d,
>   				return -EINVAL;
>   
>   			d->src_addr =
> -				ttm_kmap_atomic_prot(d->src_pages[src_page],
> -						     d->src_prot);
> +				kmap_atomic_prot(d->src_pages[src_page],
> +						 d->src_prot);
>   			if (!d->src_addr)
>   				return -ENOMEM;
>   
> @@ -499,9 +499,9 @@ int vmw_bo_cpu_blit(struct ttm_buffer_object *dst,
>   	}
>   out:
>   	if (d.src_addr)
> -		ttm_kunmap_atomic_prot(d.src_addr, d.src_prot);
> +		kunmap_atomic(d.src_addr);
>   	if (d.dst_addr)
> -		ttm_kunmap_atomic_prot(d.dst_addr, d.dst_prot);
> +		kunmap_atomic(d.dst_addr);
>   
>   	return ret;
>   }
> diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
> index 0a9d042e075a..de1ccdcd5703 100644
> --- a/include/drm/ttm/ttm_bo_api.h
> +++ b/include/drm/ttm/ttm_bo_api.h
> @@ -668,10 +668,6 @@ int ttm_bo_mmap_obj(struct vm_area_struct *vma, struct ttm_buffer_object *bo);
>   int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma,
>   		struct ttm_bo_device *bdev);
>   
> -void *ttm_kmap_atomic_prot(struct page *page, pgprot_t prot);
> -
> -void ttm_kunmap_atomic_prot(void *addr, pgprot_t prot);
> -
>   /**
>    * ttm_bo_io
>    *


_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

  reply	other threads:[~2020-05-01  7:24 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30 20:38 [PATCH V1 00/10] Remove duplicated kmap code ira.weiny
2020-04-30 20:38 ` [PATCH V1 01/10] arch/kmap: Remove BUG_ON() ira.weiny
2020-05-01  8:35   ` Christoph Hellwig
2020-04-30 20:38 ` [PATCH V1 02/10] arch/xtensa: Move kmap build bug out of the way ira.weiny
2020-05-01  8:36   ` Christoph Hellwig
2020-04-30 20:38 ` [PATCH V1 03/10] arch/kmap: Remove redundant arch specific kmaps ira.weiny
2020-05-01  8:37   ` Christoph Hellwig
2020-04-30 20:38 ` [PATCH V1 04/10] arch/kunmap: Remove duplicate kunmap implementations ira.weiny
2020-05-01  8:38   ` Christoph Hellwig
2020-04-30 20:38 ` [PATCH V1 05/10] arch/kmap_atomic: Consolidate duplicate code ira.weiny
2020-05-01  2:09   ` Al Viro
2020-05-01  8:39   ` Christoph Hellwig
2020-04-30 20:38 ` [PATCH V1 06/10] arch/kunmap_atomic: " ira.weiny
2020-05-01  8:39   ` Christoph Hellwig
2020-04-30 20:38 ` [PATCH V1 07/10] arch/kmap: Ensure kmap_prot visibility ira.weiny
2020-05-01  8:44   ` sparc-related comment, to " Christoph Hellwig
2020-05-01 15:35     ` Ira Weiny
2020-04-30 20:38 ` [PATCH V1 08/10] arch/kmap: Don't hard code kmap_prot values ira.weiny
2020-05-01  2:16   ` Al Viro
2020-05-01  8:47   ` Christoph Hellwig
2020-04-30 20:38 ` [PATCH V1 09/10] arch/kmap: Define kmap_atomic_prot() for all arch's ira.weiny
2020-05-01  2:37   ` Al Viro
2020-05-01  3:20     ` Al Viro
2020-05-03  3:11       ` Ira Weiny
2020-05-01  8:48   ` Christoph Hellwig
2020-04-30 20:38 ` [PATCH V1 10/10] drm: Remove drm specific kmap_atomic code ira.weiny
2020-05-01  7:23   ` Christian König [this message]
2020-05-01  8:49   ` Christoph Hellwig
2020-05-01  2:29 ` [PATCH V1 00/10] Remove duplicated kmap code Michael Ellerman
2020-05-01  8:54 ` Christoph Hellwig
2020-05-01 17:18   ` Ira Weiny

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=d6d5ab74-5e16-6541-391b-63d993041fb8@amd.com \
    --to=christian.koenig@amd.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=bp@alien8.de \
    --cc=chris@zankel.net \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hpa@zytor.com \
    --cc=ira.weiny@intel.com \
    --cc=jcmvbkbc@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-csky@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=linux-xtensa@linux-xtensa.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=ray.huang@amd.com \
    --cc=sparclinux@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tsbogend@alpha.franken.de \
    --cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).