mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] video: bochs: fix IOMEM usage
@ 2023-05-11 12:47 Denis Orlov
  2023-05-11 12:50 ` Ahmad Fatoum
  2023-05-12 11:15 ` Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Denis Orlov @ 2023-05-11 12:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum, Denis Orlov

For the PCI version of the driver, we end up calling IOMEM() twice on
both the fb_map and mmio pointers. This happens because we first use
pci_iomap() on PCI resources in the bochs_pci_probe() and then
explicitly call IOMEM() in the bochs_hw_probe(). However, judging from
the parameters of the latter function having __iomem attributes, we
should not be remapping them. So, remove those IOMEM calls and instead
do explicit remapping in bochs_isa_detect(), which was missing it.

Also fix bochs_hw_probe() declaration missing one __iomem.

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 drivers/video/bochs/bochs_hw.c  | 4 ++--
 drivers/video/bochs/bochs_hw.h  | 2 +-
 drivers/video/bochs/bochs_isa.c | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/video/bochs/bochs_hw.c b/drivers/video/bochs/bochs_hw.c
index f31020acd4..48de5ea0bd 100644
--- a/drivers/video/bochs/bochs_hw.c
+++ b/drivers/video/bochs/bochs_hw.c
@@ -158,8 +158,8 @@ int bochs_hw_probe(struct device *dev, void __iomem *fb_map,
 
 	bochs = xzalloc(sizeof(*bochs));
 
-	bochs->fb_map	= IOMEM(fb_map);
-	bochs->mmio	= IOMEM(mmio);
+	bochs->fb_map	= fb_map;
+	bochs->mmio	= mmio;
 
 	ret = bochs_hw_read_version(bochs);
 	if (ret < 0) {
diff --git a/drivers/video/bochs/bochs_hw.h b/drivers/video/bochs/bochs_hw.h
index e01ef13d47..c721113656 100644
--- a/drivers/video/bochs/bochs_hw.h
+++ b/drivers/video/bochs/bochs_hw.h
@@ -10,6 +10,6 @@
 
 struct device;
 
-int bochs_hw_probe(struct device *dev, void *fb_map, void __iomem *mmio);
+int bochs_hw_probe(struct device *dev, void __iomem *fb_map, void __iomem *mmio);
 
 #endif
diff --git a/drivers/video/bochs/bochs_isa.c b/drivers/video/bochs/bochs_isa.c
index 3cedb5c345..50fdecd9c8 100644
--- a/drivers/video/bochs/bochs_isa.c
+++ b/drivers/video/bochs/bochs_isa.c
@@ -26,6 +26,6 @@ static int bochs_isa_detect(void)
 	if (ret)
 		return ret;
 
-	return bochs_hw_probe(dev, (void *)0xe0000000, NULL);
+	return bochs_hw_probe(dev, IOMEM(0xe0000000), NULL);
 }
 device_initcall(bochs_isa_detect);
-- 
2.30.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] video: bochs: fix IOMEM usage
  2023-05-11 12:47 [PATCH] video: bochs: fix IOMEM usage Denis Orlov
@ 2023-05-11 12:50 ` Ahmad Fatoum
  2023-05-12 11:15 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2023-05-11 12:50 UTC (permalink / raw)
  To: Denis Orlov, barebox

On 11.05.23 14:47, Denis Orlov wrote:
> For the PCI version of the driver, we end up calling IOMEM() twice on
> both the fb_map and mmio pointers. This happens because we first use
> pci_iomap() on PCI resources in the bochs_pci_probe() and then
> explicitly call IOMEM() in the bochs_hw_probe(). However, judging from
> the parameters of the latter function having __iomem attributes, we
> should not be remapping them. So, remove those IOMEM calls and instead
> do explicit remapping in bochs_isa_detect(), which was missing it.
> 
> Also fix bochs_hw_probe() declaration missing one __iomem.
> 
> Signed-off-by: Denis Orlov <denorl2009@gmail.com>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

Thanks!
Ahmad

> ---
>  drivers/video/bochs/bochs_hw.c  | 4 ++--
>  drivers/video/bochs/bochs_hw.h  | 2 +-
>  drivers/video/bochs/bochs_isa.c | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/video/bochs/bochs_hw.c b/drivers/video/bochs/bochs_hw.c
> index f31020acd4..48de5ea0bd 100644
> --- a/drivers/video/bochs/bochs_hw.c
> +++ b/drivers/video/bochs/bochs_hw.c
> @@ -158,8 +158,8 @@ int bochs_hw_probe(struct device *dev, void __iomem *fb_map,
>  
>  	bochs = xzalloc(sizeof(*bochs));
>  
> -	bochs->fb_map	= IOMEM(fb_map);
> -	bochs->mmio	= IOMEM(mmio);
> +	bochs->fb_map	= fb_map;
> +	bochs->mmio	= mmio;
>  
>  	ret = bochs_hw_read_version(bochs);
>  	if (ret < 0) {
> diff --git a/drivers/video/bochs/bochs_hw.h b/drivers/video/bochs/bochs_hw.h
> index e01ef13d47..c721113656 100644
> --- a/drivers/video/bochs/bochs_hw.h
> +++ b/drivers/video/bochs/bochs_hw.h
> @@ -10,6 +10,6 @@
>  
>  struct device;
>  
> -int bochs_hw_probe(struct device *dev, void *fb_map, void __iomem *mmio);
> +int bochs_hw_probe(struct device *dev, void __iomem *fb_map, void __iomem *mmio);
>  
>  #endif
> diff --git a/drivers/video/bochs/bochs_isa.c b/drivers/video/bochs/bochs_isa.c
> index 3cedb5c345..50fdecd9c8 100644
> --- a/drivers/video/bochs/bochs_isa.c
> +++ b/drivers/video/bochs/bochs_isa.c
> @@ -26,6 +26,6 @@ static int bochs_isa_detect(void)
>  	if (ret)
>  		return ret;
>  
> -	return bochs_hw_probe(dev, (void *)0xe0000000, NULL);
> +	return bochs_hw_probe(dev, IOMEM(0xe0000000), NULL);
>  }
>  device_initcall(bochs_isa_detect);

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] video: bochs: fix IOMEM usage
  2023-05-11 12:47 [PATCH] video: bochs: fix IOMEM usage Denis Orlov
  2023-05-11 12:50 ` Ahmad Fatoum
@ 2023-05-12 11:15 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2023-05-12 11:15 UTC (permalink / raw)
  To: Denis Orlov; +Cc: barebox, Ahmad Fatoum

On Thu, May 11, 2023 at 03:47:43PM +0300, Denis Orlov wrote:
> For the PCI version of the driver, we end up calling IOMEM() twice on
> both the fb_map and mmio pointers. This happens because we first use
> pci_iomap() on PCI resources in the bochs_pci_probe() and then
> explicitly call IOMEM() in the bochs_hw_probe(). However, judging from
> the parameters of the latter function having __iomem attributes, we
> should not be remapping them. So, remove those IOMEM calls and instead
> do explicit remapping in bochs_isa_detect(), which was missing it.
> 
> Also fix bochs_hw_probe() declaration missing one __iomem.
> 
> Signed-off-by: Denis Orlov <denorl2009@gmail.com>
> ---
>  drivers/video/bochs/bochs_hw.c  | 4 ++--
>  drivers/video/bochs/bochs_hw.h  | 2 +-
>  drivers/video/bochs/bochs_isa.c | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/video/bochs/bochs_hw.c b/drivers/video/bochs/bochs_hw.c
> index f31020acd4..48de5ea0bd 100644
> --- a/drivers/video/bochs/bochs_hw.c
> +++ b/drivers/video/bochs/bochs_hw.c
> @@ -158,8 +158,8 @@ int bochs_hw_probe(struct device *dev, void __iomem *fb_map,
>  
>  	bochs = xzalloc(sizeof(*bochs));
>  
> -	bochs->fb_map	= IOMEM(fb_map);
> -	bochs->mmio	= IOMEM(mmio);
> +	bochs->fb_map	= fb_map;
> +	bochs->mmio	= mmio;
>  
>  	ret = bochs_hw_read_version(bochs);
>  	if (ret < 0) {
> diff --git a/drivers/video/bochs/bochs_hw.h b/drivers/video/bochs/bochs_hw.h
> index e01ef13d47..c721113656 100644
> --- a/drivers/video/bochs/bochs_hw.h
> +++ b/drivers/video/bochs/bochs_hw.h
> @@ -10,6 +10,6 @@
>  
>  struct device;
>  
> -int bochs_hw_probe(struct device *dev, void *fb_map, void __iomem *mmio);
> +int bochs_hw_probe(struct device *dev, void __iomem *fb_map, void __iomem *mmio);
>  
>  #endif
> diff --git a/drivers/video/bochs/bochs_isa.c b/drivers/video/bochs/bochs_isa.c
> index 3cedb5c345..50fdecd9c8 100644
> --- a/drivers/video/bochs/bochs_isa.c
> +++ b/drivers/video/bochs/bochs_isa.c
> @@ -26,6 +26,6 @@ static int bochs_isa_detect(void)
>  	if (ret)
>  		return ret;
>  
> -	return bochs_hw_probe(dev, (void *)0xe0000000, NULL);
> +	return bochs_hw_probe(dev, IOMEM(0xe0000000), NULL);
>  }
>  device_initcall(bochs_isa_detect);
> -- 
> 2.30.2
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-05-12 11:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-11 12:47 [PATCH] video: bochs: fix IOMEM usage Denis Orlov
2023-05-11 12:50 ` Ahmad Fatoum
2023-05-12 11:15 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox