From patchwork Tue Aug 8 08:22:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 132726 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp2328557vqr; Tue, 8 Aug 2023 11:55:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFRAWpsuzDB6WYYysIynHTiW98J2HkK21Fd+gTPkhSHyYtIJoR1PYSYTbcyqNPvDrmMlipW X-Received: by 2002:a05:6a20:1443:b0:13e:c03a:7c5d with SMTP id a3-20020a056a20144300b0013ec03a7c5dmr768368pzi.8.1691520909060; Tue, 08 Aug 2023 11:55:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691520909; cv=none; d=google.com; s=arc-20160816; b=qG8sz4XnqW2ajjS4dc4GLy2iLUf9z3Vv/c1Ll+JHNXGEQDKAjUFpNxQym0HJ7oLINE CVt1iOsjYIWjLiEzJSOyba0+TLdu2xqrmo+etTGmKaiy4A0GM3M8dc157bYbtbnzKdYb +EcMPt8nPo6ekehTqL833Na86/59+54YtUykmOwpftGz6eHF4a/FysWVulkOvDKib8sG Ye4x4cHTkPekhiX6nAUrAYfSNun4yCVwARXalkhFduOzAmowmH9341TSmW7PUAeTmYIs 793ZcomOLS84gRSSodVh2ldcFMlK9GQy/ZkGyN5gjEMVb4YN3UoYOxuJ8YG6+1TVmQwg HvmA== 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=JC2u1t9TgRDx5k7FvJLmbLB8O7+Njf3hqFzd6Yv6PjE=; fh=Amix3fM17tr65VI1fISDYxtFdk/MRmRQCaXTbLjGJHs=; b=xd+1pAgMALTdjs+8S7BrMpWmfzJUJHkZqI8z3ClY87rVOjo2K4wLA0AuWktymefoWW 0ttozX5nED8NJz7g2x7BETDza14uXhuQAuiJei4LKTdpY3kGnkaVy7K3XKb1J5rFCHmW NT4SjDu59M4YuUupJi0+8g0l5FOtL0SY2ICMiyiVF4QGa7ku6uCaxIfNkZ+6up1wY6vR FeHoGWmKwKrjiPKw7mowmUtK8XBWWR7TmpP81ExpcAjzNY6tAG0+jd+CIKP0JVCl5OE8 DbBQvEyOjZguX8cDOOkPvEoEyjP2bjY4rXjj7aixtuSlsM9sEyC0fJR+vLnaIYY70WHh 3QfQ== 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 a7-20020a634d07000000b005307d9f387esi7248966pgb.536.2023.08.08.11.54.55; Tue, 08 Aug 2023 11:55:09 -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 S232713AbjHHSd5 (ORCPT + 99 others); Tue, 8 Aug 2023 14:33:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235853AbjHHSdg (ORCPT ); Tue, 8 Aug 2023 14:33:36 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1242C2988D for ; Tue, 8 Aug 2023 10:55:43 -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 D92D11480; Tue, 8 Aug 2023 01:23:55 -0700 (PDT) Received: from a077893.blr.arm.com (unknown [10.162.40.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E37A23F64C; Tue, 8 Aug 2023 01:23:08 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, suzuki.poulose@arm.com Cc: yangyicong@huawei.com, Anshuman Khandual , Sami Mujawar , Catalin Marinas , Will Deacon , Mark Rutland , Mike Leach , Leo Yan , Alexander Shishkin , James Clark , coresight@lists.linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH V4 3/4] coresight: trbe: Add a representative coresight_platform_data for TRBE Date: Tue, 8 Aug 2023 13:52:46 +0530 Message-Id: <20230808082247.383405-4-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230808082247.383405-1-anshuman.khandual@arm.com> References: <20230808082247.383405-1-anshuman.khandual@arm.com> MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773688228637902452 X-GMAIL-MSGID: 1773688228637902452 TRBE coresight devices do not need regular connections information, as the paths get built between all percpu source and their respective percpu sink devices. Please refer 'commit 2cd87a7b293d ("coresight: core: Add support for dedicated percpu sinks")' which added support for percpu sink devices. coresight_register() expect device connections via the platform_data. TRBE devices do not have any graph connections and thus is empty. With upcoming ACPI support for TRBE, we do not get a real acpi_device and thus coresight_get_platform_dat() will end up in failures. Hence this allocates a zeroed coresight_platform_data structure and assigns that back into the device. Cc: Suzuki K Poulose Cc: Mike Leach Cc: Leo Yan Cc: Alexander Shishkin Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- drivers/hwtracing/coresight/coresight-trbe.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c index 7720619909d6..9455d62ca620 100644 --- a/drivers/hwtracing/coresight/coresight-trbe.c +++ b/drivers/hwtracing/coresight/coresight-trbe.c @@ -1494,9 +1494,20 @@ static int arm_trbe_device_probe(struct platform_device *pdev) if (!drvdata) return -ENOMEM; - pdata = coresight_get_platform_data(dev); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); + /* + * TRBE coresight devices do not need regular connections + * information, as the paths get built between all percpu + * source and their respective percpu sink devices. Though + * coresight_register() expect device connections via the + * platform_data, which TRBE devices do not have. As they + * are not real ACPI devices, coresight_get_platform_data() + * ends up failing. Instead let's allocate a dummy zeroed + * coresight_platform_data structure and assign that back + * into the device for that purpose. + */ + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return -ENOMEM; dev_set_drvdata(dev, drvdata); dev->platform_data = pdata;