All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen: xenguest_arm64: map all VIRTIO MMIO region
@ 2024-01-26 10:29 Peng Fan (OSS)
  2024-03-04 15:26 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Peng Fan (OSS) @ 2024-01-26 10:29 UTC (permalink / raw)
  To: anastasiia_lukianenko, oleksandr_andrushchenko, trini
  Cc: u-boot, elven.wang, Peng Fan

From: Peng Fan <peng.fan@nxp.com>

When run `virtio scan` on i.MX95, there is abort when accessing virtio
mmio region. The issue is the mmio region is not mapped. So let's map
all virtio mmio regions.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 board/xen/xenguest_arm64/xenguest_arm64.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/board/xen/xenguest_arm64/xenguest_arm64.c b/board/xen/xenguest_arm64/xenguest_arm64.c
index 244070a242d..1d2946f4fde 100644
--- a/board/xen/xenguest_arm64/xenguest_arm64.c
+++ b/board/xen/xenguest_arm64/xenguest_arm64.c
@@ -31,6 +31,9 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#define GUEST_VIRTIO_MMIO_BASE	0x2000000
+#define GUEST_VIRTIO_MMIO_SIZE	0x100000
+
 int board_init(void)
 {
 	return 0;
@@ -212,6 +215,15 @@ static int setup_mem_map(void)
 				PTE_BLOCK_INNER_SHARE);
 	i++;
 
+	if (CONFIG_IS_ENABLED(VIRTIO_MMIO)) {
+		xen_mem_map[i].virt = GUEST_VIRTIO_MMIO_BASE;
+		xen_mem_map[i].phys = GUEST_VIRTIO_MMIO_BASE;
+		xen_mem_map[i].size = GUEST_VIRTIO_MMIO_SIZE;
+		xen_mem_map[i].attrs = (PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+					PTE_BLOCK_NON_SHARE);
+		i++;
+	}
+
 	mem = get_next_memory_node(blob, -1);
 	if (mem < 0) {
 		printf("%s: Missing /memory node\n", __func__);
@@ -219,6 +231,11 @@ static int setup_mem_map(void)
 	}
 
 	for (; i < MAX_MEM_MAP_REGIONS; i++) {
+		if (CONFIG_IS_ENABLED(VIRTIO_MMIO)) {
+			ret = fdt_node_check_compatible(blob, mem, "virtio,mmio");
+			if (!ret)
+				continue;
+		}
 		ret = fdt_get_resource(blob, mem, "reg", reg++, &res);
 		if (ret == -FDT_ERR_NOTFOUND) {
 			reg = 0;
-- 
2.35.3


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

* Re: [PATCH] xen: xenguest_arm64: map all VIRTIO MMIO region
  2024-01-26 10:29 [PATCH] xen: xenguest_arm64: map all VIRTIO MMIO region Peng Fan (OSS)
@ 2024-03-04 15:26 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2024-03-04 15:26 UTC (permalink / raw)
  To: Peng Fan (OSS)
  Cc: anastasiia_lukianenko, oleksandr_andrushchenko, u-boot,
	elven.wang, Peng Fan

[-- Attachment #1: Type: text/plain, Size: 380 bytes --]

On Fri, Jan 26, 2024 at 06:29:38PM +0800, Peng Fan (OSS) wrote:

> From: Peng Fan <peng.fan@nxp.com>
> 
> When run `virtio scan` on i.MX95, there is abort when accessing virtio
> mmio region. The issue is the mmio region is not mapped. So let's map
> all virtio mmio regions.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>

Applied to u-boot/next, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

end of thread, other threads:[~2024-03-04 15:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-26 10:29 [PATCH] xen: xenguest_arm64: map all VIRTIO MMIO region Peng Fan (OSS)
2024-03-04 15:26 ` Tom Rini

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.