OSDN Git Service

pflash: Only read non-zero parts of backend image
authorXiang Zheng <zhengxiang9@huawei.com>
Tue, 20 Dec 2022 08:42:46 +0000 (09:42 +0100)
committerKevin Wolf <kwolf@redhat.com>
Tue, 24 Jan 2023 17:26:41 +0000 (18:26 +0100)
commita4b15a8b9ef25b44fa92a4825312622600c1f37c
tree1b47940e0215ec3c6d9ac9d0b7c53e943038bc9b
parent95988739c73f76176327061824c603f85b072ff2
pflash: Only read non-zero parts of backend image

Currently we fill the VIRT_FLASH memory space with two 64MB NOR images
when using persistent UEFI variables on virt board. Actually we only use
a very small(non-zero) part of the memory while the rest significant
large(zero) part of memory is wasted.

So this patch checks the block status and only writes the non-zero part
into memory. This requires pflash devices to use sparse files for
backends.

Signed-off-by: Xiang Zheng <zhengxiang9@huawei.com>
[ kraxel: rebased to latest master ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20221220084246.1984871-1-kraxel@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
hw/block/block.c