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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251009094905.223456-1-wbg@kernel.org>
Date: Thu,  9 Oct 2025 18:49:03 +0900
From: William Breathitt Gray <wbg@...nel.org>
To: Mark Cave-Ayland <mark.caveayland@...anix.com>
Cc: William Breathitt Gray <wbg@...nel.org>,
	mwalle@...nel.org,
	linus.walleij@...aro.org,
	brgl@...ev.pl,
	andriy.shevchenko@...ux.intel.com,
	broonie@...nel.org,
	linux-gpio@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: gpio: gpio-pci-idio-16 regression after LTS upgrade

On Thu, Oct 09, 2025 at 10:05:58AM +0100, Mark Cave-Ayland wrote:
> On 07/10/2025 09:16, William Breathitt Gray wrote:
> > So the intention I had with gpio-idio-16 was to provide reg_dat_base and
> > reg_set_base to define the input and output bases, and then
> > reg_mask_xlate would do the translation between input and outputs. I
> > think this design is allowed by gpio-regmap, is it not Michael?
> >
> > In theory, gpio_regmap_get_direction should call gpio->reg_mask_xlate()
> > which is mapped to idio_16_reg_mask_xlate(), and thus set reg and mask
> > which then is evaluated at the end of gpio_regmap_get_direction() to
> > determine which direction to return.
> >
> > Is it possible idio_16_reg_mask_xlate() is returning the wrong values
> > for reg and mask?
> >
> > William Breathitt Gray
> 
> The only logic around .reg_dat_base and .reg_set_base in
> gpio_regmap_get_direction() is this:
> 
> 	if (gpio->reg_dat_base && !gpio->reg_set_base)
> 		return GPIO_LINE_DIRECTION_IN;
> 	if (gpio->reg_set_base && !gpio->reg_dat_base)
> 		return GPIO_LINE_DIRECTION_OUT;
> 
> Otherwise it attempts to use .reg_dir_out_base and .reg_dir_in_base
> which are not set for gpio-idio-16 because the GPIO directions are fixed
> and not controlled via a data-direction register. And as these are not
> set, gpio_regmap_get_direction() returns -ENOTSUPP.
> 
> Were you thinking that gpio_regmap_get_direction() should have some
> additional direction logic if both .reg_dat_base and .reg_set_base are
> set, based upon their comparative values?

Ah you're right, I misunderstood the logic in gpio_regmap_get_direction.
So essentially the problem is that gpio-idio-16 has no way of indicating
the direction of its I/O because it's mixed.

The IDIO-16 series lacks a direction setting register, so I think the
proper solution is as you suggest: add support for a get_direction
callback to struct gpio_regmap_config in the same vein as the existing
reg_mask_xlate callback. Then in gpio_regmap_register you can set
gpio->get_direction = config->get_direction in the same way
config->reg_mask_xlate is handled.

William Breathitt Gray

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ