From patchwork Fri Aug 29 09:01:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Freimann X-Patchwork-Id: 384098 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 7C93C14009B for ; Fri, 29 Aug 2014 19:03:53 +1000 (EST) Received: from localhost ([::1]:40766 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNI63-00017u-CC for incoming@patchwork.ozlabs.org; Fri, 29 Aug 2014 05:03:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNI4K-0006V4-QJ for qemu-devel@nongnu.org; Fri, 29 Aug 2014 05:02:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XNI4B-0006Mf-P9 for qemu-devel@nongnu.org; Fri, 29 Aug 2014 05:02:04 -0400 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:54434) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNI4B-0006MO-Hq for qemu-devel@nongnu.org; Fri, 29 Aug 2014 05:01:55 -0400 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 29 Aug 2014 10:01:50 +0100 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 29 Aug 2014 10:01:47 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 9F834219005F for ; Fri, 29 Aug 2014 10:01:28 +0100 (BST) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s7T91l3047382602 for ; Fri, 29 Aug 2014 09:01:47 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s7T91kHm023266 for ; Fri, 29 Aug 2014 03:01:46 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s7T91kjF023256; Fri, 29 Aug 2014 03:01:46 -0600 Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 1122) id 27B06122443E; Fri, 29 Aug 2014 11:01:46 +0200 (CEST) From: Jens Freimann To: Christian Borntraeger , Alexander Graf , Cornelia Huck Date: Fri, 29 Aug 2014 11:01:37 +0200 Message-Id: <1409302902-57391-3-git-send-email-jfrei@linux.vnet.ibm.com> X-Mailer: git-send-email 1.8.5.5 In-Reply-To: <1409302902-57391-1-git-send-email-jfrei@linux.vnet.ibm.com> References: <1409302902-57391-1-git-send-email-jfrei@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14082909-5024-0000-0000-0000011F3F61 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.107 Cc: "Eugene \(jno\) Dvurechenski" , Jens Freimann , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 2/7] 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 --- 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)