From patchwork Mon Apr 15 12:16:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Teddy Astie X-Patchwork-Id: 13629893 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DAA05C4345F for ; Mon, 15 Apr 2024 12:16:46 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.706122.1103163 (Exim 4.92) (envelope-from ) id 1rwLGB-0006St-FP; Mon, 15 Apr 2024 12:16:31 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 706122.1103163; Mon, 15 Apr 2024 12:16:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rwLGB-0006Sm-CQ; Mon, 15 Apr 2024 12:16:31 +0000 Received: by outflank-mailman (input) for mailman id 706122; Mon, 15 Apr 2024 12:16:30 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rwLG9-0006Sb-VD for xen-devel@lists.xenproject.org; Mon, 15 Apr 2024 12:16:30 +0000 Received: from mail145-16.atl61.mandrillapp.com (mail145-16.atl61.mandrillapp.com [198.2.145.16]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id fc166306-fb21-11ee-b908-491648fe20b8; Mon, 15 Apr 2024 14:16:28 +0200 (CEST) Received: from pmta06.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1]) by mail145-16.atl61.mandrillapp.com (Mailchimp) with ESMTP id 4VJ5kL3k0cz8XRqhX for ; Mon, 15 Apr 2024 12:16:26 +0000 (GMT) Received: from [37.26.189.201] by mandrillapp.com id df12415ac50046a4b0827733735753de; Mon, 15 Apr 2024 12:16:26 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: fc166306-fb21-11ee-b908-491648fe20b8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; s=mte1; t=1713183386; x=1713443886; bh=CpLIfnsQ6CTwc8nRBaUZ7IwM1SPQ6YD1gSr8oBgEhC4=; h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version: Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From; b=vnO/XCy5oonWo/9iaWGidQIG+mO5ju2HWAg4RIUJ2r1bnOx96H/DvC/TEtRea+bVt xVk5xDFya5hkSZHUrSfcs2GTrp4Yx8xaGVW1IfmfexggpdO7VwVkJNwdcz7aGZ7+fm T5jIsJyDpWhxVUP9ebGr+aKrcFnfE1N+EfDZxrN2dX/uzaiqux5g/3JqJyAezQlQce S/BxwiMf0P7ZHpWaoopaKsD9r6SjNROrdg/YaIQxMpYcUnGWl5OPVhSXELTGwaMdfa oE7ZaNhZTTqwVcrfBAwcRlWs6eP/W28HhBlExqLc9DMk1WDKonXG83mt23P+XRHfkQ v2A6u96hHK4GQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1; t=1713183386; x=1713443886; i=teddy.astie@vates.tech; bh=CpLIfnsQ6CTwc8nRBaUZ7IwM1SPQ6YD1gSr8oBgEhC4=; h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version: Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From; b=yKN+5gwLR+KuqVgnsFp5pS5XH+jupvU54K9UkDo9sv7boUkP37pXjZSwMFpJA9WAh ecMb2NQJtwqFyp5KQWQbyo6bZm5nJvkzocD201Yk5z0l/lrgbubRr/SF8qf5VcYsBy 4AyxoU7S03487GJ4DjACvOIpHiDuMcqmJr7fHLN5fl8YjVCx1/wQxNVZiJmpAD6mzj SCCw4jiRZ42B5Ko9SufOF3UKSEGoz1wVsicLFrFRjf+lVoWzaUNnSO8x9pDxWlrdMo 6Yh6Vuy+ifxwdCQRSmTqWYnGdSGNuh/325Oj/6AgvaFS2vACsp4B7rrXsDpH2Moxnp fG14Q08vyee/A== From: Teddy Astie Subject: =?utf-8?q?=5BXEN_PATCH_v4_0/5=5D_x86/iommu=3A_Drop_IOMMU_support_wh?= =?utf-8?q?en_cx16_isn=27t_supported?= X-Mailer: git-send-email 2.44.0 X-Bm-Disclaimer: Yes X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2 X-Bm-Transport-Timestamp: 1713183385756 To: xen-devel@lists.xenproject.org Cc: Teddy Astie Message-Id: X-Native-Encoded: 1 X-Report-Abuse: =?utf-8?q?Please_forward_a_copy_of_this_message=2C_including?= =?utf-8?q?_all_headers=2C_to_abuse=40mandrill=2Ecom=2E_You_can_also_report_?= =?utf-8?q?abuse_here=3A_https=3A//mandrillapp=2Ecom/contact/abuse=3Fid=3D30?= =?utf-8?q?504962=2Edf12415ac50046a4b0827733735753de?= X-Mandrill-User: md_30504962 Feedback-ID: 30504962:30504962.20240415:md Date: Mon, 15 Apr 2024 12:16:26 +0000 MIME-Version: 1.0 All hardware that supports VT-d/AMD-Vi that exists also supports cx16 (aside specifically crafted virtual machines). Some IOMMU code paths in Xen consider cases where VT-d/AMD-Vi is supported while cx16 isn't, those paths may be bugged and are barely tested, dead code in practice. Disable IOMMU in case we have IOMMU hardware but no cx16, then cleanup no-cx16 handling logic from VT-d and AMD-Vi drivers. Also disable interrupt remapping that also relies on cx16. Teddy Astie (5): VT-d: Disable IOMMU if cx16 isn't supported AMD-Vi: Disable IOMMU if cx16 isn't supported VT-d: Cleanup MAP_SINGLE_DEVICE and related code VT-d: Disable intrerrupt remapping if cx16 is not supported AMD-Vi: Disable intrerrupt remapping if cx16 is not supported xen/drivers/passthrough/amd/iommu_intr.c | 6 ++ xen/drivers/passthrough/amd/iommu_map.c | 42 ++++------ xen/drivers/passthrough/amd/pci_amd_iommu.c | 6 ++ xen/drivers/passthrough/vtd/intremap.c | 70 +++++----------- xen/drivers/passthrough/vtd/iommu.c | 92 +++++++-------------- xen/drivers/passthrough/vtd/vtd.h | 5 +- 6 files changed, 77 insertions(+), 144 deletions(-)