From patchwork Thu Aug 17 05:54:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 136017 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b82d:0:b0:3f2:4152:657d with SMTP id z13csp1411360vqi; Fri, 18 Aug 2023 06:44:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGpcx9SoNDGD6xeA12cFlVkrhlTMmRNEOduxoykTmc/FyzOAB2pdySY6r+GyZceXGqAG0qu X-Received: by 2002:a17:906:dc:b0:99d:e8a5:45d6 with SMTP id 28-20020a17090600dc00b0099de8a545d6mr1979752eji.34.1692366274533; Fri, 18 Aug 2023 06:44:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692366274; cv=none; d=google.com; s=arc-20160816; b=f8MX+xDnqKAPQKQzowXe94MojM/vzfSL9wUDytSnVpj/o79e1eUkGeph+onE17UUX4 NQH32IS6WWz0G05RDafPnvV4gdiWT5C9IjW0l55tO4ar+9ijtCl+FcfaqP5WjPF5CyeV dp14eKmweOj6NhK83EcN+7H97Uq5qlVzm7VJ+/gpIDCsRQ6zGnmeYpBDJ03BH953kVpu Vq6h3NyQmYeP4W2rQuPBIrhQhKaMrTKzkrw1ZIe2T/mqvQdCaFd6bTYNlX6OyByNOj/u CX9vuE56KsFz3chwB2v1y6BFWOvXWVfF9zYCHRUj/j+7k+7MuyTPvqYdfS25PlovthIy i/Ow== 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=AXEDLvx4qHGyM0SrofG+eBLywcBoBf0S8X6vcPVlwOKJTQ8ieg/VEr/FrpZSqkw9B0 Bv93B/nt/RchumxFe3fN/HgpTOeBUgIZ2AchiUctLpyz+y4ir8FwAkpy5fnR0RodOf2/ Si52MQr1z9mB5MjK2kswLpYzlC6OEKwfmoZokMqZrMie4rBLcs5G3ReMKM5diF5pRgbb knKIDZyiRz8T745Pr9Wtv7TSSJ0B/PnwENTHiPPiVBL4k5pWg3C0nE9e4LVsdY5dBELY /AARmIhAk6sr/keO43Jp5ftZ0rf8YuMlssK1bhOrGesE/cRdVGr3xv2OMBh23qvApIlW FpQw== 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 gf2-20020a170906e20200b00993ebae9929si1329368ejb.708.2023.08.18.06.44.09; Fri, 18 Aug 2023 06:44:34 -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 S1348157AbjHQFy6 (ORCPT + 99 others); Thu, 17 Aug 2023 01:54:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348137AbjHQFym (ORCPT ); Thu, 17 Aug 2023 01:54:42 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C6F12211E for ; Wed, 16 Aug 2023 22:54:40 -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 69C7FD75; Wed, 16 Aug 2023 22:55:21 -0700 (PDT) Received: from a077893.arm.com (unknown [10.163.56.113]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 743433F762; Wed, 16 Aug 2023 22:54:35 -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 V5 3/4] coresight: trbe: Add a representative coresight_platform_data for TRBE Date: Thu, 17 Aug 2023 11:24:04 +0530 Message-Id: <20230817055405.249630-4-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230817055405.249630-1-anshuman.khandual@arm.com> References: <20230817055405.249630-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: 1774574658473173667 X-GMAIL-MSGID: 1774574658473173667 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; From patchwork Thu Aug 17 05:54:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 136297 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b82d:0:b0:3f2:4152:657d with SMTP id z13csp2623000vqi; Sun, 20 Aug 2023 12:34:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFbi3660mt/muAiZUaBk6S9F8xkyIO8yFCQbt53KoF2nA1tdHsYUwjJN/hqYMYBFqYSv2Os X-Received: by 2002:a05:6a20:9702:b0:137:e595:830f with SMTP id hr2-20020a056a20970200b00137e595830fmr2438172pzc.57.1692560081261; Sun, 20 Aug 2023 12:34:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692560081; cv=none; d=google.com; s=arc-20160816; b=Z2N378HEXEcZCRmf4vpf9UgP4O522FazwnRBIhkin0ZmIBprSQkA4Hs+xbbACA1NdX AZ7ml+rHSUofmKtbh1Q4cTaRa1Tz+QmK6YbZYuGJOHYAlNk+rCOLYP+gb+6ZouM4zGhv NGuudLOwCZUK2PWXaMj09IBzCmwx1GmcDc5b4jOFAyWhsBy0bCx3iAYNrJQuVIWpjywF cydcIKHR8xiUtRLgktHdTRh89w76uRi02zeqjgnZrgLIoAPAXsMgRoYUZ05vPw8pgbWl rnnzKb3UbqDu4LdYTi07xnTOhpOMSUbswjgMlehqewdWd2epPKyEBjOX1rQLOVO3Hpf0 /ybw== 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=4UhGJvisDVMQMCZv8SkHZ/CXNnJ+ricqwiek4ORpzZ8=; fh=Amix3fM17tr65VI1fISDYxtFdk/MRmRQCaXTbLjGJHs=; b=R+6L5SSzXvjigRUsUVM/tANfIKHFEkX5t3ufsGtsituj1brv3UpKQGukFK3zABQoy8 BMDxk7mC13Ic6MmKrcVG3tzZZmrffwoGZ7VMCeo3f2bymO4vUTi7dlGsOkj9+qJZs+uo fIHuErFRuZugWro/EvYuqHC4qm85KJxcqvRWgnDModFHgVQxZqa1Xqs7fy2f19WG+475 lGcizhuRkrfdzN/fmWNSh9a7DQkWENRTI0kBZ/FWjXTe8jK75fewnVf890Ugp1e6v5hi FrBWEGOJ2J8hias15Yz3H4hCz/Re67dj1Nkbj489CvVmXv3F5m/sWN8PzRTxX67uxY5H vlvQ== 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:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id je7-20020a170903264700b001b86ddfd49bsi5361182plb.6.2023.08.20.12.34.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Aug 2023 12:34:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 48101372160; Sat, 19 Aug 2023 12:09:38 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348162AbjHQFzA (ORCPT + 99 others); Thu, 17 Aug 2023 01:55:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348138AbjHQFys (ORCPT ); Thu, 17 Aug 2023 01:54:48 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E507D211E for ; Wed, 16 Aug 2023 22:54:46 -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 88808D75; Wed, 16 Aug 2023 22:55:27 -0700 (PDT) Received: from a077893.arm.com (unknown [10.163.56.113]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3ADCA3F762; Wed, 16 Aug 2023 22:54:40 -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 V5 4/4] coresight: trbe: Enable ACPI based TRBE devices Date: Thu, 17 Aug 2023 11:24:05 +0530 Message-Id: <20230817055405.249630-5-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230817055405.249630-1-anshuman.khandual@arm.com> References: <20230817055405.249630-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: 1774777879820474225 X-GMAIL-MSGID: 1774777879820474225 This detects and enables ACPI based TRBE devices via the dummy platform device created earlier for this purpose. 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 | 9 +++++++++ drivers/hwtracing/coresight/coresight-trbe.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c index 9455d62ca620..9c59e2652b20 100644 --- a/drivers/hwtracing/coresight/coresight-trbe.c +++ b/drivers/hwtracing/coresight/coresight-trbe.c @@ -1548,7 +1548,16 @@ static const struct of_device_id arm_trbe_of_match[] = { }; MODULE_DEVICE_TABLE(of, arm_trbe_of_match); +#ifdef CONFIG_ACPI +static const struct platform_device_id arm_trbe_acpi_match[] = { + { ARMV8_TRBE_PDEV_NAME, 0 }, + { } +}; +MODULE_DEVICE_TABLE(platform, arm_trbe_acpi_match); +#endif + static struct platform_driver arm_trbe_driver = { + .id_table = ACPI_PTR(arm_trbe_acpi_match), .driver = { .name = DRVNAME, .of_match_table = of_match_ptr(arm_trbe_of_match), diff --git a/drivers/hwtracing/coresight/coresight-trbe.h b/drivers/hwtracing/coresight/coresight-trbe.h index 77cbb5c63878..fce1735d5c58 100644 --- a/drivers/hwtracing/coresight/coresight-trbe.h +++ b/drivers/hwtracing/coresight/coresight-trbe.h @@ -7,11 +7,13 @@ * * Author: Anshuman Khandual */ +#include #include #include #include #include #include +#include #include #include