From nobody Thu Mar 28 13:15:22 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1560340890; cv=none; d=zoho.com; s=zohoarc; b=RF3yCWZkjZ/QJxwFFDB/8+epjlrdJMp0xKymanT4+D7Kud8KLlUxFhwMnkpYNfh8f4Sy8GaMp8qgQAwiwdfyP3RYqbyoZoouk/yX26gzQfjcDQQ/+lgkVDv+OdTkIhACNSq2bQ9LO+NTYRIYzX6TmbxhoRtmQchwhekgoZMnHEg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560340890; 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:Subject:To:ARC-Authentication-Results; bh=ofy+Hd2h1hbkZ8pb8pmoCPnC84+D4gurems6btJ2B9Y=; b=ls0/Nntr+TdWvrSYutqbnAlK0vxVXAhX597wJDdg0nhn/o5agwqR8Cb6+hxSVq9wBxah2MVfTW3D246LSOrwKc5BoT4dLzP8ygCSpyU3ZgTZQkltZnH/HyO1vdBCBPBrTpoqdCLBZ48ucGJkMZtCpk/y3kcRGwqxuB2qEDT+y+8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1560340890260318.57908780678156; Wed, 12 Jun 2019 05:01:30 -0700 (PDT) Received: from [192.168.203.99] (mailu_mailman-core_1.mailu_default [192.168.203.99]) by coreboot.org (Postfix) with ESMTP id BFA6712E2ED8; Wed, 12 Jun 2019 12:01:25 +0000 (UTC) Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) by coreboot.org (Postfix) with ESMTP id 4FEB012E2ECA for ; Wed, 12 Jun 2019 12:01:05 +0000 (UTC) Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5CBsJj3115437; Wed, 12 Jun 2019 12:00:02 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 2t02heu1de-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 12:00:02 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5CBwuLU140664; Wed, 12 Jun 2019 12:00:01 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 2t04hyvu66-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 12:00:01 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5CC00jF015631; Wed, 12 Jun 2019 12:00:00 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 12 Jun 2019 05:00:00 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=IF99orgPl5PZbXP/iOJCxdKOiazKw347UHLBH9LWKbA=; b=eHJFx0wFOA96kKqXaCxgF1HCKrTrbfgZGlcTVdp4RGzzv5c+cb/aeRItoCJIaRcJK2FM bxQ5XdaU0URKXNvM+Q7EMtYamicOJPickdE5D+ln/6r1L0B+6fQgTwB5iJC4cJOHw3+D I09AMx4CKsm5Vx65n/vZDD/gPzdVIZ9ANlSKBhY7X7Wg8Y99mE7uGaBHtgr3QTOljmCI Kl0ZifVmEflhZFSjDFXTnet7Mw8CKHIrikjTWDc3eHofzOFJI/weIbvgR+FsTt3fS2vz mqUw7bjjHm1RrMZMO2xQr05liEVIUgkGyOv3cPp5PSYCNoJdL4A2vQ95AIoCvvopx4LR Mg== From: Sam Eiderman To: kwolf@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com, seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net Date: Wed, 12 Jun 2019 14:59:32 +0300 Message-Id: <20190612115939.23825-2-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190612115939.23825-1-shmuel.eiderman@oracle.com> References: <20190612115939.23825-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906120083 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906120083 Message-ID-Hash: LPYQ7FY63YIHXMM5IBEYE2S3PDWJAV22 X-Message-ID-Hash: LPYQ7FY63YIHXMM5IBEYE2S3PDWJAV22 X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: karl.heubaum@oracle.com, arbel.moshe@oracle.com X-Mailman-Version: 3.2.2 Precedence: list Subject: [SeaBIOS] [QEMU] [PATCH v2 1/8] block: Refactor macros - fix tabbing List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org X-Spamd-Bar: / X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Fixing tabbing in block related macros. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman --- hw/ide/qdev.c | 2 +- include/hw/block/block.h | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 360cd20bd8..9cae3205df 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -285,7 +285,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 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) \ --=20 2.13.3 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Thu Mar 28 13:15:22 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1560340864; cv=none; d=zoho.com; s=zohoarc; b=jjVk3Qkdt3xctIU1yXkA9dyVk47cYaQSWaV7g03tqKoROvCpGjpwunUMB6Ki9RjpnouO7QlPUJhgdqMKRvH6w6kAab3ab+c5+9lcAfa2qeCjfd49fC3y0E68AGjpKMIuURwhQU0ANAzNAryXbKcqd2URtQn4odFDirdAH36PJls= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560340864; 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:Subject:To:ARC-Authentication-Results; bh=NmFVvEfozvShzXedOR7bFLrFW6qAHqLz6sJlQrAmM+I=; b=FDsBJwH64SrI/OYcZ/lWxHJg8NW9DY24cSRA5+xFAbmHcOTVyD1fs0w0PCAMUiAS+VdsLGdIoVAWyDEL+tkAZX5WDudQn50sindZf8ZOI9MNuRHywzCQ9Sn+MCZY8oYjrqBnd5ug83btIi6303WMeROt104804mn/DXiQIfcGpk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1560340864815359.7645805351269; Wed, 12 Jun 2019 05:01:04 -0700 (PDT) Received: from [192.168.203.99] (mailu_mailman-core_1.mailu_default [192.168.203.99]) by coreboot.org (Postfix) with ESMTP id 0D65012E2EC6; Wed, 12 Jun 2019 12:01:00 +0000 (UTC) Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by coreboot.org (Postfix) with ESMTP id 3D42212E2E9D for ; Wed, 12 Jun 2019 12:00:51 +0000 (UTC) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5CBsG9x096660; Wed, 12 Jun 2019 12:00:06 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 2t04ettx0j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 12:00:05 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5CBx1bd140836; Wed, 12 Jun 2019 12:00:05 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 2t04hyvu79-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 12:00:04 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5CC03r3015692; Wed, 12 Jun 2019 12:00:03 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 12 Jun 2019 05:00:03 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=wNJVY/MJnZ0hr3JnQpWCYzEqCzxEtI5MUZ+RiQowC2s=; b=Ze/tLxnY9VqhDJBNEYPSAA3jVqblQfmTmQ/EDtNWAes7WhwUKZUXHVou7WlJGu0EnYOH Y0qNLX5rb+5GOQdd6HN0qp0xeae4/AOmTfgBOCtw8p1IFeQ42gva1Z/cLkqVb/L5nVvU KGoAbtARfbpK4CJUERp+ZLw5g7ZUAYxQGKXfJ+OnbdqxfUAK3wuHaEPvXf0rr5HuqjNu rTyMrUHmVvi6JQ9pXXnoqouEj/ejqUS8PCSAXEECYDvcaNpAf9EhhnY32y5oxvk78gjb agJplJCnZ9FbuVhb9HGqz/orv5W9YTdu3R8R4VKqq+JVUHVwse5jq/WwWGpsTVfBMjAB ag== From: Sam Eiderman To: kwolf@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com, seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net Date: Wed, 12 Jun 2019 14:59:33 +0300 Message-Id: <20190612115939.23825-3-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190612115939.23825-1-shmuel.eiderman@oracle.com> References: <20190612115939.23825-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906120083 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906120083 Message-ID-Hash: ASILRCDX6AZYGD3CGOUJWT67YCURAJZF X-Message-ID-Hash: ASILRCDX6AZYGD3CGOUJWT67YCURAJZF X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: karl.heubaum@oracle.com, arbel.moshe@oracle.com X-Mailman-Version: 3.2.2 Precedence: list Subject: [SeaBIOS] [QEMU] [PATCH v2 2/8] block: Support providing LCHS from user List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: ++++ X-Spam-Level: **** Authentication-Results: coreboot.org X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" 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 --- 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.13.3 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Thu Mar 28 13:15:22 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1560340876; cv=none; d=zoho.com; s=zohoarc; b=b9pRmSl31cY/O0lZ6ap+/m9av68NKt4Q6qLNwTaHeqkQSGmMVPS3+3Ptp6I5US8tKKJAd9elei/CM46pl5ejjZgwdibRdZVdYYf1anGyERikkajZOGy7bbF2EO5lnNmmL//mPNMBudF4yhmg/xFkXq+CVmVEhBNRThoozBGjqh8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560340876; 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:Subject:To:ARC-Authentication-Results; bh=c7i+jkMXzgHbOL6IcOYCCy4u8Oj+pxSfDIAbwVVsAbQ=; b=bpibClOKEJ6zGR+ph/YkKKRqLtKCb2dTZD/vNatOmckgKzAEOSEz1Mhvl+Zbqbj9EBURVJMYAqcyXfWu+LowB+cNLQNMSw1QyKALkC+ApwotUelpx1r1LGh9G8VKYkT9W+uLPr3Y9e+FpjYmlyiL+oVI2PDgUinBmf+fjozs0cg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1560340876494479.67279746091083; Wed, 12 Jun 2019 05:01:16 -0700 (PDT) Received: from [192.168.203.99] (mailu_mailman-core_1.mailu_default [192.168.203.99]) by coreboot.org (Postfix) with ESMTP id 36B8F12E2ECE; Wed, 12 Jun 2019 12:01:12 +0000 (UTC) Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by coreboot.org (Postfix) with ESMTP id 8248D12E2E9D for ; Wed, 12 Jun 2019 12:00:53 +0000 (UTC) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5CBsGAK096672; Wed, 12 Jun 2019 12:00:13 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 2t04ettx24-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 12:00:13 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5CC0CHe003086; Wed, 12 Jun 2019 12:00:12 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 2t0p9ru1tx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 12:00:12 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5CC06hW020639; Wed, 12 Jun 2019 12:00:06 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 12 Jun 2019 05:00:06 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=VuvUHYBiIoed7M4Qt45n2olUqtuKHAeuaxDDCAKVfqc=; b=bWSpXaVphnfWwA/XE7/zf4tSGt4Ws7QSfu2UZbtAH5xjIkY0YOd1P6krIfCeVHfGFWtN 3DIogyZ/LnyqLN4tb1/LhRIGnWMiI6dyEpbEFkxCABSd3EjUGdEkmZWxgplL1uCsvUIT Ueh/13kUTqI4CgtnwdwhzHU+zc28WKhEqd87+hSat1eMWsiT9D5gTp90SlEAv/ECct8h hPy3XY+KZmaX2gswiZuM/70RKpXMmJLtnDhzumBpavc2BtX/KciHmCQFUAPdH28AlIjc gV+30QWGKGLGTB08vJvY0udOv+yYZ4Hx27771OOuN+mhekzO/QokvF/ywMXtIkrB6bsk Pw== From: Sam Eiderman To: kwolf@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com, seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net Date: Wed, 12 Jun 2019 14:59:34 +0300 Message-Id: <20190612115939.23825-4-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190612115939.23825-1-shmuel.eiderman@oracle.com> References: <20190612115939.23825-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906120083 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906120083 X-Spam-Level: *** Message-ID-Hash: ETSQIVVHCEX2ZC6PQYOO6UL2CDJ36F3V X-Message-ID-Hash: ETSQIVVHCEX2ZC6PQYOO6UL2CDJ36F3V X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: karl.heubaum@oracle.com, arbel.moshe@oracle.com X-Mailman-Version: 3.2.2 Precedence: list Subject: [SeaBIOS] [QEMU] [PATCH v2 3/8] bootdevice: Add interface to gather LCHS List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org X-Spamd-Bar: / X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" 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 --- bootdevice.c | 55 +++++++++++++++++++++++++++++++++++++++++++++= ++++ include/sysemu/sysemu.h | 3 +++ 2 files changed, 58 insertions(+) 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; + } + } +} diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 61579ae71e..173dfbb539 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -171,6 +171,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, --=20 2.13.3 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Thu Mar 28 13:15:22 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1560340883; cv=none; d=zoho.com; s=zohoarc; b=CP1PiI86iFl5MA2FQ46UeaMiYbhJ/3lEp3/fP538GQiLcZZT0YVOJnX3Gfb54cgWg9CACVhuq/oUHGDzj3PquvwyR714tB2RMzj+68wFdUcADSZd7nry3pnuaAdxoQERW0Mb/nWVz5OywdAy4IP6AbNHB2h0zPSb+0kkuY7gG+g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560340883; 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:Subject:To:ARC-Authentication-Results; bh=xDVfc7g2movGkbrog3xJ7d+/CYTtUGHQ4lSOG/S3sts=; b=XKFq9CQcOwckSHs7+EjKlaLRJnw0W1t6E7ratZMTj9dvFdes1qItGAgcZPomLFMcGhcknG5Ia0qGFRGFesVBrP/mmcsxldfoL8wd4eo82Kpcrz1uQSF9ilAQkFpV17OceL1hN92uh5FozjF4omQ8JfyWathtyFaIDYt1FrDNgmU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1560340883054404.96739038575686; Wed, 12 Jun 2019 05:01:23 -0700 (PDT) Received: from [192.168.203.99] (mailu_mailman-core_1.mailu_default [192.168.203.99]) by coreboot.org (Postfix) with ESMTP id 2C78A12E2ED5; Wed, 12 Jun 2019 12:01:18 +0000 (UTC) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by coreboot.org (Postfix) with ESMTP id 9C71A12E2E9D for ; Wed, 12 Jun 2019 12:00:56 +0000 (UTC) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5CBsId1105911; Wed, 12 Jun 2019 12:00:14 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2t05nqttp2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 12:00:14 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5CC0Ck4003117; Wed, 12 Jun 2019 12:00:13 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 2t0p9ru1vt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 12:00:13 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5CC09r9015790; Wed, 12 Jun 2019 12:00:10 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 12 Jun 2019 05:00:09 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=7xrUoYOu+9ElvUB5L88vzyRFGdPo+spBEQlM3TkzjbI=; b=chspXC2Auwz4DvqpWreK4EQYgvh3GAYgBCHa1Qb3LJbkSNv3gmfPRkKSXbJNWnsOEOsP SbEnQ5MA9S8OLQ8p6Mvm6Dj7xUT1nTtIpT2k1OH++kYFMN5CHWrmx6YKsM2kqVovJhAR l/qSXlIABBvBD/6caEhx4YplzM9lZwGE153BNJT5HC5A+JbpY1NWIt706IZJ9kWJTEfU MEAzetMHW2meTvbSGyBXphTgtuD+3NdMFdLIMknrRdVDyed5Z/p1tY+LgNOcuRV1qd/7 CNsMPGdDnP10jdOKx63qRt1SbQZorsPYHN4x1HSgXLFF1QziUH8aqKV2zfyHIC8+KSED wQ== From: Sam Eiderman To: kwolf@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com, seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net Date: Wed, 12 Jun 2019 14:59:35 +0300 Message-Id: <20190612115939.23825-5-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190612115939.23825-1-shmuel.eiderman@oracle.com> References: <20190612115939.23825-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=969 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906120083 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906120083 X-Spam-Level: ** Message-ID-Hash: 4ZG2W5EJWAVR25YYCZREPZIGD6OK2GVQ X-Message-ID-Hash: 4ZG2W5EJWAVR25YYCZREPZIGD6OK2GVQ X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: karl.heubaum@oracle.com, arbel.moshe@oracle.com X-Mailman-Version: 3.2.2 Precedence: list Subject: [SeaBIOS] [QEMU] [PATCH v2 4/8] scsi: Propagate unrealize() callback to scsi-hd List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org X-Spamd-Bar: / X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" 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 Signed-off-by: Sam Eiderman --- hw/scsi/scsi-bus.c | 15 +++++++++++++++ include/hw/scsi/scsi.h | 1 + 2 files changed, 16 insertions(+) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index c480553083..f6fe497a1a 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -55,6 +55,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) { @@ -213,11 +221,18 @@ 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_unrealize(dev, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + scsi_device_purge_requests(dev, SENSE_CODE(NO_SENSE)); blockdev_mark_auto_del(dev->conf.blk); } diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h index 426566a5c6..8cf71f910d 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, --=20 2.13.3 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Thu Mar 28 13:15:22 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1560340896; cv=none; d=zoho.com; s=zohoarc; b=BJteypm5DmEuqe+kP1i4BpSyZS3k8gPGW3NMNOc6kU+QgIZIbGXOwkBJaPzYR2AnVoDyu3awUIhmkQ3/o0sxyI5/Akqk1QM8IeBuvu6eNaYqVjD1yXnngLuc5DoY2mOLnzlAiy1SeJQwp7bHRQ5p6I04oqd+6eOTMFBkW+fxy+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560340896; 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:Subject:To:ARC-Authentication-Results; bh=Ini6XmRyJuXDkk2sqXEOyFs+ExfVOY7Fe3jFR18lY60=; b=Qi/6ow2mIeyj5xuoFGsP0S++h1PjzljIagpD3doSeFcEx4UJWP1vQf5UsxOKi8VslcQTjJ3Sw1/aTphF+b0TiTz9BaPR6SHaKw2+rRVqpGdTxiM28YPDnfCrdBoAlrHD7P6lg4TB0HbgmYomeFH/wj9px/FtOZizQQcbn7bhAzU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1560340896925350.36405507800464; Wed, 12 Jun 2019 05:01:36 -0700 (PDT) Received: from [192.168.203.99] (mailu_mailman-core_1.mailu_default [192.168.203.99]) by coreboot.org (Postfix) with ESMTP id CE03412E2EDE; Wed, 12 Jun 2019 12:01:31 +0000 (UTC) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by coreboot.org (Postfix) with ESMTP id 9B52912E2ECA for ; Wed, 12 Jun 2019 12:01:11 +0000 (UTC) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5CBsmO3106351; Wed, 12 Jun 2019 12:00:16 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2t05nqttpc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 12:00:16 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5CC0CjJ003077; Wed, 12 Jun 2019 12:00:15 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 2t0p9ru1ye-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 12:00:15 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5CC0CHY024450; Wed, 12 Jun 2019 12:00:13 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 12 Jun 2019 05:00:12 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=LGrComxyqN1TLgk8Bo9iKZ5zTEqxz7KVof3cokKzZBY=; b=WMudt7jgcn3b0qcd2KCaM0geGoby9sfs/IMFAcD8JIJgD8aMp5Mjm/3ZurUYw0egbRn4 aPGF6+aJKcHmli1c7/vdtpSLozJmymQqe2WUyIzSlfpFMiVaKE2amjZhuIjJeNBDUtUb AJMvQLGE8BXdhHvH0BXXWQxSowG0skb5k01In8SoiqfLiHLZkqDi36ovtqp5kjo8IviD g2rRbso1IOCi+644zH0BpYGAThELJyDZTuVyXsJKHCQh+GSjK6tZKETdEpykYjNxA7Mj jNCoYH621xWAlehvP6baNkqUu8Ge7NBzwN8SYXMqfV0Si+Lfn7AXTZD5fjihDHAwX/32 rQ== From: Sam Eiderman To: kwolf@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com, seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net Date: Wed, 12 Jun 2019 14:59:36 +0300 Message-Id: <20190612115939.23825-6-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190612115939.23825-1-shmuel.eiderman@oracle.com> References: <20190612115939.23825-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=886 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906120083 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=930 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906120083 Message-ID-Hash: OPHH6C2W5I6MIHEARBNSM7S527NGH375 X-Message-ID-Hash: OPHH6C2W5I6MIHEARBNSM7S527NGH375 X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: karl.heubaum@oracle.com, arbel.moshe@oracle.com X-Mailman-Version: 3.2.2 Precedence: list Subject: [SeaBIOS] [QEMU] [PATCH v2 5/8] bootdevice: Gather LCHS from all relevant devices List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org X-Spamd-Bar: / X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" 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 --- hw/block/virtio-blk.c | 6 ++++++ hw/ide/qdev.c | 5 +++++ hw/scsi/scsi-disk.c | 14 ++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 06e57a4d39..787bbd768a 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -1182,6 +1182,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) @@ -1189,6 +1194,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 9cae3205df..07f429d5e3 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -215,6 +215,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 7b89ac798b..3451aefdea 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2390,6 +2390,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) @@ -2988,6 +2998,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"; @@ -3019,6 +3030,7 @@ static void scsi_cd_class_initfn(ObjectClass *klass, = void *data) SCSIDeviceClass *sc =3D SCSI_DEVICE_CLASS(klass); =20 sc->realize =3D scsi_cd_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 CD-ROM"; @@ -3054,6 +3066,7 @@ static void scsi_block_class_initfn(ObjectClass *klas= s, void *data) SCSIDiskClass *sdc =3D SCSI_DISK_BASE_CLASS(klass); =20 sc->realize =3D scsi_block_realize; + sc->unrealize =3D scsi_unrealize; sc->alloc_req =3D scsi_block_new_request; sc->parse_cdb =3D scsi_block_parse_cdb; sdc->dma_readv =3D scsi_block_dma_readv; @@ -3095,6 +3108,7 @@ static void scsi_disk_class_initfn(ObjectClass *klass= , void *data) SCSIDeviceClass *sc =3D SCSI_DEVICE_CLASS(klass); =20 sc->realize =3D scsi_disk_realize; + sc->unrealize =3D scsi_unrealize; sc->alloc_req =3D scsi_new_request; sc->unit_attention_reported =3D scsi_disk_unit_attention_reported; dc->fw_name =3D "disk"; --=20 2.13.3 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Thu Mar 28 13:15:22 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1560340915; cv=none; d=zoho.com; s=zohoarc; b=GrCx4JGguJFa3NNNMhqT6BrDIDxzm092UKJS7HNeLMcHPu6IO6kr4+29z+5bVflsjneEjI+lPN11ADmeS0tcRyb+jZ6JcJ2zVFiPB80bK5f41cRXaLJAyV7Z40k/fymhXBufnEjoycl6Xu3ih7MOnDDGrPRtoLuEPZUwlklkHV0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560340915; 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:Subject:To:ARC-Authentication-Results; bh=mxEz8KqPLJxhwjpcOtwTjtvoY7sJVxLsJUbcGylMj5s=; b=mubXXYk8YEkKZvnIvgeBqIVwJ5nI9cEfP41Tv6bPnGt6amWBSE5IyWfYorEE7yZVn3l2YNWtSnSQ+KNe2KxaRriTSBwjwM07kPQEEoChutoX/3VRpDDitslmyHQpWDP6kZnzDi/ghZ1NSuuqho3CTvVDSxAEoeMPYbLjMnNPXEk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1560340915362727.5006790555083; Wed, 12 Jun 2019 05:01:55 -0700 (PDT) Received: from [192.168.203.99] (mailu_mailman-core_1.mailu_default [192.168.203.99]) by coreboot.org (Postfix) with ESMTP id 3046512E2EE7; Wed, 12 Jun 2019 12:01:51 +0000 (UTC) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by coreboot.org (Postfix) with ESMTP id E85C712E2EDA for ; Wed, 12 Jun 2019 12:01:21 +0000 (UTC) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5CBsYaj105998; Wed, 12 Jun 2019 12:00:17 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2t05nqttpj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 12:00:17 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5CBxPgk196364; Wed, 12 Jun 2019 12:00:17 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3030.oracle.com with ESMTP id 2t024uxgm8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 12:00:16 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5CC0GOQ020759; Wed, 12 Jun 2019 12:00:16 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 12 Jun 2019 05:00:15 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=iHOxrB7sQtoFEk7ueVdptFxfU4bhLQrvkAX6+XMXujI=; b=IBdIrmuN7Clx3AH1BLn/sHlGoxg3SS4ag03nOaTGF9nQ2NHhb8s2kEIjJ7LiMhGUzuYC pXCPoKh0i7STgcCZjhSepveefdgPK/JQJ4bQCQKaajvoe4bZT6Tt8jeDbGB43uYKNvMs WWhrelLW5jm7nsS45ZuK4HZllms1Ojsaby4jhuCCT6m0FqVe89hypJ6NCxWkQkPlus72 p8Rb5Qhu2cnXBBhG0GD9TvdSA6SH+EB+KBpDLD+7ABolGN49Fc2L8zUu0OgYWeFqR0yA bezGqxYR5m2DytPsZZMsnKyubZlOn5S4C6K1ooGtAe+quc3MNdNWE1OLzsbj+u1xWFSZ Ew== From: Sam Eiderman To: kwolf@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com, seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net Date: Wed, 12 Jun 2019 14:59:37 +0300 Message-Id: <20190612115939.23825-7-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190612115939.23825-1-shmuel.eiderman@oracle.com> References: <20190612115939.23825-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906120083 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906120083 Message-ID-Hash: SRNO27BUGOTHDJ2E5KSNSFP5XVTASRKJ X-Message-ID-Hash: SRNO27BUGOTHDJ2E5KSNSFP5XVTASRKJ X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: karl.heubaum@oracle.com, arbel.moshe@oracle.com X-Mailman-Version: 3.2.2 Precedence: list Subject: [SeaBIOS] [QEMU] [PATCH v2 6/8] bootdevice: Refactor get_boot_devices_list List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org X-Spamd-Bar: / X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" 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 Signed-off-by: Sam Eiderman --- bootdevice.c | 61 +++++++++++++++++++++++++++++++++-----------------------= ---- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/bootdevice.c b/bootdevice.c index bc5e1c2de4..2b12fb85a4 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, + 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.13.3 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Thu Mar 28 13:15:22 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1560340902; cv=none; d=zoho.com; s=zohoarc; b=CK9F5kRGNSt2OVqgZJdjzr1huyiVQSA/3qXL4upah3+euyqn0wc9qDAvWSJ4M9e6oJUz3ZGfyzCMkDHFSQ+pjhv+OW2D+rJPFRdFttOmw/VnLGFyiAocu7BsAbjikLmJPKw35koWL5AIVKs/LXT+hyUs9SgmCOu/9U3UVK4IxJM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560340902; 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:Subject:To:ARC-Authentication-Results; bh=3b14QT89owHoZyMeFkJS6tvE4UYGOTmOP58+ZTsWPc0=; b=d0q7V81eERSCR2Stwg4sjj+v0IJgs0rrHtPo430x/gGo4sbGZ8POB75SLqcdJxzam/3tgy5X2fva3WUKiX09INqotuYjxtwDfXwqDfapKPgeXlXQa2YlJJugQMdX2qyoBWDXST4wc5aWiLHyHedH8RdlP/ADt2dmvPTwmAN9pzk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1560340902839430.01258681007744; Wed, 12 Jun 2019 05:01:42 -0700 (PDT) Received: from [192.168.203.99] (mailu_mailman-core_1.mailu_default [192.168.203.99]) by coreboot.org (Postfix) with ESMTP id C72A312E2EDA; Wed, 12 Jun 2019 12:01:37 +0000 (UTC) Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) by coreboot.org (Postfix) with ESMTP id 2B49512E2ED4 for ; Wed, 12 Jun 2019 12:01:17 +0000 (UTC) Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5CBsGRX115391; Wed, 12 Jun 2019 12:00:21 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 2t02heu1h6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 12:00:21 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5CBwo6v075256; Wed, 12 Jun 2019 12:00:20 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 2t1jphytx4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 12:00:20 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5CC0JYj020843; Wed, 12 Jun 2019 12:00:19 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 12 Jun 2019 05:00:18 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=hQZ3WEyRXWZ6Vma864cBiiSbs9o8TGD6e7LS+aGjIko=; b=r8Q4MrAcugxiQvrIk0ls6MilOzcArq0I5RmrvQKufDOWZZoutu0klW3cYtDTRzoFFas0 YwuTvB/YqkWWCXfcgbogFoiH3Gv8h3PaxaybCGaQYzeDbrPj7rmUfbsTYSsFkfQO2d7k CEMepVr+jAnjNU9hV0NKumhVg0PWTV6654zR2hraEPmdhzIEVuHv5j2vKZAhMrtFLpSS h5dxLrs/X8D8wBd7lmWjHp4/kt7qhYiMbycDy8hr8Fq4yeWjITWO0P+2RfrYTIjIH5I5 IIzQyThjtDzqHZ7+ymrGkWNqIXNgQFdBTdCY2UNMatbawmABmF6PTw4fAc9bUrdxtAqj 3Q== From: Sam Eiderman To: kwolf@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com, seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net Date: Wed, 12 Jun 2019 14:59:38 +0300 Message-Id: <20190612115939.23825-8-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190612115939.23825-1-shmuel.eiderman@oracle.com> References: <20190612115939.23825-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906120083 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906120083 Message-ID-Hash: 5WTMCYBEVMYIDTJLSEZBWIEZDD5ZWK35 X-Message-ID-Hash: 5WTMCYBEVMYIDTJLSEZBWIEZDD5ZWK35 X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: karl.heubaum@oracle.com, arbel.moshe@oracle.com X-Mailman-Version: 3.2.2 Precedence: list Subject: [SeaBIOS] [QEMU] [PATCH v2 7/8] bootdevice: FW_CFG interface for LCHS values List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org X-Spamd-Bar: / X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" 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 fw_cfg entry is "bootdevices" and it serializes a struct. At the moment the struct holds the values of logical CHS values but it can be expanded easily due to the extendable ABI implemented. (In the future, we can pass the bootindex through "bootdevices" instead "bootorder" - unifying all bootdevice information in one fw_cfg value) The PV interface through fw_cfg could have also been implemented using device specific keys, e.g.: "/etc/bootdevice/%s/logical_geometry" where %s is the device name QEMU produces - but this implementation would require much more code refactoring, both in QEMU and SeaBIOS, so the current implementation was chosen. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman --- bootdevice.c | 42 ++++++++++++++++++++++++++++++++++++++++++ hw/nvram/fw_cfg.c | 14 +++++++++++--- include/sysemu/sysemu.h | 1 + 3 files changed, 54 insertions(+), 3 deletions(-) diff --git a/bootdevice.c b/bootdevice.c index 2b12fb85a4..84c2a83f25 100644 --- a/bootdevice.c +++ b/bootdevice.c @@ -405,3 +405,45 @@ void del_boot_device_lchs(DeviceState *dev, const char= *suffix) } } } + +typedef struct QEMU_PACKED BootDeviceEntrySerialized { + /* Do not change field order - add new fields below */ + uint32_t lcyls; + uint32_t lheads; + uint32_t lsecs; +} BootDeviceEntrySerialized; + +/* Serialized as: struct size (4) + (device name\0 + device struct) x devi= ces */ +char *get_boot_devices_info(size_t *size) +{ + FWLCHSEntry *i; + BootDeviceEntrySerialized s; + size_t total =3D 0; + char *list =3D NULL; + + list =3D g_malloc0(sizeof(uint32_t)); + *((uint32_t *)list) =3D (uint32_t)sizeof(s); + total =3D sizeof(uint32_t); + + QTAILQ_FOREACH(i, &fw_lchs, link) { + char *bootpath; + size_t len; + + bootpath =3D get_boot_device_path(i->dev, false, i->suffix); + s.lcyls =3D i->lcyls; + s.lheads =3D i->lheads; + s.lsecs =3D i->lsecs; + + len =3D strlen(bootpath) + 1; + list =3D g_realloc(list, total + len + sizeof(s)); + memcpy(&list[total], bootpath, len); + memcpy(&list[total + len], &s, sizeof(s)); + total +=3D len + sizeof(s); + + g_free(bootpath); + } + + *size =3D total; + + return list; +} diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 9f7b7789bc..008b21542f 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -916,13 +916,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_info(&len); + ptr =3D fw_cfg_modify_file(s, "bootdevices", (uint8_t *)buf, len); + g_free(ptr); + } } =20 static void fw_cfg_machine_ready(struct Notifier *n, void *data) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 173dfbb539..f0552006f4 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -174,6 +174,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_info(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, --=20 2.13.3 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Thu Mar 28 13:15:22 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1560340909; cv=none; d=zoho.com; s=zohoarc; b=JRhP2RF65L2Ia94ADDVloiRzqLDDtLZdI8yInFrbaMv9Zi5Kc5JZm1FWIJMOA4BX53a6UWON5blh+aMqLdPn1PW2L5m8vGRHqVlEXBbMB6yTyJi5AvoHgRpc/6oRDrpyhZYb5mouYLDISvWQS0zVm2fszZO/CDEC8kIsGmhZuHM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560340909; 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:Subject:To:ARC-Authentication-Results; bh=NROxbqbpn49stxBbj4koX+D8T6dMF1OAYDFGf7SPJ+U=; b=ge7iDK1RU8OY/a4l0I/Cl0Z3M8/YK1i46tKg7r+qD+CY5DTJzC/0Uh83Bnc85DPd7bFLkpIaQ5BFDAgMReLemOHItgRNWYf3lSIxISVPo9mFmn8tzG7daPxMbIPq+xKuwl1YPtcx/rDZyVq9F02cJl2wT4+Oe/I5idrJAxshr2A= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1560340909119563.5016218591388; Wed, 12 Jun 2019 05:01:49 -0700 (PDT) Received: from [192.168.203.99] (mailu_mailman-core_1.mailu_default [192.168.203.99]) by coreboot.org (Postfix) with ESMTP id 2ECC112E2EE5; Wed, 12 Jun 2019 12:01:44 +0000 (UTC) Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by coreboot.org (Postfix) with ESMTP id A566D12E2EDA for ; Wed, 12 Jun 2019 12:01:20 +0000 (UTC) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5CBsKuM096692; Wed, 12 Jun 2019 12:00:24 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 2t04ettx39-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 12:00:23 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5CC0C44003094; Wed, 12 Jun 2019 12:00:23 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 2t0p9ru221-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 12:00:22 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5CC0MPS020910; Wed, 12 Jun 2019 12:00:22 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 12 Jun 2019 05:00:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=HeClDaNlhSlrH2DGXwHKIi01pxw6OyJgboxWVGdUh3U=; b=hetaC1v2qhob0kF7EVWGFxNI/vK5MGQTYn1gITcOa4AbMW/yw+dRhygIFZ3Mznib0fNb 1LGyhKFHnbeCHlI9YH0CP5dyRaxm1ancz/sGFmz9ruWJjVtUxp5ojShSrFWcIOZAKxpX eHbITA4qWyQa2yNkcXK+Hbg2Qm8eE+YXibAOaREmsbxO6R2qdKWQAR0vXH4UXGZ9XiST VCAQQ5wKke9GsUnJ9IYzaRE9dJfaLIfF3xuCQCbt9vg/67OUPIs8S2gAwMsItpajpjd3 gktNqU4rHxYXQOxZJwFA78fY0oWQmPmcPcSGMXOCPvT0Z7WZVSPRbDapVkPJqUdO8kDe 9A== From: Sam Eiderman To: kwolf@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com, seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net Date: Wed, 12 Jun 2019 14:59:39 +0300 Message-Id: <20190612115939.23825-9-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190612115939.23825-1-shmuel.eiderman@oracle.com> References: <20190612115939.23825-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906120083 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906120083 Message-ID-Hash: 4BL5PCLI4LQM2TPNGSUWTE2M7YXWUU65 X-Message-ID-Hash: 4BL5PCLI4LQM2TPNGSUWTE2M7YXWUU65 X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: karl.heubaum@oracle.com, arbel.moshe@oracle.com X-Mailman-Version: 3.2.2 Precedence: list Subject: [SeaBIOS] [QEMU] [PATCH v2 8/8] hd-geo-test: Add tests for lchs override List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org X-Spamd-Bar: / X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" 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. I added a few helper functions which will make adding more tests easier. QTest's fw_cfg helper functions support only legacy fw_cfg, so I had to read the new fw_cfg layout on my own. 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 --- tests/Makefile.include | 2 +- tests/hd-geo-test.c | 565 +++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 566 insertions(+), 1 deletion(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index 46a36c2c95..55ea165ed4 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -765,7 +765,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 \ diff --git a/tests/hd-geo-test.c b/tests/hd-geo-test.c index 62eb624726..08eafeb81a 100644 --- a/tests/hd-geo-test.c +++ b/tests/hd-geo-test.c @@ -17,7 +17,11 @@ =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 "standard-headers/linux/qemu_fw_cfg.h" =20 #define ARGV_SIZE 256 =20 @@ -388,6 +392,557 @@ 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; + + 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); + + ret =3D snprintf(cmd, sizeof(cmd), + "$QTEST_QEMU_IMG convert -f raw -O qcow2 %s %s > /dev/n= ull", + 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), + "$QTEST_QEMU_IMG resize %s %" PRIu64 " > /dev/null", + qcow2_path, qcow2_size); + g_assert((0 < ret) && (ret <=3D sizeof(cmd))); + ret =3D system(cmd); + g_assert(ret =3D=3D 0); + + unlink(raw_path); + free(raw_path); + + return qcow2_path; +} + +struct QemuCfgFile { + uint32_t size; /* file size */ + uint16_t select; /* write this to 0x510 to read it */ + uint16_t reserved; + char name[56]; +}; + +static uint16_t find_fw_cfg_file(QFWCFG *fw_cfg, + const char *filename) +{ + struct QemuCfgFile qfile; + uint32_t count, e; + uint16_t select; + + count =3D qfw_cfg_get_u32(fw_cfg, FW_CFG_FILE_DIR); + count =3D be32_to_cpu(count); + for (select =3D 0, e =3D 0; e < count; e++) { + qfw_cfg_read_data(fw_cfg, &qfile, sizeof(qfile)); + if (!strcmp(filename, qfile.name)) { + select =3D be16_to_cpu(qfile.select); + } + } + + return select; +} + +static void read_fw_cfg_file(QFWCFG *fw_cfg, + const char *filename, + void *data, + size_t len) +{ + uint16_t select =3D find_fw_cfg_file(fw_cfg, filename); + + g_assert(select); + + qfw_cfg_get(fw_cfg, select, data, len); +} + +#define BOOTDEVICES_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[]) +{ + uint32_t info_size; + char *buf =3D g_malloc0(BOOTDEVICES_MAX_SIZE); + void *cur; + char *name; + CHS *chs; + GList *results =3D NULL, *cur_result; + CHSResult *r; + int i; + bool found; + + read_fw_cfg_file(fw_cfg, "bootdevices", buf, BOOTDEVICES_MAX_SIZE); + + cur =3D buf; + + info_size =3D *((uint32_t *)cur); + + g_assert(info_size >=3D sizeof(*chs)); + + cur +=3D 4; + + while (strlen(cur)) { + name =3D cur; + chs =3D cur + strlen(cur) + 1; + + r =3D g_malloc0(sizeof(*r)); + r->dev_path =3D name; + r->chs =3D *chs; + + results =3D g_list_prepend(results, r); + + cur +=3D strlen(cur) + 1 + info_size; + } + + 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(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[]) +{ + char *joined_args; + QFWCFG *fw_cfg; + int i; + + joined_args =3D g_strjoinv(" ", args->argv); + + qtest_start(joined_args); + fw_cfg =3D pc_fw_cfg_init(global_qtest); + + read_bootdevices(fw_cfg, expected); + + g_free(joined_args); + qtest_end(); + + 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) +{ + 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); + + qtest_start(joined_args); + fw_cfg =3D pc_fw_cfg_init(global_qtest); + + read_bootdevices(fw_cfg, expected); + + /* unplug device an restart */ + response =3D qmp("{ 'execute': 'device_del'," + " 'arguments': {'id': 'scsi-disk0' }}"); + g_assert(response); + g_assert(!qdict_haskey(response, "error")); + qobject_unref(response); + response =3D qmp("{ 'execute': 'system_reset', 'arguments': { }}"); + g_assert(response); + g_assert(!qdict_haskey(response, "error")); + qobject_unref(response); + + qtest_qmp_eventwait(global_qtest, "RESET"); + + read_bootdevices(fw_cfg, expected2); + + g_free(joined_args); + qtest_end(); + + 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) +{ + 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); + + qtest_start(joined_args); + fw_cfg =3D pc_fw_cfg_init(global_qtest); + + read_bootdevices(fw_cfg, expected); + + /* unplug device an restart */ + response =3D qmp("{ 'execute': 'device_del'," + " 'arguments': {'id': 'virtio-disk0' }}"); + g_assert(response); + g_assert(!qdict_haskey(response, "error")); + qobject_unref(response); + response =3D qmp("{ 'execute': 'system_reset', 'arguments': { }}"); + g_assert(response); + g_assert(!qdict_haskey(response, "error")); + qobject_unref(response); + + qtest_qmp_eventwait(global_qtest, "RESET"); + + read_bootdevices(fw_cfg, expected2); + + g_free(joined_args); + qtest_end(); + + 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 +968,16 @@ 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); + 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); =20 ret =3D g_test_run(); =20 --=20 2.13.3 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org