• Geert Uytterhoeven's avatar
    crypto: ccree - fix debugfs register access while suspended · f5f7e1a0
    Geert Uytterhoeven authored
    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: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
    Acked-by: default avatarGilad Ben-Yossef <gilad@benyossef.com>
    Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    Reviewed-by: default avatarNiklas Söderlund <niklas.soderlund@ragnatech.se>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    f5f7e1a0
cc_debugfs.c 2.92 KB