bus: mhi: host: Read PK HASH dynamically
authorJeffrey Hugo <quic_jhugo@quicinc.com>
Fri, 5 Jan 2024 17:42:53 +0000 (10:42 -0700)
committerManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Tue, 30 Jan 2024 18:22:42 +0000 (23:52 +0530)
commit8ddf54a32111f6dbe06cd318af443c6545a6c037
treeb7df093c2ac5a4c1f9638ee71ac4a5b15f775af9
parentbce3f770684cc1d91ff9edab431b71ac991faf29
bus: mhi: host: Read PK HASH dynamically

The OEM PK HASH registers in the BHI region are read once during firmware
load (boot), cached, and displayed on demand via sysfs. This has a few
problems - if firmware load is skipped, the registers will not be read and
if the register values change over the life of the device the local cache
will be out of sync.

Qualcomm Cloud AI 100 can expose both these problems. It is possible for
mhi_async_power_up() to be invoked while the device is in AMSS EE, which
would bypass firmware loading. Also, Qualcomm Cloud AI 100 has 5 PK HASH
slots which can be dynamically provisioned while the device is active,
which would result in the values changing and users may want to know what
keys are active.

Address these concerns by reading the PK HASH registers on-demand during
the sysfs read. This will result in showing the most current information.

Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Reviewed-by: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20240105174253.863388-1-quic_jhugo@quicinc.com
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
drivers/bus/mhi/host/boot.c
drivers/bus/mhi/host/init.c
include/linux/mhi.h