From patchwork Fri Apr 12 12:33:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Teddy Astie X-Patchwork-Id: 13627692 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 C1D37C4345F for ; Fri, 12 Apr 2024 12:33:59 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.704623.1101092 (Exim 4.92) (envelope-from ) id 1rvG6B-0000gp-HR; Fri, 12 Apr 2024 12:33:43 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 704623.1101092; Fri, 12 Apr 2024 12:33:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rvG6B-0000gi-EL; Fri, 12 Apr 2024 12:33:43 +0000 Received: by outflank-mailman (input) for mailman id 704623; Fri, 12 Apr 2024 12:33:41 +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 1rvG69-0000fM-PK for xen-devel@lists.xenproject.org; Fri, 12 Apr 2024 12:33:41 +0000 Received: from mail5.us4.mandrillapp.com (mail5.us4.mandrillapp.com [205.201.136.5]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e3dc9626-f8c8-11ee-b908-491648fe20b8; Fri, 12 Apr 2024 14:33:40 +0200 (CEST) Received: from pmta15.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1]) by mail5.us4.mandrillapp.com (Mailchimp) with ESMTP id 4VGGFZ615KzDRHy9G for ; Fri, 12 Apr 2024 12:33:38 +0000 (GMT) Received: from [37.26.189.201] by mandrillapp.com id 3b07ce38dac04a7aa6620cfa04f75290; Fri, 12 Apr 2024 12:33:38 +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: e3dc9626-f8c8-11ee-b908-491648fe20b8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; s=mte1; t=1712925218; x=1713185718; bh=lUyJPgNnx0SAin6hEtZWlv9ZWViQpLeT4NrclMLzQzg=; h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version: Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From; b=j9A6GE63KybtdPlWDUCBXZlbxQcE/rPJpNYW6RlKqKMszuvj6RauYGS69IG4wV3hD ALwNxeJhVP8IseHLUeBavCx2nDlIBS+6QPK2es9Cv0lAx1mMDvI6355e3Up78+af43 zihy4JiOhmYuVUVuRVok3UDgJJvKSToNfD0W9dR41O2J2rIhwj7PfGMUVz69mIbR/K 485dJqzY1sEgVldEzCORBEyHTvLDN6PURRDaIzg7wVhXo3qbRzVyA1cZdKlbyTxSdK 23gZM/n03p6CiIqihYR0WZAjKWMWKN9ps/dHFxWkvPMkv/naFIhK1AZilAj4x5/344 7HQIoF/VdAhQg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1; t=1712925218; x=1713185718; i=teddy.astie@vates.tech; bh=lUyJPgNnx0SAin6hEtZWlv9ZWViQpLeT4NrclMLzQzg=; h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version: Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From; b=v5RAGysVGmuL8VTxbmcnwseQXYj03PBP5oRqrmKWaryZTkAm7TlaVZvFvLBvfuRMu gPpXqIToEDHmQreXKKX18fP9cMPVBvKWeeI+1rN6+dW3WEMRbM9ecnZd45rIfNLzhy la0HWfHy8yt8IvLsfYxndUBqeJDfPoxP66+YwzVpIfyTeUAtUpppPm80p2UqovpBXy 7iT9rwoO0rnGBQ0yGscR+bv0JLerHAWr4jlTKaNXG8HaEa/QpjD7I95UvqBq0P4tFs Tr5NFVLELnDZsyAuVdOZ2Ul6hCCLCbmHiyVx/tFyP4PUzamNT3CAWVoUprDRX7X7wG 2kkD9URb/MacQ== From: Teddy Astie Subject: =?utf-8?q?=5BXEN_PATCH_v3_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: 1712925216018 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=2E3b07ce38dac04a7aa6620cfa04f75290?= X-Mandrill-User: md_30504962 Feedback-ID: 30504962:30504962.20240412:md Date: Fri, 12 Apr 2024 12:33:38 +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 Changed in v3: * Use -ENODEV instead of -ENOSYS. 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(-)