* [PATCH] staging: media: atomisp: Use kmap_local_page() in hmm_set()
@ 2022-04-13 21:22 Fabio M. De Francesco
2022-04-13 22:24 ` Ira Weiny
2022-04-20 11:07 ` Hans de Goede
0 siblings, 2 replies; 3+ messages in thread
From: Fabio M. De Francesco @ 2022-04-13 21:22 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman,
Hans Verkuil, Tsuchiya Yuto, Martiros Shakhzadyan, Hans de Goede,
linux-media, linux-staging, linux-kernel, Ira Weiny, outreachy
Cc: Fabio M. De Francesco
The use of kmap() is being deprecated in favor of kmap_local_page()
where it is feasible. In file pci/hmm/hmm.c, function hmm_set() calls
kmap() / kunmap() where kmap_local_page() can instead do the mapping.
With kmap_local_page(), the mapping is per thread, CPU local and not
globally visible. Therefore, hmm_set()() is a function where the use
of kmap_local_page() in place of kmap() is correctly suited.
Convert the calls of kmap() / kunmap() to kmap_local_page() /
kunmap_local().
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
---
drivers/staging/media/atomisp/pci/hmm/hmm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm.c b/drivers/staging/media/atomisp/pci/hmm/hmm.c
index 6394385b6637..46ac082cd3f1 100644
--- a/drivers/staging/media/atomisp/pci/hmm/hmm.c
+++ b/drivers/staging/media/atomisp/pci/hmm/hmm.c
@@ -563,7 +563,7 @@ int hmm_set(ia_css_ptr virt, int c, unsigned int bytes)
idx = (virt - bo->start) >> PAGE_SHIFT;
offset = (virt - bo->start) - (idx << PAGE_SHIFT);
- des = (char *)kmap(bo->page_obj[idx].page) + offset;
+ des = (char *)kmap_local_page(bo->page_obj[idx].page) + offset;
if ((bytes + offset) >= PAGE_SIZE) {
len = PAGE_SIZE - offset;
@@ -579,7 +579,7 @@ int hmm_set(ia_css_ptr virt, int c, unsigned int bytes)
clflush_cache_range(des, len);
- kunmap(bo->page_obj[idx].page);
+ kunmap_local(des);
}
return 0;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: media: atomisp: Use kmap_local_page() in hmm_set()
2022-04-13 21:22 [PATCH] staging: media: atomisp: Use kmap_local_page() in hmm_set() Fabio M. De Francesco
@ 2022-04-13 22:24 ` Ira Weiny
2022-04-20 11:07 ` Hans de Goede
1 sibling, 0 replies; 3+ messages in thread
From: Ira Weiny @ 2022-04-13 22:24 UTC (permalink / raw)
To: Fabio M. De Francesco
Cc: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman,
Hans Verkuil, Tsuchiya Yuto, Martiros Shakhzadyan, Hans de Goede,
linux-media, linux-staging, linux-kernel, outreachy
On Wed, Apr 13, 2022 at 11:22:10PM +0200, Fabio M. De Francesco wrote:
> The use of kmap() is being deprecated in favor of kmap_local_page()
> where it is feasible. In file pci/hmm/hmm.c, function hmm_set() calls
> kmap() / kunmap() where kmap_local_page() can instead do the mapping.
>
> With kmap_local_page(), the mapping is per thread, CPU local and not
> globally visible. Therefore, hmm_set()() is a function where the use
> of kmap_local_page() in place of kmap() is correctly suited.
>
> Convert the calls of kmap() / kunmap() to kmap_local_page() /
> kunmap_local().
>
> Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
> ---
> drivers/staging/media/atomisp/pci/hmm/hmm.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm.c b/drivers/staging/media/atomisp/pci/hmm/hmm.c
> index 6394385b6637..46ac082cd3f1 100644
> --- a/drivers/staging/media/atomisp/pci/hmm/hmm.c
> +++ b/drivers/staging/media/atomisp/pci/hmm/hmm.c
> @@ -563,7 +563,7 @@ int hmm_set(ia_css_ptr virt, int c, unsigned int bytes)
> idx = (virt - bo->start) >> PAGE_SHIFT;
> offset = (virt - bo->start) - (idx << PAGE_SHIFT);
>
> - des = (char *)kmap(bo->page_obj[idx].page) + offset;
> + des = (char *)kmap_local_page(bo->page_obj[idx].page) + offset;
>
> if ((bytes + offset) >= PAGE_SIZE) {
> len = PAGE_SIZE - offset;
> @@ -579,7 +579,7 @@ int hmm_set(ia_css_ptr virt, int c, unsigned int bytes)
>
> clflush_cache_range(des, len);
>
> - kunmap(bo->page_obj[idx].page);
> + kunmap_local(des);
> }
>
> return 0;
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: media: atomisp: Use kmap_local_page() in hmm_set()
2022-04-13 21:22 [PATCH] staging: media: atomisp: Use kmap_local_page() in hmm_set() Fabio M. De Francesco
2022-04-13 22:24 ` Ira Weiny
@ 2022-04-20 11:07 ` Hans de Goede
1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2022-04-20 11:07 UTC (permalink / raw)
To: Fabio M. De Francesco, Mauro Carvalho Chehab, Sakari Ailus,
Greg Kroah-Hartman, Hans Verkuil, Tsuchiya Yuto,
Martiros Shakhzadyan, linux-media, linux-staging, linux-kernel,
Ira Weiny, outreachy
Hi,
On 4/13/22 23:22, Fabio M. De Francesco wrote:
> The use of kmap() is being deprecated in favor of kmap_local_page()
> where it is feasible. In file pci/hmm/hmm.c, function hmm_set() calls
> kmap() / kunmap() where kmap_local_page() can instead do the mapping.
>
> With kmap_local_page(), the mapping is per thread, CPU local and not
> globally visible. Therefore, hmm_set()() is a function where the use
> of kmap_local_page() in place of kmap() is correctly suited.
>
> Convert the calls of kmap() / kunmap() to kmap_local_page() /
> kunmap_local().
>
> Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
I've successfully tested this on both the front and back cams
of a chuwi hi8 tablet:
Tested-by: Hans de Goede <hdegoede@redhat.com>
Regards,
Hans
> ---
> drivers/staging/media/atomisp/pci/hmm/hmm.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm.c b/drivers/staging/media/atomisp/pci/hmm/hmm.c
> index 6394385b6637..46ac082cd3f1 100644
> --- a/drivers/staging/media/atomisp/pci/hmm/hmm.c
> +++ b/drivers/staging/media/atomisp/pci/hmm/hmm.c
> @@ -563,7 +563,7 @@ int hmm_set(ia_css_ptr virt, int c, unsigned int bytes)
> idx = (virt - bo->start) >> PAGE_SHIFT;
> offset = (virt - bo->start) - (idx << PAGE_SHIFT);
>
> - des = (char *)kmap(bo->page_obj[idx].page) + offset;
> + des = (char *)kmap_local_page(bo->page_obj[idx].page) + offset;
>
> if ((bytes + offset) >= PAGE_SIZE) {
> len = PAGE_SIZE - offset;
> @@ -579,7 +579,7 @@ int hmm_set(ia_css_ptr virt, int c, unsigned int bytes)
>
> clflush_cache_range(des, len);
>
> - kunmap(bo->page_obj[idx].page);
> + kunmap_local(des);
> }
>
> return 0;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-20 11:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-13 21:22 [PATCH] staging: media: atomisp: Use kmap_local_page() in hmm_set() Fabio M. De Francesco
2022-04-13 22:24 ` Ira Weiny
2022-04-20 11:07 ` Hans de Goede
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).