Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp469590rwl; Wed, 29 Mar 2023 04:42:01 -0700 (PDT) X-Google-Smtp-Source: AKy350b+mofDk9tLLoQqU3CBryIbv85VPLlJ7olYWlkpeVOSgKsIAdRBP+x0tTJjC+PbOhWKiK9y X-Received: by 2002:a05:6402:48e:b0:4fa:9b39:a388 with SMTP id k14-20020a056402048e00b004fa9b39a388mr19173121edv.14.1680090121762; Wed, 29 Mar 2023 04:42:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680090121; cv=none; d=google.com; s=arc-20160816; b=c0WKlCpXOLgrupDEHQFkfugTOC78OweAkzfLN8gX7WxUSrkf1+T4uXoSkdpjaUFzWd vOmBm633l32bINw39ARWX2ee+reL0WUqIbgOXPttV7GhdDLzFB+ZHdqJxuqwbRhEMbm2 qXwLSNprx02voktX2vR8kSZx0XmKI6PQgdcZuwXIP0+WFFrcJaIq2X59/2RHw67n6H/W SopGLOwgMdM+ZNXdo7K7TYZLC33PQiJdyei8zxGwTVUwcGMDgjWUd2EeS8TIaEzv4las kMenk3Ild4s9c/vcO1z/TCHQVOjLYybnDwZDkfjG2mf658oIk+ZxtoY8x7/H/2VmVNu8 uGAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=i7ZcynCV7YYrv4qTx9V9uCUqClhw6LzI/2Aj3v4Trlk=; b=zoyBLmObJttc0fG7yt7mfqpMf1f4HD62q8jPspKdW6wan9z283lb9mYninGkDzzoti e2+ujOncYKVfzrcxM5GFf5KyKfBjWa6X4TggQsH3ORzyHEnb1zZi4ijnIZzA9m9J01cK jUUjhfjXC1yEsEWgk1Lhc/ZEjPe4IDvSZoold4VG1SdbpBdCODJSCpE4yvZTEdC5o2mT Z7vZ4HMfsdXhrglSwGHKEYCrSBS76ZoNsC1r6gQhEirv3LmCP/RPqZvzVJnU0x/J3WVU asgdoNdjfZcHYn6yr7ENXp2P8NEgknsLYnty8EJvEf6TpKlFSfALxYMmz/nr6S587nKj MtVQ== 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=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w22-20020aa7cb56000000b004ae08218725si11812877edt.303.2023.03.29.04.41.37; Wed, 29 Mar 2023 04:42:01 -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=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229718AbjC2LfD (ORCPT + 99 others); Wed, 29 Mar 2023 07:35:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbjC2LfB (ORCPT ); Wed, 29 Mar 2023 07:35:01 -0400 Received: from out30-100.freemail.mail.aliyun.com (out30-100.freemail.mail.aliyun.com [115.124.30.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C04740E4 for ; Wed, 29 Mar 2023 04:35:00 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=renyu.zj@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0VewpjER_1680089695; Received: from 30.221.149.47(mailfrom:renyu.zj@linux.alibaba.com fp:SMTPD_---0VewpjER_1680089695) by smtp.aliyun-inc.com; Wed, 29 Mar 2023 19:34:57 +0800 Message-ID: <92d5b3e1-e149-e6f2-fc37-5f9834c629ac@linux.alibaba.com> Date: Wed, 29 Mar 2023 19:34:55 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH] perf/arm-cmn: Fix and refactor device mapping resource To: Robin Murphy , Will Deacon , ilkka@os.amperecomputing.com Cc: Mark Rutland , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Shuai Xue , Zhuo Song References: <1676535470-120560-1-git-send-email-renyu.zj@linux.alibaba.com> <20230327140536.GB31752@willie-the-truck> <73eb9a5f-8e30-27b9-369e-053389d83f48@linux.alibaba.com> From: Jing Zhang In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.0 required=5.0 tests=ENV_AND_HDR_SPF_MATCH, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=unavailable 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: X-Mailing-List: linux-kernel@vger.kernel.org 在 2023/3/29 下午6:53, Robin Murphy 写道: > On 2023-03-29 10:48, Jing Zhang wrote: >> >> >> 在 2023/3/27 下午10:27, Robin Murphy 写道: >>> On 2023-03-27 15:05, Will Deacon wrote: >>>> [+Robin and Ilkka, as they contribute most to this driver] >>>> >>>> On Thu, Feb 16, 2023 at 04:17:50PM +0800, Jing Zhang wrote: >>>>> The devm_platform_ioremap_resource() won't let the platform device >>>>> claim resource when the ACPI companion device has already claimed it. >>>>> If CMN-ANY except CMN600 is ACPI companion device, it will return >>>>> -EBUSY in devm_platform_ioremap_resource(), and the driver cannot be >>>>> successfully installed. >>>>> >>>>> So let ACPI companion device call arm_cmn_acpi_probe and not claim >>>>> resource again. In addition, the arm_cmn_acpi_probe() and >>>>> arm_cmn_of_probe() functions are refactored to make them compatible >>>>> with both CMN600 and CMN-ANY. >>> >>> No, the whole point of CMN-600 probing being a special case is that the ACPI and DT bindings for CMN-600 are special cases. In ACPI, only ARMHC600 has the two nested memory resources; all the other models should only have one memory resource because one is all that is meaningful. See table 16 the document[1] in where the description of ROOTNODEBASE says "This field is specific to the CMN-600 device object." >>> >>> Similarly in DT, "arm,root-node" is only required for "arm,cmn-600" - it didn't seem worth overcomplicating the schema to actively disallow it for other models, but that is supposed to be implied by its description as "not relevant for newer CMN/CI products". >>> >>> If you're hitting this because you've written your ACPI DSDT incorrectly, it's a sign that you should fix your DSDT. >>> >>> Thanks, >>> Robin. >>> >>> [1] https://developer.arm.com/documentation/den0093/latest/ >>> >> >> Hi Robin, >> >> Yes, I know what you mean, but if a new CMN PMU device design two resources like CMN600, it will fail to load driver. > > Future CMN models won't do that, though. And if some design way down the line does end up wanting multiple memory resources for some other reason, the CMN-600 probing code almost certainly won't be the right thing anyway. Besides, firmware bindings for new models will be defined as necessary when those new models are released, and the driver will be updated as necessary at that point to support them, so this is a non-issue. > >> the specification doesn't explicitly forbid giving two ranges for CMN700 > > What do you think "specific to the CMN-600 device object" means, exactly? > >> although the example shows just one. >> So in our SoC, CMN700 is designed with two resources similar to CMN600, > > Why? Either the second resource is meaningless and the correct answer is to remove it from the DSDT, or you've actually modified the hardware design to move the CFG node somewhere else, in which case what you have is no longer an Arm CMN-700 and thus should not be claiming to be one. > >  and the overlap of resource addresses makes >> the CMN driver unable to match my CMN700. The error log: >> >> [  12.016837] arm-cmn ARMHC700:00: can't request region for resource [mem 0x40000000-0x4fffffff] >> [  12.028230] arm-cmn: probe of ARMHC700:00 failed with error -16 >> [  12.036832] arm-cmn ARMHC700:01: can't request region for resource [mem 0x40040000000-0x4004fffffff] >> [  12.051289] arm-cmn: probe of ARMHC700:01 failed with error -16 >> >> So this patch can compatible devices which has two memory resources and one memory resource, why not do it? > > The driver supports the standard firmware bindings, because if everyone ignored the standard firmware bindings and did their own thing, there could not be a standard driver. If we can tell that firmware hasn't followed the bindings because it's added random extra resources, how can we be sure that *any* of them will actually be the one we're looking for? > > Please follow the standard firmware bindings and do not hack non-standard behaviours into the driver. > Ok, I think I should remove second resource from my ACPI DSDT. Thank you.