Re: [PATCH v9 14/25] iommu/arm-smmu-v3-kvm: Shadow the command queue
From: Nicolin Chen
Date: Thu Nov 05 2026 - 21:00:21 EST
One more thing:
On Thu, Oct 15, 2026 at 08:08:45PM +0000, Mostafa Saleh wrote:
> +/*
> + * The kernel part of the driver allocates and zeroes the shadow cmdq. Take
> + * ownership of it and program it into the hardware.
> + */
> +static int smmu_init_cmdq(struct hyp_arm_smmu_v3_device *smmu)
> +{
> + size_t cmdq_nr_pages;
> + int ret;
> +
> + smmu->cmdq.llq.max_n_shift = min(smmu->cmdq.llq.max_n_shift, smmu->cmdq_max_shift);
Given this is the cmdq used to run commands eventually..
> +static void smmu_emulate_cmdq_enable(struct hyp_arm_smmu_v3_device *smmu)
> +{
> + u32 shift = smmu->cmdq_host.q_base & Q_BASE_LOG2SIZE;
> +
> + smmu->cmdq_host.llq.max_n_shift = min(shift, smmu->cmdq_max_shift);
.. should this be min(shift, smmu->cmdq.llq.max_n_shift)?
Otherwise, a buggy guest SW might setup a larger queue and number
of commands?
Nicolin