1

s390/cio: use new address translation helpers

Use virt_to_dma32() and friends to properly convert virtual to physical and
physical to virtual addresses so that "make C=1" does not generate any
warnings anymore.

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
Heiko Carstens 2024-03-07 13:28:15 +01:00
parent e1f51be68d
commit 9ff91a33c0
13 changed files with 46 additions and 46 deletions

View File

@ -191,7 +191,7 @@ EXPORT_SYMBOL_GPL(chsc_ssqd);
* Returns 0 on success. * Returns 0 on success.
*/ */
int chsc_sadc(struct subchannel_id schid, struct chsc_scssc_area *scssc, int chsc_sadc(struct subchannel_id schid, struct chsc_scssc_area *scssc,
u64 summary_indicator_addr, u64 subchannel_indicator_addr, u8 isc) dma64_t summary_indicator_addr, dma64_t subchannel_indicator_addr, u8 isc)
{ {
memset(scssc, 0, sizeof(*scssc)); memset(scssc, 0, sizeof(*scssc));
scssc->request.length = 0x0fe0; scssc->request.length = 0x0fe0;
@ -861,9 +861,9 @@ int __chsc_do_secm(struct channel_subsystem *css, int enable)
u32 key : 4; u32 key : 4;
u32 : 28; u32 : 28;
u32 zeroes1; u32 zeroes1;
u32 cub_addr1; dma32_t cub_addr1;
u32 zeroes2; u32 zeroes2;
u32 cub_addr2; dma32_t cub_addr2;
u32 reserved[13]; u32 reserved[13];
struct chsc_header response; struct chsc_header response;
u32 status : 8; u32 status : 8;
@ -881,8 +881,8 @@ int __chsc_do_secm(struct channel_subsystem *css, int enable)
secm_area->request.code = 0x0016; secm_area->request.code = 0x0016;
secm_area->key = PAGE_DEFAULT_KEY >> 4; secm_area->key = PAGE_DEFAULT_KEY >> 4;
secm_area->cub_addr1 = virt_to_phys(css->cub_addr1); secm_area->cub_addr1 = virt_to_dma32(css->cub_addr1);
secm_area->cub_addr2 = virt_to_phys(css->cub_addr2); secm_area->cub_addr2 = virt_to_dma32(css->cub_addr2);
secm_area->operation_code = enable ? 0 : 1; secm_area->operation_code = enable ? 0 : 1;

View File

@ -164,7 +164,7 @@ void chsc_chp_offline(struct chp_id chpid);
int chsc_get_channel_measurement_chars(struct channel_path *chp); int chsc_get_channel_measurement_chars(struct channel_path *chp);
int chsc_ssqd(struct subchannel_id schid, struct chsc_ssqd_area *ssqd); int chsc_ssqd(struct subchannel_id schid, struct chsc_ssqd_area *ssqd);
int chsc_sadc(struct subchannel_id schid, struct chsc_scssc_area *scssc, int chsc_sadc(struct subchannel_id schid, struct chsc_scssc_area *scssc,
u64 summary_indicator_addr, u64 subchannel_indicator_addr, dma64_t summary_indicator_addr, dma64_t subchannel_indicator_addr,
u8 isc); u8 isc);
int chsc_sgib(u32 origin); int chsc_sgib(u32 origin);
int chsc_error_from_response(int response); int chsc_error_from_response(int response);

View File

@ -148,7 +148,7 @@ cio_start_key (struct subchannel *sch, /* subchannel structure */
orb->cmd.i2k = 0; orb->cmd.i2k = 0;
orb->cmd.key = key >> 4; orb->cmd.key = key >> 4;
/* issue "Start Subchannel" */ /* issue "Start Subchannel" */
orb->cmd.cpa = (u32)virt_to_phys(cpa); orb->cmd.cpa = virt_to_dma32(cpa);
ccode = ssch(sch->schid, orb); ccode = ssch(sch->schid, orb);
/* process condition code */ /* process condition code */
@ -717,7 +717,7 @@ int cio_tm_start_key(struct subchannel *sch, struct tcw *tcw, u8 lpm, u8 key)
orb->tm.key = key >> 4; orb->tm.key = key >> 4;
orb->tm.b = 1; orb->tm.b = 1;
orb->tm.lpm = lpm ? lpm : sch->lpm; orb->tm.lpm = lpm ? lpm : sch->lpm;
orb->tm.tcw = (u32)virt_to_phys(tcw); orb->tm.tcw = virt_to_dma32(tcw);
cc = ssch(sch->schid, orb); cc = ssch(sch->schid, orb);
switch (cc) { switch (cc) {
case 0: case 0:

View File

@ -64,13 +64,13 @@ static void ccw_timeout_log(struct ccw_device *cdev)
printk(KERN_WARNING "cio: orb indicates transport mode\n"); printk(KERN_WARNING "cio: orb indicates transport mode\n");
printk(KERN_WARNING "cio: last tcw:\n"); printk(KERN_WARNING "cio: last tcw:\n");
print_hex_dump(KERN_WARNING, "cio: ", DUMP_PREFIX_NONE, 16, 1, print_hex_dump(KERN_WARNING, "cio: ", DUMP_PREFIX_NONE, 16, 1,
phys_to_virt(orb->tm.tcw), dma32_to_virt(orb->tm.tcw),
sizeof(struct tcw), 0); sizeof(struct tcw), 0);
} else { } else {
printk(KERN_WARNING "cio: orb indicates command mode\n"); printk(KERN_WARNING "cio: orb indicates command mode\n");
if (phys_to_virt(orb->cmd.cpa) == if (dma32_to_virt(orb->cmd.cpa) ==
&private->dma_area->sense_ccw || &private->dma_area->sense_ccw ||
phys_to_virt(orb->cmd.cpa) == dma32_to_virt(orb->cmd.cpa) ==
cdev->private->dma_area->iccws) cdev->private->dma_area->iccws)
printk(KERN_WARNING "cio: last channel program " printk(KERN_WARNING "cio: last channel program "
"(intern):\n"); "(intern):\n");
@ -78,7 +78,7 @@ static void ccw_timeout_log(struct ccw_device *cdev)
printk(KERN_WARNING "cio: last channel program:\n"); printk(KERN_WARNING "cio: last channel program:\n");
print_hex_dump(KERN_WARNING, "cio: ", DUMP_PREFIX_NONE, 16, 1, print_hex_dump(KERN_WARNING, "cio: ", DUMP_PREFIX_NONE, 16, 1,
phys_to_virt(orb->cmd.cpa), dma32_to_virt(orb->cmd.cpa),
sizeof(struct ccw1), 0); sizeof(struct ccw1), 0);
} }
printk(KERN_WARNING "cio: ccw device state: %d\n", printk(KERN_WARNING "cio: ccw device state: %d\n",

View File

@ -210,7 +210,7 @@ void ccw_device_sense_id_start(struct ccw_device *cdev)
snsid_init(cdev); snsid_init(cdev);
/* Channel program setup. */ /* Channel program setup. */
cp->cmd_code = CCW_CMD_SENSE_ID; cp->cmd_code = CCW_CMD_SENSE_ID;
cp->cda = (u32)virt_to_phys(&cdev->private->dma_area->senseid); cp->cda = virt_to_dma32(&cdev->private->dma_area->senseid);
cp->count = sizeof(struct senseid); cp->count = sizeof(struct senseid);
cp->flags = CCW_FLAG_SLI; cp->flags = CCW_FLAG_SLI;
/* Request setup. */ /* Request setup. */

View File

@ -141,7 +141,7 @@ static void spid_build_cp(struct ccw_device *cdev, u8 fn)
pgid->inf.fc = fn; pgid->inf.fc = fn;
cp->cmd_code = CCW_CMD_SET_PGID; cp->cmd_code = CCW_CMD_SET_PGID;
cp->cda = (u32)virt_to_phys(pgid); cp->cda = virt_to_dma32(pgid);
cp->count = sizeof(*pgid); cp->count = sizeof(*pgid);
cp->flags = CCW_FLAG_SLI; cp->flags = CCW_FLAG_SLI;
req->cp = cp; req->cp = cp;
@ -442,7 +442,7 @@ static void snid_build_cp(struct ccw_device *cdev)
/* Channel program setup. */ /* Channel program setup. */
cp->cmd_code = CCW_CMD_SENSE_PGID; cp->cmd_code = CCW_CMD_SENSE_PGID;
cp->cda = (u32)virt_to_phys(&cdev->private->dma_area->pgid[i]); cp->cda = virt_to_dma32(&cdev->private->dma_area->pgid[i]);
cp->count = sizeof(struct pgid); cp->count = sizeof(struct pgid);
cp->flags = CCW_FLAG_SLI; cp->flags = CCW_FLAG_SLI;
req->cp = cp; req->cp = cp;
@ -632,11 +632,11 @@ static void stlck_build_cp(struct ccw_device *cdev, void *buf1, void *buf2)
struct ccw1 *cp = cdev->private->dma_area->iccws; struct ccw1 *cp = cdev->private->dma_area->iccws;
cp[0].cmd_code = CCW_CMD_STLCK; cp[0].cmd_code = CCW_CMD_STLCK;
cp[0].cda = (u32)virt_to_phys(buf1); cp[0].cda = virt_to_dma32(buf1);
cp[0].count = 32; cp[0].count = 32;
cp[0].flags = CCW_FLAG_CC; cp[0].flags = CCW_FLAG_CC;
cp[1].cmd_code = CCW_CMD_RELEASE; cp[1].cmd_code = CCW_CMD_RELEASE;
cp[1].cda = (u32)virt_to_phys(buf2); cp[1].cda = virt_to_dma32(buf2);
cp[1].count = 32; cp[1].count = 32;
cp[1].flags = 0; cp[1].flags = 0;
req->cp = cp; req->cp = cp;

View File

@ -332,7 +332,7 @@ ccw_device_do_sense(struct ccw_device *cdev, struct irb *irb)
*/ */
sense_ccw = &to_io_private(sch)->dma_area->sense_ccw; sense_ccw = &to_io_private(sch)->dma_area->sense_ccw;
sense_ccw->cmd_code = CCW_CMD_BASIC_SENSE; sense_ccw->cmd_code = CCW_CMD_BASIC_SENSE;
sense_ccw->cda = virt_to_phys(cdev->private->dma_area->irb.ecw); sense_ccw->cda = virt_to_dma32(cdev->private->dma_area->irb.ecw);
sense_ccw->count = SENSE_MAX_COUNT; sense_ccw->count = SENSE_MAX_COUNT;
sense_ccw->flags = CCW_FLAG_SLI; sense_ccw->flags = CCW_FLAG_SLI;

View File

@ -63,7 +63,7 @@ static int eadm_subchannel_start(struct subchannel *sch, struct aob *aob)
int cc; int cc;
orb_init(orb); orb_init(orb);
orb->eadm.aob = (u32)virt_to_phys(aob); orb->eadm.aob = virt_to_dma32(aob);
orb->eadm.intparm = (u32)virt_to_phys(sch); orb->eadm.intparm = (u32)virt_to_phys(sch);
orb->eadm.key = PAGE_DEFAULT_KEY >> 4; orb->eadm.key = PAGE_DEFAULT_KEY >> 4;
@ -147,7 +147,7 @@ static void eadm_subchannel_irq(struct subchannel *sch)
css_sched_sch_todo(sch, SCH_TODO_EVAL); css_sched_sch_todo(sch, SCH_TODO_EVAL);
return; return;
} }
scm_irq_handler(phys_to_virt(scsw->aob), error); scm_irq_handler(dma32_to_virt(scsw->aob), error);
private->state = EADM_IDLE; private->state = EADM_IDLE;
if (private->completion) if (private->completion)

View File

@ -25,7 +25,7 @@
*/ */
struct tcw *tcw_get_intrg(struct tcw *tcw) struct tcw *tcw_get_intrg(struct tcw *tcw)
{ {
return phys_to_virt(tcw->intrg); return dma32_to_virt(tcw->intrg);
} }
EXPORT_SYMBOL(tcw_get_intrg); EXPORT_SYMBOL(tcw_get_intrg);
@ -40,9 +40,9 @@ EXPORT_SYMBOL(tcw_get_intrg);
void *tcw_get_data(struct tcw *tcw) void *tcw_get_data(struct tcw *tcw)
{ {
if (tcw->r) if (tcw->r)
return phys_to_virt(tcw->input); return dma64_to_virt(tcw->input);
if (tcw->w) if (tcw->w)
return phys_to_virt(tcw->output); return dma64_to_virt(tcw->output);
return NULL; return NULL;
} }
EXPORT_SYMBOL(tcw_get_data); EXPORT_SYMBOL(tcw_get_data);
@ -55,7 +55,7 @@ EXPORT_SYMBOL(tcw_get_data);
*/ */
struct tccb *tcw_get_tccb(struct tcw *tcw) struct tccb *tcw_get_tccb(struct tcw *tcw)
{ {
return phys_to_virt(tcw->tccb); return dma64_to_virt(tcw->tccb);
} }
EXPORT_SYMBOL(tcw_get_tccb); EXPORT_SYMBOL(tcw_get_tccb);
@ -67,7 +67,7 @@ EXPORT_SYMBOL(tcw_get_tccb);
*/ */
struct tsb *tcw_get_tsb(struct tcw *tcw) struct tsb *tcw_get_tsb(struct tcw *tcw)
{ {
return phys_to_virt(tcw->tsb); return dma64_to_virt(tcw->tsb);
} }
EXPORT_SYMBOL(tcw_get_tsb); EXPORT_SYMBOL(tcw_get_tsb);
@ -190,7 +190,7 @@ EXPORT_SYMBOL(tcw_finalize);
*/ */
void tcw_set_intrg(struct tcw *tcw, struct tcw *intrg_tcw) void tcw_set_intrg(struct tcw *tcw, struct tcw *intrg_tcw)
{ {
tcw->intrg = (u32)virt_to_phys(intrg_tcw); tcw->intrg = virt_to_dma32(intrg_tcw);
} }
EXPORT_SYMBOL(tcw_set_intrg); EXPORT_SYMBOL(tcw_set_intrg);
@ -208,11 +208,11 @@ EXPORT_SYMBOL(tcw_set_intrg);
void tcw_set_data(struct tcw *tcw, void *data, int use_tidal) void tcw_set_data(struct tcw *tcw, void *data, int use_tidal)
{ {
if (tcw->r) { if (tcw->r) {
tcw->input = virt_to_phys(data); tcw->input = virt_to_dma64(data);
if (use_tidal) if (use_tidal)
tcw->flags |= TCW_FLAGS_INPUT_TIDA; tcw->flags |= TCW_FLAGS_INPUT_TIDA;
} else if (tcw->w) { } else if (tcw->w) {
tcw->output = virt_to_phys(data); tcw->output = virt_to_dma64(data);
if (use_tidal) if (use_tidal)
tcw->flags |= TCW_FLAGS_OUTPUT_TIDA; tcw->flags |= TCW_FLAGS_OUTPUT_TIDA;
} }
@ -228,7 +228,7 @@ EXPORT_SYMBOL(tcw_set_data);
*/ */
void tcw_set_tccb(struct tcw *tcw, struct tccb *tccb) void tcw_set_tccb(struct tcw *tcw, struct tccb *tccb)
{ {
tcw->tccb = virt_to_phys(tccb); tcw->tccb = virt_to_dma64(tccb);
} }
EXPORT_SYMBOL(tcw_set_tccb); EXPORT_SYMBOL(tcw_set_tccb);
@ -241,7 +241,7 @@ EXPORT_SYMBOL(tcw_set_tccb);
*/ */
void tcw_set_tsb(struct tcw *tcw, struct tsb *tsb) void tcw_set_tsb(struct tcw *tcw, struct tsb *tsb)
{ {
tcw->tsb = virt_to_phys(tsb); tcw->tsb = virt_to_dma64(tsb);
} }
EXPORT_SYMBOL(tcw_set_tsb); EXPORT_SYMBOL(tcw_set_tsb);
@ -346,7 +346,7 @@ struct tidaw *tcw_add_tidaw(struct tcw *tcw, int num_tidaws, u8 flags,
memset(tidaw, 0, sizeof(struct tidaw)); memset(tidaw, 0, sizeof(struct tidaw));
tidaw->flags = flags; tidaw->flags = flags;
tidaw->count = count; tidaw->count = count;
tidaw->addr = virt_to_phys(addr); tidaw->addr = virt_to_dma64(addr);
return tidaw; return tidaw;
} }
EXPORT_SYMBOL(tcw_add_tidaw); EXPORT_SYMBOL(tcw_add_tidaw);

View File

@ -82,7 +82,7 @@ static inline int do_siga_input(unsigned long schid, unsigned long mask,
*/ */
static inline int do_siga_output(unsigned long schid, unsigned long mask, static inline int do_siga_output(unsigned long schid, unsigned long mask,
unsigned int *bb, unsigned long fc, unsigned int *bb, unsigned long fc,
unsigned long aob) dma64_t aob)
{ {
int cc; int cc;
@ -321,7 +321,7 @@ static inline int qdio_siga_sync_q(struct qdio_q *q)
} }
static int qdio_siga_output(struct qdio_q *q, unsigned int count, static int qdio_siga_output(struct qdio_q *q, unsigned int count,
unsigned int *busy_bit, unsigned long aob) unsigned int *busy_bit, dma64_t aob)
{ {
unsigned long schid = *((u32 *) &q->irq_ptr->schid); unsigned long schid = *((u32 *) &q->irq_ptr->schid);
unsigned int fc = QDIO_SIGA_WRITE; unsigned int fc = QDIO_SIGA_WRITE;
@ -628,7 +628,7 @@ int qdio_inspect_output_queue(struct ccw_device *cdev, unsigned int nr,
EXPORT_SYMBOL_GPL(qdio_inspect_output_queue); EXPORT_SYMBOL_GPL(qdio_inspect_output_queue);
static int qdio_kick_outbound_q(struct qdio_q *q, unsigned int count, static int qdio_kick_outbound_q(struct qdio_q *q, unsigned int count,
unsigned long aob) dma64_t aob)
{ {
int retries = 0, cc; int retries = 0, cc;
unsigned int busy_bit; unsigned int busy_bit;
@ -1070,7 +1070,7 @@ int qdio_establish(struct ccw_device *cdev,
irq_ptr->ccw->cmd_code = ciw->cmd; irq_ptr->ccw->cmd_code = ciw->cmd;
irq_ptr->ccw->flags = CCW_FLAG_SLI; irq_ptr->ccw->flags = CCW_FLAG_SLI;
irq_ptr->ccw->count = ciw->count; irq_ptr->ccw->count = ciw->count;
irq_ptr->ccw->cda = (u32) virt_to_phys(irq_ptr->qdr); irq_ptr->ccw->cda = virt_to_dma32(irq_ptr->qdr);
spin_lock_irq(get_ccwdev_lock(cdev)); spin_lock_irq(get_ccwdev_lock(cdev));
ccw_device_set_options_mask(cdev, 0); ccw_device_set_options_mask(cdev, 0);
@ -1263,9 +1263,9 @@ static int handle_outbound(struct qdio_q *q, unsigned int bufnr, unsigned int co
qperf_inc(q, outbound_queue_full); qperf_inc(q, outbound_queue_full);
if (queue_type(q) == QDIO_IQDIO_QFMT) { if (queue_type(q) == QDIO_IQDIO_QFMT) {
unsigned long phys_aob = aob ? virt_to_phys(aob) : 0; dma64_t phys_aob = aob ? virt_to_dma64(aob) : 0;
WARN_ON_ONCE(!IS_ALIGNED(phys_aob, 256)); WARN_ON_ONCE(!IS_ALIGNED(dma64_to_u64(phys_aob), 256));
rc = qdio_kick_outbound_q(q, count, phys_aob); rc = qdio_kick_outbound_q(q, count, phys_aob);
} else if (qdio_need_siga_sync(q->irq_ptr)) { } else if (qdio_need_siga_sync(q->irq_ptr)) {
rc = qdio_sync_output_queue(q); rc = qdio_sync_output_queue(q);

View File

@ -179,7 +179,7 @@ static void setup_storage_lists(struct qdio_q *q, struct qdio_irq *irq_ptr,
/* fill in sl */ /* fill in sl */
for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; j++) for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; j++)
q->sl->element[j].sbal = virt_to_phys(q->sbal[j]); q->sl->element[j].sbal = virt_to_dma64(q->sbal[j]);
} }
static void setup_queues(struct qdio_irq *irq_ptr, static void setup_queues(struct qdio_irq *irq_ptr,
@ -291,9 +291,9 @@ void qdio_setup_ssqd_info(struct qdio_irq *irq_ptr)
static void qdio_fill_qdr_desc(struct qdesfmt0 *desc, struct qdio_q *queue) static void qdio_fill_qdr_desc(struct qdesfmt0 *desc, struct qdio_q *queue)
{ {
desc->sliba = virt_to_phys(queue->slib); desc->sliba = virt_to_dma64(queue->slib);
desc->sla = virt_to_phys(queue->sl); desc->sla = virt_to_dma64(queue->sl);
desc->slsba = virt_to_phys(&queue->slsb); desc->slsba = virt_to_dma64(&queue->slsb);
desc->akey = PAGE_DEFAULT_KEY >> 4; desc->akey = PAGE_DEFAULT_KEY >> 4;
desc->bkey = PAGE_DEFAULT_KEY >> 4; desc->bkey = PAGE_DEFAULT_KEY >> 4;
@ -315,7 +315,7 @@ static void setup_qdr(struct qdio_irq *irq_ptr,
irq_ptr->qdr->oqdcnt = qdio_init->no_output_qs; irq_ptr->qdr->oqdcnt = qdio_init->no_output_qs;
irq_ptr->qdr->iqdsz = sizeof(struct qdesfmt0) / 4; /* size in words */ irq_ptr->qdr->iqdsz = sizeof(struct qdesfmt0) / 4; /* size in words */
irq_ptr->qdr->oqdsz = sizeof(struct qdesfmt0) / 4; irq_ptr->qdr->oqdsz = sizeof(struct qdesfmt0) / 4;
irq_ptr->qdr->qiba = virt_to_phys(&irq_ptr->qib); irq_ptr->qdr->qiba = virt_to_dma64(&irq_ptr->qib);
irq_ptr->qdr->qkey = PAGE_DEFAULT_KEY >> 4; irq_ptr->qdr->qkey = PAGE_DEFAULT_KEY >> 4;
for (i = 0; i < qdio_init->no_input_qs; i++) for (i = 0; i < qdio_init->no_input_qs; i++)

View File

@ -137,15 +137,15 @@ static struct airq_struct tiqdio_airq = {
static int set_subchannel_ind(struct qdio_irq *irq_ptr, int reset) static int set_subchannel_ind(struct qdio_irq *irq_ptr, int reset)
{ {
struct chsc_scssc_area *scssc = (void *)irq_ptr->chsc_page; struct chsc_scssc_area *scssc = (void *)irq_ptr->chsc_page;
u64 summary_indicator_addr, subchannel_indicator_addr; dma64_t summary_indicator_addr, subchannel_indicator_addr;
int rc; int rc;
if (reset) { if (reset) {
summary_indicator_addr = 0; summary_indicator_addr = 0;
subchannel_indicator_addr = 0; subchannel_indicator_addr = 0;
} else { } else {
summary_indicator_addr = virt_to_phys(tiqdio_airq.lsi_ptr); summary_indicator_addr = virt_to_dma64(tiqdio_airq.lsi_ptr);
subchannel_indicator_addr = virt_to_phys(irq_ptr->dsci); subchannel_indicator_addr = virt_to_dma64(irq_ptr->dsci);
} }
rc = chsc_sadc(irq_ptr->schid, scssc, summary_indicator_addr, rc = chsc_sadc(irq_ptr->schid, scssc, summary_indicator_addr,

View File

@ -1404,7 +1404,7 @@ static void qeth_tx_complete_pending_bufs(struct qeth_card *card,
for (i = 0; for (i = 0;
i < aob->sb_count && i < queue->max_elements; i < aob->sb_count && i < queue->max_elements;
i++) { i++) {
void *data = phys_to_virt(aob->sba[i]); void *data = dma64_to_virt(aob->sba[i]);
if (test_bit(i, buf->from_kmem_cache) && data) if (test_bit(i, buf->from_kmem_cache) && data)
kmem_cache_free(qeth_core_header_cache, kmem_cache_free(qeth_core_header_cache,