From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8AD7C41A792 for ; Tue, 11 Aug 2026 08:38:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.200 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786437513; cv=none; b=XZAydAIX3MR7ID9gxtyt5A6z3JqfgB0WP6K3Dor3OKcPC3LQtY3gUOLRWvaP6n6GJ3oD/yUk51Wr0BApS2zVTtwnhf3ae6uEOZ72zJdsFECIF4DctFAG3od2De5zuE+gyDPr6SdH9jY2yUsJMs4DTXFqPtTU1AdVJR0k/ElD82c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786437513; c=relaxed/simple; bh=T+IVSnX6EINKXEn0mOBww7kAlOYFW8L58VWaDzZloDs=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=tWWBcIgFzWGLSf6+n/gWyy4OQbjmW6DqdkQrBjK9KomvfWb4n0P/JM/nDgSqkMzH8JXeXQEKgbiMdiagfyjMdG090Kg1RnecQpNUZ0HYR0745RYfZN25qgSg6CMSzQ24gpHnJxbIt82vOjUMUTHsQsB2gZe1eI0Z94VAfAP/1SM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=gdRILl6z; arc=none smtp.client-ip=209.85.215.200 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="gdRILl6z" Received: by mail-pg1-f200.google.com with SMTP id 41be03b00d2f7-cbb92868263so3329898a12.2 for ; Tue, 11 Aug 2026 01:38:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1786437512; x=1787042312; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:mime-version:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=ixdeBYynArpsix+QJOhKjoMwqlLEZo89UtTQqf0yC/4=; b=gdRILl6z8Wad83fPCEGYweNNSW3bqEalRkotK4jATGNq12z1UdK6T4CG7hyR9VeRVB JYZjS21RfFlWgypDF0zd+UJbUA/FdSwOcjutfLyfbf4E12gAmcPRk/S9H76kncRv+34t 8h9z4rBD9BlCgNik/ss/8JNTk+Cei6wEAs81j1udUxBGuJOy/soVtyrKXHGre8DA0dfR 04ci5lvr0mZyNOkey+srO+stIrL47ZRdjrBy6oakxwTHYmdZIl/0pjHkkdqR8NZ/t0XQ N8wEAFh1phTQ46FNnjzPQ66OmK2J1x2JbWZy3avY08T6RILksa1GN0hAxB0haLDeBq4V JF8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786437512; x=1787042312; h=content-type:cc:to:from:subject:message-id:mime-version:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ixdeBYynArpsix+QJOhKjoMwqlLEZo89UtTQqf0yC/4=; b=oxo6urGhj8lchoyh6WWzhGBCKpxZh10k0DX0JNkz+g/4cP6MFnjNrKxd0ceqPUT0LP SJaN20Mb5IYqDUqM17hmzEC82/Tzz5ISt5yNJJsWkwndjFI70YFMaNR2tA/XY3wWGWHq u8tjXA6xWs3sPqbUygdQFs9qhZYx2QqILJade6aInvscvAIcMuU6UdR3OMB8cM8TFD4S qvpM+6LqwjEw7RYlROEuOWbj0a2zjH7lCzWtW0ljiCtt/ExT9bUHpnnG3F7EGLLd9Dg4 REpmpOMmfPPAkj/yaGUUBiqJ25spEg+/5C72RSmV+jwRoO78WayrO1+97D979V/cieVd qQlQ== X-Forwarded-Encrypted: i=1; AHgh+RpK1XIym0JhnH6jyWJoMr7lo/ilax8BHAgWLkFdqO2aXyMigxANQXgmdlCIuHdu/AbqkvjXY3uO2K7SrCg=@vger.kernel.org X-Gm-Message-State: AOJu0YwB9yn2klqwC6VpGtvf6t2swyKGdG8ENxg1xkF0jvMlnHE2PjDU G8MeV+Rlo6slIB3iGXhpz27mqQ8e3lrz32ko50D/oepNJpTviEH/9pCCScKqDSi5efvX8ECRGby QU22OsOWrCA== X-Received: from dldz13-n1.prod.google.com ([2002:a05:701b:418d:10b0:13c:e20a:efb6]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:d83:b0:3c3:875d:704d with SMTP id adf61e73a8af0-3cc2baaa24emr2409791637.25.1786437511665; Tue, 11 Aug 2026 01:38:31 -0700 (PDT) Date: Tue, 11 Aug 2026 01:38:25 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.55.0.679.g6767b8d81c-goog Message-ID: <20260811083828.2057695-1-irogers@google.com> Subject: [PATCH v1 0/2] perf: Add Raspberry Pi AXI PMU driver From: Ian Rogers To: Will Deacon , Mark Rutland , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-rpi-kernel@lists.infradead.org Cc: Ian Rogers Content-Type: text/plain; charset="UTF-8" This patch series adds an uncore Performance Monitoring Unit (PMU) driver for Broadcom AXI system and VideoCore VPU performance monitors found on Raspberry Pi SoCs (BCM2835 through BCM2712 / Raspberry Pi 1 through 5). Motivation & Background ------------------------ Currently, Linux lacks a standard perf-API compatible driver for the Broadcom AXI performance counter blocks on Raspberry Pi platforms. Prior out-of-tree vendor solutions relied on custom debugfs nodes and ad-hoc kthreads, preventing integration with standard Linux perf tooling (`perf stat`, `perf list`, etc.). This driver implements standard `struct pmu` hardware uncore callbacks under `drivers/perf/`, exposing human-readable sysfs event aliases, unit scaling (`Bytes`), and bus filtering directly to user space. Key Architectural Improvements & Features ------------------------------------------ 1. Standard Linux Perf Integration: - Exposes uncore AXI interconnect events via `/sys/bus/event_source/devices/rpi_axi_pmu/`. - Supports event sampling and hardware counter accumulation (`local64_add`), automatically managing 31-bit hardware counter wraparound across high-bandwidth interconnect transfers. 2. CPU Hotplug Support (`cpuhp`): - Registers dynamic CPU hotplug notifiers (`CPUHP_AP_ONLINE_DYN`). - Automatically migrates PMU context (`perf_pmu_migrate_context`) to an online CPU core when a designated CPU goes offline, avoiding stale uncore state. 3. Hybrid Memory-Mapped & Mailbox Work Queue Architecture: - System Monitor (MMIO): Performs fast atomic-safe memory reads (~15ns) directly mapped over ARM physical memory space (`MON__SYSTEM`). - VPU Monitor (Mailbox IPC): For Broadcom BCM2835-BCM2711 platforms (RPi 1-4), VideoCore VPU monitor IPC calls are offloaded to process context via a dedicated workqueue (`vpu_work`) and serialized under `vpu_mutex`. This avoids atomic sleeps or blocking in timer/interrupt context. 4. SoC Generation Support: - Patch 1 adds core driver support for Broadcom BCM2835-BCM2711 (RPi 1-4). - Patch 2 expands support for Broadcom BCM2712 (Raspberry Pi 5), adding PCIe RP1 Southbridge links, HEVC decoder, HVS display engine, and Cortex-A76 DSU L3 interconnect monitoring. Hardware Validation ------------------- The driver has been validated on real hardware across multiple SoC generations: - Raspberry Pi 400 (BCM2711): Validated System L2, ARM CPU, and VideoCore VPU firmware mailbox IPC performance counters. - Raspberry Pi 5 (BCM2712): Validated live byte throughput across HVS display refresh cycles, Cortex-A76 DSU L3 interconnect memory traffic, and PCIe RP1 Southbridge transfers. Ian Rogers (2): perf: Add Raspberry Pi BCM2835 AXI PMU driver perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support drivers/perf/Kconfig | 10 + drivers/perf/Makefile | 1 + drivers/perf/rpi_axi_pmu.c | 1948 ++++++++++++++++++++++++++++++++++++ 3 files changed, 1959 insertions(+) create mode 100644 drivers/perf/rpi_axi_pmu.c -- 2.55.0.679.g6767b8d81c-goog