From nobody Mon Feb 9 23:01:09 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529377402630758.5608385359047; Mon, 18 Jun 2018 20:03:22 -0700 (PDT) Received: from localhost ([::1]:38874 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV6vK-00040h-Rq for importer@patchew.org; Mon, 18 Jun 2018 23:03:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46651) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fV5j3-0002e3-6A for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:46:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fV5iz-0000Ms-2n for qemu-devel@nongnu.org; Mon, 18 Jun 2018 21:46:29 -0400 Received: from mail-ot0-x229.google.com ([2607:f8b0:4003:c0f::229]:47065) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fV5iy-0000Mj-UJ; Mon, 18 Jun 2018 21:46:25 -0400 Received: by mail-ot0-x229.google.com with SMTP id v24-v6so12228704otk.13; Mon, 18 Jun 2018 18:46:24 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id j65-v6sm8103385otc.21.2018.06.18.18.46.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 18:46:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Gkw1g3XCFkrXU2javTcEWVy2J1meRvRzlxfdIx4+afg=; b=gMjSnWFhPQ0X6zZGprYfM6TG85yhC3OhCdW61x51ZbaAJi8XmMlF5fy0COUgnO5qL6 gYv4QT2fniEU/jy9aXom9GAO5k2vgkrvWFjwoaNw/UDHd6lobLb0RYT6wUXMtHPid9eK lvl5uvkS9gUUcUGzCaHymOczTaP/AsFlkPeZ/08RJfAOlyr8YHdAPnPYU8i2e+/uBcVC FGfAZVaKtBYWbzI/KnvTxLAQaSlD3CaXI3R4ePduc9zQLGnJ0EK0m9Q+lJgS0SQNMa9x k0Wrhr8d0LQ945F7IL6+aTaI+yVjKFI0E/XuO8TmxHmR+h+DFGqnMdjFjz4epq7syN55 5FJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Gkw1g3XCFkrXU2javTcEWVy2J1meRvRzlxfdIx4+afg=; b=kgoz5f12qhtZEAkWHe8BXPmiMyU18jTP+Hx6/pZnbYFolnVxEOCwxENw4pjUIDAzW5 mJOF2Vt7Bsbyb0BnAhtnSBMVjoK0CW1JXrlnGZZhY8iUO0luIFOlsJoQbZPLZIKKX/fu twMZ2uEPUkceaLnkEEQS2bL8xUgb14iF3WYNaUCNcFkjKtnOS/LWCJuZ6KAJ62jMs+K1 98Uty7WDiW+kAR0Rr8oCQvw0ZunRZpy7F1vg5FTPldpyFEgqnDJJcjwti4M0BjIKhFBV V4qsXACY6iJeHROOENU/HG54Hzu+tOT2G/bBdQABuIXboGBM+ZCxBJSV37zHT8s+iqiH cHbA== X-Gm-Message-State: APt69E1ma19Iditb8x08RxIDpI4mq2UAgbMNK19E2TO8VHG4GBdJjJLJ vqz9PMIMKFLVZylyP/M9m20qCOTyF3w= X-Google-Smtp-Source: ADUXVKKWIoTJDBk4NpdlawMl9ly3Efe0ojIQyFwyLWQ/XPCM9rTxOz9JzgxAPeWGRnHlOCHwtNQRXQ== X-Received: by 2002:a9d:3351:: with SMTP id u17-v6mr9964899otd.221.1529372783753; Mon, 18 Jun 2018 18:46:23 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 18 Jun 2018 20:42:28 -0500 Message-Id: <20180619014319.28272-63-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> References: <20180619014319.28272-1-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c0f::229 Subject: [Qemu-devel] [PATCH 062/113] s390: Do not pass inofficial IPL type to the guest X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cornelia Huck , qemu-stable@nongnu.org, Viktor Mihajlovski Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Viktor Mihajlovski IPL over a virtio-scsi device requires special handling not available in the real architecture. For this purpose the IPL type 0xFF has been chosen as means of communication between QEMU and the pc-bios. However, a guest OS could be confused by seeing an unknown IPL type. This change sets the IPL parameter type to 0x02 (CCW) to prevent this. Pre-existing Linux has looked up the IPL parameters only in the case of FCP IPL. This means that the behavior should stay the same even if Linux checks for the IPL type unconditionally. Signed-off-by: Viktor Mihajlovski Message-Id: <1522940844-12336-4-git-send-email-mihajlov@linux.vnet.ibm.com> Reviewed-by: Christian Borntraeger Signed-off-by: Cornelia Huck (cherry picked from commit e8c7ef288abb05b741a95418ee2de85c1071e0db) Signed-off-by: Michael Roth --- pc-bios/s390-ccw/bootmap.c | 7 +++++++ pc-bios/s390-ccw/iplb.h | 15 +++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c index 67a6123ed4..bc01bbccbe 100644 --- a/pc-bios/s390-ccw/bootmap.c +++ b/pc-bios/s390-ccw/bootmap.c @@ -50,6 +50,13 @@ static void jump_to_IPL_code(uint64_t address) { /* store the subsystem information _after_ the bootmap was loaded */ write_subsystem_identification(); + + /* prevent unknown IPL types in the guest */ + if (iplb.pbt =3D=3D S390_IPL_TYPE_QEMU_SCSI) { + iplb.pbt =3D S390_IPL_TYPE_CCW; + set_iplb(&iplb); + } + /* * The IPL PSW is at address 0. We also must not overwrite the * content of non-BIOS memory after we loaded the guest, so we diff --git a/pc-bios/s390-ccw/iplb.h b/pc-bios/s390-ccw/iplb.h index 890aed9ece..40fc2d8e21 100644 --- a/pc-bios/s390-ccw/iplb.h +++ b/pc-bios/s390-ccw/iplb.h @@ -77,16 +77,27 @@ extern IplParameterBlock iplb __attribute__((__aligned_= _(PAGE_SIZE))); #define S390_IPL_TYPE_CCW 0x02 #define S390_IPL_TYPE_QEMU_SCSI 0xff =20 -static inline bool store_iplb(IplParameterBlock *iplb) +static inline bool manage_iplb(IplParameterBlock *iplb, bool store) { register unsigned long addr asm("0") =3D (unsigned long) iplb; register unsigned long rc asm("1") =3D 0; =20 asm volatile ("diag %0,%2,0x308\n" : "+d" (addr), "+d" (rc) - : "d" (6) + : "d" (store ? 6 : 5) : "memory", "cc"); return rc =3D=3D 0x01; } =20 + +static inline bool store_iplb(IplParameterBlock *iplb) +{ + return manage_iplb(iplb, true); +} + +static inline bool set_iplb(IplParameterBlock *iplb) +{ + return manage_iplb(iplb, false); +} + #endif /* IPLB_H */ --=20 2.11.0