From nobody Wed Oct 29 22:02:31 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass header.i=teddy.astie@vates.tech; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=vates.tech ARC-Seal: i=1; a=rsa-sha256; t=1761126707; cv=none; d=zohomail.com; s=zohoarc; b=YawbTUz4miBTnlNi1NE2jXqcaNwo+JB7Ri25L6RCBWxEsi3+PLnpSGtHB745GQ5xv6noPQo2brrN5uQVPQzp7sgE12XT3JRcgkEzgYKOdX612WBGx8jFhdp2vXGG5WR5RWKWz98wU1RGdcLqrShBvIzOSKYR3c3rli9JSgtHJgc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761126707; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Z19jcW4y7eMkW61Dtah/xs2jKM8h/ya64whHhXGW4tg=; b=UqHQZRH6kvuA6uEWkt28jm/MT8T59lA1s5R6eHwvlyinFZBip5uIb97eJljhQ9brkjmb5G86PzfyKneNcquFHEYXQBT4C7VsiQQcrup8YyjKwTONPprRuXKixBaZlkxDlwAMQLPxnjNsoMLU14JH8MO9rUY4D0FsrB8a0+zy9C0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=teddy.astie@vates.tech; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1761126707693854.8481887756299; Wed, 22 Oct 2025 02:51:47 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1147745.1479928 (Exim 4.92) (envelope-from ) id 1vBVVF-0007QO-Db; Wed, 22 Oct 2025 09:51:33 +0000 Received: by outflank-mailman (output) from mailman id 1147745.1479928; Wed, 22 Oct 2025 09:51:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vBVVF-0007QH-9p; Wed, 22 Oct 2025 09:51:33 +0000 Received: by outflank-mailman (input) for mailman id 1147745; Wed, 22 Oct 2025 09:51:31 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vBVVD-0007BN-Pr for xen-devel@lists.xenproject.org; Wed, 22 Oct 2025 09:51:31 +0000 Received: from mail187-3.suw11.mandrillapp.com (mail187-3.suw11.mandrillapp.com [198.2.187.3]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id aa2b547a-af2c-11f0-980a-7dc792cee155; Wed, 22 Oct 2025 11:51:22 +0200 (CEST) Received: from pmta09.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1]) by mail187-3.suw11.mandrillapp.com (Mailchimp) with ESMTP id 4cs4Dn13rHzDRJHK4 for ; Wed, 22 Oct 2025 09:51:21 +0000 (GMT) Received: from [37.26.189.201] by mandrillapp.com id 92eae8be8cab4148a34e7f6f293f1524; Wed, 22 Oct 2025 09:51:21 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: aa2b547a-af2c-11f0-980a-7dc792cee155 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; s=mte1; t=1761126681; x=1761396681; bh=Z19jcW4y7eMkW61Dtah/xs2jKM8h/ya64whHhXGW4tg=; h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID: Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date: Subject:From; b=QQKlsMZshX+p3vUUNoOYyaGzsBbATBUUuLcQyevFZQ9H4QMKnKpriuGR3lsqu2Nn8 I+oItd0zNN9XPet/FoNe96tN8ujlaieqVeiQp4Tq9P5zsCOL2t0Vx7TUsluGPUAimv IYiQa+UUo+NSuHZYU1cEeAnEXSeJw6Vfu+vJ9U7Fg4Qbgc+IT8b3a1ti72L0kbv/Ep ToR7xHvHa2ZydKs0PAf/pE1JhttCC6v1m6ipKSzpIWYsaxlt8qc0XQBLMMQH1QFH+p I7ogEKxYr8G6qvEGIroYP5082GyFK6p1xO9WJ8qyOTbjBkJv1HVVQ1XrJ8WdcC1e7l hnveCPcY09PnA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1; t=1761126681; x=1761387181; i=teddy.astie@vates.tech; bh=Z19jcW4y7eMkW61Dtah/xs2jKM8h/ya64whHhXGW4tg=; h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID: Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date: Subject:From; b=GtRrB25h/64dSYrr2qcV3SFd3O/iXe07gwturj8JBks+cymloCicM9XAqbYb7Rww0 PQ1+uWfgt4m7Q9OIa1NflDFV4rF1u/m0ib1UvFEvu0pbwBGtUllPG4lZw5PqTI+tmN pYlHVhBEI9+AEdPME1KK1kAbHhD4KOhE2o5c2Hiq6DWIjYjDOCxV5/2jBwVvROmUfJ 4R9VSGuC7bPpfPFnOmTkYp95k30tDMLrmK76rogOdDEnVdxfrzp6mBLNd7aIsMxnYs BMaT6OeBddcWLqewLB2EdzZnIzCmFOEakGlnuXs1PvPVUUjVR8k2a35amyCDwgWq3e zYErOhxSQML9g== From: "Teddy Astie" Subject: =?utf-8?Q?[PATCH=201/4]=20vtd:=20Move=20(un)map=5Fvtd=5Fdomain=5Fpage=20to=20extern.h?= X-Mailer: git-send-email 2.51.1 X-Bm-Disclaimer: Yes X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2 X-Bm-Transport-Timestamp: 1761126680273 To: xen-devel@lists.xenproject.org Cc: "Teddy Astie" , "Jan Beulich" , "Andrew Cooper" , "=?utf-8?Q?Roger=20Pau=20Monn=C3=A9?=" Message-Id: <74ff3496afcc0a0b747f9ea203d10f51e6b4d00c.1761124632.git.teddy.astie@vates.tech> In-Reply-To: References: X-Native-Encoded: 1 X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.92eae8be8cab4148a34e7f6f293f1524?= X-Mandrill-User: md_30504962 Feedback-ID: 30504962:30504962.20251022:md Date: Wed, 22 Oct 2025 09:51:21 +0000 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @mandrillapp.com) (identity teddy.astie@vates.tech) X-ZM-MESSAGEID: 1761126709747154100 Content-Type: text/plain; charset="utf-8" These functions are basically wrappers of map_domain_page; move them to the shared extern.h and make them inline to help with code generation. Signed-off-by: Teddy Astie --- xen/drivers/passthrough/vtd/extern.h | 13 +++++++++++-- xen/drivers/passthrough/vtd/x86/vtd.c | 10 ---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough= /vtd/extern.h index c16583c951..a62310b3e7 100644 --- a/xen/drivers/passthrough/vtd/extern.h +++ b/xen/drivers/passthrough/vtd/extern.h @@ -21,6 +21,7 @@ #define DRIVERS__PASSTHROUGH__VTD__EXTERN_H =20 #include "dmar.h" +#include #include =20 #define VTDPREFIX "[VT-D]" @@ -78,8 +79,6 @@ int __must_check qinval_device_iotlb_sync(struct vtd_iomm= u *iommu, =20 uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node); void free_pgtable_maddr(u64 maddr); -void *map_vtd_domain_page(u64 maddr); -void unmap_vtd_domain_page(const void *va); int domain_context_mapping_one(struct domain *domain, struct vtd_iommu *io= mmu, uint8_t bus, uint8_t devfn, const struct pci_dev *pdev, domid_t domid, @@ -114,4 +113,14 @@ void quirk_iommu_caps(struct vtd_iommu *iommu); bool platform_supports_intremap(void); bool platform_supports_x2apic(void); =20 +static inline void *map_vtd_domain_page(u64 maddr) +{ + return map_domain_page(_mfn(paddr_to_pfn(maddr))); +} + +static inline void unmap_vtd_domain_page(const void *va) +{ + unmap_domain_page(va); +} + #endif // DRIVERS__PASSTHROUGH__VTD__EXTERN_H diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthroug= h/vtd/x86/vtd.c index 76f12adc23..b0798dc6a1 100644 --- a/xen/drivers/passthrough/vtd/x86/vtd.c +++ b/xen/drivers/passthrough/vtd/x86/vtd.c @@ -36,13 +36,3 @@ * 1:1 iommu mappings except xen and unusable regions. */ boolean_param("iommu_inclusive_mapping", iommu_hwdom_inclusive); - -void *map_vtd_domain_page(u64 maddr) -{ - return map_domain_page(_mfn(paddr_to_pfn(maddr))); -} - -void unmap_vtd_domain_page(const void *va) -{ - unmap_domain_page(va); -} --=20 2.51.1 -- Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech From nobody Wed Oct 29 22:02:31 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass header.i=teddy.astie@vates.tech; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=vates.tech ARC-Seal: i=1; a=rsa-sha256; t=1761126711; cv=none; d=zohomail.com; s=zohoarc; b=oDOFphhPvbtGLFXnSl2q8Kpiaon+5cRbFaqnuoCD/JAeUAGJRhr9P62KhYWrP/5+gExcX+wZcUM2LnjCHcrU5MoMR4dSoMjcoUk65bdg1JpBGt6sIUztJQplenmAhmMiQJqI/Z5CFRkSufR0/ABiVHYLTj9ErXx+Fy5U+qxRknc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761126711; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+LDeJfp4Fui1L+MoS/fNpSswgos6OApNk3YD5WlQ4s0=; b=VIzEim39Q0eofP+0LJs4u/8mOMET6285pDJOgJlQ00bxDTIaW7y7Fe7BcbivoGvYttka9zPtroE9ziI95RSnSze645vzg/uQwJYn4xJ11i04RDksuCQsx5OFioti0dwhmBgUYLaKGt4Bjxs8uPjwiQPzHUNH5Eb9eqIDc3F6QwY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=teddy.astie@vates.tech; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1761126711208990.4331776517237; Wed, 22 Oct 2025 02:51:51 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1147744.1479918 (Exim 4.92) (envelope-from ) id 1vBVVE-0007C9-6W; Wed, 22 Oct 2025 09:51:32 +0000 Received: by outflank-mailman (output) from mailman id 1147744.1479918; Wed, 22 Oct 2025 09:51:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vBVVE-0007C0-35; Wed, 22 Oct 2025 09:51:32 +0000 Received: by outflank-mailman (input) for mailman id 1147744; Wed, 22 Oct 2025 09:51:31 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vBVVD-0007BN-3e for xen-devel@lists.xenproject.org; Wed, 22 Oct 2025 09:51:31 +0000 Received: from mail187-3.suw11.mandrillapp.com (mail187-3.suw11.mandrillapp.com [198.2.187.3]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id aa2c1a93-af2c-11f0-980a-7dc792cee155; Wed, 22 Oct 2025 11:51:22 +0200 (CEST) Received: from pmta09.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1]) by mail187-3.suw11.mandrillapp.com (Mailchimp) with ESMTP id 4cs4Dn3tS7zDRHxTs for ; Wed, 22 Oct 2025 09:51:21 +0000 (GMT) Received: from [37.26.189.201] by mandrillapp.com id d0027f5a90814dada2a9af600a2f7328; Wed, 22 Oct 2025 09:51:21 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: aa2c1a93-af2c-11f0-980a-7dc792cee155 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; s=mte1; t=1761126681; x=1761396681; bh=+LDeJfp4Fui1L+MoS/fNpSswgos6OApNk3YD5WlQ4s0=; h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID: Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date: Subject:From; b=bkTAEZ3Hkt1bK3S6oRGi1eTN1o9wwmG0skjWC/tjqKh8SUnEmgZfjMOJIvjiGyfA4 dyvtmLvSg+1aLjpwHNvexAERPb04YibRnooBn7urnkibJc50BVGNCjBDu4cOFiNSbf du0XHBDMGdygeCDXwy9Wx5pkTdiO5qvFbq9BCagHynVeBPk76N2ULqrcaTRLqHaGKB YDvA8w5c/D0+iGIz+MlFBkYyamc1eRm6/ZiRNT/6ff+tQQ56VkmZ2SJolf39HVOBN8 phrL/Yypo4gGtr2AswFNHZaxT8d2gNNxvt+8YDCoBj7QsECtvD4YMnYvHLhD/AfHLw ncl0AqZ+vEVOA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1; t=1761126681; x=1761387181; i=teddy.astie@vates.tech; bh=+LDeJfp4Fui1L+MoS/fNpSswgos6OApNk3YD5WlQ4s0=; h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID: Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date: Subject:From; b=JlrepnyzKPqdmChY2/UGevb/AK5a/1wsIEAyJ0hki3aYS165JlFQVAmLdfYIkWZQr dpdtqsbBb6K/sD0n4HTK5gFY1J7vrfbRrBpbuIoKz/Znh/UonyaTDKkcT2Q+OSIZew sYSFSVDyW7nlYZXT4wmrLBc52JL1d4YCMDL9UWlZ3rxyIpubsVH9IUSCgbQwEpInow A0f56z+mUvEhjTCEop2sEeFwQF5a1FKVBPJCvscmsQmyE42MAzvIqNA6ktBMe0i+xl 1i9mGJi/AsXhagZTGRXQosn7xfPV4W4FDkG6nkXOHVsyfBIsH+G4bZV+V++yL/emyf 9rZvAy1T44Sjg== From: "Teddy Astie" Subject: =?utf-8?Q?[PATCH=202/4]=20vtd:=20Collapse=20x86=20subdirectory?= X-Mailer: git-send-email 2.51.1 X-Bm-Disclaimer: Yes X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2 X-Bm-Transport-Timestamp: 1761126680586 To: xen-devel@lists.xenproject.org Cc: "Teddy Astie" , "Jan Beulich" , "=?utf-8?Q?Roger=20Pau=20Monn=C3=A9?=" , "Andrew Cooper" Message-Id: <0b9cda94fc8b69563a5f8783d6bc3ed22b0531d9.1761124632.git.teddy.astie@vates.tech> In-Reply-To: References: X-Native-Encoded: 1 X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.d0027f5a90814dada2a9af600a2f7328?= X-Mandrill-User: md_30504962 Feedback-ID: 30504962:30504962.20251022:md Date: Wed, 22 Oct 2025 09:51:21 +0000 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @mandrillapp.com) (identity teddy.astie@vates.tech) X-ZM-MESSAGEID: 1761126714256158500 Content-Type: text/plain; charset="utf-8" As VT-d only exists on x86, it doesn't make sense to have a x86-specific subdirectory. Moreover, now that vtd.c empty (once we moved the deprecated iommu_inclusive_mapping parameter), only ats.c remain which could be moved = to the upper directory. Collapse this directory to make the driver structure clearer. Signed-off-by: Teddy Astie --- Do we care much about iommu_inclusive_mapping ? xen/drivers/passthrough/iommu.c | 10 ++++++ xen/drivers/passthrough/vtd/Makefile | 3 +- xen/drivers/passthrough/vtd/{x86 =3D> }/ats.c | 10 +++--- xen/drivers/passthrough/vtd/x86/Makefile | 2 -- xen/drivers/passthrough/vtd/x86/vtd.c | 38 --------------------- 5 files changed, 16 insertions(+), 47 deletions(-) rename xen/drivers/passthrough/vtd/{x86 =3D> }/ats.c (97%) delete mode 100644 xen/drivers/passthrough/vtd/x86/Makefile delete mode 100644 xen/drivers/passthrough/vtd/x86/vtd.c diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iomm= u.c index c9425d6971..2e2037502d 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -57,6 +57,16 @@ bool __read_mostly iommu_hwdom_passthrough; bool __hwdom_initdata iommu_hwdom_inclusive; int8_t __hwdom_initdata iommu_hwdom_reserved =3D -1; =20 +#ifdef CONFIG_X86 +/* + * Deprecated + * + * iommu_inclusive_mapping: when set, all memory below 4GB is included in = dom0 + * 1:1 iommu mappings except xen and unusable regions. + */ +boolean_param("iommu_inclusive_mapping", iommu_hwdom_inclusive); +#endif + #ifndef iommu_hap_pt_share bool __read_mostly iommu_hap_pt_share =3D true; #endif diff --git a/xen/drivers/passthrough/vtd/Makefile b/xen/drivers/passthrough= /vtd/Makefile index fde7555fac..328a014016 100644 --- a/xen/drivers/passthrough/vtd/Makefile +++ b/xen/drivers/passthrough/vtd/Makefile @@ -1,5 +1,4 @@ -obj-$(CONFIG_X86) +=3D x86/ - +obj-y +=3D ats.o obj-y +=3D iommu.o obj-y +=3D dmar.o obj-y +=3D utils.o diff --git a/xen/drivers/passthrough/vtd/x86/ats.c b/xen/drivers/passthroug= h/vtd/ats.c similarity index 97% rename from xen/drivers/passthrough/vtd/x86/ats.c rename to xen/drivers/passthrough/vtd/ats.c index 61052ef580..d481eff6d7 100644 --- a/xen/drivers/passthrough/vtd/x86/ats.c +++ b/xen/drivers/passthrough/vtd/ats.c @@ -22,11 +22,11 @@ #include #include #include -#include "../iommu.h" -#include "../dmar.h" -#include "../vtd.h" -#include "../extern.h" -#include "../../ats.h" +#include "iommu.h" +#include "dmar.h" +#include "vtd.h" +#include "extern.h" +#include "../ats.h" =20 static LIST_HEAD(ats_dev_drhd_units); =20 diff --git a/xen/drivers/passthrough/vtd/x86/Makefile b/xen/drivers/passthr= ough/vtd/x86/Makefile deleted file mode 100644 index fe20a0b019..0000000000 --- a/xen/drivers/passthrough/vtd/x86/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -obj-y +=3D ats.o -obj-y +=3D vtd.o diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthroug= h/vtd/x86/vtd.c deleted file mode 100644 index b0798dc6a1..0000000000 --- a/xen/drivers/passthrough/vtd/x86/vtd.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2008, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License f= or - * more details. - * - * You should have received a copy of the GNU General Public License along= with - * this program; If not, see . - * - * Copyright (C) Allen Kay - * Copyright (C) Weidong Han - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../iommu.h" -#include "../dmar.h" -#include "../vtd.h" -#include "../extern.h" - -/* - * iommu_inclusive_mapping: when set, all memory below 4GB is included in = dom0 - * 1:1 iommu mappings except xen and unusable regions. - */ -boolean_param("iommu_inclusive_mapping", iommu_hwdom_inclusive); --=20 2.51.1 -- Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech From nobody Wed Oct 29 22:02:31 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass header.i=teddy.astie@vates.tech; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=vates.tech ARC-Seal: i=1; a=rsa-sha256; t=1761126714; cv=none; d=zohomail.com; s=zohoarc; b=WnMBBH5Nx0t97+eXUo3Ppk/l8FTotRp7nEIfnhnsLu57moS/Lk3Ou6K75t9PEgGbdL6a+UPPQLUzvq6Lb86Hk1W9l21guqlFD6u/HWjHDlGA5Gqgl8K2Y4H6Ob/kSgHpiDoWzznt9s8oedgdNpf10OIKsU4PURzjlLlarXu3kPg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761126714; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=pnFV+fDDYcmdoekdKwaFpxr/OuJxPCuCxIvebF8I08Q=; b=JTVvhtkAMDHjBN8cJNFULIl2yPhlE5wYYeWjypyLnN4Lm5ILduhxqfbmjVpztSd9mFVtSiWT9FOqsinPKzC5oekdrsSxH0R3lzh/cptm5sR8vZb25gZGBK+6Rec8V/e/o5SYXcxyfI3ql0yPnbd2rOVCZTyzs4/AuT03nOQKuUY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=teddy.astie@vates.tech; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1761126714231628.0425075134306; Wed, 22 Oct 2025 02:51:54 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1147746.1479938 (Exim 4.92) (envelope-from ) id 1vBVVG-0007f4-Jw; Wed, 22 Oct 2025 09:51:34 +0000 Received: by outflank-mailman (output) from mailman id 1147746.1479938; Wed, 22 Oct 2025 09:51:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vBVVG-0007el-Gr; Wed, 22 Oct 2025 09:51:34 +0000 Received: by outflank-mailman (input) for mailman id 1147746; Wed, 22 Oct 2025 09:51:32 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vBVVE-0007BN-Py for xen-devel@lists.xenproject.org; Wed, 22 Oct 2025 09:51:32 +0000 Received: from mail180-10.suw31.mandrillapp.com (mail180-10.suw31.mandrillapp.com [198.2.180.10]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id aa4d1956-af2c-11f0-980a-7dc792cee155; Wed, 22 Oct 2025 11:51:22 +0200 (CEST) Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1]) by mail180-10.suw31.mandrillapp.com (Mailchimp) with ESMTP id 4cs4Dn5Pydz5QlDfF for ; Wed, 22 Oct 2025 09:51:21 +0000 (GMT) Received: from [37.26.189.201] by mandrillapp.com id f0bf9ec886ff408dbd4f0076b9aef2da; Wed, 22 Oct 2025 09:51:21 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: aa4d1956-af2c-11f0-980a-7dc792cee155 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; s=mte1; t=1761126681; x=1761396681; bh=pnFV+fDDYcmdoekdKwaFpxr/OuJxPCuCxIvebF8I08Q=; h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID: Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date: Subject:From; b=CInwWjjIfzU+YNFapjTNtvc/9G+d8E1dr2qA9M4ydqM3jD3dZd6A4+pT6zPlqtVD4 Jt5n75IxSrl8vkFvzmJX0iHmQm5RriW6tFiZ1au0/JhGKqdWdy3IcGTNBAj9qLOdKO TwbOXKRviLtIwv675vOohC1dNkw/cMo8GK/mV9ybLIUAiDpNWxke276+cx3V640zpb ivEW9OYrZy5jMWtdQdLwVs+yoMk1RJvceC4AXSykFDyPc39mjWbzGnURnwK6VpHOhS bfCuoPy7MFU0NrIw1HFdbH21y/tuSPklWOq02eqpwy4kmHetfue6vyNsRQGi58mqnR PkVE9pOXC26DA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1; t=1761126681; x=1761387181; i=teddy.astie@vates.tech; bh=pnFV+fDDYcmdoekdKwaFpxr/OuJxPCuCxIvebF8I08Q=; h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID: Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date: Subject:From; b=furiCssd/WYkv5hqSYcS8H86H7vKyIY88mZ6x3F19QbKn0EROQQDSPeRpDHIdDd1N 5kXN4U3NV+SI0oH1Ww+HLyQBeS8lBAuG04OaOxhjWr01uP/guoGteB7HGkHGmFswpn SYaP9Ef4YpyryIwnxZ0+CdMmk7koEohTRbUpREwKxjjcLNHhL3gnIHgyKFFmNjLolx Umk1gu4eauPUkWVUscL4uoLLix2+2ZJolR+rRylhMdnJ24j9ENKbfyMOI8RuQNBy45 Ppl8HI7bWVifYg7B9UhCTfwbpt9x/mDmoqS5WVWLxVvJ7Y+VaOIGaEw+ZtkBvfAJgQ WtS2pt+KDP4NA== From: "Teddy Astie" Subject: =?utf-8?Q?[PATCH=203/4]=20vtd:=20Remove=20IO=5FxAPIC=5Froute=5Fentry=20macro?= X-Mailer: git-send-email 2.51.1 X-Bm-Disclaimer: Yes X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2 X-Bm-Transport-Timestamp: 1761126680904 To: xen-devel@lists.xenproject.org Cc: "Teddy Astie" , "Jan Beulich" , "Andrew Cooper" , "=?utf-8?Q?Roger=20Pau=20Monn=C3=A9?=" Message-Id: <540db157df0f0f6e27c7b50edc6a7d82fe668608.1761124632.git.teddy.astie@vates.tech> In-Reply-To: References: X-Native-Encoded: 1 X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.f0bf9ec886ff408dbd4f0076b9aef2da?= X-Mandrill-User: md_30504962 Feedback-ID: 30504962:30504962.20251022:md Date: Wed, 22 Oct 2025 09:51:21 +0000 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @mandrillapp.com) (identity teddy.astie@vates.tech) X-ZM-MESSAGEID: 1761126720161158500 Content-Type: text/plain; charset="utf-8" This macro was introduced to abstract between IO-APIC and IO-SAPIC (ia64), now that ia64 isn't supported anymore, this macro now only refers to IO-API= C. Signed-off-by: Teddy Astie Acked-by: Andrew Cooper --- xen/drivers/passthrough/vtd/intremap.c | 10 +++++----- xen/drivers/passthrough/vtd/vtd.h | 3 --- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrou= gh/vtd/intremap.c index 7726ee618a..e0314aa469 100644 --- a/xen/drivers/passthrough/vtd/intremap.c +++ b/xen/drivers/passthrough/vtd/intremap.c @@ -268,7 +268,7 @@ static unsigned int alloc_remap_entry(struct vtd_iommu = *iommu, unsigned int nr) } =20 static int remap_entry_to_ioapic_rte( - struct vtd_iommu *iommu, int index, struct IO_xAPIC_route_entry *old_r= te) + struct vtd_iommu *iommu, int index, struct IO_APIC_route_entry *old_rt= e) { struct iremap_entry *iremap_entry =3D NULL, *iremap_entries; unsigned long flags; @@ -316,8 +316,8 @@ static int remap_entry_to_ioapic_rte( } =20 static int ioapic_rte_to_remap_entry(struct vtd_iommu *iommu, - int apic, unsigned int ioapic_pin, struct IO_xAPIC_route_entry *old_rt= e, - struct IO_xAPIC_route_entry new_rte) + int apic, unsigned int ioapic_pin, struct IO_APIC_route_entry *old_rte, + struct IO_APIC_route_entry new_rte) { struct iremap_entry *iremap_entry =3D NULL, *iremap_entries; struct iremap_entry new_ire; @@ -398,7 +398,7 @@ unsigned int cf_check io_apic_read_remap_rte( { unsigned int ioapic_pin =3D (reg - 0x10) / 2; int index; - struct IO_xAPIC_route_entry old_rte =3D { }; + struct IO_APIC_route_entry old_rte =3D { }; int rte_upper =3D (reg & 1) ? 1 : 0; struct vtd_iommu *iommu =3D ioapic_to_iommu(IO_APIC_ID(apic)); =20 @@ -420,7 +420,7 @@ unsigned int cf_check io_apic_read_remap_rte( void cf_check io_apic_write_remap_rte( unsigned int apic, unsigned int pin, uint64_t rte) { - struct IO_xAPIC_route_entry old_rte =3D {}, new_rte; + struct IO_APIC_route_entry old_rte =3D {}, new_rte; struct vtd_iommu *iommu =3D ioapic_to_iommu(IO_APIC_ID(apic)); int rc; =20 diff --git a/xen/drivers/passthrough/vtd/vtd.h b/xen/drivers/passthrough/vt= d/vtd.h index b95124517b..f0286b40c3 100644 --- a/xen/drivers/passthrough/vtd/vtd.h +++ b/xen/drivers/passthrough/vtd/vtd.h @@ -31,9 +31,6 @@ #define MAP_ERROR_RECOVERY (1u << 2) #define UNMAP_ME_PHANTOM_FUNC (1u << 3) =20 -/* Allow for both IOAPIC and IOSAPIC. */ -#define IO_xAPIC_route_entry IO_APIC_route_entry - struct IO_APIC_route_remap_entry { union { u64 val; --=20 2.51.1 -- Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech From nobody Wed Oct 29 22:02:31 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass header.i=teddy.astie@vates.tech; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=vates.tech ARC-Seal: i=1; a=rsa-sha256; t=1761126715; cv=none; d=zohomail.com; s=zohoarc; b=KJSeOGuRTQV4cbyffDwZ0wXdKgKxODs7QDFTTn9vIEAponfnAbLyBZyE6LKKSmyuvj4C8hkPfDz/2nNrSDnFFm2gK2OYrmiJwue6tvUtgB1FmLdBcxtIqVDfuJ5NeqzOHkH01Z/Hg2GEkE/UojiRKVOj4UVCn9EAJew9Si2IpZg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761126715; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=u65tTbbGHDnLFDs3oLFBy6jWBaKMKOiRqgKclIL4gpA=; b=CFB/AqFJFN5XDHBeCQi00/w4RF7R3yRLha5CgTcWI605HXzzknEIYDNTjorzNvfYoxSczE9Uuuky0XJ22n4phEh048qaWpleqo5lR4ojWFIWqzdH5Dx6S/2ADehpeTlD+8ylAwrCLrVmm9wodU5ZHHJQQIwe/ddV/XjykSIvijc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=teddy.astie@vates.tech; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1761126715660549.1496078197815; Wed, 22 Oct 2025 02:51:55 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1147747.1479948 (Exim 4.92) (envelope-from ) id 1vBVVI-0007v2-1P; Wed, 22 Oct 2025 09:51:36 +0000 Received: by outflank-mailman (output) from mailman id 1147747.1479948; Wed, 22 Oct 2025 09:51:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vBVVH-0007us-TO; Wed, 22 Oct 2025 09:51:35 +0000 Received: by outflank-mailman (input) for mailman id 1147747; Wed, 22 Oct 2025 09:51:33 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vBVVF-0007BN-Pz for xen-devel@lists.xenproject.org; Wed, 22 Oct 2025 09:51:33 +0000 Received: from mail187-3.suw11.mandrillapp.com (mail187-3.suw11.mandrillapp.com [198.2.187.3]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id af993062-af2c-11f0-980a-7dc792cee155; Wed, 22 Oct 2025 11:51:31 +0200 (CEST) Received: from pmta09.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1]) by mail187-3.suw11.mandrillapp.com (Mailchimp) with ESMTP id 4cs4Dn66SVzDRJHhh for ; Wed, 22 Oct 2025 09:51:21 +0000 (GMT) Received: from [37.26.189.201] by mandrillapp.com id 9b6d7c45405a405e9f943669d8d0ba31; Wed, 22 Oct 2025 09:51:21 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: af993062-af2c-11f0-980a-7dc792cee155 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; s=mte1; t=1761126681; x=1761396681; bh=u65tTbbGHDnLFDs3oLFBy6jWBaKMKOiRqgKclIL4gpA=; h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID: Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date: Subject:From; b=oY8+Hu1kq3Wi/xu+r2DIGUMCNtUAqPbMq8WOG3aKJS1we84QBENoQtwUaC+Oe2CIp 6qOytG8zBzLc/xTi64lZNf8EXYDzAQjuAb75pwTdCo0WeuU5/uwxAIh48q1hX9KdxQ xUU6cdUInQAMF+OGivCx34EbXRYFqjusBguxtkPPUrtNe9XCI/c3n2Dz0zoD4JT23V 2J8dqQE709qE5HHV57igCK4vVRqeHr3CpG9CPnkwWuKTv1vBND/lICtKJqafSdSYxS YbvoqOVzsqmHgnkMLHXc1W11VLXw+JZip8MWc/3KezJK/KqLIPkAiKygrcT3Xe2Tb3 pvixyq1VJ5Y4g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1; t=1761126681; x=1761387181; i=teddy.astie@vates.tech; bh=u65tTbbGHDnLFDs3oLFBy6jWBaKMKOiRqgKclIL4gpA=; h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID: Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date: Subject:From; b=MSv240JMXfe4EWAytify7HzLpVtU0etqw/x9KwkOe760JELTkX6w8SPhNAjFcAyCb ZjjVh3eCXG1ZZUlLTG3qqnTqd+hj7Ijv2mA3gZgAP35k6xfQAMuWm/ZZHKUbff8gYS U53J0j4GQjO6Ztd+Fn8Q7vY//fyjQ8YKS4mY7H4hArCf4gA3V/wh4nzx//jxs11o+f lprgTkqCFxfSBipzibQTujdPh4q8oSkbTlMxpAoClKsFtewi/qdx5HaBOP1BeRGjOI 7GARzsrgzDnIWiRzI6/tSu7fkOYqv8GoSxVE3JFzf7kKfwZSDkBCIF/UsU6GuSCtmb Fv2FB5hrSP/GA== From: "Teddy Astie" Subject: =?utf-8?Q?[PATCH=204/4]=20x86/ioapic:=20Don't=20open-code=2032-bits=20rte=20reads?= X-Mailer: git-send-email 2.51.1 X-Bm-Disclaimer: Yes X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2 X-Bm-Transport-Timestamp: 1761126681095 To: xen-devel@lists.xenproject.org Cc: "Teddy Astie" , "Jan Beulich" , "Andrew Cooper" , "=?utf-8?Q?Roger=20Pau=20Monn=C3=A9?=" Message-Id: <819a011a32c608f4aefaf692aeac5ee47381a998.1761124632.git.teddy.astie@vates.tech> In-Reply-To: References: X-Native-Encoded: 1 X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.9b6d7c45405a405e9f943669d8d0ba31?= X-Mandrill-User: md_30504962 Feedback-ID: 30504962:30504962.20251022:md Date: Wed, 22 Oct 2025 09:51:21 +0000 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity teddy.astie@vates.tech) (identity @mandrillapp.com) X-ZM-MESSAGEID: 1761126717756154100 Content-Type: text/plain; charset="utf-8" There are many places where we use interesting ways of reading 32-bits components of the RTE. Introduce and use low and high components directly to the rte structure instead. Also take the opportunity to simplify "x & 1 ? 1 : 0". Signed-off-by: Teddy Astie --- xen/arch/x86/include/asm/io_apic.h | 1 + xen/arch/x86/io_apic.c | 29 ++++++++++---------------- xen/drivers/passthrough/vtd/intremap.c | 9 +++----- 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/xen/arch/x86/include/asm/io_apic.h b/xen/arch/x86/include/asm/= io_apic.h index 4680dce9e1..0e85f2a860 100644 --- a/xen/arch/x86/include/asm/io_apic.h +++ b/xen/arch/x86/include/asm/io_apic.h @@ -122,6 +122,7 @@ struct IO_APIC_route_entry { } dest; }; uint64_t raw; + struct { uint32_t low, high; }; }; }; =20 diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c index 24447aef6c..9d2edec179 100644 --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -257,28 +257,23 @@ nomem: return NULL; } =20 -union entry_union { - struct { u32 w1, w2; }; - struct IO_APIC_route_entry entry; -}; - struct IO_APIC_route_entry __ioapic_read_entry( unsigned int apic, unsigned int pin, bool raw) { - union entry_union eu; + struct IO_APIC_route_entry entry; =20 if ( raw || !iommu_intremap ) { - eu.w1 =3D __io_apic_read(apic, 0x10 + 2 * pin); - eu.w2 =3D __io_apic_read(apic, 0x11 + 2 * pin); + entry.low =3D __io_apic_read(apic, 0x10 + 2 * pin); + entry.high =3D __io_apic_read(apic, 0x11 + 2 * pin); } else { - eu.w1 =3D iommu_read_apic_from_ire(apic, 0x10 + 2 * pin); - eu.w2 =3D iommu_read_apic_from_ire(apic, 0x11 + 2 * pin); + entry.low =3D iommu_read_apic_from_ire(apic, 0x10 + 2 * pin); + entry.high =3D iommu_read_apic_from_ire(apic, 0x11 + 2 * pin); } =20 - return eu.entry; + return entry; } =20 static struct IO_APIC_route_entry ioapic_read_entry( @@ -297,12 +292,10 @@ void __ioapic_write_entry( unsigned int apic, unsigned int pin, bool raw, struct IO_APIC_route_entry e) { - union entry_union eu =3D { .entry =3D e }; - if ( raw || !iommu_intremap ) { - __io_apic_write(apic, 0x11 + 2 * pin, eu.w2); - __io_apic_write(apic, 0x10 + 2 * pin, eu.w1); + __io_apic_write(apic, 0x11 + 2 * pin, e.high); + __io_apic_write(apic, 0x10 + 2 * pin, e.low); /* * Might be called before io_apic_pin_eoi is allocated. Entry wil= l be * initialized to the RTE value once the cache is allocated. @@ -2235,7 +2228,7 @@ int ioapic_guest_read(unsigned long physbase, unsigne= d int reg, u32 *pval) dprintk(XENLOG_INFO, "IO-APIC: apic=3D%d, pin=3D%d, irq=3D%d\n" \ XENLOG_INFO "IO-APIC: new_entry=3D%08x\n" \ XENLOG_INFO "IO-APIC: " f "\n", \ - apic, pin, irq, *(u32 *)&rte, ##a ) + apic, pin, irq, rte.low, ##a ) =20 int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val) { @@ -2254,7 +2247,7 @@ int ioapic_guest_write(unsigned long physbase, unsign= ed int reg, u32 val) pin =3D (reg - 0x10) >> 1; =20 /* Write first half from guest; second half is target info. */ - *(u32 *)&rte =3D val; + rte.low =3D val; =20 /* * What about weird destination types? @@ -2305,7 +2298,7 @@ int ioapic_guest_write(unsigned long physbase, unsign= ed int reg, u32 val) ret =3D io_apic_read(apic, 0x10 + 2 * pin); spin_unlock_irqrestore(&ioapic_lock, flags); rte.vector =3D desc->arch.vector; - if ( *(u32*)&rte !=3D ret ) + if ( rte.low !=3D ret ) WARN_BOGUS_WRITE("old_entry=3D%08x pirq=3D%d\n" XENLOG_INFO "IO-APIC: Attempt to modify IO-APIC pin for i= n-use IRQ!", ret, pirq); diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrou= gh/vtd/intremap.c index e0314aa469..3cdb892559 100644 --- a/xen/drivers/passthrough/vtd/intremap.c +++ b/xen/drivers/passthrough/vtd/intremap.c @@ -399,7 +399,7 @@ unsigned int cf_check io_apic_read_remap_rte( unsigned int ioapic_pin =3D (reg - 0x10) / 2; int index; struct IO_APIC_route_entry old_rte =3D { }; - int rte_upper =3D (reg & 1) ? 1 : 0; + unsigned int rte_upper =3D reg & 1; struct vtd_iommu *iommu =3D ioapic_to_iommu(IO_APIC_ID(apic)); =20 if ( !iommu->intremap.num || @@ -410,11 +410,8 @@ unsigned int cf_check io_apic_read_remap_rte( =20 if ( remap_entry_to_ioapic_rte(iommu, index, &old_rte) ) return __io_apic_read(apic, reg); - - if ( rte_upper ) - return (*(((u32 *)&old_rte) + 1)); - else - return (*(((u32 *)&old_rte) + 0)); + =20 + return rte_upper ? old_rte.high : old_rte.low; } =20 void cf_check io_apic_write_remap_rte( --=20 2.51.1 -- Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech