All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: KobaK <kobak@nvidia.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	Fenghua Yu <fenghuay@nvidia.com>, Tushar Dave <tdave@nvidia.com>,
	Kai-Heng Feng <kaihengf@nvidia.com>,
	rupakr@nvidia.com, mohammedk@nvidia.com
Subject: Re: [RFC PATCH 2/3] Documentation/arch/arm64: document arm_cpumod
Date: Mon, 17 Aug 2026 17:03:54 -0500	[thread overview]
Message-ID: <20260817220354.GA2274565-robh@kernel.org> (raw)
In-Reply-To: <20260817022335.3-3-kobak@nvidia.com>

On Mon, Aug 17, 2026 at 10:23:34AM +0800, KobaK wrote:
> From: Koba Ko <kobak@nvidia.com>
> 
> Document the ABI intent and scope for the new arm64 cpumod interface.
> The sysfs directory is per-CPU and is created only for recognized Grace
> and Vera profiles:
> 
>   /sys/devices/system/cpu/cpuN/cpumod/
> 
> CPUs with unsupported MIDRs are skipped without blocking module load or
> CPU hotplug and do not receive a cpumod directory.
> 
> Describe the common attributes, the Grace- and Vera-specific attributes,
> and the accepted range for each writable field. Out-of-range writes are
> documented as failing before either cached sysfs state or target CPU
> register state is changed.
> 
> Document the CPU hotplug lifecycle explicitly: the cpumod directory is
> present only while a supported CPU is online, is removed when that CPU
> goes offline, and is recreated when it returns online. Reads and writes
> therefore require an online target CPU.
> 
> Also document the firmware prerequisite: EL1 must be allowed to access
> the relevant implementation control registers. The interface remains an
> RFC for controlled performance characterization, is not a general
> production tuning ABI, and should stay disabled by default on production
> systems.
> 
> Reviewed-by: Fenghua Yu <fenghuay@nvidia.com>
> Reviewed-by: Tushar Dave <tdave@nvidia.com>
> Reviewed-by: Kai-Heng Feng <kaihengf@nvidia.com>
> Signed-off-by: Koba Ko <kobak@nvidia.com>
> ---
>  Documentation/arch/arm64/arm-cpumod.rst | 89 +++++++++++++++++++++++++
>  Documentation/arch/arm64/index.rst      |  1 +
>  2 files changed, 90 insertions(+)
>  create mode 100644 Documentation/arch/arm64/arm-cpumod.rst
> 
> diff --git a/Documentation/arch/arm64/arm-cpumod.rst b/Documentation/arch/arm64/arm-cpumod.rst
> new file mode 100644
> index 0000000000000..7dbe2cd5404a2
> --- /dev/null
> +++ b/Documentation/arch/arm64/arm-cpumod.rst
> @@ -0,0 +1,89 @@
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +====================================
> +Arm CPU prefetch modulation controls
> +====================================
> +
> +``ARM64_CPUMOD`` exposes selected CPU implementation control register fields
> +through per-CPU sysfs attributes under::
> +
> +  /sys/devices/system/cpu/cpuN/cpumod/
> +
> +The ``cpumod`` directory is created only when the CPU MIDR matches a recognized
> +Grace or Vera profile. CPUs with unsupported MIDRs are skipped without blocking
> +module load or CPU hotplug and do not have a ``cpumod`` directory.
> +
> +The interface is intended for controlled performance characterization and
> +evaluation. It is not intended as a general production tuning ABI, and the
> +configuration should remain disabled by default on production systems.
> +
> +Configuration and placement
> +===========================
> +
> +The controls are built when ``CONFIG_ARM64_CPUMOD`` is enabled. The code lives
> +under ``arch/arm64/kernel/`` because the exposed state is CPU implementation
> +control state accessed by the arm64 kernel, similar in placement to other
> +architecture CPU-facing helpers.
> +
> +The ABI remains separate from the existing arm64 ``cpu*/regs`` sysfs files:
> +``cpumod`` exposes a small set of named, range-checked control fields rather
> +than a general raw register dump.
> +
> +CPU hotplug
> +===========
> +
> +A ``cpumod`` directory is created only for online CPUs with a supported
> +profile. The directory is removed when a CPU goes offline and recreated when
> +the CPU comes back online, again only when its MIDR matches a supported
> +profile. Reads and writes require the target CPU to be online.
> +
> +Firmware requirement
> +====================
> +
> +The controls require firmware to permit EL1 reads and writes to the relevant
> +CPU implementation control registers. On systems where firmware traps or
> +blocks those accesses, the interface cannot be used.

How does the kernel discover if the interface can be enabled? Write a 
register and if we're still alive we can enable it?

> +
> +Current ABI

Is the future ABI going to be different? ;)

> +===========
> +
> +Common attributes:
> +
> +``affected_cpus``
> +  Read-only decimal CPU identifier for the sysfs instance.
> +
> +``pf_dis``
> +  Hardware prefetch disable control. Valid values are ``0`` and ``1``.
> +
> +``pf_mode``
> +  Hardware prefetch aggressiveness mode. Valid values are ``0`` through ``9``.
> +  Values ``10`` through ``15`` are reserved and rejected.
> +
> +Grace-only attributes:
> +
> +``cbusy_filter_threshold``
> +  Valid values are ``0`` through ``3``.
> +
> +``cbusy_filter_window``
> +  Valid values are ``0`` through ``3``.
> +
> +``cmc_min_ways``
> +  Valid values are ``0`` through ``7``.
> +
> +Vera-only attributes:
> +
> +``l2spr_cmc_max_ways``
> +  Valid values are ``0`` through ``7``.

There is already a standard way to document sysfs entries. Use that.

Rob

  reply	other threads:[~2026-08-17 22:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17  2:23 [RFC PATCH 0/3] arm64: expose CPU prefetch and cache modulation controls KobaK
2026-08-17  2:23 ` [RFC PATCH 1/3] arm64: add CPU prefetch and cache modulation sysfs interface KobaK
2026-08-17 22:07   ` Rob Herring
2026-08-17  2:23 ` [RFC PATCH 2/3] Documentation/arch/arm64: document arm_cpumod KobaK
2026-08-17 22:03   ` Rob Herring [this message]
2026-08-17  2:23 ` [RFC PATCH 3/3] selftests: arm64: add arm_cpumod kselftest KobaK

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260817220354.GA2274565-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=corbet@lwn.net \
    --cc=fenghuay@nvidia.com \
    --cc=kaihengf@nvidia.com \
    --cc=kobak@nvidia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mohammedk@nvidia.com \
    --cc=rupakr@nvidia.com \
    --cc=skhan@linuxfoundation.org \
    --cc=tdave@nvidia.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.