From patchwork Mon Apr 8 13:02:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Teddy Astie X-Patchwork-Id: 13621131 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 47BACCD128A for ; Mon, 8 Apr 2024 13:02:25 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.701950.1096597 (Exim 4.92) (envelope-from ) id 1rtodb-0001Bn-An; Mon, 08 Apr 2024 13:02:15 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 701950.1096597; Mon, 08 Apr 2024 13:02:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rtodb-0001Bg-7w; Mon, 08 Apr 2024 13:02:15 +0000 Received: by outflank-mailman (input) for mailman id 701950; Mon, 08 Apr 2024 13:02:14 +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 1rtoda-0001Ba-C3 for xen-devel@lists.xenproject.org; Mon, 08 Apr 2024 13:02:14 +0000 Received: from mail177-6.suw61.mandrillapp.com (mail177-6.suw61.mandrillapp.com [198.2.177.6]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 36fbf243-f5a8-11ee-afe6-a90da7624cb6; Mon, 08 Apr 2024 15:02:12 +0200 (CEST) Received: from pmta14.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1]) by mail177-6.suw61.mandrillapp.com (Mailchimp) with ESMTP id 4VCq4M33k1z2K1rvl for ; Mon, 8 Apr 2024 13:02:11 +0000 (GMT) Received: from [37.26.189.201] by mandrillapp.com id 5b58a5928e67455fbecda3529697de3e; Mon, 08 Apr 2024 13:02:11 +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: 36fbf243-f5a8-11ee-afe6-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; s=mte1; t=1712581331; x=1712841831; bh=JQ6LM3Ho+eDAiTb570CdKQbJlPC3483j6ox6dL2ZHI0=; h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version: Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From; b=X8Ne/q5YsO/85iP4k+G0ujsk3B9pzscAqzok+UakHtvKhACd8oUctRO8tHehPY6aL TmNFyRLyiZxirXtOyHusxSX3sl9MvByjZaT6RZLXBtAPQ4kw4XE/Uz97J6AB6rv0pm HOrsqof5o2CKGNoqbg9Yjshi1ns5PMppJ7n8012yvekWiPQ4rNbAahAmqTOS6nRWFG naG80BkZySQRWkV9KZi2v34oys6U/kO7rJvU9xxK0zUc/fHFoPh9MLAyj1pJHW9/3l ewC/T1kr7COfdUPVQ7RXlEUbzPsBYzVJoD1GX9NiyQkk3a3zWZsMZBne0YAOsfDIXo MnTl6860fDDBQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1; t=1712581331; x=1712841831; i=teddy.astie@vates.tech; bh=JQ6LM3Ho+eDAiTb570CdKQbJlPC3483j6ox6dL2ZHI0=; h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version: Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From; b=TKl4RfSotxcoPbP/8QwunrDLmaGOawmbIYv+gqkoEtDcnjfot33CqPZphA/CGyxSJ +NGNOP17LPMBUEPzDF/kfs6PBIifaLe8OSWq3cdof0bmSpGHNh6v3RZ4vgDzzIEImx YhwpWxqzvBvEWnqEcr/uAN1HFuc6wRpwU8nGnNsatSovTMtlHpquLt7HKRRdV4WJmI NW3nHwYQ4rkIs8gN7tbZGOVCsRBf/eJ3urppAvJ+gkRCa4OfYBDaHf+/8munC1ibDi 8L6xvmj7x4viuIg4epzVGWCAMznkHs8C1j5e5KZdOI9OZLZB+fgeOA7biHVgJN9dwu ESwTeuE+eWJLw== From: Teddy Astie Subject: =?utf-8?q?=5BXEN_PATCH_v2_0/3=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: 1712581330187 To: xen-devel@lists.xenproject.org Cc: Teddy Astie , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= 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=2E5b58a5928e67455fbecda3529697de3e?= X-Mandrill-User: md_30504962 Feedback-ID: 30504962:30504962.20240408:md Date: Mon, 08 Apr 2024 13:02:11 +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. Teddy Changed in v2: * Added cleanup no-cx16 code for x2APIC * Fixed commit and code formatting * Added missing Suggested-by note Teddy Astie (3): 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 xen/arch/x86/apic.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 | 65 ++++----------- xen/drivers/passthrough/vtd/iommu.c | 92 +++++++-------------- xen/drivers/passthrough/vtd/vtd.h | 5 +- 6 files changed, 71 insertions(+), 145 deletions(-)