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).

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.

Paolo


Reply via email to