[PATCH] hw/arm/virt: Use TAG_GRANULE when creating tag memory

Gustavo Romero posted 1 patch 1 week, 6 days ago
hw/arm/virt.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
[PATCH] hw/arm/virt: Use TAG_GRANULE when creating tag memory
Posted by Gustavo Romero 1 week, 6 days ago
Use TAG_GRANULE definition when creating the memory region where the
FEAT_MTE tags are stored.

Signed-off-by: Gustavo Romero <gromero@redhat.com>
---
 hw/arm/virt.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 9d192515d8..0d56197dac 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -2308,8 +2308,10 @@ static void create_tag_ram(MemoryRegion *tag_sysmem,
 {
     MemoryRegion *tagram = g_new(MemoryRegion, 1);
 
-    memory_region_init_ram(tagram, NULL, name, size / 32, &error_fatal);
-    memory_region_add_subregion(tag_sysmem, base / 32, tagram);
+    /* We store 2 granules in 1 byte. */
+    memory_region_init_ram(tagram, NULL, name, size / (2 * TAG_GRANULE),
+                           &error_fatal);
+    memory_region_add_subregion(tag_sysmem, base / (2 * TAG_GRANULE), tagram);
 }
 
 static void create_secure_ram(VirtMachineState *vms,
-- 
2.47.3
Re: [PATCH] hw/arm/virt: Use TAG_GRANULE when creating tag memory
Posted by Peter Maydell 1 week, 3 days ago
On Fri, 9 Oct 2026 at 13:16, Gustavo Romero <gromero@redhat.com> wrote:
>
> Use TAG_GRANULE definition when creating the memory region where the
> FEAT_MTE tags are stored.
>
> Signed-off-by: Gustavo Romero <gromero@redhat.com>
> ---
>  hw/arm/virt.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)



Applied to target-arm.next, thanks.

-- PMM
Re: [PATCH] hw/arm/virt: Use TAG_GRANULE when creating tag memory
Posted by Philippe Mathieu-Daudé 1 week, 6 days ago
On 9/10/26 14:15, Gustavo Romero wrote:
> Use TAG_GRANULE definition when creating the memory region where the
> FEAT_MTE tags are stored.
> 
> Signed-off-by: Gustavo Romero <gromero@redhat.com>
> ---
>   hw/arm/virt.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>