Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932108AbdCIMDV (ORCPT ); Thu, 9 Mar 2017 07:03:21 -0500 Received: from mail-bn3nam01on0064.outbound.protection.outlook.com ([104.47.33.64]:53557 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753158AbdCIMDS (ORCPT ); Thu, 9 Mar 2017 07:03:18 -0500 Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=cavium.com; Date: Thu, 9 Mar 2017 13:02:06 +0100 From: Robert Richter To: Robin Murphy Cc: Will Deacon , Joerg Roedel , linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] iommu/arm-smmu: Report smmu type in dmesg Message-ID: <20170309120206.GP16822@rric.localdomain> References: <20170306135833.21455-1-rrichter@cavium.com> <20170307140607.GY16822@rric.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Originating-IP: [92.229.91.73] X-ClientProxiedBy: DB6PR0501CA0029.eurprd05.prod.outlook.com (10.168.78.143) To BL2PR07MB2338.namprd07.prod.outlook.com (10.167.101.16) X-MS-Office365-Filtering-Correlation-Id: 975caad7-a2c2-4e46-8395-08d466e42316 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BL2PR07MB2338; X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2338;3:jDcRnqnGMeW4jyZqvh3kErQu1yS10Pg5A4Wdg4N1OUaEvVcBDotOkwqRQC4NPejzUKN/GmnXQIPg1KViQwUnQ3DMmLo9PQmqEEiNw15M3cGHnXmo0shGrmzRj2oo7+u6miLLnmjqQDKJOPtfmmpfOhmDsE5Z9UEilRokRnO4oOALOiQ0g+djDUkeYS1JMZn7YpDncgEWs4se7luvQpG6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3pdIoi05dRrusYyvFfqQQlT7Bv9iRE7YxL1/CZIeCZC9YV9Ofw+r5+1Aq03ZfdpOA7CxQnrsTPUGTyaiQJC+8EPoVHqihjJuxrLVCsRVtAsmyKV7c+I3eYe/t2lnNWIL6rndAxgA2nZUNnj0PCjWbqZB4XM2wrlzD3nESXfw+Z7034MAdZu3Ll44zEmdtqekvRbCkK6pGAV+WTw6/2tO0qpp0RKaQrQojUZBh1gAn9Lxad38q4vAN+f3PZZawkLhTTMKHFPzmtwxjKcuuDN9H+6Ja8LvC4e X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(211171220733660); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123562025)(20161123564025)(20161123560025)(20161123555025)(20161123558025)(6072148);SRVR:BL2PR07MB2338;BCL:0;PCL:0;RULEID:;SRVR:BL2PR07MB2338; X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2338;4:Ns+QwMAa6N1rkZq062z4CKFcf5leGetMgTY1PSwIg647e74EsS7PMWwggxpItatirIAZ72Tm96xDi1WWF9pIAbAuurxtMLwpseqMJd/YM3y9ndP4tQsocNPOLpE34yjwknt21hCP+5dwtinDHdl/xEA5YKGzE3snoAR5Qsako1i4vm8U0wR1aVMeaEo83tb2epnIrxayy4QxsQcBi0HRu+JoyAx6X7j7EzKlR22t0NmzU2tmef6UhshvAmRkJZsoUhHiaCgd7UOvYWWq860DrjcCZIu9XxHZgxur/faSUQ+RPoF8P5Kq5Qj87+URaVAp2zbHeMjaju3slEzAik2nS+RRn/7eBuLciD39kMZMm+op7w2dSpxDRoI/T75Z1HQBxaAxqOc0wJmSRzdluzpLDabI2yJnGh6R7W2seA5y8P3mOw3K9Mn2Qi12BVIMykrPcSiqB1iQwV58Ohjj/Abtf98XXSloOAw9SOr1svRPokbT0QMLJn4uHqjSlNl3qB7UXy7PvQq7B+HJc1yF+AxaEeaHj6xYTHN/cQOXDufEtR+fyu6nY0VadKk24Zi30riwSrxl8j1ZVsNfq5q0KgIlmjxBdpj0N14wzpzRiUnXXCZaET39QPgSqKkhIZVdeQNLl0NJxScPdQxChG4VrSgITQ== X-Forefront-PRVS: 0241D5F98C X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(39410400002)(39450400003)(39830400002)(24454002)(86362001)(4326008)(4001350100001)(47776003)(53546006)(66066001)(25786008)(5660300001)(83506001)(2906002)(33656002)(2950100002)(6916009)(6666003)(3846002)(9686003)(6116002)(53936002)(1076002)(6506006)(50466002)(81166006)(76176999)(8676002)(50986999)(23726003)(54356999)(305945005)(110136004)(7736002)(38730400002)(189998001)(6246003)(42186005)(229853002)(54906002)(55016002)(93886004)(18370500001);DIR:OUT;SFP:1101;SCL:1;SRVR:BL2PR07MB2338;H:rric.localdomain;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BL2PR07MB2338;23:Te+4z9VJyrMc2LZfTX7aFLcf2msy7LRvmbLHll9EE?= =?us-ascii?Q?rUN8ZWWXOyLttDauxHKHal5AJgPHZWnaMiLiS90BOJfx1/i4bkegYROaymhb?= =?us-ascii?Q?eerDBLBuTdZFNNZd4UjrWhCD9kNR8AER19gITX22TiWF0svPEvFfZxsxwicj?= =?us-ascii?Q?Nf1Zja0bu4wyPuAcKdb50PprEbfEJL7l1pUthBQHz/fOJaHxWZxutpy+TjWe?= =?us-ascii?Q?OBOsXq+K4p+/2i58+a1vDt3Yqyul+Mu7NP1lb71GqE1P8a5FB4njPcnAYUNN?= =?us-ascii?Q?yLt6ZMhaXtVdOGCATb+VxDytPHXvcFU59BhZfgOxKwplPdgjMBmmYAQHZLAi?= =?us-ascii?Q?Dp0aYGhdVIYWTm7L5Mt3S8c92vudrqmuR+zh3dQBNQJranblHuzZvQSCsi+m?= =?us-ascii?Q?sm1pEnQ0bZJq++x8AOl1C9/Jrbp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ppdc1/+MRsC+qp5syCefJMh6YVdJBgFTziQHO9o4oRyAWd0z9UNco/E7EoMHwPWxpSbMVkdM+SNX45ao3reoHJDQOBdVQJlLBhGDmrkDHd0qoRlFlNz+t40jrUDI8+QpdYKDQ/1LO2Ne2hijRJwXHddvYKP55XoUnFcYR7lCKTQKPndl8E5C4vHUXXlTTY0nf+G2qkutTe1thDkDIbHZz56XvPa0lUy3wZpRcI8o3QXWxpyk2yvuyWfspaKIw==;5:Ov4IbkdT04GNIaZsppMU26k0xqQ++PQYsSFmAGgfaulGYxqT5eFTY05tJpeOOmFPKZvMtnvE3xoqyKhAIOfPfObaO95Cs+TYBXYO61kPUgSyOlRBnTmY0mK/eOhyoLFK+JKhlsDSTnhbEisZ3Rye0j/l70wd7VDIozQHxeUC5DE=;24:yJv427WFUKY73K0cu5MLkd+YoHWjW/pHntniMj9I7Qj1ciE41QNlRSeXVtMl2cxSblY0EZ5M1HGA5y2AyJ0pL0fipHm6KpNlGKcWmWqOwMo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2338;7:VhsMs9iTJ5KJ6QYcU981Vx/3j5L2jOD5vXuYm1SBPe9b+gwByNQtw1HsB7Vbk5C/SyFMkaIUPcEkW5oHqMUbkP4SBTdrev7P/ehVZzZUx7I5b1hsGtqIQ+r3i3HZUxONljQcxdX87z0waIBqQjoWlT8Q9Avq2Cc70rxmV1sF6ZA1nq3TL8uudl9C0SJIG2+SywHR8sRjGJ03wkTtoGkpVdv2DuhxOXHtuvJ8ptDcpdIM3MwQG0dJfNsBtIDbeTiFxruQP73rNQF5tAKwknLt4CsDTg23cddfEnnI+rU8o9Cc4yyGdX2gzPqM0G6BzLV8Tu2fwM9763FkNMXKyR/lYw== X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2017 12:02:18.1461 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR07MB2338 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3387 Lines: 74 On 07.03.17 18:41:33, Robin Murphy wrote: > On 07/03/17 14:06, Robert Richter wrote: > > On 06.03.17 18:22:08, Robin Murphy wrote: > >> On 06/03/17 13:58, Robert Richter wrote: > >>> The ARM SMMU detection especially depends from system firmware. For > >>> better diagnostic, log the detected type in dmesg. > >> > >> This paragraph especially depends from grammar. I think. > > > > Thanks for the mail on you. :) > > > >> > >>> The smmu type's name is now stored in struct arm_smmu_type and ACPI > >>> code is modified to use that struct too. Rename ARM_SMMU_MATCH_DATA() > >>> macro to ARM_SMMU_TYPE() for better readability. > >>> > >>> Signed-off-by: Robert Richter > >>> --- > >>> drivers/iommu/arm-smmu.c | 61 ++++++++++++++++++++++++------------------------ > >>> 1 file changed, 30 insertions(+), 31 deletions(-) > >> > >> That seems a relatively invasive diffstat for the sake of printing a > >> string once at boot time to what I can only assume is a small audience > >> of firmware developers who find "cat > >> /sys/firmware/devicetree/base/iommu*/compatible" (or the ACPI > >> equivalent) too hard ;) > > > > Reading firmware data is not really a solution as you don't know what > > the driver is doing with it. The actual background of this patch is to > > be sure a certain workaround was enabled in the kernel. ARM's cpu > > errata framework does this nicely. In case of smmus we just have the > > internal model implementation type which is not visible in the logs. > > Right now, there is no way to figure that out without knowing fw > > specifics and kernel sources. > > Ah, now it starts to become clear. In that case, if we want to confirm > the presence of specific workarounds, we should actually _confirm the > presence of specific workarounds_. I'd have no complaint with e.g. this: > > -----8<----- > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index f7411109670f..9e50a092632c 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -1934,6 +1934,8 @@ static int arm_smmu_device_cfg_probe(struct > arm_smmu_device *smmu) > atomic_add_return(smmu->num_context_banks, > &cavium_smmu_context_count); > smmu->cavium_id_base -= smmu->num_context_banks; > + dev_notice(smmu->dev, "\tusing ASID/VMID offset %u\n", > + smmu->cavium_id_base); > } > > /* ID2 */ > ----->8----- > > and the equivalent for other things, if need be. If you just print "hey, > this is SMMU-x", the user is in fact no better off, since they would > then still have to go and look at the source for whatever kernel they're > running to find out which particular workarounds for SMMU-x bugs that > particular kernel implements. I don't understand why you don't want to expose in some way the smmu type. There are a lot of things that can go wrong, esp. with firmware, to detect the proper smmu type. The above change is not a general solution too for reporting the enablement of smmu errata workarounds. The check could be done multiple times and in the fast path. For the particular problem the above would work, but still some message on the type detected would be fine. I could rework my patch in a way that .name is not permanently stored in struct arm_smmu_device. -Robert