From nobody Mon Nov 25 04:28:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1716997524; cv=none; d=zohomail.com; s=zohoarc; b=EQAbb2gCu6yaYrbaDQ7X25fm0Wn28jZbHInijVUZmtqt0iIZY6/hTKi9LPQoBWKnScL/H/KXfqegFv/N0/yiI+9ktCoMjEyJop1R6twt98HH25xCGudszkEOhauSHCDUk16r4ii/iJV9FgR7COCL8zNGl5VGNaWRgWJ48gkXk4Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716997524; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0uj8fCPrcE3dkfxkzwTpsoNpZDQSGZ8G4hU3TEG/aI8=; b=BJE2nWr2IujiTru1gWS74KQF/OH7zu7ru5TyyjU+ABUD793LWFIV3NhzjI7vs76D7zQ8zjm7BLLdccnx/naLXI98yYHspu9x+ztoWPhqPErAaiqUjKmm7WC7uxikV+x3cTouQQWaCNfpHaAGQKaY5hWvIcGF8e4nqZ6KDYJCceE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1716997524478994.9732565378363; Wed, 29 May 2024 08:45:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCLSa-0005kB-0m; Wed, 29 May 2024 11:43:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCLSY-0005jH-LO; Wed, 29 May 2024 11:43:26 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCLSW-0006xG-Fr; Wed, 29 May 2024 11:43:26 -0400 Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44TFgIZ7007748; Wed, 29 May 2024 15:43:22 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ye77y002x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 May 2024 15:43:21 +0000 Received: from m0353727.ppops.net (m0353727.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 44TFhLaU008871; Wed, 29 May 2024 15:43:21 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ye77y002s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 May 2024 15:43:21 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 44TF6cPX009860; Wed, 29 May 2024 15:43:20 GMT Received: from smtprelay06.wdc07v.mail.ibm.com ([172.16.1.73]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3ydpbbmjmd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 May 2024 15:43:20 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 44TFhGLo21561892 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 May 2024 15:43:18 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2DA8758068; Wed, 29 May 2024 15:43:16 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B22EC58056; Wed, 29 May 2024 15:43:15 +0000 (GMT) Received: from t15.ibmuc.com (unknown [9.67.55.69]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 29 May 2024 15:43:15 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc : content-transfer-encoding : date : from : in-reply-to : message-id : mime-version : references : subject : to; s=pp1; bh=0uj8fCPrcE3dkfxkzwTpsoNpZDQSGZ8G4hU3TEG/aI8=; b=axD94VKjMNzTsft/AalLYBbuOdTH1g0LqBsTbosvH18jnoxWMEduyRDTwKFT8bpf4SO4 A6enMtlo/LnK80adC7RBHvol7AXLBtoJG1CUB3BD8E8tUygn2DR/S5A1JBA8xFZdU2CD D/VqbaiyZVipp9fXbtI002anhLe2ky55eswfKmk1aOSJ4wxEp5hG9/T/novA6lHD5pCH wZ6Nr0NcSuAfXPQ1agqyb1OESY/g3qkXRF+rf17IONE6WYFuC85knp8unkXfEPTX6GhP W+7fvHip6mLQo91BIPKlI5WoZddO1DdKzlCQ3rt7DBHcGl6nhiaghPXxP4XknBldP5FV CA== From: jrossi@linux.ibm.com To: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, thuth@redhat.com Cc: frankja@linux.ibm.com, nsg@linux.ibm.com, jrossi@linux.ibm.com Subject: [PATCH 1/5] s390x: Create include files for s390x IPL definitions Date: Wed, 29 May 2024 11:43:07 -0400 Message-Id: <20240529154311.734548-2-jrossi@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240529154311.734548-1-jrossi@linux.ibm.com> References: <20240529154311.734548-1-jrossi@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 37kZcM3bA8PnnopQIEns7sVvgooZytau X-Proofpoint-ORIG-GUID: LOom3WIN3kcKAJJVPa_EfmzoUHhEZWk- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-29_12,2024-05-28_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 bulkscore=0 adultscore=0 mlxscore=0 priorityscore=1501 mlxlogscore=999 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405290108 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.156.1; envelope-from=jrossi@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1716997525891100003 Content-Type: text/plain; charset="utf-8" From: Jared Rossi Currently, stuctures defined in both hw/s390x/ipl.h and pc-bios/s390-ccw/ip= lb.h must be kept in sync, which is prone to error. Instead, create a new direct= ory at include/hw/s390x/ipl/ to contain the definitions that must be shared. Signed-off-by: Jared Rossi --- hw/s390x/ipl.h | 113 +------------------------------- include/hw/s390x/ipl/qipl.h | 126 ++++++++++++++++++++++++++++++++++++ pc-bios/s390-ccw/iplb.h | 84 ++---------------------- pc-bios/s390-ccw/Makefile | 2 +- 4 files changed, 133 insertions(+), 192 deletions(-) create mode 100644 include/hw/s390x/ipl/qipl.h diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h index 57cd125769..b066d9e8e5 100644 --- a/hw/s390x/ipl.h +++ b/hw/s390x/ipl.h @@ -16,95 +16,11 @@ #include "cpu.h" #include "exec/address-spaces.h" #include "hw/qdev-core.h" +#include "hw/s390x/ipl/qipl.h" #include "qom/object.h" =20 -struct IPLBlockPVComp { - uint64_t tweak_pref; - uint64_t addr; - uint64_t size; -} QEMU_PACKED; -typedef struct IPLBlockPVComp IPLBlockPVComp; - -struct IPLBlockPV { - uint8_t reserved18[87]; /* 0x18 */ - uint8_t version; /* 0x6f */ - uint32_t reserved70; /* 0x70 */ - uint32_t num_comp; /* 0x74 */ - uint64_t pv_header_addr; /* 0x78 */ - uint64_t pv_header_len; /* 0x80 */ - struct IPLBlockPVComp components[0]; -} QEMU_PACKED; -typedef struct IPLBlockPV IPLBlockPV; - -struct IplBlockCcw { - uint8_t reserved0[85]; - uint8_t ssid; - uint16_t devno; - uint8_t vm_flags; - uint8_t reserved3[3]; - uint32_t vm_parm_len; - uint8_t nss_name[8]; - uint8_t vm_parm[64]; - uint8_t reserved4[8]; -} QEMU_PACKED; -typedef struct IplBlockCcw IplBlockCcw; - -struct IplBlockFcp { - uint8_t reserved1[305 - 1]; - uint8_t opt; - uint8_t reserved2[3]; - uint16_t reserved3; - uint16_t devno; - uint8_t reserved4[4]; - uint64_t wwpn; - uint64_t lun; - uint32_t bootprog; - uint8_t reserved5[12]; - uint64_t br_lba; - uint32_t scp_data_len; - uint8_t reserved6[260]; - uint8_t scp_data[0]; -} QEMU_PACKED; -typedef struct IplBlockFcp IplBlockFcp; - -struct IplBlockQemuScsi { - uint32_t lun; - uint16_t target; - uint16_t channel; - uint8_t reserved0[77]; - uint8_t ssid; - uint16_t devno; -} QEMU_PACKED; -typedef struct IplBlockQemuScsi IplBlockQemuScsi; - #define DIAG308_FLAGS_LP_VALID 0x80 =20 -union IplParameterBlock { - struct { - uint32_t len; - uint8_t reserved0[3]; - uint8_t version; - uint32_t blk0_len; - uint8_t pbt; - uint8_t flags; - uint16_t reserved01; - uint8_t loadparm[8]; - union { - IplBlockCcw ccw; - IplBlockFcp fcp; - IPLBlockPV pv; - IplBlockQemuScsi scsi; - }; - } QEMU_PACKED; - struct { - uint8_t reserved1[110]; - uint16_t devno; - uint8_t reserved2[88]; - uint8_t reserved_ext[4096 - 200]; - } QEMU_PACKED; -} QEMU_PACKED; -typedef union IplParameterBlock IplParameterBlock; - int s390_ipl_set_loadparm(uint8_t *loadparm); void s390_ipl_update_diag308(IplParameterBlock *iplb); int s390_ipl_prepare_pv_header(Error **errp); @@ -125,33 +41,6 @@ void s390_ipl_reset_request(CPUState *cs, enum s390_res= et reset_type); void s390_ipl_get_reset_request(CPUState **cs, enum s390_reset *reset_type= ); void s390_ipl_clear_reset_request(void); =20 -#define QIPL_ADDRESS 0xcc - -/* Boot Menu flags */ -#define QIPL_FLAG_BM_OPTS_CMD 0x80 -#define QIPL_FLAG_BM_OPTS_ZIPL 0x40 - -/* - * The QEMU IPL Parameters will be stored at absolute address - * 204 (0xcc) which means it is 32-bit word aligned but not - * double-word aligned. - * Placement of data fields in this area must account for - * their alignment needs. E.g., netboot_start_address must - * have an offset of 4 + n * 8 bytes within the struct in order - * to keep it double-word aligned. - * The total size of the struct must never exceed 28 bytes. - * This definition must be kept in sync with the definition - * in pc-bios/s390-ccw/iplb.h. - */ -struct QemuIplParameters { - uint8_t qipl_flags; - uint8_t reserved1[3]; - uint64_t netboot_start_addr; - uint32_t boot_menu_timeout; - uint8_t reserved2[12]; -} QEMU_PACKED; -typedef struct QemuIplParameters QemuIplParameters; - #define TYPE_S390_IPL "s390-ipl" OBJECT_DECLARE_SIMPLE_TYPE(S390IPLState, S390_IPL) =20 diff --git a/include/hw/s390x/ipl/qipl.h b/include/hw/s390x/ipl/qipl.h new file mode 100644 index 0000000000..a6ce6ddfe3 --- /dev/null +++ b/include/hw/s390x/ipl/qipl.h @@ -0,0 +1,126 @@ +/* + * S/390 boot structures + * + * Copyright 2024 IBM Corp. + * Author(s): Jared Rossi + * + * This work is licensed under the terms of the GNU GPL, version 2 or (at + * your option) any later version. See the COPYING file in the top-level + * directory. + */ + +#ifndef S390X_QIPL_H +#define S390X_QIPL_H + +/* Boot Menu flags */ +#define QIPL_FLAG_BM_OPTS_CMD 0x80 +#define QIPL_FLAG_BM_OPTS_ZIPL 0x40 + +#define QIPL_ADDRESS 0xcc +#define LOADPARM_LEN 8 + +/* + * The QEMU IPL Parameters will be stored at absolute address + * 204 (0xcc) which means it is 32-bit word aligned but not + * double-word aligned. + * Placement of data fields in this area must account for + * their alignment needs. E.g., netboot_start_address must + * have an offset of 4 + n * 8 bytes within the struct in order + * to keep it double-word aligned. + * The total size of the struct must never exceed 28 bytes. + */ +struct QemuIplParameters { + uint8_t qipl_flags; + uint8_t reserved1[3]; + uint64_t netboot_start_addr; + uint32_t boot_menu_timeout; + uint8_t reserved2[12]; +} QEMU_PACKED; +typedef struct QemuIplParameters QemuIplParameters; + +struct IPLBlockPVComp { + uint64_t tweak_pref; + uint64_t addr; + uint64_t size; +} QEMU_PACKED; +typedef struct IPLBlockPVComp IPLBlockPVComp; + +struct IPLBlockPV { + uint8_t reserved18[87]; /* 0x18 */ + uint8_t version; /* 0x6f */ + uint32_t reserved70; /* 0x70 */ + uint32_t num_comp; /* 0x74 */ + uint64_t pv_header_addr; /* 0x78 */ + uint64_t pv_header_len; /* 0x80 */ + struct IPLBlockPVComp components[0]; +} QEMU_PACKED; +typedef struct IPLBlockPV IPLBlockPV; + +struct IplBlockCcw { + uint8_t reserved0[85]; + uint8_t ssid; + uint16_t devno; + uint8_t vm_flags; + uint8_t reserved3[3]; + uint32_t vm_parm_len; + uint8_t nss_name[8]; + uint8_t vm_parm[64]; + uint8_t reserved4[8]; +} QEMU_PACKED; +typedef struct IplBlockCcw IplBlockCcw; + +struct IplBlockFcp { + uint8_t reserved1[305 - 1]; + uint8_t opt; + uint8_t reserved2[3]; + uint16_t reserved3; + uint16_t devno; + uint8_t reserved4[4]; + uint64_t wwpn; + uint64_t lun; + uint32_t bootprog; + uint8_t reserved5[12]; + uint64_t br_lba; + uint32_t scp_data_len; + uint8_t reserved6[260]; + uint8_t scp_data[0]; +} QEMU_PACKED; +typedef struct IplBlockFcp IplBlockFcp; + +struct IplBlockQemuScsi { + uint32_t lun; + uint16_t target; + uint16_t channel; + uint8_t reserved0[77]; + uint8_t ssid; + uint16_t devno; +} QEMU_PACKED; +typedef struct IplBlockQemuScsi IplBlockQemuScsi; + +union IplParameterBlock { + struct { + uint32_t len; + uint8_t reserved0[3]; + uint8_t version; + uint32_t blk0_len; + uint8_t pbt; + uint8_t flags; + uint16_t reserved01; + uint8_t loadparm[LOADPARM_LEN]; + union { + IplBlockCcw ccw; + IplBlockFcp fcp; + IPLBlockPV pv; + IplBlockQemuScsi scsi; + }; + } QEMU_PACKED; + struct { + uint8_t reserved1[110]; + uint16_t devno; + uint8_t reserved2[88]; + uint8_t reserved_ext[4096 - 200]; + } QEMU_PACKED; +} QEMU_PACKED; +typedef union IplParameterBlock IplParameterBlock; + +#endif diff --git a/pc-bios/s390-ccw/iplb.h b/pc-bios/s390-ccw/iplb.h index cb6ac8a880..16643f5879 100644 --- a/pc-bios/s390-ccw/iplb.h +++ b/pc-bios/s390-ccw/iplb.h @@ -12,88 +12,14 @@ #ifndef IPLB_H #define IPLB_H =20 -#define LOADPARM_LEN 8 +#ifndef QEMU_PACKED +#define QEMU_PACKED __attribute__((packed)) +#endif =20 -struct IplBlockCcw { - uint8_t reserved0[85]; - uint8_t ssid; - uint16_t devno; - uint8_t vm_flags; - uint8_t reserved3[3]; - uint32_t vm_parm_len; - uint8_t nss_name[8]; - uint8_t vm_parm[64]; - uint8_t reserved4[8]; -} __attribute__ ((packed)); -typedef struct IplBlockCcw IplBlockCcw; - -struct IplBlockFcp { - uint8_t reserved1[305 - 1]; - uint8_t opt; - uint8_t reserved2[3]; - uint16_t reserved3; - uint16_t devno; - uint8_t reserved4[4]; - uint64_t wwpn; - uint64_t lun; - uint32_t bootprog; - uint8_t reserved5[12]; - uint64_t br_lba; - uint32_t scp_data_len; - uint8_t reserved6[260]; - uint8_t scp_data[]; -} __attribute__ ((packed)); -typedef struct IplBlockFcp IplBlockFcp; - -struct IplBlockQemuScsi { - uint32_t lun; - uint16_t target; - uint16_t channel; - uint8_t reserved0[77]; - uint8_t ssid; - uint16_t devno; -} __attribute__ ((packed)); -typedef struct IplBlockQemuScsi IplBlockQemuScsi; - -struct IplParameterBlock { - uint32_t len; - uint8_t reserved0[3]; - uint8_t version; - uint32_t blk0_len; - uint8_t pbt; - uint8_t flags; - uint16_t reserved01; - uint8_t loadparm[LOADPARM_LEN]; - union { - IplBlockCcw ccw; - IplBlockFcp fcp; - IplBlockQemuScsi scsi; - }; -} __attribute__ ((packed)); -typedef struct IplParameterBlock IplParameterBlock; - -extern IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE))); - -#define QIPL_ADDRESS 0xcc - -/* Boot Menu flags */ -#define QIPL_FLAG_BM_OPTS_CMD 0x80 -#define QIPL_FLAG_BM_OPTS_ZIPL 0x40 - -/* - * This definition must be kept in sync with the definition - * in hw/s390x/ipl.h - */ -struct QemuIplParameters { - uint8_t qipl_flags; - uint8_t reserved1[3]; - uint64_t netboot_start_addr; - uint32_t boot_menu_timeout; - uint8_t reserved2[12]; -} __attribute__ ((packed)); -typedef struct QemuIplParameters QemuIplParameters; +#include =20 extern QemuIplParameters qipl; +extern IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE))); =20 #define S390_IPL_TYPE_FCP 0x00 #define S390_IPL_TYPE_CCW 0x02 diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile index acfcd1e71a..a771439acf 100644 --- a/pc-bios/s390-ccw/Makefile +++ b/pc-bios/s390-ccw/Makefile @@ -3,7 +3,7 @@ all: build-all @true =20 include config-host.mak -CFLAGS =3D -O2 -g +CFLAGS =3D -O2 -g -I $(SRC_PATH)/../..//include/hw/s390x/ipl MAKEFLAGS +=3D -rR =20 GIT_SUBMODULES =3D roms/SLOF --=20 2.45.1 From nobody Mon Nov 25 04:28:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1716997520; cv=none; d=zohomail.com; s=zohoarc; b=XGqK10pXTQb8D7j4eRK2/qJJ8YrJYRR0yfjGP3Uur7Yti82OimFzJigwr3Lo9OYseOulxBvPqNLjJhd1BRq9Uk+XWfTF0dcCsY+hiQjTdj22isOCLyMPLiE8R3cz1h0pJ5SQHjoHnhS/yRsWzkyAWvyK8glnjggfw1In2OQYVBQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716997520; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rRhNdpHeDHeBH5DoIUy1iUwmsrClhc/xeX0CjkwkJR8=; b=mKVktGQHApMZRghivckWKLhKDKz0A9eh0qpwhoae7pinOp8WNih27y/Ee33/MR6GtJixhFGPuV18J49knUpJegVcNRoXaXlRzyeHVCsDKT6MPWGv/LmK3/Zictz1JzMTb6F41gmlekBc/qVSySisV862mRiM6L5C9KWNmmZBB+w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1716997520400991.1099313704328; Wed, 29 May 2024 08:45:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCLSa-0005kD-2s; Wed, 29 May 2024 11:43:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCLSZ-0005jf-Dh; Wed, 29 May 2024 11:43:27 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCLSX-0006xL-AT; Wed, 29 May 2024 11:43:27 -0400 Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44TFeKws014066; Wed, 29 May 2024 15:43:23 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ye6t10218-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 May 2024 15:43:23 +0000 Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 44TFhMRQ019412; Wed, 29 May 2024 15:43:22 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ye6t10216-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 May 2024 15:43:22 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 44TFATMY026789; Wed, 29 May 2024 15:43:21 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([172.16.1.74]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3ydpd2mj8m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 May 2024 15:43:21 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 44TFhHf028443332 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 May 2024 15:43:20 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9D8AA5806C; Wed, 29 May 2024 15:43:17 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3080A58063; Wed, 29 May 2024 15:43:17 +0000 (GMT) Received: from t15.ibmuc.com (unknown [9.67.55.69]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 29 May 2024 15:43:17 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc : content-transfer-encoding : date : from : in-reply-to : message-id : mime-version : references : subject : to; s=pp1; bh=rRhNdpHeDHeBH5DoIUy1iUwmsrClhc/xeX0CjkwkJR8=; b=tpBXET7hXGcy9rqph5ZsZZRWwjpNdOaDwRgw+13b2ItLLgJUOj6nUgdnLDQJHmvHqxJO +/DkRa/JrJ9mmSwfT7DU0DG2ya59vvoYy5Ka6nkb9xxM0gEkSD+4NSPyVv6UuploBqqD O7H0FKW11yiJcig0OraGBLavH89hTjgDEQ4q3vXqOG2aYEFRtpzY21UpPzNk5PXk4WLq IH3wG/2lNDn9O/FhWgE5UhvX2Gbg0/qwtuDNxgaptcijq/Luby+WPrl1kxIXkCw56yMN RpyIVfj50c/GRZ8GgPlaRhxhl4jQ4O5V7a8Ly3/ChJE+FmWlMOPc6I+yEjnGhY0OAXjQ rg== From: jrossi@linux.ibm.com To: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, thuth@redhat.com Cc: frankja@linux.ibm.com, nsg@linux.ibm.com, jrossi@linux.ibm.com Subject: [PATCH 2/5] s390x: Add loadparm to CcwDevice Date: Wed, 29 May 2024 11:43:08 -0400 Message-Id: <20240529154311.734548-3-jrossi@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240529154311.734548-1-jrossi@linux.ibm.com> References: <20240529154311.734548-1-jrossi@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 0pPCeVEAz-M5OcneXJSTap-TvHJSQ7N1 X-Proofpoint-ORIG-GUID: lFRdzf7XR8d6p5mzF8b6Ey4zJwo8NQa- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-29_12,2024-05-28_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 clxscore=1015 bulkscore=0 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 spamscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405290108 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.156.1; envelope-from=jrossi@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1716997521911100003 Content-Type: text/plain; charset="utf-8" From: Jared Rossi Add a loadparm property to the CcwDevice object so that different loadparms can be defined on a per-device basis when using multiple boot devices. The machine/global loadparm is still supported. If both a global and per-de= vice loadparm are defined, the per-device value will override the global value f= or that device, but any other devices that do not specify a per-device loadparm will still use the global loadparm. Assigning a loadparm to a non-boot device is invalid and will be rejected. Signed-off-by: Jared Rossi --- hw/s390x/ccw-device.h | 2 ++ hw/s390x/ipl.h | 3 +- hw/s390x/ccw-device.c | 49 ++++++++++++++++++++++++++++ hw/s390x/ipl.c | 67 +++++++++++++++++++++++--------------- hw/s390x/s390-virtio-ccw.c | 18 +--------- hw/s390x/sclp.c | 3 +- pc-bios/s390-ccw/main.c | 10 ++++-- 7 files changed, 104 insertions(+), 48 deletions(-) diff --git a/hw/s390x/ccw-device.h b/hw/s390x/ccw-device.h index 6dff95225d..35ccf1f7bb 100644 --- a/hw/s390x/ccw-device.h +++ b/hw/s390x/ccw-device.h @@ -26,6 +26,8 @@ struct CcwDevice { CssDevId dev_id; /* The actual busid of the virtual subchannel. */ CssDevId subch_id; + /* If set, use this loadparm value when device is boot target */ + uint8_t loadparm[8]; }; typedef struct CcwDevice CcwDevice; =20 diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h index b066d9e8e5..1dcb8984bb 100644 --- a/hw/s390x/ipl.h +++ b/hw/s390x/ipl.h @@ -21,7 +21,8 @@ =20 #define DIAG308_FLAGS_LP_VALID 0x80 =20 -int s390_ipl_set_loadparm(uint8_t *loadparm); +void s390_ipl_set_loadparm(char *ascii_lp, uint8_t *ebcdic_lp); +void s390_ipl_fmt_loadparm(uint8_t *loadparm, char *str, Error **errp); void s390_ipl_update_diag308(IplParameterBlock *iplb); int s390_ipl_prepare_pv_header(Error **errp); int s390_ipl_pv_unpack(void); diff --git a/hw/s390x/ccw-device.c b/hw/s390x/ccw-device.c index fb8c1acc64..143e085279 100644 --- a/hw/s390x/ccw-device.c +++ b/hw/s390x/ccw-device.c @@ -13,6 +13,10 @@ #include "ccw-device.h" #include "hw/qdev-properties.h" #include "qemu/module.h" +#include "ipl.h" +#include "qapi/visitor.h" +#include "qemu/ctype.h" +#include "qapi/error.h" =20 static void ccw_device_refill_ids(CcwDevice *dev) { @@ -36,10 +40,55 @@ static void ccw_device_realize(CcwDevice *dev, Error **= errp) ccw_device_refill_ids(dev); } =20 +static void ccw_device_get_loadparm(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + CcwDevice *dev =3D CCW_DEVICE(obj); + char *str =3D g_strndup((char *) dev->loadparm, sizeof(dev->loadparm)); + + visit_type_str(v, name, &str, errp); + g_free(str); +} + +static void ccw_device_set_loadparm(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + CcwDevice *dev =3D CCW_DEVICE(obj); + char *val; + int index; + + index =3D object_property_get_int(obj, "bootindex", &error_abort); + + if (index < 0) { + error_setg(errp, "LOADPARM: non-boot device"); + } + + if (!visit_type_str(v, name, &val, errp)) { + return; + } + + s390_ipl_fmt_loadparm(dev->loadparm, val, errp); +} + +static const PropertyInfo ccw_loadparm =3D { + .name =3D "ccw_loadparm", + .description =3D "Up to 8 chars in set of [A-Za-z0-9. ] (lower case" + " chars converted to upper case) to pass to machine loader," + " boot manager, and guest kernel", + .get =3D ccw_device_get_loadparm, + .set =3D ccw_device_set_loadparm, +}; + +#define DEFINE_PROP_CCW_LOADPARM(_n, _s, _f) \ + DEFINE_PROP(_n, _s, _f, ccw_loadparm, typeof(uint8_t[8])) + static Property ccw_device_properties[] =3D { DEFINE_PROP_CSS_DEV_ID("devno", CcwDevice, devno), DEFINE_PROP_CSS_DEV_ID_RO("dev_id", CcwDevice, dev_id), DEFINE_PROP_CSS_DEV_ID_RO("subch_id", CcwDevice, subch_id), + DEFINE_PROP_CCW_LOADPARM("loadparm", CcwDevice, loadparm), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index e934bf89d1..2d4f5152b3 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -34,6 +34,7 @@ #include "qemu/config-file.h" #include "qemu/cutils.h" #include "qemu/option.h" +#include "qemu/ctype.h" #include "standard-headers/linux/virtio_ids.h" =20 #define KERN_IMAGE_START 0x010000UL @@ -390,12 +391,44 @@ static CcwDevice *s390_get_ccw_device(DeviceState *de= v_st, int *devtype) return ccw_dev; } =20 +void s390_ipl_fmt_loadparm(uint8_t *loadparm, char *str, Error **errp) +{ + int i; + + /* Initialize the loadparm with spaces */ + memset(loadparm, ' ', LOADPARM_LEN); + for (i =3D 0; i < LOADPARM_LEN && str[i]; i++) { + uint8_t c =3D qemu_toupper(str[i]); /* mimic HMC */ + + if (('A' <=3D c && c <=3D 'Z') || ('0' <=3D c && c <=3D '9') || (c= =3D=3D '.') || + (c =3D=3D ' ')) { + loadparm[i] =3D c; + } else { + error_setg(errp, "LOADPARM: invalid character '%c' (ASCII 0x%0= 2x)", + c, c); + return; + } + } +} + +void s390_ipl_set_loadparm(char *ascii_lp, uint8_t *ebcdic_lp) +{ + int i; + + /* Initialize the loadparm with EBCDIC spaces (0x40) */ + memset(ebcdic_lp, '@', LOADPARM_LEN); + for (i =3D 0; i < LOADPARM_LEN && ascii_lp[i]; i++) { + ebcdic_lp[i] =3D ascii2ebcdic[(uint8_t) ascii_lp[i]]; + } +} + static bool s390_gen_initial_iplb(S390IPLState *ipl) { DeviceState *dev_st; CcwDevice *ccw_dev =3D NULL; SCSIDevice *sd; int devtype; + uint8_t *lp; =20 dev_st =3D get_boot_device(0); if (dev_st) { @@ -406,6 +439,8 @@ static bool s390_gen_initial_iplb(S390IPLState *ipl) * Currently allow IPL only from CCW devices. */ if (ccw_dev) { + lp =3D ccw_dev->loadparm; + switch (devtype) { case CCW_DEVTYPE_SCSI: sd =3D SCSI_DEVICE(dev_st); @@ -438,40 +473,20 @@ static bool s390_gen_initial_iplb(S390IPLState *ipl) break; } =20 - if (!s390_ipl_set_loadparm(ipl->iplb.loadparm)) { - ipl->iplb.flags |=3D DIAG308_FLAGS_LP_VALID; + /* If the device loadparm is empty use the global machine loadparm= */ + if (memcmp(lp, "\0\0\0\0\0\0\0\0", 8) =3D=3D 0) { + lp =3D S390_CCW_MACHINE(qdev_get_machine())->loadparm; } =20 + s390_ipl_set_loadparm((char *)lp, ipl->iplb.loadparm); + ipl->iplb.flags |=3D DIAG308_FLAGS_LP_VALID; + return true; } =20 return false; } =20 -int s390_ipl_set_loadparm(uint8_t *loadparm) -{ - MachineState *machine =3D MACHINE(qdev_get_machine()); - char *lp =3D object_property_get_str(OBJECT(machine), "loadparm", NULL= ); - - if (lp) { - int i; - - /* lp is an uppercase string without leading/embedded spaces */ - for (i =3D 0; i < 8 && lp[i]; i++) { - loadparm[i] =3D ascii2ebcdic[(uint8_t) lp[i]]; - } - - if (i < 8) { - memset(loadparm + i, 0x40, 8 - i); /* fill with EBCDIC spaces = */ - } - - g_free(lp); - return 0; - } - - return -1; -} - static int load_netboot_image(Error **errp) { MachineState *ms =3D MACHINE(qdev_get_machine()); diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 3d0bc3e7f2..00478bd6ee 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -714,28 +714,12 @@ static void machine_set_loadparm(Object *obj, Visitor= *v, { S390CcwMachineState *ms =3D S390_CCW_MACHINE(obj); char *val; - int i; =20 if (!visit_type_str(v, name, &val, errp)) { return; } =20 - for (i =3D 0; i < sizeof(ms->loadparm) && val[i]; i++) { - uint8_t c =3D qemu_toupper(val[i]); /* mimic HMC */ - - if (('A' <=3D c && c <=3D 'Z') || ('0' <=3D c && c <=3D '9') || (c= =3D=3D '.') || - (c =3D=3D ' ')) { - ms->loadparm[i] =3D c; - } else { - error_setg(errp, "LOADPARM: invalid character '%c' (ASCII 0x%0= 2x)", - c, c); - return; - } - } - - for (; i < sizeof(ms->loadparm); i++) { - ms->loadparm[i] =3D ' '; /* pad right with spaces */ - } + s390_ipl_fmt_loadparm(ms->loadparm, val, errp); } =20 static void ccw_machine_class_init(ObjectClass *oc, void *data) diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index e725dcd5fd..00afa9ad52 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -175,7 +175,8 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) memcpy(&read_info->loadparm, &ipib->loadparm, sizeof(read_info->loadparm)); } else { - s390_ipl_set_loadparm(read_info->loadparm); + s390_ipl_set_loadparm((char *)S390_CCW_MACHINE(machine)->loadparm, + read_info->loadparm); } =20 sccb->h.response_code =3D cpu_to_be16(SCLP_RC_NORMAL_READ_COMPLETION); diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index 5506798098..3e51d698d7 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -173,8 +173,14 @@ static void css_setup(void) static void boot_setup(void) { char lpmsg[] =3D "LOADPARM=3D[________]\n"; + have_iplb =3D store_iplb(&iplb); + + if (memcmp(iplb.loadparm, "@@@@@@@@", LOADPARM_LEN) !=3D 0) { + ebcdic_to_ascii((char *) iplb.loadparm, loadparm_str, LOADPARM_LEN= ); + } else { + sclp_get_loadparm_ascii(loadparm_str); + } =20 - sclp_get_loadparm_ascii(loadparm_str); memcpy(lpmsg + 10, loadparm_str, 8); sclp_print(lpmsg); =20 @@ -183,8 +189,6 @@ static void boot_setup(void) * so we don't taint our decision-making process during a reboot. */ memset((char *)S390EP, 0, 6); - - have_iplb =3D store_iplb(&iplb); } =20 static void find_boot_device(void) --=20 2.45.1 From nobody Mon Nov 25 04:28:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1716997478; cv=none; d=zohomail.com; s=zohoarc; b=KBLnJV9m2bkd8IkMebgti0dQs0nigoJqSljFt3GeAaFekBOvJATmfmwAcWfKkwe1skcGrdlR93PrhTBt5MTtKtjmD0qT6g/LBbcftn7PGs3Oo5dyAt/nJQ5pgtagy/UZnTqF+JU0LNNH8BcneB7V8zN0aKPKAkhSJiDbteYjQEU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716997478; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Qnk4AOc8ry9Ao+8TO63Bu1ceY2ulkAuquFQlrY66fa8=; b=MuSYHPAa36gImD9FD5dYTC1IFefCJrBv6zIt2Yw8uRV33G9NrOeFw7ijNNHxZWpSKUfza2M7s6QrfH0ax7qZ8k5yOCrjzUiEeIxUMHtLrMNTHNsCdGXawJO5jrUc5+Z6dTH9cBmElFDgkv8BAraGyJQQ5DGFiXDnO1jzRA9aYoA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1716997478713294.37138806994653; Wed, 29 May 2024 08:44:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCLSc-0005lt-2v; Wed, 29 May 2024 11:43:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCLSa-0005kG-DT; Wed, 29 May 2024 11:43:28 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCLSY-0006xR-2y; Wed, 29 May 2024 11:43:28 -0400 Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44TFgU6g027322; Wed, 29 May 2024 15:43:24 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ye77w802y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 May 2024 15:43:23 +0000 Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 44TFhNp6029107; Wed, 29 May 2024 15:43:23 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ye77w802t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 May 2024 15:43:23 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 44TFNN2X024784; Wed, 29 May 2024 15:43:22 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3ydphqmgau-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 May 2024 15:43:22 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 44TFhJOj25297462 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 May 2024 15:43:21 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 02E8D58072; Wed, 29 May 2024 15:43:19 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8A4B05806F; Wed, 29 May 2024 15:43:18 +0000 (GMT) Received: from t15.ibmuc.com (unknown [9.67.55.69]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 29 May 2024 15:43:18 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc : content-transfer-encoding : date : from : in-reply-to : message-id : mime-version : references : subject : to; s=pp1; bh=Qnk4AOc8ry9Ao+8TO63Bu1ceY2ulkAuquFQlrY66fa8=; b=lLG0YuLvTuD96GFHcGjEfyC1gn0u+SILYGupcHuvh9Q0YSu9Pw4AXRwbrSj60Desa0dg XR58yHmsqiJgKLOraPdlfBBX8G7PgsCeC0gkCKAsDp+lhVnu4N67cBMWvDK33KXqi50y m44xWvpovE+03IpFy1iAVADM0SOP44eh+A/Y5y3o6JSCcn4Dr+2oHa/i7/mDghRGk419 KIKfkKntT/mwsDlaq4oLFPr1T3OsEJfIa8/QAl8q6HyJTCcPbiws3eyGPZB9np0G3D69 6n6ZGY6HM1KhuQyMld2Gk6o48vp3jUa9EJPi/aigXC45ZmzlT8aitRY4qtjNC0SMyDT7 DQ== From: jrossi@linux.ibm.com To: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, thuth@redhat.com Cc: frankja@linux.ibm.com, nsg@linux.ibm.com, jrossi@linux.ibm.com Subject: [PATCH 3/5] s390x: Build IPLB chain for multiple boot devices Date: Wed, 29 May 2024 11:43:09 -0400 Message-Id: <20240529154311.734548-4-jrossi@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240529154311.734548-1-jrossi@linux.ibm.com> References: <20240529154311.734548-1-jrossi@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: LPQvYRdmJIj8Z-xl0sMGEvGMKIW_sx6x X-Proofpoint-ORIG-GUID: tm7L3z210Ie8ZWRdLZ15htiYc7e-13A2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-29_12,2024-05-28_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 impostorscore=0 adultscore=0 suspectscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 clxscore=1015 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405290108 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.156.1; envelope-from=jrossi@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1716997479636100003 Content-Type: text/plain; charset="utf-8" From: Jared Rossi Write a chain of IPLBs into memory for future use. The IPLB chain is placed immediately before the BIOS in memory at the highe= st unused page boundary providing sufficient space to fit the chain. Because t= his is not a fixed address, the location of the next IPLB and number of remaini= ng boot devices is stored in the QIPL global variable for later access. At this stage the IPLB chain is not accessed by the guest during IPL. Signed-off-by: Jared Rossi --- hw/s390x/ipl.h | 1 + include/hw/s390x/ipl/qipl.h | 4 +- hw/s390x/ipl.c | 129 +++++++++++++++++++++++++++--------- 3 files changed, 103 insertions(+), 31 deletions(-) diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h index 1dcb8984bb..4f098d3a81 100644 --- a/hw/s390x/ipl.h +++ b/hw/s390x/ipl.h @@ -20,6 +20,7 @@ #include "qom/object.h" =20 #define DIAG308_FLAGS_LP_VALID 0x80 +#define MAX_IPLB_CHAIN 7 =20 void s390_ipl_set_loadparm(char *ascii_lp, uint8_t *ebcdic_lp); void s390_ipl_fmt_loadparm(uint8_t *loadparm, char *str, Error **errp); diff --git a/include/hw/s390x/ipl/qipl.h b/include/hw/s390x/ipl/qipl.h index a6ce6ddfe3..481c459a53 100644 --- a/include/hw/s390x/ipl/qipl.h +++ b/include/hw/s390x/ipl/qipl.h @@ -34,7 +34,9 @@ struct QemuIplParameters { uint8_t reserved1[3]; uint64_t netboot_start_addr; uint32_t boot_menu_timeout; - uint8_t reserved2[12]; + uint8_t reserved2[2]; + uint16_t num_iplbs; + uint64_t next_iplb; } QEMU_PACKED; typedef struct QemuIplParameters QemuIplParameters; =20 diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index 2d4f5152b3..79429acabd 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -55,6 +55,13 @@ static bool iplb_extended_needed(void *opaque) return ipl->iplbext_migration; } =20 +/* Start IPLB chain from the boundary of the first unused page before BIOS= */ +static uint64_t find_iplb_chain_addr(uint64_t bios_addr, uint16_t count) +{ + return (bios_addr & TARGET_PAGE_MASK) + - (count * sizeof(IplParameterBlock)); +} + static const VMStateDescription vmstate_iplb_extended =3D { .name =3D "ipl/iplb_extended", .version_id =3D 0, @@ -391,6 +398,17 @@ static CcwDevice *s390_get_ccw_device(DeviceState *dev= _st, int *devtype) return ccw_dev; } =20 +static void s390_ipl_map_iplb_chain(IplParameterBlock *iplb_chain) +{ + S390IPLState *ipl =3D get_ipl_device(); + uint16_t count =3D ipl->qipl.num_iplbs; + uint64_t len =3D sizeof(IplParameterBlock) * count; + uint64_t chain_addr =3D find_iplb_chain_addr(ipl->bios_start_addr, cou= nt); + + cpu_physical_memory_write(chain_addr, iplb_chain, be32_to_cpu(len)); + ipl->qipl.next_iplb =3D chain_addr; +} + void s390_ipl_fmt_loadparm(uint8_t *loadparm, char *str, Error **errp) { int i; @@ -422,54 +440,51 @@ void s390_ipl_set_loadparm(char *ascii_lp, uint8_t *e= bcdic_lp) } } =20 -static bool s390_gen_initial_iplb(S390IPLState *ipl) +static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb) { - DeviceState *dev_st; + S390IPLState *ipl =3D get_ipl_device(); CcwDevice *ccw_dev =3D NULL; SCSIDevice *sd; int devtype; uint8_t *lp; =20 - dev_st =3D get_boot_device(0); - if (dev_st) { - ccw_dev =3D s390_get_ccw_device(dev_st, &devtype); - } - /* * Currently allow IPL only from CCW devices. */ + ccw_dev =3D s390_get_ccw_device(dev_st, &devtype); if (ccw_dev) { lp =3D ccw_dev->loadparm; =20 - switch (devtype) { - case CCW_DEVTYPE_SCSI: + switch (devtype) { + case CCW_DEVTYPE_SCSI: sd =3D SCSI_DEVICE(dev_st); - ipl->iplb.len =3D cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN); - ipl->iplb.blk0_len =3D + iplb->len =3D cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN); + iplb->blk0_len =3D cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN - S390_IPLB_HEADER= _LEN); - ipl->iplb.pbt =3D S390_IPL_TYPE_QEMU_SCSI; - ipl->iplb.scsi.lun =3D cpu_to_be32(sd->lun); - ipl->iplb.scsi.target =3D cpu_to_be16(sd->id); - ipl->iplb.scsi.channel =3D cpu_to_be16(sd->channel); - ipl->iplb.scsi.devno =3D cpu_to_be16(ccw_dev->sch->devno); - ipl->iplb.scsi.ssid =3D ccw_dev->sch->ssid & 3; + iplb->pbt =3D S390_IPL_TYPE_QEMU_SCSI; + iplb->scsi.lun =3D cpu_to_be32(sd->lun); + iplb->scsi.target =3D cpu_to_be16(sd->id); + iplb->scsi.channel =3D cpu_to_be16(sd->channel); + iplb->scsi.devno =3D cpu_to_be16(ccw_dev->sch->devno); + iplb->scsi.ssid =3D ccw_dev->sch->ssid & 3; break; case CCW_DEVTYPE_VFIO: - ipl->iplb.len =3D cpu_to_be32(S390_IPLB_MIN_CCW_LEN); - ipl->iplb.pbt =3D S390_IPL_TYPE_CCW; - ipl->iplb.ccw.devno =3D cpu_to_be16(ccw_dev->sch->devno); - ipl->iplb.ccw.ssid =3D ccw_dev->sch->ssid & 3; + iplb->len =3D cpu_to_be32(S390_IPLB_MIN_CCW_LEN); + iplb->pbt =3D S390_IPL_TYPE_CCW; + iplb->ccw.devno =3D cpu_to_be16(ccw_dev->sch->devno); + iplb->ccw.ssid =3D ccw_dev->sch->ssid & 3; break; case CCW_DEVTYPE_VIRTIO_NET: + /* The S390IPLState netboot is ture if ANY IPLB may use netboo= t */ ipl->netboot =3D true; /* Fall through to CCW_DEVTYPE_VIRTIO case */ case CCW_DEVTYPE_VIRTIO: - ipl->iplb.len =3D cpu_to_be32(S390_IPLB_MIN_CCW_LEN); - ipl->iplb.blk0_len =3D + iplb->len =3D cpu_to_be32(S390_IPLB_MIN_CCW_LEN); + iplb->blk0_len =3D cpu_to_be32(S390_IPLB_MIN_CCW_LEN - S390_IPLB_HEADER_LEN); - ipl->iplb.pbt =3D S390_IPL_TYPE_CCW; - ipl->iplb.ccw.devno =3D cpu_to_be16(ccw_dev->sch->devno); - ipl->iplb.ccw.ssid =3D ccw_dev->sch->ssid & 3; + iplb->pbt =3D S390_IPL_TYPE_CCW; + iplb->ccw.devno =3D cpu_to_be16(ccw_dev->sch->devno); + iplb->ccw.ssid =3D ccw_dev->sch->ssid & 3; break; } =20 @@ -478,8 +493,8 @@ static bool s390_gen_initial_iplb(S390IPLState *ipl) lp =3D S390_CCW_MACHINE(qdev_get_machine())->loadparm; } =20 - s390_ipl_set_loadparm((char *)lp, ipl->iplb.loadparm); - ipl->iplb.flags |=3D DIAG308_FLAGS_LP_VALID; + s390_ipl_set_loadparm((char *)lp, iplb->loadparm); + iplb->flags |=3D DIAG308_FLAGS_LP_VALID; =20 return true; } @@ -487,6 +502,58 @@ static bool s390_gen_initial_iplb(S390IPLState *ipl) return false; } =20 +static bool s390_init_all_iplbs(S390IPLState *ipl) +{ + int iplb_num =3D 0; + IplParameterBlock iplb_chain[7]; + DeviceState *dev_st =3D get_boot_device(0); + + /* + * Parse the boot devices. Generate an IPLB for the first boot device, + * which will later be set with DIAG308. Index any fallback boot devic= es. + */ + if (!dev_st) { + ipl->qipl.num_iplbs =3D 0; + return false; + } + + iplb_num =3D 1; + s390_build_iplb(dev_st, &ipl->iplb); + ipl->iplb.flags |=3D DIAG308_FLAGS_LP_VALID; + + while (get_boot_device(iplb_num)) { + iplb_num++; + } + + ipl->qipl.num_iplbs =3D iplb_num - 1; + + /* + * Build fallback IPLBs for any boot devices above index 0, up to a + * maximum amount as defined in ipl.h + */ + if (iplb_num > 1) { + if (iplb_num > MAX_IPLB_CHAIN) { + warn_report("Excess boot devices defined! %d boot devices foun= d, " + "but only the first %d will be considered.", + iplb_num, MAX_IPLB_CHAIN + 1); + iplb_num =3D MAX_IPLB_CHAIN + 1; + } + + ipl->qipl.num_iplbs =3D iplb_num - 1; + + /* Start at 1 because the IPLB for boot index 0 is not chained */ + for (int i =3D 1; i < iplb_num; i++) { + dev_st =3D get_boot_device(i); + s390_build_iplb(dev_st, &iplb_chain[i - 1]); + iplb_chain[i - 1].flags |=3D DIAG308_FLAGS_LP_VALID; + } + + s390_ipl_map_iplb_chain(iplb_chain); + } + + return iplb_num; +} + static int load_netboot_image(Error **errp) { MachineState *ms =3D MACHINE(qdev_get_machine()); @@ -664,7 +731,7 @@ void s390_ipl_reset_request(CPUState *cs, enum s390_res= et reset_type) * this is the original boot device's SCSI * so restore IPL parameter info from it */ - ipl->iplb_valid =3D s390_gen_initial_iplb(ipl); + ipl->iplb_valid =3D s390_build_iplb(get_boot_device(0), &ipl->= iplb); } } if (reset_type =3D=3D S390_RESET_MODIFIED_CLEAR || @@ -758,7 +825,9 @@ void s390_ipl_prepare_cpu(S390CPU *cpu) if (!ipl->kernel || ipl->iplb_valid) { cpu->env.psw.addr =3D ipl->bios_start_addr; if (!ipl->iplb_valid) { - ipl->iplb_valid =3D s390_gen_initial_iplb(ipl); + ipl->iplb_valid =3D s390_init_all_iplbs(ipl); + } else { + ipl->qipl.num_iplbs =3D 0; } } if (ipl->netboot) { --=20 2.45.1 From nobody Mon Nov 25 04:28:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1716997448; cv=none; d=zohomail.com; s=zohoarc; b=gjSqNSVfqCslIfuTEzguTjtoRbh3tkiR4TE07MgDL4K2caExNpijgDKdKBEYSwnA7wmmdhqmCe9vAQ6aUYhr1ntpwfit9csR9VjWcHPrkvPZHZFauemu/jkjBmdJkV1KQ6ujmsnYLFnwJYjwxJvbYCc519ygkTwstBCdnuKwMNk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716997448; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DNSDR6Ip26VL8YTQlpGoygzmm3raGtx5zokLcxWbUBE=; b=FeD60AqK/nNaOXseP3pYgVYZgfs0XliWYCwiR/Iy1Ha4hIhizeM9C5I6eYv4qAd/jQwTs6NJiNRdoOFmc86QFD9Xe5nlZXbKgx4m6XFvWQSeSk6GDNfP/rsVyu6i0GFqvqhaYB0+80DemktuY/AZgfLo/nwM8dyCm9stn5yDlJA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1716997448906135.08914584836248; Wed, 29 May 2024 08:44:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCLSd-0005nV-TJ; Wed, 29 May 2024 11:43:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCLSc-0005m9-6U; Wed, 29 May 2024 11:43:30 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCLSZ-0006xg-5s; Wed, 29 May 2024 11:43:29 -0400 Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44TFg8xo007021; Wed, 29 May 2024 15:43:25 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ye77y0035-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 May 2024 15:43:25 +0000 Received: from m0353727.ppops.net (m0353727.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 44TFhOX9008945; Wed, 29 May 2024 15:43:24 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ye77y0030-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 May 2024 15:43:24 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 44TEv0vX029003; Wed, 29 May 2024 15:43:23 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3ydpaymjjr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 May 2024 15:43:23 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 44TFhKkG24052366 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 May 2024 15:43:22 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4CBB858063; Wed, 29 May 2024 15:43:20 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D38285806F; Wed, 29 May 2024 15:43:19 +0000 (GMT) Received: from t15.ibmuc.com (unknown [9.67.55.69]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 29 May 2024 15:43:19 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc : content-transfer-encoding : date : from : in-reply-to : message-id : mime-version : references : subject : to; s=pp1; bh=DNSDR6Ip26VL8YTQlpGoygzmm3raGtx5zokLcxWbUBE=; b=UFWC6lANkwnhKhpuDWQxjwbKgR3jSzOaNUgDDxlWR6EVNLMrZ9Ow5CfVI2KPpAMO4oTO ORJ5UY9lLqVLlB8bociWKSyyUwT5jT1I0SErVaxKnugJASEbKw66PoLL5v2cK71b3LUQ HDZVyldSkOjFIuCn6ag9qX/+/3w/8EK0E91uSDHlJLM6h+cd0orjHfjjDtpgVTzTeo+L AF1txVC4vu/2T7U27QN5AZpchsbbi/udCX1LmYYud96dLTHdZP9AkStV154wGAUek3J5 aRZkvRd4blMG6PwNXFfEIkwrGnhJZRSwQAa/3CY+xEfVD9aAbUHJ7uk7yEy/sIAvmPh4 lw== From: jrossi@linux.ibm.com To: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, thuth@redhat.com Cc: frankja@linux.ibm.com, nsg@linux.ibm.com, jrossi@linux.ibm.com Subject: [PATCH 4/5] s390x: Add boot device fallback infrastructure Date: Wed, 29 May 2024 11:43:10 -0400 Message-Id: <20240529154311.734548-5-jrossi@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240529154311.734548-1-jrossi@linux.ibm.com> References: <20240529154311.734548-1-jrossi@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Z3-QaJW7xSDMjbETZbrsV8NLVaIUkRKl X-Proofpoint-ORIG-GUID: WkrOM3rDAwPfV4ZRPrS_zcCJcvQzd_pb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-29_12,2024-05-28_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 bulkscore=0 adultscore=0 mlxscore=0 priorityscore=1501 mlxlogscore=999 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405290108 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.156.1; envelope-from=jrossi@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1716997449575100001 Content-Type: text/plain; charset="utf-8" From: Jared Rossi Add a routine for loading the next IPLB if a device fails to boot. This includes some minor changes to the List-Directed IPL routine so that t= he failing device may be retried using the legacy boot pointers before moving = on to the next device. Signed-off-by: Jared Rossi --- pc-bios/s390-ccw/bootmap.h | 5 +++++ pc-bios/s390-ccw/iplb.h | 24 ++++++++++++++++++++++ pc-bios/s390-ccw/bootmap.c | 41 ++++++++++++++++++++++++++------------ pc-bios/s390-ccw/main.c | 15 +++++++++----- pc-bios/s390-ccw/netmain.c | 4 ++++ 5 files changed, 71 insertions(+), 18 deletions(-) diff --git a/pc-bios/s390-ccw/bootmap.h b/pc-bios/s390-ccw/bootmap.h index d4690a88c2..d5061ed6c8 100644 --- a/pc-bios/s390-ccw/bootmap.h +++ b/pc-bios/s390-ccw/bootmap.h @@ -366,6 +366,11 @@ static inline void read_block(block_number_t blockno, IPL_assert(virtio_read(blockno, buffer) =3D=3D 0, errmsg); } =20 +static inline bool read_block_nonfatal(block_number_t blockno, void *buffe= r) +{ + return (virtio_read(blockno, buffer) =3D=3D 0); +} + static inline bool block_size_ok(uint32_t block_size) { return block_size =3D=3D virtio_get_block_size(); diff --git a/pc-bios/s390-ccw/iplb.h b/pc-bios/s390-ccw/iplb.h index 16643f5879..3c29d23375 100644 --- a/pc-bios/s390-ccw/iplb.h +++ b/pc-bios/s390-ccw/iplb.h @@ -49,4 +49,28 @@ static inline bool set_iplb(IplParameterBlock *iplb) return manage_iplb(iplb, false); } =20 +/* + * The IPL started on the device, but failed in some way. If the IPLB cha= in + * still has more devices left to try, use the next device in order. Set t= he + * next IPLB and save the current qipl parameters state. + */ +static inline bool load_next_iplb(void) +{ + IplParameterBlock *next_iplb; + + if (qipl.num_iplbs < 1) { + return false; + } + + next_iplb =3D (IplParameterBlock *) qipl.next_iplb; + memcpy(&iplb, next_iplb, sizeof(IplParameterBlock)); + set_iplb(&iplb); + + qipl.num_iplbs--; + qipl.next_iplb =3D qipl.next_iplb + sizeof(IplParameterBlock); + memcpy((QemuIplParameters *)QIPL_ADDRESS, &qipl, sizeof(QemuIplParamet= ers)); + + return true; +} + #endif /* IPLB_H */ diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c index a2137449dc..69391557fa 100644 --- a/pc-bios/s390-ccw/bootmap.c +++ b/pc-bios/s390-ccw/bootmap.c @@ -144,7 +144,10 @@ static block_number_t load_eckd_segments(block_number_= t blk, bool ldipl, bool more_data; =20 memset(_bprs, FREE_SPACE_FILLER, sizeof(_bprs)); - read_block(blk, bprs, "BPRS read failed"); + if (!read_block_nonfatal(blk, bprs)) { + IPL_assert(ldipl, "BPRS read failed"); + return -1; + } =20 do { more_data =3D false; @@ -188,7 +191,10 @@ static block_number_t load_eckd_segments(block_number_= t blk, bool ldipl, * I.e. the next ptr must point to the unused memory area */ memset(_bprs, FREE_SPACE_FILLER, sizeof(_bprs)); - read_block(block_nr, bprs, "BPRS continuation read failed"= ); + if (!read_block_nonfatal(block_nr, bprs)) { + IPL_assert(ldipl, "BPRS continuation read failed"); + break; + } more_data =3D true; break; } @@ -197,7 +203,10 @@ static block_number_t load_eckd_segments(block_number_= t blk, bool ldipl, * to memory (address). */ rc =3D virtio_read_many(block_nr, (void *)(*address), count + = 1); - IPL_assert(rc =3D=3D 0, "code chunk read failed"); + if (rc !=3D 0) { + IPL_assert(ldipl, "code chunk read failed"); + break; + } =20 *address +=3D (count + 1) * virtio_get_block_size(); } @@ -295,13 +304,22 @@ static void run_eckd_boot_script(block_number_t bmt_b= lock_nr, " maximum number of boot entries allowed"); =20 memset(sec, FREE_SPACE_FILLER, sizeof(sec)); - read_block(bmt_block_nr, sec, "Cannot read Boot Map Table"); + if (!read_block_nonfatal(bmt_block_nr, sec)) { + IPL_assert(ldipl, "Cannot read Boot Map Table"); + return; + } =20 block_nr =3D gen_eckd_block_num(&bmt->entry[loadparm].xeckd, ldipl); - IPL_assert(block_nr !=3D -1, "Cannot find Boot Map Table Entry"); + if (block_nr =3D=3D -1) { + IPL_assert(ldipl, "Cannot find Boot Map Table Entry"); + return; + } =20 memset(sec, FREE_SPACE_FILLER, sizeof(sec)); - read_block(block_nr, sec, "Cannot read Boot Map Script"); + if (!read_block_nonfatal(block_nr, sec)) { + IPL_assert(ldipl, "Cannot read Boot Map Script"); + return; + } =20 for (i =3D 0; bms->entry[i].type =3D=3D BOOT_SCRIPT_LOAD || bms->entry[i].type =3D=3D BOOT_SCRIPT_SIGNATURE; i++) { @@ -319,13 +337,10 @@ static void run_eckd_boot_script(block_number_t bmt_b= lock_nr, } while (block_nr !=3D -1); } =20 - if (ldipl && bms->entry[i].type !=3D BOOT_SCRIPT_EXEC) { - /* Abort LD-IPL and retry as CCW-IPL */ + if (bms->entry[i].type !=3D BOOT_SCRIPT_EXEC) { + IPL_assert(ldipl, "Unknown script entry type"); return; } - - IPL_assert(bms->entry[i].type =3D=3D BOOT_SCRIPT_EXEC, - "Unknown script entry type"); write_reset_psw(bms->entry[i].address.load_address); /* no return */ jump_to_IPL_code(0); /* no return */ } @@ -492,7 +507,7 @@ static void ipl_eckd(void) /* LD-IPL does not use the S1B bock, just make it NULL */ run_eckd_boot_script(ldipl_bmt, NULL_BLOCK_NR); /* Only return in error, retry as CCW-IPL */ - sclp_print("Retrying IPL "); + sclp_print("LD-IPL failed, retrying device\n"); print_eckd_msg(); } memset(sec, FREE_SPACE_FILLER, sizeof(sec)); @@ -944,5 +959,5 @@ void zipl_load(void) panic("\n! Unknown IPL device type !\n"); } =20 - sclp_print("zIPL load failed.\n"); + panic("zIPL load failed.\n"); } diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index 3e51d698d7..248ed5a410 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -53,6 +53,12 @@ unsigned int get_loadparm_index(void) return atoui(loadparm_str); } =20 +static void copy_qipl(void) +{ + QemuIplParameters *early_qipl =3D (QemuIplParameters *)QIPL_ADDRESS; + memcpy(&qipl, early_qipl, sizeof(QemuIplParameters)); +} + static int is_dev_possibly_bootable(int dev_no, int sch_no) { bool is_virtio; @@ -194,7 +200,7 @@ static void boot_setup(void) static void find_boot_device(void) { VDev *vdev =3D virtio_get_device(); - bool found; + bool found =3D false; =20 switch (iplb.pbt) { case S390_IPL_TYPE_CCW: @@ -221,11 +227,8 @@ static void find_boot_device(void) static int virtio_setup(void) { VDev *vdev =3D virtio_get_device(); - QemuIplParameters *early_qipl =3D (QemuIplParameters *)QIPL_ADDRESS; int ret; =20 - memcpy(&qipl, early_qipl, sizeof(QemuIplParameters)); - if (have_iplb) { menu_setup(); } @@ -242,7 +245,8 @@ static int virtio_setup(void) ret =3D virtio_scsi_setup_device(blk_schid); break; default: - panic("\n! No IPL device available !\n"); + ret =3D 1; + panic("Unrecognized virtio device type!\n"); } =20 if (!ret) { @@ -296,6 +300,7 @@ static void probe_boot_device(void) =20 void main(void) { + copy_qipl(); sclp_setup(); css_setup(); boot_setup(); diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c index 5cd619b2d6..65cee15fef 100644 --- a/pc-bios/s390-ccw/netmain.c +++ b/pc-bios/s390-ccw/netmain.c @@ -36,6 +36,7 @@ #include "cio.h" #include "virtio.h" #include "s390-time.h" +#include "iplb.h" =20 #define DEFAULT_BOOT_RETRIES 10 #define DEFAULT_TFTP_RETRIES 20 @@ -51,6 +52,7 @@ void write_iplb_location(void) {} #define STSI322_VMDB_UUID_OFFSET ((8 + 12) * 4) =20 IplParameterBlock iplb __attribute__((aligned(PAGE_SIZE))); +QemuIplParameters qipl; static char cfgbuf[2048]; =20 static SubChannelId net_schid =3D { .one =3D 1 }; @@ -513,6 +515,8 @@ void main(void) { filename_ip_t fn_ip; int rc, fnlen; + QemuIplParameters *early_qipl =3D (QemuIplParameters *)QIPL_ADDRESS; + memcpy(&qipl, early_qipl, sizeof(QemuIplParameters)); =20 sclp_setup(); sclp_print("Network boot starting...\n"); --=20 2.45.1 From nobody Mon Nov 25 04:28:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1716997503; cv=none; d=zohomail.com; s=zohoarc; b=KM/LIuJIWlpzHGeZ+mtYPF/vBY7R1ZDi8PvomK0Ra/CyWQyZQ46UNyShgTs/jvHW73ui/HGwQvHEJ2FT9ndaPGV218dA8he1n03v9Nm/8j22PLDCCelXGtvMoTNumYcsTxq0Slw1+ooShoYac86N5X9nJwsdeImvf899/nhSuxI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716997503; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=i1ZddlVaqXoyEbUeMkXydGpQ6op+z/QE2+zEDnnUsQE=; b=ZLT60uOvRitkCYLx3aVoe+SDXiw3BT0t69sKcnqm6VuK9F7CxPAnXjn4/ZIntZoYa0O6QnMRfjU0znDQLz4TmxakmK9eyYM2P6Imk/87Ix+K9zB5+kj3IskXuZI8mv9nn1MpgjxvZiWO7Eh0tx7IvRzSpexWQ9W7qovsWGs3E8I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17169975036891007.4973619176853; Wed, 29 May 2024 08:45:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCLSe-0005o8-PI; Wed, 29 May 2024 11:43:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCLSc-0005mU-Kt; Wed, 29 May 2024 11:43:30 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCLSa-0006xy-TD; Wed, 29 May 2024 11:43:30 -0400 Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44TFBCMG021274; Wed, 29 May 2024 15:43:27 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ye58prc8r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 May 2024 15:43:26 +0000 Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 44TFhPJ9008206; Wed, 29 May 2024 15:43:25 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ye58prc8n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 May 2024 15:43:25 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 44TF8RoZ002783; Wed, 29 May 2024 15:43:24 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([172.16.1.8]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3ydpb0mka3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 May 2024 15:43:24 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 44TFhLvH26214894 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 May 2024 15:43:23 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9984C58068; Wed, 29 May 2024 15:43:21 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2C6A058064; Wed, 29 May 2024 15:43:21 +0000 (GMT) Received: from t15.ibmuc.com (unknown [9.67.55.69]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 29 May 2024 15:43:21 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc : content-transfer-encoding : date : from : in-reply-to : message-id : mime-version : references : subject : to; s=pp1; bh=i1ZddlVaqXoyEbUeMkXydGpQ6op+z/QE2+zEDnnUsQE=; b=n36Csnvo9IUKrpvcQ1B2nuQHruCpSRZXGCkfGSOiAYhPTbQRhgIlF/Yy8O+bcToaoyU4 fTTsCKSP0Tk0p2hi9GZ4MI+h2NpdwHRNmz1FK+eOHSIMIh7CypUD06Psx1pj3JjLEfQG uiRWmztk2iZKXSFtDFd+d3d9R7b1tvUo4MMuA1v8Jp4GBdwgxAZhoks3nuZc+2v8LhUZ 5cVtBbXTncLBhcej2y6MLuZ/fHmGFuzagTS/BAcFWPctVYlJ4n7TIfOiGF91voc0vZIN NMGTh7Z2LoT/q8B7vfl8XCqwv/OyEuOD3LayupEpIpp6rkMH/OT8ih16JVT3wZOAwksa OA== From: jrossi@linux.ibm.com To: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, thuth@redhat.com Cc: frankja@linux.ibm.com, nsg@linux.ibm.com, jrossi@linux.ibm.com Subject: [PATCH 5/5] s390x: Enable and document boot device fallback on panic Date: Wed, 29 May 2024 11:43:11 -0400 Message-Id: <20240529154311.734548-6-jrossi@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240529154311.734548-1-jrossi@linux.ibm.com> References: <20240529154311.734548-1-jrossi@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: eOcfXpobV5j-6cIv0uHD2nBi9KOCD5VL X-Proofpoint-ORIG-GUID: -n9eJw642lP-qe813A85fO3HXd81Iz-I X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-29_12,2024-05-28_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 spamscore=0 mlxscore=0 clxscore=1015 bulkscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405290108 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.156.1; envelope-from=jrossi@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1716997505771100003 Content-Type: text/plain; charset="utf-8" From: Jared Rossi On a panic during IPL (i.e. a device failed to boot) check for another devi= ce to boot from, as indicated by the presence of an unused IPLB. If an IPLB is successfully loaded, then jump to the start of BIOS, restarti= ng IPL using the updated IPLB. Otherwise enter disabled wait. Signed-off-by: Jared Rossi --- docs/system/bootindex.rst | 7 ++++--- docs/system/s390x/bootdevices.rst | 9 ++++++--- pc-bios/s390-ccw/s390-ccw.h | 6 ++++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/docs/system/bootindex.rst b/docs/system/bootindex.rst index 8b057f812f..de597561bd 100644 --- a/docs/system/bootindex.rst +++ b/docs/system/bootindex.rst @@ -50,9 +50,10 @@ Limitations =20 Some firmware has limitations on which devices can be considered for booting. For instance, the PC BIOS boot specification allows only one -disk to be bootable. If boot from disk fails for some reason, the BIOS -won't retry booting from other disk. It can still try to boot from -floppy or net, though. +disk to be bootable, except for on s390x machines. If boot from disk fails= for +some reason, the BIOS won't retry booting from other disk. It can still t= ry to +boot from floppy or net, though. In the case of s390x, the BIOS will try = up to +8 total devices, any number of which may be disks. =20 Sometimes, firmware cannot map the device path QEMU wants firmware to boot from to a boot method. It doesn't happen for devices the firmware diff --git a/docs/system/s390x/bootdevices.rst b/docs/system/s390x/bootdevi= ces.rst index 1a7a18b43b..f096e1cc06 100644 --- a/docs/system/s390x/bootdevices.rst +++ b/docs/system/s390x/bootdevices.rst @@ -6,9 +6,7 @@ Booting with bootindex parameter =20 For classical mainframe guests (i.e. LPAR or z/VM installations), you alwa= ys have to explicitly specify the disk where you want to boot from (or "IPL" = from, -in s390x-speak -- IPL means "Initial Program Load"). In particular, there = can -also be only one boot device according to the architecture specification, = thus -specifying multiple boot devices is not possible (yet). +in s390x-speak -- IPL means "Initial Program Load"). =20 So for booting an s390x guest in QEMU, you should always mark the device where you want to boot from with the ``bootindex`` property, for @@ -17,6 +15,11 @@ example:: qemu-system-s390x -drive if=3Dnone,id=3Ddr1,file=3Dguest.qcow2 \ -device virtio-blk,drive=3Ddr1,bootindex=3D1 =20 +Multiple devices may have a bootindex. The lowest bootindex is assigned to= the +device to IPL first. If the IPL fails for the first, the device with the = second +lowest bootindex will be tried and so on until IPL is successful or there = are no +remaining boot devices to try. + For booting from a CD-ROM ISO image (which needs to include El-Torito boot information in order to be bootable), it is recommended to specify a ``scs= i-cd`` device, for example like this:: diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h index c977a52b50..de3d1f0d5a 100644 --- a/pc-bios/s390-ccw/s390-ccw.h +++ b/pc-bios/s390-ccw/s390-ccw.h @@ -43,6 +43,7 @@ typedef unsigned long long u64; #include "iplb.h" =20 /* start.s */ +extern char _start[]; void disabled_wait(void) __attribute__ ((__noreturn__)); void consume_sclp_int(void); void consume_io_int(void); @@ -88,6 +89,11 @@ __attribute__ ((__noreturn__)) static inline void panic(const char *string) { sclp_print(string); + if (load_next_iplb()) { + sclp_print("\nTrying next boot device..."); + jump_to_IPL_code((long)_start); + } + disabled_wait(); } =20 --=20 2.45.1