Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755942Ab0BXItU (ORCPT ); Wed, 24 Feb 2010 03:49:20 -0500 Received: from mtagate3.de.ibm.com ([195.212.17.163]:33021 "EHLO mtagate3.de.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755661Ab0BXIov (ORCPT ); Wed, 24 Feb 2010 03:44:51 -0500 Message-Id: <20100224084449.732641600@de.ibm.com> User-Agent: quilt/0.48-1 Date: Wed, 24 Feb 2010 09:44:43 +0100 From: Martin Schwidefsky To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org Cc: Heiko Carstens , Martin Schwidefsky Subject: [patch 13/32] [PATCH] add MACHINE_IS_LPAR flag References: <20100224084430.193562869@de.ibm.com> Content-Disposition: inline; filename=112-lpar-machine-flag.diff Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4196 Lines: 107 From: Martin Schwidefsky Introduce the MACHINE_IS_LPAR flag for code that should only be executed if Linux is running in an LPAR. Signed-off-by: Martin Schwidefsky --- arch/s390/include/asm/setup.h | 3 +++ arch/s390/kernel/early.c | 9 ++++++--- arch/s390/kernel/setup.c | 4 ++-- drivers/s390/cio/cio.c | 2 +- drivers/s390/cio/qdio_main.c | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) Index: quilt-2.6/arch/s390/include/asm/setup.h =================================================================== --- quilt-2.6.orig/arch/s390/include/asm/setup.h 2010-02-24 09:28:13.000000000 +0100 +++ quilt-2.6/arch/s390/include/asm/setup.h 2010-02-24 09:44:25.000000000 +0100 @@ -71,9 +71,12 @@ #define MACHINE_FLAG_KVM (1UL << 9) #define MACHINE_FLAG_HPAGE (1UL << 10) #define MACHINE_FLAG_PFMF (1UL << 11) +#define MACHINE_FLAG_LPAR (1UL << 12) #define MACHINE_IS_VM (S390_lowcore.machine_flags & MACHINE_FLAG_VM) #define MACHINE_IS_KVM (S390_lowcore.machine_flags & MACHINE_FLAG_KVM) +#define MACHINE_IS_LPAR (S390_lowcore.machine_flags & MACHINE_FLAG_LPAR) + #define MACHINE_HAS_DIAG9C (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG9C) #ifndef __s390x__ Index: quilt-2.6/arch/s390/kernel/early.c =================================================================== --- quilt-2.6.orig/arch/s390/kernel/early.c 2010-02-24 09:28:13.000000000 +0100 +++ quilt-2.6/arch/s390/kernel/early.c 2010-02-24 09:44:25.000000000 +0100 @@ -214,10 +214,13 @@ static noinline __init void detect_machine_type(void) { - /* No VM information? Looks like LPAR */ - if (stsi(&vmms, 3, 2, 2) == -ENOSYS) + /* Check current-configuration-level */ + if ((stsi(NULL, 0, 0, 0) >> 28) <= 2) { + S390_lowcore.machine_flags |= MACHINE_FLAG_LPAR; return; - if (!vmms.count) + } + /* Get virtual-machine cpu information. */ + if (stsi(&vmms, 3, 2, 2) == -ENOSYS || !vmms.count) return; /* Running under KVM? If not we assume z/VM */ Index: quilt-2.6/arch/s390/kernel/setup.c =================================================================== --- quilt-2.6.orig/arch/s390/kernel/setup.c 2010-02-24 09:28:13.000000000 +0100 +++ quilt-2.6/arch/s390/kernel/setup.c 2010-02-24 09:44:25.000000000 +0100 @@ -804,7 +804,7 @@ if (MACHINE_IS_VM) pr_info("Linux is running as a z/VM " "guest operating system in 31-bit mode\n"); - else + else if (MACHINE_IS_LPAR) pr_info("Linux is running natively in 31-bit mode\n"); if (MACHINE_HAS_IEEE) pr_info("The hardware system has IEEE compatible " @@ -818,7 +818,7 @@ "guest operating system in 64-bit mode\n"); else if (MACHINE_IS_KVM) pr_info("Linux is running under KVM in 64-bit mode\n"); - else + else if (MACHINE_IS_LPAR) pr_info("Linux is running natively in 64-bit mode\n"); #endif /* CONFIG_64BIT */ Index: quilt-2.6/drivers/s390/cio/cio.c =================================================================== --- quilt-2.6.orig/drivers/s390/cio/cio.c 2010-02-24 09:28:13.000000000 +0100 +++ quilt-2.6/drivers/s390/cio/cio.c 2010-02-24 09:44:25.000000000 +0100 @@ -661,7 +661,7 @@ * We don't do this for VM because a tpi drops the cpu * out of the sie which costs more cycles than it saves. */ - } while (!MACHINE_IS_VM && tpi (NULL) != 0); + } while (MACHINE_IS_LPAR && tpi(NULL) != 0); irq_exit(); set_irq_regs(old_regs); } Index: quilt-2.6/drivers/s390/cio/qdio_main.c =================================================================== --- quilt-2.6.orig/drivers/s390/cio/qdio_main.c 2010-02-24 09:44:25.000000000 +0100 +++ quilt-2.6/drivers/s390/cio/qdio_main.c 2010-02-24 09:44:25.000000000 +0100 @@ -534,7 +534,7 @@ if ((bufnr != q->last_move) || q->qdio_error) { q->last_move = bufnr; - if (!is_thinint_irq(q->irq_ptr) && !MACHINE_IS_VM) + if (!is_thinint_irq(q->irq_ptr) && MACHINE_IS_LPAR) q->u.in.timestamp = get_usecs(); return 1; } else -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/