On Sat, May 30, 2015 at 3:32 AM, Paolo Bonzini <pbonz...@redhat.com> wrote: > > > On 30/05/2015 11:55, Peter Crosthwaite wrote: >> I think the same is true of NOR. > > NOR is sized according to the capacity of its backing file, at least in > the PC case. >
So that might be the exception to the rule. I assume that is this (pc_sysfw.c): snprintf(name, sizeof name, "system.flash%d", unit); system_flash = pflash_cfi01_register(phys_addr, NULL /* qdev */, name, size, blk, sector_size, size >> sector_bits, 1 /* width */, 0x0000 /* id0 */, 0x0000 /* id1 */, 0x0000 /* id2 */, 0x0000 /* id3 */, 0 /* be */); This ID fields are 0'd out and a generic flash is created matching the blk dev geometry. So this does what you says it does. A bit of grepping around, there are a good number of embedded boards (ARM is heavily represented) where the board specifies the flash specifically. Here is one for versatilepb: hw/arm/versatilepb.c:#define VERSATILE_FLASH_SIZE (64 * 1024 * 1024) hw/arm/versatilepb.c: if (!pflash_cfi01_register(VERSATILE_FLASH_ADDR, NULL, "versatile.flash", hw/arm/versatilepb.c- VERSATILE_FLASH_SIZE, hw/arm/versatilepb.c- dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, hw/arm/versatilepb.c- VERSATILE_FLASH_SECT_SIZE, hw/arm/versatilepb.c- VERSATILE_FLASH_SIZE / VERSATILE_FLASH_SECT_SIZE, hw/arm/versatilepb.c- 4, 0x0089, 0x0018, 0x0000, 0x0, 0)) { Vexpress does something very similar but using QOM setters instead. The IDs are set to something very specific indicating a chosen part rather than a generic pflash. Consequently we have the mixed semantic of blk sometimes dictating the device size and other times not. For ARM, it is generally the not case. Regards, Peter > Paolo >