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>] [day] [month] [year] [list]
Message-ID: <CAMRc=MdcxeRAHyGw2PPL9sN8qHL=YLKHDu2TDpCUUjBdNW3Qcw@mail.gmail.com>
Date:   Thu, 23 Jun 2022 16:59:50 +0200
From:   Bartosz Golaszewski <brgl@...ev.pl>
To:     Menglong Wu <menglongwoo@...yun.com>
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: Re: [PATCH 0/2] gpio: gpio-sim: read property 'gpio-base' from dtb

On Wed, Jun 22, 2022 at 5:54 PM Menglong Wu <menglongwoo@...yun.com> wrote:
>
> The first GPIO number of the gpio-sim module is dynamic.
>
> gpio_chip.base = -1.
>
> ```
>     gpio-sim {
>         compatible = "gpio-simulator";
>         bank0 {
>             gpio-controller;
>             #gpio-cells = <2>;
>             ngpios = <16>;
>             gpio-sim,label = "dt-bank0";
>             gpio-line-names = "", "sim-foo", "", "sim-bar";
>         };
>     };
> ```
>
> If I want to export GPIO from user space. I have to confirm the number
> from the debugfs filesystem. The 16 GPIO be map to 2032-2047.
>

I find it ironic that you're trying to use sysfs to play with the
module whose sole purpose is to facilitate the move away from it. I'd
like to hear a very good reason to add this option because otherwise
you're exposing information that should very much be hidden from
user-space.

Bart

>
> ```
> [root@...U-ARM ~]# cat /sys/kernel/debug/gpio
> gpiochip0: GPIOs 2032-2047, parent: platform/gpio-sim, dt-bank0:
>
>  gpio-2033 (sim-foo             )
>  gpio-2035 (sim-bar             )
> ```
>
> Change
>
> Then add the property 'gpio-base' to fix the base number.
> Although the method is be DEPRECATED (include/linux/gpio/driver.h)
>
> ```
>     gpio-sim {
>         compatible = "gpio-simulator";
>         bank0 {
>             gpio-controller;
>             #gpio-cells = <2>;
>             gpio-base = <300>;
>             ngpios = <16>;
>             gpio-sim,label = "dt-bank0";
>             gpio-line-names = "", "sim-foo", "", "sim-bar";
>         };
>     };
> ```
>
> This base number is always 300.
>
> ```
> [root@...U-ARM ~]# cat /sys/kernel/debug/gpio
> gpiochip0: GPIOs 300-315, parent: platform/gpio-sim, dt-bank0:
>  gpio-301 (sim-foo             )
>  gpio-303 (sim-bar             )
> [root@...U-ARM ~]# echo 300 > /sys/class/gpio/export
> ```
>
>
>
>
> Menglong Wu (2):
>   gpio: gpio-sim: initialize gpio_chip->base from dtb
>   docs: gpio-sim device-tree example with gpio-base
>
>  Documentation/admin-guide/gpio/gpio-sim.rst | 3 +++
>  drivers/gpio/gpio-sim.c                     | 7 ++++++-
>  2 files changed, 9 insertions(+), 1 deletion(-)
>
> --
> 2.30.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ