diff options
author | Meghana Barkalle <mbarkalle@google.com> | 2023-05-26 18:51:04 +0000 |
---|---|---|
committer | Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> | 2023-12-13 16:36:31 +0000 |
commit | f19cb07883168222eb00a943eca336ca3c4cc215 (patch) | |
tree | 054a963b49a1157eb5ada115006bad8140c89dd1 | |
parent | 6ecc790fc1dd27005491b475dc01415e51c366b8 (diff) | |
download | lwis-f19cb07883168222eb00a943eca336ca3c4cc215.tar.gz |
LWIS: Update read buffer pointer
While executing the remaining transaction based
on the transaction process limit, there is a need
to save the location where the read buffer should
be updated in the response.
Queue the work on the tranaction/I2C worker thread
again if there are any pending entries to be
processed further.
Bug: 299130975
Test: GCA Smoke Test, verified with LDAF changes
Change-Id: I1054318a028e487f94a4f667c589cedb3e4b8e71
(cherry picked from commit 40ef72b8bbc70e4b0942a9c4d2e63ae90dbdf4a1)
Signed-off-by: Meghana Barkalle <mbarkalle@google.com>
-rw-r--r-- | lwis_ioctl.c | 1 | ||||
-rw-r--r-- | lwis_transaction.c | 30 | ||||
-rw-r--r-- | lwis_transaction.h | 5 |
3 files changed, 35 insertions, 1 deletions
diff --git a/lwis_ioctl.c b/lwis_ioctl.c index 5a2ce64..9cbb72d 100644 --- a/lwis_ioctl.c +++ b/lwis_ioctl.c @@ -1203,6 +1203,7 @@ static int construct_transaction_from_cmd(struct lwis_client *client, uint32_t c k_transaction->resp = NULL; k_transaction->is_weak_transaction = false; k_transaction->remaining_entries_to_process = k_transaction->info.num_io_entries; + k_transaction->starting_read_buf = NULL; INIT_LIST_HEAD(&k_transaction->event_list_node); INIT_LIST_HEAD(&k_transaction->process_queue_node); INIT_LIST_HEAD(&k_transaction->completion_fence_list); diff --git a/lwis_transaction.c b/lwis_transaction.c index f10bde9..43a2ce7 100644 --- a/lwis_transaction.c +++ b/lwis_transaction.c @@ -24,10 +24,10 @@ #include "lwis_device.h" #include "lwis_event.h" #include "lwis_fence.h" +#include "lwis_i2c_bus_manager.h" #include "lwis_io_entry.h" #include "lwis_ioreg.h" #include "lwis_util.h" -#include "lwis_i2c_bus_manager.h" #define CREATE_TRACE_POINTS #include "lwis_trace.h" @@ -149,6 +149,9 @@ void lwis_transaction_free(struct lwis_device *lwis_dev, struct lwis_transaction } } lwis_allocator_free(lwis_dev, transaction->info.io_entries); + + transaction->starting_read_buf = NULL; + if (transaction->resp) { kfree(transaction->resp); } @@ -211,8 +214,17 @@ static int process_transaction(struct lwis_client *client, struct lwis_transacti resp_size = sizeof(struct lwis_transaction_response_header) + resp->results_size_bytes; read_buf = (uint8_t *)resp + sizeof(struct lwis_transaction_response_header); + resp->completion_index = -1; + /* + * If the starting read buffer pointer is not null then use this cached location to correctly + * set the read buffer for the current transaction processing run. + */ + if (transaction->starting_read_buf) { + read_buf = transaction->starting_read_buf; + } + /* Use write memory barrier at the beginning of I/O entries if the access protocol * allows it */ if (lwis_dev->vops.register_io_barrier != NULL) { @@ -367,6 +379,7 @@ static int process_transaction(struct lwis_client *client, struct lwis_transacti * in the transaction. */ spin_lock_irqsave(&client->transaction_lock, flags); + transaction->starting_read_buf = read_buf; transaction->remaining_entries_to_process = remaining_entries_to_be_processed; spin_unlock_irqrestore(&client->transaction_lock, flags); return ret; @@ -471,6 +484,8 @@ void lwis_process_transactions_in_queue(struct lwis_client *client) struct list_head pending_events; struct list_head pending_fences; struct lwis_transaction *transaction; + struct lwis_device *lwis_dev = client->lwis_dev; + struct lwis_i2c_bus_manager *i2c_bus_manager = lwis_i2c_bus_manager_get_manager(lwis_dev); INIT_LIST_HEAD(&pending_events); INIT_LIST_HEAD(&pending_fences); @@ -504,6 +519,18 @@ void lwis_process_transactions_in_queue(struct lwis_client *client) client->lwis_dev->dev, "Transaction processing limit reached, remaining entries to process %d\n", transaction->remaining_entries_to_process); + + /* + * Queue the remaining transaction again on the transaction worker/bus maanger worker + * to be processed again later + */ + if (i2c_bus_manager) { + kthread_queue_work(&i2c_bus_manager->i2c_bus_worker, + &client->i2c_work); + } else { + kthread_queue_work(&client->lwis_dev->transaction_worker, + &client->transaction_work); + } break; } } @@ -919,6 +946,7 @@ new_repeating_transaction_iteration(struct lwis_client *client, new_instance->is_weak_transaction = transaction->is_weak_transaction; new_instance->remaining_entries_to_process = transaction->info.num_io_entries; + new_instance->starting_read_buf = NULL; INIT_LIST_HEAD(&new_instance->event_list_node); INIT_LIST_HEAD(&new_instance->process_queue_node); diff --git a/lwis_transaction.h b/lwis_transaction.h index 5af187d..9f91b2f 100644 --- a/lwis_transaction.h +++ b/lwis_transaction.h @@ -53,6 +53,11 @@ struct lwis_transaction { remaining to be processed after a given transaction process cycle */ int remaining_entries_to_process; + /* Starting read buffer pointer is set to the last read location when the transaction + process limit has reached. During the next run for the transaction, this pointer + will be referred to correctly point to the read buffer for the run. + */ + uint8_t *starting_read_buf; }; /* For debugging purposes, keeps track of the transaction information, as |