public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: [patch 10/47] cio: I/O subchannel specific fields.
Date: Thu, 20 Dec 2007 16:19:35 +0100	[thread overview]
Message-ID: <20071220152105.138785512@de.ibm.com> (raw)
In-Reply-To: 20071220151925.405881218@de.ibm.com

[-- Attachment #1: 109-cio-fields.diff --]
[-- Type: text/plain, Size: 8695 bytes --]

From: Cornelia Huck <cornelia.huck@de.ibm.com>

Some fields may be !0 only for I/O subchannels. Add some checks
where required. Also adapt cio_enable_subchannel() to make the
caller specify the intparm, which makes it more generic.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---

 drivers/s390/cio/chsc.c       |    5 +++--
 drivers/s390/cio/cio.c        |   24 ++++++++++++------------
 drivers/s390/cio/cio.h        |    4 ++--
 drivers/s390/cio/css.c        |   18 ++++++++++++++++--
 drivers/s390/cio/css.h        |    2 ++
 drivers/s390/cio/device_fsm.c |    9 ++++++---
 drivers/s390/cio/device_ops.c |    2 +-
 7 files changed, 42 insertions(+), 22 deletions(-)

Index: quilt-2.6/drivers/s390/cio/chsc.c
===================================================================
--- quilt-2.6.orig/drivers/s390/cio/chsc.c
+++ quilt-2.6/drivers/s390/cio/chsc.c
@@ -89,7 +89,8 @@ int chsc_get_ssd_info(struct subchannel_
 	/* Copy data */
 	ret = 0;
 	memset(ssd, 0, sizeof(struct chsc_ssd_info));
-	if ((ssd_area->st != 0) && (ssd_area->st != 2))
+	if ((ssd_area->st != SUBCHANNEL_TYPE_IO) &&
+	    (ssd_area->st != SUBCHANNEL_TYPE_MSG))
 		goto out_free;
 	ssd->path_mask = ssd_area->path_mask;
 	ssd->fla_valid_mask = ssd_area->fla_valid_mask;
@@ -158,7 +159,7 @@ s390_subchannel_remove_chpid(struct devi
 	spin_lock_irq(sch->lock);
 
 	stsch(sch->schid, &schib);
-	if (!schib.pmcw.dnv)
+	if (!css_sch_is_valid(&schib))
 		goto out_unreg;
 	memcpy(&sch->schib, &schib, sizeof(struct schib));
 	/* Check for single path devices. */
Index: quilt-2.6/drivers/s390/cio/cio.c
===================================================================
--- quilt-2.6.orig/drivers/s390/cio/cio.c
+++ quilt-2.6/drivers/s390/cio/cio.c
@@ -406,8 +406,8 @@ cio_modify (struct subchannel *sch)
 /*
  * Enable subchannel.
  */
-int
-cio_enable_subchannel (struct subchannel *sch, unsigned int isc)
+int cio_enable_subchannel(struct subchannel *sch, unsigned int isc,
+			  u32 intparm)
 {
 	char dbf_txt[15];
 	int ccode;
@@ -426,7 +426,7 @@ cio_enable_subchannel (struct subchannel
 	for (retry = 5, ret = 0; retry > 0; retry--) {
 		sch->schib.pmcw.ena = 1;
 		sch->schib.pmcw.isc = isc;
-		sch->schib.pmcw.intparm = (u32)(addr_t)sch;
+		sch->schib.pmcw.intparm = intparm;
 		ret = cio_modify(sch);
 		if (ret == -ENODEV)
 			break;
@@ -577,11 +577,8 @@ cio_validate_subchannel (struct subchann
 	}
 
 	/* Initialization for io subchannels. */
-	if (!sch->schib.pmcw.dnv) {
-		/* io subchannel but device number is invalid. */
-		err = -ENODEV;
-		goto out;
-	}
+	if (!css_sch_is_valid(&sch->schib))
+		return -ENODEV;
 	/* Devno is valid. */
 	if (is_blacklisted (sch->schid.ssid, sch->schib.pmcw.dev)) {
 		/*
@@ -745,9 +742,9 @@ cio_test_for_console(struct subchannel_i
 {
 	if (stsch_err(schid, &console_subchannel.schib) != 0)
 		return -ENXIO;
-	if (console_subchannel.schib.pmcw.dnv &&
-	    console_subchannel.schib.pmcw.dev ==
-	    console_devno) {
+	if ((console_subchannel.schib.pmcw.st == SUBCHANNEL_TYPE_IO) &&
+	    console_subchannel.schib.pmcw.dnv &&
+	    (console_subchannel.schib.pmcw.dev == console_devno)) {
 		console_irq = schid.sch_no;
 		return 1; /* found */
 	}
@@ -765,6 +762,7 @@ cio_get_console_sch_no(void)
 		/* VM provided us with the irq number of the console. */
 		schid.sch_no = console_irq;
 		if (stsch(schid, &console_subchannel.schib) != 0 ||
+		    (console_subchannel.schib.pmcw.st != SUBCHANNEL_TYPE_IO) ||
 		    !console_subchannel.schib.pmcw.dnv)
 			return -1;
 		console_devno = console_subchannel.schib.pmcw.dev;
@@ -1029,7 +1027,7 @@ static int __reipl_subchannel_match(stru
 
 	if (stsch_reset(schid, &schib))
 		return -ENXIO;
-	if (schib.pmcw.dnv &&
+	if ((schib.pmcw.st == SUBCHANNEL_TYPE_IO) && schib.pmcw.dnv &&
 	    (schib.pmcw.dev == match_id->devid.devno) &&
 	    (schid.ssid == match_id->devid.ssid)) {
 		match_id->schid = schid;
@@ -1075,6 +1073,8 @@ int __init cio_get_iplinfo(struct cio_ip
 		return -ENODEV;
 	if (stsch(schid, &schib))
 		return -ENODEV;
+	if (schib.pmcw.st != SUBCHANNEL_TYPE_IO)
+		return -ENODEV;
 	if (!schib.pmcw.dnv)
 		return -ENODEV;
 	iplinfo->devno = schib.pmcw.dev;
Index: quilt-2.6/drivers/s390/cio/cio.h
===================================================================
--- quilt-2.6.orig/drivers/s390/cio/cio.h
+++ quilt-2.6/drivers/s390/cio/cio.h
@@ -60,7 +60,7 @@ struct subchannel {
 	enum {
 		SUBCHANNEL_TYPE_IO = 0,
 		SUBCHANNEL_TYPE_CHSC = 1,
-		SUBCHANNEL_TYPE_MESSAGE = 2,
+		SUBCHANNEL_TYPE_MSG = 2,
 		SUBCHANNEL_TYPE_ADM = 3,
 	} st;			/* subchannel type */
 
@@ -85,7 +85,7 @@ struct subchannel {
 #define to_subchannel(n) container_of(n, struct subchannel, dev)
 
 extern int cio_validate_subchannel (struct subchannel *, struct subchannel_id);
-extern int cio_enable_subchannel (struct subchannel *, unsigned int);
+extern int cio_enable_subchannel(struct subchannel *, unsigned int, u32);
 extern int cio_disable_subchannel (struct subchannel *);
 extern int cio_cancel (struct subchannel *);
 extern int cio_clear (struct subchannel *);
Index: quilt-2.6/drivers/s390/cio/css.c
===================================================================
--- quilt-2.6.orig/drivers/s390/cio/css.c
+++ quilt-2.6/drivers/s390/cio/css.c
@@ -237,11 +237,25 @@ get_subchannel_by_schid(struct subchanne
 	return dev ? to_subchannel(dev) : NULL;
 }
 
+/**
+ * css_sch_is_valid() - check if a subchannel is valid
+ * @schib: subchannel information block for the subchannel
+ */
+int css_sch_is_valid(struct schib *schib)
+{
+	if ((schib->pmcw.st == SUBCHANNEL_TYPE_IO) && !schib->pmcw.dnv)
+		return 0;
+	return 1;
+}
+EXPORT_SYMBOL_GPL(css_sch_is_valid);
+
 static int css_get_subchannel_status(struct subchannel *sch)
 {
 	struct schib schib;
 
-	if (stsch(sch->schid, &schib) || !schib.pmcw.dnv)
+	if (stsch(sch->schid, &schib))
+		return CIO_GONE;
+	if (!css_sch_is_valid(&schib))
 		return CIO_GONE;
 	if (sch->schib.pmcw.dnv && (schib.pmcw.dev != sch->schib.pmcw.dev))
 		return CIO_REVALIDATE;
@@ -349,7 +363,7 @@ static int css_evaluate_new_subchannel(s
 		/* Will be done on the slow path. */
 		return -EAGAIN;
 	}
-	if (stsch_err(schid, &schib) || !schib.pmcw.dnv) {
+	if (stsch_err(schid, &schib) || !css_sch_is_valid(&schib)) {
 		/* Unusable - ignore. */
 		return 0;
 	}
Index: quilt-2.6/drivers/s390/cio/css.h
===================================================================
--- quilt-2.6.orig/drivers/s390/cio/css.h
+++ quilt-2.6/drivers/s390/cio/css.h
@@ -136,6 +136,8 @@ void css_schedule_eval(struct subchannel
 void css_schedule_eval_all(void);
 
 int sch_is_pseudo_sch(struct subchannel *);
+struct schib;
+int css_sch_is_valid(struct schib *);
 
 extern struct workqueue_struct *slow_path_wq;
 
Index: quilt-2.6/drivers/s390/cio/device_fsm.c
===================================================================
--- quilt-2.6.orig/drivers/s390/cio/device_fsm.c
+++ quilt-2.6/drivers/s390/cio/device_fsm.c
@@ -553,7 +553,8 @@ ccw_device_recognition(struct ccw_device
 	    (cdev->private->state != DEV_STATE_BOXED))
 		return -EINVAL;
 	sch = to_subchannel(cdev->dev.parent);
-	ret = cio_enable_subchannel(sch, sch->schib.pmcw.isc);
+	ret = cio_enable_subchannel(sch, sch->schib.pmcw.isc,
+				    (u32)(addr_t)sch);
 	if (ret != 0)
 		/* Couldn't enable the subchannel for i/o. Sick device. */
 		return ret;
@@ -663,7 +664,8 @@ ccw_device_online(struct ccw_device *cde
 	sch = to_subchannel(cdev->dev.parent);
 	if (css_init_done && !get_device(&cdev->dev))
 		return -ENODEV;
-	ret = cio_enable_subchannel(sch, sch->schib.pmcw.isc);
+	ret = cio_enable_subchannel(sch, sch->schib.pmcw.isc,
+				    (u32)(addr_t)sch);
 	if (ret != 0) {
 		/* Couldn't enable the subchannel for i/o. Sick device. */
 		if (ret == -ENODEV)
@@ -1043,7 +1045,8 @@ ccw_device_start_id(struct ccw_device *c
 	struct subchannel *sch;
 
 	sch = to_subchannel(cdev->dev.parent);
-	if (cio_enable_subchannel(sch, sch->schib.pmcw.isc) != 0)
+	if (cio_enable_subchannel(sch, sch->schib.pmcw.isc,
+				  (u32)(addr_t)sch) != 0)
 		/* Couldn't enable the subchannel for i/o. Sick device. */
 		return;
 
Index: quilt-2.6/drivers/s390/cio/device_ops.c
===================================================================
--- quilt-2.6.orig/drivers/s390/cio/device_ops.c
+++ quilt-2.6/drivers/s390/cio/device_ops.c
@@ -501,7 +501,7 @@ ccw_device_stlck(struct ccw_device *cdev
 		return -ENOMEM;
 	}
 	spin_lock_irqsave(sch->lock, flags);
-	ret = cio_enable_subchannel(sch, 3);
+	ret = cio_enable_subchannel(sch, 3, (u32)(addr_t)sch);
 	if (ret)
 		goto out_unlock;
 	/*

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.


  parent reply	other threads:[~2007-12-20 15:26 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-20 15:19 [patch 00/47] s390 2.6.25 patch queue Martin Schwidefsky
2007-12-20 15:19 ` [patch 01/47] Cleanup in Documentation/kernel-parameters.txt Martin Schwidefsky
2007-12-20 15:19 ` [patch 02/47] cio: Dump ccw device information in case of timeout Martin Schwidefsky
2007-12-20 15:19 ` [patch 03/47] cio: Use helpers instead of container_of() Martin Schwidefsky
2007-12-20 15:19 ` [patch 04/47] cio: css_driver: Use consistent parameters Martin Schwidefsky
2007-12-20 15:19 ` [patch 05/47] cio: Reset sch->driver Martin Schwidefsky
2007-12-20 15:19 ` [patch 06/47] cio: Add css_driver_{register,unregister} Martin Schwidefsky
2007-12-20 15:19 ` [patch 07/47] cio: Cleanup debug feature usage Martin Schwidefsky
2007-12-20 15:19 ` [patch 08/47] cio: Introduce subchannel->private Martin Schwidefsky
2007-12-20 15:19 ` [patch 09/47] cio: Extend adapter interrupt interface Martin Schwidefsky
2007-12-20 15:19 ` Martin Schwidefsky [this message]
2007-12-20 15:19 ` [patch 11/47] cio: Use dev_{g,s}et_drvdata() Martin Schwidefsky
2007-12-20 15:19 ` [patch 12/47] cio: Set driver->owner on css, ccw and ccwgroup busses Martin Schwidefsky
2007-12-20 15:19 ` [patch 13/47] cio: reduce cpu utilization during device scan Martin Schwidefsky
2007-12-20 15:19 ` [patch 14/47] qdio: Remove double checked value Martin Schwidefsky
2007-12-20 15:19 ` [patch 15/47] qdio: set QDIO_ACTIVATE_TIMEOUT to 5s Martin Schwidefsky
2007-12-20 15:19 ` [patch 16/47] sclp: sysfs interface for SCLP cpi Martin Schwidefsky
2007-12-20 15:19 ` [patch 17/47] Standby cpu activation/deactivation Martin Schwidefsky
2007-12-20 15:19 ` [patch 18/47] sclp: convert channel path configure code to use sync interface Martin Schwidefsky
2007-12-20 15:19 ` [patch 19/47] Optimize reference bit handling Martin Schwidefsky
2007-12-20 15:19 ` [patch 20/47] Fix tlb flushing with idte Martin Schwidefsky
2007-12-20 15:19 ` [patch 21/47] Change vmalloc defintions Martin Schwidefsky
2007-12-20 15:19 ` [patch 22/47] Print kernel version in dump_stack() and show_regs() Martin Schwidefsky
2007-12-20 15:19 ` [patch 23/47] Get rid of HOLES_IN_ZONE requirement Martin Schwidefsky
2007-12-20 15:19 ` [patch 24/47] DEBUG_PAGEALLOC support for s390 Martin Schwidefsky
2007-12-20 15:19 ` [patch 25/47] Remove owner_pc member from raw_spinlock_t Martin Schwidefsky
2007-12-20 15:19 ` [patch 26/47] Use new style spinlock initializer in __RWSEM_INITIALIZER Martin Schwidefsky
2007-12-20 15:19 ` [patch 27/47] Get rid of additional_cpus kernel parameter Martin Schwidefsky
2007-12-20 15:19 ` [patch 28/47] Remove appldata include from sysctl_check.c Martin Schwidefsky
2007-12-20 15:19 ` [patch 29/47] crypto: move s390 Kconfig options Martin Schwidefsky
2007-12-20 15:19 ` [patch 30/47] dasd: fix return value of dasd_generic_probe() Martin Schwidefsky
2007-12-20 15:19 ` [patch 31/47] arch/s390: Add missing "space" Martin Schwidefsky
2007-12-20 15:19 ` [patch 32/47] drivers/s390: " Martin Schwidefsky
2007-12-20 15:19 ` [patch 33/47] kernel: Shutdown Actions Interface Martin Schwidefsky
2007-12-20 15:19 ` [patch 34/47] Load disabled wait psw instead of stopping cpu on halt Martin Schwidefsky
2007-12-20 15:20 ` [patch 35/47] use LIST_HEAD instead of LIST_HEAD_INIT Martin Schwidefsky
2007-12-20 15:20 ` [patch 36/47] Allocate and free cpu lowcores and stacks when needed/possible Martin Schwidefsky
2007-12-20 15:20 ` [patch 37/47] Initialize sclp_ipl_info Martin Schwidefsky
2007-12-20 15:20 ` [patch 38/47] vmemmap: allocate struct pages before 1:1 mapping Martin Schwidefsky
2007-12-20 15:20 ` [patch 39/47] Use diag308 subcodes 3 and 6 for reboot and dump when possible Martin Schwidefsky
2007-12-20 15:20 ` [patch 40/47] arch/s390/: Spelling fixes Martin Schwidefsky
2007-12-20 15:20 ` [patch 41/47] include/asm-s390/: " Martin Schwidefsky
2007-12-20 15:20 ` [patch 42/47] drivers/s390/: " Martin Schwidefsky
2007-12-20 15:20 ` [patch 43/47] Move NOTES and BUG_TABLE Martin Schwidefsky
2007-12-20 15:20 ` [patch 44/47] single-step cleanup Martin Schwidefsky
2007-12-20 15:20 ` [patch 45/47] dasd: add hyper PAV support to DASD device driver, part 1 Martin Schwidefsky
2007-12-20 15:20 ` [patch 46/47] dasd: add hyper PAV support to DASD device driver, part 2 Martin Schwidefsky
2007-12-20 15:20 ` [patch 47/47] dasd: add hyper PAV support to DASD device driver, part 3 Martin Schwidefsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071220152105.138785512@de.ibm.com \
    --to=schwidefsky@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox