Skip to content

Commit ada1da3

Browse files
Alexander GordeevVasily Gorbik
authored andcommitted
s390/sclp: sort out physical vs virtual pointers usage
Provide physical addresses whenever the hardware interface expects it or a 32-bit value used for tracking. Variable sclp_early_sccb gets initialized in the decompressor and points to an address in physcal memory. Yet, it is used as virtual memory pointer and therefore should be converted. Note, the other two __bootdata variables sclp_info_sccb and sclp_info_sccb_valid contain plain data, but no pointers and do need any special care. Reviewed-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
1 parent dd9089b commit ada1da3

File tree

6 files changed

+16
-9
lines changed

6 files changed

+16
-9
lines changed

arch/s390/include/asm/sclp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ struct zpci_report_error_header {
117117

118118
extern char *sclp_early_sccb;
119119

120+
void sclp_early_adjust_va(void);
120121
void sclp_early_set_buffer(void *sccb);
121122
int sclp_early_read_info(void);
122123
int sclp_early_read_storage_info(void);

arch/s390/kernel/early.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ static void __init check_image_bootable(void)
296296

297297
void __init startup_init(void)
298298
{
299+
sclp_early_adjust_va();
299300
reset_tod_clock();
300301
check_image_bootable();
301302
time_early_init();

drivers/s390/char/sclp.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ static inline void sclp_trace_req(int prio, char *id, struct sclp_req *req,
163163
summary.timeout = (u16)req->queue_timeout;
164164
summary.start_count = (u16)req->start_count;
165165

166-
sclp_trace(prio, id, (u32)(addr_t)sccb, summary.b, err);
166+
sclp_trace(prio, id, __pa(sccb), summary.b, err);
167167
}
168168

169169
static inline void sclp_trace_register(int prio, char *id, u32 a, u64 b,
@@ -502,7 +502,7 @@ sclp_add_request(struct sclp_req *req)
502502
}
503503

504504
/* RQAD: Request was added (a=sccb, b=caller) */
505-
sclp_trace(2, "RQAD", (u32)(addr_t)req->sccb, _RET_IP_, false);
505+
sclp_trace(2, "RQAD", __pa(req->sccb), _RET_IP_, false);
506506

507507
req->status = SCLP_REQ_QUEUED;
508508
req->start_count = 0;
@@ -617,15 +617,15 @@ __sclp_find_req(u32 sccb)
617617

618618
list_for_each(l, &sclp_req_queue) {
619619
req = list_entry(l, struct sclp_req, list);
620-
if (sccb == (u32) (addr_t) req->sccb)
621-
return req;
620+
if (sccb == __pa(req->sccb))
621+
return req;
622622
}
623623
return NULL;
624624
}
625625

626626
static bool ok_response(u32 sccb_int, sclp_cmdw_t cmd)
627627
{
628-
struct sccb_header *sccb = (struct sccb_header *)(addr_t)sccb_int;
628+
struct sccb_header *sccb = (struct sccb_header *)__va(sccb_int);
629629
struct evbuf_header *evbuf;
630630
u16 response;
631631

@@ -664,7 +664,7 @@ static void sclp_interrupt_handler(struct ext_code ext_code,
664664

665665
/* INT: Interrupt received (a=intparm, b=cmd) */
666666
sclp_trace_sccb(0, "INT", param32, active_cmd, active_cmd,
667-
(struct sccb_header *)(addr_t)finished_sccb,
667+
(struct sccb_header *)__va(finished_sccb),
668668
!ok_response(finished_sccb, active_cmd));
669669

670670
if (finished_sccb) {
@@ -1110,7 +1110,7 @@ static void sclp_check_handler(struct ext_code ext_code,
11101110
/* Is this the interrupt we are waiting for? */
11111111
if (finished_sccb == 0)
11121112
return;
1113-
if (finished_sccb != (u32) (addr_t) sclp_init_sccb)
1113+
if (finished_sccb != __pa(sclp_init_sccb))
11141114
panic("sclp: unsolicited interrupt for buffer at 0x%x\n",
11151115
finished_sccb);
11161116
spin_lock(&sclp_lock);

drivers/s390/char/sclp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ static inline int sclp_service_call(sclp_cmdw_t command, void *sccb)
333333
"2:\n"
334334
EX_TABLE(0b, 2b)
335335
EX_TABLE(1b, 2b)
336-
: "+&d" (cc) : "d" (command), "a" ((unsigned long)sccb)
336+
: "+&d" (cc) : "d" (command), "a" (__pa(sccb))
337337
: "cc", "memory");
338338
if (cc == 4)
339339
return -EINVAL;

drivers/s390/char/sclp_early.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ static void __init sclp_early_console_detect(struct init_sccb *sccb)
155155
sclp.has_linemode = 1;
156156
}
157157

158+
void __init sclp_early_adjust_va(void)
159+
{
160+
sclp_early_sccb = __va((unsigned long)sclp_early_sccb);
161+
}
162+
158163
void __init sclp_early_detect(void)
159164
{
160165
void *sccb = sclp_early_sccb;

drivers/s390/char/sclp_sd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ static int sclp_sd_sync(unsigned long page, u8 eq, u8 di, u64 sat, u64 sa,
194194
struct sclp_sd_evbuf *evbuf;
195195
int rc;
196196

197-
sclp_sd_listener_init(&listener, (u32) (addr_t) sccb);
197+
sclp_sd_listener_init(&listener, __pa(sccb));
198198
sclp_sd_listener_add(&listener);
199199

200200
/* Prepare SCCB */

0 commit comments

Comments
 (0)