Re: [PATCH v2 13/13] KVM: arm64: Implement HVC interface for ITS emulation setup

From: Fuad Tabba

Date: Tue Sep 15 2026 - 14:05:20 EST


Hi Seb,

A couple of things on the wiring:

On Fri, Aug 07, 2026 at 04:43:23PM +0000, Sebastian Ene wrote:

[...]

> diff --git a/arch/arm64/kvm/pkvm.c b/arch/arm64/kvm/pkvm.c
[...]
> +#define ITS_PAGES (2UL)
> +
> +static int pkvm_init_its_emulation(phys_addr_t dev_addr, struct its_host_state *host)
> +{
> + size_t priv_state_sz = ITS_PAGES << PAGE_SHIFT;
[...]
> + priv_state = alloc_pages_exact(priv_state_sz, GFP_ATOMIC);

its_emulate_release_locks() runs this callback with its_lock and
its->lock held and IRQs off, so alloc_pages_exact() is under a raw
spinlock. On PREEMPT_RT the page allocator takes sleeping locks even
for GFP_ATOMIC, so this can't allocate under the raw spinlock. Could
priv_state be allocated before the locks are taken and passed in?
(Sashiko)

> + ret = kvm_call_hyp_nvhe(__pkvm_its_emulate_setup, dev_addr, host, priv_state, ITS_PAGES);

ITS_PAGES is a fixed 2, and num_tracked_entries in
pkvm_its_emulate_setup derives from it, so the emulation can track
about 500 ITT pages total (dte_entry is 16 bytes). Each MAPD pins its
ITT pages into that table, so a system with enough MSI devices runs
track_pfn_add out of slots, gets -ENOSPC, and the queue stalls. Could
the private-state size scale with the ITS's table sizes rather than a
fixed 2 pages?

Cheers,
/fuad