Skip to content

Commit 3c8cfec

Browse files
houlz0507superm1
authored andcommitted
accel/amdxdna: Declare mailbox register base as __iomem pointer
Declare mailbox ringbuf_base and mbox_base as 'void __iomem *' to fix sparse warnings: cast removes address space '__iomem' of expression incorrect type in argument 2 (different address spaces) Fixes: b87f920 ("accel/amdxdna: Support hardware mailbox") Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Signed-off-by: Lizhi Hou <[email protected]> Reviewed-by: Mario Limonciello <[email protected]> Signed-off-by: Mario Limonciello <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 71486e4 commit 3c8cfec

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

drivers/accel/amdxdna/aie2_pci.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,9 @@ static int aie2_hw_start(struct amdxdna_dev *xdna)
380380
goto stop_psp;
381381
}
382382

383-
mbox_res.ringbuf_base = (u64)ndev->sram_base;
383+
mbox_res.ringbuf_base = ndev->sram_base;
384384
mbox_res.ringbuf_size = pci_resource_len(pdev, xdna->dev_info->sram_bar);
385-
mbox_res.mbox_base = (u64)ndev->mbox_base;
385+
mbox_res.mbox_base = ndev->mbox_base;
386386
mbox_res.mbox_size = MBOX_SIZE(ndev);
387387
mbox_res.name = "xdna_mailbox";
388388
ndev->mbox = xdnam_mailbox_create(&xdna->ddev, &mbox_res);

drivers/accel/amdxdna/amdxdna_mailbox.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,27 +98,27 @@ struct mailbox_msg {
9898
static void mailbox_reg_write(struct mailbox_channel *mb_chann, u32 mbox_reg, u32 data)
9999
{
100100
struct xdna_mailbox_res *mb_res = &mb_chann->mb->res;
101-
u64 ringbuf_addr = mb_res->mbox_base + mbox_reg;
101+
void __iomem *ringbuf_addr = mb_res->mbox_base + mbox_reg;
102102

103-
writel(data, (void *)ringbuf_addr);
103+
writel(data, ringbuf_addr);
104104
}
105105

106106
static u32 mailbox_reg_read(struct mailbox_channel *mb_chann, u32 mbox_reg)
107107
{
108108
struct xdna_mailbox_res *mb_res = &mb_chann->mb->res;
109-
u64 ringbuf_addr = mb_res->mbox_base + mbox_reg;
109+
void __iomem *ringbuf_addr = mb_res->mbox_base + mbox_reg;
110110

111-
return readl((void *)ringbuf_addr);
111+
return readl(ringbuf_addr);
112112
}
113113

114114
static int mailbox_reg_read_non_zero(struct mailbox_channel *mb_chann, u32 mbox_reg, u32 *val)
115115
{
116116
struct xdna_mailbox_res *mb_res = &mb_chann->mb->res;
117-
u64 ringbuf_addr = mb_res->mbox_base + mbox_reg;
117+
void __iomem *ringbuf_addr = mb_res->mbox_base + mbox_reg;
118118
int ret, value;
119119

120120
/* Poll till value is not zero */
121-
ret = readx_poll_timeout(readl, (void *)ringbuf_addr, value,
121+
ret = readx_poll_timeout(readl, ringbuf_addr, value,
122122
value, 1 /* us */, 100);
123123
if (ret < 0)
124124
return ret;
@@ -200,10 +200,10 @@ static void mailbox_release_msg(struct mailbox_channel *mb_chann,
200200
static int
201201
mailbox_send_msg(struct mailbox_channel *mb_chann, struct mailbox_msg *mb_msg)
202202
{
203+
void __iomem *write_addr;
203204
u32 ringbuf_size;
204205
u32 head, tail;
205206
u32 start_addr;
206-
u64 write_addr;
207207
u32 tmp_tail;
208208

209209
head = mailbox_get_headptr(mb_chann, CHAN_RES_X2I);
@@ -221,14 +221,14 @@ mailbox_send_msg(struct mailbox_channel *mb_chann, struct mailbox_msg *mb_msg)
221221

222222
if (tail >= head && tmp_tail > ringbuf_size - sizeof(u32)) {
223223
write_addr = mb_chann->mb->res.ringbuf_base + start_addr + tail;
224-
writel(TOMBSTONE, (void *)write_addr);
224+
writel(TOMBSTONE, write_addr);
225225

226226
/* tombstone is set. Write from the start of the ringbuf */
227227
tail = 0;
228228
}
229229

230230
write_addr = mb_chann->mb->res.ringbuf_base + start_addr + tail;
231-
memcpy_toio((void *)write_addr, &mb_msg->pkg, mb_msg->pkg_size);
231+
memcpy_toio(write_addr, &mb_msg->pkg, mb_msg->pkg_size);
232232
mailbox_set_tailptr(mb_chann, tail + mb_msg->pkg_size);
233233

234234
trace_mbox_set_tail(MAILBOX_NAME, mb_chann->msix_irq,
@@ -275,11 +275,11 @@ mailbox_get_resp(struct mailbox_channel *mb_chann, struct xdna_msg_header *heade
275275
static int mailbox_get_msg(struct mailbox_channel *mb_chann)
276276
{
277277
struct xdna_msg_header header;
278+
void __iomem *read_addr;
278279
u32 msg_size, rest;
279280
u32 ringbuf_size;
280281
u32 head, tail;
281282
u32 start_addr;
282-
u64 read_addr;
283283
int ret;
284284

285285
if (mailbox_reg_read_non_zero(mb_chann, mb_chann->res[CHAN_RES_I2X].mb_tail_ptr_reg, &tail))
@@ -302,7 +302,7 @@ static int mailbox_get_msg(struct mailbox_channel *mb_chann)
302302

303303
/* Peek size of the message or TOMBSTONE */
304304
read_addr = mb_chann->mb->res.ringbuf_base + start_addr + head;
305-
header.total_size = readl((void *)read_addr);
305+
header.total_size = readl(read_addr);
306306
/* size is TOMBSTONE, set next read from 0 */
307307
if (header.total_size == TOMBSTONE) {
308308
if (head < tail) {
@@ -328,7 +328,7 @@ static int mailbox_get_msg(struct mailbox_channel *mb_chann)
328328

329329
rest = sizeof(header) - sizeof(u32);
330330
read_addr += sizeof(u32);
331-
memcpy_fromio((u32 *)&header + 1, (void *)read_addr, rest);
331+
memcpy_fromio((u32 *)&header + 1, read_addr, rest);
332332
read_addr += rest;
333333

334334
ret = mailbox_get_resp(mb_chann, &header, (u32 *)read_addr);

drivers/accel/amdxdna/amdxdna_mailbox.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ struct xdna_mailbox_msg {
3939
* @mbox_size: mailbox size
4040
*/
4141
struct xdna_mailbox_res {
42-
u64 ringbuf_base;
42+
void __iomem *ringbuf_base;
4343
size_t ringbuf_size;
44-
u64 mbox_base;
44+
void __iomem *mbox_base;
4545
size_t mbox_size;
4646
const char *name;
4747
};

0 commit comments

Comments
 (0)