Message ID | 12-v4-874277bde66e+1a9f6-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 CEF7BEB64D7 for <linux-rockchip@archiver.kernel.org>; Fri, 16 Jun 2023 19:05:40 +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=VIM6k9UPr/8FglE9aIDq67YRZsymiEH166Ch1ic5D6A=; b=rTv68uQfc1MuBx M5gVjl2cJnNuRmXma8Jhb7NJhzmkO4uVKe3QcDtC9l8m3BNabkc3i+A6I6A99nobzvUKK9C56NLz6 kBQ7Ih31gAsvP/BJNqjnsksEp0X9IHOKwXRn7+7iqGoCvrMsuyyt3SM61vcmISK+WEomADC8FXAVg vtnH3v/TaRQW9g0F3dJ6wbj5SYqittZQ4u5OoU+4PVUbMXtMBZcEaK3OgqsjfuW8+NWkPmNKKEWWT pRplREIeEKJ/Zj3CuwEZLvQa70ZqbNJOXPP+XrIu+gwDMWglrsonJ5q57/WcLgbqCRROMYBpmxF9V 82QyN8bjhrBYzCMCBNhw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qAElE-001ZB8-00; Fri, 16 Jun 2023 19:05:28 +0000 Received: from mail-bn7nam10on20600.outbound.protection.outlook.com ([2a01:111:f400:7e8a::600] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qAEj4-001X8M-15; Fri, 16 Jun 2023 19:03:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TZCzK9mJ68daY3j9NxhGgi5HHP4ilRLMSTh8Zqr24Xvna+geqoYNptQe/lFK8bvvUFMoQCzs5veonkbaorbn92rhDuIpXlgD6vlPuw7pHmoshCxVh9l1JULrdpeuJN2HC0F6e7TgEAb2kPGT2v8Yb1c/nHWvpz/UCuEDmXbj77I6GwxFUDCx/epk/75lF0uQFkZ0WPyxdIesVd9aR5iv5YstUhIJZC0qjlPM55jtbOp1knGT7Rmcl+rbW1aCKh7rh8+lT0ZzFenHSP1Z76RzMfBmPWbFe2vbwubMVe+1KKn6HqfGkGyZ0/S7miNG22qcL4aokLmJf0Fg1iDAj0YgZw== 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=fUUt/fAI8ph2DHNlhM4gNIsfEv7BScpXS9Tps+iWPLY=; b=CUGUPeZ9M+f/91kypFo2s67Xypymm6M5WxcyTDEO8nyc8qJmbeTGNyAYg7K72f4nzH9hU4/pT3oRff/CDVTLlEMCn3MyketKRbl/KOtLmri7/r2BVFxEEi4LBhfl+Fcn8drXRWk2froa/VztEDvD77a9oRuiLMjUivoLV+YjtIW8zTo14YNx/VlOGFsEbQlyR8VtPDgfWla/vgx7LlMTgHGxOwCDfcxIl8jcEJMpfYLbCJp6oaKVNQA798ZhLq1Ju82Z0p0oIMBtUwfU9+krYkJkDyN3wprYSJqQ6VPNCna3xY97G9EwMpW/ZyVSa3H/YX41naZr98QwskIzSC2wvg== 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=fUUt/fAI8ph2DHNlhM4gNIsfEv7BScpXS9Tps+iWPLY=; b=ZFzSUWhdmbQsvIhGBrN03mUboymBDRocLFtPTjE7W5N6NGb08zCV+v89o73J5RuwTpnkwgOrrVPi+dropWyszTojOAXIkj5WzcgoHFca6blAejh25r57BsvZu+XNFWHM7fJpmwk/V+4f+jFKSRcWnN6MO4dA37lX/3ht0HpNTmwjwyVmvLmmS4cjF5T1GPu9DRMf6Rx58Jz0r0lXW29K25cfZFAC8oHMvPxuT46UiWXvW7kHdTo63uy1jjl5ZBYorBmnFYK3EW+jdW61cAEn6MhwDMgxHjqqj3ta+MEC40jpqmI3d2pfA7RkB3OpBl0937EPOvQVHAHNQSb5CAgDnA== 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 SJ1PR12MB6051.namprd12.prod.outlook.com (2603:10b6:a03:48a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.37; Fri, 16 Jun 2023 19:03:04 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f7a7:a561:87e9:5fab]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f7a7:a561:87e9:5fab%7]) with mapi id 15.20.6477.037; Fri, 16 Jun 2023 19:03:04 +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 v4 12/25] iommu/tegra-smmu: Support DMA domains in tegra Date: Fri, 16 Jun 2023 16:02:41 -0300 Message-Id: <12-v4-874277bde66e+1a9f6-iommu_all_defdom_jgg@nvidia.com> In-Reply-To: <0-v4-874277bde66e+1a9f6-iommu_all_defdom_jgg@nvidia.com> References: X-ClientProxiedBy: MN2PR20CA0060.namprd20.prod.outlook.com (2603:10b6:208:235::29) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|SJ1PR12MB6051:EE_ X-MS-Office365-Filtering-Correlation-Id: 719f4613-fe12-4385-4593-08db6e9c4b7e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bph0ONWjIbIlYMdA2cwyoThAzYx/yipSrfMRcOAU2mLkSHS5eDZDjWl603gdQrti4gefZjy5D0SoKy6S46cHg/WuWlhB8+Ww63CkUCBG+vzMWyIxaYZcWlZz4N5G8lCc2NSTssGWp3RyznYTGJldbvr5Xpxgm+gxru+EpSv6dNHmID8jSBbB1/snWSUtqS9mj31gFk8uM7a5MR9NiJz2XNsULQkc5/fY5jne7vXVEwp9iw6SHlIzPX7Pd9qnf+i7fcl9J1P3Vj2EuLCpfzBtv+oc8zc78g5x6BM8AoXxlNSjsrzJHDsewb5M7VrIwwO3O3qHR8zwVbL38WNWp3zag+2qxvv9E9HJHmOsNhPRJ8kz5pOMGWFNUyatGRtllBaB5DKkfqbkQQVrHsy8U7Q2/dZR22DZUOezH7GMh0K2ePJwkOfYUkMf8uCdV1MO+w3heSISioyFzf5+OyQ78xznPRj81D6X6mfnaOuVcw2+8jqZlaeojQYnDKMkALK1KgA3Wftz543gpuucPpQQlW4Xd+yuuXBw12xnGcCwnP30hLflhmzd9zOoKdfGq1B5cH8qg2F7Krahd/NTyjIFd7e/PWeNoGA8a8/VB/OZmdx/nb0= 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)(396003)(366004)(346002)(39860400002)(136003)(376002)(451199021)(2906002)(83380400001)(2616005)(36756003)(86362001)(921005)(38100700002)(8676002)(8936002)(5660300002)(107886003)(66556008)(316002)(478600001)(66476007)(66946007)(4326008)(6666004)(6486002)(186003)(7416002)(6506007)(54906003)(7406005)(110136005)(41300700001)(26005)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BVhCJLw/cV65UtBr6Vi9PKllG5qjOsCgk3SRAU/O+fsEwAnvsDzPhMXQguXoMipvDIATJJVPbkur0ixltovIGXiFFzJ15rBNpz0hF+XcXH+ZM4Z42cwU+NhSeJ1Lyis7xy1eDzR7lj+8DnPLuYh9JIi1tHy9qqwzJds2er4bXgLclm/ow6+O08s+h39B2ySGODgNxvr4LhDjGjvyj8D4yPvfAzXZw4SFalc2ZYbGgJP2OHPSx8T2Xovks5hdmd/p6PUGvTImr4wS2rdq6VFvFqoERc1EpUpbVSLXbgEH/R0SkDQ4muBRHGrgbz3+Y0FeTE8Po8aOOOCqy9mfyVDjZRVZfC1/WvM7mec5oMefy/9C5sSQAnW4uM01me3fzbsIv3EOB4lrM7YPr4u8SJFMTSHhSRunuEasR8MDiHNQGSYNZP5JhQpaZRhYnKjnTWRiEgZelB0e5EY5+Vc7zlgH6PxKy0sE4A5HmLgOFIG+1maAMf3xJplQhXfvvEI0PesfahpyKrOfazLVAkAakeNSIMdrm8hYSFC8oCfbtEkc+cFmT9x0MXcLLyy+whRflfiunAUtNvKwxS8Qq8ED05bd6S7WPLb0LO3BbhXlpKpx6ZbQeDabQdZi5QLsrjJbKpHORs4hLFJ5xtFNA9XqzIYPW8BsyKJ3IWNrV8ZB5UYxHx2ZrfKK1S0+qwfmJN5P08EVf4xOrKlCOomm3DHQxXGkNps8IU3vv8vtSBPdUMtY5LLTgKE7CNBicf253bTnq01BG1bahEGwi1COAL9obFT9dL6XwD/Op55MPtfEgsj64waqGy0HyjK400BR0PwMuDGaPgJvofSPv24byyBiMCMNxdfXeKVekyg6QiuyQz3ibY3x66cC25QzmKdRxXXn5knrUzLl3xZWylE6Ea0lc/9LUj7Mem92VXpRQSOC7qJqx0cdfhu3aD4w5IRB9E6giHth9j3ElJH3YnDe26AiwMYOYD98HLn24PSwC/yvv3/947bEZPG8RvyKOcs02xes3g5Zx7RECyeZEAFcS0D92F1GBVfYLGD2XqwryIlNk5doj0VTyk2mCuWTaQk1PoNiYvUkV4M+3A4pV6Zd8dqsc0fMuUltw1ClFB+HCp0FYPrKVlcsO5jmeopTASRrUAxRUUZOrDMocvxPBLVdw370uALVCmxWw06C3Ocva9Mai9KfUgDktbMRQi3Je7VNJtdYBb+3gNpfaPKo0KKkJTd7m4hgiCNOVVWGiTh+kIvlls+UqhUpTTHFBwpgaY5RWkHjPP77avhJSX9DIFXVVZnXukXofdtD9XXLa9m85XjZOJFLy3rulW1RbP8m3xWCC8oboou0F5IQAsyzr94tV94a7fu9f7gZ/FJtaLwr/5K+KCSafszLT0VO0uSn8MS9bh8UcsSeOpGcBnleM/U8veV2K0BuammAy4fWg2G/3jMyKdssfawRNshb5EdFAt8eFJrEiSqDPRm0Xwm3KHV2oU51BTKF9nNTO5SyREu0dnz2wmCHvqoSvPxXPhCw3wnxPiZjemDMTYrTE+sm/tjb9w1MZGqXdsTHP4qzBr7xSgmIewZ15czR9ICXPAbXNcCtaSTjxr+l X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 719f4613-fe12-4385-4593-08db6e9c4b7e X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 19:02:56.5004 (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: eCiSm1w9oEWT2k5pY72RjoexHTrcywDz3wTSt3Z7UUf9FAfgXrb2VXtguyudLbzk X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6051 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230616_120314_428614_FFC2E773 X-CRM114-Status: GOOD ( 13.01 ) 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/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index f63f1d4f0bd10f..6cba034905edbf 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -276,7 +276,7 @@ static struct iommu_domain *tegra_smmu_domain_alloc(unsigned type) { struct tegra_smmu_as *as; - if (type != IOMMU_DOMAIN_UNMANAGED) + if (type != IOMMU_DOMAIN_UNMANAGED && type != IOMMU_DOMAIN_DMA) return NULL; as = kzalloc(sizeof(*as), GFP_KERNEL); @@ -989,6 +989,12 @@ static int tegra_smmu_def_domain_type(struct device *dev) } static const struct iommu_ops tegra_smmu_ops = { + /* + * FIXME: For now we want to run all translation in IDENTITY mode, + * better would be to have a def_domain_type op do this for just the + * quirky device. + */ + .default_domain = &tegra_smmu_identity_domain, .identity_domain = &tegra_smmu_identity_domain, .def_domain_type = &tegra_smmu_def_domain_type, .domain_alloc = tegra_smmu_domain_alloc,
All ARM64 iommu drivers should support IOMMU_DOMAIN_DMA to enable dma-iommu.c. tegra is blocking dma-iommu usage, and also default_domain's, because it wants an identity translation. This is needed for some device quirk. The correct way to do this is to support IDENTITY domains and use ops->def_domain_type() to return IOMMU_DOMAIN_IDENTITY for only the quirky devices. Add support for IOMMU_DOMAIN_DMA and force IOMMU_DOMAIN_IDENTITY mode for everything so no behavior changes. Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> --- drivers/iommu/tegra-smmu.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)