All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v2 3/8] power: reset: Introduce PSCR Recording Framework for Non-Volatile Storage
@ 2024-01-27 23:31 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2024-01-27 23:31 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "low confidence static check warning: drivers/power/reset/pscrr.c:132:9: sparse: sparse: statement expected after case label"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20240124122204.730370-4-o.rempel@pengutronix.de>
References: <20240124122204.730370-4-o.rempel@pengutronix.de>
TO: Oleksij Rempel <o.rempel@pengutronix.de>
TO: Sebastian Reichel <sre@kernel.org>
TO: Rob Herring <robh+dt@kernel.org>
TO: Krzysztof Kozlowski <krzk@kernel.org>
TO: Conor Dooley <conor+dt@kernel.org>
TO: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
CC: Oleksij Rempel <o.rempel@pengutronix.de>
CC: kernel@pengutronix.de
CC: linux-kernel@vger.kernel.org
CC: Liam Girdwood <lgirdwood@gmail.com>
CC: Mark Brown <broonie@kernel.org>
CC: "Rafael J. Wysocki" <rafael@kernel.org>
CC: Daniel Lezcano <daniel.lezcano@linaro.org>
CC: Zhang Rui <rui.zhang@intel.com>
CC: Lukasz Luba <lukasz.luba@arm.com>
CC: linux-pm@vger.kernel.org
CC: devicetree@vger.kernel.org
CC: "Søren Andersen" <san@skov.dk>

Hi Oleksij,

kernel test robot noticed the following build warnings:

[auto build test WARNING on robh/for-next]
[also build test WARNING on broonie-regulator/for-next rafael-pm/thermal linus/master v6.8-rc1 next-20240125]
[cannot apply to sre-power-supply/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Oleksij-Rempel/power-Extend-power_on_reason-h-for-upcoming-PSCRR-framework/20240124-202833
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link:    https://lore.kernel.org/r/20240124122204.730370-4-o.rempel%40pengutronix.de
patch subject: [PATCH v2 3/8] power: reset: Introduce PSCR Recording Framework for Non-Volatile Storage
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: i386-randconfig-062-20240128 (https://download.01.org/0day-ci/archive/20240128/202401280712.O6FEvsAC-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240128/202401280712.O6FEvsAC-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202401280712.O6FEvsAC-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/power/reset/pscrr.c:132:9: sparse: sparse: statement expected after case label
>> drivers/power/reset/pscrr.c:20:11: sparse: sparse: symbol 'system_pscr' was not declared. Should it be static?
>> drivers/power/reset/pscrr.c:57:17: sparse: sparse: symbol 'pscr_map_table' was not declared. Should it be static?
   drivers/power/reset/pscrr.c: note: in included file (through include/linux/mmzone.h, include/linux/gfp.h, include/linux/xarray.h, ...):
   include/linux/page-flags.h:242:46: sparse: sparse: self-comparison always evaluates to false

vim +132 drivers/power/reset/pscrr.c

3f484eec6730bd Oleksij Rempel 2024-01-24   19  
3f484eec6730bd Oleksij Rempel 2024-01-24  @20  enum pscr system_pscr;
3f484eec6730bd Oleksij Rempel 2024-01-24   21  
3f484eec6730bd Oleksij Rempel 2024-01-24   22  /*
3f484eec6730bd Oleksij Rempel 2024-01-24   23   * struct pscr_to_magic_entry - Entry for mapping PSCR to magic values.
3f484eec6730bd Oleksij Rempel 2024-01-24   24   *
3f484eec6730bd Oleksij Rempel 2024-01-24   25   * This structure represents a single entry in a list that maps Power State
3f484eec6730bd Oleksij Rempel 2024-01-24   26   * Change Reason (PSCR) values to corresponding magic values. Each entry
3f484eec6730bd Oleksij Rempel 2024-01-24   27   * associates a specific PSCR with a unique magic value, facilitating easy
3f484eec6730bd Oleksij Rempel 2024-01-24   28   * translation between the two.
3f484eec6730bd Oleksij Rempel 2024-01-24   29   *
3f484eec6730bd Oleksij Rempel 2024-01-24   30   * @pscr: The PSCR value.
3f484eec6730bd Oleksij Rempel 2024-01-24   31   * @magic: The corresponding magic value.
3f484eec6730bd Oleksij Rempel 2024-01-24   32   * @list: List head for chaining multiple such entries.
3f484eec6730bd Oleksij Rempel 2024-01-24   33   */
3f484eec6730bd Oleksij Rempel 2024-01-24   34  struct pscr_to_magic_entry {
3f484eec6730bd Oleksij Rempel 2024-01-24   35  	enum pscr pscr;
3f484eec6730bd Oleksij Rempel 2024-01-24   36  	u32 magic;
3f484eec6730bd Oleksij Rempel 2024-01-24   37  	struct list_head list;
3f484eec6730bd Oleksij Rempel 2024-01-24   38  };
3f484eec6730bd Oleksij Rempel 2024-01-24   39  
3f484eec6730bd Oleksij Rempel 2024-01-24   40  /*
3f484eec6730bd Oleksij Rempel 2024-01-24   41   * struct pscr_map - Maps device tree property names to PSCR values.
3f484eec6730bd Oleksij Rempel 2024-01-24   42   *
3f484eec6730bd Oleksij Rempel 2024-01-24   43   * @dt_prop_name: Device tree property name without the "pscr-" prefix.
3f484eec6730bd Oleksij Rempel 2024-01-24   44   * @pscr: The corresponding PSCR enum value for the given property name.
3f484eec6730bd Oleksij Rempel 2024-01-24   45   */
3f484eec6730bd Oleksij Rempel 2024-01-24   46  struct pscr_map {
3f484eec6730bd Oleksij Rempel 2024-01-24   47  	const char *dt_prop_name;
3f484eec6730bd Oleksij Rempel 2024-01-24   48  	enum pscr pscr;
3f484eec6730bd Oleksij Rempel 2024-01-24   49  };
3f484eec6730bd Oleksij Rempel 2024-01-24   50  
3f484eec6730bd Oleksij Rempel 2024-01-24   51  /*
3f484eec6730bd Oleksij Rempel 2024-01-24   52   * struct pscr_map - Maps shortened DT property names to PSCR values.
3f484eec6730bd Oleksij Rempel 2024-01-24   53   *
3f484eec6730bd Oleksij Rempel 2024-01-24   54   * This structure maps device tree property names, with the "pscr-" prefix
3f484eec6730bd Oleksij Rempel 2024-01-24   55   * omitted, to their corresponding Power State Change Reason (PSCR) values.
3f484eec6730bd Oleksij Rempel 2024-01-24   56   */
3f484eec6730bd Oleksij Rempel 2024-01-24  @57  struct pscr_map pscr_map_table[] = {
3f484eec6730bd Oleksij Rempel 2024-01-24   58  	{ "under-voltage", PSCR_UNDER_VOLTAGE },
3f484eec6730bd Oleksij Rempel 2024-01-24   59  	{ "over-current", PSCR_OVER_CURRENT },
3f484eec6730bd Oleksij Rempel 2024-01-24   60  	{ "regulator-failure", PSCR_REGULATOR_FAILURE },
3f484eec6730bd Oleksij Rempel 2024-01-24   61  	{ "over-temperature", PSCR_OVERTEMPERATURE },
3f484eec6730bd Oleksij Rempel 2024-01-24   62  };
3f484eec6730bd Oleksij Rempel 2024-01-24   63  
3f484eec6730bd Oleksij Rempel 2024-01-24   64  /*
3f484eec6730bd Oleksij Rempel 2024-01-24   65   * pscr_find_from_dt_name - Finds the PSCR value for a given DT property name.
3f484eec6730bd Oleksij Rempel 2024-01-24   66   *
3f484eec6730bd Oleksij Rempel 2024-01-24   67   * @dt_prop_name: The device tree property name, without the "pscr-" prefix, to
3f484eec6730bd Oleksij Rempel 2024-01-24   68   * look up.
3f484eec6730bd Oleksij Rempel 2024-01-24   69   * Returns the corresponding PSCR value or -ENOENT if not found.
3f484eec6730bd Oleksij Rempel 2024-01-24   70   */
3f484eec6730bd Oleksij Rempel 2024-01-24   71  static int find_pscr_by_string(const char *dt_prop_name)
3f484eec6730bd Oleksij Rempel 2024-01-24   72  {
3f484eec6730bd Oleksij Rempel 2024-01-24   73  	int i;
3f484eec6730bd Oleksij Rempel 2024-01-24   74  
3f484eec6730bd Oleksij Rempel 2024-01-24   75  	for (i = 0; i < ARRAY_SIZE(pscr_map_table); i++) {
3f484eec6730bd Oleksij Rempel 2024-01-24   76  		if (!strcmp(dt_prop_name, pscr_map_table[i].dt_prop_name))
3f484eec6730bd Oleksij Rempel 2024-01-24   77  			return pscr_map_table[i].pscr;
3f484eec6730bd Oleksij Rempel 2024-01-24   78  	}
3f484eec6730bd Oleksij Rempel 2024-01-24   79  
3f484eec6730bd Oleksij Rempel 2024-01-24   80  	return -ENOENT;
3f484eec6730bd Oleksij Rempel 2024-01-24   81  }
3f484eec6730bd Oleksij Rempel 2024-01-24   82  
3f484eec6730bd Oleksij Rempel 2024-01-24   83  static enum pscr get_pscr_by_magic(struct pscrr_device *pscrr_dev, u32 magic)
3f484eec6730bd Oleksij Rempel 2024-01-24   84  {
3f484eec6730bd Oleksij Rempel 2024-01-24   85  	struct pscr_to_magic_entry *map_entry;
3f484eec6730bd Oleksij Rempel 2024-01-24   86  
3f484eec6730bd Oleksij Rempel 2024-01-24   87  	list_for_each_entry(map_entry, &pscrr_dev->pscr_map_list, list) {
3f484eec6730bd Oleksij Rempel 2024-01-24   88  		if (map_entry->magic == magic)
3f484eec6730bd Oleksij Rempel 2024-01-24   89  			return map_entry->pscr;
3f484eec6730bd Oleksij Rempel 2024-01-24   90  	}
3f484eec6730bd Oleksij Rempel 2024-01-24   91  
3f484eec6730bd Oleksij Rempel 2024-01-24   92  	return 0;
3f484eec6730bd Oleksij Rempel 2024-01-24   93  }
3f484eec6730bd Oleksij Rempel 2024-01-24   94  
3f484eec6730bd Oleksij Rempel 2024-01-24   95  static u32 get_magic_by_pscr(struct pscrr_device *pscrr_dev, enum pscr pscr)
3f484eec6730bd Oleksij Rempel 2024-01-24   96  {
3f484eec6730bd Oleksij Rempel 2024-01-24   97  	struct pscr_to_magic_entry *map_entry;
3f484eec6730bd Oleksij Rempel 2024-01-24   98  
3f484eec6730bd Oleksij Rempel 2024-01-24   99  	list_for_each_entry(map_entry, &pscrr_dev->pscr_map_list, list) {
3f484eec6730bd Oleksij Rempel 2024-01-24  100  		if (map_entry->pscr == pscr)
3f484eec6730bd Oleksij Rempel 2024-01-24  101  			return map_entry->magic;
3f484eec6730bd Oleksij Rempel 2024-01-24  102  	}
3f484eec6730bd Oleksij Rempel 2024-01-24  103  
3f484eec6730bd Oleksij Rempel 2024-01-24  104  	return 0;
3f484eec6730bd Oleksij Rempel 2024-01-24  105  }
3f484eec6730bd Oleksij Rempel 2024-01-24  106  
3f484eec6730bd Oleksij Rempel 2024-01-24  107  /**
3f484eec6730bd Oleksij Rempel 2024-01-24  108   * set_power_state_change_reason() - Set the system's power state change reason
3f484eec6730bd Oleksij Rempel 2024-01-24  109   * @pscr: The enum value representing the power state change reason
3f484eec6730bd Oleksij Rempel 2024-01-24  110   *
3f484eec6730bd Oleksij Rempel 2024-01-24  111   * This function sets the system's power state change reason based on the
3f484eec6730bd Oleksij Rempel 2024-01-24  112   * provided enum value.
3f484eec6730bd Oleksij Rempel 2024-01-24  113   */
3f484eec6730bd Oleksij Rempel 2024-01-24  114  void set_power_state_change_reason(enum pscr pscr)
3f484eec6730bd Oleksij Rempel 2024-01-24  115  {
3f484eec6730bd Oleksij Rempel 2024-01-24  116  	system_pscr = pscr;
3f484eec6730bd Oleksij Rempel 2024-01-24  117  }
3f484eec6730bd Oleksij Rempel 2024-01-24  118  EXPORT_SYMBOL_GPL(set_power_state_change_reason);
3f484eec6730bd Oleksij Rempel 2024-01-24  119  
3f484eec6730bd Oleksij Rempel 2024-01-24  120  static const char *pscr_to_por_string(enum pscr pscr)
3f484eec6730bd Oleksij Rempel 2024-01-24  121  {
3f484eec6730bd Oleksij Rempel 2024-01-24  122  	switch (pscr) {
3f484eec6730bd Oleksij Rempel 2024-01-24  123  	case PSCR_UNDER_VOLTAGE:
3f484eec6730bd Oleksij Rempel 2024-01-24  124  		return POWER_ON_REASON_BROWN_OUT;
3f484eec6730bd Oleksij Rempel 2024-01-24  125  	case PSCR_OVER_CURRENT:
3f484eec6730bd Oleksij Rempel 2024-01-24  126  		return POWER_ON_REASON_OVER_CURRENT;
3f484eec6730bd Oleksij Rempel 2024-01-24  127  	case PSCR_REGULATOR_FAILURE:
3f484eec6730bd Oleksij Rempel 2024-01-24  128  		return POWER_ON_REASON_REGULATOR_FAILURE;
3f484eec6730bd Oleksij Rempel 2024-01-24  129  	case PSCR_OVERTEMPERATURE:
3f484eec6730bd Oleksij Rempel 2024-01-24  130  		return POWER_ON_REASON_OVERTEMPERATURE;
3f484eec6730bd Oleksij Rempel 2024-01-24  131  	default:
3f484eec6730bd Oleksij Rempel 2024-01-24 @132  	}
3f484eec6730bd Oleksij Rempel 2024-01-24  133  
3f484eec6730bd Oleksij Rempel 2024-01-24  134  	return POWER_ON_REASON_UNKNOWN;
3f484eec6730bd Oleksij Rempel 2024-01-24  135  }
3f484eec6730bd Oleksij Rempel 2024-01-24  136  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [RFC PATCH v1 0/8] Introduction of PSCR Framework and Related Components
@ 2024-01-24 12:21 Oleksij Rempel
  2024-01-24 12:21 ` [PATCH v2 3/8] power: reset: Introduce PSCR Recording Framework for Non-Volatile Storage Oleksij Rempel
  0 siblings, 1 reply; 3+ messages in thread
From: Oleksij Rempel @ 2024-01-24 12:21 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Srinivas Kandagatla
  Cc: Oleksij Rempel, kernel, linux-kernel, Liam Girdwood, Mark Brown,
	Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	linux-pm, devicetree, Søren Andersen

changes v2:
- rename the framework from PSCR to PSCRR (last R is for Recorder)
- extend power on reason header and use it to show detected reason on
  system start and in sysfs.
- remove "unknow" reason
- rebase on top of v6.8-rc1
- yaml fixes
- zero reason state on boot

Hello all,

This patch series introduces the Power State Change Reasons (PSCR)
tracking framework and its related components into the kernel. The PSCR
framework is designed for systems where traditional methods of storing
power state change reasons, like PMICs or watchdogs, are inadequate. It
provides a structured way to store reasons for system shutdowns and
reboots, such as under-voltage or software-triggered events, in
non-volatile hardware storage.

These changes are critical for systems requiring detailed postmortem
analysis and where immediate power-down scenarios limit traditional
storage options. The framework also assists bootloaders and early-stage
system components in making informed recovery decisions.

Oleksij Rempel (8):
  power: Extend power_on_reason.h for upcoming PSCRR framework
  dt-bindings: power: reset: add generic PSCRR binding trackers
  power: reset: Introduce PSCR Recording Framework for Non-Volatile
    Storage
  dt-bindings: power: reset: add bindings for NVMEM hardware storing
    PSCR Data
  nvmem: provide consumer access to cell size metrics
  power: reset: add PSCR NVMEM Driver for Recording Power State Change
    Reasons
  regulator: set Power State Change Reason before
    hw_protection_shutdown()
  thermal: core: Record PSCR before hw_protection_shutdown()

 .../bindings/power/reset/pscrr-nvmem.yaml     |  53 +++
 .../bindings/power/reset/pscrr.yaml           |  44 +++
 drivers/nvmem/core.c                          |  25 ++
 drivers/power/reset/Kconfig                   |  30 ++
 drivers/power/reset/Makefile                  |   2 +
 drivers/power/reset/pscrr-nvmem.c             | 121 ++++++
 drivers/power/reset/pscrr.c                   | 353 ++++++++++++++++++
 drivers/regulator/core.c                      |   6 +
 drivers/thermal/thermal_core.c                |   3 +
 include/linux/nvmem-consumer.h                |   7 +
 include/linux/power/power_on_reason.h         |   3 +
 include/linux/pscrr.h                         |  73 ++++
 12 files changed, 720 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/reset/pscrr-nvmem.yaml
 create mode 100644 Documentation/devicetree/bindings/power/reset/pscrr.yaml
 create mode 100644 drivers/power/reset/pscrr-nvmem.c
 create mode 100644 drivers/power/reset/pscrr.c
 create mode 100644 include/linux/pscrr.h

-- 
2.39.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-28  9:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-27 23:31 [PATCH v2 3/8] power: reset: Introduce PSCR Recording Framework for Non-Volatile Storage kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2024-01-24 12:21 [RFC PATCH v1 0/8] Introduction of PSCR Framework and Related Components Oleksij Rempel
2024-01-24 12:21 ` [PATCH v2 3/8] power: reset: Introduce PSCR Recording Framework for Non-Volatile Storage Oleksij Rempel
2024-01-28  9:05   ` kernel test robot

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.