[PATCH v4 04/13] irqchip/gic-v3-its: Page-align ITT allocations in pKVM

From: Fuad Tabba

Date: Wed Nov 18 2026 - 10:21:05 EST


From: Bartłomiej Grzesik <bgrzesik@xxxxxxxxxx>

In a subsequent patch the host donates the pages of each device's ITT
to the hypervisor. A page the hypervisor already owns can't be donated
again, so the MAPD of a device whose ITT shares a page with another
device's would be rejected.

Round each ITT up to whole pages in protected mode. This costs up to a
page per MSI device, where several 256-byte ITTs would have shared one.
That's tens of pages on a phone and thousands on a server with thousands
of VFs.

Signed-off-by: Bartłomiej Grzesik <bgrzesik@xxxxxxxxxx>
Signed-off-by: Fuad Tabba <fuad.tabba@xxxxxxxxx>
---
drivers/irqchip/irq-gic-v3-its.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index c952c069f9373..bbfea565149bb 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -3493,6 +3493,9 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id,
nr_ites = max(2, nvecs);
sz = nr_ites * (FIELD_GET(GITS_TYPER_ITT_ENTRY_SIZE, its->typer) + 1);
sz = max(sz, ITS_ITT_ALIGN);
+ /* The hypervisor takes whole pages for each ITT. */
+ if (gic_is_protected_kvm())
+ sz = PAGE_ALIGN(sz);

itt = itt_alloc_pool(its->numa_node, sz);

--
2.47.3