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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 7 Jul 2022 19:00:15 +0800
From:   Baolin Wang <baolin.wang7@...il.com>
To:     Christian Marangi <ansuelsmth@...il.com>
Cc:     Andy Gross <agross@...nel.org>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        Konrad Dybcio <konrad.dybcio@...ainline.org>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Ohad Ben-Cohen <ohad@...ery.com>,
        linux-arm-msm@...r.kernel.org,
        Devicetree List <devicetree@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        linux-remoteproc@...r.kernel.org
Subject: Re: [PATCH 1/3] hwspinlock: qcom: Add support for mmio usage to sfpb-mutex

On Thu, Jul 7, 2022 at 9:30 AM Christian Marangi <ansuelsmth@...il.com> wrote:
>
> Allow sfpb-mutex to use mmio in addition to syscon.
>
> Signed-off-by: Christian Marangi <ansuelsmth@...il.com>
> ---
>  drivers/hwspinlock/qcom_hwspinlock.c | 32 ++++++++++++++++++++++------
>  1 file changed, 25 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/hwspinlock/qcom_hwspinlock.c b/drivers/hwspinlock/qcom_hwspinlock.c
> index 364710966665..23c913095bd0 100644
> --- a/drivers/hwspinlock/qcom_hwspinlock.c
> +++ b/drivers/hwspinlock/qcom_hwspinlock.c
> @@ -19,6 +19,11 @@
>  #define QCOM_MUTEX_APPS_PROC_ID        1
>  #define QCOM_MUTEX_NUM_LOCKS   32
>
> +struct qcom_hwspinlock_of_data {
> +       u32 offset;
> +       u32 stride;
> +};
> +
>  static int qcom_hwspinlock_trylock(struct hwspinlock *lock)
>  {
>         struct regmap_field *field = lock->priv;
> @@ -63,9 +68,20 @@ static const struct hwspinlock_ops qcom_hwspinlock_ops = {
>         .unlock         = qcom_hwspinlock_unlock,
>  };
>
> +static const struct qcom_hwspinlock_of_data of_sfpb_mutex = {
> +       .offset = 0x4,
> +       .stride = 0x4,
> +};
> +
> +/* All modern platform has offset 0 and stride of 4k */
> +static const struct qcom_hwspinlock_of_data of_tcsr_mutex = {
> +       .offset = 0,
> +       .stride = 0x1000,
> +};
> +
>  static const struct of_device_id qcom_hwspinlock_of_match[] = {
> -       { .compatible = "qcom,sfpb-mutex" },
> -       { .compatible = "qcom,tcsr-mutex" },
> +       { .compatible = "qcom,sfpb-mutex", .data = &of_sfpb_mutex },
> +       { .compatible = "qcom,tcsr-mutex", .data = &of_tcsr_mutex },
>         { }
>  };
>  MODULE_DEVICE_TABLE(of, qcom_hwspinlock_of_match);
> @@ -101,7 +117,7 @@ static struct regmap *qcom_hwspinlock_probe_syscon(struct platform_device *pdev,
>         return regmap;
>  }
>
> -static const struct regmap_config tcsr_mutex_config = {
> +static const struct regmap_config qcom_hwspinlock_mmio_config = {
>         .reg_bits               = 32,
>         .reg_stride             = 4,
>         .val_bits               = 32,
> @@ -112,18 +128,20 @@ static const struct regmap_config tcsr_mutex_config = {
>  static struct regmap *qcom_hwspinlock_probe_mmio(struct platform_device *pdev,
>                                                  u32 *offset, u32 *stride)
>  {
> +       const struct qcom_hwspinlock_of_data *data;
>         struct device *dev = &pdev->dev;
>         void __iomem *base;
>
> -       /* All modern platform has offset 0 and stride of 4k */
> -       *offset = 0;
> -       *stride = 0x1000;
> +       data = of_device_get_match_data(dev);

Nit: better to validate the return value though this is a rare case.

if (!data)
         return -ENODEV;

Otherwise LGTM.

Reviewed-by: Baolin Wang <baolin.wang7@...il.com>

-- 
Baolin Wang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ