From patchwork Mon Sep 1 12:54:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Borntraeger X-Patchwork-Id: 384813 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id A96311401AC for ; Mon, 1 Sep 2014 22:59:37 +1000 (EST) Received: from localhost ([::1]:60128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XORCp-0001dN-QS for incoming@patchwork.ozlabs.org; Mon, 01 Sep 2014 08:59:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58881) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOR7v-0001d4-B1 for qemu-devel@nongnu.org; Mon, 01 Sep 2014 08:54:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOR7g-00055z-IF for qemu-devel@nongnu.org; Mon, 01 Sep 2014 08:54:31 -0400 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:52408) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOR7g-000556-9D for qemu-devel@nongnu.org; Mon, 01 Sep 2014 08:54:16 -0400 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 1 Sep 2014 13:54:15 +0100 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 1 Sep 2014 13:54:13 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 905371B08069 for ; Mon, 1 Sep 2014 13:55:12 +0100 (BST) Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s81CsCIZ37945372 for ; Mon, 1 Sep 2014 12:54:12 GMT Received: from d06av02.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s81CsAfW002621 for ; Mon, 1 Sep 2014 06:54:12 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s81Cs97n002593; Mon, 1 Sep 2014 06:54:09 -0600 Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id AEBE1122443E; Mon, 1 Sep 2014 14:54:09 +0200 (CEST) From: Christian Borntraeger To: Peter Maydell Date: Mon, 1 Sep 2014 14:54:17 +0200 Message-Id: <1409576070-55803-7-git-send-email-borntraeger@de.ibm.com> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1409576070-55803-1-git-send-email-borntraeger@de.ibm.com> References: <1409576070-55803-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14090112-5024-0000-0000-00000124CFFF X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.107 Cc: qemu-devel , Alexander Graf , Christian Borntraeger , Jens Freimann , Anthony Liguori , Cornelia Huck , "Eugene \(jno\) Dvurechenski" , Richard Henderson Subject: [Qemu-devel] [PULL 06/19] pc-bios/s390-ccw: handle more ECKD DASD block sizes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: "Eugene (jno) Dvurechenski" Using dasdfmt(8) to format a DASD allows to choose a block size. There are four supported values: 512, 1024, 2048, and 4096 bytes per block. Each block size leads to selection of new count of sectors per track. The head count remains always the same: 15. This empiric knowledge is used to detect ECKD DASD to IPL from. Signed-off-by: Eugene (jno) Dvurechenski Reviewed-by: David Hildenbrand Acked-by: Christian Borntraeger Signed-off-by: Jens Freimann Signed-off-by: Christian Borntraeger --- pc-bios/s390-ccw/virtio.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c index 04977e4..6ed3dc9 100644 --- a/pc-bios/s390-ccw/virtio.c +++ b/pc-bios/s390-ccw/virtio.c @@ -299,14 +299,35 @@ bool virtio_disk_is_scsi(void) && (virtio_get_block_size() == 512); } +/* + * Other supported value pairs, if any, would need to be added here. + * Note: head count is always 15. + */ +static inline u8 virtio_eckd_sectors_for_block_size(int size) +{ + switch (size) { + case 512: + return 49; + case 1024: + return 33; + case 2048: + return 21; + case 4096: + return 12; + } + return 0; +} + bool virtio_disk_is_eckd(void) { + const int block_size = virtio_get_block_size(); + if (guessed_disk_nature) { - return (virtio_get_block_size() == 4096); + return (block_size == 4096); } return (blk_cfg.geometry.heads == 15) - && (blk_cfg.geometry.sectors == 12) - && (virtio_get_block_size() == 4096); + && (blk_cfg.geometry.sectors == + virtio_eckd_sectors_for_block_size(block_size)); } bool virtio_ipl_disk_is_valid(void)