[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] pci: add romsize property
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH] pci: add romsize property |
Date: |
Tue, 19 Jan 2021 18:19:32 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 |
On 1/19/21 6:10 PM, Paolo Bonzini wrote:
> On 19/01/21 17:51, Philippe Mathieu-Daudé wrote:
>>> + if (pci_dev->romsize != -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.
>
> This check only applies to the value that is specified on the command
> line or in a global property, not to the file (the purpose of the
> property is exactly to override the file size, no matter if the file
> size is a power of two or not).
Doh sorry I completely misunderstood the purpose of the patch.
> Even if there is no value for the property, non-power-of-two ROMs files
> are accepted and changed into the next power of two:
>
> pdev->romsize = pow2ceil(size);
>
>> The pow2 check looks like a separate change however, maybe add in a
>> separate patch? Or maybe not:)
>
> Not a separate patch for the above reason: the check is on the
> newly-introduced property.
Obviously :)
>
> Paolo
>