From nobody Sat Apr 20 10:04:15 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=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1659694128; cv=none; d=zohomail.com; s=zohoarc; b=gKtGwtkLkQu9kA0oCdYCgLq51AnW3x4oPkRqlSfHOeimfkzXExRukLaEEvPPg8N2aw8NKDgmQyYVXd1dcg4sUWwYq2NUELwaSzJETWSYY9SCfMLRZAM/fGUWs9k5XPn3Sdwa950tWsE2B7a39zZ37k07E3IdmYLAA6gmZwS8lP8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659694128; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=a/zS7C9/2frkUzNou6lAzzXGlc0EIgLAaKLd4Z+SDL0=; b=JjC1UjVhVDhBaRC5nIGy51GEdbkvCzR7rE9Kp6z2Dh3HaM5AjC7zC1oryvaGDUiSgXxAsruzQyS6SeCbqTA5zfh2N8RBgeiD0GcpLReUOmzxFeGSqw58ePH5A2fYqPQCnR5xsVJySPOmQCkmEbPPUmD5jsmPapM+KBg47DZH4AQ= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1659694128376388.4970736884288; Fri, 5 Aug 2022 03:08:48 -0700 (PDT) Received: from localhost ([::1]:47542 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJuG6-0006EK-AY for importer@patchew.org; Fri, 05 Aug 2022 06:08:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJtqb-0002Eh-F1 for qemu-devel@nongnu.org; Fri, 05 Aug 2022 05:42:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:23328) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJtqX-0001xS-7E for qemu-devel@nongnu.org; Fri, 05 Aug 2022 05:42:22 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-578-Snf4TgaIOwOOVbk1fJv1dg-1; Fri, 05 Aug 2022 05:42:19 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B2F4785A586; Fri, 5 Aug 2022 09:42:18 +0000 (UTC) Received: from thuth.com (unknown [10.39.195.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2874A1415122; Fri, 5 Aug 2022 09:42:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659692540; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=a/zS7C9/2frkUzNou6lAzzXGlc0EIgLAaKLd4Z+SDL0=; b=UHk7iBvTqkaSY3YbgUt6T43bcLCIE4979dmOsIBU5r7j+u/yMkBOOlDqFI0k8kq9Q6e0B1 BtERwwvu3F6agdxHBJGggcyJE+PjTpZxMhCxtm7M8XfjLmyLdetsbLytZ6YYr68vakMYwt vQKKu4h520SjLi7hBihWGXb2vS3K5xc= X-MC-Unique: Snf4TgaIOwOOVbk1fJv1dg-1 From: Thomas Huth To: qemu-s390x@nongnu.org, Christian Borntraeger Cc: qemu-devel@nongnu.org, Cornelia Huck , Eric Farman , Halil Pasic Subject: [PATCH] pc-bios/s390-ccw: Fix booting with logical block size < physical block size Date: Fri, 5 Aug 2022 11:42:14 +0200 Message-Id: <20220805094214.285223-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1659694129197100001 Content-Type: text/plain; charset="utf-8" For accessing single blocks during boot, it's the logical block size that matters. (Physical block sizes are rather interesting e.g. for creating file systems with the correct alignment for speed reasons etc.). So the s390-ccw bios has to use the logical block size for calculating sector numbers during the boot phase, the "physical_block_exp" shift value must not be taken into account. This change fixes the boot process when the guest hast been installed on a disk where the logical block size differs from the physical one, e.g. if the guest has been installed like this: qemu-system-s390x -nographic -accel kvm -m 2G \ -drive if=3Dnone,id=3Dd1,file=3Dfedora.iso,format=3Draw,media=3Dcdrom \ -device virtio-scsi -device scsi-cd,drive=3Dd1 \ -drive if=3Dnone,id=3Dd2,file=3Dtest.qcow2,format=3Dqcow2 -device virtio-blk,drive=3Dd2,physical_block_size=3D4096,logical_block_si= ze=3D512 Linux correctly uses the logical block size of 512 for the installation, but the s390-ccw bios tries to boot from a disk with 4096 block size so far, as long as this patch has not been applied yet (well, it used to work by accident in the past due to the virtio_assume_scsi() hack that used to enforce 512 byte sectors on all virtio-block disks, but that hack has been well removed in commit 5447de2619050a0a4d to fix other scenarios). Fixes: 5447de2619 ("pc-bios/s390-ccw/virtio-blkdev: Remove virtio_assume_sc= si()") Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=3D2112303 Signed-off-by: Thomas Huth Reviewed-by: Cornelia Huck Reviewed-by: Eric Farman --- pc-bios/s390-ccw/virtio-blkdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pc-bios/s390-ccw/virtio-blkdev.c b/pc-bios/s390-ccw/virtio-blk= dev.c index 8271c47296..794f99b42c 100644 --- a/pc-bios/s390-ccw/virtio-blkdev.c +++ b/pc-bios/s390-ccw/virtio-blkdev.c @@ -173,7 +173,7 @@ int virtio_get_block_size(void) =20 switch (vdev->senseid.cu_model) { case VIRTIO_ID_BLOCK: - return vdev->config.blk.blk_size << vdev->config.blk.physical_bloc= k_exp; + return vdev->config.blk.blk_size; case VIRTIO_ID_SCSI: return vdev->scsi_block_size; } --=20 2.31.1