Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2536437rdg; Mon, 16 Oct 2023 07:26:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHxhxd/IUjZoX54xKLfXQFqd29s/1zZtcuv1liwkuo/b7Lx2bX7llHUj91kVWRDydMtZh4F X-Received: by 2002:a05:6870:d1d3:b0:1d6:5b09:1584 with SMTP id b19-20020a056870d1d300b001d65b091584mr42361974oac.5.1697466373808; Mon, 16 Oct 2023 07:26:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697466373; cv=none; d=google.com; s=arc-20160816; b=LiwKq/Vngm+tdYODlvR7aILuTYf61/dQDZiF3NgG9fRuxURrtVhP0EQ7k0qGXqEyGH RvhiG/m/Hex3IFuZMxntKkLYzXmiRhZTRr99fI4juWm34o2RKl+TlNgza7IGHvLexP8x 3GoL2/P2JmUPlQbdJ1hB7jaO/ocva5+gvKf3//4Wy1OEfVSwpkw3geWAZZfCzFX6mVX/ 8EGgr6Qg+WKmcJiTm9iCfXjCaiOd8/30boKIydCzwf4cFXY+Ek2RRDuIOVoOuNoI4JDA tI2jwGcSitVqK4n6bWdrHgqLVMm6+9bvfQzfrrypxurvHpUHmE/RJ7RgjWuefBDUdCu3 IuUg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NwazfauXcUGj1BmvasgAf3QvgjV5ocjmQ6ZgfeR7NX0=; fh=wFNFASyjzVBOmAOLY/Tbv6+/uN+Gxk2qPKaREUYeW30=; b=p8MSEGcP6lSIPHc4s2ZgvAEiya7mW+5gzwGvNHcTr1QjH8Z+M4LLbUnlBJL0wSfVha kfOsGoERrc8lZmtR8SzPwT83H+XB6o2XiqolM/jSf1SXflF62HZTJc1UAV4fBuEFdaQu 3N5WPD52C9GlCX8tv/PFGnNnu6vbUFKpmQrQOIjV6bTcR2ZecwmgV1t2+yDR5SrYbyTW GvNmHMPsKzdarROUqvQHIhZypnOFyYRnGa/t4FwMTYYBZv8rXWvgsIbQl9qxdxFBwlb8 PwqeVn2irddUvrdCEJ0OLL4IMlAOTTwOozoxKCH/+Oc3CfOrOAT492kRFAN0gUW5/INW P86Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oZOWjCnL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id f19-20020a056a00239300b006b798c24276si6582198pfc.348.2023.10.16.07.26.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 07:26:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oZOWjCnL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 2F2418083B18; Mon, 16 Oct 2023 07:25:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233772AbjJPOZY (ORCPT + 99 others); Mon, 16 Oct 2023 10:25:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233685AbjJPOZX (ORCPT ); Mon, 16 Oct 2023 10:25:23 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C763E83; Mon, 16 Oct 2023 07:25:21 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB961C433C7; Mon, 16 Oct 2023 14:25:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1697466321; bh=sEAtPHGVqN9YumoNYv3VDPGXpoeUzGnAcM59GdaEyU4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oZOWjCnLzCyB47rbsFe7ukqPm6Z4M9nB1KSajLdYz1IcEXED+AEteqm67EkOBmSKP SeR8PMCwuhwXnRmV16hDwc3UhGPd/i7zT8Cwsw3rIVvez/5w28m6ONP/HiPTIfexdt xK+Rfof/C6escm2Lcy3OXu1wHWe4YWNCs8Aju7Cs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Catalin Marinas , Will Deacon , Mark Rutland , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Anshuman Khandual , Sasha Levin Subject: [PATCH 6.5 006/191] arm_pmu: acpi: Add a representative platform device for TRBE Date: Mon, 16 Oct 2023 10:39:51 +0200 Message-ID: <20231016084015.550509169@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231016084015.400031271@linuxfoundation.org> References: <20231016084015.400031271@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.2 required=5.0 tests=DATE_IN_PAST_03_06, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 16 Oct 2023 07:25:48 -0700 (PDT) 6.5-stable review patch. If anyone has any objections, please let me know. ------------------ From: Anshuman Khandual [ Upstream commit 1aa3d0274a4aac338ee45a3dfc3b17c944bcc2bc ] 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 Link: https://lore.kernel.org/r/20230817055405.249630-3-anshuman.khandual@arm.com Signed-off-by: Will Deacon Stable-dep-of: 4785aa802853 ("cpuidle, ACPI: Evaluate LPI arch_flags for broadcast timer") Signed-off-by: Sasha Levin --- arch/arm64/include/asm/acpi.h | 3 +++ drivers/perf/arm_pmu_acpi.c | 35 +++++++++++++++++++++++++++++++++++ include/linux/perf/arm_pmu.h | 1 + 3 files changed, 39 insertions(+) diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h index bd68e1b7f29f3..4d537d56eb847 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 90815ad762ebc..8baeeb369118e 100644 --- a/drivers/perf/arm_pmu_acpi.c +++ b/drivers/perf/arm_pmu_acpi.c @@ -139,6 +139,40 @@ static inline void arm_spe_acpi_register_device(void) } #endif /* CONFIG_ARM_SPE_PMU */ +#if IS_ENABLED(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; @@ -374,6 +408,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 a0801f68762bf..143fbc10ecfe0 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" #endif /* __ARM_PMU_H__ */ -- 2.40.1