lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Mon, 17 Jun 2024 07:20:28 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Mark Brown <broonie@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-kernel@...r.kernel.org, Armin Wolf <W_Armin@....de>
Subject: Page select register restrictions in regmap core

Hi,

I have been trying to use the regmap page select mechanism to implement
page access in the upcoming spd5118 driver [1]. Unfortunately, that fails
with the following error.

spd5118 0-0050: Range 0: selector for 1 in window
spd5118 0-0050: error -EINVAL: regmap init failed

The page select register in spd5118 devices is outside the paged area
in an area which is otherwise (i.e., for other registers in that area)
only accessible from page 0. The regmap range configuration looks as
follows.

static const struct regmap_range_cfg regmap_range_cfg[] = {
	/*
	 * volatile registers, only accessible from page 0 except for
	 * the page select register
	 */
        {
        .selector_reg     = SPD5118_REG_I2C_LEGACY_MODE,	// 0x0b
        .selector_mask    = SPD5118_LEGACY_PAGE_MASK,		// 0x07
        .selector_shift   = 0,
        .window_start     = 0,
        .window_len       = SPD5118_PAGE_SIZE,			// 128
        .range_min        = 0,
        .range_max        = SPD5118_PAGE_SIZE - 1,		// 127
        },
	/* non-volatile data, pages 0..7 */
        {
        .selector_reg     = SPD5118_REG_I2C_LEGACY_MODE,	// 0x0b
        .selector_mask    = SPD5118_LEGACY_PAGE_MASK,		// 0x07
        .selector_shift   = 0,
        .window_start     = SPD5118_PAGE_SIZE,			// 128
        .window_len       = SPD5118_PAGE_SIZE,			// 128
        .range_min        = SPD5118_PAGE_SIZE,			// 128
        .range_max        = 9 * SPD5118_PAGE_SIZE - 1,		// 0x47f
        },
};

This works just fine if I comment out the select register validation in
the regmap core (the one which generates the error). Is there a reason
for having this restriction, or would it be possible to drop it ?
If dropping it is not possible, could we possibly add some flag to the
configuration data, indicating that this "violation" is on purpose ?
Alternatively, do you see some other means to describe the ranges which
would not violate the restrictions ?

Thanks,
Guenter

---
[1] https://patchwork.kernel.org/project/linux-hwmon/patch/20240610144103.1970359-3-linux@roeck-us.net/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ