From nobody Sun Feb 8 12:01:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.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=google.com ARC-Seal: i=1; a=rsa-sha256; t=1571244858; cv=none; d=zoho.com; s=zohoarc; b=jdcHmf6SkgrFAsrl+SIclNDxOF02ubY1IKDKzVT7YpJEwl4kycAD5U0DRwEUG/Ts4H2V1KHAw4ukqmFcCDzcSKgwxU/my7qKydXQ3C1poT6Dmgc5Bgss6Ij9JS23yVVJZIRxaGQn1Kdk/88E5DM4TXlOlbE9cMZHjR5owEZRn60= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571244858; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jJrGsmisejq5BsmJhJyozl1VGOARUm605lXC7WQlSTg=; b=SW3MV0wJ30MMn13hsCueCBPqyn1m/hSO2ggOLQ+SdtyIsWDk9jwc3eAIKngPjYFmcfPiMY2Pq7rHxX1uCrm/Y+9B8RkQKXucZWPLjVyj06C+YaCQrq21sQB0vOavQAwBgtsFc9JvuBMarqOhy/62MH1R+SNOLgSmlQ19eY7wngY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571244858293655.7479452160546; Wed, 16 Oct 2019 09:54:18 -0700 (PDT) Received: from localhost ([::1]:45672 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iKmYz-0005oj-81 for importer@patchew.org; Wed, 16 Oct 2019 12:54:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36195) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <3a0inXQYKCow8q2uytw44w1u.s426u2A-tuBu1343w3A.47w@flex--sameid.bounces.google.com>) id 1iKmNS-0004G3-MK for qemu-devel@nongnu.org; Wed, 16 Oct 2019 12:42:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <3a0inXQYKCow8q2uytw44w1u.s426u2A-tuBu1343w3A.47w@flex--sameid.bounces.google.com>) id 1iKmNR-0006Gf-DD for qemu-devel@nongnu.org; Wed, 16 Oct 2019 12:42:22 -0400 Received: from mail-wr1-x449.google.com ([2a00:1450:4864:20::449]:44629) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from <3a0inXQYKCow8q2uytw44w1u.s426u2A-tuBu1343w3A.47w@flex--sameid.bounces.google.com>) id 1iKmNR-0006GD-6e for qemu-devel@nongnu.org; Wed, 16 Oct 2019 12:42:21 -0400 Received: by mail-wr1-x449.google.com with SMTP id n18so11968366wro.11 for ; Wed, 16 Oct 2019 09:42:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=jJrGsmisejq5BsmJhJyozl1VGOARUm605lXC7WQlSTg=; b=aHgoxQo67NIvAoSPLJkyoj+01YpH2YXalQ4j0UhVjNZahodZomhJ/keI6DhLY4qFwD Jvg2RmqryBx7dyzjgkpSqupqneWhrzQIGess1aTTh92aGpHzkrpKWHf7lmpu3GzCyrnV BkJSYNa4EKX3TWYntRA8T0gOZ3FaOTJp7m/J5cbOqBZKv1nSrbA9c9Pf7OGb0abZ1bo3 cw9+SzRw7eypvXl2W4rUjGVlVDd6RTF+0R890XAWTd1h1Ns8yAeRRbbOx6FoHpqMEykN GWGeTorSj2XZmFsJOEQvpsurkFwFAWD70u165hMqbizTEl3OiDEOJcBWXmg91v/sQESj NPuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=jJrGsmisejq5BsmJhJyozl1VGOARUm605lXC7WQlSTg=; b=gDbjurDRZtI2sL+ccCnA+XSH3OIhQ97ikPrRdPDzWtEbREFZb5jaqBiBi90h85G1Km XtrDeKjyhuIyJ1JONdGsHlE60EGDa1eM480WnTE/sY3ro9SdCBmeMOP4BKYS8EgqZa+G 3UkLNrxu73eH9X45ewBe+TymmWdabKeRRQFZAbgdC0LIp3ybpgGHALI02C1VfOKwx2vv JQ694kfFwQ6yoOoXYYuC+OtVauUIp7yfs7NfqSd1CJJMvnCfUgqfZqEywQnAoVgSh8nN 6y4OLsTwV0bVCKBMyOf4jJr9zbLBAt+Az2suj1d4svttdBD9MZrRs5zCBqOEIjc5hhQO T3wA== X-Gm-Message-State: APjAAAUrhQe+LnO9YLdIAn43hhK0+wkKnH3H7lVh/i60U2mzUxlEiwtI SbWG/p4RKdUnaeOzKfJv98UfLf77xHQMma7huNOzmTRRm3R2nTlwkQPFTjH/VlaDehXwUvjZzWW 0fgImD7K3I7pzCewSzT6r42nGbIdk/CroV4FtUoj8br87CSxTUBSFfLc14lQr X-Google-Smtp-Source: APXvYqwkPk5TVkSLUX7xLsbZdrT7MnLsYXIq2aWqw8O3FzmohrA54NQSI9AF2ixkTUOWttMkSZgWPu9Fg1Y= X-Received: by 2002:adf:fcd2:: with SMTP id f18mr3847264wrs.388.1571244139969; Wed, 16 Oct 2019 09:42:19 -0700 (PDT) Date: Wed, 16 Oct 2019 19:41:42 +0300 In-Reply-To: <20191016164145.115898-1-sameid@google.com> Message-Id: <20191016164145.115898-7-sameid@google.com> Mime-Version: 1.0 References: <20191016164145.115898-1-sameid@google.com> X-Mailer: git-send-email 2.23.0.700.g56cf767bdb-goog Subject: [PATCH v8 5/8] bootdevice: Gather LCHS from all relevant devices From: Sam Eiderman To: qemu-devel@nongnu.org Cc: arbel.moshe@oracle.com, karl.heubaum@oracle.com, kevin@koconnor.net, kraxel@redhat.com, kwolf@redhat.com, liran.alon@oracle.com, qemu-block@nongnu.org, sameid@google.com, seabios@seabios.org, lersek@redhat.com, philmd@redhat.com, jsnow@redhat.com, Sam Eiderman X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::449 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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 @google.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Sam Eiderman Relevant devices are: * ide-hd (and ide-cd, ide-drive) * scsi-hd (and scsi-cd, scsi-disk, scsi-block) * virtio-blk-pci We do not call del_boot_device_lchs() for ide-* since we don't need to - IDE block devices do not support unplugging. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman Signed-off-by: Sam Eiderman Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- hw/block/virtio-blk.c | 6 ++++++ hw/ide/qdev.c | 5 +++++ hw/scsi/scsi-disk.c | 12 ++++++++++++ 3 files changed, 23 insertions(+) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index ed2ddebd2b..c56e905f80 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -1200,6 +1200,11 @@ static void virtio_blk_device_realize(DeviceState *d= ev, Error **errp) blk_set_guest_block_size(s->blk, s->conf.conf.logical_block_size); =20 blk_iostatus_enable(s->blk); + + add_boot_device_lchs(dev, "/disk@0,0", + conf->conf.lcyls, + conf->conf.lheads, + conf->conf.lsecs); } =20 static void virtio_blk_device_unrealize(DeviceState *dev, Error **errp) @@ -1207,6 +1212,7 @@ static void virtio_blk_device_unrealize(DeviceState *= dev, Error **errp) VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); VirtIOBlock *s =3D VIRTIO_BLK(dev); =20 + del_boot_device_lchs(dev, "/disk@0,0"); virtio_blk_data_plane_destroy(s->dataplane); s->dataplane =3D NULL; qemu_del_vm_change_state_handler(s->change); diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 6dd219944f..2ffd387a73 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -220,6 +220,11 @@ static void ide_dev_initfn(IDEDevice *dev, IDEDriveKin= d kind, Error **errp) =20 add_boot_device_path(dev->conf.bootindex, &dev->qdev, dev->unit ? "/disk@1" : "/disk@0"); + + add_boot_device_lchs(&dev->qdev, dev->unit ? "/disk@1" : "/disk@0", + dev->conf.lcyls, + dev->conf.lheads, + dev->conf.lsecs); } =20 static void ide_dev_get_bootindex(Object *obj, Visitor *v, const char *nam= e, diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 68b1675fd9..07fb5ebdf1 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -35,6 +35,7 @@ #include "hw/block/block.h" #include "hw/qdev-properties.h" #include "sysemu/dma.h" +#include "sysemu/sysemu.h" #include "qemu/cutils.h" #include "trace.h" =20 @@ -2414,6 +2415,16 @@ static void scsi_realize(SCSIDevice *dev, Error **er= rp) blk_set_guest_block_size(s->qdev.conf.blk, s->qdev.blocksize); =20 blk_iostatus_enable(s->qdev.conf.blk); + + add_boot_device_lchs(&dev->qdev, NULL, + dev->conf.lcyls, + dev->conf.lheads, + dev->conf.lsecs); +} + +static void scsi_unrealize(SCSIDevice *dev, Error **errp) +{ + del_boot_device_lchs(&dev->qdev, NULL); } =20 static void scsi_hd_realize(SCSIDevice *dev, Error **errp) @@ -3018,6 +3029,7 @@ static void scsi_hd_class_initfn(ObjectClass *klass, = void *data) SCSIDeviceClass *sc =3D SCSI_DEVICE_CLASS(klass); =20 sc->realize =3D scsi_hd_realize; + sc->unrealize =3D scsi_unrealize; sc->alloc_req =3D scsi_new_request; sc->unit_attention_reported =3D scsi_disk_unit_attention_reported; dc->desc =3D "virtual SCSI disk"; --=20 2.23.0.700.g56cf767bdb-goog