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: Heiko Carstens <heiko.carstens@de.ibm.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: [patch 04/16] sclp: Test facility list before executing a service call.
Date: Tue, 10 Jul 2007 11:29:39 +0200	[thread overview]
Message-ID: <20070710093106.788578966@de.ibm.com> (raw)
In-Reply-To: 20070710092935.896013926@de.ibm.com

[-- Attachment #1: 004-sclp-detect.diff --]
[-- Type: text/plain, Size: 3465 bytes --]

From: Heiko Carstens <heiko.carstens@de.ibm.com>

Check if a command is available before executing. Saves some
superfluous service calls that won't succeed anyway.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---

 arch/s390/kernel/early.c      |    1 +
 drivers/s390/char/sclp.h      |    5 +++++
 drivers/s390/char/sclp_chp.c  |    4 ++++
 drivers/s390/char/sclp_info.c |    9 +++++++++
 include/asm-s390/sclp.h       |    1 +
 5 files changed, 20 insertions(+)

Index: quilt-2.6/arch/s390/kernel/early.c
===================================================================
--- quilt-2.6.orig/arch/s390/kernel/early.c
+++ quilt-2.6/arch/s390/kernel/early.c
@@ -275,6 +275,7 @@ void __init startup_init(void)
 	sort_main_extable();
 	setup_lowcore_early();
 	sclp_readinfo_early();
+	sclp_facilities_detect();
 	memsize = sclp_memory_detect();
 #ifndef CONFIG_64BIT
 	/*
Index: quilt-2.6/drivers/s390/char/sclp_chp.c
===================================================================
--- quilt-2.6.orig/drivers/s390/char/sclp_chp.c
+++ quilt-2.6/drivers/s390/char/sclp_chp.c
@@ -55,6 +55,8 @@ static int do_configure(sclp_cmdw_t cmd)
 	struct chp_cfg_data *data;
 	int rc;
 
+	if (!SCLP_HAS_CHP_RECONFIG)
+		return -EOPNOTSUPP;
 	/* Prepare sccb. */
 	data = (struct chp_cfg_data *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
 	if (!data)
@@ -152,6 +154,8 @@ int sclp_chp_read_info(struct sclp_chp_i
 	struct chp_info_data *data;
 	int rc;
 
+	if (!SCLP_HAS_CHP_INFO)
+		return -EOPNOTSUPP;
 	/* Prepare sccb. */
 	data = (struct chp_info_data *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
 	if (!data)
Index: quilt-2.6/drivers/s390/char/sclp.h
===================================================================
--- quilt-2.6.orig/drivers/s390/char/sclp.h
+++ quilt-2.6/drivers/s390/char/sclp.h
@@ -79,6 +79,11 @@ struct sccb_header {
 	u16	response_code;
 } __attribute__((packed));
 
+extern u64 sclp_facilities;
+
+#define SCLP_HAS_CHP_INFO	(sclp_facilities & 0x8000000000000000ULL)
+#define SCLP_HAS_CHP_RECONFIG	(sclp_facilities & 0x2000000000000000ULL)
+
 struct gds_subvector {
 	u8	length;
 	u8	key;
Index: quilt-2.6/drivers/s390/char/sclp_info.c
===================================================================
--- quilt-2.6.orig/drivers/s390/char/sclp_info.c
+++ quilt-2.6/drivers/s390/char/sclp_info.c
@@ -30,6 +30,8 @@ struct sclp_readinfo_sccb {
 static struct sclp_readinfo_sccb __initdata early_readinfo_sccb;
 static int __initdata early_readinfo_sccb_valid;
 
+u64 sclp_facilities;
+
 void __init sclp_readinfo_early(void)
 {
 	int ret;
@@ -70,6 +72,13 @@ void __init sclp_readinfo_early(void)
 	__ctl_clear_bit(0, 9);
 }
 
+void __init sclp_facilities_detect(void)
+{
+	if (!early_readinfo_sccb_valid)
+		return;
+	sclp_facilities = early_readinfo_sccb.facilities;
+}
+
 unsigned long long __init sclp_memory_detect(void)
 {
 	unsigned long long memsize;
Index: quilt-2.6/include/asm-s390/sclp.h
===================================================================
--- quilt-2.6.orig/include/asm-s390/sclp.h
+++ quilt-2.6/include/asm-s390/sclp.h
@@ -28,6 +28,7 @@ struct sclp_ipl_info {
 };
 
 void sclp_readinfo_early(void);
+void sclp_facilities_detect(void);
 unsigned long long sclp_memory_detect(void);
 int sclp_sdias_blk_count(void);
 int sclp_sdias_copy(void *dest, int blk_num, int nr_blks);

-- 
blue skies,
   Martin.

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


  parent reply	other threads:[~2007-07-10  9:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-10  9:29 [patch 00/16] First s390 patchset for 2.6.22+ Martin Schwidefsky
2007-07-10  9:29 ` [patch 01/16] vmcp cleanup Martin Schwidefsky
2007-07-10  9:29 ` [patch 02/16] Fixed comment typo Martin Schwidefsky
2007-07-10  9:29 ` [patch 03/16] sclp: introduce some new interfaces Martin Schwidefsky
2007-07-10  9:29 ` Martin Schwidefsky [this message]
2007-07-10  9:29 ` [patch 05/16] fixed cdl-format detection Martin Schwidefsky
2007-07-10  9:29 ` [patch 06/16] zcore: Fix __user annotation Martin Schwidefsky
2007-07-10  9:29 ` [patch 07/16] smp: Merge smp_count_cpus() and smp_get_save_areas() Martin Schwidefsky
2007-07-10  9:29 ` [patch 08/16] Bogomips calculation for 64 bit Martin Schwidefsky
2007-07-10  9:29 ` [patch 09/16] Program check in diag 210 under 31 bit Martin Schwidefsky
2007-07-10  9:29 ` [patch 10/16] Remove volatile from atomic_t Martin Schwidefsky
2007-07-10  9:29 ` [patch 11/16] dasd: Avoid compile warnings on !CONFIG_DASD_PROFILE Martin Schwidefsky
2007-07-10  9:29 ` [patch 12/16] system call optimization Martin Schwidefsky
2007-07-10  9:29 ` [patch 13/16] zcrypt: fix request timeout handling Martin Schwidefsky
2007-07-10  9:29 ` [patch 14/16] cio: Remove prototype for non-existing function cmf_reset() Martin Schwidefsky
2007-07-10  9:29 ` [patch 15/16] s390: rename CPU_IDLE to S390_CPU_IDLE Martin Schwidefsky
2007-07-10  9:29 ` [patch 16/16] vmlogrdr function annotation 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=20070710093106.788578966@de.ibm.com \
    --to=schwidefsky@de.ibm.com \
    --cc=heiko.carstens@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