[PATCHv5 0/3] QCOM smmu-500 wait-for-safe handling for sdm845
From: Sai Prakash Ranjan
Date: Sun Sep 15 2019 - 08:35:57 EST
Previous version of the patches are at :
QCOM's implementation of smmu-500 on sdm845 adds a hardware logic called
wait-for-safe. This logic helps in meeting the invalidation requirements
from 'real-time clients', such as display and camera. This wait-for-safe
logic ensures that the invalidations happen after getting an ack from these
In this patch-series we are disabling this wait-for-safe logic from the
arm-smmu driver's probe as with this enabled the hardware tries to
throttle invalidations from 'non-real-time clients', such as USB and UFS.
For detailed information please refer to patch [3/4] in this series.
I have included the device tree patch too in this series for someone who
would like to test out this. Here's a branch  that gets display on MTP
This patch series is inspired from downstream work to handle under-performance
issues on real-time clients on sdm845. In downstream we add separate page table
ops to handle TLB maintenance and toggle wait-for-safe in tlb_sync call so that
achieve required performance for display and camera [3, 4].
Changes since v4:
* Addressed Stephen's comments.
* Moved QCOM specific implementation to arm-smmu-qcom.c as per Robin's suggestion.
Changes since v3:
* Based on arm-smmu implementation cleanup series  by Robin Murphy which is
already merged in Will's tree .
* Implemented the sdm845 specific reset hook which does arm_smmu_device_reset()
followed by making SCM call to disable the wait-for-safe logic.
* Removed depedency for SCM call on any dt flag. We invariably try to disable
the wait-for-safe logic on sdm845. The platforms such as mtp845, and db845
that implement handlers for this particular SCM call should be able disable
Other platforms such as cheza don't enable the wait-for-safe logic at all
from their bootloaders. So there's no need to disable the same.
* No change in SCM call patches 1 & 2.
Changes since v2:
* Dropped the patch to add atomic io_read/write scm API.
* Removed support for any separate page table ops to handle wait-for-safe.
Currently just disabling this wait-for-safe logic from arm_smmu_device_probe()
to achieve performance on USB/UFS on sdm845.
* Added a device tree patch to add smmu option for fw-implemented support
for SCM call to take care of SAFE toggling.
Changes since v1:
* Addressed Will and Robin's comments:
- Dropped the patch that forked out __arm_smmu_tlb_inv_range_nosync(),
- Cleaned up the errata patch further to use downstream polling mechanism
for tlb sync.
* No change in SCM call patches - patches 1 to 3.
Vivek Gautam (3):
firmware: qcom_scm-64: Add atomic version of qcom_scm_call
firmware/qcom_scm: Add scm call to handle smmu errata
iommu: arm-smmu-impl: Add sdm845 implementation hook
drivers/firmware/qcom_scm-32.c | 5 ++
drivers/firmware/qcom_scm-64.c | 152 +++++++++++++++++++++++----------
drivers/firmware/qcom_scm.c | 6 ++
drivers/firmware/qcom_scm.h | 5 ++
drivers/iommu/Makefile | 2 +-
drivers/iommu/arm-smmu-impl.c | 7 +-
drivers/iommu/arm-smmu-qcom.c | 32 +++++++
drivers/iommu/arm-smmu-qcom.h | 11 +++
drivers/iommu/arm-smmu.h | 2 +
include/linux/qcom_scm.h | 2 +
10 files changed, 177 insertions(+), 47 deletions(-)
create mode 100644 drivers/iommu/arm-smmu-qcom.c
create mode 100644 drivers/iommu/arm-smmu-qcom.h
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation