From nobody Fri Mar 14 06:43:54 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=quarantine dis=none) header.from=vates.tech ARC-Seal: i=1; a=rsa-sha256; t=1738839000; cv=none; d=zohomail.com; s=zohoarc; b=S0sUQ2/jvGS/sxJj1/4c7HQ5TVc+EnslyS4wGmi/ur6Z5lEcu/lR8X/3dMek4TRqVvp/l25g2Fh7wMBUIxW+g5mRKccDRi+ZTGFuFzq1sN4p3P1/J3aFzMjHry1H7KOiPVWslHoi2QWqmw16ANZVhuCPjRAtKuxUQegYNNhYNBg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738839000; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=L4o2ZZgMga0nK/q0vLs6VvOXTbOpIP3PAVzgoEdo7vE=; b=Nq2wwJo4RFKkk4hddw93Z04MzSYPbTjxvNmzndjcyDhP3hooc9q08Re6qAY7IiSBDbOW9cf/B9tu1qvPQsh0v9CUgajaFqrHwML85UXfHNvc21TnA9jfDl+gIdJLqFe93Ss4se+XFCgw4hFTZzY2vwlxUREddLJPaXIUDDdvINE= 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=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1738839000163338.98647929898175; Thu, 6 Feb 2025 02:50:00 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.882713.1292809 (Exim 4.92) (envelope-from ) id 1tfzRt-00021B-N4; Thu, 06 Feb 2025 10:49:33 +0000 Received: by outflank-mailman (output) from mailman id 882713.1292809; Thu, 06 Feb 2025 10:49: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 1tfzRt-000214-K0; Thu, 06 Feb 2025 10:49:33 +0000 Received: by outflank-mailman (input) for mailman id 882713; Thu, 06 Feb 2025 10:49: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 1tfzRs-00020y-Dg for xen-devel@lists.xenproject.org; Thu, 06 Feb 2025 10:49:32 +0000 Received: from mail145-20.atl61.mandrillapp.com (mail145-20.atl61.mandrillapp.com [198.2.145.20]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 09cfcd29-e478-11ef-b3ef-695165c68f79; Thu, 06 Feb 2025 11:49:29 +0100 (CET) Received: from pmta06.mandrill.prod.atl01.rsglab.com (localhost [127.0.0.1]) by mail145-20.atl61.mandrillapp.com (Mailchimp) with ESMTP id 4YpYkv4Y13zCf9KCn for ; Thu, 6 Feb 2025 10:49:27 +0000 (GMT) Received: from [37.26.189.201] by mandrillapp.com id c7b5e5191f3f44ddaecfd120a10a4d98; Thu, 06 Feb 2025 10:49:27 +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: 09cfcd29-e478-11ef-b3ef-695165c68f79 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; s=mte1; t=1738838967; x=1739108967; bh=L4o2ZZgMga0nK/q0vLs6VvOXTbOpIP3PAVzgoEdo7vE=; h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version: Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From; b=YYAUZTOwsSYtRYYxAQqiBU8Hk3QzDLt4LkH6/u9P6feoaj31B8hm2mbs68PZUt1We gWyxPGBH9GJCoubPSFuTIrJA4sTu86CqDEe/wHfPE5fFmTdnnkO55Gjq1nvJeJgZTY HOQKxbf70ts6Q6C8+9tbf88bSvUt6zkKwY2dPjoR8YrGHDBXm/PMZqByrrLuu/wFol zl21aYLobYMglFZXxAoyFAnA2VJR9NIAFcLA5v40+lPL0PSrSGpIj7TfjEjYxYLgwD Yvlf6myEKYp8C9+XkzEexRDlI5bvz+Lo6yRi68Z62TuEbdaTLibDyVOft2wFlVBHhH 1CoQIGi2GVRvA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1; t=1738838967; x=1739099467; i=teddy.astie@vates.tech; bh=L4o2ZZgMga0nK/q0vLs6VvOXTbOpIP3PAVzgoEdo7vE=; h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version: Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From; b=Bui21VqQgjYCybM4iMw/deRmIsSiFZY8LAIiqW3ICeBwdoYiki2xQYmnqfQvukHVB g7xpYTYejkJCuw51Ax/3eHx79tkNpLT5uoCPcNX8gJ1xdnnzPqxpIqjU55weasBoOJ z5oAIh60LeCFtMkFwvSVP4QrPITOA17+EHtqbDQDgeKHijKItF4gz+HYHbPLVQSwhY h1XmThbq4g+1GkEl3nNVhrhQ15xi2WmJpLew6bsosWRfwODAErM8zBk5IYDMTd/FKR QhACFl1ddePM5vCO6Vz50tCmF9eyBb9aiOGlX0retxv8tS/ixxKYb5RNHXzIGQhjv/ WY4ahO5OsN4fA== From: "Teddy Astie" Subject: =?utf-8?Q?[XEN=20PATCH]=20iommu/amd:=20Remove=20redundant=20values=20redefinitions?= 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: 1738838966668 To: xen-devel@lists.xenproject.org Cc: "Teddy Astie" , "Jan Beulich" , "Andrew Cooper" , "=?utf-8?Q?Roger=20Pau=20Monn=C3=A9?=" Message-Id: 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.c7b5e5191f3f44ddaecfd120a10a4d98?= X-Mandrill-User: md_30504962 Feedback-ID: 30504962:30504962.20250206:md Date: Thu, 06 Feb 2025 10:49:27 +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: 1738839003027019100 Content-Type: text/plain; charset="utf-8" In amd_iommu_setup_domain_device, we redefine req_id and ivrs_dev without using it the first time we read it. This is effectively dead logic that we can refactor. Signed-off-by: Teddy Astie --- xen/drivers/passthrough/amd/pci_amd_iommu.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/pass= through/amd/pci_amd_iommu.c index f96f59440b..1511a2a099 100644 --- a/xen/drivers/passthrough/amd/pci_amd_iommu.c +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c @@ -147,17 +147,14 @@ static int __must_check amd_iommu_setup_domain_device( if ( rc ) return rc; =20 - req_id =3D get_dma_requestor_id(iommu->seg, pdev->sbdf.bdf); - ivrs_dev =3D &get_ivrs_mappings(iommu->seg)[req_id]; - sr_flags =3D (iommu_hwdom_passthrough && is_hardware_domain(domain) - ? 0 : SET_ROOT_VALID) - | (ivrs_dev->unity_map ? SET_ROOT_WITH_UNITY_MAP : 0); - - /* get device-table entry */ req_id =3D get_dma_requestor_id(iommu->seg, PCI_BDF(bus, devfn)); table =3D iommu->dev_table.buffer; + /* get device-table entry */ dte =3D &table[req_id]; ivrs_dev =3D &get_ivrs_mappings(iommu->seg)[req_id]; + sr_flags =3D (iommu_hwdom_passthrough && is_hardware_domain(domain) + ? 0 : SET_ROOT_VALID) + | (ivrs_dev->unity_map ? SET_ROOT_WITH_UNITY_MAP : 0); =20 if ( domain !=3D dom_io ) { --=20 2.47.2 Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech