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

[PATCH] iommu/amd-vi: avoid pointless flushes in invalidate_all_domain_pages()


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Fri, 7 Jul 2023 15:59:15 +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=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=gauybQdT91IQj1nb0helNPZvmZ3xxIn2FZDVAC7JLK0=; b=Ve3hD8ZpzvcMoo0TKAipfORBQqozuVsA4i4Td4lMxtRmCMbwTVmjpCxve9t4stiZwrl1c7vrwvjAQTLHJPaAdkg7ecU5G4k4iyPGgCe1LrADRG2ZTwZFz9Ponkvubvk/H96eAJHw/I2ekS7RQijb3nMEXfVex5y5W7RGUd08U1VlmGLrqoT4A+F2AOjBpW6d8VPcpjbgzbRpgA4Ialth+y4muUnhTsxm8VSwyJFqa3gJnizBFephqFy+yzGl+tMg2QKK8OKyp+KA4iGMbt/ULzHilrUkI96A82d1MrXxlTrxaYsSfJswG5MATcEHxrN57NUioJz1kROghR+xpEav2g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MMJ0Pjxuy7bQDEOuWZfG8QNft/LjhYJwlbcx0Aw/zfmGWiwuR15aQk7furwZKfOOBEvsSN6plgx4vJCPfM9vaVZnd/OQrVe1eS/zgqDv52RY+Oe176GYg72S7Xr7NauP9f8WHsCVNEAG+haPH6Mlr9MYQVS8IB4EpFdJFlVM7bB3q5+tjSoYhht+W3UtApkG8IZp4BuwTfN3LYLPLwxE2hfectEN3WJJqU2JKnmlfWBp5YCtKIpsuYz8UYtaFD4UJN1GqgutgQRfaTCVs2h9d9RXflzh1LadZf0ojXOHW1Uwuvr+My3Ow+xCRGQ0Suz3Sn0Jq0QQdK4Axg3I8wXrnA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Fri, 07 Jul 2023 13:59:57 +0000
  • Ironport-data: A9a23:UD3lOKIiO7Ho63G1FE+Rw5QlxSXFcZb7ZxGr2PjKsXjdYENS1DUAn zMYXG+Ga/ncNDOkLYtwaNi/8B9V68fWnNJiHgNlqX01Q3x08seUXt7xwmUcnc+xBpaaEB84t ZV2hv3odp1coqr0/0/1WlTZhSAgk/rOHvykU7Ss1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpKrfrawP9TlK6q4mhA4QRhPaojUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jnvWauYEm/FNoWU8AgUvoIx/ytWZcWq85efSZSzXFD6I+QrvBIAzt03ZHzaM7H09c54HH9oq KMSNQkpf1O7m+js5aOxS+Vj05FLwMnDZOvzu1lG5BSAVbMMZ8+GRK/Ho9hFwD03m8ZCW+7EY NYUYiZuaxKGZABTPlAQC9Q1m+LAanvXKmUE7g7K4/VvpTGLl2Sd05C0WDbRUsaNSshP2F6Ru 0rN/njjAwFcP9uaodaA2iv12rCfwnOmBOr+EpWb/OM13XLJgVVQMw0XDUOShb67lm6hDoc3x 0s8v3BGQbIJ3FymSJzxUgO1pFaAvwUAQJxAHusi8gaPx6HIpQGDCQAsTDRMddgnv88eXiEx2 xmCmNaBONB0mLicSHbY/LHLqzq3YHARNTVbPXRCShYZ6d7+po11lgjIUttoDK+yiJvyBC30x DeJ6iM5gt3/kPI26klyxnif6xrEm3QDZlddCtn/No590j5EWQ==
  • Ironport-hdrordr: A9a23:OpxbdKpHUBYYX9Lb5VKJP0oaV5v5L9V00zEX/kB9WHVpm5Oj+v xGzc5w6farsl0ssRAb6La90cy7LU80mqQFhbX5UY3SPjUO21HYT72Kj7GSugEIcheWnoEytZ uIG5IOcOEYZmIK6voSjjPIdurI9OP3i5xAyN2uvEtFfEVPUeVN/g15AgGUHglfQxRHP4MwEN 656tBcrzStVHwLZoDjb0N1KtTrlpnurtbLcBQGDxko5E2nii6p0qfzF1y90g0FWz1C7L8++S zukhD/5I+kr/anoyWspVP73tBzop/M29FDDMuDhow8LSjtsB+hYMBbV7iLrFkO0Z+SAAJBqr jxiiZlG/42x2Laf2mzrxeo8RLnyiwS53jrzkLdqWf/oOTiLQhKQfZptMZ8SF/0+kAgtNZz3O ZgxGSCradaChvGgWDU+8XIbRd3jUC5yEBS2tL7t0YvHLf2VYUh5LD3vXklZqvoJRiKn7zPxd MeRP01555tACynhj7izyVSKeeXLwgO9ye9MzU/U/OuokJrdVBCvjolLZ8k7wc9HdQGOu1529 g=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Fix invalidate_all_domain_pages() to only attempt to flush the domains
that have IOMMU enabled, otherwise the flush is pointless.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/drivers/passthrough/amd/iommu_init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/amd/iommu_init.c 
b/xen/drivers/passthrough/amd/iommu_init.c
index 7dbd7e7d094a..af6713d2fc02 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -1532,8 +1532,10 @@ int __init amd_iommu_init_late(void)
 static void invalidate_all_domain_pages(void)
 {
     struct domain *d;
+
     for_each_domain( d )
-        amd_iommu_flush_all_pages(d);
+        if ( is_iommu_enabled(d) )
+            amd_iommu_flush_all_pages(d);
 }
 
 static int cf_check _invalidate_all_devices(
-- 
2.41.0




 


Rackspace

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