arm_mpam: Switch to kvzmalloc_objs() for allocation of component cfg

Each component cfg is sized by the size of a per-PARTID multiplied by the
number of PARTIDs. On a platform sized to push the limits of the
specification, the allocation using kzalloc_objs() will consistently
fail. Change to use kvzmalloc_objs() so that large allocations fall back to
vmalloc() based allocations.

Fixes: 09b89d2a72 ("arm_mpam: Allow configuration to be applied and restored during cpu online")
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
Tested-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: James Morse <james.morse@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
This commit is contained in:
Ben Horgan 2026-09-17 15:56:16 +01:00 committed by James Morse
parent 1e105782a1
commit 046384f02b

View File

@ -157,7 +157,7 @@ static void mpam_free_garbage(void)
if (iter->pdev)
devm_kfree(&iter->pdev->dev, iter->to_free);
else
kfree(iter->to_free);
kvfree(iter->to_free);
}
}
@ -2698,7 +2698,7 @@ static int __allocate_component_cfg(struct mpam_component *comp)
if (comp->cfg)
return 0;
comp->cfg = kzalloc_objs(*comp->cfg, mpam_partid_max + 1);
comp->cfg = kvzalloc_objs(*comp->cfg, mpam_partid_max + 1);
if (!comp->cfg)
return -ENOMEM;