Commit Graph

77 Commits

Author SHA1 Message Date
qctecmdr
ccd2f268a7 Merge "mm-drivers: hw_fence: add support for multiple ipe and vpu clients" 2023-03-13 18:27:01 -07:00
Grace An
88f51cfe04 mm-drivers: hw_fence: add support for multiple ipe and vpu clients
Add support for signal-based reservation of hw fence client ids for
ipe and vpu clients.

Change-Id: I4e4a835424756c6e5fa8d5c2d340dfadc4d11541
Signed-off-by: Grace An <quic_gracan@quicinc.com>
2023-03-06 09:09:56 -08:00
Grace An
41b11c1d09 mm-drivers: hw_fence: add implementation of translation to synx API
Add implementation to translate the msm_hw_fence API into synx API.

Change-Id: I5d0b7afcc297a4e3c8ec4ed9867831b5d2dfc3af
Signed-off-by: Grace An <quic_gracan@quicinc.com>
2023-03-03 16:07:10 -08:00
Grace An
5eec9ba76c mm-drivers: hw_fence: add header file for translation to synx api
Add header file for synx translation layer in hwfence driver.

Change-Id: Ie0ec426292cda180159d8572a3ace474804d3af5
Signed-off-by: Grace An <quic_gracan@quicinc.com>
2023-03-03 15:50:20 -08:00
qctecmdr
0e2a053012 Merge "mm-drivers: hw_fence: fix ioctl support for ipcc signaling" 2023-02-23 00:22:34 -08:00
qctecmdr
7d2c8417aa Merge "mm-drivers: hw_fence: trigger signal for validation signaled fences" 2023-02-23 00:22:34 -08:00
Grace An
4e5524c85f mm-drivers: hw_fence: trigger signal for validation signaled fences
When validation clients register to wait on already signaled fences,
the hw fence driver must signal the client wait and wake up waiting
validation clients.

Change-Id: I3e0f7abfbb055d8e5fbb5afd5fc8b88991c95aee
Signed-off-by: Grace An <quic_gracan@quicinc.com>
2023-02-16 14:43:06 -08:00
Grace An
90268c94ab mm-driver: hw_fence: resolve compilation failure with data types
Latest update to qcom_scm_assign_mem API changed input data types.
Change data types in HW Fence Driver to ensure compatibility with
newest API.

Change-Id: Ia25bb9e129cf67ec99e18c60407ac997cf0d6e3f
Signed-off-by: Grace An <quic_gracan@quicinc.com>
2023-02-15 08:57:35 -08:00
Grace An
e443a11c83 mm-drivers: hw_fence: fix ioctl support for ipcc signaling
Currently, the ioctl to trigger ipcc signals uses the client virtual id
as the tx client and the client physical id as the rx client. This
should be reversed to correctly perform ipcc signaling.

Change-Id: I61e7ec0e4bfd63f2d7e1cd1dd4e62dd4f6a82143
Signed-off-by: Grace An <quic_gracan@quicinc.com>
2023-02-13 13:57:40 -08:00
qctecmdr
e0d65b7cca Merge "mm-drivers: hw_fence: reset queues during client reset" 2023-01-24 15:43:49 -08:00
qctecmdr
a63269b7e0 Merge "mm-drivers: hw_fence: switch to qcom_scm_assign_mem from hyp_assign_phys" 2023-01-24 15:43:49 -08:00
qctecmdr
121ee6c421 Merge "mm-drivers: hw_fence: silently fail registration when feature disabled" 2023-01-24 15:43:49 -08:00
Ingrid Gallardo
0219a76630 mm-drivers: hw_fence: silently fail registration when feature disabled
Current hw-fencing feature is disabled by default through kernel command line
argument, therefore it is expected that clients receive an error when trying
to register a client while feature is disabled.
This change silence any print error messages during the clients registration
when feature is disabled.

Change-Id: Ie57adb52a975f9541e485039a582407cf21c11cd
Signed-off-by: Ingrid Gallardo <quic_ingridg@quicinc.com>
2023-01-24 11:07:49 -08:00
Grace An
1db6867762 mm-drivers: hw_fence: change memory mapping of hwfence shared memory
Currently, carved-out memory region is mapped as IO. Change mapping
to normal memory.

Change-Id: I1eca1067e30e2a6e39969c003dcce9ea0f9c47fd
Signed-off-by: Grace An <quic_gracan@quicinc.com>
2023-01-20 02:37:24 -08:00
Grace An
4f59f5ce02 mm-drivers: hw_fence: switch to qcom_scm_assign_mem from hyp_assign_phys
Switch to upstream friendly qcom_scm_assign_mem from hyp_assign_phys.

Change-Id: I01c6b93698fea094cf89926f3168466ba14061bc
Signed-off-by: Grace An <quic_gracan@quicinc.com>
2023-01-20 02:37:17 -08:00
Ingrid Gallardo
13b4e1270c mm-drivers: hw_fence: reset queues during client reset
This change make sure that the write_idx and read_idx
of the client hfi queues are reset during the call
to msm_hw_fence_reset_client.

Change-Id: Iaf94865ddf78ed8e19de509e3ee6176d03c5301c
Signed-off-by: Ingrid Gallardo <quic_ingridg@quicinc.com>
2023-01-18 16:27:28 -08:00
Grace An
bb0f9e965f mm-drivers: hw_fence: share hw fence driver mem pool always
When hw fencing is disabled via kernel command line argument, allow
probing of hw fence driver and perform memory sharing during probe. This
ensures that the carved out memory region for hw fences is always shared
with hypervisor regardless of hw-fencing feature enablement.

Change-Id: I7723fd61860e0d6b8dc374a054c8519d98d700a6
Signed-off-by: Grace An <quic_gracan@quicinc.com>
2023-01-13 09:44:02 -08:00
qctecmdr
55082654a9 Merge "mm-drivers: hw_fence: update ipc protocol to fence for pineapple" 2022-12-21 11:14:55 -08:00
Grace An
fbde79b118 mm-drivers: hw-fence: extend ioctl support to create fence_array
Current HW Fence validation framework limits the creation of a HW Fence-
array to fences from a single parent client. This change adds support to
hw_fence_create_array IOCTL so a HW fence-array can be created from fences
of different clients.

Change-Id: I6ce801f51747fcab503fc23c1ae981b107d4f315
Signed-off-by: Grace An <quic_gracan@quicinc.com>
2022-12-21 07:36:06 -08:00
Grace An
e0bf897e1f mm-drivers: hw_fence: update ipc protocol to fence for pineapple
Starting pineapple, fence protocol is used for hw fence driver.

Change-Id: I87435128c22aeb338dfcda38f0196e04dc9eb70b
Signed-off-by: Grace An <quic_gracan@quicinc.com>
2022-12-19 11:12:42 -08:00
Grace An
f4afac60ba mm-drivers: hw_fence: update txq to use separate software wr ptr
Some hw fence driver clients require the ability to call the
'msm_hw_fence_update_txq' API to update the queue payload without
updating the 'write_index' member within the hfi header. These clients
also need to receive the index at which the payload is written within
the queue.

This change adds support for this requirement by adding a device-tree
property to configure this behavior for each client. The 'tx_wm' member
within the hfi header is used to track in software the place where the
payloads are within the queue for clients that skip the update to the
'write_index' member.

Change-Id: I2881fa49bef4e49691eb6049830f9dc8dc8fa425
Signed-off-by: Grace An <quic_gracan@quicinc.com>
2022-12-05 09:15:07 -08:00
Grace An
965d398c06 mm-drivers: hw_fence: update ipc for ipe, vpu, ife clients
Update ipc configurations to support IPE, VPU, and IFE clients
in hw fence driver. Add support for IPE and VPU clients on
kalama, and add support for all clients on pineaple.

Change-Id: Iee577118284a02bd5b368ca206e88ed75eaa95b3
Signed-off-by: Grace An <quic_gracan@quicinc.com>
2022-12-05 09:14:58 -08:00
Grace An
368ae72991 mm-drivers: hw_fence: add support for ipe, vpu, and ife clients
Update hw fence driver to support new clients with large number
of possible sub-clients, which can be configured in device-tree.
Add client queues support for ipe, vpu, and ife clients.

Change-Id: I6e274819c1c154af3ea977d1d09e419d86f6fe8e
Signed-off-by: Grace An <quic_gracan@quicinc.com>
2022-12-05 09:14:28 -08:00
Grace An
b2efa8bc8b mm-drivers: hw_fence: add dtsi-based allocation of client queues
Update hw fence driver to support configurable parameters for
each client type, which can be set up through device-tree. This
allows configuring number of queues (e.g. only Tx Queue or both
Rx and Tx Queues), number of entries per client queue, and number
of sub-clients for each client-type.

Change-Id: I2d8f84ff2b7eb5322f9ca661cfd8f6a291db7b38
Signed-off-by: Grace An <quic_gracan@quicinc.com>
2022-12-04 17:12:02 -08:00
qctecmdr
83808f0957 Merge "mm-drivers: hw_fence: add support for 64-bit client_data" 2022-12-02 13:23:06 -08:00
Grace An
b09b4f0720 mm-drivers: hw_fence: add support for 64-bit client_data
Add support of the option to pass a 64-bit client_data value to
the hw fence driver when a client registers as a waiting client
for a hardware fence. Then during fence signaling, this client_data
is returned to the client via the RxQ.

If no client_data is passed to the driver for the hw fence, then a
default value of zero is registered as the client_data.

Change-Id: I34cf3e50413639d53cbfa8251c98b9ff1d3cbf4a
Signed-off-by: Grace An <quic_gracan@quicinc.com>
2022-11-30 13:23:18 -08:00
Grace An
66c1c4f019 mm-drivers: hw_fence: update new APIs for synx compat support
Add new APIs to receive params client-id and handles of hw fences
to manage synx compat support.

Change-Id: I5dae0845f8eb2c6c05cc2605d8fc93935c780901
Signed-off-by: Grace An <quic_gracan@quicinc.com>
2022-11-30 13:22:53 -08:00
Ingrid Gallardo
b87b258b9e mm-drivers: hw_fence: add debug refcount to trylock
Add debugfs to query the amount of times that
inter-vm trylock needs to wakeup the svm.

Change-Id: Ic1f88319f502e652902be0d45792768cf5c5154e
Signed-off-by: Ingrid Gallardo <quic_ingridg@quicinc.com>
2022-11-30 13:07:59 -08:00
Ingrid Gallardo
f5cc2eb42f mm-drivers: hw_fence: add check to avoid empty join hw fence
Current driver creates a join hw-fence from a fence-array, adds its
waiting client to it, and then it decides if signal the hw-fence
depending in the current state of all the child hw-fences from the
fence array.

However, if by any reason the fence-array gets all its children cleared
within it (which can happen for spec-fences failures), hw-fence driver
logic won't signal the new created join-fence.
This can lead to the creation of an empty or incomplete join-fence that
the waiting-client will be waiting-for, but won't be signaled.

Add a check to make sure that if above scenario is ever presented,
the register for wait API catches this issue and fails to register
for wait in this invalid fence.

Change-Id: If3c69405d2a3adfefd12f447257c2560b839d238
Signed-off-by: Ingrid Gallardo <quic_ingridg@quicinc.com>
2022-11-30 13:07:19 -08:00
Ingrid Gallardo
05689a41c3 mm-drivers: hw_fence: add inter-vm try lock
Add support for inter-vm try-lock between hlos and vm.

Change-Id: Iab9087acf82a4a746e9d43a736724ce2e7196237
Signed-off-by: Ingrid Gallardo <quic_ingridg@quicinc.com>
2022-11-30 13:06:10 -08:00
Ingrid Gallardo
ecef24aa62 mm-drivers: hw_fence: update ipc regs config to support phys-id
Starting pineapple, each ipc client has a different physical-id and
virtual-id for registers access and configuration.
This change updates the ipc to handle this different configuration.

Change-Id: I36fa84b07ffd209ce3fb323ff796f9e7721d7dd2
Signed-off-by: Ingrid Gallardo <quic_ingridg@quicinc.com>
2022-11-30 13:04:52 -08:00
Harshdeep Dhatt
54256aa9e0 mm-drivers: hw_fence: Fix join fence signaling
It is possible that one (or more) child fences get signaled by
fence controller, right after we add the join fence as parent
fence of the child fence. If so, the join fence pending child
count may become 0 which means we can safely signal the join
fence.

Change-Id: I0222b93a62db13eeb7867f3741c1db944df036b1
Signed-off-by: Harshdeep Dhatt <quic_hdhatt@quicinc.com>
2022-11-30 13:04:29 -08:00
Harshdeep Dhatt
fbea8f77fa mm-drivers: hw_fence: Set MSM_HW_FENCE_FLAG_SIGNALED_BIT flag
Set this flag if a hw fence (for which a client wants to wait) has already
been signaled. Clients can check this flag and indicate to their respective
hardware (or firmware) that this fence is already signaled.

Change-Id: I9337cabb771197f2d35ac4386402a25941d73311
Signed-off-by: Harshdeep Dhatt <quic_hdhatt@quicinc.com>
2022-11-30 13:04:11 -08:00
Harshdeep Dhatt
9ff114eee8 mm-drivers: hw_fence: Add per client ipc interrupt property
Not all clients need ipc interrupt for an already signaled fence. Set the
per client property based on whether a client needs the interrupt or not.
Also, set update_rxq property for GPU client to false, as GPU doesn't need
already signaled fences to be sent to GPU Rx Queue.

Change-Id: I08a6bbd598695b112124ce6ec409db75d5e11e0f
Signed-off-by: Harshdeep Dhatt <quic_hdhatt@quicinc.com>
2022-11-30 12:14:10 -08:00
Nilaan Gunabalachandran
d881744a72 mm-drivers: fix prink argument errors
This change fixes printk arguments in mm-drivers which is
found with additional compilation flags and add compile
flags too.

Change-Id: Ic83f044467dca6d391221182096b9c50b7da36de
Signed-off-by: Nilaan Gunabalachandran <quic_ngunabal@quicinc.com>
2022-11-08 16:57:31 -05:00
qctecmdr
90774e9372 Merge "mm-drivers: hw_fence: add missing return type" 2022-10-22 10:49:22 -07:00
Bruce Hoo
a5e17f3fa7 mm-drivers: spec_fence: create dummy spec_fence for fence array creation
Create dummy spec_fence and pass it to dma_fence_array_create(), to
avoid NULL pointer access in dma_fence_array_create().

Change-Id: I7a283753169cccbed6c842090a48cbb6e185cf9a
Signed-off-by: Bruce Hoo <quic_bingchua@quicinc.com>
2022-10-18 12:43:24 -07:00
qctecmdr
2437b5ab9c Merge "mm-drivers: hw_fence: remove client id mask registration logic" 2022-10-14 07:54:05 -07:00
Ingrid Gallardo
d62205ae1c mm-drivers: hw_fence: read qtimer for timestamps
Move timestamps to use qtimer instead of sleep timer.

Change-Id: I1a5f20c3d1ec31ba13e95713828024a309a53ba1
Signed-off-by: Ingrid Gallardo <quic_ingridg@quicinc.com>
2022-10-14 02:57:05 -07:00
Grace An
b13dcfb79e mm-drivers: hw_fence: remove client id mask registration logic
Remove client id bitmask to track registered clients. This
allows support of more than 64 transmit clients.

Change-Id: Ia2b4667d008bfceb0b46bfd3e14302e5bec82cb3
Signed-off-by: Grace An <quic_gracan@quicinc.com>
2022-10-14 02:56:53 -07:00
Alex Danila
877fea198c mm-drivers: hw_fence: add missing return type
Change addresses a compiler error for missing return type

Change-Id: I82f22cefef069988e60608210533250307e516b3
Signed-off-by: Alex Danila <quic_eadanila@quicinc.com>
2022-10-06 10:46:13 -04:00
Ashwin Pillai
674640bc0c Merge remote-tracking branch 'origin/display-kernel.lnx.5.15' into display-kernel.lnx.1.0
* origin/display-kernel.lnx.5.15:
  mm-drivers: configure max driver instances base on build config
  mm-drivers: hw_fence: avoid signal during reset for signaled hw fences
  mm-drivers: hw_fence: modify hw fence queue payload structure
  mm-drivers: hw-fence: fix static analysis issue
  mm-drivers: hw_fence: add bounds check for hw fence deregistration

Change-Id: I6ebfcde295704d218e015fdf1e7c0b1575c95a1e
Signed-off-by: Ashwin Pillai <quic_ashwpill@quicinc.com>
2022-09-09 13:59:38 -04:00
qctecmdr
cfdc62c704 Merge "mm-drivers: configure max driver instances base on build config" 2022-09-08 18:10:35 -07:00
Amine Najahi
51925b9f96 mm-drivers: configure max driver instances base on build config
Add #ifdef to configure the maximum allowed driver instances
base on the build configuration, to avoid uninitialized access
to fences array.

Change-Id: I83ea5ade33a93e23edee21a0435ed7257fe5c9c9
Signed-off-by: Amine Najahi <quic_anajahi@quicinc.com>
2022-09-01 14:36:24 -04:00
Ingrid Gallardo
f4e1ed2578 mm-drivers: hw_fence: avoid signal during reset for signaled hw fences
During a client reset, hw fences that are already signaled
should not require to be signaled again, otherwise waiting
clients can receive the signal from unexpected hw fences
that have been already signaled long time back.
Add check to only signal hw fences that are not in signaled
state during the client reset.

Change-Id: I6f6a6ba142889f9c7ee2bd8680c30592c3c0987f
Signed-off-by: Ingrid Gallardo <quic_ingridg@quicinc.com>
2022-08-31 13:41:50 -07:00
Grace An
99948e9714 mm-drivers: hw_fence: modify hw fence queue payload structure
Add size, type, version, and client_data fields to hw fence queue
payload and update 32-bit timestamp field to full 64-bit timestamp
field.

Change-Id: Iafb0eb80f83acd5753786fa50a31c1fb74f1a2fa
Signed-off-by: Grace An <quic_gracan@quicinc.com>
2022-08-18 11:36:34 -07:00
Ashwin Pillai
2e0acac216 Merge remote-tracking branch 'origin/display-kernel.lnx.5.15' into display-kernel.lnx.1.0
* origin/display-kernel.lnx.5.15:
  mm-drivers: hw_fence: add timestamp to the queue
  mm-drivers: add support for build.sh techpack display_tp
  mm-drivers: hw_fence: move mem barrier before mem read
  mm-drivers: spec_fence: increasing device_available
  mm-drivers: hw_fence: enable hw-fence driver based on cmdline var
  mm-drivers: sync: export sync_fence module symbols
  mm-drivers: hw-fence: add hardware fence driver validation ioctls
  mm-drivers: add support for compiling out mm driver modules
  mm-drivers: hw_fence: avoid hw fences creation until fctl ready
  mm-drivers: hw_fence: populate payload size in hfi header
  mm-drivers: hw_fence: avoid compiling hw_fence driver for taro
  mm-drivers: hw_fence: Add support for hw-fence driver
  mm-drivers: sync: resolve compilation of sync fence driver
  mm-drivers: sync: add api to wait for sync fence bind
  mm-drivers: sync-fence: add changes to serialize fence operations
  mm-drivers: sync_fence: avoid compiling spec_fence driver for taro
  mm-drivers: msm_ext_display: export msm-ext-display module symbols
  mm-drivers: enable mm-driver modules compilation
  mm-drivers: msm_ext_display: add snapshot
  mm-drivers: sync-fence: add sync fence driver snapshot

Change-Id: Id3fde6d894d2e73243c0a50aab018067431f211d
Signed-off-by: Ashwin Pillai <quic_ashwpill@quicinc.com>
2022-08-08 23:52:19 -04:00
qctecmdr
7b57595458 Merge "mm-drivers: hw-fence: fix static analysis issue" 2022-08-08 20:01:56 -07:00
Manoj Kumar AVM
f168780f74 mm-drivers: hw-fence: fix static analysis issue
Fix static analysis issue where uninitialized variable is being accessed.

Change-Id: Iab6210fb4c67f35c7f1bada592800c10f0ad76bc
Signed-off-by: Manoj Kumar AVM <quic_mkavm@quicinc.com>
2022-08-03 23:27:22 -07:00
Grace An
b30002d731 mm-drivers: hw_fence: add bounds check for hw fence deregistration
Ensure that clients deregister hardware fences for client ids
strictly less than HW_FENCE_CLIENT_MAX. This prevents out of bounds
array accesses.

Change-Id: I3453135cfd7a74373421d8db32c3ecb0fffc70d0
Signed-off-by: Grace An <quic_gracan@quicinc.com>
2022-08-01 16:22:19 -07:00