From nobody Fri Nov 29 14:39:58 2024 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; 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1638035560; cv=none; d=zohomail.com; s=zohoarc; b=ny/jqX5ietq0KbOEtQZSwHoRgWpt/Sb421uHOZiWaWPY+BnHgDIWGm6FcQXZ7Idc9dFNy8a3pN69qLjGMpbYZMHsvFXgQnLH7kUPMP3EOY4HcMJf7qGa4P6I+FiW4Bz6HtQY2wcwxAU2yUsb8/Q6P6yXmIRQWmb3cIp0fVVvQEY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638035560; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=FyIIWAAFmJxixgOyTM6dxQSE4aN0oIOcdU1AbmFPmek=; b=L6SGoffQsgtq3i1YUbg5DKhDzkyLrll3YQTitR1xjDSg0fy4a6lLrFlL2bWdEejmdHxpFmEgP/V7GCQBo6wiI5kH5jhNukoNCIyAULWN3/APYugwxWi3NVvUIF3vqy6NEGg2UpoMGrPsMYHrFZCdaK5ob61Babs+IijtNXJEPkg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1638035560386931.0996899538063; Sat, 27 Nov 2021 09:52:40 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.234026.406263 (Exim 4.92) (envelope-from ) id 1mr1ro-0006JF-Mq; Sat, 27 Nov 2021 17:52:04 +0000 Received: by outflank-mailman (output) from mailman id 234026.406263; Sat, 27 Nov 2021 17:52:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mr1rn-0006FF-Vj; Sat, 27 Nov 2021 17:52:04 +0000 Received: by outflank-mailman (input) for mailman id 234026; Sat, 27 Nov 2021 17:52:01 +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 1mr1rk-0004Ih-Rn for xen-devel@lists.xenproject.org; Sat, 27 Nov 2021 17:52:00 +0000 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [2a00:1450:4864:20::231]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b877781f-4faa-11ec-976b-d102b41d0961; Sat, 27 Nov 2021 18:52:00 +0100 (CET) Received: by mail-lj1-x231.google.com with SMTP id i63so25447941lji.3 for ; Sat, 27 Nov 2021 09:52:00 -0800 (PST) Received: from otyshchenko.router ([212.22.223.21]) by smtp.gmail.com with ESMTPSA id f18sm827075ljc.104.2021.11.27.09.51.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 Nov 2021 09:51:59 -0800 (PST) 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: b877781f-4faa-11ec-976b-d102b41d0961 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FyIIWAAFmJxixgOyTM6dxQSE4aN0oIOcdU1AbmFPmek=; b=GHsGKs1gXcGqMfXG6bbH/OmtpfRJ6f2IBuERRrno5etnJdsPQLsI7Zs6gb00nQb9Wd XaMJpZi9bTfkDhrSfhB/PG+F8dXHayOi2JOp7GNHOamHCd/UofJg44rdM0MapglzdlnF UT+akpTYovZ/8ECMghVsw9rP0YIekBJjNETH0T0VpcfAKSWmHKVr6cCTMERyVtFXZhGN BIEqBwwWOYGzQqHHvIfEmzI1tQrdCkt+SguEBW0VVHonIvzTZW8vaYdniC8kmCvBTkKp Bn0asH/tij+CiphOUhMsuEeiPNTYrUJGLVpdw+2YlxHZM3msFn4M8Z2PX7viB001V+Kp xemw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FyIIWAAFmJxixgOyTM6dxQSE4aN0oIOcdU1AbmFPmek=; b=mMHhlfhJq7wjk3wX+zB7ZaEftrlzZP2nZoLcN+8OJ4RvU4DzaQ9SyAD8le8duWLuQ7 JnRmz3X0fHG5L9cqGdompJgUJaBhPSy7yJgoRoaLcR9R+GRGxlkwR2UdjO6TU0zs2Kmb T6oS0v5aQr6QJUKc4ukJko/KzUmJPQnD/5OoB3KW3jebg1asebW+DiPiKAtQ1vOMdpV8 erpWa2aZ79MdDUN2r8/eWiAKfWNElILiTj5YPpNl4FmZ9IHOXMOE0WYOB+SjRnEWQ3R/ Y8YBdnhoL2DbSsn0cH7PJJkEC2A4SHI4T/FBv6EnQcKK5yqeZtcd3pSv4bXAiptUzJjM 7A7Q== X-Gm-Message-State: AOAM530eNFzAlB2Zltmq9pS1UABtA2DPgKSrYf9QVUj9J0HTdmSwCRJW xCNG+tmnXzMVwQ3yGVxO4HZtGeg9fxQ= X-Google-Smtp-Source: ABdhPJzjMZrfxBLx7Z7zAyGCtcqtbrTb3ahQJT7JKt23e9NahIdg8jbACgJGDRuhTOvxmSfSnkckbQ== X-Received: by 2002:a2e:bb98:: with SMTP id y24mr10661874lje.315.1638035519303; Sat, 27 Nov 2021 09:51:59 -0800 (PST) From: Oleksandr Tyshchenko To: xen-devel@lists.xenproject.org Cc: Oleksandr Tyshchenko , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Rahul Singh , Yoshihiro Shimoda Subject: [PATCH 10/10] iommu/arm: Remove code duplication in all IOMMU drivers Date: Sat, 27 Nov 2021 19:51:45 +0200 Message-Id: <1638035505-16931-11-git-send-email-olekstysh@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1638035505-16931-1-git-send-email-olekstysh@gmail.com> References: <1638035505-16931-1-git-send-email-olekstysh@gmail.com> X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1638035562342100010 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Oleksandr Tyshchenko All IOMMU drivers on Arm perform almost the same generic actions in hwdom_init callback. Move this code to common arch_iommu_hwdom_init() in order to get rid of code duplication. Signed-off-by: Oleksandr Tyshchenko Reviewed-by: Volodymyr Babchuk Reviewed-by: Yoshihiro Shimoda --- xen/drivers/passthrough/arm/iommu.c | 7 +++++++ xen/drivers/passthrough/arm/ipmmu-vmsa.c | 8 -------- xen/drivers/passthrough/arm/smmu-v3.c | 10 ---------- xen/drivers/passthrough/arm/smmu.c | 10 ---------- 4 files changed, 7 insertions(+), 28 deletions(-) diff --git a/xen/drivers/passthrough/arm/iommu.c b/xen/drivers/passthrough/= arm/iommu.c index ee653a9..fc45318 100644 --- a/xen/drivers/passthrough/arm/iommu.c +++ b/xen/drivers/passthrough/arm/iommu.c @@ -134,6 +134,13 @@ void arch_iommu_domain_destroy(struct domain *d) =20 void __hwdom_init arch_iommu_hwdom_init(struct domain *d) { + /* Set to false options not supported on ARM. */ + if ( iommu_hwdom_inclusive ) + printk(XENLOG_WARNING "map-inclusive dom0-iommu option is not supp= orted on ARM\n"); + iommu_hwdom_inclusive =3D false; + if ( iommu_hwdom_reserved =3D=3D 1 ) + printk(XENLOG_WARNING "map-reserved dom0-iommu option is not suppo= rted on ARM\n"); + iommu_hwdom_reserved =3D 0; } =20 /* diff --git a/xen/drivers/passthrough/arm/ipmmu-vmsa.c b/xen/drivers/passthr= ough/arm/ipmmu-vmsa.c index 32609f8..451fc21 100644 --- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c +++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c @@ -1336,14 +1336,6 @@ static int ipmmu_iommu_domain_init(struct domain *d) =20 static void __hwdom_init ipmmu_iommu_hwdom_init(struct domain *d) { - /* Set to false options not supported on ARM. */ - if ( iommu_hwdom_inclusive ) - printk(XENLOG_WARNING "ipmmu: map-inclusive dom0-iommu option is n= ot supported on ARM\n"); - iommu_hwdom_inclusive =3D false; - if ( iommu_hwdom_reserved =3D=3D 1 ) - printk(XENLOG_WARNING "ipmmu: map-reserved dom0-iommu option is no= t supported on ARM\n"); - iommu_hwdom_reserved =3D 0; - arch_iommu_hwdom_init(d); } =20 diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthroug= h/arm/smmu-v3.c index d115df7..ca8b5c7 100644 --- a/xen/drivers/passthrough/arm/smmu-v3.c +++ b/xen/drivers/passthrough/arm/smmu-v3.c @@ -3404,16 +3404,6 @@ static int arm_smmu_iommu_xen_domain_init(struct dom= ain *d) =20 static void __hwdom_init arm_smmu_iommu_hwdom_init(struct domain *d) { - /* Set to false options not supported on ARM. */ - if (iommu_hwdom_inclusive) - printk(XENLOG_WARNING - "map-inclusive dom0-iommu option is not supported on ARM\n"); - iommu_hwdom_inclusive =3D false; - if (iommu_hwdom_reserved =3D=3D 1) - printk(XENLOG_WARNING - "map-reserved dom0-iommu option is not supported on ARM\n"); - iommu_hwdom_reserved =3D 0; - arch_iommu_hwdom_init(d); } =20 diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/a= rm/smmu.c index c9dfc4c..ec18df7 100644 --- a/xen/drivers/passthrough/arm/smmu.c +++ b/xen/drivers/passthrough/arm/smmu.c @@ -2851,16 +2851,6 @@ static int arm_smmu_iommu_domain_init(struct domain = *d) =20 static void __hwdom_init arm_smmu_iommu_hwdom_init(struct domain *d) { - /* Set to false options not supported on ARM. */ - if ( iommu_hwdom_inclusive ) - printk(XENLOG_WARNING - "map-inclusive dom0-iommu option is not supported on ARM\n"); - iommu_hwdom_inclusive =3D false; - if ( iommu_hwdom_reserved =3D=3D 1 ) - printk(XENLOG_WARNING - "map-reserved dom0-iommu option is not supported on ARM\n"); - iommu_hwdom_reserved =3D 0; - arch_iommu_hwdom_init(d); } =20 --=20 2.7.4