Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754381AbdFWGSE (ORCPT ); Fri, 23 Jun 2017 02:18:04 -0400 Received: from mail-by2nam01on0071.outbound.protection.outlook.com ([104.47.34.71]:35748 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750902AbdFWGSB (ORCPT ); Fri, 23 Jun 2017 02:18:01 -0400 Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=caviumnetworks.com; From: Geetha sowjanya To: will.deacon@arm.com, robin.murphy@arm.com, lorenzo.pieralisi@arm.com, hanjun.guo@linaro.org, sudeep.holla@arm.com, iommu@lists.linux-foundation.org Cc: robert.moore@intel.com, lv.zheng@intel.com, rjw@rjwysocki.net, jcm@redhat.com, linux-kernel@vger.kernel.org, robert.richter@cavium.com, catalin.marinas@arm.com, sgoutham@cavium.com, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, geethasowjanya.akula@gmail.com, devel@acpica.org, linu.cherian@cavium.com, Charles.Garcia-Tobin@arm.com, robh@kernel.org, Geetha Sowjanya , Geetha sowjanya Subject: [PATCH v9 3/3] iommu/arm-smmu-v3: Add workaround for Cavium ThunderX2 erratum #126 Date: Fri, 23 Jun 2017 11:28:05 +0530 Message-Id: <1498197485-32008-1-git-send-email-gakula@caviumnetworks.com> X-Mailer: git-send-email 1.7.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: PN1PR01CA0081.INDPRD01.PROD.OUTLOOK.COM (10.174.144.149) To BY2PR0701MB2022.namprd07.prod.outlook.com (10.163.156.12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d124abe9-86a0-4487-524b-08d4b9ff97ab X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:BY2PR0701MB2022; X-Microsoft-Exchange-Diagnostics: 1;BY2PR0701MB2022;3:SaSIjW7kySpYoHyMNkJrao/jXrYxWd6JoZyDhnd+lIqhbZftMBM4PfApM//wFm1tlawuMb2ZuyCWYTWMqqFRLvh9Uo635Pcv671jRmVHWYlbTTiTAdBH6GugoS8wApGIgoaPZ0krFiJRcapfGAZv4OArCy4BTK7eow8FmwvcxGCbqZ2PnuRyQUOvh9iDA/uK9bSUsYp0Txow9n/APGlpv97sq7CHb5/qYXljSzC2PxAGRtkykhHF6yLA8lyPdiCEQPp8zUQvgos1Nm7/0pgRa4Vv1+CbFX3ij4e2r1gwZbYbkkq6UVP3aDNPPxSuePvrATvsg9vtuM/Uh24y4Rj9TA==;25:z67WfHPStDQnQIGZ66og43q3zzO1FLxg1kvbrbcj6/fiSSjafU6Bo2K10Xn/4n+cDENqyohqk9VJscGLrn6fON/AQN/YfLSGqi3SgXJuyELZlJswV+SLTP4n+dn3cVlwKp0JYBj0l7bWFDphvMg/HXauUuCSa22UxbLd8OrBUJc0FWcyoJLV+v5F14AMfP339gi2d0mC+1FjnZN/cZg4rchTuXNBklRrce3cvT4OBxWaVw/vxhv53nf8ZWOwxP+FBMI5Qc+NKYODMEN24wtfLdTOveqa1CORFb5S5qs5m88Umw6u2zfXjnvOmAm78PVlqYlRDl+g3If112cPS8a7RLyJz1q1kpxFTqQnYQqQR0U8tr/eQ03cytN9k9JO40TMXZw5GU8+QMwdxxh8VmyK3i3iHWvcQXJSSDTQDLhYL2xkN2wypNh1NVatAvdao7S2CgAFRxv5iSbK7rshd3usv1ftj9OtmZ/a9rwXrVO0C9A= X-MS-TrafficTypeDiagnostic: BY2PR0701MB2022: X-Microsoft-Exchange-Diagnostics: 1;BY2PR0701MB2022;31:nKP6ZAa/PXUuFMkWFoK95JCNCOwVlOATIKjJPamu7SxKcseX/2w5D4RvZ9WovacmnxZRmxJdXJPrmpyTGa74ncFPte1+u24bzuHW03mDI3lxQvIBg5OQGBoInKGplWuHRAuH8C15wbQFtXP1aaUbr6tg+GPGTBKLEaFdlw1kENfhuaagwP6lK9hrODImOKwmA0gLVU2m5m8l101XjtKd3e83b4JzG4OaJQMFbmoFNRw=;20:jfunQRE8hePVo1fF4sVp0I6lMSeai29bUlyHos5YTN6c7zJ3lTHqlREOwm4E9v0N+Mj6IimPvY1H/JHcmpma12R+6fNd3eQw5EqyXFG7RbAqy2ypQvdKHbiS13SXYTYBLavOvfs2m/tH9XiaN5bNApwkSyR1pXIsUJ8SRnT2riLLuQM2SbYb3zvZvX/2ybpgVfkjEGNRyvMDVQAfyLG0WFnLflexcnqt8RVQfp0R/gAiZuSRLxjHuXABmTnB9FCypwHn0ea91aZcG6I/QXp4Oit/8Lw0D6+gzO5yXlBtbwZHfWCel5ricKpJ13FbZSJCXRcuUzpTofxgMjI8c00kw251p7ZADkGN5fFnFH9smr8iXTrhI5SpjHQVvgX4nFD3Aj37q4kMojW+brdAW9Uvz0VI+j3x4jNxx+PxCc3QqmiqyPFu5o9O4HKw4E3FsjrY4a/7zNNUNrRkNTzm9eM+iRrgqGZjLQi46XWmPWhcOUE+D6NH4MYtwn7KpSX15I2zfavJ1a1qjvPmifp499j6T+xbOBeSt2MYPmV11vZcDLN+B0WO9cm4VUSKxKVx/zKwRVQGi26dceEybyzE/KzP7E9UOPMi+r0+C8AwscHLkNc= 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)(100000703101)(100105400095)(10201501046)(3002001)(6041248)(20161123555025)(20161123562025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123564025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:BY2PR0701MB2022;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:BY2PR0701MB2022; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR0701MB2022;4:MyhE/+pHVO9GvkGvWHNGsEHkBsQF8NgpOkSD/KMp?= =?us-ascii?Q?+ghDw7WgoaZ0rNF/nDtQ+CZGVdtsIdJ3Z2y/EGlmvYww49n/mlZerP4kp0at?= =?us-ascii?Q?RwFL7J1eCijN+dFw0S3skF2zTm/6w6z28Ms0F8Jh3tjyjeZH3fGNnalWNvmG?= =?us-ascii?Q?X4itm073SlC1HBNX9eBEGRkvPwOslMlbjrQRoU/wi7gYHMJ49hQILR7o1Sgb?= =?us-ascii?Q?z2BUSqpMHgEpUZ7lGElVUihuR5AsIGHyIbl+xGsZ7tMeL2MjfwValTOLAmcY?= =?us-ascii?Q?iwxjHZZxYNwreRlw57HT1gQHbPNaAcdPxURmMhQL8J5Z2DJ9sFEfrYhF2Qi8?= =?us-ascii?Q?1HMUQbxE8J33oDLHUus2NWH5802K2nDTLpxqvngJmqzbUImw3OTKwleAeyKG?= =?us-ascii?Q?Vu6ekI8ORmPQlxTfCPq+A2aTWZjGcoao5CscCYW6Nu5S2B2TFV9V8/gcstbu?= =?us-ascii?Q?KOf/MFFBUqGpGQ3TZcZyX/Hg5t/isvQNHbMt+vafneA6gX0r2QKkUhBVllli?= =?us-ascii?Q?UuPfTz41m+sk315frON9oS8Sm+nNgV8S7M7ZpxgrKndcax0T9Iw9F8SMXJFt?= =?us-ascii?Q?5v3KG6+ATdFpkoTJ4FNhlu8WHl0lpNsMv4GDfseOa3yGHDMk4pwf5R5kFpSM?= =?us-ascii?Q?ZuS09a9KcfQZdAO+dwx4p92LED88OOzZ77AmILYSWMtYZP3Xg3lIb5YTxl3w?= =?us-ascii?Q?AHdVWQd28+ClsZ7MLJ/MvQbUwF1iUL3gk5t6pEpzOfzUnYD//PHpClvoEkcZ?= =?us-ascii?Q?TAT2jgWUREBwv/ZUFGgGnvUkXepMlV3Fl8ub4ElQidP8jVgbz+lcVUvui+Ge?= =?us-ascii?Q?ZTUoVRNkSa43wqOdLsmWJVAJm4831YQMOsVIK6T/+HKq1lNfIxO3pkpCnJhk?= =?us-ascii?Q?nXtzJAtesGlClgEmV0ZU7i/hyxMVxyWh6PdFQCbDbZInct17A+rOZZCFOsg3?= =?us-ascii?Q?ijuQ3edcctsni5UzoGN8lPHil/WVo7Ku5ZyxFAnfJEG+9ozlKG6uWfrtVbwA?= =?us-ascii?Q?PpYiqjuFSTf4fZB9L67YCEik/X1pfW5xUHkxiXjCPnl1YvxZlPkdKWMXUyHz?= =?us-ascii?Q?jDuGvX0Io7yjkA0wgrgDv7ceK6Lb2mLJigwoJugZx+SQ4yWppw29sW/M4CVM?= =?us-ascii?Q?s/SdHDq828w=3D?= X-Forefront-PRVS: 0347410860 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(6069001)(39410400002)(39450400003)(39840400002)(39400400002)(39850400002)(50226002)(4326008)(478600001)(25786009)(5660300001)(81166006)(8676002)(66066001)(36756003)(72206003)(305945005)(2906002)(107886003)(38730400002)(53936002)(230783001)(5009440100003)(6486002)(50466002)(6116002)(3846002)(6506006)(54906002)(6512007)(110136004)(48376002)(42882006)(6666003)(50986999)(33646002)(47776003)(42186005)(7736002)(189998001)(5003940100001)(7416002)(110426004)(42262002);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR0701MB2022;H:localhost.localdomain;FPR:;SPF:None;MLV:nov;PTR:InfoNoRecords;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR0701MB2022;23:1Vw72rrVsx0THm9gk0Zu0+CNA1j1qBhdO6nLe+9?= =?us-ascii?Q?tjPMp7WQAe6RpPA7yKKyeiQz/gkWFDSSetNrUX/EphoHO4NZJibPPdvtfGM5?= =?us-ascii?Q?YeYWCsuvwuKoUlpowe/B5lwqt9uM0wY661uLIzI13YfqBijocjiwOYD8ptVV?= =?us-ascii?Q?k6FgauNytBvPWCBdThhJOEdpCBd3C5HZzjPhD+EMw0YyKf91/hyG3hyxzcWU?= =?us-ascii?Q?k+N1IPxpwBP8l2ntfyfojftyua9kHl2o591tS0pI7iTTXj7IXEtCtIubxNp5?= =?us-ascii?Q?jp0XDSeC1tYrhrM5jcvZvnjTPQOppIQrCpOioiG+f8JeNVfnF1GDo4gochU0?= =?us-ascii?Q?W+PVIUYSSYUExXG5BDjz8FRqiDXUaGUVRsriCWHXeb9RalKNclLQP/X/1yD7?= =?us-ascii?Q?JSjFvOflEGvqS/CgRP8z7XJ77zg7eL1N9gki8fCHHEn1Vem7UX009ZZUTkS7?= =?us-ascii?Q?14KNesgPH0DHRBtaKGID0sxqJH/L3iT+LdtaTi5C3h0xhg8pcetq/8Q94slt?= =?us-ascii?Q?Gpv7K9FTE4NJAVZJmYj5wEH/rib7kDOxXrIU2VyemkM+ask9DgBmYreFsxtg?= =?us-ascii?Q?GNIpQ0/XMIWGL99LNiUxOVX4cl05zuiFnzdfzeTvhAjPaiwHyAWIgxGbr2SN?= =?us-ascii?Q?7g5o3tCnvydQI1C1H5SK5RJbQgTwawzrs0z6pTsDIUwL8KhbKdSM27arVhHn?= =?us-ascii?Q?Z22g6dqcNNEX55H84bBlEHR0Ky4Ip5xNoACpdZYZ0O3UNQ1ARntG96dEAawg?= =?us-ascii?Q?dlxuUbHR73gdO/fCU7pak/hsuxCoZ+RjxADyYcbtFs6PGw6seJ532KVa0J+N?= =?us-ascii?Q?QR5DmISZ26M36PTi/gBl6RxDUPSthb+mCYCbzbi8em1qLRfvHV9P5m/D8w7t?= =?us-ascii?Q?A1Hwzpl1DFuqAlL7NHGHNosP+PJTlL7upx0893rr2RTJMhmL7lJW1C0elBqA?= =?us-ascii?Q?OTtHH6ujodEruTMrI60bvQSSW2jBTGIcYSHEyHZnPwJhABxPL0ypwVyEOth3?= =?us-ascii?Q?JnGI73iCEN+4kVbnZ7WHZDXMmw78U6tic49S2t2mDlTwrdCRKxKyZuRhCnLn?= =?us-ascii?Q?XV+z7jWkvmWXFQf6cu4eZZvNTUuZZ/9bSEYgCmmhAGG9wF43Tereq3KPJyRR?= =?us-ascii?Q?PJ00v52BdekIKDpWp+t7Fo4FE5fRJwyZRe58QkCHWxTLiJZ7INRmGHw=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR0701MB2022;6:IMPij6e0JPVBBmwjdH0YmeJCbL6gky8XaDxkvVft?= =?us-ascii?Q?bCcy6JA1xkRsUUfw4zhuFekjHeldxzjcbux1aSPSdTkUkQMymGbWUOWrPFmn?= =?us-ascii?Q?VmzeBBA8a1qEv492I5IsrGdipSF7DipQMIK2ojJnqq+ZKBo+Z7fqs73ZaT0w?= =?us-ascii?Q?tzdF8ekCydX1PLLb1DnTraEUsLNB4y9Np+QQuWJz7IebxMZXwZcQ/L+KeTYo?= =?us-ascii?Q?9pa8WZfBBRfWdkOT6ZmndKbRjfCyII0csDf6jlQRxy06RGTCwzLWOzjq63ua?= =?us-ascii?Q?Bxg7XMymKSM79n7rwuBRh7jqUqztooUMF1PUtEo60sAEUZIC5813VbNCihtv?= =?us-ascii?Q?ENlHcrE4nxcsAtagbof+Qi+JyTOwcnPPRLfswHB/obihAY0lS62IhcN8HKoN?= =?us-ascii?Q?ONpCB9jQKVjd2Vsj66hHsDR43C3swwHaZ/u71QP4C+5St+GwEuXOa/IzXYhV?= =?us-ascii?Q?NZJ937nCaZa8xvMnVuxYbZdIqoSp667ESc6IC+dd3YVtKWE4uxQBOOM5+uEE?= =?us-ascii?Q?jUr9ATjwCk8B3NefqB9Bmr8RjCfO2juUT385RyF1b5McY1UkiSmj8dpCC+Xb?= =?us-ascii?Q?PYIa8zB67DIeWICQyDiLk4fSTucl62aKn6UifxcJDxozNfjvKuw3VpLLWF54?= =?us-ascii?Q?DahVKR9HBnSDAsVpvMkDavbqcEPlij5yiQpFcOQUXn72oyujuJdsHcdNPjJ+?= =?us-ascii?Q?3Imc/6k+ih8Jw1GBUrOI7Ea8TjqQjXcZtt/XUotwPEaBxcHdyN7M7zW7/fgE?= =?us-ascii?Q?m7Al71tuFb+4ozHZs3FT9PezovNaCyTXc/Ok6brW04+MWpOkwmFECS/h+6lv?= =?us-ascii?Q?IWtnT1hrVIg22BVu1BSwK0FshHxEwLbHV8iyq5vA06+C0pcbRcETFj+8KJct?= =?us-ascii?Q?PXEfYR7KX0U7d6SWbBtAstO2jH8glNV7QVeZDPmen2dCOyWeood1kc56R9M0?= =?us-ascii?Q?EXvgjVW43QXp5AiyIGv7gglx4j2wrA9B35q9mneOh1ud7r1OTq3xbLn19/kc?= =?us-ascii?Q?rQI=3D?= X-Microsoft-Exchange-Diagnostics: 1;BY2PR0701MB2022;5:wGc9ZJurMa+adtDwiwpi0jhrhBL/d/fyDivXPv/GCydgg1K/3MmmHjY9fv7N/pc3WDhHCdA7/Vxj6X/76WzsxiJ1dlradAxW+xbu+S2jVc1LMzFk7K8/FhfBokZ3bA/WQD/nPmEyKqPwlMEtd6jRDs/nijIMKs75JmkjJTVTfVqwA/LtpgzakMojKl7YTcqgDPGgWijgzlgQEO8JqP14IWO83T0qcVad+LYi61KI647ZMwX3hb2zPCD21vbuqaV5KZpXvr+2VRH85bY35DuJvH4n2w3BMOEGq8fqQCW6r71WPxR9N6DPAB6ToRp1poMa6va0aJ5w8nrqU+r6FYDCEENi7FGvE6cbEueKD+m2zRpqoJ9OQplrWKr+tWyNzoy7FzjKXT4VDp+oWR9lpLkdZFrJZKlRa1wu7cKWCL4enn2VhZdQvQr1dlndzsoOm+kr3JFiH68R+bD/7qCtkNM8lrfECwNwFH5RKQnW7cX30NgatIxyB6YkritK6iPA+Zh9;24:RiVpVcP+zEhC3VAIfli5+yWs6IDHpSGEZ6mQRqogOATGULpxapAxJJiomC34BN8xsovMm5JtbJdm+rm8nvvQGZPBhmyrbfOwzQNMbvBMFF8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BY2PR0701MB2022;7:Dgig/ya70TiEwtdisN136r8d4WLd0XJT4lKI3FIKUv1G/KTkGbtiGPI6kXklGIHWTg3Qgx1NDygF56AZgfcdGet4umh11vZITSei5WB49oWMJ305LNvpCwsnRRq9ekiFjF8QUc1nl66xnhBEFm72qp/L+m5wfXjaw/RcRNvh2yjof9y3yjO7zS+Ggdq93ERpWMBM0OrQPR5kxyj2VMaqTqCrjg8WkZU9nKxx0b9GsAJVKroI317N+Qytd5pZ59r6O78ukOjPyPtluoeTobj3bRKEb13dhJe3MkMCUesHTiI9YbXl7IIv+QfeVVk86BdJTsfrCWoV3Azzrfo9QE04KRWtyYCT/fGwxzmnZZfMcew6UJh0VVyJlLdCuSXxDewXND9WuXcjm8YVoQDBvX1tqalB/jqb40ru6GeVVqiORWgcnxXzY6h6FpE4a5qyGMvrgWJxPxAKxOaDbL7HdOTOKEufIdJyWaxuGdufa+mhuTvmyKTvC79jTN+qO+NVOsyYFwQBL2KvMhlqFTmAaMI3hnpTu2rpu2ZYYmLE7RKpOcWZPdRonre2mCHQS6jOXQXLU5Peve6qHRJ1GJHgQrNFHJFp3GDOy6soO5f21nIpDtUl3Tfi9OClvxrjzYSnYWEmnkdJn7NRb4uyDh+aC+fq4Xt52Z2ZaA6rKkk+aKqQJ89cqWe3Wy9l/R5JX5SvGQiFhz0pZ5JVJ700lw5ty5tzEZciAuhR3w+6B0pu5yF6VfqZ8tBnzksIVnWFiagi9ZZxnl3IpsZXt5mbj9OkNnsHb1jdl0RXLRFRRUODKQAibUQ= X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2017 06:17:51.3466 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0701MB2022 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 8580 Lines: 262 From: Geetha Sowjanya Cavium ThunderX2 SMMU doesn't support MSI and also doesn't have unique irq lines for gerror, eventq and cmdq-sync. New named irq "combined" is set as a errata workaround, which allows to share the irq line by register single irq handler for all the interrupts. Signed-off-by: Geetha sowjanya --- Documentation/arm64/silicon-errata.txt | 1 + .../devicetree/bindings/iommu/arm,smmu-v3.txt | 6 + drivers/acpi/arm64/iort.c | 54 +++++++---- drivers/iommu/arm-smmu-v3.c | 100 ++++++++++++++----- 4 files changed, 116 insertions(+), 45 deletions(-) diff --git a/Documentation/arm64/silicon-errata.txt b/Documentation/arm64/silicon-errata.txt index 4693a32..42422f6 100644 --- a/Documentation/arm64/silicon-errata.txt +++ b/Documentation/arm64/silicon-errata.txt @@ -63,6 +63,7 @@ stable kernels. | Cavium | ThunderX Core | #27456 | CAVIUM_ERRATUM_27456 | | Cavium | ThunderX SMMUv2 | #27704 | N/A | | Cavium | ThunderX2 SMMUv3| #74 | N/A | +| Cavium | ThunderX2 SMMUv3| #126 | N/A | | | | | | | Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 | | | | | | diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt b/Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt index e7855cf..c9abbf3 100644 --- a/Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt +++ b/Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt @@ -26,6 +26,12 @@ the PCIe specification. * "priq" - PRI Queue not empty * "cmdq-sync" - CMD_SYNC complete * "gerror" - Global Error activated + * "combined" - The combined interrupt is optional, + and should only be provided if the + hardware supports just a single, + combined interrupt line. + If provided, then the combined interrupt + will be used in preference to any others. - #iommu-cells : See the generic IOMMU binding described in devicetree/bindings/pci/pci-iommu.txt diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index bd97b7d..4e9523b 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -828,6 +828,18 @@ static int __init arm_smmu_v3_count_resources(struct acpi_iort_node *node) return num_res; } +static bool arm_smmu_v3_is_combined_irq(struct acpi_iort_smmu_v3 *smmu) +{ + /* + * Cavium ThunderX2 implementation doesn't not support unique + * irq line. Use single irq line for all the SMMUv3 interrupts. + */ + if (smmu->model == ACPI_IORT_SMMU_V3_CAVIUM_CN99XX) + return true; + + return false; +} + static unsigned long arm_smmu_v3_resource_size(struct acpi_iort_smmu_v3 *smmu) { /* @@ -855,26 +867,32 @@ static void __init arm_smmu_v3_init_resources(struct resource *res, res[num_res].flags = IORESOURCE_MEM; num_res++; - - if (smmu->event_gsiv) - acpi_iort_register_irq(smmu->event_gsiv, "eventq", - ACPI_EDGE_SENSITIVE, - &res[num_res++]); - - if (smmu->pri_gsiv) - acpi_iort_register_irq(smmu->pri_gsiv, "priq", - ACPI_EDGE_SENSITIVE, - &res[num_res++]); - - if (smmu->gerr_gsiv) - acpi_iort_register_irq(smmu->gerr_gsiv, "gerror", - ACPI_EDGE_SENSITIVE, - &res[num_res++]); - - if (smmu->sync_gsiv) - acpi_iort_register_irq(smmu->sync_gsiv, "cmdq-sync", + if (arm_smmu_v3_is_combined_irq(smmu)) + acpi_iort_register_irq(smmu->event_gsiv, "combined", ACPI_EDGE_SENSITIVE, &res[num_res++]); + else { + + if (smmu->event_gsiv) + acpi_iort_register_irq(smmu->event_gsiv, "eventq", + ACPI_EDGE_SENSITIVE, + &res[num_res++]); + + if (smmu->pri_gsiv) + acpi_iort_register_irq(smmu->pri_gsiv, "priq", + ACPI_EDGE_SENSITIVE, + &res[num_res++]); + + if (smmu->gerr_gsiv) + acpi_iort_register_irq(smmu->gerr_gsiv, "gerror", + ACPI_EDGE_SENSITIVE, + &res[num_res++]); + + if (smmu->sync_gsiv) + acpi_iort_register_irq(smmu->sync_gsiv, "cmdq-sync", + ACPI_EDGE_SENSITIVE, + &res[num_res++]); + } } static bool __init arm_smmu_v3_is_coherent(struct acpi_iort_node *node) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 2dea4a9..fd5a48c 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -605,6 +605,7 @@ struct arm_smmu_device { struct arm_smmu_priq priq; int gerr_irq; + int combined_irq; unsigned long ias; /* IPA */ unsigned long oas; /* PA */ @@ -1314,6 +1315,24 @@ static irqreturn_t arm_smmu_gerror_handler(int irq, void *dev) return IRQ_HANDLED; } +static irqreturn_t arm_smmu_combined_irq_thread(int irq, void *dev) +{ + struct arm_smmu_device *smmu = dev; + + arm_smmu_evtq_thread(irq, dev); + if (smmu->features & ARM_SMMU_FEAT_PRI) + arm_smmu_priq_thread(irq, dev); + + return IRQ_HANDLED; +} + +static irqreturn_t arm_smmu_combined_irq_handler(int irq, void *dev) +{ + arm_smmu_gerror_handler(irq, dev); + arm_smmu_cmdq_sync_handler(irq, dev); + return IRQ_WAKE_THREAD; +} + /* IO_PGTABLE API */ static void __arm_smmu_tlb_sync(struct arm_smmu_device *smmu) { @@ -2230,18 +2249,9 @@ static void arm_smmu_setup_msis(struct arm_smmu_device *smmu) devm_add_action(dev, arm_smmu_free_msis, dev); } -static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu) +static void arm_smmu_setup_unique_irqs(struct arm_smmu_device *smmu) { - int ret, irq; - u32 irqen_flags = IRQ_CTRL_EVTQ_IRQEN | IRQ_CTRL_GERROR_IRQEN; - - /* Disable IRQs first */ - ret = arm_smmu_write_reg_sync(smmu, 0, ARM_SMMU_IRQ_CTRL, - ARM_SMMU_IRQ_CTRLACK); - if (ret) { - dev_err(smmu->dev, "failed to disable irqs\n"); - return ret; - } + int irq, ret; arm_smmu_setup_msis(smmu); @@ -2284,10 +2294,41 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu) if (ret < 0) dev_warn(smmu->dev, "failed to enable priq irq\n"); - else - irqen_flags |= IRQ_CTRL_PRIQ_IRQEN; } } +} + +static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu) +{ + int ret, irq; + u32 irqen_flags = IRQ_CTRL_EVTQ_IRQEN | IRQ_CTRL_GERROR_IRQEN; + + /* Disable IRQs first */ + ret = arm_smmu_write_reg_sync(smmu, 0, ARM_SMMU_IRQ_CTRL, + ARM_SMMU_IRQ_CTRLACK); + if (ret) { + dev_err(smmu->dev, "failed to disable irqs\n"); + return ret; + } + + irq = smmu->combined_irq; + if (irq) { + /* + * Cavium ThunderX2 implementation doesn't not support unique + * irq lines. Use single irq line for all the SMMUv3 interrupts. + */ + ret = devm_request_threaded_irq(smmu->dev, irq, + arm_smmu_combined_irq_handler, + arm_smmu_combined_irq_thread, + IRQF_ONESHOT, + "arm-smmu-v3-combined-irq", smmu); + if (ret < 0) + dev_warn(smmu->dev, "failed to enable combined irq\n"); + } else + arm_smmu_setup_unique_irqs(smmu); + + if (smmu->features & ARM_SMMU_FEAT_PRI) + irqen_flags |= IRQ_CTRL_PRIQ_IRQEN; /* Enable interrupt generation on the SMMU */ ret = arm_smmu_write_reg_sync(smmu, irqen_flags, @@ -2724,22 +2765,27 @@ static int arm_smmu_device_probe(struct platform_device *pdev) return PTR_ERR(smmu->base); /* Interrupt lines */ - irq = platform_get_irq_byname(pdev, "eventq"); - if (irq > 0) - smmu->evtq.q.irq = irq; - irq = platform_get_irq_byname(pdev, "priq"); + irq = platform_get_irq_byname(pdev, "combined"); if (irq > 0) - smmu->priq.q.irq = irq; + smmu->combined_irq = irq; + else { + irq = platform_get_irq_byname(pdev, "eventq"); + if (irq > 0) + smmu->evtq.q.irq = irq; - irq = platform_get_irq_byname(pdev, "cmdq-sync"); - if (irq > 0) - smmu->cmdq.q.irq = irq; + irq = platform_get_irq_byname(pdev, "priq"); + if (irq > 0) + smmu->priq.q.irq = irq; - irq = platform_get_irq_byname(pdev, "gerror"); - if (irq > 0) - smmu->gerr_irq = irq; + irq = platform_get_irq_byname(pdev, "cmdq-sync"); + if (irq > 0) + smmu->cmdq.q.irq = irq; + irq = platform_get_irq_byname(pdev, "gerror"); + if (irq > 0) + smmu->gerr_irq = irq; + } /* Probe the h/w */ ret = arm_smmu_device_hw_probe(smmu); if (ret) -- 1.7.1