Skip to content

Commit 33395f4

Browse files
committed
Merge branch 'net-ipa-kill-endpoint-stop-workaround'
Alex Elder says: ==================== net: ipa: kill endpoint stop workaround It turns out that a workaround that performs a small DMA operation between retried attempts to stop a GSI channel is not needed for any supported hardware. The hardware quirk that required the extra DMA operation was fixed after IPA v3.1. So this series gets rid of that workaround code, along with some other code that was only present to support it. NOTE: This series depends on (and includes/duplicates) another patch that has already been committed in the net tree: 713b6eb net: ipa: fix a bug in ipa_endpoint_stop() ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 6a5dc76 + da1a782 commit 33395f4

4 files changed

Lines changed: 6 additions & 146 deletions

File tree

‎drivers/net/ipa/ipa_cmd.c‎

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -103,28 +103,6 @@ struct ipa_cmd_ip_packet_init {
103103
/* Field masks for ipa_cmd_ip_packet_init dest_endpoint field */
104104
#define IPA_PACKET_INIT_DEST_ENDPOINT_FMASK GENMASK(4, 0)
105105

106-
/* IPA_CMD_DMA_TASK_32B_ADDR */
107-
108-
/* This opcode gets modified with a DMA operation count */
109-
110-
#define DMA_TASK_32B_ADDR_OPCODE_COUNT_FMASK GENMASK(15, 8)
111-
112-
struct ipa_cmd_hw_dma_task_32b_addr {
113-
__le16 flags;
114-
__le16 size;
115-
__le32 addr;
116-
__le16 packet_size;
117-
u8 reserved[6];
118-
};
119-
120-
/* Field masks for ipa_cmd_hw_dma_task_32b_addr flags field */
121-
#define DMA_TASK_32B_ADDR_FLAGS_SW_RSVD_FMASK GENMASK(10, 0)
122-
#define DMA_TASK_32B_ADDR_FLAGS_CMPLT_FMASK GENMASK(11, 11)
123-
#define DMA_TASK_32B_ADDR_FLAGS_EOF_FMASK GENMASK(12, 12)
124-
#define DMA_TASK_32B_ADDR_FLAGS_FLSH_FMASK GENMASK(13, 13)
125-
#define DMA_TASK_32B_ADDR_FLAGS_LOCK_FMASK GENMASK(14, 14)
126-
#define DMA_TASK_32B_ADDR_FLAGS_UNLOCK_FMASK GENMASK(15, 15)
127-
128106
/* IPA_CMD_DMA_SHARED_MEM */
129107

130108
/* For IPA v4.0+, this opcode gets modified with pipeline clear options */
@@ -163,7 +141,6 @@ union ipa_cmd_payload {
163141
struct ipa_cmd_hw_hdr_init_local hdr_init_local;
164142
struct ipa_cmd_register_write register_write;
165143
struct ipa_cmd_ip_packet_init ip_packet_init;
166-
struct ipa_cmd_hw_dma_task_32b_addr dma_task_32b_addr;
167144
struct ipa_cmd_hw_dma_mem_mem dma_shared_mem;
168145
struct ipa_cmd_ip_packet_tag_status ip_packet_tag_status;
169146
};
@@ -508,42 +485,6 @@ static void ipa_cmd_ip_packet_init_add(struct gsi_trans *trans, u8 endpoint_id)
508485
direction, opcode);
509486
}
510487

511-
/* Use a 32-bit DMA command to zero a block of memory */
512-
void ipa_cmd_dma_task_32b_addr_add(struct gsi_trans *trans, u16 size,
513-
dma_addr_t addr, bool toward_ipa)
514-
{
515-
struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi);
516-
enum ipa_cmd_opcode opcode = IPA_CMD_DMA_TASK_32B_ADDR;
517-
struct ipa_cmd_hw_dma_task_32b_addr *payload;
518-
union ipa_cmd_payload *cmd_payload;
519-
enum dma_data_direction direction;
520-
dma_addr_t payload_addr;
521-
u16 flags;
522-
523-
/* assert(addr <= U32_MAX); */
524-
addr &= GENMASK_ULL(31, 0);
525-
526-
/* The opcode encodes the number of DMA operations in the high byte */
527-
opcode |= u16_encode_bits(1, DMA_TASK_32B_ADDR_OPCODE_COUNT_FMASK);
528-
529-
direction = toward_ipa ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
530-
531-
/* complete: 0 = don't interrupt; eof: 0 = don't assert eot */
532-
flags = DMA_TASK_32B_ADDR_FLAGS_FLSH_FMASK;
533-
/* lock: 0 = don't lock endpoint; unlock: 0 = don't unlock */
534-
535-
cmd_payload = ipa_cmd_payload_alloc(ipa, &payload_addr);
536-
payload = &cmd_payload->dma_task_32b_addr;
537-
538-
payload->flags = cpu_to_le16(flags);
539-
payload->size = cpu_to_le16(size);
540-
payload->addr = cpu_to_le32((u32)addr);
541-
payload->packet_size = cpu_to_le16(size);
542-
543-
gsi_trans_cmd_add(trans, payload, sizeof(*payload), payload_addr,
544-
direction, opcode);
545-
}
546-
547488
/* Use a DMA command to read or write a block of IPA-resident memory */
548489
void ipa_cmd_dma_shared_mem_add(struct gsi_trans *trans, u32 offset, u16 size,
549490
dma_addr_t addr, bool toward_ipa)

‎drivers/net/ipa/ipa_cmd.h‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ enum ipa_cmd_opcode {
3535
IPA_CMD_HDR_INIT_LOCAL = 9,
3636
IPA_CMD_REGISTER_WRITE = 12,
3737
IPA_CMD_IP_PACKET_INIT = 16,
38-
IPA_CMD_DMA_TASK_32B_ADDR = 17,
3938
IPA_CMD_DMA_SHARED_MEM = 19,
4039
IPA_CMD_IP_PACKET_TAG_STATUS = 20,
4140
};
@@ -147,16 +146,6 @@ void ipa_cmd_hdr_init_local_add(struct gsi_trans *trans, u32 offset, u16 size,
147146
void ipa_cmd_register_write_add(struct gsi_trans *trans, u32 offset, u32 value,
148147
u32 mask, bool clear_full);
149148

150-
/**
151-
* ipa_cmd_dma_task_32b_addr_add() - Add a 32-bit DMA command to a transaction
152-
* @trans: GSi transaction
153-
* @size: Number of bytes to be memory to be transferred
154-
* @addr: DMA address of buffer to be read into or written from
155-
* @toward_ipa: true means write to IPA memory; false means read
156-
*/
157-
void ipa_cmd_dma_task_32b_addr_add(struct gsi_trans *trans, u16 size,
158-
dma_addr_t addr, bool toward_ipa);
159-
160149
/**
161150
* ipa_cmd_dma_shared_mem_add() - Add a DMA memory command to a transaction
162151
* @trans: GSI transaction

‎drivers/net/ipa/ipa_endpoint.c‎

Lines changed: 6 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,9 @@
3232
/* The amount of RX buffer space consumed by standard skb overhead */
3333
#define IPA_RX_BUFFER_OVERHEAD (PAGE_SIZE - SKB_MAX_ORDER(NET_SKB_PAD, 0))
3434

35-
#define IPA_ENDPOINT_STOP_RX_RETRIES 10
36-
#define IPA_ENDPOINT_STOP_RX_SIZE 1 /* bytes */
37-
3835
#define IPA_ENDPOINT_RESET_AGGR_RETRY_MAX 3
3936
#define IPA_AGGR_TIME_LIMIT_DEFAULT 1000 /* microseconds */
4037

41-
#define ENDPOINT_STOP_DMA_TIMEOUT 15 /* milliseconds */
42-
4338
/** enum ipa_status_opcode - status element opcode hardware values */
4439
enum ipa_status_opcode {
4540
IPA_STATUS_OPCODE_PACKET = 0x01,
@@ -1219,7 +1214,7 @@ static int ipa_endpoint_reset_rx_aggr(struct ipa_endpoint *endpoint)
12191214

12201215
gsi_trans_read_byte_done(gsi, endpoint->channel_id);
12211216

1222-
ret = ipa_endpoint_stop(endpoint);
1217+
ret = gsi_channel_stop(gsi, endpoint->channel_id);
12231218
if (ret)
12241219
goto out_suspend_again;
12251220

@@ -1236,7 +1231,7 @@ static int ipa_endpoint_reset_rx_aggr(struct ipa_endpoint *endpoint)
12361231
goto out_suspend_again;
12371232

12381233
err_endpoint_stop:
1239-
ipa_endpoint_stop(endpoint);
1234+
(void)gsi_channel_stop(gsi, endpoint->channel_id);
12401235
out_suspend_again:
12411236
if (suspended)
12421237
(void)ipa_endpoint_program_suspend(endpoint, true);
@@ -1274,70 +1269,6 @@ static void ipa_endpoint_reset(struct ipa_endpoint *endpoint)
12741269
ret, endpoint->channel_id, endpoint->endpoint_id);
12751270
}
12761271

1277-
static int ipa_endpoint_stop_rx_dma(struct ipa *ipa)
1278-
{
1279-
u16 size = IPA_ENDPOINT_STOP_RX_SIZE;
1280-
struct gsi_trans *trans;
1281-
dma_addr_t addr;
1282-
int ret;
1283-
1284-
trans = ipa_cmd_trans_alloc(ipa, 1);
1285-
if (!trans) {
1286-
dev_err(&ipa->pdev->dev,
1287-
"no transaction for RX endpoint STOP workaround\n");
1288-
return -EBUSY;
1289-
}
1290-
1291-
/* Read into the highest part of the zero memory area */
1292-
addr = ipa->zero_addr + ipa->zero_size - size;
1293-
1294-
ipa_cmd_dma_task_32b_addr_add(trans, size, addr, false);
1295-
1296-
ret = gsi_trans_commit_wait_timeout(trans, ENDPOINT_STOP_DMA_TIMEOUT);
1297-
if (ret)
1298-
gsi_trans_free(trans);
1299-
1300-
return ret;
1301-
}
1302-
1303-
/**
1304-
* ipa_endpoint_stop() - Stops a GSI channel in IPA
1305-
* @client: Client whose endpoint should be stopped
1306-
*
1307-
* This function implements the sequence to stop a GSI channel
1308-
* in IPA. This function returns when the channel is is STOP state.
1309-
*
1310-
* Return value: 0 on success, negative otherwise
1311-
*/
1312-
int ipa_endpoint_stop(struct ipa_endpoint *endpoint)
1313-
{
1314-
u32 retries = endpoint->toward_ipa ? 0 : IPA_ENDPOINT_STOP_RX_RETRIES;
1315-
int ret;
1316-
1317-
do {
1318-
struct ipa *ipa = endpoint->ipa;
1319-
struct gsi *gsi = &ipa->gsi;
1320-
1321-
ret = gsi_channel_stop(gsi, endpoint->channel_id);
1322-
if (ret != -EAGAIN)
1323-
break;
1324-
1325-
if (endpoint->toward_ipa)
1326-
continue;
1327-
1328-
/* For IPA v3.5.1, send a DMA read task and check again */
1329-
if (ipa->version == IPA_VERSION_3_5_1) {
1330-
ret = ipa_endpoint_stop_rx_dma(ipa);
1331-
if (ret)
1332-
break;
1333-
}
1334-
1335-
msleep(1);
1336-
} while (retries--);
1337-
1338-
return retries ? ret : -EIO;
1339-
}
1340-
13411272
static void ipa_endpoint_program(struct ipa_endpoint *endpoint)
13421273
{
13431274
if (endpoint->toward_ipa) {
@@ -1390,12 +1321,13 @@ void ipa_endpoint_disable_one(struct ipa_endpoint *endpoint)
13901321
{
13911322
u32 mask = BIT(endpoint->endpoint_id);
13921323
struct ipa *ipa = endpoint->ipa;
1324+
struct gsi *gsi = &ipa->gsi;
13931325
int ret;
13941326

1395-
if (!(endpoint->ipa->enabled & mask))
1327+
if (!(ipa->enabled & mask))
13961328
return;
13971329

1398-
endpoint->ipa->enabled ^= mask;
1330+
ipa->enabled ^= mask;
13991331

14001332
if (!endpoint->toward_ipa) {
14011333
ipa_endpoint_replenish_disable(endpoint);
@@ -1404,7 +1336,7 @@ void ipa_endpoint_disable_one(struct ipa_endpoint *endpoint)
14041336
}
14051337

14061338
/* Note that if stop fails, the channel's state is not well-defined */
1407-
ret = ipa_endpoint_stop(endpoint);
1339+
ret = gsi_channel_stop(gsi, endpoint->channel_id);
14081340
if (ret)
14091341
dev_err(&ipa->pdev->dev,
14101342
"error %d attempting to stop endpoint %u\n", ret,

‎drivers/net/ipa/ipa_endpoint.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ int ipa_endpoint_modem_exception_reset_all(struct ipa *ipa);
7676

7777
int ipa_endpoint_skb_tx(struct ipa_endpoint *endpoint, struct sk_buff *skb);
7878

79-
int ipa_endpoint_stop(struct ipa_endpoint *endpoint);
80-
8179
void ipa_endpoint_exit_one(struct ipa_endpoint *endpoint);
8280

8381
int ipa_endpoint_enable_one(struct ipa_endpoint *endpoint);

0 commit comments

Comments
 (0)