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

Re: [PATCH v2 5/5] amd/iommu: force atomic updates of remapping entries


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 19 Jul 2023 14:46:49 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=1PpEtTjchqtIXbj5lvrqIxEFaxj/Cyma1XqXDqeY4cU=; b=ju9ZPC7UOPtiniEYWBIvD83RK++BgBLL5VTMjNzCjv2d+FhvgHhG3kmKmHvgS+nUjmyxqQtBiPwoZ4CE0/w73TGuIOFMgFWQLdSPhXmN0BOQDJ43ggAGrJ/1NjyIHeyt7gPNoJsVAPHn6xP8aaYvxxllaO1eXLjTl67RFoKpkZwSTQFcPwXNpkJEt6RD9vVusT9Z8tUgJ1tQASKL2lcC48nwq7g6QSz9g8/N9BaNi4LiHog5AwSgLPv+1PX2Y5wIun8TQmsS+fW6W6QMgxMxAaDgGEzoEXNSPyYrSlqTAhez3JofTAfkN6hbTNAkh1QAqCDrHLTHald8atsiCJOqyg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SmMLyQcU38SzjlVAtp//jkyfegLwA3vVQOubYrNIyaM/q7LT43afezovQLiAt9Jdm9C/A6VZJ9sH7GwzIvOQs+COguOEsmzzqJb7WMiJm5G4/9bNfzngmqelK6Tgn3UQHjSCS9rdYxiYku/mQa1p523Tw9PQcvA6luIMtewLYXTb/xQTUA30LthPVpKMlcV2DYaksqA90pBgdPoViT5zK/rDZt3xSxh2Dxkr9LYh5TJs5GHJCr/gdwIilVaMMhBHOcm+q7DW4aGQNcFyRDVIXNxDbR6LdhmAYkUcZT2KoTCcFouhjVDrqV6gjuOfn+2ko6BlEi4skjo7JsRdVTXWrg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 19 Jul 2023 12:47:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 18.07.2023 14:43, Roger Pau Monne wrote:
> Disable XT (x2APIC) support and thus 128 IRTE entries if cmpxchg16b is
> not available, do so in order to avoid having to disable the IRTE (and
> possibly loose interrupts) when updating the entry.  Note this also
> removes the usage of a while loop in order to disable the entry, since
> RemapEn is no longer toggled when updating.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> ---
> x2APIC support was added late enough on AMD that CPUs that I believe
> all models that have x2APIC must also have CX16.
> 
> The AMD-Vi manual contains the following advice in the "2.3.2 Making
> Guest Interrupt Virtualization Changes" section:
> 
> """
> If RemapEn=1 before the change, the following steps may be followed to
> change interrupt virtualization information:
>  * Set RemapEn=0 in the entry to disable interrupt virtualization;
>    device-initiated interrupt requests for the DeviceID and vector are
>    processed as IO_PAGE_FAULT events.
>  * Update the fields in the IRTE and invalidate the interrupt table
>    (see Section 2.4.5 [INVALIDATE_INTERRUPT_TABLE]).
>  * Set RemapEn=1 to virtualize interrupts from the device.
> """
> 
> However if the update of the IRTE is done atomically I assume that
> setting RemapEn=0 is not longer necessary, and that the
> INVALIDATE_INTERRUPT_TABLE command can be executed after the entry has
> been (atomically) updated.

There's one additional prereq to this: The IOMMU also needs to read
128-bit IRTEs atomically. I'm afraid we can't take this for given
without it being said explicitly in the spec (I've just gone through
and looked at all occurrences of "atomic", without finding anything
applicable to IRTEs). If this can be resolved, I think I'm fine with
the patch.

Jan



 


Rackspace

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