Loading...
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef LINUX_MMC_HSQ_H
3#define LINUX_MMC_HSQ_H
4
5#define HSQ_NUM_SLOTS 64
6#define HSQ_INVALID_TAG HSQ_NUM_SLOTS
7
8struct hsq_slot {
9 struct mmc_request *mrq;
10};
11
12struct mmc_hsq {
13 struct mmc_host *mmc;
14 struct mmc_request *mrq;
15 wait_queue_head_t wait_queue;
16 struct hsq_slot *slot;
17 spinlock_t lock;
18 struct work_struct retry_work;
19
20 int next_tag;
21 int num_slots;
22 int qcnt;
23 int tail_tag;
24 int tag_slot[HSQ_NUM_SLOTS];
25
26 bool enabled;
27 bool waiting_for_idle;
28 bool recovery_halt;
29};
30
31int mmc_hsq_init(struct mmc_hsq *hsq, struct mmc_host *mmc);
32void mmc_hsq_suspend(struct mmc_host *mmc);
33int mmc_hsq_resume(struct mmc_host *mmc);
34bool mmc_hsq_finalize_request(struct mmc_host *mmc, struct mmc_request *mrq);
35
36#endif
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef LINUX_MMC_HSQ_H
3#define LINUX_MMC_HSQ_H
4
5#define HSQ_NUM_SLOTS 64
6#define HSQ_INVALID_TAG HSQ_NUM_SLOTS
7
8/*
9 * For MMC host software queue, we only allow 2 requests in
10 * flight to avoid a long latency.
11 */
12#define HSQ_NORMAL_DEPTH 2
13/*
14 * For 4k random writes, we allow hsq_depth to increase to 5
15 * for better performance.
16 */
17#define HSQ_PERFORMANCE_DEPTH 5
18
19struct hsq_slot {
20 struct mmc_request *mrq;
21};
22
23struct mmc_hsq {
24 struct mmc_host *mmc;
25 struct mmc_request *mrq;
26 wait_queue_head_t wait_queue;
27 struct hsq_slot *slot;
28 spinlock_t lock;
29 struct work_struct retry_work;
30
31 int next_tag;
32 int num_slots;
33 int qcnt;
34 int tail_tag;
35 int tag_slot[HSQ_NUM_SLOTS];
36
37 bool enabled;
38 bool waiting_for_idle;
39 bool recovery_halt;
40};
41
42int mmc_hsq_init(struct mmc_hsq *hsq, struct mmc_host *mmc);
43void mmc_hsq_suspend(struct mmc_host *mmc);
44int mmc_hsq_resume(struct mmc_host *mmc);
45bool mmc_hsq_finalize_request(struct mmc_host *mmc, struct mmc_request *mrq);
46
47#endif