From: Gilad Ben-Yossef <gilad@benyossef.com>
To: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S . Miller" <davem@davemloft.net>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>,
Felipe Balbi <balbi@kernel.org>,
Alan Stern <stern@rowland.harvard.edu>,
Thierry Reding <thierry.reding@gmail.com>,
Jonathan Hunter <jonathanh@nvidia.com>,
Mathias Nyman <mathias.nyman@intel.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Chunfeng Yun <chunfeng.yun@mediatek.com>, Bin Liu <b-liu@ti.com>,
Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
"open list:THERMAL" <linux-pm@vger.kernel.org>,
Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
linux-usb@vger.kernel.org,
Linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] crypto: ccree - fix debugfs register access while suspended
Date: Sun, 26 Jan 2020 15:32:50 +0200 [thread overview]
Message-ID: <CAOtvUMdA2aD9DJBmSpOJOFRw=1_9OcaG4Y915q5L7dgo7n7HTA@mail.gmail.com> (raw)
In-Reply-To: <20200124132957.15769-3-geert+renesas@glider.be>
On Fri, Jan 24, 2020 at 3:30 PM Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
>
> Reading the debugfs files under /sys/kernel/debug/ccree/ can be done by
> the user at any time. On R-Car SoCs, the CCREE device is power-managed
> using a moduile clock, and if this clock is not running, bogus register
> values may be read.
>
> Fix this by filling in the debugfs_regset32.dev field, so debugfs will
> make sure the device is resumed while its registers are being read.
>
> This fixes the bogus values (0x00000260) in the register dumps on R-Car
> H3 ES1.0:
>
> -e6601000.crypto/regs:HOST_IRR = 0x00000260
> -e6601000.crypto/regs:HOST_POWER_DOWN_EN = 0x00000260
> +e6601000.crypto/regs:HOST_IRR = 0x00000038
> +e6601000.crypto/regs:HOST_POWER_DOWN_EN = 0x00000038
> e6601000.crypto/regs:AXIM_MON_ERR = 0x00000000
> e6601000.crypto/regs:DSCRPTR_QUEUE_CONTENT = 0x000002aa
> -e6601000.crypto/regs:HOST_IMR = 0x00000260
> +e6601000.crypto/regs:HOST_IMR = 0x017ffeff
> e6601000.crypto/regs:AXIM_CFG = 0x001f0007
> e6601000.crypto/regs:AXIM_CACHE_PARAMS = 0x00000000
> -e6601000.crypto/regs:GPR_HOST = 0x00000260
> +e6601000.crypto/regs:GPR_HOST = 0x017ffeff
> e6601000.crypto/regs:AXIM_MON_COMP = 0x00000000
> -e6601000.crypto/version:SIGNATURE = 0x00000260
> -e6601000.crypto/version:VERSION = 0x00000260
> +e6601000.crypto/version:SIGNATURE = 0xdcc63000
> +e6601000.crypto/version:VERSION = 0xaf400001
>
> Note that this behavior is system-dependent, and the issue does not show
> up on all R-Car Gen3 SoCs and boards. Even when the device is
> suspended, the module clock may be left enabled, if configured by the
> firmware for Secure Mode, or when controlled by the Real-Time Core.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> drivers/crypto/ccree/cc_debugfs.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/crypto/ccree/cc_debugfs.c b/drivers/crypto/ccree/cc_debugfs.c
> index 5669997386988055..35f3a2137502bd96 100644
> --- a/drivers/crypto/ccree/cc_debugfs.c
> +++ b/drivers/crypto/ccree/cc_debugfs.c
> @@ -81,6 +81,7 @@ int cc_debugfs_init(struct cc_drvdata *drvdata)
> regset->regs = debug_regs;
> regset->nregs = ARRAY_SIZE(debug_regs);
> regset->base = drvdata->cc_base;
> + regset->dev = dev;
>
> ctx->dir = debugfs_create_dir(drvdata->plat_dev->name, cc_debugfs_dir);
>
> @@ -102,6 +103,7 @@ int cc_debugfs_init(struct cc_drvdata *drvdata)
> verset->nregs = ARRAY_SIZE(pid_cid_regs);
> }
> verset->base = drvdata->cc_base;
> + verset->dev = dev;
>
> debugfs_create_regset32("version", 0400, ctx->dir, verset);
>
> --
> 2.17.1
>
Acked-by: Gilad Ben-Yossef <gilad@benyossef.com>
Thanks,
Gilad
--
Gilad Ben-Yossef
Chief Coffee Drinker
values of β will give rise to dom!
next prev parent reply other threads:[~2020-01-26 13:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-24 13:29 [PATCH 0/2] Fix debugfs register access while suspended Geert Uytterhoeven
2020-01-24 13:29 ` [PATCH 1/2] debugfs: regset32: Add Runtime PM support Geert Uytterhoeven
2020-01-31 10:13 ` Rafael J. Wysocki
2020-02-10 19:01 ` Greg Kroah-Hartman
2020-01-24 13:29 ` [PATCH 2/2] crypto: ccree - fix debugfs register access while suspended Geert Uytterhoeven
2020-01-26 13:32 ` Gilad Ben-Yossef [this message]
2020-01-31 10:11 ` Rafael J. Wysocki
2020-01-24 16:24 ` [PATCH 0/2] Fix " Niklas Söderlund
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAOtvUMdA2aD9DJBmSpOJOFRw=1_9OcaG4Y915q5L7dgo7n7HTA@mail.gmail.com' \
--to=gilad@benyossef.com \
--cc=b-liu@ti.com \
--cc=balbi@kernel.org \
--cc=chunfeng.yun@mediatek.com \
--cc=davem@davemloft.net \
--cc=geert+renesas@glider.be \
--cc=gregkh@linuxfoundation.org \
--cc=herbert@gondor.apana.org.au \
--cc=jonathanh@nvidia.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=matthias.bgg@gmail.com \
--cc=rafael@kernel.org \
--cc=robdclark@gmail.com \
--cc=sean@poorly.run \
--cc=stern@rowland.harvard.edu \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).