mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master 1/2] virtio: pci: fix 64-bit incompatibility
@ 2021-04-10 10:49 Ahmad Fatoum
  2021-04-10 10:49 ` [PATCH master 2/2] virtio: pci: remove inaccurate comment on 64-bit bar addr incompatibility Ahmad Fatoum
  2021-04-13  7:19 ` [PATCH master 1/2] virtio: pci: fix 64-bit incompatibility Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2021-04-10 10:49 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

device_len is size_t, but written by pci_read_config_dword as a u32.
Change the type to fix this.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 drivers/virtio/virtio_pci_common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/virtio/virtio_pci_common.h b/drivers/virtio/virtio_pci_common.h
index 32f0f451ab49..8f97d1218838 100644
--- a/drivers/virtio/virtio_pci_common.h
+++ b/drivers/virtio/virtio_pci_common.h
@@ -47,7 +47,7 @@ struct virtio_pci_device {
 	void __iomem *notify_base;
 
 	/* So we can sanity-check accesses. */
-	size_t device_len;
+	u32 device_len;
 
 	/* Multiply queue_notify_off by this value. (non-legacy mode). */
 	u32 notify_offset_multiplier;
-- 
2.30.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* [PATCH master 2/2] virtio: pci: remove inaccurate comment on 64-bit bar addr incompatibility
  2021-04-10 10:49 [PATCH master 1/2] virtio: pci: fix 64-bit incompatibility Ahmad Fatoum
@ 2021-04-10 10:49 ` Ahmad Fatoum
  2021-04-13  7:19 ` [PATCH master 1/2] virtio: pci: fix 64-bit incompatibility Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2021-04-10 10:49 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

pci_iomap returns the bar base address, which can already be > 4G on
barebox. The comment originates from U-Boot, where indeed only the lower
32-bit are read. We don't have this limitation and qemu -M q35 places
bars for VirtIO devices at >= 0x8_0000_0000 and they worked correctly,
so drop the inaccurate comment.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 drivers/virtio/virtio_pci_modern.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c
index 180c14771aad..d828bee69e62 100644
--- a/drivers/virtio/virtio_pci_modern.c
+++ b/drivers/virtio/virtio_pci_modern.c
@@ -335,13 +335,6 @@ static void __iomem *virtio_pci_map_capability(struct pci_dev *dev, int off)
 	offset = off + offsetof(struct virtio_pci_cap, offset);
 	pci_read_config_dword(dev, offset, &offset);
 
-	/*
-	 * TODO: adding 64-bit BAR support
-	 *
-	 * Per spec, the BAR is permitted to be either 32-bit or 64-bit.
-	 * For simplicity, only read the BAR address as 32-bit.
-	 */
-
         return pci_iomap(dev, bar) + offset;
 }
 
-- 
2.30.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* Re: [PATCH master 1/2] virtio: pci: fix 64-bit incompatibility
  2021-04-10 10:49 [PATCH master 1/2] virtio: pci: fix 64-bit incompatibility Ahmad Fatoum
  2021-04-10 10:49 ` [PATCH master 2/2] virtio: pci: remove inaccurate comment on 64-bit bar addr incompatibility Ahmad Fatoum
@ 2021-04-13  7:19 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2021-04-13  7:19 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Sat, Apr 10, 2021 at 12:49:10PM +0200, Ahmad Fatoum wrote:
> device_len is size_t, but written by pci_read_config_dword as a u32.
> Change the type to fix this.
> 
> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> ---
>  drivers/virtio/virtio_pci_common.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/virtio/virtio_pci_common.h b/drivers/virtio/virtio_pci_common.h
> index 32f0f451ab49..8f97d1218838 100644
> --- a/drivers/virtio/virtio_pci_common.h
> +++ b/drivers/virtio/virtio_pci_common.h
> @@ -47,7 +47,7 @@ struct virtio_pci_device {
>  	void __iomem *notify_base;
>  
>  	/* So we can sanity-check accesses. */
> -	size_t device_len;
> +	u32 device_len;
>  
>  	/* Multiply queue_notify_off by this value. (non-legacy mode). */
>  	u32 notify_offset_multiplier;
> -- 
> 2.30.0
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

end of thread, other threads:[~2021-04-13  7:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-10 10:49 [PATCH master 1/2] virtio: pci: fix 64-bit incompatibility Ahmad Fatoum
2021-04-10 10:49 ` [PATCH master 2/2] virtio: pci: remove inaccurate comment on 64-bit bar addr incompatibility Ahmad Fatoum
2021-04-13  7:19 ` [PATCH master 1/2] virtio: pci: fix 64-bit incompatibility Sascha Hauer

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