Skip to content

Commit 8d76a7d

Browse files
arndbThomas Gleixner
authored andcommitted
irqchip/gic-v3-its: Avoid truncating memory addresses
On 32-bit machines with CONFIG_ARM_LPAE, it is possible for lowmem allocations to be backed by addresses physical memory above the 32-bit address limit, as found while experimenting with larger VMSPLIT configurations. This caused the qemu virt model to crash in the GICv3 driver, which allocates the 'itt' object using GFP_KERNEL. Since all memory below the 4GB physical address limit is in ZONE_DMA in this configuration, kmalloc() defaults to higher addresses for ZONE_NORMAL, and the ITS driver stores the physical address in a 32-bit 'unsigned long' variable. Change the itt_addr variable to the correct phys_addr_t type instead, along with all other variables in this driver that hold a physical address. The gicv5 driver correctly uses u64 variables, while all other irqchip drivers don't call virt_to_phys or similar interfaces. It's expected that other device drivers have similar issues, but fixing this one is sufficient for booting a virtio based guest. Fixes: cc2d321 ("irqchip: GICv3: ITS command queue") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Reviewed-by: Marc Zyngier <maz@kernel.org> Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260119201603.2713066-1-arnd@kernel.org
1 parent cd4a3ce commit 8d76a7d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/irqchip/irq-gic-v3-its.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ static struct its_collection *its_build_mapd_cmd(struct its_node *its,
709709
struct its_cmd_block *cmd,
710710
struct its_cmd_desc *desc)
711711
{
712-
unsigned long itt_addr;
712+
phys_addr_t itt_addr;
713713
u8 size = ilog2(desc->its_mapd_cmd.dev->nr_ites);
714714

715715
itt_addr = virt_to_phys(desc->its_mapd_cmd.dev->itt);
@@ -879,7 +879,7 @@ static struct its_vpe *its_build_vmapp_cmd(struct its_node *its,
879879
struct its_cmd_desc *desc)
880880
{
881881
struct its_vpe *vpe = valid_vpe(its, desc->its_vmapp_cmd.vpe);
882-
unsigned long vpt_addr, vconf_addr;
882+
phys_addr_t vpt_addr, vconf_addr;
883883
u64 target;
884884
bool alloc;
885885

@@ -2477,10 +2477,10 @@ static int its_setup_baser(struct its_node *its, struct its_baser *baser,
24772477
baser->psz = psz;
24782478
tmp = indirect ? GITS_LVL1_ENTRY_SIZE : esz;
24792479

2480-
pr_info("ITS@%pa: allocated %d %s @%lx (%s, esz %d, psz %dK, shr %d)\n",
2480+
pr_info("ITS@%pa: allocated %d %s @%llx (%s, esz %d, psz %dK, shr %d)\n",
24812481
&its->phys_base, (int)(PAGE_ORDER_TO_SIZE(order) / (int)tmp),
24822482
its_base_type_string[type],
2483-
(unsigned long)virt_to_phys(base),
2483+
(u64)virt_to_phys(base),
24842484
indirect ? "indirect" : "flat", (int)esz,
24852485
psz / SZ_1K, (int)shr >> GITS_BASER_SHAREABILITY_SHIFT);
24862486

0 commit comments

Comments
 (0)