[PATCH v9 13/25] iommu/arm-smmu-v3-kvm: Add MMIO emulation

Mostafa Saleh smostafa at google.com
Mon Nov 9 03:06:09 PST 2026


On Fri, Nov 06, 2026 at 11:56:34AM -0800, Nicolin Chen wrote:
> On Thu, Oct 15, 2026 at 08:08:44PM +0000, Mostafa Saleh wrote:
> > +static bool smmu_dabt_handler(struct user_pt_regs *regs, u64 esr, u64 addr)
> > +{
> > +	struct hyp_arm_smmu_v3_device *smmu;
> > +	bool ret;
> > +
> > +	for_each_smmu(smmu) {
> > +		if (addr < smmu->mmio_addr || addr >= smmu->mmio_addr + smmu->mmio_size)
> > +			continue;
> > +		hyp_spin_lock(&smmu->lock);
> > +		ret = smmu_dabt_device(smmu, regs, esr, addr - smmu->mmio_addr);
> 
> Going through the followup patches, I found this smmu_dabt_device
> gets really too big. Perhaps it can be bisect to read and write at
> least? Something like:
> 
> static bool smmu_mmio_handler(smmu, regs, esr, off)
> {
>         /* decode ESR: len, rd, xzr; width check */
>         if (is_write)
>                 return smmu_mmio_write_handler(smmu, off, len, val);
>         val = smmu_mmio_read_handler(smmu, off, len);
>         if (!is_xzr)
>                 regs->regs[rd] = val;
>         return true;
> }

Yes, I was wondering about the size of the dabt handler also.
I will try this, but that will propably won't cut the size in half.

Thanks,
Mostafa

> 
> Nicolin



More information about the linux-arm-kernel mailing list