[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] iommu/amd-vi: do not zero IOMMU MMIO region


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Wed, 6 May 2026 10:43:49 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IVycNhysnM8nwy+SogsZNGtqJ7e7RtPw7shbmTH/Jg0=; b=fLhQmQE1VQ04pGOWn+kzHvaxt32Hp4uP1PIWSMCejSs1kIDExJscobE3jjOxsG1obGhf8My9+mFkNncOTGok8q2tUhVrtsaXa9oPXjBUUepXvgqyAQhfgSipQwk3CqokiA07SLsAK44avDDmDI2UNCarFP1/l4MkBTcRAwruIz8asefS2GwPt0AXZ0YRAozy1X0Gyfv3iFfea7wkDgzcu9eU+rljFw2FmnfF8xyKmbce9KLYT7gOzXQqA9OrK+ob6N+XxVe16Y812Yg95YzuYVABTceLAquyPxlfGAzsEe9o6JGo6aOrPl2QYHHm5zkVKLVWlVlKVLWAJyRSb5gCaw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UivV2WaywKOs1JW7XFbrXEObPuSHZSR2pwni7EkYyEUKh8vhvaStpWGrsEQyxlLucjDMIYtb7WcXtL3PenV84FO6l2XZVexBod5rQifPkDE8M3rFTg0NWBu2fvUdjlAYMFUc3lx7P+KxKNySA5eUZI1gVyMj0JDtMmMRx1nP/hHAx3gEr8+ZMfplN8YTbOtbufT/LaQXkrgEZ/6obzaPh5+RrUAZ61aT2xE5R7U+EwMeN9PxjUfq8qSmvhq7rrbpbCp5g193OnrTPhhfu/BaUoxXDvHquF0ssTL9AHWxiKTQ/iLxmwHASOSvxhEUU5hqBZvNlwXL8z+nHeQ8qnrxMw==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jason Andryuk <jason.andryuk@xxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 06 May 2026 08:43:59 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, May 06, 2026 at 10:28:52AM +0200, Jan Beulich wrote:
> On 06.05.2026 09:37, Roger Pau Monne wrote:
> > @@ -1381,6 +1372,11 @@ static int __init amd_iommu_prepare_one(struct 
> > amd_iommu *iommu)
> >      if ( amd_iommu_max_paging_mode < amd_iommu_min_paging_mode )
> >          return -ERANGE;
> >  
> > +    /* Read current control register and forcefully disable the IOMMU. */
> > +    iommu->ctrl.raw = readq(iommu->mmio_base + IOMMU_CONTROL_MMIO_OFFSET);
> > +    disable_iommu(iommu, true);
> 
> Don't you also need to pre-fill iommu->features?

Indeed, that's done just ahead of this chunk, in the
get_iommu_features() call.

> And with that field's use in
> disable_iommu(), won't we be at risk of leaving stuff enabled which we are
> entirely unaware of?

Possibly, yes, that's always a risk.

> Even if we fully cleared the control register (which
> would eliminate the need to fetch features), down the road a 2nd control
> register could appear.

We do clear the control register, it's indirectly done by us setting
iommu->ctrl.raw = 0 after the disable_iommu() call.

I did wonder about just doing a write of 0 to the control register,
but I think it's best if we try to gracefully disable the features (as
done in disable_iommu()), and then reset the cached control state to
0.  Future writes to the control register will clear any bits not
directly set by Xen.

> Has it become clear which register(s) or bit(s) it
> really is that are causing the observed issue? IOW is there truly something
> we may not clear?

It's not so much as not clearing something, but rather the clearing
itself putting the IOMMU in a broken state which we then can't recover
from using the initialization procedure in Xen.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.