Message ID | 1524824826-29473-4-git-send-email-nipun.gupta@nxp.com (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Bjorn Helgaas |
Headers | show
Return-Path: <linux-pci-owner@kernel.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8EEA8602B3 for <patchwork-linux-pci@patchwork.kernel.org>; Fri, 27 Apr 2018 10:29:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F93729351 for <patchwork-linux-pci@patchwork.kernel.org>; Fri, 27 Apr 2018 10:29:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 736E32936C; Fri, 27 Apr 2018 10:29:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19F3029351 for <patchwork-linux-pci@patchwork.kernel.org>; Fri, 27 Apr 2018 10:29:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757991AbeD0K2G (ORCPT <rfc822;patchwork-linux-pci@patchwork.kernel.org>); Fri, 27 Apr 2018 06:28:06 -0400 Received: from mail-he1eur01on0042.outbound.protection.outlook.com ([104.47.0.42]:45312 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757811AbeD0K2C (ORCPT <rfc822;linux-pci@vger.kernel.org>); Fri, 27 Apr 2018 06:28:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=vyhaqY+Sk1z77HT3LMDiRsi309OonR1fbf2wgiIq7t4=; b=gB82GRwYWXHinp45zkYJmQDUp7gbH1hyP73sL8sGa1dJJ2voVjeLnU0qYPvknKW1wcOzV8xf23tZkTsphpCRln/j6NdYWn/jdTW5feLFMmZdHOqH4gwAS3HH4Arm1gKE+c4E7+6gLMrs0HNFkfuBeHOEpo+1ju85rcOXlRWDefE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=nipun.gupta@nxp.com; Received: from b27504-OptiPlex-790.ap.freescale.net (14.142.187.166) by DB6PR0401MB2422.eurprd04.prod.outlook.com (2603:10a6:4:4a::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.15; Fri, 27 Apr 2018 10:27:54 +0000 From: Nipun Gupta <nipun.gupta@nxp.com> To: robin.murphy@arm.com, will.deacon@arm.com, mark.rutland@arm.com, catalin.marinas@arm.com Cc: hch@lst.de, gregkh@linuxfoundation.org, joro@8bytes.org, robh+dt@kernel.org, m.szyprowski@samsung.com, shawnguo@kernel.org, frowand.list@gmail.com, bhelgaas@google.com, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org, bharat.bhushan@nxp.com, stuyoder@gmail.com, laurentiu.tudor@nxp.com, leoyang.li@nxp.com, Nipun Gupta <nipun.gupta@nxp.com> Subject: [PATCH 3/6 v3] iommu: support iommu configuration for fsl-mc devices Date: Fri, 27 Apr 2018 15:57:03 +0530 Message-Id: <1524824826-29473-4-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1524824826-29473-1-git-send-email-nipun.gupta@nxp.com> References: <1524824826-29473-1-git-send-email-nipun.gupta@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: BM1PR01CA0096.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00::12) To DB6PR0401MB2422.eurprd04.prod.outlook.com (2603:10a6:4:4a::25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603328)(7153060)(7193020); SRVR:DB6PR0401MB2422; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0401MB2422; 3:WPlv4XJXz9eClpl5s+w24kzGADewnhDeBw/noimdxwtTvnxEmm1L6xykohnO9asYavyM2Bbqi33LtCjGTH+BGbOyPpb9jY9eBid8YhH+bDrauIH5ZNhjWxawlUoO0pNgPifsq90UHBchYdbaAOy2fB57n/buiG3GMyUhT1Xqgm9rWJ8V2Zrd6ZjURMtVfdyCQNc6EDar4ImqNTdkJWU7mrLnBfaB0huFCxJUxux8XiEZBbAMF1A4sJW5dE+4w0Sd; 25:zh8kisBAGRJ6MLpVxJs/tlyE9CLe5aKrbjJQWrQDBLnWD+KGBXCBVk7VXaC1logJNBxAZTIKpzEVJYE6L/iPVtzUw1nTCtoUDbV2hr4SxdIRD6cewGLLviwRTmQTs6ff8Q4aRZmQq5xUqT4g8eI8ZetB+NhyzutsfTWRGblpRMO363SQUzp2o+9/MuBBj7aE5zs2h1d7GX/y8Th6IM2W5Cvx+6VWyEnvJ0ebCygZo4AzOOTWcxPlm34dxObJCQxRSinlTuyUMzueVucpUxSoQo49JRO6EB+weUTPhOvlzffVJ52XdRzgtTTJYvJD3QA9x1/R+zKTRsUqyxuBSRpjPg==; 31:HRNbOX8ValqDEcykoVGWpdU7pApcg/IDnnEunffmWCNgf5A5xzG4HHgTFLrVV43Cf7DqOWRlRUKIO4FxDqmdSAJhUaHorkoaHh9gIVz60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BCA7F175C0B34E99E68D0@DB6PR0401MB2422.eurprd04.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231232)(944501410)(52105095)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041310)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:DB6PR0401MB2422; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0401MB2422; X-Forefront-PRVS: 0655F9F006 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(396003)(346002)(39860400002)(39380400002)(376002)(189003)(199004)(2906002)(86362001)(8936002)(6116002)(3846002)(53936002)(25786009)(5009440100003)(305945005)(48376002)(6512007)(6666003)(6486002)(4326008)(39060400002)(16526019)(186003)(478600001)(76176011)(52116002)(7416002)(44832011)(26005)(105586002)(2616005)(36756003)(8676002)(81156014)(16586007)(486006)(66066001)(11346002)(50466002)(51416003)(446003)(956004)(97736004)(106356001)(386003)(68736007)(81166006)(5660300001)(47776003)(55236004)(476003)(50226002)(6506007)(7736002)(316002)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0401MB2422; H:b27504-OptiPlex-790.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0401MB2422; 23:JMCCFMx2Wtw3J9z9DIXgmjvQ/MMk6U1Nfr5cT4E?= =?us-ascii?Q?98DnuRhgGEDj/ZVxuLoqb4sCZySutTtHx7XmNBEsaY2W9NzZX7wV3okLlRJG?= =?us-ascii?Q?hIlDhcZhyCvx1P/pX9BWtcTfh1RMtXnPB11/EWw1LP4f2+hOtj9g7Y197CBb?= =?us-asc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RhwhU7HI2n/A==; 5:EvjITW41f1plwUXEiuN7A+p2JTJg7fb/iCFUJ0K5l0934v0a9S32vExXszBM6xe4P3Ub1NLMS4+7ggLHYM90XAhNpQqSCE8Twod6rQLtAio+SoMcHykBq5juoEYLGRyslTQhC0ff7o56dzbEcZgQmv2/JaPXiMmJUZ9nFDsj26U=; 24:vFy9u8cRY8fX4ufAluMvY6g4e9JTAQuXFAAQgCAKxOp4emiEDaVk84dqCZ0A5XkTVy3cu1wPJpmgT4vFiwQiO7TLQE13hPPig8Tru+KmIrQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0401MB2422; 7:ZV/vJvGbXH/1W1g/dYUm+hDYub2b7PfaQbdpvAJAhoZQACp+YvdhuNjC4pawu2dhyROLgJRP2iFr9TnXQP5S5uIGO7MHy0cyCKCzdnAJT3KfYcpc+WipcfVR7vQL54EOtWA5rtMdR7m5INzpTOLQtFr53i4mtT1CmCKBwcDBomRBH1e+WvMJlzl0Kgo6JChvCC2GPvY9i2RydwRT6VWfR8BZcXMExYS61bTcj7+3bXiq8UWdyZinOdJQOJ6XO3+/ X-MS-Office365-Filtering-Correlation-Id: 851df3a5-96ef-4760-51c4-08d5ac298bff X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2018 10:27:54.7851 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 851df3a5-96ef-4760-51c4-08d5ac298bff X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2422 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: <linux-pci.vger.kernel.org> X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index ea9ecef..3687882 100644 --- a/drivers/iommu/of_iommu.c +++ b/drivers/iommu/of_iommu.c @@ -25,6 +25,7 @@ #include <linux/of_iommu.h> #include <linux/of_pci.h> #include <linux/slab.h> +#include <linux/fsl/mc.h> #define NO_IOMMU 1 @@ -160,6 +161,23 @@ static int of_pci_iommu_init(struct pci_dev *pdev, u16 alias, void *data) return err; } +static int of_fsl_mc_iommu_init(struct fsl_mc_device *mc_dev, + struct device_node *master_np) +{ + struct of_phandle_args iommu_spec = { .args_count = 1 }; + int err; + + err = of_map_rid(master_np, mc_dev->icid, "iommu-map", + "iommu-map-mask", &iommu_spec.np, + iommu_spec.args); + if (err) + return err == -ENODEV ? NO_IOMMU : err; + + err = of_iommu_xlate(&mc_dev->dev, &iommu_spec); + of_node_put(iommu_spec.np); + return err; +} + const struct iommu_ops *of_iommu_configure(struct device *dev, struct device_node *master_np) { @@ -191,6 +209,8 @@ const struct iommu_ops *of_iommu_configure(struct device *dev, err = pci_for_each_dma_alias(to_pci_dev(dev), of_pci_iommu_init, &info); + } else if (dev_is_fsl_mc(dev)) { + err = of_fsl_mc_iommu_init(to_fsl_mc_device(dev), master_np); } else { struct of_phandle_args iommu_spec; int idx = 0;
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- drivers/iommu/of_iommu.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)