From patchwork Mon Feb 17 10:18:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Teddy Astie X-Patchwork-Id: 13977467 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 7049CC0219E for ; Mon, 17 Feb 2025 10:18:32 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.890004.1299049 (Exim 4.92) (envelope-from ) id 1tjyCn-0000Q0-NB; Mon, 17 Feb 2025 10:18:25 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 890004.1299049; Mon, 17 Feb 2025 10:18:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tjyCn-0000OG-Eq; Mon, 17 Feb 2025 10:18:25 +0000 Received: by outflank-mailman (input) for mailman id 890004; Mon, 17 Feb 2025 10:18:24 +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 1tjyCm-0008Nl-8a for xen-devel@lists.xenproject.org; Mon, 17 Feb 2025 10:18:24 +0000 Received: from mail178-27.suw51.mandrillapp.com (mail178-27.suw51.mandrillapp.com [198.2.178.27]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 840ba84f-ed18-11ef-9aa6-95dc52dad729; Mon, 17 Feb 2025 11:18:22 +0100 (CET) Received: from pmta13.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1]) by mail178-27.suw51.mandrillapp.com (Mailchimp) with ESMTP id 4YxJWx75CZz6CPyPD for ; Mon, 17 Feb 2025 10:18:21 +0000 (GMT) Received: from [37.26.189.201] by mandrillapp.com id b78efb45eff9473c8831e3b16f38586e; Mon, 17 Feb 2025 10:18:21 +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: 840ba84f-ed18-11ef-9aa6-95dc52dad729 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; s=mte1; t=1739787502; x=1740057502; bh=Unm7kyf0yewx/61zGSD5OTOtKbpaUHiruf6MwrYYcBM=; 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=SG8tm9VogyshjU1b25z0O6UNlPkwoMsobD6Ajus3dNmbDTWak4gOB5gCAISiubeKZ JgBpIjN7WwSs+GPEmd166SfIv8ESxpRh6cH4DYp9W8V9iEd0SofQL1f2HBbRTu4NRg ds1nNz24Hdkyh4GOJBG/0Qy9Ley0gAbZdzQf7R+HSpHHvPlCU6BZ+7pDQDH7tWwEn0 +IUFmNZ/l4CCmX7/iYHonTyiwdyr8SFSJl91LcSsg4S9JWCehOGteZmnhYPEmex13T HleNij7pimLPsv9MZvrCHujogpJMTnlP/RFPDxngpPJ13F972JipWN+qI125PESf7U utBr/LS14Quuw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1; t=1739787502; x=1740048002; i=teddy.astie@vates.tech; bh=Unm7kyf0yewx/61zGSD5OTOtKbpaUHiruf6MwrYYcBM=; 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=C/GcX6fP7EJhylvOP4pihczVMeMNR1Aj0wrHOFg19Swn/Yyy01V6M8vLPiCy10pe2 yIlt1466utkhspApmhpTzrR1bHHWFCBhIfullnq5CDOMlRKWabCG++tnWWCLS8r5J3 HPq90Oe1MLJZo0AqprqpsF8J2inrzO+AhbiAx6sa5y6V/NtRifhMtfJcVAnPKm4zyM IiNv6spF3XPhzwA2zM+Gfpk9k4KFYKA5x7QtYWetsj1JOB72Kocud4ixmYufO4wZKu 237DiM4qlZAH0OgpQgpf2WE6d+Z1hFl7MAj69mt2mbIcwXxud5JvDZwP0WNwhgzAXF rToR5tAqXgFOA== From: "Teddy Astie" Subject: =?utf-8?q?=5BXEN_RFC_PATCH_v6_06/11=5D_vtd=3A_Remove_MAP=5FERROR=5F?= =?utf-8?q?RECOVERY_code_path_in_domain=5Fcontext=5Fmapping=5Fone?= X-Mailer: git-send-email 2.47.2 X-Bm-Disclaimer: Yes X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2 X-Bm-Transport-Timestamp: 1739787501062 To: xen-devel@lists.xenproject.org Cc: "Teddy Astie" , "Jan Beulich" , "Andrew Cooper" , " =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= " Message-Id: In-Reply-To: References: 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=2Eb78efb45eff9473c8831e3b16f38586e?= X-Mandrill-User: md_30504962 Feedback-ID: 30504962:30504962.20250217:md Date: Mon, 17 Feb 2025 10:18:21 +0000 MIME-Version: 1.0 This logic is almost never called as the only possible failures are - no memory to allocate the pagetable (if it isn't already allocated) this is fixed in this patch serie by ensuring that the pagetable is allocated when entering this function - EILSEQ when there is a race condtion with hardware, which should not happen under normal circonstances Remove this logic to simplify the error management of the function. Signed-off-by: Teddy Astie --- xen/drivers/passthrough/vtd/iommu.c | 20 -------------------- xen/drivers/passthrough/vtd/vtd.h | 3 +-- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index 55562084fc..852994cf97 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1621,26 +1621,6 @@ int domain_context_mapping_one( if ( !seg && !rc ) rc = me_wifi_quirk(domain, bus, devfn, domid, pgd_maddr, mode); - if ( rc && !(mode & MAP_ERROR_RECOVERY) ) - { - if ( !prev_dom || - /* - * Unmapping here means DEV_TYPE_PCI devices with RMRRs (if such - * exist) would cause problems if such a region was actually - * accessed. - */ - (prev_dom == dom_io && !pdev) ) - ret = domain_context_unmap_one(domain, iommu, bus, devfn); - else - ret = domain_context_mapping_one(prev_dom, ctx, iommu, bus, devfn, pdev, - prev_dom->domain_id, - iommu_default_context(prev_dom)->arch.vtd.pgd_maddr, - (mode & MAP_WITH_RMRR) | - MAP_ERROR_RECOVERY) < 0; - - if ( !ret && pdev && pdev->devfn == devfn ) - check_cleanup_domid_map(domain, pdev, iommu); - } if ( prev_dom ) rcu_unlock_domain(prev_dom); diff --git a/xen/drivers/passthrough/vtd/vtd.h b/xen/drivers/passthrough/vtd/vtd.h index b95124517b..72aa9a70c9 100644 --- a/xen/drivers/passthrough/vtd/vtd.h +++ b/xen/drivers/passthrough/vtd/vtd.h @@ -28,8 +28,7 @@ */ #define MAP_WITH_RMRR (1u << 0) #define MAP_OWNER_DYING (1u << 1) -#define MAP_ERROR_RECOVERY (1u << 2) -#define UNMAP_ME_PHANTOM_FUNC (1u << 3) +#define UNMAP_ME_PHANTOM_FUNC (1u << 2) /* Allow for both IOAPIC and IOSAPIC. */ #define IO_xAPIC_route_entry IO_APIC_route_entry