Message ID | 20230317030501.1811905-7-anshuman.khandual@arm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp117854wrt; Thu, 16 Mar 2023 20:11:32 -0700 (PDT) X-Google-Smtp-Source: AK7set98EfIZiamPDiVGb0v6gU9OAoLx/GMukKOSibTtrxFLc4sAT0Lq1DKshvTpM3abUZufr2xU X-Received: by 2002:a92:cb4c:0:b0:315:9891:85d7 with SMTP id f12-20020a92cb4c000000b00315989185d7mr887390ilq.16.1679022692232; Thu, 16 Mar 2023 20:11:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679022692; cv=none; d=google.com; s=arc-20160816; b=cxoXZgjeff0lScD2bQmcCoAl1VjF48s/L5oSUASLPbk3Vm35O1+DjTLJXNJ76rXWb5 IIWchDinAv/FbrYdvg+IJ4WyCSJvkBTKMihSnlHkU6QwIDsW4NxMi9H1lgJNdnJK5xKi 8ytcred5BBsmNhgdF5pBYFV8Sel5AnSnNANVIHVkRF8yf5DIzL7NVOnVoIR0q8oGXRxz 6Dw1lphGFebWBvW/g6E7Xbip2Gzw1yb3n7uIQZfhiMtrT/VYVhmkWJq09FwSIaLHTT4h LxE2EqynXbYUrZlqJDKBFfRvid0pI6egiYtQQzuxpSfR4sEPFnrDl8+YAW7ODcVBCHtx 0r0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=tebm3XRXTkPIirCaUrLLTzOi8HiG+SZHUopngVfEwWg=; b=oeAnvmfl2waIf7sh3NW3Hbq9RNDda/ZemiqyFbAaTda1Bx1dLUTb64M8KWJ2QBCVBQ x4oZgZhJeJIT3xmkrlojdnj9RxB7rADHaqglzbNFsdPXPTZNQYQEeRjMGKgHJN2oWqjn gzM4JOs38MsC9thfKSBFqYeRUqp47qSqp31HNtmGHzCiLQSMQAHm3tXHaZZC6vnFnQ/r 4cWszdwaZZpAtQmWSnPkIhFMtyrNKVkJQA2CU6OTwfH9Z5Fs7kxRI3tHVyutgYuQXzW/ 8dMEJlUeylg1bx3pMB/7hNtxHrMF9klK92s2u56oH7yYAUnUK296eKDYoZEUa5QkppB0 TyYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k7-20020a056e021a8700b00318d4c5ba39si1190577ilv.29.2023.03.16.20.11.17; Thu, 16 Mar 2023 20:11:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230044AbjCQDHA (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Thu, 16 Mar 2023 23:07:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229702AbjCQDGP (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 16 Mar 2023 23:06:15 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0425CB1ED1; Thu, 16 Mar 2023 20:06:00 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 826B24B3; Thu, 16 Mar 2023 20:06:43 -0700 (PDT) Received: from a077893.blr.arm.com (unknown [10.162.40.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C0DE63F64C; Thu, 16 Mar 2023 20:05:53 -0700 (PDT) From: Anshuman Khandual <anshuman.khandual@arm.com> To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, suzuki.poulose@arm.com Cc: scclevenger@os.amperecomputing.com, Anshuman Khandual <anshuman.khandual@arm.com>, Rob Herring <robh+dt@kernel.org>, Frank Rowand <frowand.list@gmail.com>, Russell King <linux@armlinux.org.uk>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Rafael J. Wysocki" <rafael@kernel.org>, Len Brown <lenb@kernel.org>, Sudeep Holla <sudeep.holla@arm.com>, Lorenzo Pieralisi <lpieralisi@kernel.org>, Mathieu Poirier <mathieu.poirier@linaro.org>, Mike Leach <mike.leach@linaro.org>, Leo Yan <leo.yan@linaro.org>, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/7] of/platform: Skip coresight etm4x devices from AMBA bus Date: Fri, 17 Mar 2023 08:35:00 +0530 Message-Id: <20230317030501.1811905-7-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230317030501.1811905-1-anshuman.khandual@arm.com> References: <20230317030501.1811905-1-anshuman.khandual@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760582898653630386?= X-GMAIL-MSGID: =?utf-8?q?1760582898653630386?= |
Series |
coresight: etm4x: Migrate AMBA devices to platform driver
|
|
Commit Message
Anshuman Khandual
March 17, 2023, 3:05 a.m. UTC
Allow other drivers to claim a device, disregarding the "priority" of "arm,primecell". e.g., CoreSight ETM4x devices could be accessed via MMIO (AMBA Bus) or via CPU system instructions. The CoreSight ETM4x platform driver can now handle both types of devices. In order to make sure the driver gets to handle the "MMIO based" devices, which always had the "arm,primecell" compatible, we have two options : 1) Remove the "arm,primecell" from the DTS. But this may be problematic for an older kernel without the support. 2) The other option is to allow OF code to "ignore" the arm,primecell priority for a selected list of compatibles. This would make sure that both older kernels and the new kernels work fine without breaking the functionality. The new DTS could always have the "arm,primecell" removed. This patch implements Option (2). Cc: Rob Herring <robh+dt@kernel.org> Cc: Frank Rowand <frowand.list@gmail.com> Cc: Russell King (Oracle) <linux@armlinux.org.uk> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org Co-developed-by: Suzuki Poulose <suzuki.poulose@arm.com> Signed-off-by: Suzuki Poulose <suzuki.poulose@arm.com> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> --- drivers/of/platform.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
Comments
On Thu, Mar 16, 2023 at 10:06 PM Anshuman Khandual <anshuman.khandual@arm.com> wrote: > > Allow other drivers to claim a device, disregarding the "priority" of > "arm,primecell". e.g., CoreSight ETM4x devices could be accessed via MMIO > (AMBA Bus) or via CPU system instructions. The OS can pick which one, use both, or this is a system integration time decision? > The CoreSight ETM4x platform > driver can now handle both types of devices. In order to make sure the > driver gets to handle the "MMIO based" devices, which always had the > "arm,primecell" compatible, we have two options : > > 1) Remove the "arm,primecell" from the DTS. But this may be problematic > for an older kernel without the support. > > 2) The other option is to allow OF code to "ignore" the arm,primecell > priority for a selected list of compatibles. This would make sure that > both older kernels and the new kernels work fine without breaking > the functionality. The new DTS could always have the "arm,primecell" > removed. 3) Drop patches 6 and 7 and just register as both AMBA and platform drivers. It's just some extra boilerplate. I would also do different compatible strings for CPU system instruction version (assuming this is an integration time decision). > > This patch implements Option (2). > > Cc: Rob Herring <robh+dt@kernel.org> > Cc: Frank Rowand <frowand.list@gmail.com> > Cc: Russell King (Oracle) <linux@armlinux.org.uk> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Cc: devicetree@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Co-developed-by: Suzuki Poulose <suzuki.poulose@arm.com> > Signed-off-by: Suzuki Poulose <suzuki.poulose@arm.com> > Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> > --- > drivers/of/platform.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/of/platform.c b/drivers/of/platform.c > index b2bd2e783445..59ff1a38ccaa 100644 > --- a/drivers/of/platform.c > +++ b/drivers/of/platform.c > @@ -325,6 +325,13 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l > return NULL; > } > > +static const struct of_device_id of_ignore_amba_table[] = { > +#ifdef CONFIG_CORESIGHT_SOURCE_ETM4X > + { .compatible = "arm,coresight-etm4x" }, > +#endif > + {} /* NULL terminated */ > +}; > + > /** > * of_platform_bus_create() - Create a device for a node and its children. > * @bus: device node of the bus to instantiate > @@ -373,7 +380,8 @@ static int of_platform_bus_create(struct device_node *bus, > platform_data = auxdata->platform_data; > } > > - if (of_device_is_compatible(bus, "arm,primecell")) { > + if (of_device_is_compatible(bus, "arm,primecell") && > + unlikely(!of_match_node(of_ignore_amba_table, bus))) { of_match_node is going to take orders of magnitude longer than any difference unlikely() would make. Drop it. > /* > * Don't return an error here to keep compatibility with older > * device tree files. > -- > 2.25.1 >
Hi Rob Thanks for your response. On 17/03/2023 14:52, Rob Herring wrote: > On Thu, Mar 16, 2023 at 10:06 PM Anshuman Khandual > <anshuman.khandual@arm.com> wrote: >> >> Allow other drivers to claim a device, disregarding the "priority" of >> "arm,primecell". e.g., CoreSight ETM4x devices could be accessed via MMIO >> (AMBA Bus) or via CPU system instructions. > > The OS can pick which one, use both, or this is a system integration > time decision? Not an OS choice. Historically, this has always been MMIO accessed but with v8.4 TraceFiltering support, CPUs are encouraged to use system instructions and obsolete MMIO. So, yes, MMIO is still possible but something that is discouraged and have to be decided at system integration time. > >> The CoreSight ETM4x platform >> driver can now handle both types of devices. In order to make sure the >> driver gets to handle the "MMIO based" devices, which always had the >> "arm,primecell" compatible, we have two options : >> >> 1) Remove the "arm,primecell" from the DTS. But this may be problematic >> for an older kernel without the support. >> >> 2) The other option is to allow OF code to "ignore" the arm,primecell >> priority for a selected list of compatibles. This would make sure that >> both older kernels and the new kernels work fine without breaking >> the functionality. The new DTS could always have the "arm,primecell" >> removed. > > 3) Drop patches 6 and 7 and just register as both AMBA and platform > drivers. It's just some extra boilerplate. I would also do different > compatible strings for CPU system instruction version (assuming this > is an integration time decision). The system instruction (and the reigster layouts) are all part of the ETMv4/ETE architecture and specific capabilities/features are discoverable, just like the Arm CPUs. Thus we don't need special versions within the ETMv4x or ETE minor versions. As of now, we have one for etm4x and another for ete. One problem with the AMBA driver in place is having to keep on adding new PIDs for the CPUs. The other option is to have a blanket mask for matching the PIDs with AMBA_UCI_ID checks. > >> >> This patch implements Option (2). >> >> Cc: Rob Herring <robh+dt@kernel.org> >> Cc: Frank Rowand <frowand.list@gmail.com> >> Cc: Russell King (Oracle) <linux@armlinux.org.uk> >> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> >> Cc: devicetree@vger.kernel.org >> Cc: linux-kernel@vger.kernel.org >> Co-developed-by: Suzuki Poulose <suzuki.poulose@arm.com> >> Signed-off-by: Suzuki Poulose <suzuki.poulose@arm.com> >> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> >> --- >> drivers/of/platform.c | 10 +++++++++- >> 1 file changed, 9 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/of/platform.c b/drivers/of/platform.c >> index b2bd2e783445..59ff1a38ccaa 100644 >> --- a/drivers/of/platform.c >> +++ b/drivers/of/platform.c >> @@ -325,6 +325,13 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l >> return NULL; >> } >> >> +static const struct of_device_id of_ignore_amba_table[] = { >> +#ifdef CONFIG_CORESIGHT_SOURCE_ETM4X >> + { .compatible = "arm,coresight-etm4x" }, >> +#endif >> + {} /* NULL terminated */ >> +}; >> + >> /** >> * of_platform_bus_create() - Create a device for a node and its children. >> * @bus: device node of the bus to instantiate >> @@ -373,7 +380,8 @@ static int of_platform_bus_create(struct device_node *bus, >> platform_data = auxdata->platform_data; >> } >> >> - if (of_device_is_compatible(bus, "arm,primecell")) { >> + if (of_device_is_compatible(bus, "arm,primecell") && >> + unlikely(!of_match_node(of_ignore_amba_table, bus))) { > > of_match_node is going to take orders of magnitude longer than any > difference unlikely() would make. Drop it. Agreed. Suzuki > >> /* >> * Don't return an error here to keep compatibility with older >> * device tree files. >> -- >> 2.25.1 >>
On Fri, Mar 17, 2023 at 11:03 AM Suzuki K Poulose <suzuki.poulose@arm.com> wrote: > > Hi Rob > > Thanks for your response. > > On 17/03/2023 14:52, Rob Herring wrote: > > On Thu, Mar 16, 2023 at 10:06 PM Anshuman Khandual > > <anshuman.khandual@arm.com> wrote: > >> > >> Allow other drivers to claim a device, disregarding the "priority" of > >> "arm,primecell". e.g., CoreSight ETM4x devices could be accessed via MMIO > >> (AMBA Bus) or via CPU system instructions. > > > > The OS can pick which one, use both, or this is a system integration > > time decision? > > Not an OS choice. Historically, this has always been MMIO accessed but > with v8.4 TraceFiltering support, CPUs are encouraged to use system > instructions and obsolete MMIO. So, yes, MMIO is still possible but > something that is discouraged and have to be decided at system > integration time. > > > > >> The CoreSight ETM4x platform > >> driver can now handle both types of devices. In order to make sure the > >> driver gets to handle the "MMIO based" devices, which always had the > >> "arm,primecell" compatible, we have two options : > >> > >> 1) Remove the "arm,primecell" from the DTS. But this may be problematic > >> for an older kernel without the support. > >> > >> 2) The other option is to allow OF code to "ignore" the arm,primecell > >> priority for a selected list of compatibles. This would make sure that > >> both older kernels and the new kernels work fine without breaking > >> the functionality. The new DTS could always have the "arm,primecell" > >> removed. > > > > 3) Drop patches 6 and 7 and just register as both AMBA and platform > > drivers. It's just some extra boilerplate. I would also do different > > compatible strings for CPU system instruction version (assuming this > > is an integration time decision). > > The system instruction (and the reigster layouts) are all part of the > ETMv4/ETE architecture and specific capabilities/features are > discoverable, just like the Arm CPUs. Thus we don't need special > versions within the ETMv4x or ETE minor versions. As of now, we have > one for etm4x and another for ete. I just meant 2 new compatible strings. One each for ETMv4x and ETE, but different from the 2 existing ones. It is different h/w presented to the OS, so different compatible. > One problem with the AMBA driver in place is having to keep on adding > new PIDs for the CPUs. The other option is to have a blanket mask > for matching the PIDs with AMBA_UCI_ID checks. But if MMIO access is discouraged, then new h/w would use the platform driver(s), not the amba driver, and you won't have to add PIDs. Rob
On 3/17/23 21:33, Suzuki K Poulose wrote: >>> drivers/of/platform.c | 10 +++++++++- >>> 1 file changed, 9 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/of/platform.c b/drivers/of/platform.c >>> index b2bd2e783445..59ff1a38ccaa 100644 >>> --- a/drivers/of/platform.c >>> +++ b/drivers/of/platform.c >>> @@ -325,6 +325,13 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l >>> return NULL; >>> } >>> >>> +static const struct of_device_id of_ignore_amba_table[] = { >>> +#ifdef CONFIG_CORESIGHT_SOURCE_ETM4X >>> + { .compatible = "arm,coresight-etm4x" }, >>> +#endif >>> + {} /* NULL terminated */ >>> +}; >>> + >>> /** >>> * of_platform_bus_create() - Create a device for a node and its children. >>> * @bus: device node of the bus to instantiate >>> @@ -373,7 +380,8 @@ static int of_platform_bus_create(struct device_node *bus, >>> platform_data = auxdata->platform_data; >>> } >>> >>> - if (of_device_is_compatible(bus, "arm,primecell")) { >>> + if (of_device_is_compatible(bus, "arm,primecell") && >>> + unlikely(!of_match_node(of_ignore_amba_table, bus))) { >> >> of_match_node is going to take orders of magnitude longer than any >> difference unlikely() would make. Drop it. > > Agreed. Sure, will drop the unlikely() here.
On 17/03/2023 20:06, Rob Herring wrote: > On Fri, Mar 17, 2023 at 11:03 AM Suzuki K Poulose > <suzuki.poulose@arm.com> wrote: >> >> Hi Rob >> >> Thanks for your response. >> >> On 17/03/2023 14:52, Rob Herring wrote: >>> On Thu, Mar 16, 2023 at 10:06 PM Anshuman Khandual >>> <anshuman.khandual@arm.com> wrote: >>>> >>>> Allow other drivers to claim a device, disregarding the "priority" of >>>> "arm,primecell". e.g., CoreSight ETM4x devices could be accessed via MMIO >>>> (AMBA Bus) or via CPU system instructions. >>> >>> The OS can pick which one, use both, or this is a system integration >>> time decision? >> >> Not an OS choice. Historically, this has always been MMIO accessed but >> with v8.4 TraceFiltering support, CPUs are encouraged to use system >> instructions and obsolete MMIO. So, yes, MMIO is still possible but >> something that is discouraged and have to be decided at system >> integration time. >> >>> >>>> The CoreSight ETM4x platform >>>> driver can now handle both types of devices. In order to make sure the >>>> driver gets to handle the "MMIO based" devices, which always had the >>>> "arm,primecell" compatible, we have two options : >>>> >>>> 1) Remove the "arm,primecell" from the DTS. But this may be problematic >>>> for an older kernel without the support. >>>> >>>> 2) The other option is to allow OF code to "ignore" the arm,primecell >>>> priority for a selected list of compatibles. This would make sure that >>>> both older kernels and the new kernels work fine without breaking >>>> the functionality. The new DTS could always have the "arm,primecell" >>>> removed. >>> >>> 3) Drop patches 6 and 7 and just register as both AMBA and platform >>> drivers. It's just some extra boilerplate. I would also do different >>> compatible strings for CPU system instruction version (assuming this >>> is an integration time decision). >> >> The system instruction (and the reigster layouts) are all part of the >> ETMv4/ETE architecture and specific capabilities/features are >> discoverable, just like the Arm CPUs. Thus we don't need special >> versions within the ETMv4x or ETE minor versions. As of now, we have >> one for etm4x and another for ete. > > I just meant 2 new compatible strings. One each for ETMv4x and ETE, > but different from the 2 existing ones. It is different h/w presented > to the OS, so different compatible. > Sorry, was not very clear here. Right now, we have : 1) arm,coresight-etm4x && arm,primecell - For AMBA based devices 2) arm,coresight-etm4x-sysreg - For system instruction based 3) arm,embedded-trace-extension - For ETE >> One problem with the AMBA driver in place is having to keep on adding >> new PIDs for the CPUs. The other option is to have a blanket mask >> for matching the PIDs with AMBA_UCI_ID checks. > > But if MMIO access is discouraged, then new h/w would use the platform > driver(s), not the amba driver, and you won't have to add PIDs. Yes for v8.4 onwards. Alternatively, the newer DTS could skip arm,primecell in the entry and that would kick the platform driver in. So, that should be fine I guess. Kind regards Suzuki > > Rob
On Mon, Mar 20, 2023 at 5:37 AM Suzuki K Poulose <suzuki.poulose@arm.com> wrote: > > > On 17/03/2023 20:06, Rob Herring wrote: > > On Fri, Mar 17, 2023 at 11:03 AM Suzuki K Poulose > > <suzuki.poulose@arm.com> wrote: > >> > >> Hi Rob > >> > >> Thanks for your response. > >> > >> On 17/03/2023 14:52, Rob Herring wrote: > >>> On Thu, Mar 16, 2023 at 10:06 PM Anshuman Khandual > >>> <anshuman.khandual@arm.com> wrote: > >>>> > >>>> Allow other drivers to claim a device, disregarding the "priority" of > >>>> "arm,primecell". e.g., CoreSight ETM4x devices could be accessed via MMIO > >>>> (AMBA Bus) or via CPU system instructions. > >>> > >>> The OS can pick which one, use both, or this is a system integration > >>> time decision? > >> > >> Not an OS choice. Historically, this has always been MMIO accessed but > >> with v8.4 TraceFiltering support, CPUs are encouraged to use system > >> instructions and obsolete MMIO. So, yes, MMIO is still possible but > >> something that is discouraged and have to be decided at system > >> integration time. > >> > >>> > >>>> The CoreSight ETM4x platform > >>>> driver can now handle both types of devices. In order to make sure the > >>>> driver gets to handle the "MMIO based" devices, which always had the > >>>> "arm,primecell" compatible, we have two options : > >>>> > >>>> 1) Remove the "arm,primecell" from the DTS. But this may be problematic > >>>> for an older kernel without the support. > >>>> > >>>> 2) The other option is to allow OF code to "ignore" the arm,primecell > >>>> priority for a selected list of compatibles. This would make sure that > >>>> both older kernels and the new kernels work fine without breaking > >>>> the functionality. The new DTS could always have the "arm,primecell" > >>>> removed. > >>> > >>> 3) Drop patches 6 and 7 and just register as both AMBA and platform > >>> drivers. It's just some extra boilerplate. I would also do different > >>> compatible strings for CPU system instruction version (assuming this > >>> is an integration time decision). > >> > >> The system instruction (and the reigster layouts) are all part of the > >> ETMv4/ETE architecture and specific capabilities/features are > >> discoverable, just like the Arm CPUs. Thus we don't need special > >> versions within the ETMv4x or ETE minor versions. As of now, we have > >> one for etm4x and another for ete. > > > > I just meant 2 new compatible strings. One each for ETMv4x and ETE, > > but different from the 2 existing ones. It is different h/w presented > > to the OS, so different compatible. > > > > Sorry, was not very clear here. > > Right now, we have : > > 1) arm,coresight-etm4x && arm,primecell - For AMBA based devices > 2) arm,coresight-etm4x-sysreg - For system instruction based > 3) arm,embedded-trace-extension - For ETE Ah, so we already have that... > > > >> One problem with the AMBA driver in place is having to keep on adding > >> new PIDs for the CPUs. The other option is to have a blanket mask > >> for matching the PIDs with AMBA_UCI_ID checks. > > > > But if MMIO access is discouraged, then new h/w would use the platform > > driver(s), not the amba driver, and you won't have to add PIDs. > > Yes for v8.4 onwards. Alternatively, the newer DTS could skip > arm,primecell in the entry and that would kick the platform driver > in. So, that should be fine I guess. Except that the new dts would not work with older kernels. I'm now lost as to what problem this series is trying to solve. Will reply further on cover letter... Rob
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index b2bd2e783445..59ff1a38ccaa 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -325,6 +325,13 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l return NULL; } +static const struct of_device_id of_ignore_amba_table[] = { +#ifdef CONFIG_CORESIGHT_SOURCE_ETM4X + { .compatible = "arm,coresight-etm4x" }, +#endif + {} /* NULL terminated */ +}; + /** * of_platform_bus_create() - Create a device for a node and its children. * @bus: device node of the bus to instantiate @@ -373,7 +380,8 @@ static int of_platform_bus_create(struct device_node *bus, platform_data = auxdata->platform_data; } - if (of_device_is_compatible(bus, "arm,primecell")) { + if (of_device_is_compatible(bus, "arm,primecell") && + unlikely(!of_match_node(of_ignore_amba_table, bus))) { /* * Don't return an error here to keep compatibility with older * device tree files.