From nobody Mon Apr 29 12:02:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1605698428; cv=none; d=zohomail.com; s=zohoarc; b=a5S+ZTAOMK1bfJbMjFaNBlMFdS7vmV530u6Xi2YuEmpVE2QJ0EdCKPzKkBdVrTFaDSdwK0qq15StlqsiU5LA1DpHy+ZCkhYi9Tzgdx24wl13u/Qf4xEwiVARYxWuhrsCwW/xnn7cEPY5Lj4mQ44gWKytoXe2Gj+AOAiTWApnqDs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605698428; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=E7vxjF6WrMAp3BHX6RDS7wb6ILV+54/MikaOkQrWRvQ=; b=FlZVlbBnkpxiOiSZIpjBZcwuZlvYxOVrxtgXNMSYDIpNG1jkS4jvfWbGcSJr3xIT2BteT3dAlvcAtCsVSLggVM7St1eSOw6R11W4a8VzAvuPyneIDq8SL8ZWM8RODUVybSeMl2iQzt5JzrM0BPoIfSUHVGCkKoD0O3jacihfbdY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 160569842818454.858376297776545; Wed, 18 Nov 2020 03:20:28 -0800 (PST) Received: from localhost ([::1]:38910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kfLVj-0001yw-4J for importer@patchew.org; Wed, 18 Nov 2020 06:20:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kfLU0-000076-3Y; Wed, 18 Nov 2020 06:18:40 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:35644) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kfLTv-0002xV-4K; Wed, 18 Nov 2020 06:18:39 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AIBELG8114374; Wed, 18 Nov 2020 11:18:25 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 34t4raynvt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 18 Nov 2020 11:18:25 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AIBFdWb110882; Wed, 18 Nov 2020 11:18:25 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 34uspun9k2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Nov 2020 11:18:25 +0000 Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0AIBINsj003388; Wed, 18 Nov 2020 11:18:24 GMT Received: from disaster-area.hh.sledj.net (/81.187.26.238) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 18 Nov 2020 03:18:23 -0800 Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 2b2a99bd; Wed, 18 Nov 2020 11:18:19 +0000 (UTC) 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 : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=E7vxjF6WrMAp3BHX6RDS7wb6ILV+54/MikaOkQrWRvQ=; b=fs551iGZ1FKamv52J4Q9kZqPHDcblYbZKrFQz/LB8bM7pG8Tpp4LvDViIAzQUDcYnBhH PzE7CqIgvwRxga9CB0WLssZxlj5qiiHjaCpUwwpDkklBaElbkW0XIZyCRgF2IwkjJ4D7 sM0lhGjbotlFRKL8c/tkAb2Y8boA31NMxa2zdVTJWFspCFlbCmP9QCl26rlP0iJYvSy3 /pUG1JHXQGvZaU8X51FQsGDQKJ7Wq7L7hbkeqry2Fzf1LFQ4DptVzKQYLsod+XePeZ8T Vz6r4mIlGMASfv/dQX+8VfzrLpDYqJN4GtHT4+9n0aOBfSg4dn3mlVw8HgDXevAvkVFI 4g== From: David Edmondson To: qemu-devel@nongnu.org Subject: [PATCH v2 1/5] hw/block: blk_check_size_and_read_all should report backend name Date: Wed, 18 Nov 2020 11:18:15 +0000 Message-Id: <20201118111819.4588-2-david.edmondson@oracle.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201118111819.4588-1-david.edmondson@oracle.com> References: <20201118111819.4588-1-david.edmondson@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9808 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 mlxscore=0 bulkscore=0 suspectscore=1 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011180079 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9808 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 clxscore=1015 malwarescore=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 mlxlogscore=999 adultscore=0 phishscore=0 suspectscore=1 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011180079 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=141.146.126.79; envelope-from=david.edmondson@oracle.com; helo=aserp2130.oracle.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/18 06:18:29 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-block@nongnu.org, "Michael S. Tsirkin" , Max Reitz , David Edmondson , Shannon Zhao , qemu-arm@nongnu.org, Igor Mammedov , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" If there are problems examining or reading data from the block backend, the error messages should include an appropriate identifier to assist in diagnoses. Signed-off-by: David Edmondson --- hw/block/block.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/block/block.c b/hw/block/block.c index 1e34573da7..5fa0f352e3 100644 --- a/hw/block/block.c +++ b/hw/block/block.c @@ -20,9 +20,6 @@ * BDRV_REQUEST_MAX_BYTES. * On success, return true. * On failure, store an error through @errp and return false. - * Note that the error messages do not identify the block backend. - * TODO Since callers don't either, this can result in confusing - * errors. * This function not intended for actual block devices, which read on * demand. It's for things like memory devices that (ab)use a block * backend to provide persistence. @@ -32,17 +29,19 @@ bool blk_check_size_and_read_all(BlockBackend *blk, voi= d *buf, hwaddr size, { int64_t blk_len; int ret; + const char *name =3D blk_name(blk); =20 blk_len =3D blk_getlength(blk); if (blk_len < 0) { error_setg_errno(errp, -blk_len, - "can't get size of block backend"); + "can't get size of block backend '%s'", + name); return false; } if (blk_len !=3D size) { error_setg(errp, "device requires %" HWADDR_PRIu " bytes, " - "block backend provides %" PRIu64 " bytes", - size, blk_len); + "block backend '%s' provides %" PRIu64 " bytes", + size, name, blk_len); return false; } =20 @@ -55,7 +54,8 @@ bool blk_check_size_and_read_all(BlockBackend *blk, void = *buf, hwaddr size, assert(size <=3D BDRV_REQUEST_MAX_BYTES); ret =3D blk_pread(blk, 0, buf, size); if (ret < 0) { - error_setg_errno(errp, -ret, "can't read block backend"); + error_setg_errno(errp, -ret, "can't read block backend '%s'", + name); return false; } return true; --=20 2.29.2 From nobody Mon Apr 29 12:02:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1605698614; cv=none; d=zohomail.com; s=zohoarc; b=Uv7Dy6Noo6hD65EShX+IpiiqrrzW1XPJGq1V1jsYhauUYnjF5KB7EwHF1brIrLrydwRmJaBL4sguUBCmA5i3JsArP1jKYPRHVeuiJo4kubpmygWviETZByd/j4vdT5aA16cWIGMBxSHhECuhSL5bl46D1LFQS8+WbTtdReyeu9Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605698614; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=06UD4IipE8zFWX6hce0WqlRmuIcYrUN59Q3b6eed6To=; b=gF5yz0YYS7bhfseOzu1nVulAYNQbEG4iGkzlJxmJAdthiFYqXXN91Jy0bhKljb48kosHk7MnHOT24DapZ09u4MIzrXBCqSnJMwPE2Rnudb9KnCLR6ncISxTTtOorH6+Wj1Qdj4Ma1ZswlXTylNv7TlVWkCmC+SDSSCBwOdppLys= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16056986143251012.5691791007239; Wed, 18 Nov 2020 03:23:34 -0800 (PST) Received: from localhost ([::1]:47016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kfLYj-0005SO-63 for importer@patchew.org; Wed, 18 Nov 2020 06:23:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35922) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kfLU3-0000EP-DT; Wed, 18 Nov 2020 06:18:43 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:49764) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kfLTv-0002xX-5P; Wed, 18 Nov 2020 06:18:43 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AIBDe6G168729; Wed, 18 Nov 2020 11:18:27 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 34t7vn7g42-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 18 Nov 2020 11:18:26 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AIBFOeZ136147; Wed, 18 Nov 2020 11:18:26 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 34umd0f4hg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Nov 2020 11:18:26 +0000 Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0AIBIPuf003392; Wed, 18 Nov 2020 11:18:25 GMT Received: from disaster-area.hh.sledj.net (/81.187.26.238) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 18 Nov 2020 03:18:25 -0800 Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 61aaad1d; Wed, 18 Nov 2020 11:18:19 +0000 (UTC) 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 : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=06UD4IipE8zFWX6hce0WqlRmuIcYrUN59Q3b6eed6To=; b=VTbm5gsPW++paC1OIUKk2TKZbA1y0hsNIlSZqXPQSNgSvEI549RB7YiUYO3FKwg/UgwO 6QtzGqwGIj3FTQGXVnIFCDYkjfqwsz4ghG49B3Q3WYGMfkz9lfQQ9efAV6upsMvXbElF Fq2evCKaxJswuOPQRhHDCG7HY/wwEFmz+og0ckxe8RsBaWrkvP/Ipcbr5Coy/lx3hSsu hleRRdSOX4tNOvnVajQ8pPR27EUYthuS3vMWrNHYtqXx61cCtwbBp1H5jR38kYCgoTjw ma03ZFyom8MNd9GQsmz0VA1p4Y2+q1ugSA9VWXVqKiXBMCr2zrcLi6JnHIdai1HFPVCT YA== From: David Edmondson To: qemu-devel@nongnu.org Subject: [PATCH v2 2/5] hw/block: Flash images can be smaller than the device Date: Wed, 18 Nov 2020 11:18:16 +0000 Message-Id: <20201118111819.4588-3-david.edmondson@oracle.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201118111819.4588-1-david.edmondson@oracle.com> References: <20201118111819.4588-1-david.edmondson@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9808 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 mlxscore=0 phishscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011180079 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9808 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=1 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 adultscore=0 mlxscore=0 priorityscore=1501 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011180079 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=156.151.31.85; envelope-from=david.edmondson@oracle.com; helo=userp2120.oracle.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/18 06:18:29 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-block@nongnu.org, "Michael S. Tsirkin" , Max Reitz , David Edmondson , Shannon Zhao , qemu-arm@nongnu.org, Igor Mammedov , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" When loading a flash image into a device, allow the image to be smaller than the extent of the device. Signed-off-by: David Edmondson --- hw/block/block.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/block/block.c b/hw/block/block.c index 5fa0f352e3..8512d752c3 100644 --- a/hw/block/block.c +++ b/hw/block/block.c @@ -16,8 +16,8 @@ =20 /* * Read the entire contents of @blk into @buf. - * @blk's contents must be @size bytes, and @size must be at most - * BDRV_REQUEST_MAX_BYTES. + * @blk's contents must not be more than @size bytes, and must be at + * most BDRV_REQUEST_MAX_BYTES in length. * On success, return true. * On failure, store an error through @errp and return false. * This function not intended for actual block devices, which read on @@ -38,10 +38,10 @@ bool blk_check_size_and_read_all(BlockBackend *blk, voi= d *buf, hwaddr size, name); return false; } - if (blk_len !=3D size) { - error_setg(errp, "device requires %" HWADDR_PRIu " bytes, " - "block backend '%s' provides %" PRIu64 " bytes", - size, name, blk_len); + if (blk_len > size) { + error_setg(errp, "block backend '%s' is too large for device " + "(%" PRIu64 " > %" HWADDR_PRIu ")", + name, blk_len, size); return false; } =20 @@ -51,8 +51,8 @@ bool blk_check_size_and_read_all(BlockBackend *blk, void = *buf, hwaddr size, * should probably rework the device to be more like an actual * block device and read only on demand. */ - assert(size <=3D BDRV_REQUEST_MAX_BYTES); - ret =3D blk_pread(blk, 0, buf, size); + assert(blk_len <=3D BDRV_REQUEST_MAX_BYTES); + ret =3D blk_pread(blk, 0, buf, blk_len); if (ret < 0) { error_setg_errno(errp, -ret, "can't read block backend '%s'", name); --=20 2.29.2 From nobody Mon Apr 29 12:02:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1605698433; cv=none; d=zohomail.com; s=zohoarc; b=bDhAINUni7+cxrt5xfAbbZD9rXud1+vcnTqBnDUW/MBq9Rmsf9G6B0mXfhZEkmOuUerSj+yGqW7I9yLeJs61jbotLMCm12NwI3w21sXxPaWWIAVhC8kmzOommU8EfxLV9MoOqYnebJOiD5k49AKN6/vVFv9nKVE768R/wiBdvEI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605698433; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mOZRb0TVML8lkdBIwyyuKUfuQFNr/qyPHyqy5IashS8=; b=gqUNv1yvwSVYYEZBGIMjckoFeL6kdV1tLyggeaa9VbzxAlwwc0ojlbWfnqoQfah9gA1g/M5csS3PJ+l+4bLst8OgLrOrf/HM7lIdBSN78c+8DegzvxP3z9TboSIfbsDI4AlUueukJQABsLRrjwTSn2tVVrI6TTs9jlebxgqGQrs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1605698433970355.3905315873194; Wed, 18 Nov 2020 03:20:33 -0800 (PST) Received: from localhost ([::1]:39444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kfLVo-0002CD-Ti for importer@patchew.org; Wed, 18 Nov 2020 06:20:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35918) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kfLU2-0000AD-1e; Wed, 18 Nov 2020 06:18:42 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:35682) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kfLTv-0002xc-5R; Wed, 18 Nov 2020 06:18:41 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AIBEN9k116758; Wed, 18 Nov 2020 11:18:28 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 34t4raynvy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 18 Nov 2020 11:18:28 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AIBFdJU110868; Wed, 18 Nov 2020 11:18:28 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 34uspun9m6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Nov 2020 11:18:27 +0000 Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 0AIBIRt5026213; Wed, 18 Nov 2020 11:18:27 GMT Received: from disaster-area.hh.sledj.net (/81.187.26.238) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 18 Nov 2020 03:18:26 -0800 Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 7ef66c49; Wed, 18 Nov 2020 11:18:19 +0000 (UTC) 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 : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=mOZRb0TVML8lkdBIwyyuKUfuQFNr/qyPHyqy5IashS8=; b=XLBbMbQOkqnsUzaypygiNOspyvHcQUYwXoYfQ/OV/XHuiWaF0hSUbh5E7kWSYPiy6ztS OKo8Q3ia7cCspfGyb5NCB/t6JagM5mw4Y8DPdGoDnCvNNglGenXzCm2VpnlsB0HZSuR0 WoZ4+88SP2ZpCrXGLzYUdA+LWu7NFctjx4Jo/19vaqwJSOZEmvq6f5xhaq3FNjcPmfvf BHbEB8CwN8XwYxZFup2Y3vWDD14PBGgqFrEA+w7aelWIflUISq2XQwr4FwMIeGc3cHuD 1KTjGXW4r+6H0L2hmBKSCeh4YxBoBXINlfV1vK2NCfndaYdjMdVMuAlmlGRHMQB5c8Ac CQ== From: David Edmondson To: qemu-devel@nongnu.org Subject: [PATCH v2 3/5] hw/arm: Convert assertions about flash image size to error_report Date: Wed, 18 Nov 2020 11:18:17 +0000 Message-Id: <20201118111819.4588-4-david.edmondson@oracle.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201118111819.4588-1-david.edmondson@oracle.com> References: <20201118111819.4588-1-david.edmondson@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9808 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 mlxscore=0 bulkscore=0 suspectscore=1 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011180079 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9808 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 clxscore=1015 malwarescore=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 mlxlogscore=999 adultscore=0 phishscore=0 suspectscore=1 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011180079 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=141.146.126.79; envelope-from=david.edmondson@oracle.com; helo=aserp2130.oracle.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/18 06:18:29 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-block@nongnu.org, "Michael S. Tsirkin" , Max Reitz , David Edmondson , Shannon Zhao , qemu-arm@nongnu.org, Igor Mammedov , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Rather than throwing an assertion, provide a more detailed report if a flash image is inappropriately sized or aligned. Signed-off-by: David Edmondson --- hw/arm/virt.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 27dbeb549e..2ba83dd18b 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -967,9 +967,21 @@ static void virt_flash_map1(PFlashCFI01 *flash, MemoryRegion *sysmem) { DeviceState *dev =3D DEVICE(flash); + const char *name =3D blk_name(pflash_cfi01_get_blk(flash)); + + if (size =3D=3D 0 || !QEMU_IS_ALIGNED(size, VIRT_FLASH_SECTOR_SIZE)) { + error_report("system firmware block device '%s' has invalid size " + "%" PRId64, name, size); + info_report("its size must be a non-zero multiple of 0x%" PRIx64, + VIRT_FLASH_SECTOR_SIZE); + exit(1); + } + if (!(size / VIRT_FLASH_SECTOR_SIZE <=3D UINT32_MAX)) { + error_report("system firmware block device '%s' is too large " + "(%" PRId64 ")", name, size); + exit(1); + } =20 - assert(QEMU_IS_ALIGNED(size, VIRT_FLASH_SECTOR_SIZE)); - assert(size / VIRT_FLASH_SECTOR_SIZE <=3D UINT32_MAX); qdev_prop_set_uint32(dev, "num-blocks", size / VIRT_FLASH_SECTOR_SIZE); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); =20 --=20 2.29.2 From nobody Mon Apr 29 12:02:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1605698649; cv=none; d=zohomail.com; s=zohoarc; b=luSDqnPHUJgQd6pKSoDYaLUKTnaTYyunl/5C1y3tA2Xa0edQHg+wdZYLu+QF891sQsUmK6kQkcqbnraVY7C1VrUJ5qm0XTEXxiQd7kIQ87daEDKVJYFepeK1QZqBkkXkbTNOEbm+EPHNeYNhyz1wQ8G8fU1/60rGR70WJjBrGyg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605698649; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BbZcOdhFM6PWqbr6Ydix0JEr2aJItr+U3Llaz47kzUw=; b=ZvwHRJXooFiZsWbFUO6mrI0gp95YJTWvymKO+bqPaxwOlX2+rLZagXOkL+h9htkKmHSiFIF1vDL4fQS5e2+40TcwzOptR2XkCUTqXaCoghv5kQ/ZybOJFuB4Ax0ge9ms4hiUErrCq8bQmJSqOC8mM8NNrKigRLc2iZD0bQMEwto= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1605698649721730.7847249498194; Wed, 18 Nov 2020 03:24:09 -0800 (PST) Received: from localhost ([::1]:49696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kfLZI-0006XI-Fn for importer@patchew.org; Wed, 18 Nov 2020 06:24:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36202) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kfLVs-0002oe-VH; Wed, 18 Nov 2020 06:20:36 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:51266) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kfLVq-0003BZ-CK; Wed, 18 Nov 2020 06:20:36 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AIBDmcs168772; Wed, 18 Nov 2020 11:20:30 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 34t7vn7gct-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 18 Nov 2020 11:20:29 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AIBFNV5135904; Wed, 18 Nov 2020 11:18:29 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 34umd0f4jr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Nov 2020 11:18:28 +0000 Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 0AIBIRDa005413; Wed, 18 Nov 2020 11:18:27 GMT Received: from disaster-area.hh.sledj.net (/81.187.26.238) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 18 Nov 2020 03:18:27 -0800 Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 171e7f29; Wed, 18 Nov 2020 11:18:19 +0000 (UTC) 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 : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=BbZcOdhFM6PWqbr6Ydix0JEr2aJItr+U3Llaz47kzUw=; b=treU/rdhF1ElXOKP5AvdqTC/5EOe60yYy5byL/neXvOyog7ulotoHDSLPMtD/c1NsoG7 mvRGT7zPJ0Ccv5fTpAopLvEubsFprtgJb7FCPt4ag42CeU2SDWMWWo4a4cAISXL+HVqP CVGoOosjqOEF4IalOGJ5hz9/ofv4HN6GJneHhb+5W7t2drfZ0MvWphWqOXPzljA2UgN5 P4AeYKrGAdTI4GnYN3OHoI0g8QtyI2WK1AS+rc+Mkvyu8neu/UzX7x7UASkTPMh4drrC 8tiA5XOAwz4RV8Kg+CrvlDMIL6kq3vVEFp4+qVf/2OB+lrhPqVxEn3yD5O+GlCrAqMQx xA== From: David Edmondson To: qemu-devel@nongnu.org Subject: [PATCH v2 4/5] hw/arm: Flash image mapping follows image size Date: Wed, 18 Nov 2020 11:18:18 +0000 Message-Id: <20201118111819.4588-5-david.edmondson@oracle.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201118111819.4588-1-david.edmondson@oracle.com> References: <20201118111819.4588-1-david.edmondson@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9808 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 mlxscore=0 phishscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011180079 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9808 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=3 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 adultscore=0 mlxscore=0 priorityscore=1501 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011180079 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=156.151.31.85; envelope-from=david.edmondson@oracle.com; helo=userp2120.oracle.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/18 06:18:29 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-block@nongnu.org, "Michael S. Tsirkin" , Max Reitz , David Edmondson , Shannon Zhao , qemu-arm@nongnu.org, Igor Mammedov , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" When mapping flash images into the bottom 128MB, create mappings that match the size of the underlying block device rather than 64MB. Signed-off-by: David Edmondson --- hw/arm/trace-events | 2 + hw/arm/virt-acpi-build.c | 29 ++++++++------- hw/arm/virt.c | 79 +++++++++++++++++++++------------------- include/hw/arm/virt.h | 1 + 4 files changed, 60 insertions(+), 51 deletions(-) diff --git a/hw/arm/trace-events b/hw/arm/trace-events index a335ee891d..a9174f8fba 100644 --- a/hw/arm/trace-events +++ b/hw/arm/trace-events @@ -53,3 +53,5 @@ smmuv3_notify_flag_add(const char *iommu) "ADD SMMUNotifi= er node for iommu mr=3D%s smmuv3_notify_flag_del(const char *iommu) "DEL SMMUNotifier node for iommu= mr=3D%s" smmuv3_inv_notifiers_iova(const char *name, uint16_t asid, uint64_t iova, = uint8_t tg, uint64_t num_pages) "iommu mr=3D%s asid=3D%d iova=3D0x%"PRIx64"= tg=3D%d num_pages=3D0x%"PRIx64 =20 +# virt.c +virt_flash_map1(const char *name, uint64_t base, uint64_t size) "map %s at= 0x%"PRIx64" + 0x%"PRIx64 diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 9747a6458f..2c08d36624 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -102,28 +102,31 @@ static void acpi_dsdt_add_fw_cfg(Aml *scope, const Me= mMapEntry *fw_cfg_memmap) aml_append(scope, dev); } =20 -static void acpi_dsdt_add_flash(Aml *scope, const MemMapEntry *flash_memma= p) +static void acpi_dsdt_add_flash1(Aml *scope, int index, + hwaddr base, hwaddr size) { Aml *dev, *crs; - hwaddr base =3D flash_memmap->base; - hwaddr size =3D flash_memmap->size / 2; =20 - dev =3D aml_device("FLS0"); + dev =3D aml_device("FLS%u", index); aml_append(dev, aml_name_decl("_HID", aml_string("LNRO0015"))); - aml_append(dev, aml_name_decl("_UID", aml_int(0))); + aml_append(dev, aml_name_decl("_UID", aml_int(index))); =20 crs =3D aml_resource_template(); aml_append(crs, aml_memory32_fixed(base, size, AML_READ_WRITE)); aml_append(dev, aml_name_decl("_CRS", crs)); aml_append(scope, dev); +} =20 - dev =3D aml_device("FLS1"); - aml_append(dev, aml_name_decl("_HID", aml_string("LNRO0015"))); - aml_append(dev, aml_name_decl("_UID", aml_int(1))); - crs =3D aml_resource_template(); - aml_append(crs, aml_memory32_fixed(base + size, size, AML_READ_WRITE)); - aml_append(dev, aml_name_decl("_CRS", crs)); - aml_append(scope, dev); +static void acpi_dsdt_add_flash(Aml *scope, const MemMapEntry *flash_memma= p, + PFlashCFI01 *flash[2]) +{ + acpi_dsdt_add_flash1(scope, 0, + flash_memmap->base, + virt_flash_size(flash[0])); + + acpi_dsdt_add_flash1(scope, 1, + flash_memmap->base + flash_memmap->size / 2, + virt_flash_size(flash[1])); } =20 static void acpi_dsdt_add_virtio(Aml *scope, @@ -603,7 +606,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, Virt= MachineState *vms) acpi_dsdt_add_uart(scope, &memmap[VIRT_UART], (irqmap[VIRT_UART] + ARM_SPI_BASE)); if (vmc->acpi_expose_flash) { - acpi_dsdt_add_flash(scope, &memmap[VIRT_FLASH]); + acpi_dsdt_add_flash(scope, &memmap[VIRT_FLASH], vms->flash); } acpi_dsdt_add_fw_cfg(scope, &memmap[VIRT_FW_CFG]); acpi_dsdt_add_virtio(scope, &memmap[VIRT_MMIO], diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 2ba83dd18b..0744a512f2 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -50,6 +50,7 @@ #include "sysemu/sysemu.h" #include "sysemu/tpm.h" #include "sysemu/kvm.h" +#include "sysemu/block-backend.h" #include "hw/loader.h" #include "exec/address-spaces.h" #include "qemu/bitops.h" @@ -78,6 +79,7 @@ #include "hw/virtio/virtio-iommu.h" #include "hw/char/pl011.h" #include "qemu/guest-random.h" +#include "trace.h" =20 #define DEFINE_VIRT_MACHINE_LATEST(major, minor, latest) \ static void virt_##major##_##minor##_class_init(ObjectClass *oc, \ @@ -931,6 +933,11 @@ static void create_virtio_devices(const VirtMachineSta= te *vms) =20 #define VIRT_FLASH_SECTOR_SIZE (256 * KiB) =20 +int64_t virt_flash_size(PFlashCFI01 *flash) +{ + return blk_getlength(pflash_cfi01_get_blk(flash)); +} + static PFlashCFI01 *virt_flash_create1(VirtMachineState *vms, const char *name, const char *alias_prop_name) @@ -969,6 +976,8 @@ static void virt_flash_map1(PFlashCFI01 *flash, DeviceState *dev =3D DEVICE(flash); const char *name =3D blk_name(pflash_cfi01_get_blk(flash)); =20 + trace_virt_flash_map1(name, base, size); + if (size =3D=3D 0 || !QEMU_IS_ALIGNED(size, VIRT_FLASH_SECTOR_SIZE)) { error_report("system firmware block device '%s' has invalid size " "%" PRId64, name, size); @@ -995,63 +1004,57 @@ static void virt_flash_map(VirtMachineState *vms, MemoryRegion *secure_sysmem) { /* - * Map two flash devices to fill the VIRT_FLASH space in the memmap. + * Map two flash devices in the VIRT_FLASH space in the memmap. * sysmem is the system memory space. secure_sysmem is the secure view * of the system, and the first flash device should be made visible on= ly * there. The second flash device is visible to both secure and nonsec= ure. * If sysmem =3D=3D secure_sysmem this means there is no separate Secu= re * address space and both flash devices are generally visible. */ - hwaddr flashsize =3D vms->memmap[VIRT_FLASH].size / 2; - hwaddr flashbase =3D vms->memmap[VIRT_FLASH].base; + MemMapEntry *m =3D &vms->memmap[VIRT_FLASH]; =20 - virt_flash_map1(vms->flash[0], flashbase, flashsize, - secure_sysmem); - virt_flash_map1(vms->flash[1], flashbase + flashsize, flashsize, - sysmem); + virt_flash_map1(vms->flash[0], m->base, + virt_flash_size(vms->flash[0]), secure_sysmem); + + virt_flash_map1(vms->flash[1], m->base + m->size / 2, + virt_flash_size(vms->flash[1]), sysmem); } =20 static void virt_flash_fdt(VirtMachineState *vms, MemoryRegion *sysmem, MemoryRegion *secure_sysmem) { - hwaddr flashsize =3D vms->memmap[VIRT_FLASH].size / 2; - hwaddr flashbase =3D vms->memmap[VIRT_FLASH].base; + bool secure =3D sysmem !=3D secure_sysmem; + MemMapEntry *m =3D &vms->memmap[VIRT_FLASH]; + hwaddr flashbase0 =3D m->base; + hwaddr flashbase1 =3D m->base + m->size / 2; + hwaddr flashsize0 =3D virt_flash_size(vms->flash[0]); + hwaddr flashsize1 =3D virt_flash_size(vms->flash[1]); char *nodename; =20 - if (sysmem =3D=3D secure_sysmem) { - /* Report both flash devices as a single node in the DT */ - nodename =3D g_strdup_printf("/flash@%" PRIx64, flashbase); - qemu_fdt_add_subnode(vms->fdt, nodename); - qemu_fdt_setprop_string(vms->fdt, nodename, "compatible", "cfi-fla= sh"); - qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg", - 2, flashbase, 2, flashsize, - 2, flashbase + flashsize, 2, flashsiz= e); - qemu_fdt_setprop_cell(vms->fdt, nodename, "bank-width", 4); - g_free(nodename); + if (secure) { + nodename =3D g_strdup_printf("/secflash@%" PRIx64, flashbase0); } else { - /* - * Report the devices as separate nodes so we can mark one as - * only visible to the secure world. - */ - nodename =3D g_strdup_printf("/secflash@%" PRIx64, flashbase); - qemu_fdt_add_subnode(vms->fdt, nodename); - qemu_fdt_setprop_string(vms->fdt, nodename, "compatible", "cfi-fla= sh"); - qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg", - 2, flashbase, 2, flashsize); - qemu_fdt_setprop_cell(vms->fdt, nodename, "bank-width", 4); + nodename =3D g_strdup_printf("/flash@%" PRIx64, flashbase0); + } + qemu_fdt_add_subnode(vms->fdt, nodename); + qemu_fdt_setprop_string(vms->fdt, nodename, "compatible", "cfi-flash"); + qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg", + 2, flashbase0, 2, flashsize0); + qemu_fdt_setprop_cell(vms->fdt, nodename, "bank-width", 4); + if (secure) { qemu_fdt_setprop_string(vms->fdt, nodename, "status", "disabled"); qemu_fdt_setprop_string(vms->fdt, nodename, "secure-status", "okay= "); - g_free(nodename); - - nodename =3D g_strdup_printf("/flash@%" PRIx64, flashbase); - qemu_fdt_add_subnode(vms->fdt, nodename); - qemu_fdt_setprop_string(vms->fdt, nodename, "compatible", "cfi-fla= sh"); - qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg", - 2, flashbase + flashsize, 2, flashsiz= e); - qemu_fdt_setprop_cell(vms->fdt, nodename, "bank-width", 4); - g_free(nodename); } + g_free(nodename); + + nodename =3D g_strdup_printf("/flash@%" PRIx64, flashbase1); + qemu_fdt_add_subnode(vms->fdt, nodename); + qemu_fdt_setprop_string(vms->fdt, nodename, "compatible", "cfi-flash"); + qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg", + 2, flashbase1, 2, flashsize1); + qemu_fdt_setprop_cell(vms->fdt, nodename, "bank-width", 4); + g_free(nodename); } =20 static bool virt_firmware_init(VirtMachineState *vms, diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index aad6d69841..ee21d691ea 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -172,6 +172,7 @@ OBJECT_DECLARE_TYPE(VirtMachineState, VirtMachineClass,= VIRT_MACHINE) =20 void virt_acpi_setup(VirtMachineState *vms); bool virt_is_acpi_enabled(VirtMachineState *vms); +int64_t virt_flash_size(PFlashCFI01 *flash); =20 /* Return the number of used redistributor regions */ static inline int virt_gicv3_redist_region_count(VirtMachineState *vms) --=20 2.29.2 From nobody Mon Apr 29 12:02:59 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1605698418; cv=none; d=zohomail.com; s=zohoarc; b=ma7b2fck4UxjzklhvJEYuxVPBlhJsMumvOf54HBNhsirmwYCnef+FLzn4LWZAgNHV7FG8CavQOCxHa6+9Ewg91mbes8WMfGedKvS6qiyURDV0XN+zJBt8L0STO7pyFujE3xuI5h3rGUu0uCRBaf/ZBpukLVEUYareX062Koc+Ds= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605698418; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ng8oSMkG5tH2O/pKjw9WzZZE2q7ts1JlGcPvAyqm/3E=; b=UpcHMNZbbAZbx7IIuz9jkXhJZaolDG1iF0IF2jph6vLfj6tmUAjCeM7JUFJ/H2TRMwrpTJYR7QquVbBhsc7aVXuCICDaZa+3SRwKiKdHHoc/6cVEUwJu6crH34SR94AodU+KheRaKtbT5wI6ZBL5Vjsd2W6I70xWcqjfyiHBwwU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1605698418598293.8904169627467; Wed, 18 Nov 2020 03:20:18 -0800 (PST) Received: from localhost ([::1]:38172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kfLVZ-0001f3-Ay for importer@patchew.org; Wed, 18 Nov 2020 06:20:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35900) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kfLU0-00007m-Hp; Wed, 18 Nov 2020 06:18:40 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:52802) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kfLTv-0002xn-6p; Wed, 18 Nov 2020 06:18:40 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AIBEGt5026703; Wed, 18 Nov 2020 11:18:31 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 34t76kyhu2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 18 Nov 2020 11:18:31 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AIBFWan104538; Wed, 18 Nov 2020 11:18:30 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 34ts0s6cgv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Nov 2020 11:18:30 +0000 Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 0AIBISRd026228; Wed, 18 Nov 2020 11:18:28 GMT Received: from disaster-area.hh.sledj.net (/81.187.26.238) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 18 Nov 2020 03:18:28 -0800 Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 0f2c299a; Wed, 18 Nov 2020 11:18:19 +0000 (UTC) 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 : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=ng8oSMkG5tH2O/pKjw9WzZZE2q7ts1JlGcPvAyqm/3E=; b=x/3ENjELiWudHjdItTO5W9+qxCGOwkc4kQs2qYaJtwxQ6dRvvRqdIjM+9iX21AM6ONrf tLaA396ktafsmLzEXE9n6xBFYqjoqWfDBrIvu/tIm/CylJNoZ+0I5xdSc4Atrc7CDG65 g98Z/5Sr3jWgu/GZVishXxOxaXHaQvNng3aoy4MA7i50R2kdLrT6/ciAF6+JJMlhCPSZ eBVXFQBDauZs04nrDykUgZuLryT3QZZc4qD3YNq66pcAagn0EuOxq0S9olfkLv8uih6X hCUm/TkeKLYysH2Ikt8eER7p0k7gD/lVQxUdssmkoTovAlumf7yMa3NTlLC7svCOxYVC 1w== From: David Edmondson To: qemu-devel@nongnu.org Subject: [PATCH v2 5/5] hw/arm: Only minimise flash size on older machines Date: Wed, 18 Nov 2020 11:18:19 +0000 Message-Id: <20201118111819.4588-6-david.edmondson@oracle.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201118111819.4588-1-david.edmondson@oracle.com> References: <20201118111819.4588-1-david.edmondson@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9808 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 bulkscore=0 suspectscore=3 spamscore=0 malwarescore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011180079 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9808 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 phishscore=0 adultscore=0 priorityscore=1501 bulkscore=0 clxscore=1015 mlxlogscore=999 malwarescore=0 mlxscore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011180079 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=141.146.126.78; envelope-from=david.edmondson@oracle.com; helo=aserp2120.oracle.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/18 06:18:27 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-block@nongnu.org, "Michael S. Tsirkin" , Max Reitz , David Edmondson , Shannon Zhao , qemu-arm@nongnu.org, Igor Mammedov , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Prior to 5.2 the flash images loaded into the bottom 128MB always filled the region. Ensure that this continues to be the case. Signed-off-by: David Edmondson --- hw/arm/virt-acpi-build.c | 11 +++--- hw/arm/virt.c | 79 ++++++++++++++++++++++++++-------------- include/hw/arm/virt.h | 3 +- 3 files changed, 60 insertions(+), 33 deletions(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 2c08d36624..6e3d72a9e9 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -117,16 +117,17 @@ static void acpi_dsdt_add_flash1(Aml *scope, int inde= x, aml_append(scope, dev); } =20 -static void acpi_dsdt_add_flash(Aml *scope, const MemMapEntry *flash_memma= p, - PFlashCFI01 *flash[2]) +static void acpi_dsdt_add_flash(Aml *scope, VirtMachineState *vms) { + MemMapEntry *flash_memmap =3D &vms->memmap[VIRT_FLASH]; + acpi_dsdt_add_flash1(scope, 0, flash_memmap->base, - virt_flash_size(flash[0])); + virt_flash_size(vms, vms->flash[0])); =20 acpi_dsdt_add_flash1(scope, 1, flash_memmap->base + flash_memmap->size / 2, - virt_flash_size(flash[1])); + virt_flash_size(vms, vms->flash[1])); } =20 static void acpi_dsdt_add_virtio(Aml *scope, @@ -606,7 +607,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, Virt= MachineState *vms) acpi_dsdt_add_uart(scope, &memmap[VIRT_UART], (irqmap[VIRT_UART] + ARM_SPI_BASE)); if (vmc->acpi_expose_flash) { - acpi_dsdt_add_flash(scope, &memmap[VIRT_FLASH], vms->flash); + acpi_dsdt_add_flash(scope, vms); } acpi_dsdt_add_fw_cfg(scope, &memmap[VIRT_FW_CFG]); acpi_dsdt_add_virtio(scope, &memmap[VIRT_MMIO], diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 0744a512f2..88495c1fb4 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -933,9 +933,15 @@ static void create_virtio_devices(const VirtMachineSta= te *vms) =20 #define VIRT_FLASH_SECTOR_SIZE (256 * KiB) =20 -int64_t virt_flash_size(PFlashCFI01 *flash) +int64_t virt_flash_size(VirtMachineState *vms, PFlashCFI01 *flash) { - return blk_getlength(pflash_cfi01_get_blk(flash)); + VirtMachineClass *vmc =3D VIRT_MACHINE_GET_CLASS(vms); + + if (vmc->maximize_flash_size) { + return vms->memmap[VIRT_FLASH].size / 2; + } else { + return blk_getlength(pflash_cfi01_get_blk(flash)); + } } =20 static PFlashCFI01 *virt_flash_create1(VirtMachineState *vms, @@ -1014,47 +1020,65 @@ static void virt_flash_map(VirtMachineState *vms, MemMapEntry *m =3D &vms->memmap[VIRT_FLASH]; =20 virt_flash_map1(vms->flash[0], m->base, - virt_flash_size(vms->flash[0]), secure_sysmem); + virt_flash_size(vms, vms->flash[0]), secure_sysmem); =20 virt_flash_map1(vms->flash[1], m->base + m->size / 2, - virt_flash_size(vms->flash[1]), sysmem); + virt_flash_size(vms, vms->flash[1]), sysmem); } =20 static void virt_flash_fdt(VirtMachineState *vms, MemoryRegion *sysmem, MemoryRegion *secure_sysmem) { + VirtMachineClass *vmc =3D VIRT_MACHINE_GET_CLASS(vms); bool secure =3D sysmem !=3D secure_sysmem; MemMapEntry *m =3D &vms->memmap[VIRT_FLASH]; hwaddr flashbase0 =3D m->base; hwaddr flashbase1 =3D m->base + m->size / 2; - hwaddr flashsize0 =3D virt_flash_size(vms->flash[0]); - hwaddr flashsize1 =3D virt_flash_size(vms->flash[1]); + hwaddr flashsize0 =3D virt_flash_size(vms, vms->flash[0]); + hwaddr flashsize1 =3D virt_flash_size(vms, vms->flash[1]); char *nodename; =20 - if (secure) { - nodename =3D g_strdup_printf("/secflash@%" PRIx64, flashbase0); - } else { + if (vmc->maximize_flash_size && !secure) { + /* Report both flash devices as a single node in the DT */ nodename =3D g_strdup_printf("/flash@%" PRIx64, flashbase0); - } - qemu_fdt_add_subnode(vms->fdt, nodename); - qemu_fdt_setprop_string(vms->fdt, nodename, "compatible", "cfi-flash"); - qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg", - 2, flashbase0, 2, flashsize0); - qemu_fdt_setprop_cell(vms->fdt, nodename, "bank-width", 4); - if (secure) { - qemu_fdt_setprop_string(vms->fdt, nodename, "status", "disabled"); - qemu_fdt_setprop_string(vms->fdt, nodename, "secure-status", "okay= "); - } - g_free(nodename); + qemu_fdt_add_subnode(vms->fdt, nodename); + qemu_fdt_setprop_string(vms->fdt, nodename, "compatible", "cfi-fla= sh"); + qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg", + 2, flashbase0, 2, flashsize0, + 2, flashbase1, 2, flashsize1); + qemu_fdt_setprop_cell(vms->fdt, nodename, "bank-width", 4); + g_free(nodename); + } else { + /* + * If we are not intending to fill the flash region or one is + * device is secure, report two distinct nodes. + */ + if (secure) { + nodename =3D g_strdup_printf("/secflash@%" PRIx64, flashbase0); + } else { + nodename =3D g_strdup_printf("/flash@%" PRIx64, flashbase0); + } + qemu_fdt_add_subnode(vms->fdt, nodename); + qemu_fdt_setprop_string(vms->fdt, nodename, "compatible", "cfi-fla= sh"); + qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg", + 2, flashbase0, 2, flashsize0); + qemu_fdt_setprop_cell(vms->fdt, nodename, "bank-width", 4); + if (secure) { + qemu_fdt_setprop_string(vms->fdt, nodename, "status", "disable= d"); + qemu_fdt_setprop_string(vms->fdt, nodename, + "secure-status", "okay"); + } + g_free(nodename); =20 - nodename =3D g_strdup_printf("/flash@%" PRIx64, flashbase1); - qemu_fdt_add_subnode(vms->fdt, nodename); - qemu_fdt_setprop_string(vms->fdt, nodename, "compatible", "cfi-flash"); - qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg", - 2, flashbase1, 2, flashsize1); - qemu_fdt_setprop_cell(vms->fdt, nodename, "bank-width", 4); - g_free(nodename); + nodename =3D g_strdup_printf("/flash@%" PRIx64, flashbase1); + qemu_fdt_add_subnode(vms->fdt, nodename); + qemu_fdt_setprop_string(vms->fdt, nodename, "compatible", "cfi-fla= sh"); + qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg", + 2, flashbase1, 2, flashsize1); + qemu_fdt_setprop_cell(vms->fdt, nodename, "bank-width", 4); + g_free(nodename); + } } =20 static bool virt_firmware_init(VirtMachineState *vms, @@ -2614,6 +2638,7 @@ static void virt_machine_5_1_options(MachineClass *mc) virt_machine_5_2_options(mc); compat_props_add(mc->compat_props, hw_compat_5_1, hw_compat_5_1_len); vmc->no_kvm_steal_time =3D true; + vmc->maximize_flash_size =3D true; } DEFINE_VIRT_MACHINE(5, 1) =20 diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index ee21d691ea..1135e7e165 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -127,6 +127,7 @@ struct VirtMachineClass { bool kvm_no_adjvtime; bool no_kvm_steal_time; bool acpi_expose_flash; + bool maximize_flash_size; }; =20 struct VirtMachineState { @@ -172,7 +173,7 @@ OBJECT_DECLARE_TYPE(VirtMachineState, VirtMachineClass,= VIRT_MACHINE) =20 void virt_acpi_setup(VirtMachineState *vms); bool virt_is_acpi_enabled(VirtMachineState *vms); -int64_t virt_flash_size(PFlashCFI01 *flash); +int64_t virt_flash_size(VirtMachineState *vms, PFlashCFI01 *flash); =20 /* Return the number of used redistributor regions */ static inline int virt_gicv3_redist_region_count(VirtMachineState *vms) --=20 2.29.2