From nobody Sun Feb 8 16:12:56 2026 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1AF9118A6CF; Thu, 25 Dec 2025 04:01:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766635303; cv=none; b=foctiHDu7+c1QYpG9baWKpc8ze8Tv7/VBzpOUBfivJcSYybiWaiGU5FAV1ft7kMsb/LZhSYL95YkE/i3JpzvQtzSyh7D6A5dAO3Gl8QV3ZZDctjSyksnw7fc8CqInZrvhJ1fFy/NWftyOCttEpjNiuvVYvz2aHTuEMHYKqJAYlM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766635303; c=relaxed/simple; bh=hJysfRjJTushzuu59PdwNmXhK03fRR3ksyu3RLmpdxQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=R+CazO3UGSUInxh+e43HCGIxvvdb6I1mrGbXBJVUk2THRVYZXd2tZhvY7bEA/19g9io8beSWsL+5CF+irTDhagySV4gfcIZ8R8X84hTKZIiA0lImrjcwX2Pn8mY1htyZ3oTenDr4Bs2rwXzGJcnS9qoB+tS2fNu/wE4Jmjik7+c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=TWwztiAT; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="TWwztiAT" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=UhWTOkAZA+dz1Nq7KQoFDikneq1yPjcN1s7NbbqCjLE=; b=TWwztiATrz8Gd7l5XTQS/8RaRT XoXNANof8Wb2SScTkVZUMkWo0qb8ocnLLuC9M90fSI+jQ+MwrBMREFOpjZESk2chpbzrqb0c9rBNk N3inC2SqgboE2QSkVl4GXNE/0VxzVx6KVnIDxiBVhvmVyAhQ1aq0divlpiQIf3VZRP39XpK5JaEGZ AIa4jWjvvk299mGtrq6TeyBEw+ebJ2YkX0Ldy3pb4SxamtO3nW5o9G7BX0R9LK7U4lRVPTQUDCJBJ d2/S682xS34kQVy7xhShvUailKl43GC9HsfsQl7dJqWzWrWl7GYmD/g4l2MlnRrH+iL6isFfFdc0d xXwh1yJA==; Received: from [58.29.143.236] (helo=localhost) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1vYcXO-00GLl3-S7; Thu, 25 Dec 2025 05:01:19 +0100 From: Changwoo Min To: lukasz.luba@arm.com, rafael@kernel.org, donald.hunter@gmail.com, kuba@kernel.org, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, horms@kernel.org, lenb@kernel.org, pavel@kernel.org, changwoo@igalia.com Cc: kernel-dev@igalia.com, linux-pm@vger.kernel.org, netdev@vger.kernel.org, sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH for 6.19 1/4] PM: EM: Fix yamllint warnings in the EM YNL spec Date: Thu, 25 Dec 2025 13:01:01 +0900 Message-ID: <20251225040104.982704-2-changwoo@igalia.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251225040104.982704-1-changwoo@igalia.com> References: <20251225040104.982704-1-changwoo@igalia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The energy model YNL spec has the following two warnings when checking with yamlint: 3:1 warning missing document start "---" (document-start) 107:13 error wrong indentation: expected 10 but found 12 (indentation) So let=E2=80=99s fix whose lint warnings. Fixes: bd26631ccdfd ("PM: EM: Add em.yaml and autogen files") Suggested-by: Donald Hunter Signed-off-by: Changwoo Min Reviewed-by: Donald Hunter --- Documentation/netlink/specs/em.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Documentation/netlink/specs/em.yaml b/Documentation/netlink/sp= ecs/em.yaml index 9905ca482325..0c595a874f08 100644 --- a/Documentation/netlink/specs/em.yaml +++ b/Documentation/netlink/specs/em.yaml @@ -1,5 +1,8 @@ # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Cla= use) - +# +# Copyright (c) 2025 Valve Corporation. +# +--- name: em =20 doc: | @@ -104,7 +107,7 @@ operations: attribute-set: pd-table event: attributes: - - pd-id + - pd-id mcgrp: event =20 mcast-groups: --=20 2.52.0 From nobody Sun Feb 8 16:12:56 2026 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E234013C8EA; Thu, 25 Dec 2025 04:01:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766635302; cv=none; b=VWE+vmpyDQYIpi+QcRJ5DFZe4F21aR+ywGOLx6nL587JyorgsgxBqV6AfQrEKbHnVK0oqlBYuc1xLVaAyQwts2Y93KPI7AKvqGkXGV6UXwwgQ+IDjjPfUo/lGb3xx9iXzfykf93GlmpNGx6QHnv5p7mo63wB465c4tZa1zF3tUQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766635302; c=relaxed/simple; bh=OLwnyUrLa2wZW9daYD59985oSl6qyf8zQ+DEiR3i4qs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BYBnKAtiIPgsS3CO27ojcNPJbchkX3kRTO2VAzRaVtDh51d4mW784/zOLgUy4S1a1Nx4MIkOBuatEU+ads51yHUo6lVJBr6FjGqB08L4yrocXYR3bK0xLbYPsoCWFCFQO7vZRHEYgo5qqb5uRPWfTwqy3FFg61/Fi5G73a07GFo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=IoqzgskE; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="IoqzgskE" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Imlxc8D54NNu+q9/3yyyh42b2yyokOwp1GVCQOSgsoE=; b=IoqzgskE91WMB/O4TLN24mYpTR mPbhnaSFRv6tyeD3vZsh7VdDplY6aKOJP6PG/5f4P58iwLzY12GwTtxo7wVF/ZHKIVTaVOs30B49l oukZTxZVbOigPK7vlfC3/KlCWCTTCzM+cj9uoQFjGadw2lA3ru5QtJF53J7JmbqOqNgCx99dTeiPa GAk9WDjIrhpNbiUMZWtA7ef/0c0cmj5CE5orrxB3vIO9/gfXtsNjW7td4IRqCkQX6g7UjWhlojhlo pFqJU4pcJ+YtNvbh0Sar5PDafBHZQ4cSIZfh/OwP1+v9I7WQZOsu/6JUf1lQpOwkD7bn6ceZgzvct uHotKdnQ==; Received: from [58.29.143.236] (helo=localhost) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1vYcXV-00GLlD-FV; Thu, 25 Dec 2025 05:01:27 +0100 From: Changwoo Min To: lukasz.luba@arm.com, rafael@kernel.org, donald.hunter@gmail.com, kuba@kernel.org, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, horms@kernel.org, lenb@kernel.org, pavel@kernel.org, changwoo@igalia.com Cc: kernel-dev@igalia.com, linux-pm@vger.kernel.org, netdev@vger.kernel.org, sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH for 6.19 2/4] PM: EM: Rename em.yaml to dev-energymodel.yaml Date: Thu, 25 Dec 2025 13:01:02 +0900 Message-ID: <20251225040104.982704-3-changwoo@igalia.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251225040104.982704-1-changwoo@igalia.com> References: <20251225040104.982704-1-changwoo@igalia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The EM YNL specification used many acronyms, including =E2=80=98em=E2=80=99= , =E2=80=98pd=E2=80=99, =E2=80=98ps=E2=80=99, etc. While the acronyms are short and convenient, the= y could be confusing. So, let=E2=80=99s spell them out to be more specific. The follow= ing changes were made in the spec. Note that the protocol name cannot exceed GENL_NAMSIZ (16). em -> dev-energymodel pds -> perf-domains pd -> perf-domain pd-id -> perf-domain-id pd-table -> perf-table ps -> perf-state get-pds -> get-perf-domains get-pd-table -> get-perf-table pd-created -> perf-domain-created pd-updated -> perf-domain-updated pd-deleted -> perf-domain-deleted In addition. doc strings were added to the spec. based on the comments in energy_model.h. Two flag attributes (perf-state-flags and perf-domain-flags) were added for easily interpreting the bit flags. Finally, the autogenerated files and em_netlink.c were updated accordingly to reflect the name changes. Suggested-by: Donald Hunter Signed-off-by: Changwoo Min Reviewed-by: Donald Hunter --- .../netlink/specs/dev-energymodel.yaml | 175 ++++++++++++++++++ Documentation/netlink/specs/em.yaml | 116 ------------ MAINTAINERS | 8 +- include/uapi/linux/dev_energymodel.h | 89 +++++++++ include/uapi/linux/energy_model.h | 63 ------- kernel/power/em_netlink.c | 135 ++++++++------ kernel/power/em_netlink_autogen.c | 44 ++--- kernel/power/em_netlink_autogen.h | 20 +- 8 files changed, 384 insertions(+), 266 deletions(-) create mode 100644 Documentation/netlink/specs/dev-energymodel.yaml delete mode 100644 Documentation/netlink/specs/em.yaml create mode 100644 include/uapi/linux/dev_energymodel.h delete mode 100644 include/uapi/linux/energy_model.h diff --git a/Documentation/netlink/specs/dev-energymodel.yaml b/Documentati= on/netlink/specs/dev-energymodel.yaml new file mode 100644 index 000000000000..cbc4bc38f23c --- /dev/null +++ b/Documentation/netlink/specs/dev-energymodel.yaml @@ -0,0 +1,175 @@ +# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Cla= use) +# +# Copyright (c) 2025 Valve Corporation. +# +--- +name: dev-energymodel + +doc: | + Energy model netlink interface to notify its changes. + +protocol: genetlink + +uapi-header: linux/dev_energymodel.h + +definitions: + - + type: flags + name: perf-state-flags + entries: + - + name: perf-state-inefficient + doc: >- + The performance state is inefficient. There is in this perf-doma= in, + another performance state with a higher frequency but a lower or + equal power cost. + - + type: flags + name: perf-domain-flags + entries: + - + name: perf-domain-microwatts + doc: >- + The power values are in micro-Watts or some other scale. + - + name: perf-domain-skip-inefficiencies + doc: >- + Skip inefficient states when estimating energy consumption. + - + name: perf-domain-artificial + doc: >- + The power values are artificial and might be created by platform + missing real power information. + +attribute-sets: + - + name: perf-domains + doc: >- + Information on all the performance domains. + attributes: + - + name: perf-domain + type: nest + nested-attributes: perf-domain + multi-attr: true + - + name: perf-domain + doc: >- + Information on a single performance domains. + attributes: + - + name: pad + type: pad + - + name: perf-domain-id + type: u32 + doc: >- + A unique ID number for each performance domain. + - + name: flags + type: u64 + doc: >- + Bitmask of performance domain flags. + enum: perf-domain-flags + - + name: cpus + type: string + doc: >- + CPUs that belong to this performance domain. + - + name: perf-table + doc: >- + Performance states table. + attributes: + - + name: perf-domain-id + type: u32 + doc: >- + A unique ID number for each performance domain. + - + name: perf-state + type: nest + nested-attributes: perf-state + multi-attr: true + - + name: perf-state + doc: >- + Performance state of a performance domain. + attributes: + - + name: pad + type: pad + - + name: performance + type: u64 + doc: >- + CPU performance (capacity) at a given frequency. + - + name: frequency + type: u64 + doc: >- + The frequency in KHz, for consistency with CPUFreq. + - + name: power + type: u64 + doc: >- + The power consumed at this level (by 1 CPU or by a registered + device). It can be a total power: static and dynamic. + - + name: cost + type: u64 + doc: >- + The cost coefficient associated with this level, used during ene= rgy + calculation. Equal to: power * max_frequency / frequency. + - + name: flags + type: u64 + doc: >- + Bitmask of performance state flags. + enum: perf-state-flags + +operations: + list: + - + name: get-perf-domains + attribute-set: perf-domains + doc: Get the list of information for all performance domains. + do: + reply: + attributes: + - perf-domain + - + name: get-perf-table + attribute-set: perf-table + doc: Get the energy model table of a performance domain. + do: + request: + attributes: + - perf-domain-id + reply: + attributes: + - perf-domain-id + - perf-state + - + name: perf-domain-created + doc: A performance domain is created. + notify: get-perf-table + mcgrp: event + - + name: perf-domain-updated + doc: A performance domain is updated. + notify: get-perf-table + mcgrp: event + - + name: perf-domain-deleted + doc: A performance domain is deleted. + attribute-set: perf-table + event: + attributes: + - perf-domain-id + mcgrp: event + +mcast-groups: + list: + - + name: event diff --git a/Documentation/netlink/specs/em.yaml b/Documentation/netlink/sp= ecs/em.yaml deleted file mode 100644 index 0c595a874f08..000000000000 --- a/Documentation/netlink/specs/em.yaml +++ /dev/null @@ -1,116 +0,0 @@ -# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Cla= use) -# -# Copyright (c) 2025 Valve Corporation. -# ---- -name: em - -doc: | - Energy model netlink interface to notify its changes. - -protocol: genetlink - -uapi-header: linux/energy_model.h - -attribute-sets: - - - name: pds - attributes: - - - name: pd - type: nest - nested-attributes: pd - multi-attr: true - - - name: pd - attributes: - - - name: pad - type: pad - - - name: pd-id - type: u32 - - - name: flags - type: u64 - - - name: cpus - type: string - - - name: pd-table - attributes: - - - name: pd-id - type: u32 - - - name: ps - type: nest - nested-attributes: ps - multi-attr: true - - - name: ps - attributes: - - - name: pad - type: pad - - - name: performance - type: u64 - - - name: frequency - type: u64 - - - name: power - type: u64 - - - name: cost - type: u64 - - - name: flags - type: u64 - -operations: - list: - - - name: get-pds - attribute-set: pds - doc: Get the list of information for all performance domains. - do: - reply: - attributes: - - pd - - - name: get-pd-table - attribute-set: pd-table - doc: Get the energy model table of a performance domain. - do: - request: - attributes: - - pd-id - reply: - attributes: - - pd-id - - ps - - - name: pd-created - doc: A performance domain is created. - notify: get-pd-table - mcgrp: event - - - name: pd-updated - doc: A performance domain is updated. - notify: get-pd-table - mcgrp: event - - - name: pd-deleted - doc: A performance domain is deleted. - attribute-set: pd-table - event: - attributes: - - pd-id - mcgrp: event - -mcast-groups: - list: - - - name: event diff --git a/MAINTAINERS b/MAINTAINERS index dc731d37c8fe..4eeb1839ce61 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9298,12 +9298,12 @@ M: Lukasz Luba M: "Rafael J. Wysocki" L: linux-pm@vger.kernel.org S: Maintained -F: kernel/power/energy_model.c -F: include/linux/energy_model.h +F: Documentation/netlink/specs/dev-energymodel.yaml F: Documentation/power/energy-model.rst -F: Documentation/netlink/specs/em.yaml -F: include/uapi/linux/energy_model.h +F: include/linux/energy_model.h +F: include/uapi/linux/dev_energymodel.h F: kernel/power/em_netlink*.* +F: kernel/power/energy_model.c =20 EPAPR HYPERVISOR BYTE CHANNEL DEVICE DRIVER M: Laurentiu Tudor diff --git a/include/uapi/linux/dev_energymodel.h b/include/uapi/linux/dev_= energymodel.h new file mode 100644 index 000000000000..3399967e1f93 --- /dev/null +++ b/include/uapi/linux/dev_energymodel.h @@ -0,0 +1,89 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Cl= ause) */ +/* Do not edit directly, auto-generated from: */ +/* Documentation/netlink/specs/dev-energymodel.yaml */ +/* YNL-GEN uapi header */ +/* To regenerate run: tools/net/ynl/ynl-regen.sh */ + +#ifndef _UAPI_LINUX_DEV_ENERGYMODEL_H +#define _UAPI_LINUX_DEV_ENERGYMODEL_H + +#define DEV_ENERGYMODEL_FAMILY_NAME "dev-energymodel" +#define DEV_ENERGYMODEL_FAMILY_VERSION 1 + +/** + * enum dev_energymodel_perf_state_flags + * @DEV_ENERGYMODEL_PERF_STATE_FLAGS_PERF_STATE_INEFFICIENT: The performan= ce + * state is inefficient. There is in this perf-domain, another performan= ce + * state with a higher frequency but a lower or equal power cost. + */ +enum dev_energymodel_perf_state_flags { + DEV_ENERGYMODEL_PERF_STATE_FLAGS_PERF_STATE_INEFFICIENT =3D 1, +}; + +/** + * enum dev_energymodel_perf_domain_flags + * @DEV_ENERGYMODEL_PERF_DOMAIN_FLAGS_PERF_DOMAIN_MICROWATTS: The power va= lues + * are in micro-Watts or some other scale. + * @DEV_ENERGYMODEL_PERF_DOMAIN_FLAGS_PERF_DOMAIN_SKIP_INEFFICIENCIES: Skip + * inefficient states when estimating energy consumption. + * @DEV_ENERGYMODEL_PERF_DOMAIN_FLAGS_PERF_DOMAIN_ARTIFICIAL: The power va= lues + * are artificial and might be created by platform missing real power + * information. + */ +enum dev_energymodel_perf_domain_flags { + DEV_ENERGYMODEL_PERF_DOMAIN_FLAGS_PERF_DOMAIN_MICROWATTS =3D 1, + DEV_ENERGYMODEL_PERF_DOMAIN_FLAGS_PERF_DOMAIN_SKIP_INEFFICIENCIES =3D 2, + DEV_ENERGYMODEL_PERF_DOMAIN_FLAGS_PERF_DOMAIN_ARTIFICIAL =3D 4, +}; + +enum { + DEV_ENERGYMODEL_A_PERF_DOMAINS_PERF_DOMAIN =3D 1, + + __DEV_ENERGYMODEL_A_PERF_DOMAINS_MAX, + DEV_ENERGYMODEL_A_PERF_DOMAINS_MAX =3D (__DEV_ENERGYMODEL_A_PERF_DOMAINS_= MAX - 1) +}; + +enum { + DEV_ENERGYMODEL_A_PERF_DOMAIN_PAD =3D 1, + DEV_ENERGYMODEL_A_PERF_DOMAIN_PERF_DOMAIN_ID, + DEV_ENERGYMODEL_A_PERF_DOMAIN_FLAGS, + DEV_ENERGYMODEL_A_PERF_DOMAIN_CPUS, + + __DEV_ENERGYMODEL_A_PERF_DOMAIN_MAX, + DEV_ENERGYMODEL_A_PERF_DOMAIN_MAX =3D (__DEV_ENERGYMODEL_A_PERF_DOMAIN_MA= X - 1) +}; + +enum { + DEV_ENERGYMODEL_A_PERF_TABLE_PERF_DOMAIN_ID =3D 1, + DEV_ENERGYMODEL_A_PERF_TABLE_PERF_STATE, + + __DEV_ENERGYMODEL_A_PERF_TABLE_MAX, + DEV_ENERGYMODEL_A_PERF_TABLE_MAX =3D (__DEV_ENERGYMODEL_A_PERF_TABLE_MAX = - 1) +}; + +enum { + DEV_ENERGYMODEL_A_PERF_STATE_PAD =3D 1, + DEV_ENERGYMODEL_A_PERF_STATE_PERFORMANCE, + DEV_ENERGYMODEL_A_PERF_STATE_FREQUENCY, + DEV_ENERGYMODEL_A_PERF_STATE_POWER, + DEV_ENERGYMODEL_A_PERF_STATE_COST, + DEV_ENERGYMODEL_A_PERF_STATE_FLAGS, + + __DEV_ENERGYMODEL_A_PERF_STATE_MAX, + DEV_ENERGYMODEL_A_PERF_STATE_MAX =3D (__DEV_ENERGYMODEL_A_PERF_STATE_MAX = - 1) +}; + +enum { + DEV_ENERGYMODEL_CMD_GET_PERF_DOMAINS =3D 1, + DEV_ENERGYMODEL_CMD_GET_PERF_TABLE, + DEV_ENERGYMODEL_CMD_PERF_DOMAIN_CREATED, + DEV_ENERGYMODEL_CMD_PERF_DOMAIN_UPDATED, + DEV_ENERGYMODEL_CMD_PERF_DOMAIN_DELETED, + + __DEV_ENERGYMODEL_CMD_MAX, + DEV_ENERGYMODEL_CMD_MAX =3D (__DEV_ENERGYMODEL_CMD_MAX - 1) +}; + +#define DEV_ENERGYMODEL_MCGRP_EVENT "event" + +#endif /* _UAPI_LINUX_DEV_ENERGYMODEL_H */ diff --git a/include/uapi/linux/energy_model.h b/include/uapi/linux/energy_= model.h deleted file mode 100644 index 0bcad967854f..000000000000 --- a/include/uapi/linux/energy_model.h +++ /dev/null @@ -1,63 +0,0 @@ -/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Cl= ause) */ -/* Do not edit directly, auto-generated from: */ -/* Documentation/netlink/specs/em.yaml */ -/* YNL-GEN uapi header */ -/* To regenerate run: tools/net/ynl/ynl-regen.sh */ - -#ifndef _UAPI_LINUX_ENERGY_MODEL_H -#define _UAPI_LINUX_ENERGY_MODEL_H - -#define EM_FAMILY_NAME "em" -#define EM_FAMILY_VERSION 1 - -enum { - EM_A_PDS_PD =3D 1, - - __EM_A_PDS_MAX, - EM_A_PDS_MAX =3D (__EM_A_PDS_MAX - 1) -}; - -enum { - EM_A_PD_PAD =3D 1, - EM_A_PD_PD_ID, - EM_A_PD_FLAGS, - EM_A_PD_CPUS, - - __EM_A_PD_MAX, - EM_A_PD_MAX =3D (__EM_A_PD_MAX - 1) -}; - -enum { - EM_A_PD_TABLE_PD_ID =3D 1, - EM_A_PD_TABLE_PS, - - __EM_A_PD_TABLE_MAX, - EM_A_PD_TABLE_MAX =3D (__EM_A_PD_TABLE_MAX - 1) -}; - -enum { - EM_A_PS_PAD =3D 1, - EM_A_PS_PERFORMANCE, - EM_A_PS_FREQUENCY, - EM_A_PS_POWER, - EM_A_PS_COST, - EM_A_PS_FLAGS, - - __EM_A_PS_MAX, - EM_A_PS_MAX =3D (__EM_A_PS_MAX - 1) -}; - -enum { - EM_CMD_GET_PDS =3D 1, - EM_CMD_GET_PD_TABLE, - EM_CMD_PD_CREATED, - EM_CMD_PD_UPDATED, - EM_CMD_PD_DELETED, - - __EM_CMD_MAX, - EM_CMD_MAX =3D (__EM_CMD_MAX - 1) -}; - -#define EM_MCGRP_EVENT "event" - -#endif /* _UAPI_LINUX_ENERGY_MODEL_H */ diff --git a/kernel/power/em_netlink.c b/kernel/power/em_netlink.c index 4b85da138a06..6f6238c465bb 100644 --- a/kernel/power/em_netlink.c +++ b/kernel/power/em_netlink.c @@ -12,27 +12,31 @@ #include #include #include -#include +#include =20 #include "em_netlink.h" #include "em_netlink_autogen.h" =20 -#define EM_A_PD_CPUS_LEN 256 +#define DEV_ENERGYMODEL_A_PERF_DOMAIN_CPUS_LEN 256 =20 /*************************** Command encoding ****************************= ****/ static int __em_nl_get_pd_size(struct em_perf_domain *pd, void *data) { - char cpus_buf[EM_A_PD_CPUS_LEN]; + char cpus_buf[DEV_ENERGYMODEL_A_PERF_DOMAIN_CPUS_LEN]; int *tot_msg_sz =3D data; int msg_sz, cpus_sz; =20 cpus_sz =3D snprintf(cpus_buf, sizeof(cpus_buf), "%*pb", cpumask_pr_args(to_cpumask(pd->cpus))); =20 - msg_sz =3D nla_total_size(0) + /* EM_A_PDS_PD */ - nla_total_size(sizeof(u32)) + /* EM_A_PD_PD_ID */ - nla_total_size_64bit(sizeof(u64)) + /* EM_A_PD_FLAGS */ - nla_total_size(cpus_sz); /* EM_A_PD_CPUS */ + msg_sz =3D nla_total_size(0) + + /* DEV_ENERGYMODEL_A_PERF_DOMAINS_PERF_DOMAIN */ + nla_total_size(sizeof(u32)) + + /* DEV_ENERGYMODEL_A_PERF_DOMAIN_PERF_DOMAIN_ID */ + nla_total_size_64bit(sizeof(u64)) + + /* DEV_ENERGYMODEL_A_PERF_DOMAIN_FLAGS */ + nla_total_size(cpus_sz); + /* DEV_ENERGYMODEL_A_PERF_DOMAIN_CPUS */ =20 *tot_msg_sz +=3D nlmsg_total_size(genlmsg_msg_size(msg_sz)); return 0; @@ -40,23 +44,26 @@ static int __em_nl_get_pd_size(struct em_perf_domain *p= d, void *data) =20 static int __em_nl_get_pd(struct em_perf_domain *pd, void *data) { - char cpus_buf[EM_A_PD_CPUS_LEN]; + char cpus_buf[DEV_ENERGYMODEL_A_PERF_DOMAIN_CPUS_LEN]; struct sk_buff *msg =3D data; struct nlattr *entry; =20 - entry =3D nla_nest_start(msg, EM_A_PDS_PD); + entry =3D nla_nest_start(msg, + DEV_ENERGYMODEL_A_PERF_DOMAINS_PERF_DOMAIN); if (!entry) goto out_cancel_nest; =20 - if (nla_put_u32(msg, EM_A_PD_PD_ID, pd->id)) + if (nla_put_u32(msg, DEV_ENERGYMODEL_A_PERF_DOMAIN_PERF_DOMAIN_ID, + pd->id)) goto out_cancel_nest; =20 - if (nla_put_u64_64bit(msg, EM_A_PD_FLAGS, pd->flags, EM_A_PD_PAD)) + if (nla_put_u64_64bit(msg, DEV_ENERGYMODEL_A_PERF_DOMAIN_FLAGS, + pd->flags, DEV_ENERGYMODEL_A_PERF_DOMAIN_PAD)) goto out_cancel_nest; =20 snprintf(cpus_buf, sizeof(cpus_buf), "%*pb", cpumask_pr_args(to_cpumask(pd->cpus))); - if (nla_put_string(msg, EM_A_PD_CPUS, cpus_buf)) + if (nla_put_string(msg, DEV_ENERGYMODEL_A_PERF_DOMAIN_CPUS, cpus_buf)) goto out_cancel_nest; =20 nla_nest_end(msg, entry); @@ -69,7 +76,8 @@ static int __em_nl_get_pd(struct em_perf_domain *pd, void= *data) return -EMSGSIZE; } =20 -int em_nl_get_pds_doit(struct sk_buff *skb, struct genl_info *info) +int dev_energymodel_nl_get_perf_domains_doit(struct sk_buff *skb, + struct genl_info *info) { struct sk_buff *msg; void *hdr; @@ -82,7 +90,7 @@ int em_nl_get_pds_doit(struct sk_buff *skb, struct genl_i= nfo *info) if (!msg) return -ENOMEM; =20 - hdr =3D genlmsg_put_reply(msg, info, &em_nl_family, 0, cmd); + hdr =3D genlmsg_put_reply(msg, info, &dev_energymodel_nl_family, 0, cmd); if (!hdr) goto out_free_msg; =20 @@ -107,10 +115,10 @@ static struct em_perf_domain *__em_nl_get_pd_table_id= (struct nlattr **attrs) struct em_perf_domain *pd; int id; =20 - if (!attrs[EM_A_PD_TABLE_PD_ID]) + if (!attrs[DEV_ENERGYMODEL_A_PERF_TABLE_PERF_DOMAIN_ID]) return NULL; =20 - id =3D nla_get_u32(attrs[EM_A_PD_TABLE_PD_ID]); + id =3D nla_get_u32(attrs[DEV_ENERGYMODEL_A_PERF_TABLE_PERF_DOMAIN_ID]); pd =3D em_perf_domain_get_by_id(id); return pd; } @@ -119,25 +127,34 @@ static int __em_nl_get_pd_table_size(const struct em_= perf_domain *pd) { int id_sz, ps_sz; =20 - id_sz =3D nla_total_size(sizeof(u32)); /* EM_A_PD_TABLE_PD_ID */ - ps_sz =3D nla_total_size(0) + /* EM_A_PD_TABLE_PS */ - nla_total_size_64bit(sizeof(u64)) + /* EM_A_PS_PERFORMANCE */ - nla_total_size_64bit(sizeof(u64)) + /* EM_A_PS_FREQUENCY */ - nla_total_size_64bit(sizeof(u64)) + /* EM_A_PS_POWER */ - nla_total_size_64bit(sizeof(u64)) + /* EM_A_PS_COST */ - nla_total_size_64bit(sizeof(u64)); /* EM_A_PS_FLAGS */ + id_sz =3D nla_total_size(sizeof(u32)); + /* DEV_ENERGYMODEL_A_PERF_TABLE_PERF_DOMAIN_ID */ + ps_sz =3D nla_total_size(0) + + /* DEV_ENERGYMODEL_A_PERF_TABLE_PERF_STATE */ + nla_total_size_64bit(sizeof(u64)) + + /* DEV_ENERGYMODEL_A_PERF_STATE_PERFORMANCE */ + nla_total_size_64bit(sizeof(u64)) + + /* DEV_ENERGYMODEL_A_PERF_STATE_FREQUENCY */ + nla_total_size_64bit(sizeof(u64)) + + /* DEV_ENERGYMODEL_A_PERF_STATE_POWER */ + nla_total_size_64bit(sizeof(u64)) + + /* DEV_ENERGYMODEL_A_PERF_STATE_COST */ + nla_total_size_64bit(sizeof(u64)); + /* DEV_ENERGYMODEL_A_PERF_STATE_FLAGS */ ps_sz *=3D pd->nr_perf_states; =20 return nlmsg_total_size(genlmsg_msg_size(id_sz + ps_sz)); } =20 -static int __em_nl_get_pd_table(struct sk_buff *msg, const struct em_perf_= domain *pd) +static +int __em_nl_get_pd_table(struct sk_buff *msg, const struct em_perf_domain = *pd) { struct em_perf_state *table, *ps; struct nlattr *entry; int i; =20 - if (nla_put_u32(msg, EM_A_PD_TABLE_PD_ID, pd->id)) + if (nla_put_u32(msg, DEV_ENERGYMODEL_A_PERF_TABLE_PERF_DOMAIN_ID, + pd->id)) goto out_err; =20 rcu_read_lock(); @@ -146,24 +163,35 @@ static int __em_nl_get_pd_table(struct sk_buff *msg, = const struct em_perf_domain for (i =3D 0; i < pd->nr_perf_states; i++) { ps =3D &table[i]; =20 - entry =3D nla_nest_start(msg, EM_A_PD_TABLE_PS); + entry =3D nla_nest_start(msg, + DEV_ENERGYMODEL_A_PERF_TABLE_PERF_STATE); if (!entry) goto out_unlock_ps; =20 - if (nla_put_u64_64bit(msg, EM_A_PS_PERFORMANCE, - ps->performance, EM_A_PS_PAD)) + if (nla_put_u64_64bit(msg, + DEV_ENERGYMODEL_A_PERF_STATE_PERFORMANCE, + ps->performance, + DEV_ENERGYMODEL_A_PERF_STATE_PAD)) goto out_cancel_ps_nest; - if (nla_put_u64_64bit(msg, EM_A_PS_FREQUENCY, - ps->frequency, EM_A_PS_PAD)) + if (nla_put_u64_64bit(msg, + DEV_ENERGYMODEL_A_PERF_STATE_FREQUENCY, + ps->frequency, + DEV_ENERGYMODEL_A_PERF_STATE_PAD)) goto out_cancel_ps_nest; - if (nla_put_u64_64bit(msg, EM_A_PS_POWER, - ps->power, EM_A_PS_PAD)) + if (nla_put_u64_64bit(msg, + DEV_ENERGYMODEL_A_PERF_STATE_POWER, + ps->power, + DEV_ENERGYMODEL_A_PERF_STATE_PAD)) goto out_cancel_ps_nest; - if (nla_put_u64_64bit(msg, EM_A_PS_COST, - ps->cost, EM_A_PS_PAD)) + if (nla_put_u64_64bit(msg, + DEV_ENERGYMODEL_A_PERF_STATE_COST, + ps->cost, + DEV_ENERGYMODEL_A_PERF_STATE_PAD)) goto out_cancel_ps_nest; - if (nla_put_u64_64bit(msg, EM_A_PS_FLAGS, - ps->flags, EM_A_PS_PAD)) + if (nla_put_u64_64bit(msg, + DEV_ENERGYMODEL_A_PERF_STATE_FLAGS, + ps->flags, + DEV_ENERGYMODEL_A_PERF_STATE_PAD)) goto out_cancel_ps_nest; =20 nla_nest_end(msg, entry); @@ -179,7 +207,8 @@ static int __em_nl_get_pd_table(struct sk_buff *msg, co= nst struct em_perf_domain return -EMSGSIZE; } =20 -int em_nl_get_pd_table_doit(struct sk_buff *skb, struct genl_info *info) +int dev_energymodel_nl_get_perf_table_doit(struct sk_buff *skb, + struct genl_info *info) { int cmd =3D info->genlhdr->cmd; int msg_sz, ret =3D -EMSGSIZE; @@ -197,7 +226,7 @@ int em_nl_get_pd_table_doit(struct sk_buff *skb, struct= genl_info *info) if (!msg) return -ENOMEM; =20 - hdr =3D genlmsg_put_reply(msg, info, &em_nl_family, 0, cmd); + hdr =3D genlmsg_put_reply(msg, info, &dev_energymodel_nl_family, 0, cmd); if (!hdr) goto out_free_msg; =20 @@ -221,7 +250,7 @@ static void __em_notify_pd_table(const struct em_perf_d= omain *pd, int ntf_type) int msg_sz, ret =3D -EMSGSIZE; void *hdr; =20 - if (!genl_has_listeners(&em_nl_family, &init_net, EM_NLGRP_EVENT)) + if (!genl_has_listeners(&dev_energymodel_nl_family, &init_net, DEV_ENERGY= MODEL_NLGRP_EVENT)) return; =20 msg_sz =3D __em_nl_get_pd_table_size(pd); @@ -230,7 +259,7 @@ static void __em_notify_pd_table(const struct em_perf_d= omain *pd, int ntf_type) if (!msg) return; =20 - hdr =3D genlmsg_put(msg, 0, 0, &em_nl_family, 0, ntf_type); + hdr =3D genlmsg_put(msg, 0, 0, &dev_energymodel_nl_family, 0, ntf_type); if (!hdr) goto out_free_msg; =20 @@ -240,28 +269,28 @@ static void __em_notify_pd_table(const struct em_perf= _domain *pd, int ntf_type) =20 genlmsg_end(msg, hdr); =20 - genlmsg_multicast(&em_nl_family, msg, 0, EM_NLGRP_EVENT, GFP_KERNEL); + genlmsg_multicast(&dev_energymodel_nl_family, msg, 0, + DEV_ENERGYMODEL_NLGRP_EVENT, GFP_KERNEL); =20 return; =20 out_free_msg: nlmsg_free(msg); - return; } =20 void em_notify_pd_created(const struct em_perf_domain *pd) { - __em_notify_pd_table(pd, EM_CMD_PD_CREATED); + __em_notify_pd_table(pd, DEV_ENERGYMODEL_CMD_PERF_DOMAIN_CREATED); } =20 void em_notify_pd_updated(const struct em_perf_domain *pd) { - __em_notify_pd_table(pd, EM_CMD_PD_UPDATED); + __em_notify_pd_table(pd, DEV_ENERGYMODEL_CMD_PERF_DOMAIN_UPDATED); } =20 static int __em_notify_pd_deleted_size(const struct em_perf_domain *pd) { - int id_sz =3D nla_total_size(sizeof(u32)); /* EM_A_PD_TABLE_PD_ID */ + int id_sz =3D nla_total_size(sizeof(u32)); /* DEV_ENERGYMODEL_A_PERF_TABL= E_PERF_DOMAIN_ID */ =20 return nlmsg_total_size(genlmsg_msg_size(id_sz)); } @@ -272,7 +301,8 @@ void em_notify_pd_deleted(const struct em_perf_domain *= pd) void *hdr; int msg_sz; =20 - if (!genl_has_listeners(&em_nl_family, &init_net, EM_NLGRP_EVENT)) + if (!genl_has_listeners(&dev_energymodel_nl_family, &init_net, + DEV_ENERGYMODEL_NLGRP_EVENT)) return; =20 msg_sz =3D __em_notify_pd_deleted_size(pd); @@ -281,28 +311,29 @@ void em_notify_pd_deleted(const struct em_perf_domain= *pd) if (!msg) return; =20 - hdr =3D genlmsg_put(msg, 0, 0, &em_nl_family, 0, EM_CMD_PD_DELETED); + hdr =3D genlmsg_put(msg, 0, 0, &dev_energymodel_nl_family, 0, + DEV_ENERGYMODEL_CMD_PERF_DOMAIN_DELETED); if (!hdr) goto out_free_msg; =20 - if (nla_put_u32(msg, EM_A_PD_TABLE_PD_ID, pd->id)) { + if (nla_put_u32(msg, DEV_ENERGYMODEL_A_PERF_TABLE_PERF_DOMAIN_ID, + pd->id)) goto out_free_msg; - } =20 genlmsg_end(msg, hdr); =20 - genlmsg_multicast(&em_nl_family, msg, 0, EM_NLGRP_EVENT, GFP_KERNEL); + genlmsg_multicast(&dev_energymodel_nl_family, msg, 0, + DEV_ENERGYMODEL_NLGRP_EVENT, GFP_KERNEL); =20 return; =20 out_free_msg: nlmsg_free(msg); - return; } =20 /**************************** Initialization *****************************= ****/ static int __init em_netlink_init(void) { - return genl_register_family(&em_nl_family); + return genl_register_family(&dev_energymodel_nl_family); } postcore_initcall(em_netlink_init); diff --git a/kernel/power/em_netlink_autogen.c b/kernel/power/em_netlink_au= togen.c index ceb3b2bb6ebe..44acef0e7df2 100644 --- a/kernel/power/em_netlink_autogen.c +++ b/kernel/power/em_netlink_autogen.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Cl= ause) /* Do not edit directly, auto-generated from: */ -/* Documentation/netlink/specs/em.yaml */ +/* Documentation/netlink/specs/dev-energymodel.yaml */ /* YNL-GEN kernel source */ /* To regenerate run: tools/net/ynl/ynl-regen.sh */ =20 @@ -9,41 +9,41 @@ =20 #include "em_netlink_autogen.h" =20 -#include +#include =20 -/* EM_CMD_GET_PD_TABLE - do */ -static const struct nla_policy em_get_pd_table_nl_policy[EM_A_PD_TABLE_PD_= ID + 1] =3D { - [EM_A_PD_TABLE_PD_ID] =3D { .type =3D NLA_U32, }, +/* DEV_ENERGYMODEL_CMD_GET_PERF_TABLE - do */ +static const struct nla_policy dev_energymodel_get_perf_table_nl_policy[DE= V_ENERGYMODEL_A_PERF_TABLE_PERF_DOMAIN_ID + 1] =3D { + [DEV_ENERGYMODEL_A_PERF_TABLE_PERF_DOMAIN_ID] =3D { .type =3D NLA_U32, }, }; =20 -/* Ops table for em */ -static const struct genl_split_ops em_nl_ops[] =3D { +/* Ops table for dev_energymodel */ +static const struct genl_split_ops dev_energymodel_nl_ops[] =3D { { - .cmd =3D EM_CMD_GET_PDS, - .doit =3D em_nl_get_pds_doit, + .cmd =3D DEV_ENERGYMODEL_CMD_GET_PERF_DOMAINS, + .doit =3D dev_energymodel_nl_get_perf_domains_doit, .flags =3D GENL_CMD_CAP_DO, }, { - .cmd =3D EM_CMD_GET_PD_TABLE, - .doit =3D em_nl_get_pd_table_doit, - .policy =3D em_get_pd_table_nl_policy, - .maxattr =3D EM_A_PD_TABLE_PD_ID, + .cmd =3D DEV_ENERGYMODEL_CMD_GET_PERF_TABLE, + .doit =3D dev_energymodel_nl_get_perf_table_doit, + .policy =3D dev_energymodel_get_perf_table_nl_policy, + .maxattr =3D DEV_ENERGYMODEL_A_PERF_TABLE_PERF_DOMAIN_ID, .flags =3D GENL_CMD_CAP_DO, }, }; =20 -static const struct genl_multicast_group em_nl_mcgrps[] =3D { - [EM_NLGRP_EVENT] =3D { "event", }, +static const struct genl_multicast_group dev_energymodel_nl_mcgrps[] =3D { + [DEV_ENERGYMODEL_NLGRP_EVENT] =3D { "event", }, }; =20 -struct genl_family em_nl_family __ro_after_init =3D { - .name =3D EM_FAMILY_NAME, - .version =3D EM_FAMILY_VERSION, +struct genl_family dev_energymodel_nl_family __ro_after_init =3D { + .name =3D DEV_ENERGYMODEL_FAMILY_NAME, + .version =3D DEV_ENERGYMODEL_FAMILY_VERSION, .netnsok =3D true, .parallel_ops =3D true, .module =3D THIS_MODULE, - .split_ops =3D em_nl_ops, - .n_split_ops =3D ARRAY_SIZE(em_nl_ops), - .mcgrps =3D em_nl_mcgrps, - .n_mcgrps =3D ARRAY_SIZE(em_nl_mcgrps), + .split_ops =3D dev_energymodel_nl_ops, + .n_split_ops =3D ARRAY_SIZE(dev_energymodel_nl_ops), + .mcgrps =3D dev_energymodel_nl_mcgrps, + .n_mcgrps =3D ARRAY_SIZE(dev_energymodel_nl_mcgrps), }; diff --git a/kernel/power/em_netlink_autogen.h b/kernel/power/em_netlink_au= togen.h index 140ab548103c..f7e4bddcbd53 100644 --- a/kernel/power/em_netlink_autogen.h +++ b/kernel/power/em_netlink_autogen.h @@ -1,24 +1,26 @@ /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Cl= ause) */ /* Do not edit directly, auto-generated from: */ -/* Documentation/netlink/specs/em.yaml */ +/* Documentation/netlink/specs/dev-energymodel.yaml */ /* YNL-GEN kernel header */ /* To regenerate run: tools/net/ynl/ynl-regen.sh */ =20 -#ifndef _LINUX_EM_GEN_H -#define _LINUX_EM_GEN_H +#ifndef _LINUX_DEV_ENERGYMODEL_GEN_H +#define _LINUX_DEV_ENERGYMODEL_GEN_H =20 #include #include =20 -#include +#include =20 -int em_nl_get_pds_doit(struct sk_buff *skb, struct genl_info *info); -int em_nl_get_pd_table_doit(struct sk_buff *skb, struct genl_info *info); +int dev_energymodel_nl_get_perf_domains_doit(struct sk_buff *skb, + struct genl_info *info); +int dev_energymodel_nl_get_perf_table_doit(struct sk_buff *skb, + struct genl_info *info); =20 enum { - EM_NLGRP_EVENT, + DEV_ENERGYMODEL_NLGRP_EVENT, }; =20 -extern struct genl_family em_nl_family; +extern struct genl_family dev_energymodel_nl_family; =20 -#endif /* _LINUX_EM_GEN_H */ +#endif /* _LINUX_DEV_ENERGYMODEL_GEN_H */ --=20 2.52.0 From nobody Sun Feb 8 16:12:56 2026 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA61A192B75; Thu, 25 Dec 2025 04:01:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766635304; cv=none; b=lNo66mc0R7shUNyzTSHRtvEIukG6BXqV3mAlZVa9y04iEIM5s+7L7VOfRnIcFjjXdqGJu7AAFSer5Y2H5hcMCzDccTzym7VMwGWlBrCW8WIzqVRu9az2/vMmYV2ZsH3U+/8tr/4RXGMBOk1BJZ0ib4RHuXST95TBXrL1fNfu9g8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766635304; c=relaxed/simple; bh=UdwAAtXW32fS6bCl7uwaPVn+j9AvR9cSxwp8VCI72cg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=knX9atRUD8v/i74fAK2g7Ef88Ic29EINMDLswXPRhMHIRm95OcQtfvgbfZvJJwPG64dahwgKKM8DhgxZO3OgcOdwPlogf4JY0R2LxE4pLN0FL3mo3ajP/6zlYMuP6z8MUprLx8S+VnS1Rpfd6CrFC9RGPonyW3SIDQ5lSgoJRSk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=lON9XcoM; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="lON9XcoM" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=uYbciyDjCoohZWJzDduoI7+l5FwGc+voMTyxmtnDYEw=; b=lON9XcoMR1rnWfvQMLXs4jbyL6 /rMFR/3tOY/aJmL3syOBRGgo/h4lBSvwHlL9LtmSGdJ6URVYVsVx5uky9iR41EH6HdMrJFJO0uoGL V8gupPh0XmPZObrQ+uM+O9ijArJfc9/k+YtcNw9R6+sMlrVkOgoZT04Wp6U9EzaLqJlxvw4Tea+hE xbpCHnk0u5EPOTau9CcGZtmJWUIqFv0Ip7/5FQDZVwQeB/jgZB7Jxp5zeVWt5R78SZ6NivnGn35qE vJF6XcTJwMuSKyeZtQdr9Yjdfd2PA4GFrCpG6THSAzljvorN/NEyJrmNND5LegfpxmEvXW+4iN8oi GnxQq2Qw==; Received: from [58.29.143.236] (helo=localhost) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1vYcXc-00GLlP-JR; Thu, 25 Dec 2025 05:01:33 +0100 From: Changwoo Min To: lukasz.luba@arm.com, rafael@kernel.org, donald.hunter@gmail.com, kuba@kernel.org, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, horms@kernel.org, lenb@kernel.org, pavel@kernel.org, changwoo@igalia.com Cc: kernel-dev@igalia.com, linux-pm@vger.kernel.org, netdev@vger.kernel.org, sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH for 6.19 3/4] PM: EM: Change cpus' type from string to u64 array in the EM YNL spec Date: Thu, 25 Dec 2025 13:01:03 +0900 Message-ID: <20251225040104.982704-4-changwoo@igalia.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251225040104.982704-1-changwoo@igalia.com> References: <20251225040104.982704-1-changwoo@igalia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Previously, the cpus attribute was a string format which was a "%*pb" stringification of a bitmap. That is not very consumable for a UAPI, so let=E2=80=99s change it to an u64 array of CPU ids. Suggested-by: Donald Hunter Signed-off-by: Changwoo Min Reviewed-by: Donald Hunter --- .../netlink/specs/dev-energymodel.yaml | 3 ++- kernel/power/em_netlink.c | 22 +++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Documentation/netlink/specs/dev-energymodel.yaml b/Documentati= on/netlink/specs/dev-energymodel.yaml index cbc4bc38f23c..af8b8f72f722 100644 --- a/Documentation/netlink/specs/dev-energymodel.yaml +++ b/Documentation/netlink/specs/dev-energymodel.yaml @@ -73,7 +73,8 @@ attribute-sets: enum: perf-domain-flags - name: cpus - type: string + type: u64 + multi-attr: true doc: >- CPUs that belong to this performance domain. - diff --git a/kernel/power/em_netlink.c b/kernel/power/em_netlink.c index 6f6238c465bb..b6edb018c65a 100644 --- a/kernel/power/em_netlink.c +++ b/kernel/power/em_netlink.c @@ -17,17 +17,14 @@ #include "em_netlink.h" #include "em_netlink_autogen.h" =20 -#define DEV_ENERGYMODEL_A_PERF_DOMAIN_CPUS_LEN 256 - /*************************** Command encoding ****************************= ****/ static int __em_nl_get_pd_size(struct em_perf_domain *pd, void *data) { - char cpus_buf[DEV_ENERGYMODEL_A_PERF_DOMAIN_CPUS_LEN]; + int nr_cpus, msg_sz, cpus_sz; int *tot_msg_sz =3D data; - int msg_sz, cpus_sz; =20 - cpus_sz =3D snprintf(cpus_buf, sizeof(cpus_buf), "%*pb", - cpumask_pr_args(to_cpumask(pd->cpus))); + nr_cpus =3D cpumask_weight(to_cpumask(pd->cpus)); + cpus_sz =3D nla_total_size_64bit(sizeof(u64)) * nr_cpus; =20 msg_sz =3D nla_total_size(0) + /* DEV_ENERGYMODEL_A_PERF_DOMAINS_PERF_DOMAIN */ @@ -44,9 +41,10 @@ static int __em_nl_get_pd_size(struct em_perf_domain *pd= , void *data) =20 static int __em_nl_get_pd(struct em_perf_domain *pd, void *data) { - char cpus_buf[DEV_ENERGYMODEL_A_PERF_DOMAIN_CPUS_LEN]; struct sk_buff *msg =3D data; + struct cpumask *cpumask; struct nlattr *entry; + int cpu; =20 entry =3D nla_nest_start(msg, DEV_ENERGYMODEL_A_PERF_DOMAINS_PERF_DOMAIN); @@ -61,10 +59,12 @@ static int __em_nl_get_pd(struct em_perf_domain *pd, vo= id *data) pd->flags, DEV_ENERGYMODEL_A_PERF_DOMAIN_PAD)) goto out_cancel_nest; =20 - snprintf(cpus_buf, sizeof(cpus_buf), "%*pb", - cpumask_pr_args(to_cpumask(pd->cpus))); - if (nla_put_string(msg, DEV_ENERGYMODEL_A_PERF_DOMAIN_CPUS, cpus_buf)) - goto out_cancel_nest; + cpumask =3D to_cpumask(pd->cpus); + for_each_cpu(cpu, cpumask) { + if (nla_put_u64_64bit(msg, DEV_ENERGYMODEL_A_PERF_DOMAIN_CPUS, + cpu, DEV_ENERGYMODEL_A_PERF_DOMAIN_PAD)) + goto out_cancel_nest; + } =20 nla_nest_end(msg, entry); =20 --=20 2.52.0 From nobody Sun Feb 8 16:12:56 2026 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DC531A3179; Thu, 25 Dec 2025 04:01:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766635312; cv=none; b=i7/oo5iWZF16ofK4uYbKy7tfvoN1IFRxVgcBn8nkRprJabbgIVC9/ik6VY1JCKmaCzVGwvdUHpDtlLrivQu4pHgfz46OYgp1DIRW02cTU0KrwQSqd73YbslNQPSbQL2q6XAseAm8ZaBgKwyHdY9pnjXGg23xxc4MekNGuvL9RKo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766635312; c=relaxed/simple; bh=a0iq1sd1jBM9Q1ibIFRv0NxghMqTfNf4aPuL2PGlptU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k6vMNCW8AU5Hg0+L0RVM1Atx6eMWzd+G1hUHaceUn3OUYtQhvNt1GDqkaSPD/3DzdNGrY84wkhYn+lujKPiDyXxLEJLOy5TJDXY82YZOegtAApppJjxDbuaRAyeTch4fZrMSBgzBUb8HDeBc6FZM58I2ri3ARKM+X2tMXOyxp94= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=bOd3Boiv; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="bOd3Boiv" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=lwltwGqxiKq/BS1zwHOtRLooQae3Ubuni+ZvF375urk=; b=bOd3BoivYefmQg185t+3yXn/tN KUk4ZkQer5Ngpw36nT7mKkD2t+Wi8ZD1KJJwE6RruOnhpaak65VEO5f+wwld9uu1F/vzI70BxcwUR bR4BkB4AYtVkJr/mfw+LJR49JoI4NFiQ8ROcYqfES8aupTychHZ6DXHGEIkMCHlJyBA0mIsZOG9uK 913nxQ9+px99h/gbH3G6Qi0pQictX7fhrTQM7HGe8qjJvP5Btu5IgmUKOEaMCHVjF4RdfqMjV+mMO MyMO3DmD03lypMU9Gu40kOKw+uLXc0MG4evVpfqzFlc6yKww6TSXUewxp5cggfxMf3PBsFFvkm81M Y0XtYhXg==; Received: from [58.29.143.236] (helo=localhost) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1vYcXj-00GLlf-1l; Thu, 25 Dec 2025 05:01:40 +0100 From: Changwoo Min To: lukasz.luba@arm.com, rafael@kernel.org, donald.hunter@gmail.com, kuba@kernel.org, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, horms@kernel.org, lenb@kernel.org, pavel@kernel.org, changwoo@igalia.com Cc: kernel-dev@igalia.com, linux-pm@vger.kernel.org, netdev@vger.kernel.org, sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH for 6.19 4/4] PM: EM: Add dump to get-perf-domains in the EM YNL spec Date: Thu, 25 Dec 2025 13:01:04 +0900 Message-ID: <20251225040104.982704-5-changwoo@igalia.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251225040104.982704-1-changwoo@igalia.com> References: <20251225040104.982704-1-changwoo@igalia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add dump to get-perf-domains, so that a user can fetch either information about a specific performance domain with do or information about all performance domains with dump. The YNL spec, autogenerated files, and the do implementation are updated, and the dump implementation is added. Suggested-by: Donald Hunter Signed-off-by: Changwoo Min --- .../netlink/specs/dev-energymodel.yaml | 12 ++++ include/uapi/linux/dev_energymodel.h | 3 +- kernel/power/em_netlink.c | 58 +++++++++++++++++-- kernel/power/em_netlink_autogen.c | 16 ++++- kernel/power/em_netlink_autogen.h | 2 + 5 files changed, 82 insertions(+), 9 deletions(-) diff --git a/Documentation/netlink/specs/dev-energymodel.yaml b/Documentati= on/netlink/specs/dev-energymodel.yaml index af8b8f72f722..1843e68faacf 100644 --- a/Documentation/netlink/specs/dev-energymodel.yaml +++ b/Documentation/netlink/specs/dev-energymodel.yaml @@ -47,6 +47,11 @@ attribute-sets: doc: >- Information on all the performance domains. attributes: + - + name: perf-domain-id + type: u32 + doc: >- + A unique ID number for each performance domain. - name: perf-domain type: nest @@ -136,6 +141,13 @@ operations: attribute-set: perf-domains doc: Get the list of information for all performance domains. do: + request: + attributes: + - perf-domain-id + reply: + attributes: + - perf-domain + dump: reply: attributes: - perf-domain diff --git a/include/uapi/linux/dev_energymodel.h b/include/uapi/linux/dev_= energymodel.h index 3399967e1f93..e8e133b5a797 100644 --- a/include/uapi/linux/dev_energymodel.h +++ b/include/uapi/linux/dev_energymodel.h @@ -37,7 +37,8 @@ enum dev_energymodel_perf_domain_flags { }; =20 enum { - DEV_ENERGYMODEL_A_PERF_DOMAINS_PERF_DOMAIN =3D 1, + DEV_ENERGYMODEL_A_PERF_DOMAINS_PERF_DOMAIN_ID =3D 1, + DEV_ENERGYMODEL_A_PERF_DOMAINS_PERF_DOMAIN, =20 __DEV_ENERGYMODEL_A_PERF_DOMAINS_MAX, DEV_ENERGYMODEL_A_PERF_DOMAINS_MAX =3D (__DEV_ENERGYMODEL_A_PERF_DOMAINS_= MAX - 1) diff --git a/kernel/power/em_netlink.c b/kernel/power/em_netlink.c index b6edb018c65a..9412f1666007 100644 --- a/kernel/power/em_netlink.c +++ b/kernel/power/em_netlink.c @@ -18,6 +18,13 @@ #include "em_netlink_autogen.h" =20 /*************************** Command encoding ****************************= ****/ +struct dump_ctx { + int idx; + int start; + struct sk_buff *skb; + struct netlink_callback *cb; +}; + static int __em_nl_get_pd_size(struct em_perf_domain *pd, void *data) { int nr_cpus, msg_sz, cpus_sz; @@ -76,16 +83,44 @@ static int __em_nl_get_pd(struct em_perf_domain *pd, vo= id *data) return -EMSGSIZE; } =20 +static int __em_nl_get_pd_for_dump(struct em_perf_domain *pd, void *data) +{ + const struct genl_info *info; + struct dump_ctx *ctx =3D data; + void *hdr; + int ret; + + if (ctx->idx++ < ctx->start) + return 0; + + info =3D genl_info_dump(ctx->cb); + hdr =3D genlmsg_iput(ctx->skb, info); + if (!hdr) { + genlmsg_cancel(ctx->skb, hdr); + return -EMSGSIZE; + } + + ret =3D __em_nl_get_pd(pd, ctx->skb); + genlmsg_end(ctx->skb, hdr); + return ret; +} + int dev_energymodel_nl_get_perf_domains_doit(struct sk_buff *skb, struct genl_info *info) { + int id, ret =3D -EMSGSIZE, msg_sz =3D 0; + int cmd =3D info->genlhdr->cmd; + struct em_perf_domain *pd; struct sk_buff *msg; void *hdr; - int cmd =3D info->genlhdr->cmd; - int ret =3D -EMSGSIZE, msg_sz =3D 0; =20 - for_each_em_perf_domain(__em_nl_get_pd_size, &msg_sz); + if (!info->attrs[DEV_ENERGYMODEL_A_PERF_DOMAINS_PERF_DOMAIN_ID]) + return -EINVAL; + + id =3D nla_get_u32(info->attrs[DEV_ENERGYMODEL_A_PERF_DOMAINS_PERF_DOMAIN= _ID]); + pd =3D em_perf_domain_get_by_id(id); =20 + __em_nl_get_pd_size(pd, &msg_sz); msg =3D genlmsg_new(msg_sz, GFP_KERNEL); if (!msg) return -ENOMEM; @@ -94,10 +129,9 @@ int dev_energymodel_nl_get_perf_domains_doit(struct sk_= buff *skb, if (!hdr) goto out_free_msg; =20 - ret =3D for_each_em_perf_domain(__em_nl_get_pd, msg); + ret =3D __em_nl_get_pd(pd, msg); if (ret) goto out_cancel_msg; - genlmsg_end(msg, hdr); =20 return genlmsg_reply(msg, info); @@ -106,10 +140,22 @@ int dev_energymodel_nl_get_perf_domains_doit(struct s= k_buff *skb, genlmsg_cancel(msg, hdr); out_free_msg: nlmsg_free(msg); - return ret; } =20 +int dev_energymodel_nl_get_perf_domains_dumpit(struct sk_buff *skb, + struct netlink_callback *cb) +{ + struct dump_ctx ctx =3D { + .idx =3D 0, + .start =3D cb->args[0], + .skb =3D skb, + .cb =3D cb, + }; + + return for_each_em_perf_domain(__em_nl_get_pd_for_dump, &ctx); +} + static struct em_perf_domain *__em_nl_get_pd_table_id(struct nlattr **attr= s) { struct em_perf_domain *pd; diff --git a/kernel/power/em_netlink_autogen.c b/kernel/power/em_netlink_au= togen.c index 44acef0e7df2..16a59200c6a4 100644 --- a/kernel/power/em_netlink_autogen.c +++ b/kernel/power/em_netlink_autogen.c @@ -11,6 +11,11 @@ =20 #include =20 +/* DEV_ENERGYMODEL_CMD_GET_PERF_DOMAINS - do */ +static const struct nla_policy dev_energymodel_get_perf_domains_nl_policy[= DEV_ENERGYMODEL_A_PERF_DOMAINS_PERF_DOMAIN_ID + 1] =3D { + [DEV_ENERGYMODEL_A_PERF_DOMAINS_PERF_DOMAIN_ID] =3D { .type =3D NLA_U32, = }, +}; + /* DEV_ENERGYMODEL_CMD_GET_PERF_TABLE - do */ static const struct nla_policy dev_energymodel_get_perf_table_nl_policy[DE= V_ENERGYMODEL_A_PERF_TABLE_PERF_DOMAIN_ID + 1] =3D { [DEV_ENERGYMODEL_A_PERF_TABLE_PERF_DOMAIN_ID] =3D { .type =3D NLA_U32, }, @@ -18,10 +23,17 @@ static const struct nla_policy dev_energymodel_get_perf= _table_nl_policy[DEV_ENER =20 /* Ops table for dev_energymodel */ static const struct genl_split_ops dev_energymodel_nl_ops[] =3D { + { + .cmd =3D DEV_ENERGYMODEL_CMD_GET_PERF_DOMAINS, + .doit =3D dev_energymodel_nl_get_perf_domains_doit, + .policy =3D dev_energymodel_get_perf_domains_nl_policy, + .maxattr =3D DEV_ENERGYMODEL_A_PERF_DOMAINS_PERF_DOMAIN_ID, + .flags =3D GENL_CMD_CAP_DO, + }, { .cmd =3D DEV_ENERGYMODEL_CMD_GET_PERF_DOMAINS, - .doit =3D dev_energymodel_nl_get_perf_domains_doit, - .flags =3D GENL_CMD_CAP_DO, + .dumpit =3D dev_energymodel_nl_get_perf_domains_dumpit, + .flags =3D GENL_CMD_CAP_DUMP, }, { .cmd =3D DEV_ENERGYMODEL_CMD_GET_PERF_TABLE, diff --git a/kernel/power/em_netlink_autogen.h b/kernel/power/em_netlink_au= togen.h index f7e4bddcbd53..5caf2f7e18a5 100644 --- a/kernel/power/em_netlink_autogen.h +++ b/kernel/power/em_netlink_autogen.h @@ -14,6 +14,8 @@ =20 int dev_energymodel_nl_get_perf_domains_doit(struct sk_buff *skb, struct genl_info *info); +int dev_energymodel_nl_get_perf_domains_dumpit(struct sk_buff *skb, + struct netlink_callback *cb); int dev_energymodel_nl_get_perf_table_doit(struct sk_buff *skb, struct genl_info *info); =20 --=20 2.52.0