Message ID | 21-v3-89830a6c7841+43d-iommu_all_defdom_jgg@nvidia.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 8E4E0C7EE2E for <linux-rockchip@archiver.kernel.org>; Fri, 9 Jun 2023 19:57:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tfVEbhqxF9yOA6aTXfXDYxd2Wk7EoBZYVXET7GlFFeo=; b=vZUQOvuTd50GIF S6KxU5n3qjwZv0kzTRa4ccdwGey48QyOAAq8DQr5wW0AfzyzwyN6/rVBiHYS/ox8yGJK+gjacq2W5 nwBUDAYWt37ZEhDR+RAMc/BY0XnjHJHKpeXI+LTeRjBg83ci6oFU8q2wFPtjP+DzurfMLkxeFTKCO TJUBOtUyR64UXGDYVZjsVfU6Y3UT4G6v91XX7aT36iQpD04HrfrxEcVXsJObEuenik6isWFaQwPGv 0khMf0xsgif2rDzXwGGaDVWS/AN4HxodAUMevnsAo0ryFQ2yNCZjl3xpr7DHWQL/+cuqiq8R9zzDj G4neGdwgIftw53wXmVAg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q7iEc-00E5Jq-06; Fri, 09 Jun 2023 19:57:22 +0000 Received: from mail-mw2nam12on2061c.outbound.protection.outlook.com ([2a01:111:f400:fe5a::61c] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q7iDn-00E4R9-0a; Fri, 09 Jun 2023 19:56:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DtKiYKUG70CTMaEdKZOfOigG9Iwe7EkWaDS952XFYttSPiEdg/KwPyi5rv2YveA9L+5GcL5wHLxnq1MRRxkHKDv+tvQa/sw+jRFpKY/wh8Cidieu+7vxgr6MT84z+jTLcchTygXTd2E+HqhTjiLxdG9eHdBK5Rh8IJ9CdvhWbtaSXDQFOzlpjNKQkgwvlcj9DzRlu/DAubU2jZOW39PRgtpMn2O49HZ9RpbyeKV5BYKMHm7fwxdbRpB33Rn0ieeHrEmzbNHD4ktWW++NQ3YYqhZWjFVqS4w+l8LetDuY1uEQ73EelzltWNAAKcbrDbTqHLvsZPK1ZSgEL3cTUwnhVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZbWRU94XzyWJt6kncIgWnjN2oHbRSgh268gPeGHXQkY=; b=ZZB9K3Di58xwCOaQ2Mbq2jXfQtlnuZwKCHUNxeMzXiSSo7pVqAHq2nT7O5gUKWSeQ5+GK67c3zpt9EiOtQ61E7HAJk6MbN5ADDG7a2t6OGe59nncnw+XlbqlUynVrlFIKjH7i41qp/I082jXILXv4sxAuvpksC9NpXSrHXtmX8eiF87aGsUUNYkz3v6Fdr9qJHM1+8xF08lWr476xRCAgN6Zwo2HjtM27YkYGrdYO5ktn2jj+e6ZOT5iYRu0SsaOHCPGH53PFF+VjSzsZsMY3iX/6Qe9yKMNDpgEI4ugR3jpbYSmTNgA+a/tm59JgDZljO/QgN3LBLvZ036Z1SWNzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZbWRU94XzyWJt6kncIgWnjN2oHbRSgh268gPeGHXQkY=; b=KE0E0t79ljo9t3ZQRZuf0iTok0Dpueb7H9ODmPsYq9S4LwxQgcRMx8HKhcVl7kvk04YPHI/J8IcFKXXOELaFqV175fYtKKFyytZ5xtdwOjU66NHZs+rOEVDCkn8ffy1WL0pLGI+WLG7+w6dJGGO0EJZmJf47J8+R3LVdVxEjUqgDagRFCl26/YNHmp25OP+y+Hsh23lX338qZrlz+nmufYwWi5ahv6a1B5po0EkMZ+y/2F0iyR8+tcvEgGdx6bbZP+n/R84X7c/qugbxYs91CQE1kdg81kahvGv3zTpW9S4vMiXxAqB/qseEby5QbIBxQC3jdF4UMltwwCoM25PM8Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by DM4PR12MB5264.namprd12.prod.outlook.com (2603:10b6:5:39c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Fri, 9 Jun 2023 19:56:20 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f7a7:a561:87e9:5fab]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f7a7:a561:87e9:5fab%6]) with mapi id 15.20.6455.030; Fri, 9 Jun 2023 19:56:20 +0000 From: Jason Gunthorpe <jgg@nvidia.com> To: Andy Gross <agross@kernel.org>, Alim Akhtar <alim.akhtar@samsung.com>, Bjorn Andersson <andersson@kernel.org>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, Baolin Wang <baolin.wang@linux.alibaba.com>, Christophe Leroy <christophe.leroy@csgroup.eu>, Gerald Schaefer <gerald.schaefer@linux.ibm.com>, Heiko Stuebner <heiko@sntech.de>, iommu@lists.linux.dev, Jernej Skrabec <jernej.skrabec@gmail.com>, Jonathan Hunter <jonathanh@nvidia.com>, Joerg Roedel <joro@8bytes.org>, Kevin Tian <kevin.tian@intel.com>, Konrad Dybcio <konrad.dybcio@linaro.org>, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-s390@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, Russell King <linux@armlinux.org.uk>, linuxppc-dev@lists.ozlabs.org, Matthias Brugger <matthias.bgg@gmail.com>, Matthew Rosato <mjrosato@linux.ibm.com>, Michael Ellerman <mpe@ellerman.id.au>, Nicholas Piggin <npiggin@gmail.com>, Orson Zhai <orsonzhai@gmail.com>, Rob Clark <robdclark@gmail.com>, Robin Murphy <robin.murphy@arm.com>, Samuel Holland <samuel@sholland.org>, Thierry Reding <thierry.reding@gmail.com>, Krishna Reddy <vdumpa@nvidia.com>, Chen-Yu Tsai <wens@csie.org>, Will Deacon <will@kernel.org>, Yong Wu <yong.wu@mediatek.com>, Chunyan Zhang <zhang.lyra@gmail.com> Cc: Lu Baolu <baolu.lu@linux.intel.com>, Dmitry Osipenko <digetx@gmail.com>, Marek Szyprowski <m.szyprowski@samsung.com>, Nicolin Chen <nicolinc@nvidia.com>, Niklas Schnelle <schnelle@linux.ibm.com>, Steven Price <steven.price@arm.com>, Thierry Reding <treding@nvidia.com> Subject: [PATCH v3 21/25] iommu: Require a default_domain for all iommu drivers Date: Fri, 9 Jun 2023 16:56:09 -0300 Message-Id: <21-v3-89830a6c7841+43d-iommu_all_defdom_jgg@nvidia.com> In-Reply-To: <0-v3-89830a6c7841+43d-iommu_all_defdom_jgg@nvidia.com> References: X-ClientProxiedBy: SJ0PR03CA0361.namprd03.prod.outlook.com (2603:10b6:a03:3a1::6) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|DM4PR12MB5264:EE_ X-MS-Office365-Filtering-Correlation-Id: 73a1c917-d938-4433-387b-08db692397bc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Af5P6nn/WVyww/eIwpgHyUyG9BoqjTwe+efgDPoxRCyeRicQXrrr0eQDTX7zeN0rQYnSqi0mjNzCKuJVydvnLNxtxErYRq+Blz6h+e7kk7LG4LNVh6Y1xyHVx+96BXMj3JNkt6k2Zjsv5eSRrPPOnil0IR7BiK+BFvPc9o+GQ6blLeUnqo9vdtO76kgaKuGNZHR33Z5yY5UjFv0l/MAOYZMAEjBxE3c4mCxdegEN+2vl1lK2HKFYWYuxmo0lY0k3RHWR/gxxmCH/vu4T3Kr3giEAu2qg08XaCSFNaQzdl9WFyIQ9ZqheGGbFT3OJo5kUn3gQfiL6+wfrfTdgA5qFr7RmZMs6EwRdBMDxOEDaXrUwRJGWRw9u4ztw/0EDYjPBi/gcyBnIsAAf4arZl4iPw9RjRX7EQ/+ir7Hu11HJzhpupDbxpozTQnmuvnTnckzEcbpd48x9CyYtbtHH+nPP1becb2kJX28+C7RvjRiwcUUb5TTQYLBcLrbSXzt00lAIVbYbA3XkxtSB3sM/vG+YcyBrBWPa52oOJ0k1LoGjwFRNC9GI54uG309sCJWT3WX+Qz9Jn41VEhcwGZZuhZP4AULA/1dXh2eMalasfJwhiDo= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(39860400002)(366004)(136003)(376002)(396003)(451199021)(2906002)(83380400001)(36756003)(26005)(6512007)(6506007)(478600001)(54906003)(110136005)(107886003)(6486002)(6666004)(8936002)(7416002)(7406005)(5660300002)(2616005)(41300700001)(66946007)(66556008)(4326008)(66476007)(8676002)(186003)(316002)(38100700002)(921005)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DrjMK7Twn+YLiri1HGiM2PSPYXIz5XJV2fVE/atLm+0i4hjGqDXVzbW06Yqf4as72qsjRd1HXBRQ9Xtduqt186vDp4Nes6s+SMKrEtzYoWzZaLRHBoGU+qliyhf24abHDiZog+HgJsOrecfDTMdPZVV1ps4vvNzHVXKG1GVFkzCCRdTMH/5i9AybAlciNtkFvXxrEKvD7v1wYvIsg/F+sySVXcd7Wgz2ft7KbQqSS47d5XP2w/7O+5K6A0fyiKZc/7LS5Lgp1dnG4T9MiN5rYzQxCZ2oBeFD/41ds7T2YtVjCeRoIA6yK9jgNq9IvrVc54ZxMZy/NZpNG2VzyWEKQ8abHVTkQXgq1X67z/qNKWO9X/lto+M/QCTjPQ+FbU+rI1DCmojIG8UbQRfGoW3kSDcZd41z/WgklwrrxLHy7aP1PVFlwNleioQBTDG065WOpR/WSDjFSNMJ4lpFUTn3w9M7ulQ4vzXyHYqhyeD93i6hjYN+PZqRTBgt2/FyL5XB3Z0YfzP566MkiyHq2NlRwDmTqnGIaz9pmrzFYiklQ7If/BSYh4tm6MCQgIJxmitt/f/OC6y4oCcNU0SLqjxb4bilsDJ5EiulOtli4mjnu1D6a6+xbsLBCMdpsPtjBBiXQYFyA+p8yPEj81Fsgk9+iO8Oz68WZz4OQXnUmeayME/4lg/9vJrAODlP+vCAVm4pr0v7fJaNTFARzhAdeiv2j1evfaXhh9TbvSyKtGrZ7DnQaZInADk3kWZLU4T2obDvmy/VpdHGCVHD0x9l63DW9QWj2zif7fKV+U+vRgEisQuMlvB+0KHXXFGurKii7lkQId5tD57KIVAxKQC4uWmmqH3KxgDzD2m0r7rYOnS585mhHu+B5bLmBQUsLguBMTdruRt6cEWlX8iuy7d0KLKzRAirFK+wT87JioSevbvyMX+jLeyvTLGI/NnMwa0o3ZD3LzJPgQcgHUfQlttxLzyxN3xNA/MpT1Ofzz6S5Ec+r363W5qjO8kfs22gcTzI2H7rSViPpQkiuRf8Kh6U2OxqrRzNHBL9IQWJi3g6UlnZqzi0Y6kh3ODxwJc0gmVnZaV4Xe5lcP/kTJDA5DIveyaRTFAssoeMukEezt5Vyb5Qmu/dUTafPZWli0xTIpn5MBeHHIZg4qFExGJUZhZ06ikq3dessGxZCHfKRa3nrAV4NsWU7HR54gWu2OOxEkCsCkX+OyvVuUrscJc5EoEmjLyxGnzLlquezpivxuwvJXobrJodukwsjD2Y1amz/N2UGK2i1s1Jb4Em//kBzqOXkYaMjd9HClYz755If3MZAQzU5W2vIW1U+DpuAbGOi6B3ysz9c0HQ4dfElJdB8X2Yq850k0iDA0kIRInvqrOOLGDRP6BnVLmWLJ+Hfk8Ih67ImVE5TUrRfo7mnK1rQScRrTmNjJFyQtqYmHuOAzhTrXm4BlGurikw+7mTTnXr4yjFba4cIB7lNK2obv97RcfWckeZX8DL18Hgtt+9Seh27Y13iBCdNjdh+aRRKrQ1k74OKpjabIGLafDCw05ODHJWH1d8d+WXnH811D6OoKGU1heotL9gZJGl7y12AeOAyYjIXO/n X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 73a1c917-d938-4433-387b-08db692397bc X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2023 19:56:19.4856 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ycljoVPSWZc1CUghZh4Mm5MJeEqyOgaIdfXw5dCDuCze/aY6FL1o4WhBZU98BfOH X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5264 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230609_125631_262522_83BBD6C0 X-CRM114-Status: GOOD ( 20.40 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms <linux-rockchip.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-rockchip>, <mailto:linux-rockchip-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-rockchip/> List-Post: <mailto:linux-rockchip@lists.infradead.org> List-Help: <mailto:linux-rockchip-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-rockchip>, <mailto:linux-rockchip-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" <linux-rockchip-bounces@lists.infradead.org> Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org |
Series |
iommu: Make default_domain's mandatory
|
expand
|
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index e60640f6ccb625..98b855487cf03c 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -1805,10 +1805,12 @@ static int iommu_get_default_domain_type(struct iommu_group *group, * ARM32 drivers supporting CONFIG_ARM_DMA_USE_IOMMU can declare an * identity_domain and it will automatically become their default * domain. Later on ARM_DMA_USE_IOMMU will install its UNMANAGED domain. - * Override the selection to IDENTITY if we are sure the driver supports - * it. + * Override the selection to IDENTITY. */ - if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) && ops->identity_domain) { + if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) { + static_assert(!(IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) && + IS_ENABLED(CONFIG_IOMMU_DMA))); + type = IOMMU_DOMAIN_IDENTITY; if (best_type && type && best_type != type) goto err; @@ -2906,18 +2908,9 @@ static int iommu_setup_default_domain(struct iommu_group *group, if (req_type < 0) return -EINVAL; - /* - * There are still some drivers which don't support default domains, so - * we ignore the failure and leave group->default_domain NULL. - */ dom = iommu_group_alloc_default_domain(group, req_type); - if (!dom) { - /* Once in default_domain mode we never leave */ - if (group->default_domain) - return -ENODEV; - group->default_domain = NULL; - return 0; - } + if (!dom) + return -ENODEV; if (group->default_domain == dom) return 0;