Commit Graph

22 Commits

Author SHA1 Message Date
Amol Jadi
9ee78c53ae ubwcp: rate limit error prints
Rate limit error messages to avoid flooding logs and
trigger watchdog.

Change-Id: I8584ec441586d7516b3049f12d353b0d674d4453
Signed-off-by: Amol Jadi <quic_ajadi@quicinc.com>
2023-05-30 10:44:19 -07:00
Amol Jadi
1b191f12dc ubwcp: incorrect return of ubwcp buf when dmabuf match is not found
When dmabuf does not exists in our record, we were matching it
to the last ubwcp buf instead of returning NULL. Also fixed
incorrect state check for hw ver call.

Change-Id: If899bab884a049dcbb8a9acd45a706d10e6d77d4
Signed-off-by: Amol Jadi <quic_ajadi@quicinc.com>
2023-05-29 14:52:19 -07:00
Amol Jadi
ec0aef5211 ubwcp: do not ignore buf size calculation failure
Failure to look up plane information during size calculatin
was returning size of 0. Instead return error and let the caller
handle error. This removes need for warn calls and communicates error
up the caller.

Change-Id: Ie147e20a64077fe586c7cd29ce91fe9dfe22a96c
Signed-off-by: Amol Jadi <quic_ajadi@quicinc.com>
2023-05-29 14:51:43 -07:00
Amol Jadi
1a1a0adee1 ubwcp: refactor code to reduce warn prints and robust error handling
Conversion between ioctl/internal/hw image formats is made consistent and
eliminated need for warn calls. Ioctl handling is broken down into
multiple functions.

Change-Id: Ic2786466f5dd7d6b2a380e030f8e04ead67dfe8c
Signed-off-by: Amol Jadi <quic_ajadi@quicinc.com>
2023-05-29 14:50:56 -07:00
Amol Jadi
4ea2f22f83 ubwcp: override reg and other cleanup
Removed writing to override reg as default value is the same.
Use defines for hardcoded attribute limit values.

Change-Id: Ief67b048d5f94eeb260476e6c8aba5a5bf346436
Signed-off-by: Amol Jadi <quic_ajadi@quicinc.com>
2023-05-29 14:47:35 -07:00
Amol Jadi
10ba8e9e40 ubwcp: dma direction update
Always invalidate on lock (even for write). This ensures that partial tile
writes will not overwrite buffer with dummy data from previously prefetched lines.
On subsequent lock calls, in case of write, update direction to bi_directional.
This way buffer will get flushed during unlock.

Change-Id: If3f1deffefe14af1dbdb2dae0a77b25106d35e5c
Signed-off-by: Amol Jadi <quic_ajadi@quicinc.com>
2023-05-29 14:46:48 -07:00
Amol Jadi
90d7328dda ubwcp: fix for width and stride comparison
Width passed in to validation logic is in pixels and was
compared to stride in bytes. Updated to first convert width to
bytes before comparison.

Change-Id: Idef3d7d4e79109c556f083c9b95629d77f4717fc
Signed-off-by: Amol Jadi <quic_ajadi@quicinc.com>
2023-05-29 14:44:37 -07:00
Amol Jadi
01e22caa56 ubwcp: misc cleanup
Removed unused scm calls.
Copy to userspace only on successful hw version call.
Cleanup during probe failure.
During driver removal, update regs only if power ON was successful.

Change-Id: I7acc165bdb80b32e377c7c5704fa3863a3819b39
Signed-off-by: Amol Jadi <quic_ajadi@quicinc.com>
2023-05-29 14:42:26 -07:00
Amol Jadi
21aed34bbd ubwcp: free path cleanup
Unlock before free.
Keep dmabuf ref until complete processing is done during set attr.

Change-Id: Idf0739bc9571cba91add8299f7b27f9a7c51e819
Signed-off-by: Amol Jadi <quic_ajadi@quicinc.com>
2023-05-26 13:15:31 -07:00
Amol Jadi
cce20f5e49 ubwcp: set attribute path cleanup
Ensure buffer size is sufficient during re-configuration.
Ensure unused ioctl values are set to 0.
Fix use of uninitialized value when only plane-1 data is present.
Register mmap ula pa only if ubwcp configuration is successful.
Clarify failure handling of set attribute call.
Cleanup related code.

Change-Id: Ia6ac54e13aa2be1c4a1dc2d4b4a7715dad3aa142
Signed-off-by: Amol Jadi <quic_ajadi@quicinc.com>
2023-05-03 10:42:07 -07:00
Amol Jadi
ff5feb8adc ubwcp: cleanup buffer lock tracking
Replaced use of locked with lock_count.

Change-Id: I5a963850b79ed425cc2eeee5e94cb44104cdccc3
Signed-off-by: Amol Jadi <quic_ajadi@quicinc.com>
2023-05-03 10:40:34 -07:00
Amol Jadi
1d12729839 ubwcp: update failure handling
Put driver in fault state on critical failures.
Other minor cleanup.

Change-Id: I79154178ae57fe12a3ef87b51626fd420ccb55c0
Signed-off-by: Amol Jadi <quic_ajadi@quicinc.com>
2023-04-24 16:05:34 -07:00
qctecmdr
d310882b06 Merge "ubwcp: limit error logs" 2023-04-11 08:10:24 -07:00
Amol Jadi
d9bea7f7f4 ubwcp: limit error logs
Enable read & decode irq only for debug.
Rate limit error logs.

Change-Id: I782d5af9049bdb501d14f3cbc6a7f868d49da581
Signed-off-by: Amol Jadi <quic_ajadi@quicinc.com>
2023-04-07 14:14:24 -07:00
Liam Mark
3c0b9be4c9 ubwcp: Replace add_memory with memremap_pages
Replace add_memory with memremap_pages as that will ensure that
ULA PA pages are not added to buddy.

Change-Id: I66dd4c533011f9e7ed4ed45697216ba947a4e3a3
Signed-off-by: Liam Mark <quic_lmark@quicinc.com>
2023-04-07 13:17:49 -07:00
Amol Jadi
7049c53fc2 ubwcp: ioctl for stride alignment and bytes per pixels
Implements stride alignment and stride validate IOCTL.
Additional checks on stride value.
Fixes spell error in ioctl interface.

Change-Id: Ic4a41a12e2ffa8d45fd71938133accd069dff863
Signed-off-by: Amol Jadi <quic_ajadi@quicinc.com>
2023-03-28 16:11:50 -07:00
Liam Mark
14742c1cfb ubwcp: optimize power and mem offline perf
Optimize the UBWC-P driver for power by ensuring that UBWC-P is only
powered up when there is a non-linear UBWC-P buffer allocated.

Optimize the performance of the memory offlining by
adding support for the CMO component to be interrupted by the
allocation of a new UBWC-P buffer.

Change-Id: Ib473c00b996782131799fd223eaf1ad7feca058b
Signed-off-by: Liam Mark <quic_lmark@quicinc.com>
2023-03-28 09:54:00 -07:00
Liam Mark
b5312c5129 ubwcp: Set ULA PA range size from DT
Use the UBWC-P ula_range DT property to configure the
UBWC-P ULA PA range size.

Change-Id: I46579146904f76160c0f984d8e377e8d28a56dd7
Signed-off-by: Liam Mark <quic_lmark@quicinc.com>
2023-03-28 09:53:32 -07:00
Liam Mark
fcb70f9328 ubwcp: add ftrace support
Add ftrace support to help with performance
measurements.

Change-Id: I21f762a9e25b2b745fbf4f72990c9932f823634b
Signed-off-by: Liam Mark <quic_lmark@quicinc.com>
2023-03-22 16:25:49 -07:00
Liam Mark
bc6e2ce23d ubwcp: Re-map as uncached and invalidate
Re-map ULA PA as uncached and invalidate before power
collapse.

Change-Id: Ice676b98a472512c0be1ad83b5b592fec079e7ee
Signed-off-by: Liam Mark <quic_lmark@quicinc.com>
2023-02-02 16:19:42 -08:00
Liam Mark
7a0417fe15 Revert "ubwcp: Keep UBWC-P powered on after buffer alloc"
This reverts commit ff2498ad42.

No longer needed now that we are doing CMOs with an
un-cached mapping.

Change-Id: I927b93aaf869755a9fe36e77a24874e5b83a331d
Signed-off-by: Liam Mark <quic_lmark@quicinc.com>
2023-02-02 16:18:10 -08:00
Amol Jadi
47907f98a1 ubwcp: bazel support
Add support for bazel build system

Change-Id: I9ec76c8341d7d1c909725016c0387beb13302570
Signed-off-by: Amol Jadi <quic_ajadi@quicinc.com>
2023-02-01 18:15:28 -08:00