File s390-tools-sles11sp3-add_lsscm.patch of Package s390-tools
Subject: [PATCH] [FEAT LS1004] s390: Allow SCM access via EADM subchannels
From: Sebastian Ott <sebott@linux.vnet.ibm.com>
Summary: s390: Allow SCM access via EADM subchannels
Description: With this feature, Linux can access Storage Class
Memory as a block device.
Upstream-ID: -
Problem-ID: LS1004
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
---
zconf/Makefile | 4 +--
zconf/lsscm | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
zconf/lsscm.8 | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 143 insertions(+), 2 deletions(-)
--- a/zconf/Makefile
+++ b/zconf/Makefile
@@ -4,11 +4,11 @@
include ../common.mak
SCRIPTS = lsdasd lstape lscss chccwdev lsqeth lszfcp lschp chchp lszcrypt \
- chzcrypt cio_ignore znetconf dasdstat
+ chzcrypt cio_ignore znetconf dasdstat lsscm
USRSBIN_SCRIPTS = lsmem chmem lsluns
MANPAGES= lsdasd.8 lstape.8 lscss.8 chccwdev.8 lsqeth.8 lszfcp.8 lschp.8 \
chchp.8 lszcrypt.8 chzcrypt.8 lsluns.8 cio_ignore.8 znetconf.8 \
- chmem.8 lsmem.8 dasdstat.8
+ chmem.8 lsmem.8 dasdstat.8 lsscm.8
all:
--- /dev/null
+++ b/zconf/lsscm
@@ -0,0 +1,74 @@
+#!/bin/bash
+
+CMD=${0##*/}
+VERSION="%S390_TOOLS_VERSION%"
+
+function print_help()
+{
+ cat <<-EOD
+Usage: $CMD <options>
+
+List information about available Storage Class Memory Increments.
+
+-h, --help Print this help, then exit
+-v, --version Print version information, then exit
+EOD
+}
+
+function print_version()
+{
+ echo -ne "$CMD: version $VERSION\nCopyright IBM Corp. 2012\n"
+}
+
+
+# Parse command line parameters
+while [ $# -gt 0 ]; do
+ case $1 in
+ -h|--help)
+ print_help
+ exit 0
+ ;;
+ -v|--version)
+ print_version
+ exit 0
+ ;;
+ -*|--*)
+ echo "$CMD: Invalid option $1" >&2
+ echo "Try '$CMD --help' for more information." >&2
+ exit 1
+ ;;
+ *)
+ echo "$CMD: Invalid argument $1" >&2
+ echo "Try '$CMD --help' for more information." >&2
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+
+echo "SCM Increment Size Name Rank D_state O_state Pers ResID"
+echo "--------------------------------------------------------------"
+find /sys/bus/scm/devices/ -type l 2> /dev/null | sort -t/ -k6 |
+while read SCM ;do
+ ADDR=${SCM##*/}
+ BLKDIR=$SCM/block/scm*
+ if [ -d $BLKDIR ] ;then
+ set - $BLKDIR
+ NAME=${1##*/}
+ else
+ NAME="N/A"
+ fi
+
+ read SIZE 2> /dev/null < $BLKDIR/size || SIZE=0
+ SIZE=$((SIZE/2048)) # (SIZE * 512) / 1024^2
+
+ read RANK 2> /dev/null < $SCM/rank || continue
+ read DSTATE 2> /dev/null < $SCM/data_state || continue
+ read OSTATE 2> /dev/null < $SCM/oper_state || continue
+ read PERS 2> /dev/null < $SCM/persistence || continue
+ read RES 2> /dev/null < $SCM/res_id || continue
+
+ printf "%s %5sMB %-5.5s %4d %7d %7d %4d %5d\n" \
+ "$ADDR" "$SIZE" "$NAME" "$RANK" "$DSTATE" "$OSTATE" "$PERS" "$RES"
+done
--- /dev/null
+++ b/zconf/lsscm.8
@@ -0,0 +1,67 @@
+.TH LSCHP 8 "Jul 2012" s390\-tools
+
+.SH NAME
+lsscm \- list information about available Storage Class Memory Increments.
+
+.SH SYNOPSIS
+.B lsscm
+.RB [ \-h|\-\-help ]
+.RB [ \-v|\-\-version ]
+
+.SH DESCRIPTION
+The lsscm command lists status and information about available
+Storage Class Memory Increments.
+
+.B Column description:
+
+SCM Increment
+.RS
+Starting address of the SCM increment.
+.RE
+
+Size
+.RS
+Size of the block device representing the SCM increment.
+.RE
+
+Name
+.RS
+Name of the block device representing the SCM increment.
+.RE
+
+Rank
+.RS
+Rank (conceptual quality) of the SCM increment.
+.RE
+
+D_state
+.RS
+Data state of the SCM increment.
+.RE
+
+O_state
+.RS
+Operation state of the SCM increment.
+.RE
+
+Pers
+.RS
+Persistence attribute.
+.RE
+
+ResID
+.RS
+Resource identifier.
+.RE
+
+
+.SH OPTIONS
+.B \-h | \-\-help
+.RS
+Print a short help text, then exit.
+.RE
+
+.B \-v | \-\-version
+.RS
+Print version number, then exit.
+.RE