ANDROID: GKI: add vendor hook for mmc

UNISOC's solution allows more requests to be issued to improve read and
write performance, so vendor hooks are added to support this function.

Bug: 229920089
Signed-off-by: Wenchao Chen <wenchao.chen@unisoc.com>
Change-Id: Ic9423b651884111d286646d0d66a033fce3b44d7
This commit is contained in:
Wenchao Chen 2022-04-22 14:37:19 +08:00
parent 96e0181952
commit 7f5325b5bb
3 changed files with 27 additions and 2 deletions

View File

@ -62,6 +62,7 @@
#include <trace/hooks/usb.h>
#include <trace/hooks/regmap.h>
#include <trace/hooks/dmabuf.h>
#include <trace/hooks/mmc.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
@ -292,3 +293,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_force_compatible_pre);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_force_compatible_post);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_regmap_update);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_dma_buf_release);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmc_check_status);

View File

@ -20,6 +20,7 @@
#include "card.h"
#include "crypto.h"
#include "host.h"
#include <trace/hooks/mmc.h>
#define MMC_DMA_MAP_MERGE_SEGMENTS 512
@ -234,7 +235,7 @@ static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
enum mmc_issue_type issue_type;
enum mmc_issued issued;
bool get_card, cqe_retune_ok;
int ret;
int ret = 0;
if (mmc_card_removed(mq->card)) {
req->rq_flags |= RQF_QUIET;
@ -263,7 +264,8 @@ static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
* For MMC host software queue, we only allow 2 requests in
* flight to avoid a long latency.
*/
if (host->hsq_enabled && mq->in_flight[issue_type] > 2) {
trace_android_vh_mmc_check_status(bd, &ret);
if (!ret && host->hsq_enabled && mq->in_flight[issue_type] > 2) {
spin_unlock_irq(&mq->lock);
return BLK_STS_RESOURCE;
}

21
include/trace/hooks/mmc.h Normal file
View File

@ -0,0 +1,21 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM mmc
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_MMC_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_MMC_H
#include <trace/hooks/vendor_hooks.h>
struct blk_mq_queue_data;
/*
* Following tracepoints are not exported in tracefs and provide a
* mechanism for vendor modules to hook and extend functionality
*/
DECLARE_HOOK(android_vh_mmc_check_status,
TP_PROTO(const struct blk_mq_queue_data *bd, int *ret),
TP_ARGS(bd, ret));
#endif /* _TRACE_HOOK_MMC_H */
/* This part must be outside protection */
#include <trace/define_trace.h>