Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752276AbdFHEp0 (ORCPT ); Thu, 8 Jun 2017 00:45:26 -0400 Received: from mail-by2nam01on0077.outbound.protection.outlook.com ([104.47.34.77]:26302 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752178AbdFHEpX (ORCPT ); Thu, 8 Jun 2017 00:45:23 -0400 Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=cavium.com; From: Ganapatrao Kulkarni To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, iommu@lists.linux-foundation.org Cc: Will.Deacon@arm.com, lorenzo.pieralisi@arm.com, hanjun.guo@linaro.org, sudeep.holla@arm.com, robin.murphy@arm.com, lv.zheng@intel.com, joro@8bytes.org, rjw@rjwysocki.net, lenb@kernel.org, jnair@caviumnetworks.com, gpkulkarni@gmail.com Subject: [PATCH v3 2/2] acpi/iort: numa: Add numa node mapping for smmuv3 devices Date: Thu, 8 Jun 2017 10:14:19 +0530 Message-Id: <1496897059-8272-3-git-send-email-ganapatrao.kulkarni@cavium.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1496897059-8272-1-git-send-email-ganapatrao.kulkarni@cavium.com> References: <1496897059-8272-1-git-send-email-ganapatrao.kulkarni@cavium.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR01CA0093.INDPRD01.PROD.OUTLOOK.COM (10.174.208.161) To CY1PR07MB2571.namprd07.prod.outlook.com (10.167.16.26) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY1PR07MB2571: X-MS-Office365-Filtering-Correlation-Id: 11003bb3-9f35-4253-49ec-08d4ae292564 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:CY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vl/WgFPC1/WFLPOJ//45tCN82T1D64cUckVA9F7m7a1F054/5hssTUVSheIkzy1V4fKbTAns+9AQpE6+yld4nTk=;20:kpAq8ib6vEUnJ4LqwZ4H+s5j6d4d+knGqwDqgDI5ItxBk1Sw1TeTNzE/u66bSPUKpoYSd2D/cCq0AeIq05NuTIBY7LW7jUyQ8fr2T9MOy4ynwB97YDTrqq95lSBrTRv8Gkrv7KYtgk1tVVQGisU2TyYttW0G8srXrughLSlM54JA5P6Qkvfsx+JqmOZahwa+Hl5n0QcfUki/9ZXgUoJVJqjD8vwZ8IZ6j3TdTMX+w/8tZj7uUUR7ZMV41ZJWxBH9Z/Z5UUgVcXyRx0q4M3oHDb5J5IHhOI3sOvpqYajHp4oCA6cOQfW9eGxSxdzQk+OPYRjZ31p665KKmaNrX/YZAeTjYizcfu+rgXwzTK0WHxo1Mu9UTAonhTiPGQUUJiYjV85HxVBfb9YHbvOfHISLNnv5GnrZhdhxnyt2eKvmODlV8n87EpZMxHDf1zSJPHaUltulWtGAklri6joygyrUZLkA0lkU1dViqjHcPknKX36o4fiupgSf7XuPDP6K77zN X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(100000703101)(100105400095)(10201501046)(6041248)(20161123558100)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123560025)(20161123564025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY1PR07MB2571;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY1PR07MB2571; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR07MB2571;4:GwtFCujfEaavER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AVwD6mmRcJ9tlJk3xIF59JJ0UDmWpFHywNDpuG0lEA0/4SDfRlJjj6GK?= =?us-ascii?Q?uhekn0yGuyjLh+Eq4hBAdF4OtqW1hJuFWnu3oEeNLRFZNHR84w1dQgwsBvSV?= =?us-ascii?Q?lrJY/ldYUykFjPVbadQon/VAEotSb5KDOdmOlLj05HNEnMYM+mp2Nav0Ni3U?= =?us-ascii?Q?vZqyXcVvJ5rTAMQpcoVFyaj7QcjdGJGtmVwXwZhxC7lrZYK3Odil8ObjFrnB?= =?us-ascii?Q?EXcociqoQbJd/3+6qEWG1eMwrTTrOJ?= X-Forefront-PRVS: 0332AACBC3 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(39850400002)(39400400002)(39410400002)(39450400003)(39840400002)(72206003)(38730400002)(3846002)(110136004)(50986999)(66066001)(6512007)(6486002)(86362001)(2950100002)(53936002)(76176999)(6666003)(6506006)(4720700003)(81166006)(6116002)(50226002)(8676002)(42186005)(5003940100001)(47776003)(53416004)(189998001)(36756003)(33646002)(48376002)(5660300001)(478600001)(25786009)(4326008)(7416002)(5009440100003)(50466002)(7736002)(305945005);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR07MB2571;H:mypc.caveonetworks.com;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR07MB2571;23:B7zlSVBanKdo0kJsxbArJWmtaoD2zwcBSvIk9NSdA?= =?us-ascii?Q?rpVtHoAFDdhPCxrdJdXIfdWZDjAI9Evw2gsk5B3o/n+QUMxFKYFJ5Lnl5wK7?= =?us-ascii?Q?51K+YQ/f6gRwMkZb2mPQ3juc4MwS6th+MH/KUGRU7dO1ZRGgMp4HtF6/hgMe?= =?us-ascii?Q?5i5Rap1b0n27nR7Z4azewnI5mzfk8zvqrAiDTN8KjTSywcG3/5y8sC2qK+TG?= =?us-ascii?Q?HzqJdpPkLLZlcWjrzAdr05Ub3sNivZWfQ4lwfeRYJEfXvKjfDrJDhFgtW3QY?= =?us-ascii?Q?5tKhV44uLcH3A7hfTnYpIBQIhplhBgzG8qjoP/t13sUoMGmTwok04NTojPsX?= =?us-ascii?Q?5kPled3/00ob3ZUssBtrAoNvyEevbkTJejTq6qXYRWKgipA7gwZO4eao4uoF?= =?us-ascii?Q?4xSrlbJtygpCSqg7CuuTP+HAS82/mbTcV0xOudxKHegIICXNBjIwTRnedSTt?= =?us-ascii?Q?xl8BFnJsXDrSbC97fD+Hiiee8kUcf2ugGFJWDWl/4CZlMvFBGCPqMcgXjY0K?= =?us-ascii?Q?8zXSmifL9kYwsp/eQhTafVHEfajIusE07l9w9jreuhuNiuyRwBxL5w1i8Laq?= =?us-ascii?Q?FbQCbFdCEQv5wM8SbwpZojI1VcXSE6AbC79IqZbs+00jZPVw9SB05XroxQ/P?= =?us-ascii?Q?e5+UZL+mMF3ungh3v6piSYUjqbC9lk1azieNxzljOEr/8wMuiSedijJUEm6T?= =?us-ascii?Q?x4nebkJZrud6MzDo7zrZuo1eJk93KEdlEjrxXjyC1lJ6Ba9YkkQNXaV1bVQO?= =?us-ascii?Q?n1G+7dJdOncdWdi2v17VRv9NvSH9pMZtwbtxDBWaKSWiOjvU3b/WSCqNArxm?= =?us-ascii?Q?t9b3hhBKgrBhduqW4zegB1hQljoqP29amrAhppmpxa8wTbxU0ILID25A2dBa?= =?us-ascii?Q?wtagpLkNSVQAahTSkG4nyaYYUbkTEuT0PoZkosOZjNep6zq6DuhchEnbRnpd?= =?us-ascii?Q?HZVoHE8KG4chQLZc1lC0UNMNGHwwNdxOhCZWKoFDxaqCxm9L6uv3eeLRbQdo?= =?us-ascii?Q?CL7mNq4CBrjE87RohBN4z1adotbEsk05zJ6U6gGhtzbbrhBrtbjNSIKKwpGR?= =?us-ascii?Q?XJApXjurnN5Qcvn5KO5XPrqa2Ax5R5nd+aKeqsE5AKsY72Hwvn6LzqPCc2q7?= =?us-ascii?Q?c1oa2ME7H8=3D?= X-Microsoft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rxsoCIQ9i/FDKdLYtH;24:r3wd+Fb/cAFmQPVkpho3Vr+2ns1QA6qDctIQ5YUMwOPH5Z8aBkI16l+PrrvowObomMaYtCxSfskgcslB+nC75aUaKZL65UX7AQrO8iPy/J8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2571;7:ZZWoJ7+J6jPG6t/ZXypREeQnnBr25ju2w3cGni0MfOk3GE90MSlRNMlNyfUfEEv09r6iTA/lXoXXnjV3CVyI3xaoZM1EGRY2MbRTwDyj2lsaniZMOFowxoU9mdauo0hgmnTq6Fr2wiDQxwQnQmkH4eD5uxXEnP4+o+Zq/be/SN+Irfs2l5YRz7JFfYH25dkjWf3bemEq7LYtfVzu1HuiWUXcHA3jofWFCgfFeCzhRAd+FsnVRp9SNKfvZP5q40R92bHI8FuOCaoNBZlAbjCWsIgBLUb2dF1pue2lN9DCc6JQ3QcLCdSNtIqJ9S7f5n+C2y2Nhp9c0VBJ0T8EvosUQQ== X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2017 04:45:06.1502 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2571 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2504 Lines: 75 Add code to parse proximity domain in SMMUv3 IORT table to set numa node mapping for smmuv3 devices. Signed-off-by: Ganapatrao Kulkarni --- drivers/acpi/arm64/iort.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index bba2b59..e804386 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -882,6 +882,23 @@ static bool __init arm_smmu_v3_is_coherent(struct acpi_iort_node *node) return smmu->flags & ACPI_IORT_SMMU_V3_COHACC_OVERRIDE; } +/* + * set numa proximity domain for smmuv3 device + */ +static void __init arm_smmu_v3_set_proximity(struct acpi_iort_node *node, + struct device *dev) +{ + struct acpi_iort_smmu_v3 *smmu; + + smmu = (struct acpi_iort_smmu_v3 *)node->node_data; + if (smmu->flags & ACPI_IORT_SMMU_V3_PXM_VALID) { + set_dev_node(dev, acpi_map_pxm_to_node(smmu->pxm)); + pr_info("SMMUV3[%llx] Mapped to Proximity domain %d\n", + smmu->base_address, + smmu->pxm); + } +} + static int __init arm_smmu_count_resources(struct acpi_iort_node *node) { struct acpi_iort_smmu *smmu; @@ -951,20 +968,24 @@ struct iort_iommu_config { int (*iommu_count_resources)(struct acpi_iort_node *node); void (*iommu_init_resources)(struct resource *res, struct acpi_iort_node *node); + void (*iommu_set_proximity)(struct acpi_iort_node *node, + struct device *dev); }; static const struct iort_iommu_config iort_arm_smmu_v3_cfg __initconst = { .name = "arm-smmu-v3", .iommu_is_coherent = arm_smmu_v3_is_coherent, .iommu_count_resources = arm_smmu_v3_count_resources, - .iommu_init_resources = arm_smmu_v3_init_resources + .iommu_init_resources = arm_smmu_v3_init_resources, + .iommu_set_proximity = arm_smmu_v3_set_proximity }; static const struct iort_iommu_config iort_arm_smmu_cfg __initconst = { .name = "arm-smmu", .iommu_is_coherent = arm_smmu_is_coherent, .iommu_count_resources = arm_smmu_count_resources, - .iommu_init_resources = arm_smmu_init_resources + .iommu_init_resources = arm_smmu_init_resources, + .iommu_set_proximity = NULL }; static __init @@ -1002,6 +1023,9 @@ static int __init iort_add_smmu_platform_device(struct acpi_iort_node *node) if (!pdev) return -ENOMEM; + if (ops->iommu_set_proximity) + ops->iommu_set_proximity(node, &pdev->dev); + count = ops->iommu_count_resources(node); r = kcalloc(count, sizeof(*r), GFP_KERNEL); -- 1.8.1.4