Skip to contentSkip to conversation

s390: ipl device.

PATCH In review Martin Schwidefsky 3 participants 6 messages Sep 14, 2005 – Sep 19, 2005 s390

lore
Share & tools
lore
#0 lore raw

PATCH 6/7 s390: ipl device.

[patch 6/7] s390: ipl device.

From: Heiko Carstens <[email protected]>

Export the ipl device settings to userspace via the sysfs:
* /sys/kernel/ipl_device
Contains a string in on of the following formats:
1) "ccw <bus_id>", or 2) "fcp <bus_id>,<wwpn>,<lun>".
* /sys/kernel/ipl_parameter
is a binary interface that exports the ipl parameter block for scsi ipl. For non-scsi ipl the ipl_paramter is irrelevant.

diffstat:

 arch/s390/kernel/head.S   |   72 ++++++++++++++++++++++++++++++++++++++++++----
 arch/s390/kernel/head64.S |   66 ++++++++++++++++++++++++++++++++++++++++--
 arch/s390/kernel/setup.c  |   67 ++++++++++++++++++++++++++++++++++++++++++
 include/asm-s390/setup.h  |   44 ++++++++++++++++++++++++++++
 4 files changed, 242 insertions(+), 7 deletions(-)
arch/s390/kernel/head64.S +64 -2
diff -urpN linux-2.6/arch/s390/kernel/head64.S linux-2.6-patched/arch/s390/kernel/head64.S
@@ -484,6 +484,8 @@ start:
 startup:basr  %r13,0                     # get base
 .LPG1:  sll   %r13,1                     # remove high order bit
         srl   %r13,1
+	l     %r1,.Lget_ipl_device_addr-.LPG1(%r13)
+	basr  %r14,%r1
         lhi   %r1,1                      # mode 1 = esame
         slr   %r0,%r0                    # set cpuid to zero
         sigp  %r1,%r0,0x12               # switch to esame mode
@@ -556,6 +558,9 @@ startup:basr  %r13,0                    
 	mlgr  %r2,%r1			# mem size in bytes in %r3
 	b     .Lfchunk-.LPG1(%r13)
 
+	.align 4
+.Lget_ipl_device_addr:
+	.long .Lget_ipl_device
 .Lpmask:
 	.byte 0
 	.align 8
@@ -746,6 +751,63 @@ _pstart:
 	.global _pend
 _pend:	
 
+.Lget_ipl_device:
+	basr  %r12,0
+.LPG2:	l     %r1,0xb8			# get sid
+	sll   %r1,15			# test if subchannel is enabled
+	srl   %r1,31
+	ltr   %r1,%r1
+	bz    0(%r14)			# subchannel disabled
+	l     %r1,0xb8
+	la    %r5,.Lipl_schib-.LPG2(%r12)
+	stsch 0(%r5)		        # get schib of subchannel
+	bnz   0(%r14)			# schib not available
+	tm    5(%r5),0x01		# devno valid?
+	bno   0(%r14)
+	la    %r6,ipl_parameter_flags-.LPG2(%r12)
+	oi    3(%r6),0x01		# set flag
+	la    %r2,ipl_devno-.LPG2(%r12)
+	mvc   0(2,%r2),6(%r5)		# store devno
+	tm    4(%r5),0x80		# qdio capable device?
+	bno   0(%r14)
+	oi    3(%r6),0x02		# set flag
+
+	# copy ipl parameters
+
+	lhi   %r0,4096
+	l     %r2,20(%r0)		# get address of parameter list
+	lhi   %r3,IPL_PARMBLOCK_ORIGIN
+	st    %r3,20(%r0)
+	lhi   %r4,1
+	cr    %r2,%r3			# start parameters < destination ?
+	jl    0f
+	lhi   %r1,1			# copy direction is upwards
+	j     1f
+0:	lhi   %r1,-1			# copy direction is downwards
+	ar    %r2,%r0
+	ar    %r3,%r0
+	ar    %r2,%r1
+	ar    %r3,%r1
+1:	mvc   0(1,%r3),0(%r2)		# finally copy ipl parameters
+	ar    %r3,%r1
+	ar    %r2,%r1
+	sr    %r0,%r4
+	jne   1b
+	b     0(%r14)
+
+	.align 4
+.Lipl_schib:
+	.rept 13
+	.long 0
+	.endr
+
+	.globl ipl_parameter_flags
+ipl_parameter_flags:
+	.long 0
+	.globl ipl_devno
+ipl_devno:
+	.word 0
+
 #ifdef CONFIG_SHARED_KERNEL
 	.org   0x100000
 #endif
@@ -755,7 +817,7 @@ _pend:	
 #
         .globl _stext
 _stext:	basr  %r13,0                    # get base
-.LPG2:
+.LPG3:
 #
 # Setup stack
 #
@@ -774,7 +836,7 @@ _stext:	basr  %r13,0                    
         lctlg  %c0,%c15,0(%r15)
 
 #
-        lam    0,15,.Laregs-.LPG2(%r13) # load access regs needed by uaccess
+        lam    0,15,.Laregs-.LPG3(%r13) # load access regs needed by uaccess
         brasl  %r14,start_kernel        # go to C code
 #
 # We returned from start_kernel ?!? PANIK
arch/s390/kernel/head.S +67 -5

105 lines not on this page · raw message

arch/s390/kernel/setup.c +67 -0

70 lines not on this page · raw message

include/asm-s390/setup.h +44 -0

61 lines not on this page · raw message

#1 lore raw
Quoted 6 lines · Martin Schwidefsky

[patch 6/7] s390: ipl device.

From: Heiko Carstens <[email protected]>

Export the ipl device settings to userspace via the sysfs:
* /sys/kernel/ipl_device

What? Why that location? Why not in the proper location for your device, on your bus?

Quoted 5 lines

Contains a string in on of the following formats:
1) "ccw <bus_id>", or 2) "fcp <bus_id>,<wwpn>,<lun>".
* /sys/kernel/ipl_parameter
is a binary interface that exports the ipl parameter block for scsi ipl. For non-scsi ipl the ipl_paramter is irrelevant.

Again, put this in your device directory, not in /sys/kernel/

Quoted 12 lines
arch/s390/kernel/setup.c +12 -0
+static ssize_t
+ipl_device_show(struct subsystem *subsys, char *page)
+{
+	struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START;
+
+	if (!IPL_DEVNO_VALID)
+		goto type_unknown;
+	if (!IPL_PARMBLOCK_VALID)
+		goto type_ccw;
+	if (ipl->hdr.header.version > IPL_MAX_SUPPORTED_VERSION)
+		goto type_unknown;
+	if (ipl->fcp.pbt != IPL_TYPE_FCP)

arch/s390/kernel/setup.c struct seq_operations cpuinfo_op = { · line 737

Quoted 10 lines
arch/s390/kernel/setup.c +10 -0
+		goto type_unknown;
+
+	return sprintf(page, "fcp 0.0.%04x,0x%016llx,0x%016llx\n",
+		       ipl->fcp.devno,
+		       (unsigned long long) ipl->fcp.wwpn,
+		       (unsigned long long) ipl->fcp.lun);
+ type_unknown:
+	return sprintf(page, "unknown\n");
+ type_ccw:
+	return sprintf(page, "ccw 0.0.%04x\n",ipl_devno);

That doesn't look like a "single value" from a single file there. Can't you break that up into individual files, based on what exactly is present at the time?

thanks,

greg k-h

#2 lore raw
Quoted 4 lines
Quoted 2 lines

Export the ipl device settings to userspace via the sysfs:
* /sys/kernel/ipl_device

What? Why that location? Why not in the proper location for your device, on your bus?

This interface tells from where the kernel was booted from. I don't think a device should have an attribute where the meaning would be "the current running kernel came via this device into memory". IMHO this should be an attribute of the kernel and therefore I thought /sys/kernel would be a good idea.

Quoted 6 lines
Quoted 5 lines

Contains a string in on of the following formats:
1) "ccw <bus_id>", or 2) "fcp <bus_id>,<wwpn>,<lun>".
* /sys/kernel/ipl_parameter
is a binary interface that exports the ipl parameter block for scsi ipl. For non-scsi ipl the ipl_paramter is irrelevant.

Again, put this in your device directory, not in /sys/kernel/

Same here.

Quoted 18 lines
Quoted 18 lines
arch/s390/kernel/setup.c +18 -0
+static ssize_t
+ipl_device_show(struct subsystem *subsys, char *page)
+{
+	struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START;
+
+	if (!IPL_DEVNO_VALID)
+		goto type_unknown;
+	if (!IPL_PARMBLOCK_VALID)
+		goto type_ccw;
+	if (ipl->hdr.header.version > IPL_MAX_SUPPORTED_VERSION)
+		goto type_unknown;
+	if (ipl->fcp.pbt != IPL_TYPE_FCP)
+		goto type_unknown;
+
+	return sprintf(page, "fcp 0.0.%04x,0x%016llx,0x%016llx\n",
+		       ipl->fcp.devno,
+		       (unsigned long long) ipl->fcp.wwpn,
+		       (unsigned long long) ipl->fcp.lun);
Quoted 8 lines

arch/s390/kernel/setup.c struct seq_operations cpuinfo_op = { · line 737

Quoted 4 lines

+ type_unknown:

arch/s390/kernel/setup.c +3 -0
+	return sprintf(page, "unknown\n");
+ type_ccw:
+	return sprintf(page, "ccw 0.0.%04x\n",ipl_devno);

That doesn't look like a "single value" from a single file there. Can't you break that up into individual files, based on what exactly is present at the time?

Sure, so I would end up with quite a few files:
always a file which tells the type of ipl e.g. ipl_type and dependent on that additionally:
- in case of ccw ipl:
just the bus_id of the ipl device (e.g. ipl_bus_id).
- in case of fcp ipl:
the bus_id, the wwpn and the fcp_lun all exported via different files.

Does that sound reasonable?

Heiko

#3 lore raw
Quoted 10 lines · Heiko Carstens
Quoted 4 lines
Quoted 2 lines

Export the ipl device settings to userspace via the sysfs:
* /sys/kernel/ipl_device

What? Why that location? Why not in the proper location for your device, on your bus?

This interface tells from where the kernel was booted from. I don't think a device should have an attribute where the meaning would be "the current running kernel came via this device into memory". IMHO this should be an attribute of the kernel and therefore I thought /sys/kernel would be a good idea.

If the additional ipl information is bound to the ipl device then we'd have to search for the device if we'd want to get the ipl information. And if we ever want to make /sys/kernel/ipl_device writable to be able to change the ipl_device for a reboot then what? Have the ipl related sysfs files for ALL devices you can ipl from to be able to move to another device? I think we need a central place for this information.

Signature · 6 lines
blue skies,
   Martin

Martin Schwidefsky
Linux for zSeries Development & Services
IBM Deutschland Entwicklung GmbH
#4 lore raw
In reply to Heiko Carstens
Quoted 6 lines · Heiko Carstens
Quoted 4 lines
Quoted 2 lines

Export the ipl device settings to userspace via the sysfs:
* /sys/kernel/ipl_device

What? Why that location? Why not in the proper location for your device, on your bus?

This interface tells from where the kernel was booted from.

Then why not use /sys/firmware/ipl/ ? That matches the /sys/firmware/edd usage we currently have on x86 boxes.

Quoted 27 lines
Quoted 18 lines
Quoted 18 lines
arch/s390/kernel/setup.c +18 -0
+static ssize_t
+ipl_device_show(struct subsystem *subsys, char *page)
+{
+	struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START;
+
+	if (!IPL_DEVNO_VALID)
+		goto type_unknown;
+	if (!IPL_PARMBLOCK_VALID)
+		goto type_ccw;
+	if (ipl->hdr.header.version > IPL_MAX_SUPPORTED_VERSION)
+		goto type_unknown;
+	if (ipl->fcp.pbt != IPL_TYPE_FCP)
+		goto type_unknown;
+
+	return sprintf(page, "fcp 0.0.%04x,0x%016llx,0x%016llx\n",
+		       ipl->fcp.devno,
+		       (unsigned long long) ipl->fcp.wwpn,
+		       (unsigned long long) ipl->fcp.lun);
Quoted 8 lines

arch/s390/kernel/setup.c struct seq_operations cpuinfo_op = { · line 737

Quoted 4 lines

+ type_unknown:

arch/s390/kernel/setup.c +3 -0
+	return sprintf(page, "unknown\n");
+ type_ccw:
+	return sprintf(page, "ccw 0.0.%04x\n",ipl_devno);

That doesn't look like a "single value" from a single file there. Can't you break that up into individual files, based on what exactly is present at the time?

Quoted 1 line

Sure, so I would end up with quite a few files:

That's fine to have.

Quoted 8 lines

always a file which tells the type of ipl e.g. ipl_type and dependent on that additionally:
- in case of ccw ipl:
just the bus_id of the ipl device (e.g. ipl_bus_id).
- in case of fcp ipl:
the bus_id, the wwpn and the fcp_lun all exported via different files.

Does that sound reasonable?

Yes.

thanks,

greg k-h

#5 lore raw
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Export the ipl device settings to userspace via the sysfs:
* /sys/kernel/ipl_device

What? Why that location? Why not in the proper location for your device, on your bus?

This interface tells from where the kernel was booted from.

Then why not use /sys/firmware/ipl/ ? That matches the /sys/firmware/edd usage we currently have on x86 boxes.

Ok, I will do the changes. Thanks for reviewing!

Heiko