From nobody Fri Apr 26 05:34:26 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=1561552880; cv=none; d=zoho.com; s=zohoarc; b=PBmNiNmMmWXAZt+N7Tn5KuJ4XvW4gWlLQSNZQkoI6S+yXBDqnUtyaU4yVlsMhjrFRbsjX4jeb0ph4jlzk6o7KLsq+mXkLxspwuRTwV1X6yNu2OeGHqlJ4Sid0tzzbDCdHhdCHQQa48XaTVtSKpKWK/YRro6aTgljRzYB6KVR7so= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561552880; 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=Y1R/FziI6EG/J2jFJpaFUQRDZ6iC46jk8/GGVu4qaqCqVtezEtsYeKIkTXPQ1rn/GInlNDNpMRvVuJ8d0WloK8d5o7QLV6TSioCcxeIv5ZFOxlFjtu+aPOrc6SAyp8/WZ3ZSsOYrqb5jyAoF1mKYiqzVrIieJrYLnkiaCwmVs7Y= 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 1561552880324359.4871528256574; Wed, 26 Jun 2019 05:41:20 -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 85573BA0BD9; Wed, 26 Jun 2019 12:41:15 +0000 (UTC) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by coreboot.org (Postfix) with ESMTP id 6E361BA0BBC for ; Wed, 26 Jun 2019 12:41:02 +0000 (UTC) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5QCd8QR108930; Wed, 26 Jun 2019 12:40:18 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 2t9c9pt2m6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:40:18 +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 x5QCdW5P100358; Wed, 26 Jun 2019 12:40:17 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3030.oracle.com with ESMTP id 2t9accp20r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:40:17 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5QCeGc7001811; Wed, 26 Jun 2019 12:40:16 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 26 Jun 2019 05:40:16 -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=kYl2i8oUqWeObWPMvdxV9japkh2f/mKgk3E4hxaBIyfcMG9FFwj9txdvmrbocxVVelh0 UawKBW8uAlRj1S/O4apqLaphz4JO2Ov7px9KD+Vs9X0wjuXLXymTADuHOb1p6O22xJPD DVhWJwwTydU/n3PD+iCGd2xepPAtLRReZNwoIhBvx0tZEP9b8veDqgcSySWK7Kz2fUe5 Jl7ILVbC9fGdlVE4SHy0R9YdgQofiOAbmFOYX9dAaBBCS/wBu49/6DLT+xRpYrI1cCBv FBqximDoZlPMXnpItu0hqPmlzNfk7d6eL5Gip7Fhg+NcfpIl1VJSnXinknaBoRCg1inP 2Q== 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, 26 Jun 2019 15:39:41 +0300 Message-Id: <20190626123948.10199-2-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190626123948.10199-1-shmuel.eiderman@oracle.com> References: <20190626123948.10199-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260150 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260151 Message-ID-Hash: MOOM2J66UFPGFMMPJ56VYATCQMQQW736 X-Message-ID-Hash: MOOM2J66UFPGFMMPJ56VYATCQMQQW736 X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; 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 v5 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 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" Fixing tabbing in block related macros. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman Acked-by: Max Reitz Reviewed-by: Gerd Hoffmann --- 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 Fri Apr 26 05:34:26 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=1561552893; cv=none; d=zoho.com; s=zohoarc; b=H4BOxM62ascWkJ+0Z457wAlZdV1jUv9TgKfm+RJa4ud3u8n8t6M6pInazYVoC2RcFe/sgBSyMxcGcsqFnu1xirWaEYjJOQjX3kKUGes34Yg9hYM6mRtwvM0GePgF786kPwe2JTI2asZIipc+C4Wvd5WNRENIqiSO71A1j6Cua0M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561552893; 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=Jv93zS0P0oSfgl3+thHwWsbhpWgFnQK3DAAs/68lcqi4JUQp1xiacqxjfygfcod1ga4+hw/kNVQ+3Bqkfp+O2RlvHIchHU84hK5NKa4ljnlfDYsLc4hEcLggi5MWex/XNnWDGH+DO5Jd54gJO9HV4QB6ak+BYuvIC+cLszCDJLk= 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 15615528934091013.254428817882; Wed, 26 Jun 2019 05:41:33 -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 09A4BBA0BEE; Wed, 26 Jun 2019 12:41:29 +0000 (UTC) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by coreboot.org (Postfix) with ESMTP id 6179EBA0BEB for ; Wed, 26 Jun 2019 12:41:16 +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 x5QCdK1U001588; Wed, 26 Jun 2019 12:40:20 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2t9cyqj0rv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:40:20 +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 x5QCcldQ164749; Wed, 26 Jun 2019 12:40:19 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 2t9p6urkmw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:40:19 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5QCeJV0003698; Wed, 26 Jun 2019 12:40:19 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 26 Jun 2019 05:40:19 -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=ryAp6GPZRNKQz9b7E6/XspHSq1PKxbQM6XFV+UPfH2qtnRZEUUtW+pQswOfo/O7aRhTz DfwOK+G++X2mFWU/Mdct178g2zMRM/zQjX3DiSV2BMBREWH4DCbixpsjDcncuZTbdNOh 1pnTM1a0c18JXlYrlZuhy1Bz/KH5Gy2gf6qAFiNI1q1tyGTTOu/Z0jizC6yJUFNSUgsf Bye5F+UpW3fVQhxPhGeqWvNFshxH8oKKxm6NbgMfXDKm3WrLBon9JyWqkIyNzDCtP8P9 yD6wefsIUI+leayUFemxzy829UotpZt+fhuoBB5Oeoa8+ix1gA64n3EprnivSDrV57Uh 1g== 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, 26 Jun 2019 15:39:42 +0300 Message-Id: <20190626123948.10199-3-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190626123948.10199-1-shmuel.eiderman@oracle.com> References: <20190626123948.10199-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260150 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260151 Message-ID-Hash: NAM7EIARLTIPBHYMBRITY6T7LG6N4BYG X-Message-ID-Hash: NAM7EIARLTIPBHYMBRITY6T7LG6N4BYG X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; 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 v5 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 Acked-by: Max Reitz Reviewed-by: Gerd Hoffmann --- 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 Fri Apr 26 05:34:26 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=1561552900; cv=none; d=zoho.com; s=zohoarc; b=DhXoCF+ZWSir1MWDA53o8bxeenvYav2rN2VceZ2q977HOPjF30s/8qBfVGXlX6uY2p3OqkIf25h1kattE/mdwmwC/Qo/RECAk+zqq8e3CX+KYe+3Sq8AkVsvA40l5x7PxuPyWgnQwp5lPaUwTQx9wUDyNLIQsvDQKdzdRusgJrU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561552900; 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=de7o8mUtBcuzYXdj/xw9SOC1TB7AYDyccQNlTa/nBM7Q9PvhmixcTBKBTAHvLWm40ud6RqtbyUsUvVwXd1uRXxgW1RJPMA7OZ3VIYQ8NDTFwoVZCKH/PKCXI6SEApS2hiSMdLNei3CshX6Bw8Td9w+uJ9hh5NlmNV/4/qybZfB0= 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 1561552900248283.37847315787747; Wed, 26 Jun 2019 05:41:40 -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 156E6BA0C0C; Wed, 26 Jun 2019 12:41:35 +0000 (UTC) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by coreboot.org (Postfix) with ESMTP id 70625BA0BFA for ; Wed, 26 Jun 2019 12:41:17 +0000 (UTC) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5QCdJHl109235; Wed, 26 Jun 2019 12:40:24 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 2t9c9pt2n8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:40:24 +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 x5QCcldR164749; Wed, 26 Jun 2019 12:40:23 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 2t9p6urknr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:40:23 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5QCeMbY025035; Wed, 26 Jun 2019 12:40:22 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 26 Jun 2019 05:40: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=VuvUHYBiIoed7M4Qt45n2olUqtuKHAeuaxDDCAKVfqc=; b=fO4nF7xDa/qQ0PW+tbOQMwQvv9aDn2F2I/Fl16uO9B4A0pLQu8/Gd5j20IkSepNb5r2I tYoAv7mk6JcJGY+kEHhbeEPraAzfVI/KFLCtU/rIpB6E7aV0g6KbwvYHrjme08HAGD1N b5AFSg7D5/2RbvOoK9TSVmfUa1BhoZmm1J4DNEHM/IFjXSaD4caT8EIn1N3B7l4ynTvZ dn3+ABUENYwUJ6I34Q7UOvO8X85jIdO2w3G0+KExnFO4Y7PGfdOz1h6TjRggAOSbYWrB MivkaAqaWw4NWCHYC0Vbp8dnive5axHrWCU2Tp4BWtvqGOPKmVhE9HaP2NByEeN5bDPf lA== 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, 26 Jun 2019 15:39:43 +0300 Message-Id: <20190626123948.10199-4-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190626123948.10199-1-shmuel.eiderman@oracle.com> References: <20190626123948.10199-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260150 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260151 Message-ID-Hash: L23HG5DE76RIMWQWOVT3I5HN5HTNU2LR X-Message-ID-Hash: L23HG5DE76RIMWQWOVT3I5HN5HTNU2LR X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; 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 v5 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 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 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 Acked-by: Max Reitz Reviewed-by: Gerd Hoffmann --- 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 Fri Apr 26 05:34:26 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=1561552906; cv=none; d=zoho.com; s=zohoarc; b=OFuVbHfYSPwOUsfjrukMz3NrQ9Rd7/ihY6fdCDkQ01YFZ070n3DouYKu3dcvpGNfmpVmCDdhns5w29rEUZrjQY93uCyqUqWy+nW9sIWCuX5N8toe3tysMbplR2uhlOZpiUhpz/6x7T8QKj2P3e656WjpwBQDd3XzsprxHJ4kZxI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561552906; 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=mQsu/lvs1w9spiN+wUEJI2aGBWF8mMzA12i8fZJHdU52Ep+bIwcKzTX6dcvY6DCnAaT3JW36CxGSsJgchjbapmsKYmPzcqNyu1tKiWIMCLWCqwvPDVDeGBcnaBpJQhsa24PSxZQJ0rzEH0JCyvxNudPf55cFPQFxL9PDFu3j6ns= 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 1561552906232707.305853233481; Wed, 26 Jun 2019 05:41:46 -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 0909EBA0C14; Wed, 26 Jun 2019 12:41:41 +0000 (UTC) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by coreboot.org (Postfix) with ESMTP id 562ADBA0C09 for ; Wed, 26 Jun 2019 12:41:18 +0000 (UTC) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5QCd5sG108861; Wed, 26 Jun 2019 12:40:26 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 2t9c9pt2nb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:40:26 +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 x5QCclkZ164837; Wed, 26 Jun 2019 12:40:25 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 2t9p6urkpa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:40:25 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5QCePEQ003787; Wed, 26 Jun 2019 12:40:25 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 26 Jun 2019 05:40:24 -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=r7PNk2WlbeXsFXABl+oAApWMCN3JGVIDXH7PxTmNeV+d13sQrP/oVVY0LUYjhvclZHdc 0Bk++sHEqMaQNwazGUmb8WHDLvKWVXX8/nvxv2PWfdY+eHusW6no9qx3bWyZroza7pLN pOa6GZ3b/BaqhtyW8PgGMQvmy6cZnFSKh7U2OT1ZB8d0m11aLuqOdyXr40Yjs9Nf2gU+ loir+nLAjgojAkTM/CxVaQ//RSNlEZQbUsHzOu7gIgkhFfK5Lp2nMFfFlOdOF3Q8GwNh 0yEl+w6dRB+6wyvqIxWzABDs19m641cHkPHvaBQwSmTkZeqje+YmAL6mcXyxn5f6e9Ub 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, 26 Jun 2019 15:39:44 +0300 Message-Id: <20190626123948.10199-5-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190626123948.10199-1-shmuel.eiderman@oracle.com> References: <20190626123948.10199-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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=964 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906260150 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260151 Message-ID-Hash: 5O2TIXXRWAGLVZ3XHNEKOCMTZMFE266O X-Message-ID-Hash: 5O2TIXXRWAGLVZ3XHNEKOCMTZMFE266O X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; 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 v5 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 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" 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 Acked-by: Max Reitz Reviewed-by: Gerd Hoffmann --- 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 Fri Apr 26 05:34:26 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=1561552993; cv=none; d=zoho.com; s=zohoarc; b=hQED5iqRSG6po0W+MVf1+xbTA2h0+gIbzTLPKmqNLG8YLA2+MlkgNrDZixdn8pn6jcHFuOmkBmm6lZaGUJgIUNBu29gc6sBCnzYuYvYxX4ZX8GNGlQGoAmix0nmu3I95eUXqNscvdu5KBYDFLcb2iDuiXI9rNHdD9qPxEfTyJUQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561552993; 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=od38PlkfdqysH9FrY3fLRzty+WcgggOF50+dtHmhIW7EHqM+L0dAQLWTGuA76PMK5LOmcy4bImZM0f/hyR9R7OdnE1yMro1Kle3ZnPopdBdYVmzoyjH29Z74vQ8UwIu1ZBENKlDFutDPKEuvaHzgvbNbPFGt5q6uyp87Q0tDum0= 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 1561552993331941.8825315766245; Wed, 26 Jun 2019 05:43:13 -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 8CA81BA0BD6; Wed, 26 Jun 2019 12:43:09 +0000 (UTC) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by coreboot.org (Postfix) with ESMTP id 97B4BBA0BBC for ; Wed, 26 Jun 2019 12:42:55 +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 x5QCd6cC001483; Wed, 26 Jun 2019 12:42:30 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 2t9cyqj1aa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:42:30 +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 x5QCdRb5025455; Wed, 26 Jun 2019 12:40:30 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3020.oracle.com with ESMTP id 2tat7ct5r4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:40:29 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5QCeTmI001927; Wed, 26 Jun 2019 12:40:29 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 26 Jun 2019 05:40:27 -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=KArJYl03fe2pq3k9U9mQNsQf4YBVbq0CN7Ri9+oVF92zEY7PMPNFSY0KaSCxqeR3IsXU 9suERA/m8f8htaC5izFGKe3sa6CKz2WBBHO44StjD6t7PzVe7C1+5Y9B4OzFaTrlTEy0 A4oMPqU4++LD93XDRyWcUzRbYDnEb4ts/6ST53KrD6KECyRQwTWt/wVmMUOaUpoqQAFn YlFOeB8vT/FrHCFXhvUW00s3SAYIUgdfsLfHV5lrywslNCCX6O5B058WgsbaeTSsNyMf m55OV3vagRUNagY7SOchnjWnb00vn9m4KJqyGqQUmGl8Nla3qaAvgrDnLbjCIbJyxhy/ uw== 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, 26 Jun 2019 15:39:45 +0300 Message-Id: <20190626123948.10199-6-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190626123948.10199-1-shmuel.eiderman@oracle.com> References: <20190626123948.10199-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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=881 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906260150 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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=928 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906260151 Message-ID-Hash: 53OSNIA3J44VFTU2242WZG3QCNGVWJQN X-Message-ID-Hash: 53OSNIA3J44VFTU2242WZG3QCNGVWJQN X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; 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 v5 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 Acked-by: Max Reitz Reviewed-by: Gerd Hoffmann --- 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 Fri Apr 26 05:34:26 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=1561552887; cv=none; d=zoho.com; s=zohoarc; b=Mz406I5rx8u6xFjmzqN/vnwdontdUVx7FDOIjrC0RWMFIz9q5MYBQfGmpAIzGbgCyyjnzyM+/1Y8JL9qJ0ObUHTQAjbU4/sV+i5fb4GACoY34NmlcoreCcwQHZfnAxs+mMNKG9AgxKq6EO0cTPW/DjKp64Gm5jfFZBEceHYtk9o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561552887; 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=RxuVLLo+FwPVLjvApJ9G7St5N/cjqziJFePP221tfMUv0hBMmcaoClx9S7aP+57wpZlQvG2/u4kAKpqRvXQ5ZSeKULoKBRkjP5cC3CQ8DZRrNEtLLJZthg0KBgI2edv9IvxgszW88n9cLs5Yf0I6yp4Smyu8LZ4vj3RSnZWXDlk= 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 1561552887530517.7799558995521; Wed, 26 Jun 2019 05:41:27 -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 ECD97BA0C00; Wed, 26 Jun 2019 12:41:22 +0000 (UTC) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by coreboot.org (Postfix) with ESMTP id 44702BA0BBF for ; Wed, 26 Jun 2019 12:41:06 +0000 (UTC) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5QCd7ko108915; Wed, 26 Jun 2019 12:40:33 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 2t9c9pt2nx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:40:33 +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 x5QCdf79100737; Wed, 26 Jun 2019 12:40:33 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3030.oracle.com with ESMTP id 2t9accp243-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:40:33 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5QCeVPg001946; Wed, 26 Jun 2019 12:40:32 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 26 Jun 2019 05:40:31 -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=ULR4M9dzEUJe0XBKUeI0ovjuiaFxUcM7qn7Fdr5hDihvJlI3YNU2zO0khgjNIrqVHjk3 fgoY9Wk7mTWKK298Wth2sM5HOgp5k5S+tOpKDORNCEIFLVAjBi/uUKRyBnpAWGm24RVx Q+a/fFzzCWJM2HQPuUEnkPMHATsBffsk2DLKG7rpUMJgofYQTgSyi/MhQVzkw10PS0Ln hCgNvVwGzLjPhdPY7nkBkiMhTmWg6V/0KF1HMdPVuw1tX1iPQF+fwT0Zi19jDe6fiEen IcbNcl/YHgosu9Q/0NpTyL/tGBXz7OGJaOCXc91hySV3v56sdH/vEE1eAAEeE1XqoN/+ yA== 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, 26 Jun 2019 15:39:46 +0300 Message-Id: <20190626123948.10199-7-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190626123948.10199-1-shmuel.eiderman@oracle.com> References: <20190626123948.10199-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260150 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260151 Message-ID-Hash: QYKGHXDI4UBWTXUCPEBAIB7ZZS4DA4WW X-Message-ID-Hash: QYKGHXDI4UBWTXUCPEBAIB7ZZS4DA4WW X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; 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 v5 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 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" 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 Acked-by: Max Reitz Reviewed-by: Gerd Hoffmann --- 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 Fri Apr 26 05:34:26 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=1561552918; cv=none; d=zoho.com; s=zohoarc; b=HjIxh2Oja4rGj7z0p0Jruxx7AmWaBR8pgJxgBVk8FgCvqXM/1O0P5iWgkWEwKy1h0Hpq+zI8Jz/WwWGBo2D65Pqm2q273eBZOQiX4+tmEoitIYtJPEJr+U+dIJJtL6w2NrRDWmoXhO0LHnx54PRbQCrZHaPdJT3Y8JZo2BsXfGU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561552918; 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=shhAgeEQXjugPjqzI5o+uMewOKwE5uiqKs/2yDdxivY=; b=UQF0I0UyMf6Zr1MC4RCJgGtCqEUAxLFZ2fnTJJ+SuDD742L3Sgr02oI0gDtE4EBLp2sxZCAR1ZBCW4LfxXyhNuv1maL1CvVkDmQnH4RD2xp+Zk9x2iB0TtvsGsyZovUsq+ftusFVAWHVMZT+bSwWs/RuB14M8iMAkNHRMedQioE= 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 1561552918115523.9314651489113; Wed, 26 Jun 2019 05:41:58 -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 2400EBA0C39; Wed, 26 Jun 2019 12:41:53 +0000 (UTC) Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by coreboot.org (Postfix) with ESMTP id 247C0BA0C09 for ; Wed, 26 Jun 2019 12:41:19 +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 x5QCd6i6191501; Wed, 26 Jun 2019 12:40:36 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 2t9brta4ep-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:40:36 +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 x5QCdupB166899; Wed, 26 Jun 2019 12:40:35 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 2t99f4ehnh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:40:35 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5QCeYnY021038; Wed, 26 Jun 2019 12:40:34 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 26 Jun 2019 05:40:34 -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=noZWG3P3O0MHQDtdNioTi7jsSJK8AoXcSNJCtLLqjkQ=; b=XpZqMYOJzyf1Htl5Q16YTruEqXZLGPfcxMEeMryLuonlRmj7e3GbW2wJp60Ewk2WyZbb R1v1aq3N/e21u2HOwpEYiOyL+oifweQkJ5mKhDRIgJToEVKC2Z/QF+LWzFfDcBIZcmkF 6B1jtyK8wJFPEGQD4W1QgR5+q/j9q3RNxoyz0Rr7ek/VP0mZZ7qpbl9LlOEaHu+oXXNC xSvu1hDGlN7RMzvCdbeJ5kF/xOgal9tsfGL5piKmMcXLzBRS8+u1QGsdlan+jfezd1tb AMZoU/UjwdXmhwg8N6S+e5FMTvcyYWeiRswgZbCdmYxdbUyl6LtsTJdS8S6aSAJ3i5i2 Ug== 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, 26 Jun 2019 15:39:47 +0300 Message-Id: <20190626123948.10199-8-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190626123948.10199-1-shmuel.eiderman@oracle.com> References: <20190626123948.10199-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260150 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260151 X-Spam-Level: *** Message-ID-Hash: L7PTYKKARQEJPJ4BQB5AJWRN6MABGDNP X-Message-ID-Hash: L7PTYKKARQEJPJ4BQB5AJWRN6MABGDNP X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; 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 v5 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 new fw_cfg entry is "bios-geometry". Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman Acked-by: Max Reitz Reviewed-by: Gerd Hoffmann --- bootdevice.c | 32 ++++++++++++++++++++++++++++++++ hw/nvram/fw_cfg.c | 14 +++++++++++--- include/sysemu/sysemu.h | 1 + 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/bootdevice.c b/bootdevice.c index 2b12fb85a4..b034ad7bdc 100644 --- a/bootdevice.c +++ b/bootdevice.c @@ -405,3 +405,35 @@ void del_boot_device_lchs(DeviceState *dev, const char= *suffix) } } } + +/* Serialized as: (device name\0 + lchs struct) x devices */ +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 9f7b7789bc..c1230fe11c 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_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) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 173dfbb539..1ca8799588 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_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, --=20 2.13.3 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Fri Apr 26 05:34:26 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=1561552873; cv=none; d=zoho.com; s=zohoarc; b=Kwyxx/1TwydE5PR4K5zDeYxcZQBVElbhdN3hHlmowNdnD9Xn1LpdijLoUO4nEJaO/NWJ9D90Sj1Dle3DL85OWMhimoN+lvtAys/LtngFsIKIbsWTfT5Rtd8pXQg16JOPeZCqbSnjpKaZ9yL4+s1wqIRuhAVloAfGOA9CI/Okepw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561552873; 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=Kc8MnyuiboO3CfzgIhd2/wi9Um9kzASS046VMs8XuDI=; b=lu86W6f2SRGDEw1xHdH0V99pki298Sod+Lftlzq86vO+VY+yY2I1th4FaIk+8UY/BH3VVidEN8RfWdM4lcCi/GQkvOw2EnGs9b7DHxoAh4tOAY2p73BtAeDH4O0+XuElu4IjPKbkB6O9xLhlNe6RSBC3fQ9G2bndkSYow9hwLZo= 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 1561552873880281.76173813035416; Wed, 26 Jun 2019 05:41:13 -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 91E17BA0BC2; Wed, 26 Jun 2019 12:41:09 +0000 (UTC) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by coreboot.org (Postfix) with ESMTP id 3C7E8BA0BBC for ; Wed, 26 Jun 2019 12:41:00 +0000 (UTC) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5QCd6ew108880; Wed, 26 Jun 2019 12:40:39 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 2t9c9pt2p9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:40:38 +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 x5QCclhb164764; Wed, 26 Jun 2019 12:40:38 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 2t9p6urksp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Jun 2019 12:40:38 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5QCeciZ003909; Wed, 26 Jun 2019 12:40:38 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 26 Jun 2019 05:40:37 -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=ak9Dk/2KghWBHbYT1sPXjRMS0GbGbjhoxii7CeYW1Is=; b=gGIRVfL1DtLmlrHi6kZTsPteDbBOvpEyuDH4cQWuDQs17anVRdGM1dDXqlnWXk1S/afB B/t6ZZ8pZWRP4P4z9JmvR80lE1Cfe+/mjerl0KUNYpVVtvHei8dKKFDJm2KbnhCxKIDB mjgDfj6HwK/T6V7sgrXijVkxXvNebHuBUG3fBkQLB2hXzCXCMRkV1M5LNAWkmvlrlJQ2 B8kaN/oPr33dKBZ3AumE5Uw+0ikiiMsCDMKXHW3X0V3SGqccp912wrHSJfnstR0N8ucG /Db8jIKjprEav7jm4uhrOsqsY57lL2Tn6cS6nIBuJel5/bQqir6fr4MW+52r8Y9+yh/w eA== 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, 26 Jun 2019 15:39:48 +0300 Message-Id: <20190626123948.10199-9-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190626123948.10199-1-shmuel.eiderman@oracle.com> References: <20190626123948.10199-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260150 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 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-1906260151 Message-ID-Hash: ACPGYY3KZ4M7OOJHPFJSWFW4FPQZU45Q X-Message-ID-Hash: ACPGYY3KZ4M7OOJHPFJSWFW4FPQZU45Q X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; 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 v5 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 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 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 Acked-by: Max Reitz Reviewed-by: Gerd Hoffmann --- tests/Makefile.include | 2 +- tests/hd-geo-test.c | 582 +++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 583 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..002f5c4a43 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,568 @@ 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; +} + +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 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; + + read_fw_cfg_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[]) +{ + 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 +980,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 --=20 2.13.3 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org