From patchwork Tue Aug 1 09:40:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 129130 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2567038vqg; Tue, 1 Aug 2023 03:15:57 -0700 (PDT) X-Google-Smtp-Source: APBJJlFv6o1iLgewSliO2PISCAUJD2hM8Tb5Qt0/Zt3+Gse9RCPRxQHUbkoudTOJqoF09KrqxhvE X-Received: by 2002:a17:902:dace:b0:1b8:17e8:5472 with SMTP id q14-20020a170902dace00b001b817e85472mr11866624plx.1.1690884957111; Tue, 01 Aug 2023 03:15:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690884957; cv=none; d=google.com; s=arc-20160816; b=BptFNMyaUOyLqFUU/G8P5EOpK9+QrjFe5GAJW4Onq+TOMvu2svrKqkp6ZFT9VfhrLq +K1Gl0voQoWgY2goxA0J37XDalU8OggZJjZTd76MDnnDQ1H39X06JmRjusTrcb1TBftc EaEvi/uMPFgsvAO6TxijZ97DI1EEb7Rigu1SS4ozemBlWmtX/lYBNW/HQGBW+ovZJ7YV 8UycfT2KieMWuE39Gl+Mt9e6cgS8zhv8+gf5yZqqLmtpmubZI1vYm7X+rKUplOH+ip5S UCdsr9uCMuVXXPVNJJEXQ1aLd7ExNgUMXPqVYjPijZxoLnkZ8RtjqvPwE+WLE69cYS6S +jdA== 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=bYCPTVIltoncEoED5uweOw5rPh+T1pbonACAot5wGbo=; fh=J+p7EhpAaI9pLvGhGO08nD/3D2XA+A6RPzvd+bjr8cY=; b=q9nMVrF5yiM1Vay8S+3QuU5GDtNLGeWz3E1wAHBCyNSwuyjcjqFyTKILdHkphTsdUE dFiK3RRsYQ7UO90fCaCQzUhjS21MbgA+rTl1QLhrGLGgnXqVCnCkB80VVLlrMARWvQCW Vvmju6GAP6+NqX5IxSgOxEj47SjJKor3QMA/qeyI9yCNEm5MSBE4JUjTSnPN6L+s1OoD ThYYvOJ4rp6F9weGh1ls9wyvZfNpRK6YZGP8xIbYbJVcJ5w+OXD52BBHsAv3G4hFoO/a 0n77J3Gkik8+VBI3BskPpbgLd0nj6AYlynbRNixtS8wvT3eacsbeAgAyTQzAUvHPkIo1 S0SQ== 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 m13-20020a170902d18d00b001bb9e3bae96si4743134plb.255.2023.08.01.03.15.43; Tue, 01 Aug 2023 03:15:57 -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 S233461AbjHAJno (ORCPT + 99 others); Tue, 1 Aug 2023 05:43:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233401AbjHAJn0 (ORCPT ); Tue, 1 Aug 2023 05:43:26 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D83955FF3 for ; Tue, 1 Aug 2023 02:41:09 -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 B956811FB; Tue, 1 Aug 2023 02:41:52 -0700 (PDT) Received: from a077893.arm.com (unknown [10.163.53.114]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 66ABF3F5A1; Tue, 1 Aug 2023 02:41:06 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, suzuki.poulose@arm.com Cc: Anshuman Khandual , Catalin Marinas , Will Deacon , Mark Rutland , linux-kernel@vger.kernel.org Subject: [PATCH V2 1/4] arm_pmu: acpi: Refactor arm_spe_acpi_register_device() Date: Tue, 1 Aug 2023 15:10:49 +0530 Message-Id: <20230801094052.750416-2-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230801094052.750416-1-anshuman.khandual@arm.com> References: <20230801094052.750416-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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: 1773021384703183830 X-GMAIL-MSGID: 1773021384703183830 Sanity checking all the GICC tables for same interrupt number, and ensuring a homogeneous ACPI based machine, could be used for other platform devices as well. Hence this refactors arm_spe_acpi_register_device() into a common helper arm_acpi_register_pmu_device(). Cc: Catalin Marinas Cc: Will Deacon Cc: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Co-developed-by: Will Deacon Signed-off-by: Will Deacon Signed-off-by: Anshuman Khandual --- drivers/perf/arm_pmu_acpi.c | 110 +++++++++++++++++++++++------------- 1 file changed, 70 insertions(+), 40 deletions(-) diff --git a/drivers/perf/arm_pmu_acpi.c b/drivers/perf/arm_pmu_acpi.c index 90815ad762eb..d9d5a7bbb92f 100644 --- a/drivers/perf/arm_pmu_acpi.c +++ b/drivers/perf/arm_pmu_acpi.c @@ -70,6 +70,68 @@ static void arm_pmu_acpi_unregister_irq(int cpu) } #if IS_ENABLED(CONFIG_ARM_SPE_PMU) +static int +arm_acpi_register_pmu_device(struct platform_device *pdev, u8 len, + u16 (*parse_gsi)(struct acpi_madt_generic_interrupt *)) +{ + int cpu, hetid, irq, ret; + bool matched = false; + u16 gsi = 0; + + /* + * Ensure that platform device must have IORESOURCE_IRQ + * resource to hold gsi interrupt. + */ + if (pdev->num_resources != 1) + return -ENXIO; + + if (pdev->resource[0].flags != IORESOURCE_IRQ) + return -ENXIO; + + /* + * Sanity check all the GICC tables for the same interrupt + * number. For now, only support homogeneous ACPI machines. + */ + for_each_possible_cpu(cpu) { + struct acpi_madt_generic_interrupt *gicc; + u16 this_gsi; + + gicc = acpi_cpu_get_madt_gicc(cpu); + if (gicc->header.length < len) + return matched ? -ENXIO : 0; + + this_gsi = parse_gsi(gicc); + if (!this_gsi) + return matched ? -ENXIO : 0; + + if (!matched) { + hetid = find_acpi_cpu_topology_hetero_id(cpu); + gsi = this_gsi; + matched = true; + } else if (hetid != find_acpi_cpu_topology_hetero_id(cpu) || + gsi != this_gsi) { + pr_warn("ACPI: %s: must be homogeneous\n", pdev->name); + return -ENXIO; + } + } + + irq = acpi_register_gsi(NULL, gsi, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_HIGH); + if (irq < 0) { + pr_warn("ACPI: %s Unable to register interrupt: %d\n", pdev->name, gsi); + return -ENXIO; + } + + pdev->resource[0].start = irq; + ret = platform_device_register(pdev); + if (ret < 0) { + pr_warn("ACPI: %s: Unable to register device\n", pdev->name); + acpi_unregister_gsi(gsi); + } + return ret; +} +#endif + +#ifdef CONFIG_ARM_SPE_PMU static struct resource spe_resources[] = { { /* irq */ @@ -84,6 +146,11 @@ static struct platform_device spe_dev = { .num_resources = ARRAY_SIZE(spe_resources) }; +static u16 arm_spe_parse_gsi(struct acpi_madt_generic_interrupt *gicc) +{ + return gicc->spe_interrupt; +} + /* * For lack of a better place, hook the normal PMU MADT walk * and create a SPE device if we detect a recent MADT with @@ -91,47 +158,10 @@ static struct platform_device spe_dev = { */ static void arm_spe_acpi_register_device(void) { - int cpu, hetid, irq, ret; - bool first = true; - u16 gsi = 0; - - /* - * Sanity check all the GICC tables for the same interrupt number. - * For now, we only support homogeneous ACPI/SPE machines. - */ - for_each_possible_cpu(cpu) { - struct acpi_madt_generic_interrupt *gicc; - - gicc = acpi_cpu_get_madt_gicc(cpu); - if (gicc->header.length < ACPI_MADT_GICC_SPE) - return; - - if (first) { - gsi = gicc->spe_interrupt; - if (!gsi) - return; - hetid = find_acpi_cpu_topology_hetero_id(cpu); - first = false; - } else if ((gsi != gicc->spe_interrupt) || - (hetid != find_acpi_cpu_topology_hetero_id(cpu))) { - pr_warn("ACPI: SPE must be homogeneous\n"); - return; - } - } - - irq = acpi_register_gsi(NULL, gsi, ACPI_LEVEL_SENSITIVE, - ACPI_ACTIVE_HIGH); - if (irq < 0) { - pr_warn("ACPI: SPE Unable to register interrupt: %d\n", gsi); - return; - } - - spe_resources[0].start = irq; - ret = platform_device_register(&spe_dev); - if (ret < 0) { + int ret = arm_acpi_register_pmu_device(&spe_dev, ACPI_MADT_GICC_SPE, + arm_spe_parse_gsi); + if (ret) pr_warn("ACPI: SPE: Unable to register device\n"); - acpi_unregister_gsi(gsi); - } } #else static inline void arm_spe_acpi_register_device(void) From patchwork Tue Aug 1 09:40:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 129144 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2567673vqg; Tue, 1 Aug 2023 03:17:22 -0700 (PDT) X-Google-Smtp-Source: APBJJlH7VwNyAeYxUNt+Hv/5+fhWdco8XA4tOGZHca89k4zYSBotomrHA6fBG7ME0GgiC8c9vGEW X-Received: by 2002:aa7:8316:0:b0:676:2a5c:7bc5 with SMTP id bk22-20020aa78316000000b006762a5c7bc5mr9866200pfb.1.1690885042727; Tue, 01 Aug 2023 03:17:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690885042; cv=none; d=google.com; s=arc-20160816; b=y2Vavov21J09G1eS/YSuBLExiGGSGpl8HomAwlQf4CMCFHAxi24Apjza407QJ5pv9d 874bgRnwQlqrM+HghVbWo2gd55PgMkrBpHgJkCZwlxtM7rqkXkIM40TUp8cBn3GwScC4 wD8Mt+sisKCDKidLvBoyUwAesYSWuKZDiyTWkBOneTE8/ZwModdird7YnlChvJjoRNYK QuOBURhwpJNgnYOPHc6uuiX6Brnc2dWyK/W0GwxT5cxSGPHzAHy5rtmoD3xuxU8VjuyM JB9Q4GR/euhBVnWvx7cAcucgKiCjL1COc9ll0bp8onFsAWW/Cq3IFOGYAhwrB7KYwmWs BYkQ== 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=dqo0eWep8EX9GHullU3gU3iOc7Tfw1692DDDsI+5xmw=; fh=J+p7EhpAaI9pLvGhGO08nD/3D2XA+A6RPzvd+bjr8cY=; b=diaEg9yO7emna15RAcy2xdPXVI4xmvTn3/sRZphOehTUY3Pz6ufYUIuze4LiZdkcnw VkD2P0MzwX/6iftP5SX8Ar8s/LlGjHecqGNkMl3F/w0TqvLVPn0zSwTOmwIFpe1DydTw nG59Lt+3+esuD+plnSSi+djfs7T7EaU5s0Pu+ZJOgtmkwArNWWHw+zs3p61traL5elwN pxFSRzaMNwWSP88SivJZC1sleqgFYi3Vz56GWGH5DSuoePJFI6tBdtiiqk/i1rsTRRj6 MNEWB5+jFJVDWSS1Eq/jCuLv4dkp1Dz7b6O9xkQcZypTDoPH3utnaKEiYi+Obssbydn9 gMsg== 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 t4-20020a63f344000000b0056416221db2si7397734pgj.816.2023.08.01.03.17.09; Tue, 01 Aug 2023 03:17:22 -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 S233475AbjHAJnt (ORCPT + 99 others); Tue, 1 Aug 2023 05:43:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233420AbjHAJne (ORCPT ); Tue, 1 Aug 2023 05:43:34 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A41D82D50 for ; Tue, 1 Aug 2023 02:41:13 -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 7468312FC; Tue, 1 Aug 2023 02:41:56 -0700 (PDT) Received: from a077893.arm.com (unknown [10.163.53.114]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1E61B3F5A1; Tue, 1 Aug 2023 02:41:09 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, suzuki.poulose@arm.com Cc: Anshuman Khandual , Catalin Marinas , Will Deacon , Mark Rutland , linux-kernel@vger.kernel.org Subject: [PATCH V2 2/4] arm_pmu: acpi: Add a representative platform device for TRBE Date: Tue, 1 Aug 2023 15:10:50 +0530 Message-Id: <20230801094052.750416-3-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230801094052.750416-1-anshuman.khandual@arm.com> References: <20230801094052.750416-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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: 1773021474070917329 X-GMAIL-MSGID: 1773021474070917329 ACPI TRBE does not have a HID for identification which could create and add a platform device into the platform bus. Also without a platform device, it cannot be probed and bound to a platform driver. This creates a dummy platform device for TRBE after ascertaining that ACPI provides required interrupts uniformly across all cpus on the system. This device gets created inside drivers/perf/arm_pmu_acpi.c to accommodate TRBE being built as a module. Cc: Catalin Marinas Cc: Will Deacon Cc: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- arch/arm64/include/asm/acpi.h | 3 +++ drivers/perf/arm_pmu_acpi.c | 37 ++++++++++++++++++++++++++++++++++- include/linux/perf/arm_pmu.h | 1 + 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index bd68e1b7f29f..4d537d56eb84 100644 --- a/arch/arm64/include/asm/acpi.h +++ b/arch/arm64/include/asm/acpi.h @@ -42,6 +42,9 @@ #define ACPI_MADT_GICC_SPE (offsetof(struct acpi_madt_generic_interrupt, \ spe_interrupt) + sizeof(u16)) +#define ACPI_MADT_GICC_TRBE (offsetof(struct acpi_madt_generic_interrupt, \ + trbe_interrupt) + sizeof(u16)) + /* Basic configuration for ACPI */ #ifdef CONFIG_ACPI pgprot_t __acpi_get_mem_attribute(phys_addr_t addr); diff --git a/drivers/perf/arm_pmu_acpi.c b/drivers/perf/arm_pmu_acpi.c index d9d5a7bbb92f..1bcda26282fc 100644 --- a/drivers/perf/arm_pmu_acpi.c +++ b/drivers/perf/arm_pmu_acpi.c @@ -69,7 +69,7 @@ static void arm_pmu_acpi_unregister_irq(int cpu) acpi_unregister_gsi(gsi); } -#if IS_ENABLED(CONFIG_ARM_SPE_PMU) +#if IS_ENABLED(CONFIG_ARM_SPE_PMU) || IS_ENABLED(CONFIG_CORESIGHT_TRBE) static int arm_acpi_register_pmu_device(struct platform_device *pdev, u8 len, u16 (*parse_gsi)(struct acpi_madt_generic_interrupt *)) @@ -169,6 +169,40 @@ static inline void arm_spe_acpi_register_device(void) } #endif /* CONFIG_ARM_SPE_PMU */ +#ifdef CONFIG_CORESIGHT_TRBE +static struct resource trbe_resources[] = { + { + /* irq */ + .flags = IORESOURCE_IRQ, + } +}; + +static struct platform_device trbe_dev = { + .name = ARMV8_TRBE_PDEV_NAME, + .id = -1, + .resource = trbe_resources, + .num_resources = ARRAY_SIZE(trbe_resources) +}; + +static u16 arm_trbe_parse_gsi(struct acpi_madt_generic_interrupt *gicc) +{ + return gicc->trbe_interrupt; +} + +static void arm_trbe_acpi_register_device(void) +{ + int ret = arm_acpi_register_pmu_device(&trbe_dev, ACPI_MADT_GICC_TRBE, + arm_trbe_parse_gsi); + if (ret) + pr_warn("ACPI: TRBE: Unable to register device\n"); +} +#else +static inline void arm_trbe_acpi_register_device(void) +{ + +} +#endif /* CONFIG_CORESIGHT_TRBE */ + static int arm_pmu_acpi_parse_irqs(void) { int irq, cpu, irq_cpu, err; @@ -404,6 +438,7 @@ static int arm_pmu_acpi_init(void) return 0; arm_spe_acpi_register_device(); + arm_trbe_acpi_register_device(); return 0; } diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h index a0801f68762b..7ec26d21303d 100644 --- a/include/linux/perf/arm_pmu.h +++ b/include/linux/perf/arm_pmu.h @@ -187,5 +187,6 @@ void armpmu_free_irq(int irq, int cpu); #endif /* CONFIG_ARM_PMU */ #define ARMV8_SPE_PDEV_NAME "arm,spe-v1" +#define ARMV8_TRBE_PDEV_NAME "arm-trbe-acpi" #endif /* __ARM_PMU_H__ */ From patchwork Tue Aug 1 09:40:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 129119 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2563163vqg; Tue, 1 Aug 2023 03:07:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlH4VR2EE7/vutxflQk7Bee+bS+y9rQOAZhFhuwUsnooJlMV4pr6arMmNmNbQ/k4itsVe7Ok X-Received: by 2002:a17:902:8493:b0:1b6:6b03:10cd with SMTP id c19-20020a170902849300b001b66b0310cdmr12342408plo.67.1690884466019; Tue, 01 Aug 2023 03:07:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690884466; cv=none; d=google.com; s=arc-20160816; b=xJ+WX/+9MFUzBVSnmyROTyJj+gXIYRHPZJ6tAo8h7kSkeuvWV6Scoa4hGZgJnPpcVW fvWxS0v9x9HYfSjx5Oqgffk6o3oKq7Tao/pOjLJhE+g3L+lAFEJIXAEtlucfHiKPIug+ vklglkuAySmxIx5BsocgIMhkBJJ5MRol5St7iWidOf+XQWoPJH7e8PhSmg01Q92AaYmN 66XkYcHaTvpv/b4kaTMGzM9iNBKDq8UovNM+hfO8tfEAUoQNs9fd2n7Zi5E0UuXr3SJR JuIonzmGs2oYlGURXERCuLBXHx/H/hfZXfKSazmK4VfRU1DcDXZSRKczA+zikGJPqVTR LzKg== 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=CPxcDyzK3EVL2RnU6wNBsC95Y1hcNEcXUF1QpiexEGk=; fh=I47RsEx4oWrJNqdaPKjoPx+4i7IV/wZ1HDIWc2+KU6M=; b=xI/lgGG4dN88AqUIY56cawhO4uPMaFhU9kqRXxB4mmYO+JFbImtGQt76ni5vbWjRQE k5FRSyuekqebyYU1h9iqHZYqlEkX2YucugmmVhxkW5mo4S0uqlre5/GrfGeS9eQBcmfl pyoEAuEUsDRyVGacND/ViTnnubMzbpFdjScNAFv4R+K7GxA2MP8qhiJS1tGk4HluJecF KSi04Rt8LAFcyBY+4rDRa485a/GB+EMoH/nftHW3dlM5JdQS1Ok0MGNENAnhClVSzfla 8WWJz4q7pL/TmXsELcePumzh3RsphLuFrpKSnHHeMNnOGWPgMndabOE+KGFam9Pfu4k8 GAcw== 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 d17-20020a170902ced100b001b5395382a0si9202959plg.212.2023.08.01.03.07.32; Tue, 01 Aug 2023 03:07:46 -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 S233442AbjHAJn6 (ORCPT + 99 others); Tue, 1 Aug 2023 05:43:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233269AbjHAJni (ORCPT ); Tue, 1 Aug 2023 05:43:38 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A6CF25240 for ; Tue, 1 Aug 2023 02:41:17 -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 1FDCD1424; Tue, 1 Aug 2023 02:42:00 -0700 (PDT) Received: from a077893.arm.com (unknown [10.163.53.114]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 93CB23F5A1; Tue, 1 Aug 2023 02:41:13 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, suzuki.poulose@arm.com Cc: Anshuman Khandual , Mike Leach , Leo Yan , Alexander Shishkin , coresight@lists.linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 3/4] coresight: trbe: Add a representative coresight_platform_data for TRBE Date: Tue, 1 Aug 2023 15:10:51 +0530 Message-Id: <20230801094052.750416-4-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230801094052.750416-1-anshuman.khandual@arm.com> References: <20230801094052.750416-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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: 1773020869523356982 X-GMAIL-MSGID: 1773020869523356982 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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c index 7720619909d6..e1d9d06e7725 100644 --- a/drivers/hwtracing/coresight/coresight-trbe.c +++ b/drivers/hwtracing/coresight/coresight-trbe.c @@ -1494,9 +1494,9 @@ 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); + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return -ENOMEM; dev_set_drvdata(dev, drvdata); dev->platform_data = pdata; From patchwork Tue Aug 1 09:40:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 129146 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2567864vqg; Tue, 1 Aug 2023 03:17:50 -0700 (PDT) X-Google-Smtp-Source: APBJJlF7PlBeZofAjkHgjqa+d2cOg/nH8nFdeo7xmqMtYLGD+7UOhFu56OD4e7aCaFjrrCHF6mFU X-Received: by 2002:a05:6a20:8e06:b0:13c:bda3:79c3 with SMTP id y6-20020a056a208e0600b0013cbda379c3mr14014891pzj.4.1690885070387; Tue, 01 Aug 2023 03:17:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690885070; cv=none; d=google.com; s=arc-20160816; b=Ec1KQ7ZjE3gWQkOX2OjalSr5MrpKcSXZnMRebI+cj6WN+K8BMg22VMP0V2fXnLAhGT zhx2MrTCmKL6sKH7J9Og8SFnny+0Gnnss+WwcKuFKxcSdZwpay3FiQEzs5QGijxqPysH MoAJVNGpV31ohZolR/RxbLumLJEfHuPd82LmFa1mp++ehvy4pWoPzKHDwW0EmEA7TAze fFB0yEWOWfM4HnM1hnlrh72Xj1lzM9LkV7mc+2t5pFDTowN3Kt2XIYpIzdTTE1xAHmTc k2qctKywylBnURBYbdnzdP8ZIWdQ0uSjVAnjECnepeUIKdWD3FWNo3Tzx8TJWxaRNQJe s6Cg== 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=iwb9CBNT4/f2vEJHLhafIA+pbYuYRXfDO81UdeO66WU=; fh=I47RsEx4oWrJNqdaPKjoPx+4i7IV/wZ1HDIWc2+KU6M=; b=dtpX5vlqpIDa14nRkvnQUEcph97gWRAIii4kkUtMRaeC8uy/KfExgcPEyRShIo9CD+ 7zyzpnr6IDPB6SQ1KpD1oDcvt8tggaKyCOvLtyhf/H1zE2ypUn1fZGXdbXEfG3rOJdPt iolrgCZO5y9IYtutN+/dHsb8EVQRftpeZYYJImkY/ZYMtgVc7Ib0FvWtcbkHGBd4ZbSq JL/UjhAqYHPvszWcFG/3ach/3zmnfQYQKxf5qDG11DD3bWWf+BAo3q3BUuFe8LXy8WTC BGTvIsa8on/6HdYmPCx9+N/ZMyj40hLw3oOQxHrBqgKsVwy+Mnhtnu1AnsY9mlk4yJU8 h6vw== 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 x62-20020a636341000000b0055336060fa0si8534082pgb.378.2023.08.01.03.17.37; Tue, 01 Aug 2023 03:17:50 -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 S233455AbjHAJoI (ORCPT + 99 others); Tue, 1 Aug 2023 05:44:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233408AbjHAJno (ORCPT ); Tue, 1 Aug 2023 05:43:44 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 437E56192 for ; Tue, 1 Aug 2023 02:41:24 -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 5B0551650; Tue, 1 Aug 2023 02:42:04 -0700 (PDT) Received: from a077893.arm.com (unknown [10.163.53.114]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 454B63F5A1; Tue, 1 Aug 2023 02:41:16 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, suzuki.poulose@arm.com Cc: Anshuman Khandual , Mike Leach , Leo Yan , Alexander Shishkin , coresight@lists.linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 4/4] coresight: trbe: Enable ACPI based TRBE devices Date: Tue, 1 Aug 2023 15:10:52 +0530 Message-Id: <20230801094052.750416-5-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230801094052.750416-1-anshuman.khandual@arm.com> References: <20230801094052.750416-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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: 1773021503994860016 X-GMAIL-MSGID: 1773021503994860016 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 | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c index e1d9d06e7725..f884883e9018 100644 --- a/drivers/hwtracing/coresight/coresight-trbe.c +++ b/drivers/hwtracing/coresight/coresight-trbe.c @@ -1537,7 +1537,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 = 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..94e67009848a 100644 --- a/drivers/hwtracing/coresight/coresight-trbe.h +++ b/drivers/hwtracing/coresight/coresight-trbe.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include