Skip to content

Commit c0549ef

Browse files
author
CKI KWF Bot
committed
Merge: mhi bus update to 6.17
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1603 JIRA: https://issues.redhat.com/browse/RHEL-122260 MHI bus rebase to linux kernel upstream version v6.17 It will be used by Wireless (Wifi and WWAN) and automotive components. Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com> Approved-by: Desnes Nunes <desnesn@redhat.com> Approved-by: Mattijs Korpershoek <mkorpershoek@redhat.com> Approved-by: John W. Linville <linville@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents 7b1d267 + c32cc50 commit c0549ef

File tree

8 files changed

+168
-37
lines changed

8 files changed

+168
-37
lines changed

drivers/bus/mhi/ep/ring.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,19 +131,23 @@ int mhi_ep_ring_add_element(struct mhi_ep_ring *ring, struct mhi_ring_element *e
131131
}
132132

133133
old_offset = ring->rd_offset;
134-
mhi_ep_ring_inc_index(ring);
135134

136135
dev_dbg(dev, "Adding an element to ring at offset (%zu)\n", ring->rd_offset);
136+
buf_info.host_addr = ring->rbase + (old_offset * sizeof(*el));
137+
buf_info.dev_addr = el;
138+
buf_info.size = sizeof(*el);
139+
140+
ret = mhi_cntrl->write_sync(mhi_cntrl, &buf_info);
141+
if (ret)
142+
return ret;
143+
144+
mhi_ep_ring_inc_index(ring);
137145

138146
/* Update rp in ring context */
139147
rp = cpu_to_le64(ring->rd_offset * sizeof(*el) + ring->rbase);
140148
memcpy_toio((void __iomem *) &ring->ring_ctx->generic.rp, &rp, sizeof(u64));
141149

142-
buf_info.host_addr = ring->rbase + (old_offset * sizeof(*el));
143-
buf_info.dev_addr = el;
144-
buf_info.size = sizeof(*el);
145-
146-
return mhi_cntrl->write_sync(mhi_cntrl, &buf_info);
150+
return ret;
147151
}
148152

149153
void mhi_ep_ring_init(struct mhi_ep_ring *ring, enum mhi_ep_ring_type type, u32 id)

drivers/bus/mhi/host/boot.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ int mhi_rddm_prepare(struct mhi_controller *mhi_cntrl,
3131
int ret;
3232

3333
for (i = 0; i < img_info->entries - 1; i++, mhi_buf++, bhi_vec++) {
34-
bhi_vec->dma_addr = mhi_buf->dma_addr;
35-
bhi_vec->size = mhi_buf->len;
34+
bhi_vec->dma_addr = cpu_to_le64(mhi_buf->dma_addr);
35+
bhi_vec->size = cpu_to_le64(mhi_buf->len);
3636
}
3737

3838
dev_dbg(dev, "BHIe programming for RDDM\n");
@@ -431,8 +431,8 @@ static void mhi_firmware_copy_bhie(struct mhi_controller *mhi_cntrl,
431431
while (remainder) {
432432
to_cpy = min(remainder, mhi_buf->len);
433433
memcpy(mhi_buf->buf, buf, to_cpy);
434-
bhi_vec->dma_addr = mhi_buf->dma_addr;
435-
bhi_vec->size = to_cpy;
434+
bhi_vec->dma_addr = cpu_to_le64(mhi_buf->dma_addr);
435+
bhi_vec->size = cpu_to_le64(to_cpy);
436436

437437
buf += to_cpy;
438438
remainder -= to_cpy;

drivers/bus/mhi/host/debugfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/list.h>
1111
#include <linux/mhi.h>
1212
#include <linux/module.h>
13+
#include <linux/string_choices.h>
1314
#include "internal.h"
1415

1516
static int mhi_debugfs_states_show(struct seq_file *m, void *d)
@@ -22,7 +23,7 @@ static int mhi_debugfs_states_show(struct seq_file *m, void *d)
2223
mhi_is_active(mhi_cntrl) ? "Active" : "Inactive",
2324
mhi_state_str(mhi_cntrl->dev_state),
2425
TO_MHI_EXEC_STR(mhi_cntrl->ee),
25-
mhi_cntrl->wake_set ? "true" : "false");
26+
str_true_false(mhi_cntrl->wake_set));
2627

2728
/* counters */
2829
seq_printf(m, "M0: %u M2: %u M3: %u", mhi_cntrl->M0, mhi_cntrl->M2,

drivers/bus/mhi/host/init.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ static int mhi_alloc_aligned_ring(struct mhi_controller *mhi_cntrl,
176176
return 0;
177177
}
178178

179-
void mhi_deinit_free_irq(struct mhi_controller *mhi_cntrl)
179+
static void mhi_deinit_free_irq(struct mhi_controller *mhi_cntrl)
180180
{
181181
int i;
182182
struct mhi_event *mhi_event = mhi_cntrl->mhi_event;
@@ -191,7 +191,7 @@ void mhi_deinit_free_irq(struct mhi_controller *mhi_cntrl)
191191
free_irq(mhi_cntrl->irq[0], mhi_cntrl);
192192
}
193193

194-
int mhi_init_irq_setup(struct mhi_controller *mhi_cntrl)
194+
static int mhi_init_irq_setup(struct mhi_controller *mhi_cntrl)
195195
{
196196
struct mhi_event *mhi_event = mhi_cntrl->mhi_event;
197197
struct device *dev = &mhi_cntrl->mhi_dev->dev;
@@ -254,7 +254,7 @@ int mhi_init_irq_setup(struct mhi_controller *mhi_cntrl)
254254
return ret;
255255
}
256256

257-
void mhi_deinit_dev_ctxt(struct mhi_controller *mhi_cntrl)
257+
static void mhi_deinit_dev_ctxt(struct mhi_controller *mhi_cntrl)
258258
{
259259
int i;
260260
struct mhi_ctxt *mhi_ctxt = mhi_cntrl->mhi_ctxt;
@@ -299,7 +299,7 @@ void mhi_deinit_dev_ctxt(struct mhi_controller *mhi_cntrl)
299299
mhi_cntrl->mhi_ctxt = NULL;
300300
}
301301

302-
int mhi_init_dev_ctxt(struct mhi_controller *mhi_cntrl)
302+
static int mhi_init_dev_ctxt(struct mhi_controller *mhi_cntrl)
303303
{
304304
struct mhi_ctxt *mhi_ctxt;
305305
struct mhi_chan_ctxt *chan_ctxt;

drivers/bus/mhi/host/internal.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ struct mhi_ctxt {
2525
};
2626

2727
struct bhi_vec_entry {
28-
u64 dma_addr;
29-
u64 size;
28+
__le64 dma_addr;
29+
__le64 size;
3030
};
3131

3232
enum mhi_fw_load_type {
@@ -383,19 +383,12 @@ void mhi_ring_chan_db(struct mhi_controller *mhi_cntrl,
383383

384384
/* Initialization methods */
385385
int mhi_init_mmio(struct mhi_controller *mhi_cntrl);
386-
int mhi_init_dev_ctxt(struct mhi_controller *mhi_cntrl);
387-
void mhi_deinit_dev_ctxt(struct mhi_controller *mhi_cntrl);
388-
int mhi_init_irq_setup(struct mhi_controller *mhi_cntrl);
389-
void mhi_deinit_free_irq(struct mhi_controller *mhi_cntrl);
390386
int mhi_rddm_prepare(struct mhi_controller *mhi_cntrl,
391387
struct image_info *img_info);
392388
void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl);
393389

394390
/* Automatically allocate and queue inbound buffers */
395391
#define MHI_CH_INBOUND_ALLOC_BUFS BIT(0)
396-
int mhi_prepare_channel(struct mhi_controller *mhi_cntrl,
397-
struct mhi_chan *mhi_chan, unsigned int flags);
398-
399392
int mhi_init_chan_ctxt(struct mhi_controller *mhi_cntrl,
400393
struct mhi_chan *mhi_chan);
401394
void mhi_deinit_chan_ctxt(struct mhi_controller *mhi_cntrl,

drivers/bus/mhi/host/main.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ static int parse_xfer_event(struct mhi_controller *mhi_cntrl,
602602
{
603603
dma_addr_t ptr = MHI_TRE_GET_EV_PTR(event);
604604
struct mhi_ring_element *local_rp, *ev_tre;
605-
void *dev_rp;
605+
void *dev_rp, *next_rp;
606606
struct mhi_buf_info *buf_info;
607607
u16 xfer_len;
608608

@@ -621,6 +621,16 @@ static int parse_xfer_event(struct mhi_controller *mhi_cntrl,
621621
result.dir = mhi_chan->dir;
622622

623623
local_rp = tre_ring->rp;
624+
625+
next_rp = local_rp + 1;
626+
if (next_rp >= tre_ring->base + tre_ring->len)
627+
next_rp = tre_ring->base;
628+
if (dev_rp != next_rp && !MHI_TRE_DATA_GET_CHAIN(local_rp)) {
629+
dev_err(&mhi_cntrl->mhi_dev->dev,
630+
"Event element points to an unexpected TRE\n");
631+
break;
632+
}
633+
624634
while (local_rp != dev_rp) {
625635
buf_info = buf_ring->rp;
626636
/* If it's the last TRE, get length from the event */
@@ -1435,7 +1445,7 @@ static void mhi_unprepare_channel(struct mhi_controller *mhi_cntrl,
14351445
mutex_unlock(&mhi_chan->mutex);
14361446
}
14371447

1438-
int mhi_prepare_channel(struct mhi_controller *mhi_cntrl,
1448+
static int mhi_prepare_channel(struct mhi_controller *mhi_cntrl,
14391449
struct mhi_chan *mhi_chan, unsigned int flags)
14401450
{
14411451
int ret = 0;

0 commit comments

Comments
 (0)