ANDROID: scsi: ufs: add complete init vendor hook

Currently the core UFS driver does not have a vops to notify when the
device is operational. This commit introduces a hook, which serves to
notify device completing initialization and is ready to accept I/O.

This is required by the FIPS140-2 [1] self integrity test of inline
encryption engine, which must run whenever the host controller is reset.
The code requires sleeping while waiting for I/O to complete and allocating
some memory dynamically, which requires the vendor hook to be restricted.

[1] https://csrc.nist.gov/publications/detail/fips/140/2/final

Bug: 185809932
Change-Id: I6f476f9c2e2b50574d2898c3f1ef6b648d92df24
(cherry picked from commit e774e4eca69ce8ab60df04b27f524b586ab74f17)
Signed-off-by: Konstantin Vyshetsky <vkon@google.com>
This commit is contained in:
Konstantin Vyshetsky
2021-08-25 15:42:09 -07:00
parent 273b99c30a
commit 86f6711a2d
3 changed files with 6 additions and 0 deletions

View File

@@ -130,6 +130,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_si_mem_available_adjust);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_si_meminfo_adjust);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_si_meminfo_adjust_shmem);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_fill_prdt);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_ufs_complete_init);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_ufs_reprogram_all_keys);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_prepare_command);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_update_sysfs);

View File

@@ -9072,6 +9072,7 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool init_dev_params)
ufshcd_write_ee_control(hba);
ufshcd_configure_auto_hibern8(hba);
trace_android_rvh_ufs_complete_init(hba);
out:
spin_lock_irqsave(hba->host->host_lock, flags);
if (ret)

View File

@@ -22,6 +22,10 @@ DECLARE_HOOK(android_vh_ufs_fill_prdt,
unsigned int segments, int *err),
TP_ARGS(hba, lrbp, segments, err));
DECLARE_RESTRICTED_HOOK(android_rvh_ufs_complete_init,
TP_PROTO(struct ufs_hba *hba),
TP_ARGS(hba), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_ufs_reprogram_all_keys,
TP_PROTO(struct ufs_hba *hba, int *err),
TP_ARGS(hba, err), 1);