From patchwork Thu May 23 09:19:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Teddy Astie X-Patchwork-Id: 13671512 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 43BF9C25B7C for ; Thu, 23 May 2024 09:20:14 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.728262.1133125 (Exim 4.92) (envelope-from ) id 1sA4cA-0006uS-1G; Thu, 23 May 2024 09:19:58 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 728262.1133125; Thu, 23 May 2024 09:19:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sA4c9-0006uL-TQ; Thu, 23 May 2024 09:19:57 +0000 Received: by outflank-mailman (input) for mailman id 728262; Thu, 23 May 2024 09:19:56 +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 1sA4c8-0006uF-N1 for xen-devel@lists.xenproject.org; Thu, 23 May 2024 09:19:56 +0000 Received: from mail187-24.suw11.mandrillapp.com (mail187-24.suw11.mandrillapp.com [198.2.187.24]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 9dc144ee-18e5-11ef-90a1-e314d9c70b13; Thu, 23 May 2024 11:19:55 +0200 (CEST) Received: from pmta09.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1]) by mail187-24.suw11.mandrillapp.com (Mailchimp) with ESMTP id 4VlN1555QWzJKF3q8 for ; Thu, 23 May 2024 09:19:53 +0000 (GMT) Received: from [37.26.189.201] by mandrillapp.com id 2fb4daa5dcaf486a8f71b549e7ac6e39; Thu, 23 May 2024 09:19:53 +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: 9dc144ee-18e5-11ef-90a1-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; s=mte1; t=1716455993; x=1716716493; bh=rb2g7/BafJk9f48N+Ig/DxIGBOHotYs1+I4pEEvyMaA=; h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version: Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From; b=t3b3P7X85yze9/uayCXuewejxeoJ1jLwI2WHHbPHeik0tzKvgO4NrqGPLIYX/6fU8 kpz4lkN1F9zWxTYbayycAswMrSO12tqg9ynFxGXdQBxhpDhhJVw56w3qTdeOlhyYzN Vp5k4mfmNIt5hJPNPs3AXKcw+Xl+UKqt2M49f5UYDe+ckHWUFBKOC+Q5n0MOCa9qV6 vWwdHvwG9X1bArNKuRJt9LWqlt7ulmmQkB5DNIWOreAKUfXVdMi9KDRPThSRj0CegG CdX8WqGxPumzUZ61yzG6lzvYxrr7RRTI5BLnp6agNfTr1LZ2Wf0CupvauPczkmrNoj F8lrPr9XV/cgg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1; t=1716455993; x=1716716493; i=teddy.astie@vates.tech; bh=rb2g7/BafJk9f48N+Ig/DxIGBOHotYs1+I4pEEvyMaA=; h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version: Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From; b=aRCcRUksJ6hk/3evHqjybmx9cuR1lQTNwoN2qExfb9elL0WMgSWDdtsYRZNy7WfIu 4TTaExTdOFSchWKa3fZW25riCFRMb7sV1X3moYWNbx6JgKOJXFkOfr0JTKfRFaN0f8 xOyHtiXyashi+nK4UEW0h7ITEfQ+Zkm9zJUQA0IGqCxcViAI5koyPTbzVg304fxRIw 8puxTH0Zu9OaeNfbF3GOu1XsfPJnFuZvy5bUWh0zqsUUafCWhAwjSRJKeewxkJVlFu UuzN6WvKh8ycB/kYsM3o9JDx7ui3XFOkyJ1Fjl1GQfCb0ESyGVpwHVxCdglnr3YER6 yjLxUVTdSwU/A== From: Teddy Astie Subject: =?utf-8?q?=5BXEN_PATCH=5D_x86/iommu=3A_Conditionally_compile_platfo?= =?utf-8?q?rm-specific_union_entries?= X-Mailer: git-send-email 2.45.1 X-Bm-Disclaimer: Yes X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2 X-Bm-Transport-Timestamp: 1716455992462 To: xen-devel@lists.xenproject.org Cc: Teddy Astie , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Message-Id: <2744240f42dadcb1edc69d0f921d5909fe0f63a2.1716455673.git.teddy.astie@vates.tech> 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=2E2fb4daa5dcaf486a8f71b549e7ac6e39?= X-Mandrill-User: md_30504962 Feedback-ID: 30504962:30504962.20240523:md Date: Thu, 23 May 2024 09:19:53 +0000 MIME-Version: 1.0 If some platform driver isn't compiled in, remove its related union entries as they are not used. Signed-off-by Teddy Astie --- xen/arch/x86/include/asm/iommu.h | 4 ++++ xen/arch/x86/include/asm/pci.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/xen/arch/x86/include/asm/iommu.h b/xen/arch/x86/include/asm/iommu.h index 8dc464fbd3..99180940c4 100644 --- a/xen/arch/x86/include/asm/iommu.h +++ b/xen/arch/x86/include/asm/iommu.h @@ -42,17 +42,21 @@ struct arch_iommu struct list_head identity_maps; union { + #ifdef CONFIG_INTEL_IOMMU /* Intel VT-d */ struct { uint64_t pgd_maddr; /* io page directory machine address */ unsigned int agaw; /* adjusted guest address width, 0 is level 2 30-bit */ unsigned long *iommu_bitmap; /* bitmap of iommu(s) that the domain uses */ } vtd; + #endif + #ifdef CONFIG_AMD_IOMMU /* AMD IOMMU */ struct { unsigned int paging_mode; struct page_info *root_table; } amd; + #endif }; }; diff --git a/xen/arch/x86/include/asm/pci.h b/xen/arch/x86/include/asm/pci.h index fd5480d67d..842710f0dc 100644 --- a/xen/arch/x86/include/asm/pci.h +++ b/xen/arch/x86/include/asm/pci.h @@ -22,12 +22,16 @@ struct arch_pci_dev { */ union { /* Subset of struct arch_iommu's fields, to be used in dom_io. */ + #ifdef CONFIG_INTEL_IOMMU struct { uint64_t pgd_maddr; } vtd; + #endif + #ifdef CONFIG_AMD_IOMMU struct { struct page_info *root_table; } amd; + #endif }; domid_t pseudo_domid; mfn_t leaf_mfn;