Re: [PATCH v4 2/3] block: introduce zone append write for zoned devices

2022-10-16 Thread Damien Le Moal
On 10/16/22 23:56, Sam Li wrote: > A zone append command is a write operation that specifies the first > logical block of a zone as the write position. When writing to a zoned > block device using zone append, the byte offset of writes is pointing > to the write pointer of that zone. Upon completio

Re: [PATCH v4 1/3] file-posix: add the tracking of the zones write pointers

2022-10-16 Thread Damien Le Moal
On 10/16/22 23:56, Sam Li wrote: > Since Linux doesn't have a user API to issue zone append operations to > zoned devices from user space, the file-posix driver is modified to add > zone append emulation using regular writes. To do this, the file-posix > driver tracks the wp location of all zones o

Re: [PATCH v12 3/7] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls

2022-10-16 Thread Damien Le Moal
On 10/16/22 23:51, Sam Li wrote: > Add a new zoned_host_device BlockDriver. The zoned_host_device option > accepts only zoned host block devices. By adding zone management > operations in this new BlockDriver, users can use the new block > layer APIs including Report Zone and four zone management o

Re: [RFC v3 1/2] include: update virtio_blk headers from Linux 5.19-rc2+

2022-10-16 Thread Damien Le Moal
On 10/17/22 09:53, Dmitry Fomichev wrote: > On Sun, 2022-10-16 at 23:05 +0800, Sam Li wrote: >> Use scripts/update-linux-headers.sh to update virtio-blk headers >> from Dmitry's "virtio-blk:add support for zoned block devices" >> linux patch. There is a link for more information: >> https://github.

Re: [PATCH v12 3/7] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls

2022-10-16 Thread Dmitry Fomichev
On Sun, 2022-10-16 at 22:51 +0800, Sam Li wrote: > Add a new zoned_host_device BlockDriver. The zoned_host_device option > accepts only zoned host block devices. By adding zone management > operations in this new BlockDriver, users can use the new block > layer APIs including Report Zone and four z

Re: [RFC v3 2/2] virtio-blk: add zoned storage emulation for zoned devices

2022-10-16 Thread Dmitry Fomichev
On Sun, 2022-10-16 at 23:05 +0800, Sam Li wrote: > This patch extends virtio-blk emulation to handle zoned device commands > by calling the new block layer APIs to perform zoned device I/O on > behalf of the guest. It supports Report Zone, four zone oparations (open, > close, finish, reset), and Ap

Re: [PATCH v4 2/3] block: introduce zone append write for zoned devices

2022-10-16 Thread Dmitry Fomichev
On Sun, 2022-10-16 at 22:56 +0800, Sam Li wrote: > A zone append command is a write operation that specifies the first > logical block of a zone as the write position. When writing to a zoned > block device using zone append, the byte offset of writes is pointing > to the write pointer of that zone

Re: [PATCH v4 1/3] file-posix: add the tracking of the zones write pointers

2022-10-16 Thread Dmitry Fomichev
On Sun, 2022-10-16 at 22:56 +0800, Sam Li wrote: > Since Linux doesn't have a user API to issue zone append operations to > zoned devices from user space, the file-posix driver is modified to add > zone append emulation using regular writes. To do this, the file-posix > driver tracks the wp locatio

Re: [PATCH v12 6/7] qemu-iotests: test new zone operations

2022-10-16 Thread Dmitry Fomichev
On Sun, 2022-10-16 at 22:51 +0800, Sam Li wrote: > We have added new block layer APIs of zoned block devices. > Test it with: > Create a null_blk device, run each zone operation on it and see > whether reporting right zone information. change this to "whether the logs show the correct zone informa

Re: [PATCH v12 5/7] config: add check to block layer

2022-10-16 Thread Dmitry Fomichev
On Sun, 2022-10-16 at 22:51 +0800, Sam Li wrote: > Putting zoned/non-zoned BlockDrivers on top of each other is not > allowed. > > Signed-off-by: Sam Li > Reviewed-by: Stefan Hajnoczi > Reviewed-by: Hannes Reinecke Reviewed-by: Dmitry Fomichev > --- >  block.c  | 19 +

Re: [PATCH v12 4/7] raw-format: add zone operations to pass through requests

2022-10-16 Thread Dmitry Fomichev
On Sun, 2022-10-16 at 22:51 +0800, Sam Li wrote: > raw-format driver usually sits on top of file-posix driver. It needs to > pass through requests of zone commands. > > Signed-off-by: Sam Li > Reviewed-by: Stefan Hajnoczi > Reviewed-by: Damien Le Moal > Reviewed-by: Hannes Reinecke Reviewed-b

Re: [PATCH v12 1/7] include: add zoned device structs

2022-10-16 Thread Dmitry Fomichev
On Sun, 2022-10-16 at 22:51 +0800, Sam Li wrote: > Signed-off-by: Sam Li > Reviewed-by: Stefan Hajnoczi > Reviewed-by: Damien Le Moal > Reviewed-by: Hannes Reinecke > --- >  include/block/block-common.h | 43 >  1 file changed, 43 insertions(+) > > diff --gi

Re: [PATCH v12 7/7] docs/zoned-storage: add zoned device documentation

2022-10-16 Thread Dmitry Fomichev
On Sun, 2022-10-16 at 22:51 +0800, Sam Li wrote: > Add the documentation about the zoned device support to virtio-blk > emulation. > > Signed-off-by: Sam Li > Reviewed-by: Stefan Hajnoczi > Reviewed-by: Damien Le Moal > --- >  docs/devel/zoned-storage.rst   | 43

Re: [RFC v3 1/2] include: update virtio_blk headers from Linux 5.19-rc2+

2022-10-16 Thread Dmitry Fomichev
On Sun, 2022-10-16 at 23:05 +0800, Sam Li wrote: > Use scripts/update-linux-headers.sh to update virtio-blk headers > from Dmitry's "virtio-blk:add support for zoned block devices" > linux patch. There is a link for more information: > https://github.com/dmitry-fomichev/virtblk-zbd > > Signed-off-

Re: [PATCH v12 2/7] file-posix: introduce helper functions for sysfs attributes

2022-10-16 Thread Dmitry Fomichev
On Sun, 2022-10-16 at 22:51 +0800, Sam Li wrote: > Use get_sysfs_str_val() to get the string value of device > zoned model. Then get_sysfs_zoned_model() can convert it to > BlockZoneModel type of QEMU. > > Use get_sysfs_long_val() to get the long value of zoned device > information. > > Signed-of

Re: [PATCH v4 00/10] m25p80: Add SFDP support

2022-10-16 Thread Joel Stanley
On Thu, 13 Oct 2022 at 16:12, Cédric Le Goater wrote: > > Hello, > > This patchset adds support for JEDEC STANDARD JESD216 Serial Flash > Discovery Parameters (SFDP). SFDP describes the features of a serial > flash device using a set of internal parameter tables. Support in > Linux has been added

[RFC v3 1/2] include: update virtio_blk headers from Linux 5.19-rc2+

2022-10-16 Thread Sam Li
Use scripts/update-linux-headers.sh to update virtio-blk headers from Dmitry's "virtio-blk:add support for zoned block devices" linux patch. There is a link for more information: https://github.com/dmitry-fomichev/virtblk-zbd Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Signed-off-by: Sam

[RFC v3 2/2] virtio-blk: add zoned storage emulation for zoned devices

2022-10-16 Thread Sam Li
This patch extends virtio-blk emulation to handle zoned device commands by calling the new block layer APIs to perform zoned device I/O on behalf of the guest. It supports Report Zone, four zone oparations (open, close, finish, reset), and Append Zone. The VIRTIO_BLK_F_ZONED feature bit will only

[PATCH v4 3/3] qemu-iotests: test zone append operation

2022-10-16 Thread Sam Li
This tests is mainly a helper to indicate append writes in block layer behaves as expected. Signed-off-by: Sam Li --- qemu-io-cmds.c | 63 ++ tests/qemu-iotests/tests/zoned.out | 7 tests/qemu-iotests/tests/zoned.sh | 9 + 3 files chang

[PATCH v4 1/3] file-posix: add the tracking of the zones write pointers

2022-10-16 Thread Sam Li
Since Linux doesn't have a user API to issue zone append operations to zoned devices from user space, the file-posix driver is modified to add zone append emulation using regular writes. To do this, the file-posix driver tracks the wp location of all zones of the device. It uses an array of uint64_

[RFC v3 0/2] Add zoned storage emulation to virtio-blk driver

2022-10-16 Thread Sam Li
Note: the virtio-blk headers isn't upstream in the kernel yet therefore marked as an RFC. v3: - use qemuio_from_buffer to write status bit [Stefan] - avoid using req->elem directly [Stefan] - fix error checkings and memory leak [Stefan] v2: - change units of emulated zone op coresponding to block

[PATCH v12 6/7] qemu-iotests: test new zone operations

2022-10-16 Thread Sam Li
We have added new block layer APIs of zoned block devices. Test it with: Create a null_blk device, run each zone operation on it and see whether reporting right zone information. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi --- tests/qemu-iotests/tests/zoned.out | 53 ++ t

[PATCH v4 2/3] block: introduce zone append write for zoned devices

2022-10-16 Thread Sam Li
A zone append command is a write operation that specifies the first logical block of a zone as the write position. When writing to a zoned block device using zone append, the byte offset of writes is pointing to the write pointer of that zone. Upon completion the device will respond with the positi

[PATCH v4 0/3] Add zone append write for zoned device

2022-10-16 Thread Sam Li
v4: - fix lock related issues[Damien] - drop all field in zone_mgmt op [Damien] - fix state checks in zong_mgmt command [Damien] - return start sector of wp when issuing zap req [Damien] v3: - only read wps when it is locked [Damien] - allow last smaller zone case [Damien] - add zone type and stat

[PATCH v12 7/7] docs/zoned-storage: add zoned device documentation

2022-10-16 Thread Sam Li
Add the documentation about the zoned device support to virtio-blk emulation. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Damien Le Moal --- docs/devel/zoned-storage.rst | 43 ++ docs/system/qemu-block-drivers.rst.inc | 6 2 files cha

[PATCH v12 4/7] raw-format: add zone operations to pass through requests

2022-10-16 Thread Sam Li
raw-format driver usually sits on top of file-posix driver. It needs to pass through requests of zone commands. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- block/raw-format.c | 13 + 1 file changed, 13 insertions(

[PATCH v12 5/7] config: add check to block layer

2022-10-16 Thread Sam Li
Putting zoned/non-zoned BlockDrivers on top of each other is not allowed. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Hannes Reinecke --- block.c | 19 +++ block/file-posix.c | 12 block/raw-format.c

[PATCH v12 3/7] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls

2022-10-16 Thread Sam Li
Add a new zoned_host_device BlockDriver. The zoned_host_device option accepts only zoned host block devices. By adding zone management operations in this new BlockDriver, users can use the new block layer APIs including Report Zone and four zone management operations (open, close, finish, reset, re

[PATCH v12 2/7] file-posix: introduce helper functions for sysfs attributes

2022-10-16 Thread Sam Li
Use get_sysfs_str_val() to get the string value of device zoned model. Then get_sysfs_zoned_model() can convert it to BlockZoneModel type of QEMU. Use get_sysfs_long_val() to get the long value of zoned device information. Signed-off-by: Sam Li Reviewed-by: Hannes Reinecke Reviewed-by: Stefan H

[PATCH v12 1/7] include: add zoned device structs

2022-10-16 Thread Sam Li
Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- include/block/block-common.h | 43 1 file changed, 43 insertions(+) diff --git a/include/block/block-common.h b/include/block/block-common.h ind

[PATCH v12 0/7] Add support for zoned device

2022-10-16 Thread Sam Li
Zoned Block Devices (ZBDs) devide the LBA space to block regions called zones that are larger than the LBA size. It can only allow sequential writes, which reduces write amplification in SSD, leading to higher throughput and increased capacity. More details about ZBDs can be found at: https://zone

Re: [PATCH v3 7/9] hw/ppc/e500: Implement pflash handling

2022-10-16 Thread BALATON Zoltan
On Sun, 16 Oct 2022, Bernhard Beschow wrote: Allows e500 boards to have their root file system reside on flash using only builtin devices located in the eLBC memory region. Note that the flash memory area is only created when a -pflash argument is given, and that the size is determined by the gi

Re: [PATCH v6 2/2] block: Refactor get_tmp_filename()

2022-10-16 Thread Bin Meng
On Mon, Oct 10, 2022 at 12:05 PM Bin Meng wrote: > > At present there are two callers of get_tmp_filename() and they are > inconsistent. > > One does: > > /* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. */ > char *tmp_filename = g_malloc0(PATH_MAX + 1); > ... > r

[PATCH v3 9/9] hw/ppc/e500: Add Freescale eSDHC to e500plat

2022-10-16 Thread Bernhard Beschow
Adds missing functionality to e500plat machine which increases the chance of given "real" firmware images to access SD cards. Signed-off-by: Bernhard Beschow --- docs/system/ppc/ppce500.rst | 12 hw/ppc/Kconfig | 1 + hw/ppc/e500.c | 35 ++

Re: [PATCH v3 0/9] ppc/e500: Add support for two types of flash, cleanup

2022-10-16 Thread Bernhard Beschow
Am 16. Oktober 2022 12:27:28 UTC schrieb Bernhard Beschow : >Cover letter: > >~ > > > >This series adds support for -pflash and direct SD card access to the > >PPC e500 boards. The idea is to increase compatibility with "real" firmware > >images where only the bare minimum of drivers is

Re: [PATCH v2 13/13] hw/ppc/e500: Add Freescale eSDHC to e500 boards

2022-10-16 Thread Bernhard Beschow
Am 3. Oktober 2022 21:06:57 UTC schrieb "Philippe Mathieu-Daudé" : >On 3/10/22 22:31, Bernhard Beschow wrote: >> Adds missing functionality to emulated e500 SOCs which increases the >> chance of given "real" firmware images to access SD cards. >> >> Signed-off-by: Bernhard Beschow >> --- >> do

[PATCH v3 5/9] hw/sd/sdhci-internal: Unexport ESDHC defines

2022-10-16 Thread Bernhard Beschow
These defines aren't used outside of sdhci.c, so can be defined there. Signed-off-by: Bernhard Beschow Reviewed-by: Bin Meng Reviewed-by: Philippe Mathieu-Daudé --- hw/sd/sdhci-internal.h | 20 hw/sd/sdhci.c | 19 +++ 2 files changed, 19 insertions

[PATCH v3 7/9] hw/ppc/e500: Implement pflash handling

2022-10-16 Thread Bernhard Beschow
Allows e500 boards to have their root file system reside on flash using only builtin devices located in the eLBC memory region. Note that the flash memory area is only created when a -pflash argument is given, and that the size is determined by the given file. The idea is to put users into control

[PATCH v3 8/9] hw/sd/sdhci: Implement Freescale eSDHC device model

2022-10-16 Thread Bernhard Beschow
Will allow e500 boards to access SD cards using just their own devices. Signed-off-by: Bernhard Beschow --- hw/sd/sdhci.c | 120 +- include/hw/sd/sdhci.h | 3 ++ 2 files changed, 122 insertions(+), 1 deletion(-) diff --git a/hw/sd/sdhci.c b/hw/s

[PATCH v3 6/9] hw/sd/sdhci: Rename ESDHC_* defines to USDHC_*

2022-10-16 Thread Bernhard Beschow
The device model's functions start with "usdhc_", so rename the defines accordingly for consistency. Signed-off-by: Bernhard Beschow Reviewed-by: Bin Meng --- hw/sd/sdhci.c | 66 +-- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/

[PATCH v3 3/9] hw/block/pflash_cfi01: Attach memory region in boards

2022-10-16 Thread Bernhard Beschow
pflash_cfi01_register() had a parameter which was only passed to sysbus_mmio_map() but not used otherwise. Pulling out sysbus_mmio_map() resolves that parameter and concentrates the memory region setup in board code. Furthermore, it allows attaching cfi01 devices relative to some parent bus rather

[PATCH v3 2/9] hw/{arm,ppc}: Resolve unreachable code

2022-10-16 Thread Bernhard Beschow
pflash_cfi01_register() always returns with a non-NULL pointer (otherwise it would crash internally). Therefore, the bodies of the if-statements are unreachable. Signed-off-by: Bernhard Beschow --- hw/arm/gumstix.c | 18 ++ hw/arm/mainstone.c | 13 + hw/arm/omap

[PATCH v3 0/9] ppc/e500: Add support for two types of flash, cleanup

2022-10-16 Thread Bernhard Beschow
Cover letter: ~ This series adds support for -pflash and direct SD card access to the PPC e500 boards. The idea is to increase compatibility with "real" firmware images where only the bare minimum of drivers is compiled in. The series is structured as follows: Patches 1-6 perform som

[PATCH v3 4/9] hw/block/pflash_cfi02: Attach memory region in boards

2022-10-16 Thread Bernhard Beschow
pflash_cfi02_register() had a parameter which was only passed to sysbus_mmio_map() but not used otherwise. Pulling out sysbus_mmio_map() resolves that parameter and concentrates the memory region setup in board code. Furthermore, it allows attaching cfi02 devices relative to some parent bus rather

[PATCH v3 1/9] hw/block/pflash_cfi0{1, 2}: Error out if device length isn't a power of two

2022-10-16 Thread Bernhard Beschow
According to the JEDEC standard the device length is communicated to an OS as an exponent (power of two). Signed-off-by: Bernhard Beschow Reviewed-by: Bin Meng Reviewed-by: Philippe Mathieu-Daudé --- hw/block/pflash_cfi01.c | 8 ++-- hw/block/pflash_cfi02.c | 5 + 2 files changed, 11 i