From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6462EC433DB for ; Wed, 20 Jan 2021 10:16:51 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 80F5E2332B for ; Wed, 20 Jan 2021 10:16:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 80F5E2332B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=dme.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:58084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l2AXh-0006tq-9i for qemu-devel@archiver.kernel.org; Wed, 20 Jan 2021 05:16:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:32998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2AVM-0005vi-Dx for qemu-devel@nongnu.org; Wed, 20 Jan 2021 05:14:24 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:39285) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l2AVK-0004N4-4J for qemu-devel@nongnu.org; Wed, 20 Jan 2021 05:14:24 -0500 Received: by mail-wm1-x336.google.com with SMTP id u14so2301310wmq.4 for ; Wed, 20 Jan 2021 02:14:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dme-org.20150623.gappssmtp.com; s=20150623; h=to:cc:subject:in-reply-to:references:from:date:message-id :mime-version:content-transfer-encoding; bh=EaJLcfjZW/JBdPJrNvBrbqfW6V2JteHrYvhf782uaeE=; b=CDfz7/N6SvvT5CGRAI/V95TxiysXnlYRzddT0p7iY0v0Vppv+1o9nXbcTknEKh+0uq Y4fjr5e5Y81SpdSaxwDi+amuFdRyzwlN2Ws4VDr4o8UIzQ4ycQGflqyv4oYLg35S0WDM fsNe5tT9bPZIHK94JMact9mcwZaMbEccq8bft/1L0kjtoATxx7IfPE21/AFmhzoZw8oL uR6LwuoR9an1G7C8ea/u6VdI+CT965EGszqFyum7ON1I0ibLZdzTLX7fx37yDDa97JG/ 8ABz2C27nYMtHIL728vzBevQJyOkXN38ZVvi97TIM6XDOhZWJoWjUyJGgfC7usJ5u91v lOAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:subject:in-reply-to:references:from:date :message-id:mime-version:content-transfer-encoding; bh=EaJLcfjZW/JBdPJrNvBrbqfW6V2JteHrYvhf782uaeE=; b=pR5CnFMZCq00b5e9khNVKCj0Ae/gJn1vD9Tpv/nH2tnxF4yXIiYPIGEVL9zgKlkrm3 DRiL7cS2tmrH/B2eCKTA4XlZPycGgylcTklzdJb/OogBJZAxDnuHQVboInxcx/ZD3/mD lt/7y4wMct111ARPhXt7AiiS6Hit1qeUSj08MHk02qNI6+yWn/21I7aCd4kEtj0hOhmo JqUjxjpDnQJU3oFk5qm6bkgBCJVaoHJymby9XfN1R6niemuVHJi0W32IR1AIAFRsZOmR QOW1oiTBuBIoyDb/4vvujJD2X3Rch4r8u4YfZEJPgtVoYePuJwVdXFi8IR+gbEIJ7jPn oEiA== X-Gm-Message-State: AOAM5322fEwa75QPlH7MFsQP6xpB5rIeLeHdqPqAVwRlMx4opV2S+EnE wVby9dGHjlBB9F3ZJ4tc5MhgMin7IEZylmVgpmE= X-Google-Smtp-Source: ABdhPJybH/9vHCM2eINC/tzT0q5JL+gziBTl/uTFBl3O8EiCzGRIOu19UKxe1MMJCXKc+VVG3z5TxA== X-Received: by 2002:a1c:790f:: with SMTP id l15mr3648357wme.188.1611137659273; Wed, 20 Jan 2021 02:14:19 -0800 (PST) Received: from disaster-area.hh.sledj.net (disaster-area.hh.sledj.net. [2001:8b0:bb71:7140:64::1]) by smtp.gmail.com with ESMTPSA id q2sm3061182wma.6.2021.01.20.02.14.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jan 2021 02:14:18 -0800 (PST) Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 64febf44; Wed, 20 Jan 2021 10:14:18 +0000 (UTC) To: Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Paolo Bonzini , qemu-devel@nongnu.org, Haibin Zhang Subject: Re: [PATCH] pci: add romsize property In-Reply-To: References: <20201218182736.1634344-1-pbonzini@redhat.com> X-HGTTG: zarquon From: David Edmondson X-Now-Playing: Four Tet - Sixteen Oceans: Something in the Sadness Date: Wed, 20 Jan 2021 10:14:18 +0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: neutral client-ip=2a00:1450:4864:20::336; envelope-from=dme@dme.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NEUTRAL=0.779, UNPARSEABLE_RELAY=0.001 autolearn=no 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: Markus Armbruster , Laszlo Ersek , dgilbert@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Tuesday, 2021-01-19 at 17:51:32 +01, Philippe Mathieu-Daud=C3=A9 wrote: > +pflash > > On 12/18/20 7:27 PM, Paolo Bonzini wrote: >> This property can be useful for distros to set up known-good ROM sizes f= or >> migration purposes. The VM will fail to start if the ROM is too large, >> and migration compatibility will not be broken if the ROM is too small. >>=20 >> Signed-off-by: Paolo Bonzini >> --- >> hw/pci/pci.c | 19 +++++++++++++++++-- >> hw/xen/xen_pt_load_rom.c | 14 ++++++++++++-- >> include/hw/pci/pci.h | 1 + >> 3 files changed, 30 insertions(+), 4 deletions(-) >>=20 >> diff --git a/hw/pci/pci.c b/hw/pci/pci.c >> index d4349ea577..fd25253c2a 100644 >> --- a/hw/pci/pci.c >> +++ b/hw/pci/pci.c >> @@ -67,6 +67,7 @@ static void pcibus_reset(BusState *qbus); >> static Property pci_props[] =3D { >> DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1), >> DEFINE_PROP_STRING("romfile", PCIDevice, romfile), >> + DEFINE_PROP_UINT32("romsize", PCIDevice, romsize, -1), >> DEFINE_PROP_UINT32("rombar", PCIDevice, rom_bar, 1), >> DEFINE_PROP_BIT("multifunction", PCIDevice, cap_present, >> QEMU_PCI_CAP_MULTIFUNCTION_BITNR, false), >> @@ -2106,6 +2107,11 @@ static void pci_qdev_realize(DeviceState *qdev, E= rror **errp) >> bool is_default_rom; >> uint16_t class_id; >>=20=20 >> + if (pci_dev->romsize !=3D -1 && !is_power_of_2(pci_dev->romsize)) { >> + error_setg(errp, "ROM size %d is not a power of two", pci_dev->= romsize); >> + return; >> + } > > Some cloud providers already complained the pow2 check in the pflash > device (wasting host storage). Personally I find using pow2 easier > and safer. > > The pow2 check looks like a separate change however, maybe add in a > separate patch? Or maybe not :) Even for flash, padding a read-only device seems straightforward. For a writable device, is it assumed that a write into the padding should extend the file? (I realise that this patch is just for the ROM.) dme. --=20 You bring light in.