From nobody Fri Apr 19 09:08:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572519623; cv=none; d=zoho.com; s=zohoarc; b=mr2yrWuLWXL030MSlTAGG9cYk7MOJC7mGfk+VbtTIkbe2IsETCarRJR9MUG04QuAgck5JcMN4bWjGQ0xFn2djbStNF4WIOGpHqw1WSMGSbRaZ4DaoRxXB69DRYDLKGlyMOjftpOdYKxUrJtxLJCUPyD4+j6g3pxefKkkWZiK+98= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572519623; h=Content-Type:Content-Transfer-Encoding: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=jI8BIuabWTuRg01qaaxsFWLVziW5Z37agMu/g/7eDjY=; b=TYMDZPq9UvmUxrgBsqy1CexIOo2PtT8CVfounK4J7TsplPnyhXXGlwJE4F58XXg9w6mAz7UusLyon5FCDhukwvnS9XZHPkvnuGnyjqJ7ska6vdC6SU44fs2FKlT79WXNE3WgUIiNqrXZlvKO4DwTt/xv9s8fgG+6RY6j25/PMKE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1572519623026284.8808003838151; Thu, 31 Oct 2019 04:00:23 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-288-wZh8tX0cOOuS0DwEymkb-w-1; Thu, 31 Oct 2019 07:00:19 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BC52C1005500; Thu, 31 Oct 2019 11:00:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7310A5D6A3; Thu, 31 Oct 2019 11:00:14 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BF9E218089CD; Thu, 31 Oct 2019 11:00:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9VB0Ca7005625 for ; Thu, 31 Oct 2019 07:00:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6F8EB60C85; Thu, 31 Oct 2019 11:00:12 +0000 (UTC) Received: from probe.redhat.com (ovpn-121-17.rdu2.redhat.com [10.10.121.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2281D60C05; Thu, 31 Oct 2019 10:59:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572519621; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=jI8BIuabWTuRg01qaaxsFWLVziW5Z37agMu/g/7eDjY=; b=SZBFFn4X7z25YEiRmr4ccyEfR+qDHc5LYpIIv9WRrfGxBZB65cEWzQgZLy09zjQLw28il/ Dn6cb5R8s8dCxPtRdFq2y/CdgokQr6UX2WCPUDPZftZ0zwPRgvU1wNNQmm+gnZlTTnc/Yw MvsT51csjhMCIjh831AmJQP8iOZ8b3M= From: John Snow To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 31 Oct 2019 06:58:56 -0400 Message-Id: <20191031105904.12194-2-jsnow@redhat.com> In-Reply-To: <20191031105904.12194-1-jsnow@redhat.com> References: <20191031105904.12194-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Fam Zheng , Thomas Huth , Peter Krempa , qemu-block@nongnu.org, "Michael S. Tsirkin" , libvir-list@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Laszlo Ersek , "Gonglei \(Arei\)" , Gerd Hoffmann , Stefan Hajnoczi , Laurent Vivier , Paolo Bonzini , Max Reitz , John Snow Subject: [libvirt] [PULL 1/9] IDE: deprecate ide-drive X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: wZh8tX0cOOuS0DwEymkb-w-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" It's an old compatibility shim that just delegates to ide-cd or ide-hd. I'd like to refactor these some day, and getting rid of the super-object will make that easier. Either way, we don't need this. Signed-off-by: John Snow Reviewed-by: Thomas Huth Reviewed-by: Markus Armbruster ACKed-by: Peter Krempa Message-id: 20191009224303.10232-2-jsnow@redhat.com Signed-off-by: John Snow --- qemu-deprecated.texi | 5 +++++ hw/ide/qdev.c | 3 +++ tests/qemu-iotests/051.pc.out | 6 ++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index f727bd3932..296bfc93a3 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -254,6 +254,11 @@ quite a bit. It will be removed without replacement un= less some users speaks up at the @email{qemu-devel@@nongnu.org} mailing list with information abo= ut their usecases. =20 +@subsection ide-drive (since 4.2) + +The 'ide-drive' device is deprecated. Users should use 'ide-hd' or +'ide-cd' as appropriate to get an IDE hard disk or CD-ROM as needed. + @section System emulator machines =20 @subsection pc-0.12, pc-0.13, pc-0.14 and pc-0.15 (since 4.0) diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 6fba6b62b8..3666e59721 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -279,6 +279,9 @@ static void ide_drive_realize(IDEDevice *dev, Error **e= rrp) { DriveInfo *dinfo =3D NULL; =20 + warn_report("'ide-drive' is deprecated, " + "please use 'ide-hd' or 'ide-cd' instead"); + if (dev->conf.blk) { dinfo =3D blk_legacy_dinfo(dev->conf.blk); } diff --git a/tests/qemu-iotests/051.pc.out b/tests/qemu-iotests/051.pc.out index 000557c7c8..34849dd172 100644 --- a/tests/qemu-iotests/051.pc.out +++ b/tests/qemu-iotests/051.pc.out @@ -158,7 +158,8 @@ QEMU X.Y.Z monitor - type 'help' for more information =20 Testing: -drive if=3Dnone,id=3Ddisk -device ide-drive,drive=3Ddisk QEMU X.Y.Z monitor - type 'help' for more information -(qemu) QEMU_PROG: -device ide-drive,drive=3Ddisk: Device needs media, but = drive is empty +(qemu) QEMU_PROG: -device ide-drive,drive=3Ddisk: warning: 'ide-drive' is = deprecated, please use 'ide-hd' or 'ide-cd' instead +QEMU_PROG: -device ide-drive,drive=3Ddisk: Device needs media, but drive i= s empty =20 Testing: -drive if=3Dnone,id=3Ddisk -device ide-hd,drive=3Ddisk QEMU X.Y.Z monitor - type 'help' for more information @@ -228,7 +229,8 @@ QEMU X.Y.Z monitor - type 'help' for more information =20 Testing: -drive file=3DTEST_DIR/t.qcow2,if=3Dnone,id=3Ddisk,readonly=3Don = -device ide-drive,drive=3Ddisk QEMU X.Y.Z monitor - type 'help' for more information -(qemu) QEMU_PROG: -device ide-drive,drive=3Ddisk: Block node is read-only +(qemu) QEMU_PROG: -device ide-drive,drive=3Ddisk: warning: 'ide-drive' is = deprecated, please use 'ide-hd' or 'ide-cd' instead +QEMU_PROG: -device ide-drive,drive=3Ddisk: Block node is read-only =20 Testing: -drive file=3DTEST_DIR/t.qcow2,if=3Dnone,id=3Ddisk,readonly=3Don = -device ide-hd,drive=3Ddisk QEMU X.Y.Z monitor - type 'help' for more information --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 19 09:08:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572519641; cv=none; d=zoho.com; s=zohoarc; b=LNQ2S3X0n51MyO7zwnqs2GYbkOWtZXTd6lq6Yd59hC8KSfJhpR4Y4TDsyqyf/y0UbRlKyWiZXzylvsnI++z/q2zloc60tbsJAQ6L2CJYs/dNU0xFk1tA6dNIsdSMIsw6xOAYNVykpa6p7pmUpUFUEPdQyfNXqXgFK/5pIPcegM0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572519641; h=Content-Type:Content-Transfer-Encoding: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=q6mRRniM8NdXyTwNu4VHOljSENjD3BgZccgArGI49ys=; b=ecz6mzAMgrayt8f2QH0TDVMopspIqglCUjEgerWkF1z7R/3daCF1VdbSoiXqs4CaAbV+EDzQnt3gmbX/ucP+fOwJLYMoNZm4HdW4GU9vKmAiftICYIy1Tj5mbDug5ktcx8DjwgbVqpUS8D3n3RkV5nJcaehcNl2KzA89JN21h8c= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1572519641674831.2414777529011; Thu, 31 Oct 2019 04:00:41 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-356-wgxRYeQBPbqLHSZ3d_TfCg-1; Thu, 31 Oct 2019 07:00:38 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D3A8385B6EF; Thu, 31 Oct 2019 11:00:33 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A7E2B5DA75; Thu, 31 Oct 2019 11:00:33 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5ADF14BB65; Thu, 31 Oct 2019 11:00:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9VB0Vm0005649 for ; Thu, 31 Oct 2019 07:00:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3D5C860C18; Thu, 31 Oct 2019 11:00:31 +0000 (UTC) Received: from probe.redhat.com (ovpn-121-17.rdu2.redhat.com [10.10.121.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id B990860C05; Thu, 31 Oct 2019 11:00:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572519640; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=q6mRRniM8NdXyTwNu4VHOljSENjD3BgZccgArGI49ys=; b=ZKc9P02nqgEK+bjpQsnB1qWKi1v6Cpkd8Sq7UQEx+7xendPeAD295wlHYCKsrwcvjiSHY4 q0HHiH7pAtz1V6oOsQuFmVITgijGoLHofexzaqV/VxqSdZI1/OGtUt6dtuc5JCtMD/5pIA gwhAQKRvBcY4uEB9N99KoIcRNFF5RUc= From: John Snow To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 31 Oct 2019 06:58:57 -0400 Message-Id: <20191031105904.12194-3-jsnow@redhat.com> In-Reply-To: <20191031105904.12194-1-jsnow@redhat.com> References: <20191031105904.12194-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Fam Zheng , Thomas Huth , qemu-block@nongnu.org, "Michael S. Tsirkin" , libvir-list@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Arbel Moshe , Laszlo Ersek , "Gonglei \(Arei\)" , Sam Eiderman , Gerd Hoffmann , Stefan Hajnoczi , Laurent Vivier , Paolo Bonzini , Sam Eiderman , Max Reitz , John Snow , Karl Heubaum Subject: [libvirt] [PULL 2/9] block: Refactor macros - fix tabbing X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: wgxRYeQBPbqLHSZ3d_TfCg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) From: Sam Eiderman Fixing tabbing in block related macros. Signed-off-by: Sam Eiderman Signed-off-by: Sam Eiderman Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: John Snow --- include/hw/block/block.h | 16 ++++++++-------- hw/ide/qdev.c | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/hw/block/block.h b/include/hw/block/block.h index 607539057a..fd55a30bca 100644 --- a/include/hw/block/block.h +++ b/include/hw/block/block.h @@ -50,21 +50,21 @@ static inline unsigned int get_physical_block_exp(Block= Conf *conf) _conf.logical_block_size), \ DEFINE_PROP_BLOCKSIZE("physical_block_size", _state, \ _conf.physical_block_size), \ - DEFINE_PROP_UINT16("min_io_size", _state, _conf.min_io_size, 0), \ + DEFINE_PROP_UINT16("min_io_size", _state, _conf.min_io_size, 0), \ DEFINE_PROP_UINT32("opt_io_size", _state, _conf.opt_io_size, 0), \ - DEFINE_PROP_UINT32("discard_granularity", _state, \ - _conf.discard_granularity, -1), \ - DEFINE_PROP_ON_OFF_AUTO("write-cache", _state, _conf.wce, \ - ON_OFF_AUTO_AUTO), \ + DEFINE_PROP_UINT32("discard_granularity", _state, \ + _conf.discard_granularity, -1), \ + DEFINE_PROP_ON_OFF_AUTO("write-cache", _state, _conf.wce, \ + ON_OFF_AUTO_AUTO), \ DEFINE_PROP_BOOL("share-rw", _state, _conf.share_rw, false) =20 #define DEFINE_BLOCK_PROPERTIES(_state, _conf) \ DEFINE_PROP_DRIVE("drive", _state, _conf.blk), \ DEFINE_BLOCK_PROPERTIES_BASE(_state, _conf) =20 -#define DEFINE_BLOCK_CHS_PROPERTIES(_state, _conf) \ - DEFINE_PROP_UINT32("cyls", _state, _conf.cyls, 0), \ - DEFINE_PROP_UINT32("heads", _state, _conf.heads, 0), \ +#define DEFINE_BLOCK_CHS_PROPERTIES(_state, _conf) \ + DEFINE_PROP_UINT32("cyls", _state, _conf.cyls, 0), \ + DEFINE_PROP_UINT32("heads", _state, _conf.heads, 0), \ DEFINE_PROP_UINT32("secs", _state, _conf.secs, 0) =20 #define DEFINE_BLOCK_ERROR_PROPERTIES(_state, _conf) \ diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 3666e59721..85cca6ec38 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -293,7 +293,7 @@ static void ide_drive_realize(IDEDevice *dev, Error **e= rrp) DEFINE_BLOCK_PROPERTIES(IDEDrive, dev.conf), \ DEFINE_BLOCK_ERROR_PROPERTIES(IDEDrive, dev.conf), \ DEFINE_PROP_STRING("ver", IDEDrive, dev.version), \ - DEFINE_PROP_UINT64("wwn", IDEDrive, dev.wwn, 0), \ + DEFINE_PROP_UINT64("wwn", IDEDrive, dev.wwn, 0), \ DEFINE_PROP_STRING("serial", IDEDrive, dev.serial),\ DEFINE_PROP_STRING("model", IDEDrive, dev.model) =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 19 09:08:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572519661; cv=none; d=zoho.com; s=zohoarc; b=mtLIgsl6yaYiKw8Gxko7uzymtI3sQmp1CTcnCDpydpFly4JvDkZYT/EjlcdBN3iz8PYkDcI5C/IGkmELZ/1uh1+AtaZuJzf1ZLOwTJZ2exU5r9yD5n6T01TpVXE5Elsgoh7D1OfRXi+kzqH9gqMMj64Rkxts8qH38iircSA25wQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572519661; h=Content-Type:Content-Transfer-Encoding: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=es7v8mKQcJQK8JuXJYKEEHBy9iu9a0L/RYhyoHjU8bg=; b=ZdNsGpmAexbrxYZ53BdBUEWzOn/3hFV8Jc9Y2swz9nH31YYOn1hVdwSjz16t8rZsQcHLCbSDtTI2AlOfuZ07nS/L92Q0PBCJX16Muw/a/N65fSmJjvihFkBUAMqkErceqSAUKiX16rOdry5GfcXjTVYClw471DQLD/bo6W/Z+G0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1572519661055292.88844073004327; Thu, 31 Oct 2019 04:01:01 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-96-sYiNxStRO_mf-jrq4f83wA-1; Thu, 31 Oct 2019 07:00:57 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 42F021800D56; Thu, 31 Oct 2019 11:00:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 16B0E6016B; Thu, 31 Oct 2019 11:00:52 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B6DFD4BB78; Thu, 31 Oct 2019 11:00:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9VB0oXG005683 for ; Thu, 31 Oct 2019 07:00:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id C8D9A6106C; Thu, 31 Oct 2019 11:00:50 +0000 (UTC) Received: from probe.redhat.com (ovpn-121-17.rdu2.redhat.com [10.10.121.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 85B4D60C05; Thu, 31 Oct 2019 11:00:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572519660; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=es7v8mKQcJQK8JuXJYKEEHBy9iu9a0L/RYhyoHjU8bg=; b=AJ7si3iwGXro8j8nanWB3bX7uxxDQWznOlNOCiFPBD7Tjt1dlY0gfLeoni9o37dQLec9yF +ySCU+6NOlQSV89IWljoUQor5Pb+A4iNW0AVLilofklQ91dGUOBYuk06Klrjd7co0nwlu8 BcTSK7CDKH450Vj8iHieNsrlO9e9bFM= From: John Snow To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 31 Oct 2019 06:58:58 -0400 Message-Id: <20191031105904.12194-4-jsnow@redhat.com> In-Reply-To: <20191031105904.12194-1-jsnow@redhat.com> References: <20191031105904.12194-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Fam Zheng , Thomas Huth , qemu-block@nongnu.org, "Michael S. Tsirkin" , libvir-list@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Arbel Moshe , Laszlo Ersek , "Gonglei \(Arei\)" , Sam Eiderman , Gerd Hoffmann , Stefan Hajnoczi , Laurent Vivier , Paolo Bonzini , Sam Eiderman , Max Reitz , John Snow , Karl Heubaum Subject: [libvirt] [PULL 3/9] block: Support providing LCHS from user X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: sYiNxStRO_mf-jrq4f83wA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) From: Sam Eiderman Add logical geometry variables to BlockConf. A user can now supply "lcyls", "lheads" & "lsecs" for any HD device that supports CHS ("cyls", "heads", "secs"). These devices include: * ide-hd * scsi-hd * virtio-blk-pci In future commits we will use the provided LCHS and pass it to the BIOS through fw_cfg to be supplied using INT13 routines. 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 Signed-off-by: John Snow --- include/hw/block/block.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/hw/block/block.h b/include/hw/block/block.h index fd55a30bca..d7246f3862 100644 --- a/include/hw/block/block.h +++ b/include/hw/block/block.h @@ -26,6 +26,7 @@ typedef struct BlockConf { uint32_t discard_granularity; /* geometry, not all devices use this */ uint32_t cyls, heads, secs; + uint32_t lcyls, lheads, lsecs; OnOffAuto wce; bool share_rw; BlockdevOnError rerror; @@ -65,7 +66,10 @@ static inline unsigned int get_physical_block_exp(BlockC= onf *conf) #define DEFINE_BLOCK_CHS_PROPERTIES(_state, _conf) \ DEFINE_PROP_UINT32("cyls", _state, _conf.cyls, 0), \ DEFINE_PROP_UINT32("heads", _state, _conf.heads, 0), \ - DEFINE_PROP_UINT32("secs", _state, _conf.secs, 0) + DEFINE_PROP_UINT32("secs", _state, _conf.secs, 0), \ + DEFINE_PROP_UINT32("lcyls", _state, _conf.lcyls, 0), \ + DEFINE_PROP_UINT32("lheads", _state, _conf.lheads, 0), \ + DEFINE_PROP_UINT32("lsecs", _state, _conf.lsecs, 0) =20 #define DEFINE_BLOCK_ERROR_PROPERTIES(_state, _conf) \ DEFINE_PROP_BLOCKDEV_ON_ERROR("rerror", _state, _conf.rerror, \ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 19 09:08:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572519728; cv=none; d=zoho.com; s=zohoarc; b=GEPMsEcGltAREfbnFN+K/8rHxV1n/yF9t7FBQX+aQ7gFayoUc2StULh/7Ogud4WPnMMPGK02N4smVLAo/8rjvrUaGhO1lV4SjK0a+kZarvEuArKJJiGM9n7nBfOY/NoWMVsMXrmlmu48b74fNFsfYxvTQrPlxmPEJTijnsRQk9o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572519728; h=Content-Type:Content-Transfer-Encoding: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=ibG8Vaj/xc1n3kE9adCGVdKIAMVWif0tEmj6yMI20Zc=; b=crrZQJUEaTmo1+sfjvO73Ix2iVycJn3FSiZ78Vn3qe6hj5YnnsaP/2yQ4j0QNyBTKUpJIkXcXuhMw9xcSS3W/qcqKtWZMRCKnlB3t2/y6mQamjEOz14LUJD9BX5plL2r0j+fGNGLNv+4a8kl+tsteLDVRWcQwxOKMzrShS/rYIA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 157251972834938.79642792951836; Thu, 31 Oct 2019 04:02:08 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-165-Wo2JWunXOrW7VkfsPjxWBg-1; Thu, 31 Oct 2019 07:02:02 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B6938801E7E; Thu, 31 Oct 2019 11:01:55 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 83315600CD; Thu, 31 Oct 2019 11:01:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2A2574E562; Thu, 31 Oct 2019 11:01:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9VB1suC005801 for ; Thu, 31 Oct 2019 07:01:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0BA8A60C05; Thu, 31 Oct 2019 11:01:54 +0000 (UTC) Received: from probe.redhat.com (ovpn-121-17.rdu2.redhat.com [10.10.121.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B74A6106A; Thu, 31 Oct 2019 11:00:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572519725; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ibG8Vaj/xc1n3kE9adCGVdKIAMVWif0tEmj6yMI20Zc=; b=J4JOnQNS5hYnYA1cVVVRH7GuoMWjanFzgEa57E8x1H6WTmcpW1ZdsgQKQjFEgOSNR/zxGB zc3sJQQARmwl1qlm4ulfI3XOqzSs3gfEtYWHZi/ed7l7T0SemQuu+/kSjtebFHHhf8vciD 3Xd3oU3NZHYHnAee9Gn+L5KLvXyZXNo= From: John Snow To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 31 Oct 2019 06:58:59 -0400 Message-Id: <20191031105904.12194-5-jsnow@redhat.com> In-Reply-To: <20191031105904.12194-1-jsnow@redhat.com> References: <20191031105904.12194-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Fam Zheng , Thomas Huth , qemu-block@nongnu.org, "Michael S. Tsirkin" , libvir-list@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Arbel Moshe , Laszlo Ersek , "Gonglei \(Arei\)" , Sam Eiderman , Gerd Hoffmann , Stefan Hajnoczi , Laurent Vivier , Paolo Bonzini , Sam Eiderman , Max Reitz , John Snow , Karl Heubaum Subject: [libvirt] [PULL 4/9] bootdevice: Add interface to gather LCHS X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: Wo2JWunXOrW7VkfsPjxWBg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) From: Sam Eiderman Add an interface to provide direct logical CHS values for boot devices. We will use this interface in the next commits. 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 Signed-off-by: John Snow --- include/sysemu/sysemu.h | 3 +++ bootdevice.c | 55 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 44f18eb739..5bc5c79cbc 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -103,6 +103,9 @@ void device_add_bootindex_property(Object *obj, int32_t= *bootindex, DeviceState *dev, Error **errp); void restore_boot_order(void *opaque); void validate_bootdevices(const char *devices, Error **errp); +void add_boot_device_lchs(DeviceState *dev, const char *suffix, + uint32_t lcyls, uint32_t lheads, uint32_t lsecs); +void del_boot_device_lchs(DeviceState *dev, const char *suffix); =20 /* handler to set the boot_device order for a specific type of MachineClas= s */ typedef void QEMUBootSetHandler(void *opaque, const char *boot_order, diff --git a/bootdevice.c b/bootdevice.c index 1d225202f9..bc5e1c2de4 100644 --- a/bootdevice.c +++ b/bootdevice.c @@ -343,3 +343,58 @@ void device_add_bootindex_property(Object *obj, int32_= t *bootindex, /* initialize devices' bootindex property to -1 */ object_property_set_int(obj, -1, name, NULL); } + +typedef struct FWLCHSEntry FWLCHSEntry; + +struct FWLCHSEntry { + QTAILQ_ENTRY(FWLCHSEntry) link; + DeviceState *dev; + char *suffix; + uint32_t lcyls; + uint32_t lheads; + uint32_t lsecs; +}; + +static QTAILQ_HEAD(, FWLCHSEntry) fw_lchs =3D + QTAILQ_HEAD_INITIALIZER(fw_lchs); + +void add_boot_device_lchs(DeviceState *dev, const char *suffix, + uint32_t lcyls, uint32_t lheads, uint32_t lsecs) +{ + FWLCHSEntry *node; + + if (!lcyls && !lheads && !lsecs) { + return; + } + + assert(dev !=3D NULL || suffix !=3D NULL); + + node =3D g_malloc0(sizeof(FWLCHSEntry)); + node->suffix =3D g_strdup(suffix); + node->dev =3D dev; + node->lcyls =3D lcyls; + node->lheads =3D lheads; + node->lsecs =3D lsecs; + + QTAILQ_INSERT_TAIL(&fw_lchs, node, link); +} + +void del_boot_device_lchs(DeviceState *dev, const char *suffix) +{ + FWLCHSEntry *i; + + if (dev =3D=3D NULL) { + return; + } + + QTAILQ_FOREACH(i, &fw_lchs, link) { + if ((!suffix || !g_strcmp0(i->suffix, suffix)) && + i->dev =3D=3D dev) { + QTAILQ_REMOVE(&fw_lchs, i, link); + g_free(i->suffix); + g_free(i); + + break; + } + } +} --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 19 09:08:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572519780; cv=none; d=zoho.com; s=zohoarc; b=oKH0Jsa/m4iCE8CUst7ltwz0CxJWTUw9mSJkyOIJvKY+fIBr4PaG0f2bRcyhY03o0eanTwFreHtYkw0C25OPOfjl3e7xyaiMV1VASpyNW61DJbkHeDB54bYmJwbSFM9fN2LydQPBxYtyfN2wz8ycQdGTn9mt+ZO0ol4eux5XmDo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572519780; h=Content-Type:Content-Transfer-Encoding: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=UTESl6nYUsalORiIipovB3ovyUrKIuS3uRhCc7pprnE=; b=Ag8X+kbrbewx8jljJ768uarNmCwsXuU5LSexpoc6xrPE3upOvZwKdmy1oXQ9XpakcQfYHUrPPyCVUmFxJQttHbSW2J0/DFQBBidCohKj8pfElFtBqd9LG1djMK25K+Ah2m6wn6ojKi8WSbrqTXXi4BfVc4Cd7sdIcYvgl/vlC2M= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1572519780818803.3642570231807; Thu, 31 Oct 2019 04:03:00 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-48-eVD4-bdwNoaPApT6b0gQdg-1; Thu, 31 Oct 2019 07:02:56 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 16756800686; Thu, 31 Oct 2019 11:02:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D66F160852; Thu, 31 Oct 2019 11:02:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 780544BB65; Thu, 31 Oct 2019 11:02:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9VB2mCN005862 for ; Thu, 31 Oct 2019 07:02:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 95F3E60BEC; Thu, 31 Oct 2019 11:02:48 +0000 (UTC) Received: from probe.redhat.com (ovpn-121-17.rdu2.redhat.com [10.10.121.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52F2160C05; Thu, 31 Oct 2019 11:01:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572519779; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=UTESl6nYUsalORiIipovB3ovyUrKIuS3uRhCc7pprnE=; b=NMCaBE87rDspfyedwlGIhpXeby7zM1YZgcjGsxWQXA0d7K6RtxO7p7qEFPy0fCN+jYqkOC jF1RCzD7K63bffG7z69xOlWaBbP4+JBWojYDXPqdlcMHucHsMs5qMXxbLptYd1t4R8j8tJ xfq/b8MPBh3ifYLl7lZOppk7pkTTkbA= From: John Snow To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 31 Oct 2019 06:59:00 -0400 Message-Id: <20191031105904.12194-6-jsnow@redhat.com> In-Reply-To: <20191031105904.12194-1-jsnow@redhat.com> References: <20191031105904.12194-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Fam Zheng , Thomas Huth , qemu-block@nongnu.org, "Michael S. Tsirkin" , libvir-list@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Arbel Moshe , Laszlo Ersek , "Gonglei \(Arei\)" , Sam Eiderman , Gerd Hoffmann , Stefan Hajnoczi , Laurent Vivier , Paolo Bonzini , Sam Eiderman , Max Reitz , John Snow , Karl Heubaum Subject: [libvirt] [PULL 5/9] scsi: Propagate unrealize() callback to scsi-hd X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: eVD4-bdwNoaPApT6b0gQdg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) From: Sam Eiderman We will need to add LCHS removal logic to scsi-hd's unrealize() in the next commit. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Sam Eiderman Signed-off-by: Sam Eiderman Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: John Snow --- include/hw/scsi/scsi.h | 1 + hw/scsi/scsi-bus.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h index d77a92361b..332ef602f4 100644 --- a/include/hw/scsi/scsi.h +++ b/include/hw/scsi/scsi.h @@ -59,6 +59,7 @@ struct SCSIRequest { typedef struct SCSIDeviceClass { DeviceClass parent_class; void (*realize)(SCSIDevice *dev, Error **errp); + void (*unrealize)(SCSIDevice *dev, Error **errp); int (*parse_cdb)(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf, void *hba_private); SCSIRequest *(*alloc_req)(SCSIDevice *s, uint32_t tag, uint32_t lun, diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index bccb7cc4c6..359d50d6d0 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -59,6 +59,14 @@ static void scsi_device_realize(SCSIDevice *s, Error **e= rrp) } } =20 +static void scsi_device_unrealize(SCSIDevice *s, Error **errp) +{ + SCSIDeviceClass *sc =3D SCSI_DEVICE_GET_CLASS(s); + if (sc->unrealize) { + sc->unrealize(s, errp); + } +} + int scsi_bus_parse_cdb(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf, void *hba_private) { @@ -217,12 +225,20 @@ static void scsi_qdev_realize(DeviceState *qdev, Erro= r **errp) static void scsi_qdev_unrealize(DeviceState *qdev, Error **errp) { SCSIDevice *dev =3D SCSI_DEVICE(qdev); + Error *local_err =3D NULL; =20 if (dev->vmsentry) { qemu_del_vm_change_state_handler(dev->vmsentry); } =20 scsi_device_purge_requests(dev, SENSE_CODE(NO_SENSE)); + + scsi_device_unrealize(dev, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + blockdev_mark_auto_del(dev->conf.blk); } =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 19 09:08:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572519800; cv=none; d=zoho.com; s=zohoarc; b=P/pi4BWsunPl3F6f9tdoqibsZf9xgR/FDQBxlipsxwdfbNcRKpz8H07mEBEJRKuGboh1hRS7KX7lU1J9nbmVGldLJThXC7ugtMRrfQ3OmbCCi9daaVO0AJV8l0Fs5TL5mJbSRsb75P6d54SXfICGLgQbtoAm69Z2TtDFWjL2uyY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572519800; h=Content-Type:Content-Transfer-Encoding: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=93aJA6+mxexUr3Gi+DIRJUv58kiQ0wWnywItdp7Lnbo=; b=m9BoAqQCsC5/OOayn/elwI3EKeJ1HABsETLg8RcDBvMBmCRfIRw1qmvnjPCBQ/R0EFruMru1aUIgmUA8RlJuQOK/Pc8J24z1kE148WNM5+ks/3mMSJUA7/nCTJgo8JbWxC6Z2Uq/jdyLGCMfxo6qiRRUFmoCVOy1U+AIV7Jvr6k= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1572519800721617.1552238886524; Thu, 31 Oct 2019 04:03:20 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-162-WhXh07a4NPiVEmoMlXa-qw-1; Thu, 31 Oct 2019 07:03:15 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 950CB1005500; Thu, 31 Oct 2019 11:03:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 64409600CD; Thu, 31 Oct 2019 11:03:10 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0A83E4E562; Thu, 31 Oct 2019 11:03:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9VB391Z005888 for ; Thu, 31 Oct 2019 07:03:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 298C760C85; Thu, 31 Oct 2019 11:03:09 +0000 (UTC) Received: from probe.redhat.com (ovpn-121-17.rdu2.redhat.com [10.10.121.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB46760BEC; Thu, 31 Oct 2019 11:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572519797; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=93aJA6+mxexUr3Gi+DIRJUv58kiQ0wWnywItdp7Lnbo=; b=heAyRA2NXObI3/OzJOGa81DJm3/xY1ypmMYOgKQIU6cBTurGkoa3OfOqTxKS+aax+Pb+Yt uxPz/YkvaFrRT6KWKHz6qoANDm7uQQvUBIuQA/+kpMOLb3gqmP0toIhNKP0FCSuGWfAP5o 1y6udCUTSMnfZRCk/MMQn2ga+B5hM2w= From: John Snow To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 31 Oct 2019 06:59:01 -0400 Message-Id: <20191031105904.12194-7-jsnow@redhat.com> In-Reply-To: <20191031105904.12194-1-jsnow@redhat.com> References: <20191031105904.12194-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Fam Zheng , Thomas Huth , qemu-block@nongnu.org, "Michael S. Tsirkin" , libvir-list@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Arbel Moshe , Laszlo Ersek , "Gonglei \(Arei\)" , Sam Eiderman , Gerd Hoffmann , Stefan Hajnoczi , Laurent Vivier , Paolo Bonzini , Sam Eiderman , Max Reitz , John Snow , Karl Heubaum Subject: [libvirt] [PULL 6/9] bootdevice: Gather LCHS from all relevant devices X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: WhXh07a4NPiVEmoMlXa-qw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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 Signed-off-by: John Snow --- 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 9fa2eaf890..4c357d2928 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) @@ -1210,6 +1215,7 @@ static void virtio_blk_device_unrealize(DeviceState *= dev, Error **errp) unsigned i; =20 blk_drain(s->blk); + del_boot_device_lchs(dev, "/disk@0,0"); virtio_blk_data_plane_destroy(s->dataplane); s->dataplane =3D NULL; for (i =3D 0; i < conf->num_queues; i++) { diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 85cca6ec38..374a791a45 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.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 19 09:08:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572519819; cv=none; d=zoho.com; s=zohoarc; b=Nly1Allbn3kd/ihsKZLR8JUwGg0wwETDHjidlfr9MMu2V6AWFrwEp/hQOK/ClwXKAVstaoGl7aClUJOH0pEmKpW95KcpjBi3o5URpW8Oy1NDMcje1wPghFx3vfUpCmiMjte99jW3/+tGadymwhGIK5qR499XlHVSFOusqOBTHas= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572519819; h=Content-Type:Content-Transfer-Encoding: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=EJDP1zzShYEvPU/84+2fHJwA4AfF5OvZwkYGbRwK658=; b=c5HzmNLloGuFCVoG+hFbXVqyEbLtmVqwyzKrDzYLLgaNduoMbYhfeENJdFVVhrsHJVx99gbx0Iy9sAg91Bb7T9u8k9OJ0tpMhEOyan6WyLYIWoPeMl01/Kxa+EXatQHZovwUIfAXe2KJr4/RasWu6hkrlJpjkRu+8i3WAekWarg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1572519819775701.5102584001038; Thu, 31 Oct 2019 04:03:39 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-431-10PCbelJNH6RGMKX7mLYBQ-1; Thu, 31 Oct 2019 07:03:34 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AD58985B6EF; Thu, 31 Oct 2019 11:03:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 88CD45C1C3; Thu, 31 Oct 2019 11:03:29 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 478F418089CD; Thu, 31 Oct 2019 11:03:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9VB3Rob005934 for ; Thu, 31 Oct 2019 07:03:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id D922E60C18; Thu, 31 Oct 2019 11:03:27 +0000 (UTC) Received: from probe.redhat.com (ovpn-121-17.rdu2.redhat.com [10.10.121.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6EC8D60BEC; Thu, 31 Oct 2019 11:03:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572519815; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=EJDP1zzShYEvPU/84+2fHJwA4AfF5OvZwkYGbRwK658=; b=XdeTxtNI0X64VqclSaQDcFsHWBvTQXifelUgKTpuFroHKmB8S88RjByUJBGJ021MffCXb6 Mv7ByLejgclzrHwOciGP1kDBzbZh7ngDaJWDeLtcrPkhgYP9lkeLTWV/6NcYc3oDxGpilM k1+rs368ZJJA39m+jMT8oobmnPYU2AM= From: John Snow To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 31 Oct 2019 06:59:02 -0400 Message-Id: <20191031105904.12194-8-jsnow@redhat.com> In-Reply-To: <20191031105904.12194-1-jsnow@redhat.com> References: <20191031105904.12194-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Fam Zheng , Thomas Huth , qemu-block@nongnu.org, "Michael S. Tsirkin" , libvir-list@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Arbel Moshe , Laszlo Ersek , "Gonglei \(Arei\)" , Sam Eiderman , Gerd Hoffmann , Stefan Hajnoczi , Laurent Vivier , Paolo Bonzini , Sam Eiderman , Max Reitz , John Snow , Karl Heubaum Subject: [libvirt] [PULL 7/9] bootdevice: Refactor get_boot_devices_list X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: 10PCbelJNH6RGMKX7mLYBQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) From: Sam Eiderman Move device name construction to a separate function. We will reuse this function in the following commit to pass logical CHS parameters through fw_cfg much like we currently pass bootindex. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Sam Eiderman Signed-off-by: Sam Eiderman Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: John Snow --- bootdevice.c | 61 +++++++++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/bootdevice.c b/bootdevice.c index bc5e1c2de4..2cf6b37c57 100644 --- a/bootdevice.c +++ b/bootdevice.c @@ -202,6 +202,39 @@ DeviceState *get_boot_device(uint32_t position) return res; } =20 +static char *get_boot_device_path(DeviceState *dev, bool ignore_suffixes, + const char *suffix) +{ + char *devpath =3D NULL, *s =3D NULL, *d, *bootpath; + + if (dev) { + devpath =3D qdev_get_fw_dev_path(dev); + assert(devpath); + } + + if (!ignore_suffixes) { + if (dev) { + d =3D qdev_get_own_fw_dev_path_from_handler(dev->parent_bus, d= ev); + if (d) { + assert(!suffix); + s =3D d; + } else { + s =3D g_strdup(suffix); + } + } else { + s =3D g_strdup(suffix); + } + } + + bootpath =3D g_strdup_printf("%s%s", + devpath ? devpath : "", + s ? s : ""); + g_free(devpath); + g_free(s); + + return bootpath; +} + /* * This function returns null terminated string that consist of new line * separated device paths. @@ -218,36 +251,10 @@ char *get_boot_devices_list(size_t *size) bool ignore_suffixes =3D mc->ignore_boot_device_suffixes; =20 QTAILQ_FOREACH(i, &fw_boot_order, link) { - char *devpath =3D NULL, *suffix =3D NULL; char *bootpath; - char *d; size_t len; =20 - if (i->dev) { - devpath =3D qdev_get_fw_dev_path(i->dev); - assert(devpath); - } - - if (!ignore_suffixes) { - if (i->dev) { - d =3D qdev_get_own_fw_dev_path_from_handler(i->dev->parent= _bus, - i->dev); - if (d) { - assert(!i->suffix); - suffix =3D d; - } else { - suffix =3D g_strdup(i->suffix); - } - } else { - suffix =3D g_strdup(i->suffix); - } - } - - bootpath =3D g_strdup_printf("%s%s", - devpath ? devpath : "", - suffix ? suffix : ""); - g_free(devpath); - g_free(suffix); + bootpath =3D get_boot_device_path(i->dev, ignore_suffixes, i->suff= ix); =20 if (total) { list[total-1] =3D '\n'; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 19 09:08:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572519849; cv=none; d=zoho.com; s=zohoarc; b=KmWv8gIghE/vN4mbjf+aICH3OHaLzW83ht1Zlph2dcbVokJ/SGbaFIZtnzG9D0NQmEZ/5S+O0Quv5t2Mgqx4wx2FlhcAj8JrvqzN1Pfiqh78ZihVwOlUdgEqFfObfoRSfv6huaBstWYrnclHEoeI1ub2CmW2Ao6CxpHXB4lgbG4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572519849; h=Content-Type:Content-Transfer-Encoding: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=ILzsOx35yTFnmN26OftYk/0j1dCnqpTXTGcWEA3AmT4=; b=Q19jiVzpRf1ZCUuwV/De+nAKhkgsifr4UwjFVbD0Ehr/CZ3gIQzy3ySL8kq2rdiUyU+dcldU86+s+CovwNpvxMRLejg9PkRxTZ+YOVBnndh2z54o8wyWEaL1Qpk9UmnWjA8sbkXrfLSR6pUhtUlvC77Tk3Li1dszz3VAXkq5eeE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1572519849927669.1371059446025; Thu, 31 Oct 2019 04:04:09 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-316-1_l1T9nvPX6wYVa3d0EGGg-1; Thu, 31 Oct 2019 07:04:06 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C3A221005500; Thu, 31 Oct 2019 11:04:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 93A575D6A3; Thu, 31 Oct 2019 11:04:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 47C2A4BB65; Thu, 31 Oct 2019 11:04:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9VB3wAa005997 for ; Thu, 31 Oct 2019 07:03:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3E70D60C85; Thu, 31 Oct 2019 11:03:58 +0000 (UTC) Received: from probe.redhat.com (ovpn-121-17.rdu2.redhat.com [10.10.121.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B9DF60BEC; Thu, 31 Oct 2019 11:03:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572519848; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ILzsOx35yTFnmN26OftYk/0j1dCnqpTXTGcWEA3AmT4=; b=MtF6w1IjYkK3wZADfjfXSY/qam8WS2J+O9VxBOcz++TZ/pXXlmUxF7V4+v9nnGaOQsv581 U3DGZLpMB7FX5xGeu6dv8iG4XrtkbHFWNLSgMwm0ae3CdC1huLZR00F0CEB8TQ1bEMis+c yLYxs02+dacwEaBvy0prA64X457+1ug= From: John Snow To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 31 Oct 2019 06:59:03 -0400 Message-Id: <20191031105904.12194-9-jsnow@redhat.com> In-Reply-To: <20191031105904.12194-1-jsnow@redhat.com> References: <20191031105904.12194-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Fam Zheng , Thomas Huth , qemu-block@nongnu.org, "Michael S. Tsirkin" , libvir-list@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Arbel Moshe , Laszlo Ersek , "Gonglei \(Arei\)" , Sam Eiderman , Gerd Hoffmann , Stefan Hajnoczi , Laurent Vivier , Paolo Bonzini , Sam Eiderman , Max Reitz , John Snow , Karl Heubaum Subject: [libvirt] [PULL 8/9] bootdevice: FW_CFG interface for LCHS values X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: 1_l1T9nvPX6wYVa3d0EGGg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) From: Sam Eiderman Using fw_cfg, supply logical CHS values directly from QEMU to the BIOS. Non-standard logical geometries break under QEMU. A virtual disk which contains an operating system which depends on logical geometries (consistent values being reported from BIOS INT13 AH=3D08) will most likely break under QEMU/SeaBIOS if it has non-standard logical geometries - for example 56 SPT (sectors per track). No matter what QEMU will report - SeaBIOS, for large enough disks - will use LBA translation, which will report 63 SPT instead. In addition we cannot force SeaBIOS to rely on physical geometries at all. A virtio-blk-pci virtual disk with 255 phyiscal heads cannot report more than 16 physical heads when moved to an IDE controller, since the ATA spec allows a maximum of 16 heads - this is an artifact of virtualization. By supplying the logical geometries directly we are able to support such "exotic" disks. We serialize this information in a similar way to the "bootorder" interface. The new fw_cfg entry is "bios-geometry". Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Sam Eiderman Signed-off-by: Sam Eiderman Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: John Snow --- include/sysemu/sysemu.h | 1 + bootdevice.c | 31 +++++++++++++++++++++++++++++++ hw/nvram/fw_cfg.c | 14 +++++++++++--- 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 5bc5c79cbc..80c57fdc4e 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -106,6 +106,7 @@ void validate_bootdevices(const char *devices, Error **= errp); void add_boot_device_lchs(DeviceState *dev, const char *suffix, uint32_t lcyls, uint32_t lheads, uint32_t lsecs); void del_boot_device_lchs(DeviceState *dev, const char *suffix); +char *get_boot_devices_lchs_list(size_t *size); =20 /* handler to set the boot_device order for a specific type of MachineClas= s */ typedef void QEMUBootSetHandler(void *opaque, const char *boot_order, diff --git a/bootdevice.c b/bootdevice.c index 2cf6b37c57..03aaffcc8d 100644 --- a/bootdevice.c +++ b/bootdevice.c @@ -405,3 +405,34 @@ void del_boot_device_lchs(DeviceState *dev, const char= *suffix) } } } + +char *get_boot_devices_lchs_list(size_t *size) +{ + FWLCHSEntry *i; + size_t total =3D 0; + char *list =3D NULL; + + QTAILQ_FOREACH(i, &fw_lchs, link) { + char *bootpath; + char *chs_string; + size_t len; + + bootpath =3D get_boot_device_path(i->dev, false, i->suffix); + chs_string =3D g_strdup_printf("%s %" PRIu32 " %" PRIu32 " %" PRIu= 32, + bootpath, i->lcyls, i->lheads, i->lse= cs); + + if (total) { + list[total - 1] =3D '\n'; + } + len =3D strlen(chs_string) + 1; + list =3D g_realloc(list, total + len); + memcpy(&list[total], chs_string, len); + total +=3D len; + g_free(chs_string); + g_free(bootpath); + } + + *size =3D total; + + return list; +} diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index aef1727250..44a3c19326 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -949,13 +949,21 @@ void *fw_cfg_modify_file(FWCfgState *s, const char *f= ilename, =20 static void fw_cfg_machine_reset(void *opaque) { + MachineClass *mc =3D MACHINE_GET_CLASS(qdev_get_machine()); + FWCfgState *s =3D opaque; void *ptr; size_t len; - FWCfgState *s =3D opaque; - char *bootindex =3D get_boot_devices_list(&len); + char *buf; =20 - ptr =3D fw_cfg_modify_file(s, "bootorder", (uint8_t *)bootindex, len); + buf =3D get_boot_devices_list(&len); + ptr =3D fw_cfg_modify_file(s, "bootorder", (uint8_t *)buf, len); g_free(ptr); + + if (!mc->legacy_fw_cfg_order) { + buf =3D get_boot_devices_lchs_list(&len); + ptr =3D fw_cfg_modify_file(s, "bios-geometry", (uint8_t *)buf, len= ); + g_free(ptr); + } } =20 static void fw_cfg_machine_ready(struct Notifier *n, void *data) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 19 09:08:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572519892; cv=none; d=zoho.com; s=zohoarc; b=YOqfMxrna93fIV62/XCVOA8Bhrw1uyzh6o7rF3kLSY/ITfL/q4zz6mNv7bUwfoOtYQMwRRYs/LeuwtgO1dtlW8ruqxG0epHM2O8LZGd3KWjgIlpDf+54zzGIPTWYfPnzjnYd/8dBwOoocLx/sqMP4SRurOQFuJqEwq/DyQd0BXk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572519892; h=Content-Type:Content-Transfer-Encoding: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=5Mkg380Ps+lSVJARL+VR75k3X1Lqx+Z86oTZ7VAYZ9o=; b=clo+d0Zrnz4PeZLbFBKi1Jcy/qXgImopO+DRd9sr7/fVSR5OPQlox/15OZLoOTJeSu9jniQPALEb1nVFZbndOVoEVjz73EuPMZG95W8jJvW1tB8QjpH4IH7SgRKX+KRDqiOjtZGSO7uzz+i6SpasTD+dCFZ2VeIYFf1riw/95B8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1572519892000953.3883818996027; Thu, 31 Oct 2019 04:04:52 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-300-iiwoz34pPYK8KvKwq_lNgA-1; Thu, 31 Oct 2019 07:04:48 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A1E042EE2; Thu, 31 Oct 2019 11:04:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7EB985C1BB; Thu, 31 Oct 2019 11:04:42 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3C32318089CE; Thu, 31 Oct 2019 11:04:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9VB4f6M006084 for ; Thu, 31 Oct 2019 07:04:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4448660C84; Thu, 31 Oct 2019 11:04:41 +0000 (UTC) Received: from probe.redhat.com (ovpn-121-17.rdu2.redhat.com [10.10.121.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 83A2960BEC; Thu, 31 Oct 2019 11:03:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572519890; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=5Mkg380Ps+lSVJARL+VR75k3X1Lqx+Z86oTZ7VAYZ9o=; b=OsxkTusNiF/TqEmYo7e5eN6yH5td2/Cw86ifeNeomACxne/TfMSsstQ8sPaC8GHXo7AsOu V7bGMmPXi0nfujSAnmA0bWFy+RJLM7q9HxHMpSxbVtmB8fgEZCg9e4dyVkAi0xQTEIuXTF okB1aPlTizb4n9Uxe0fgXn0synxnC9g= From: John Snow To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 31 Oct 2019 06:59:04 -0400 Message-Id: <20191031105904.12194-10-jsnow@redhat.com> In-Reply-To: <20191031105904.12194-1-jsnow@redhat.com> References: <20191031105904.12194-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Kevin Wolf , Fam Zheng , Thomas Huth , qemu-block@nongnu.org, "Michael S. Tsirkin" , libvir-list@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Arbel Moshe , Laszlo Ersek , "Gonglei \(Arei\)" , Sam Eiderman , Gerd Hoffmann , Stefan Hajnoczi , Laurent Vivier , Paolo Bonzini , Sam Eiderman , Max Reitz , John Snow , Karl Heubaum Subject: [libvirt] [PULL 9/9] hd-geo-test: Add tests for lchs override X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: iiwoz34pPYK8KvKwq_lNgA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Sam Eiderman Add QTest tests to check the logical geometry override option. The tests in hd-geo-test are out of date - they only test IDE and do not test interesting MBRs. Creating qcow2 disks with specific size and MBR layout is currently unused - we only use a default empty MBR. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman Signed-off-by: Sam Eiderman Signed-off-by: John Snow --- tests/hd-geo-test.c | 551 +++++++++++++++++++++++++++++++++++++++++ tests/Makefile.include | 2 +- 2 files changed, 552 insertions(+), 1 deletion(-) diff --git a/tests/hd-geo-test.c b/tests/hd-geo-test.c index 62eb624726..7e86c5416c 100644 --- a/tests/hd-geo-test.c +++ b/tests/hd-geo-test.c @@ -17,7 +17,12 @@ =20 #include "qemu/osdep.h" #include "qemu-common.h" +#include "qemu/bswap.h" +#include "qapi/qmp/qlist.h" #include "libqtest.h" +#include "libqos/fw_cfg.h" +#include "libqos/libqos.h" +#include "standard-headers/linux/qemu_fw_cfg.h" =20 #define ARGV_SIZE 256 =20 @@ -388,6 +393,537 @@ static void test_ide_drive_cd_0(void) qtest_quit(qts); } =20 +typedef struct { + bool active; + uint32_t head; + uint32_t sector; + uint32_t cyl; + uint32_t end_head; + uint32_t end_sector; + uint32_t end_cyl; + uint32_t start_sect; + uint32_t nr_sects; +} MBRpartitions[4]; + +static MBRpartitions empty_mbr =3D { {false, 0, 0, 0, 0, 0, 0, 0, 0}, + {false, 0, 0, 0, 0, 0, 0, 0, 0}, + {false, 0, 0, 0, 0, 0, 0, 0, 0}, + {false, 0, 0, 0, 0, 0, 0, 0, 0} }; + +static char *create_qcow2_with_mbr(MBRpartitions mbr, uint64_t sectors) +{ + const char *template =3D "/tmp/qtest.XXXXXX"; + char *raw_path =3D strdup(template); + char *qcow2_path =3D strdup(template); + char cmd[100 + 2 * PATH_MAX]; + uint8_t buf[512]; + int i, ret, fd, offset; + uint64_t qcow2_size =3D sectors * 512; + uint8_t status, parttype, head, sector, cyl; + char *qemu_img_path; + char *qemu_img_abs_path; + + offset =3D 0xbe; + + for (i =3D 0; i < 4; i++) { + status =3D mbr[i].active ? 0x80 : 0x00; + g_assert(mbr[i].head < 256); + g_assert(mbr[i].sector < 64); + g_assert(mbr[i].cyl < 1024); + head =3D mbr[i].head; + sector =3D mbr[i].sector + ((mbr[i].cyl & 0x300) >> 2); + cyl =3D mbr[i].cyl & 0xff; + + buf[offset + 0x0] =3D status; + buf[offset + 0x1] =3D head; + buf[offset + 0x2] =3D sector; + buf[offset + 0x3] =3D cyl; + + parttype =3D 0; + g_assert(mbr[i].end_head < 256); + g_assert(mbr[i].end_sector < 64); + g_assert(mbr[i].end_cyl < 1024); + head =3D mbr[i].end_head; + sector =3D mbr[i].end_sector + ((mbr[i].end_cyl & 0x300) >> 2); + cyl =3D mbr[i].end_cyl & 0xff; + + buf[offset + 0x4] =3D parttype; + buf[offset + 0x5] =3D head; + buf[offset + 0x6] =3D sector; + buf[offset + 0x7] =3D cyl; + + (*(uint32_t *)&buf[offset + 0x8]) =3D cpu_to_le32(mbr[i].start_sec= t); + (*(uint32_t *)&buf[offset + 0xc]) =3D cpu_to_le32(mbr[i].nr_sects); + + offset +=3D 0x10; + } + + fd =3D mkstemp(raw_path); + g_assert(fd); + close(fd); + + fd =3D open(raw_path, O_WRONLY); + g_assert(fd >=3D 0); + ret =3D write(fd, buf, sizeof(buf)); + g_assert(ret =3D=3D sizeof(buf)); + close(fd); + + fd =3D mkstemp(qcow2_path); + g_assert(fd); + close(fd); + + qemu_img_path =3D getenv("QTEST_QEMU_IMG"); + g_assert(qemu_img_path); + qemu_img_abs_path =3D realpath(qemu_img_path, NULL); + g_assert(qemu_img_abs_path); + + ret =3D snprintf(cmd, sizeof(cmd), + "%s convert -f raw -O qcow2 %s %s > /dev/null", + qemu_img_abs_path, + raw_path, qcow2_path); + g_assert((0 < ret) && (ret <=3D sizeof(cmd))); + ret =3D system(cmd); + g_assert(ret =3D=3D 0); + + ret =3D snprintf(cmd, sizeof(cmd), + "%s resize %s %" PRIu64 " > /dev/null", + qemu_img_abs_path, + qcow2_path, qcow2_size); + g_assert((0 < ret) && (ret <=3D sizeof(cmd))); + ret =3D system(cmd); + g_assert(ret =3D=3D 0); + + free(qemu_img_abs_path); + + unlink(raw_path); + free(raw_path); + + return qcow2_path; +} + +#define BIOS_GEOMETRY_MAX_SIZE 10000 + +typedef struct { + uint32_t c; + uint32_t h; + uint32_t s; +} CHS; + +typedef struct { + const char *dev_path; + CHS chs; +} CHSResult; + +static void read_bootdevices(QFWCFG *fw_cfg, CHSResult expected[]) +{ + char *buf =3D g_malloc0(BIOS_GEOMETRY_MAX_SIZE); + char *cur; + GList *results =3D NULL, *cur_result; + CHSResult *r; + int i; + int res; + bool found; + + qfw_cfg_get_file(fw_cfg, "bios-geometry", buf, BIOS_GEOMETRY_MAX_SIZE); + + for (cur =3D buf; *cur; cur++) { + if (*cur =3D=3D '\n') { + *cur =3D '\0'; + } + } + cur =3D buf; + + while (strlen(cur)) { + + r =3D g_malloc0(sizeof(*r)); + r->dev_path =3D g_malloc0(strlen(cur) + 1); + res =3D sscanf(cur, "%s %" PRIu32 " %" PRIu32 " %" PRIu32, + (char *)r->dev_path, + &(r->chs.c), &(r->chs.h), &(r->chs.s)); + + g_assert(res =3D=3D 4); + + results =3D g_list_prepend(results, r); + + cur +=3D strlen(cur) + 1; + } + + i =3D 0; + + while (expected[i].dev_path) { + found =3D false; + cur_result =3D results; + while (cur_result) { + r =3D cur_result->data; + if (!strcmp(r->dev_path, expected[i].dev_path) && + !memcmp(&(r->chs), &(expected[i].chs), sizeof(r->chs))) { + found =3D true; + break; + } + cur_result =3D g_list_next(cur_result); + } + g_assert(found); + g_free((char *)((CHSResult *)cur_result->data)->dev_path); + g_free(cur_result->data); + results =3D g_list_delete_link(results, cur_result); + i++; + } + + g_assert(results =3D=3D NULL); + + g_free(buf); +} + +#define MAX_DRIVES 30 + +typedef struct { + char **argv; + int argc; + char **drives; + int n_drives; + int n_scsi_disks; + int n_scsi_controllers; + int n_virtio_disks; +} TestArgs; + +static TestArgs *create_args(void) +{ + TestArgs *args =3D g_malloc0(sizeof(*args)); + args->argv =3D g_new0(char *, ARGV_SIZE); + args->argc =3D append_arg(args->argc, args->argv, + ARGV_SIZE, g_strdup("-nodefaults")); + args->drives =3D g_new0(char *, MAX_DRIVES); + return args; +} + +static void add_drive_with_mbr(TestArgs *args, + MBRpartitions mbr, uint64_t sectors) +{ + char *img_file_name; + char part[300]; + int ret; + + g_assert(args->n_drives < MAX_DRIVES); + + img_file_name =3D create_qcow2_with_mbr(mbr, sectors); + + args->drives[args->n_drives] =3D img_file_name; + ret =3D snprintf(part, sizeof(part), + "-drive file=3D%s,if=3Dnone,format=3Dqcow2,id=3Ddisk%d", + img_file_name, args->n_drives); + g_assert((0 < ret) && (ret <=3D sizeof(part))); + args->argc =3D append_arg(args->argc, args->argv, ARGV_SIZE, g_strdup(= part)); + args->n_drives++; +} + +static void add_ide_disk(TestArgs *args, + int drive_idx, int bus, int unit, int c, int h, i= nt s) +{ + char part[300]; + int ret; + + ret =3D snprintf(part, sizeof(part), + "-device ide-hd,drive=3Ddisk%d,bus=3Dide.%d,unit=3D%d," + "lcyls=3D%d,lheads=3D%d,lsecs=3D%d", + drive_idx, bus, unit, c, h, s); + g_assert((0 < ret) && (ret <=3D sizeof(part))); + args->argc =3D append_arg(args->argc, args->argv, ARGV_SIZE, g_strdup(= part)); +} + +static void add_scsi_controller(TestArgs *args, + const char *type, + const char *bus, + int addr) +{ + char part[300]; + int ret; + + ret =3D snprintf(part, sizeof(part), + "-device %s,id=3Dscsi%d,bus=3D%s,addr=3D%d", + type, args->n_scsi_controllers, bus, addr); + g_assert((0 < ret) && (ret <=3D sizeof(part))); + args->argc =3D append_arg(args->argc, args->argv, ARGV_SIZE, g_strdup(= part)); + args->n_scsi_controllers++; +} + +static void add_scsi_disk(TestArgs *args, + int drive_idx, int bus, + int channel, int scsi_id, int lun, + int c, int h, int s) +{ + char part[300]; + int ret; + + ret =3D snprintf(part, sizeof(part), + "-device scsi-hd,id=3Dscsi-disk%d,drive=3Ddisk%d," + "bus=3Dscsi%d.0," + "channel=3D%d,scsi-id=3D%d,lun=3D%d," + "lcyls=3D%d,lheads=3D%d,lsecs=3D%d", + args->n_scsi_disks, drive_idx, bus, channel, scsi_id, l= un, + c, h, s); + g_assert((0 < ret) && (ret <=3D sizeof(part))); + args->argc =3D append_arg(args->argc, args->argv, ARGV_SIZE, g_strdup(= part)); + args->n_scsi_disks++; +} + +static void add_virtio_disk(TestArgs *args, + int drive_idx, const char *bus, int addr, + int c, int h, int s) +{ + char part[300]; + int ret; + + ret =3D snprintf(part, sizeof(part), + "-device virtio-blk-pci,id=3Dvirtio-disk%d," + "drive=3Ddisk%d,bus=3D%s,addr=3D%d," + "lcyls=3D%d,lheads=3D%d,lsecs=3D%d", + args->n_virtio_disks, drive_idx, bus, addr, c, h, s); + g_assert((0 < ret) && (ret <=3D sizeof(part))); + args->argc =3D append_arg(args->argc, args->argv, ARGV_SIZE, g_strdup(= part)); + args->n_virtio_disks++; +} + +static void test_override(TestArgs *args, CHSResult expected[]) +{ + QTestState *qts; + char *joined_args; + QFWCFG *fw_cfg; + int i; + + joined_args =3D g_strjoinv(" ", args->argv); + + qts =3D qtest_init(joined_args); + fw_cfg =3D pc_fw_cfg_init(qts); + + read_bootdevices(fw_cfg, expected); + + g_free(joined_args); + qtest_quit(qts); + + g_free(fw_cfg); + + for (i =3D 0; i < args->n_drives; i++) { + unlink(args->drives[i]); + free(args->drives[i]); + } + g_free(args->drives); + g_strfreev(args->argv); + g_free(args); +} + +static void test_override_ide(void) +{ + TestArgs *args =3D create_args(); + CHSResult expected[] =3D { + {"/pci@i0cf8/ide@1,1/drive@0/disk@0", {10000, 120, 30} }, + {"/pci@i0cf8/ide@1,1/drive@0/disk@1", {9000, 120, 30} }, + {"/pci@i0cf8/ide@1,1/drive@1/disk@0", {0, 1, 1} }, + {"/pci@i0cf8/ide@1,1/drive@1/disk@1", {1, 0, 0} }, + {NULL, {0, 0, 0} } + }; + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_ide_disk(args, 0, 0, 0, 10000, 120, 30); + add_ide_disk(args, 1, 0, 1, 9000, 120, 30); + add_ide_disk(args, 2, 1, 0, 0, 1, 1); + add_ide_disk(args, 3, 1, 1, 1, 0, 0); + test_override(args, expected); +} + +static void test_override_scsi(void) +{ + TestArgs *args =3D create_args(); + CHSResult expected[] =3D { + {"/pci@i0cf8/scsi@3/channel@0/disk@0,0", {10000, 120, 30} }, + {"/pci@i0cf8/scsi@3/channel@0/disk@1,0", {9000, 120, 30} }, + {"/pci@i0cf8/scsi@3/channel@0/disk@2,0", {1, 0, 0} }, + {"/pci@i0cf8/scsi@3/channel@0/disk@3,0", {0, 1, 0} }, + {NULL, {0, 0, 0} } + }; + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_scsi_controller(args, "lsi53c895a", "pci.0", 3); + add_scsi_disk(args, 0, 0, 0, 0, 0, 10000, 120, 30); + add_scsi_disk(args, 1, 0, 0, 1, 0, 9000, 120, 30); + add_scsi_disk(args, 2, 0, 0, 2, 0, 1, 0, 0); + add_scsi_disk(args, 3, 0, 0, 3, 0, 0, 1, 0); + test_override(args, expected); +} + +static void test_override_scsi_2_controllers(void) +{ + TestArgs *args =3D create_args(); + CHSResult expected[] =3D { + {"/pci@i0cf8/scsi@3/channel@0/disk@0,0", {10000, 120, 30} }, + {"/pci@i0cf8/scsi@3/channel@0/disk@1,0", {9000, 120, 30} }, + {"/pci@i0cf8/scsi@4/channel@0/disk@0,1", {1, 0, 0} }, + {"/pci@i0cf8/scsi@4/channel@0/disk@1,2", {0, 1, 0} }, + {NULL, {0, 0, 0} } + }; + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_scsi_controller(args, "lsi53c895a", "pci.0", 3); + add_scsi_controller(args, "virtio-scsi-pci", "pci.0", 4); + add_scsi_disk(args, 0, 0, 0, 0, 0, 10000, 120, 30); + add_scsi_disk(args, 1, 0, 0, 1, 0, 9000, 120, 30); + add_scsi_disk(args, 2, 1, 0, 0, 1, 1, 0, 0); + add_scsi_disk(args, 3, 1, 0, 1, 2, 0, 1, 0); + test_override(args, expected); +} + +static void test_override_virtio_blk(void) +{ + TestArgs *args =3D create_args(); + CHSResult expected[] =3D { + {"/pci@i0cf8/scsi@3/disk@0,0", {10000, 120, 30} }, + {"/pci@i0cf8/scsi@4/disk@0,0", {9000, 120, 30} }, + {NULL, {0, 0, 0} } + }; + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_virtio_disk(args, 0, "pci.0", 3, 10000, 120, 30); + add_virtio_disk(args, 1, "pci.0", 4, 9000, 120, 30); + test_override(args, expected); +} + +static void test_override_zero_chs(void) +{ + TestArgs *args =3D create_args(); + CHSResult expected[] =3D { + {NULL, {0, 0, 0} } + }; + add_drive_with_mbr(args, empty_mbr, 1); + add_ide_disk(args, 0, 1, 1, 0, 0, 0); + test_override(args, expected); +} + +static void test_override_scsi_hot_unplug(void) +{ + QTestState *qts; + char *joined_args; + QFWCFG *fw_cfg; + QDict *response; + int i; + TestArgs *args =3D create_args(); + CHSResult expected[] =3D { + {"/pci@i0cf8/scsi@2/channel@0/disk@0,0", {10000, 120, 30} }, + {"/pci@i0cf8/scsi@2/channel@0/disk@1,0", {20, 20, 20} }, + {NULL, {0, 0, 0} } + }; + CHSResult expected2[] =3D { + {"/pci@i0cf8/scsi@2/channel@0/disk@1,0", {20, 20, 20} }, + {NULL, {0, 0, 0} } + }; + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_scsi_controller(args, "virtio-scsi-pci", "pci.0", 2); + add_scsi_disk(args, 0, 0, 0, 0, 0, 10000, 120, 30); + add_scsi_disk(args, 1, 0, 0, 1, 0, 20, 20, 20); + + joined_args =3D g_strjoinv(" ", args->argv); + + qts =3D qtest_init(joined_args); + fw_cfg =3D pc_fw_cfg_init(qts); + + read_bootdevices(fw_cfg, expected); + + /* unplug device an restart */ + response =3D qtest_qmp(qts, + "{ 'execute': 'device_del'," + " 'arguments': {'id': 'scsi-disk0' }}"); + g_assert(response); + g_assert(!qdict_haskey(response, "error")); + qobject_unref(response); + response =3D qtest_qmp(qts, + "{ 'execute': 'system_reset', 'arguments': { }}"); + g_assert(response); + g_assert(!qdict_haskey(response, "error")); + qobject_unref(response); + + qtest_qmp_eventwait(qts, "RESET"); + + read_bootdevices(fw_cfg, expected2); + + g_free(joined_args); + qtest_quit(qts); + + g_free(fw_cfg); + + for (i =3D 0; i < args->n_drives; i++) { + unlink(args->drives[i]); + free(args->drives[i]); + } + g_free(args->drives); + g_strfreev(args->argv); + g_free(args); +} + +static void test_override_virtio_hot_unplug(void) +{ + QTestState *qts; + char *joined_args; + QFWCFG *fw_cfg; + QDict *response; + int i; + TestArgs *args =3D create_args(); + CHSResult expected[] =3D { + {"/pci@i0cf8/scsi@2/disk@0,0", {10000, 120, 30} }, + {"/pci@i0cf8/scsi@3/disk@0,0", {20, 20, 20} }, + {NULL, {0, 0, 0} } + }; + CHSResult expected2[] =3D { + {"/pci@i0cf8/scsi@3/disk@0,0", {20, 20, 20} }, + {NULL, {0, 0, 0} } + }; + add_drive_with_mbr(args, empty_mbr, 1); + add_drive_with_mbr(args, empty_mbr, 1); + add_virtio_disk(args, 0, "pci.0", 2, 10000, 120, 30); + add_virtio_disk(args, 1, "pci.0", 3, 20, 20, 20); + + joined_args =3D g_strjoinv(" ", args->argv); + + qts =3D qtest_init(joined_args); + fw_cfg =3D pc_fw_cfg_init(qts); + + read_bootdevices(fw_cfg, expected); + + /* unplug device an restart */ + response =3D qtest_qmp(qts, + "{ 'execute': 'device_del'," + " 'arguments': {'id': 'virtio-disk0' }}"); + g_assert(response); + g_assert(!qdict_haskey(response, "error")); + qobject_unref(response); + response =3D qtest_qmp(qts, + "{ 'execute': 'system_reset', 'arguments': { }}"); + g_assert(response); + g_assert(!qdict_haskey(response, "error")); + qobject_unref(response); + + qtest_qmp_eventwait(qts, "RESET"); + + read_bootdevices(fw_cfg, expected2); + + g_free(joined_args); + qtest_quit(qts); + + g_free(fw_cfg); + + for (i =3D 0; i < args->n_drives; i++) { + unlink(args->drives[i]); + free(args->drives[i]); + } + g_free(args->drives); + g_strfreev(args->argv); + g_free(args); +} + int main(int argc, char **argv) { Backend i; @@ -413,6 +949,21 @@ int main(int argc, char **argv) qtest_add_func("hd-geo/ide/device/mbr/chs", test_ide_device_mbr_chs); qtest_add_func("hd-geo/ide/device/user/chs", test_ide_device_user_chs); qtest_add_func("hd-geo/ide/device/user/chst", test_ide_device_user_chs= t); + if (have_qemu_img()) { + qtest_add_func("hd-geo/override/ide", test_override_ide); + qtest_add_func("hd-geo/override/scsi", test_override_scsi); + qtest_add_func("hd-geo/override/scsi_2_controllers", + test_override_scsi_2_controllers); + qtest_add_func("hd-geo/override/virtio_blk", test_override_virtio_= blk); + qtest_add_func("hd-geo/override/zero_chs", test_override_zero_chs); + qtest_add_func("hd-geo/override/scsi_hot_unplug", + test_override_scsi_hot_unplug); + qtest_add_func("hd-geo/override/virtio_hot_unplug", + test_override_virtio_hot_unplug); + } else { + g_test_message("QTEST_QEMU_IMG not set or qemu-img missing; " + "skipping hd-geo/override/* tests"); + } =20 ret =3D g_test_run(); =20 diff --git a/tests/Makefile.include b/tests/Makefile.include index c79402ab75..728d802dbd 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -794,7 +794,7 @@ tests/ide-test$(EXESUF): tests/ide-test.o $(libqos-pc-o= bj-y) tests/ahci-test$(EXESUF): tests/ahci-test.o $(libqos-pc-obj-y) qemu-img$(E= XESUF) tests/ipmi-kcs-test$(EXESUF): tests/ipmi-kcs-test.o tests/ipmi-bt-test$(EXESUF): tests/ipmi-bt-test.o -tests/hd-geo-test$(EXESUF): tests/hd-geo-test.o +tests/hd-geo-test$(EXESUF): tests/hd-geo-test.o $(libqos-obj-y) tests/boot-order-test$(EXESUF): tests/boot-order-test.o $(libqos-obj-y) tests/boot-serial-test$(EXESUF): tests/boot-serial-test.o $(libqos-obj-y) tests/bios-tables-test$(EXESUF): tests/bios-tables-test.o \ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list