[PATCH v5 3/3] hw/ufs: Support for UFS logical unit

2023-07-18 Thread Jeuk Kim
From: Jeuk Kim This commit adds support for ufs logical unit. The LU handles processing for the SCSI command, unit descriptor query request. This commit enables the UFS device to process IO requests. Signed-off-by: Jeuk Kim --- hw/ufs/lu.c | 1439

[PATCH v5 2/3] hw/ufs: Support for Query Transfer Requests

2023-07-18 Thread Jeuk Kim
From: Jeuk Kim This commit makes the UFS device support query and nop out transfer requests. The next patch would be support for UFS logical unit and scsi command transfer request. Signed-off-by: Jeuk Kim --- hw/ufs/trace-events | 1 + hw/ufs/ufs.c| 980

[PATCH v5 1/3] hw/ufs: Initial commit for emulated Universal-Flash-Storage

2023-07-18 Thread Jeuk Kim
From: Jeuk Kim Universal Flash Storage (UFS) is a high-performance mass storage device with a serial interface. It is primarily used as a high-performance data storage device for embedded applications. This commit contains code for UFS device to be recognized as a UFS PCI device. Patches to

[PATCH v5 0/3] hw/ufs: Add Universal Flash Storage (UFS) support

2023-07-18 Thread Jeuk Kim
Since v4: Addressed review comment from Stefan Hajnoczi. The fixes are as follows. - Keep u->reg fields in host endian (Removed little-endian helper functions from MemoryRegionOps) - Remove unnecessary NULL checks for g_new and g_malloc0 - Replace DEFINE_PROP_DRIVE_IOTHREAD -> DEFINE_PROP_DRIVE

Re: PING: [PATCH v4 0/3] hw/ufs: Add Universal Flash Storage (UFS) support

2023-07-18 Thread Jeuk Kim
On 2023-07-19 오전 3:56, Stefan Hajnoczi wrote: On Tue, Jul 11, 2023 at 07:31:02PM +0900, Jeuk Kim wrote: Hi, Any more reviews...? Dear Stefan If you don't mind, Could you give it "reviewed-by"? And is there anything else I should do...? Sorry for the late reply. I was on vacation and am

Re: [Libguestfs] [libnbd PATCH v3 04/22] states: Prepare to send 64-bit requests

2023-07-18 Thread Eric Blake
On Tue, May 30, 2023 at 01:18:22PM -0500, Eric Blake wrote: > > > + /* It is more convenient to manage PAYLOAD_LEN by what was negotiated > > > + * than to require the user to have to set it correctly. > > > + * TODO: Add new h->strict bit to allow intentional protocol violation > > > + *

Re: [PATCH v4 3/3] hw/ufs: Support for UFS logical unit

2023-07-18 Thread Stefan Hajnoczi
On Tue, Jul 04, 2023 at 05:33:59PM +0900, Jeuk Kim wrote: > +static Property ufs_lu_props[] = { > +DEFINE_PROP_DRIVE_IOTHREAD("drive", UfsLu, qdev.conf.blk), This device is not aware of IOThreads, so I think DEFINE_PROP_DRIVE() should be used instead. signature.asc Description: PGP

Re: [PATCH v4 2/3] hw/ufs: Support for Query Transfer Requests

2023-07-18 Thread Stefan Hajnoczi
On Tue, Jul 04, 2023 at 05:33:58PM +0900, Jeuk Kim wrote: > +static MemTxResult ufs_dma_read_prdt(UfsRequest *req) > +{ > +UfsHc *u = req->hc; > +uint16_t prdt_len = le16_to_cpu(req->utrd.prd_table_length); > +uint16_t prdt_byte_off = > +le16_to_cpu(req->utrd.prd_table_offset)

Re: [PATCH v4 1/3] hw/ufs: Initial commit for emulated Universal-Flash-Storage

2023-07-18 Thread Stefan Hajnoczi
On Tue, Jul 04, 2023 at 05:33:57PM +0900, Jeuk Kim wrote: > From: Jeuk Kim > > Universal Flash Storage (UFS) is a high-performance mass storage device > with a serial interface. It is primarily used as a high-performance > data storage device for embedded applications. > > This commit contains

Re: PING: [PATCH v4 0/3] hw/ufs: Add Universal Flash Storage (UFS) support

2023-07-18 Thread Stefan Hajnoczi
On Tue, Jul 11, 2023 at 07:31:02PM +0900, Jeuk Kim wrote: > Hi, > Any more reviews...? > > Dear Stefan > If you don't mind, Could you give it "reviewed-by"? > And is there anything else I should do...? Sorry for the late reply. I was on vacation and am working my way through pending code review

Re: [PATCH 6/5] qemu-nbd: make verbose bool and local variable in main()

2023-07-18 Thread Eric Blake
On Mon, Jul 17, 2023 at 10:25:20PM +0200, Denis V. Lunev wrote: > Pass 'verbose' to nbd_client_thread() inside NbdClientOpts which looks > a little bit cleaner and make it bool as it is used as bool actually. > > Signed-off-by: Denis V. Lunev > CC: Eric Blake > CC: Vladimir Sementsov-Ogievskiy

Re: [PATCH 5/5] qemu-nbd: handle dup2() error when qemu-nbd finished setup process

2023-07-18 Thread Eric Blake
On Mon, Jul 17, 2023 at 04:55:44PM +0200, Denis V. Lunev wrote: > Fail on error, we are in trouble. > > Signed-off-by: Denis V. Lunev > CC: Eric Blake > CC: Vladimir Sementsov-Ogievskiy > --- > qemu-nbd.c | 14 -- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git

Re: [PATCH 4/5] qemu-nbd: properly report error if qemu_daemon() is failed

2023-07-18 Thread Eric Blake
On Mon, Jul 17, 2023 at 04:55:43PM +0200, Denis V. Lunev wrote: > errno has been overwritten by dup2() just below qemu_daemon() and thus > improperly returned to the caller. Fix accordingly. > > Signed-off-by: Denis V. Lunev > CC: Eric Blake > CC: Vladimir Sementsov-Ogievskiy > --- >

Re: [PATCH 3/5] qemu-nbd: properly report error on error in dup2() after qemu_daemon()

2023-07-18 Thread Eric Blake
On Mon, Jul 17, 2023 at 04:55:42PM +0200, Denis V. Lunev wrote: > We are trying to temporary redirect stderr of daemonized process to temporarily > a pipe to report a error and get failed. In that case we could not > use error_report() helper, but should write the message directly into > the

Re: [PATCH] hw/nvme: fix endianness issue for shadow doorbells

2023-07-18 Thread Philippe Mathieu-Daudé
On 18/7/23 13:34, Klaus Jensen wrote: On Jul 18 13:18, Philippe Mathieu-Daudé wrote: On 18/7/23 12:35, Klaus Jensen wrote: From: Klaus Jensen In commit 2fda0726e514 ("hw/nvme: fix missing endian conversions for doorbell buffers"), we fixed shadow doorbells for big-endian guests running on

Re: [PATCH] hw/nvme: fix endianness issue for shadow doorbells

2023-07-18 Thread Klaus Jensen
On Jul 18 13:18, Philippe Mathieu-Daudé wrote: > On 18/7/23 12:35, Klaus Jensen wrote: > > From: Klaus Jensen > > > > In commit 2fda0726e514 ("hw/nvme: fix missing endian conversions for > > doorbell buffers"), we fixed shadow doorbells for big-endian guests > > running on little endian hosts.

Re: [PATCH] hw/nvme: fix endianness issue for shadow doorbells

2023-07-18 Thread Philippe Mathieu-Daudé
On 18/7/23 12:35, Klaus Jensen wrote: From: Klaus Jensen In commit 2fda0726e514 ("hw/nvme: fix missing endian conversions for doorbell buffers"), we fixed shadow doorbells for big-endian guests running on little endian hosts. But I did not fix little-endian guests on big-endian hosts. Fix

Re: [PATCH] hw/nvme: fix endianness issue for shadow doorbells

2023-07-18 Thread Keith Busch
On Tue, Jul 18, 2023 at 12:35:12PM +0200, Klaus Jensen wrote: > From: Klaus Jensen > > In commit 2fda0726e514 ("hw/nvme: fix missing endian conversions for > doorbell buffers"), we fixed shadow doorbells for big-endian guests > running on little endian hosts. But I did not fix little-endian

Re: [PATCH] hw/nvme: fix endianness issue for shadow doorbells

2023-07-18 Thread Thomas Huth
On 18/07/2023 12.35, Klaus Jensen wrote: From: Klaus Jensen In commit 2fda0726e514 ("hw/nvme: fix missing endian conversions for doorbell buffers"), we fixed shadow doorbells for big-endian guests running on little endian hosts. But I did not fix little-endian guests on big-endian hosts. Fix

Re: [PATCH v2 0/7] iotests/parallels: Add new tests and fix old

2023-07-18 Thread Alexander Ivanov
This patchset also could be applied upon [PATCH v8 00/10] parallels: Add duplication check, repair at open, fix bugs. On 7/1/23 12:11, Alexander Ivanov wrote: This patchset should be applied on top of [PATCH v7 0/8] parallels: Add duplication check, repair at open, fix bugs Add out-of-image,

[PATCH v8 07/10] parallels: Image repairing in parallels_open()

2023-07-18 Thread Alexander Ivanov
Repair an image at opening if the image is unclean or out-of-image corruption was detected. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 70 +-- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git

[PATCH v8 09/10] parallels: Add data_off check

2023-07-18 Thread Alexander Ivanov
data_off field of the parallels image header can be corrupted. Check if this field greater than the header + BAT size and less than file size. Signed-off-by: Alexander Ivanov --- block/parallels.c | 80 +++ 1 file changed, 80 insertions(+) diff --git

Re: [PATCH] hw/nvme: fix endianness issue for shadow doorbells

2023-07-18 Thread Cédric Le Goater
On 7/18/23 12:35, Klaus Jensen wrote: From: Klaus Jensen In commit 2fda0726e514 ("hw/nvme: fix missing endian conversions for doorbell buffers"), we fixed shadow doorbells for big-endian guests running on little endian hosts. But I did not fix little-endian guests on big-endian hosts. Fix

[PATCH v8 03/10] parallels: Check if data_end greater than the file size

2023-07-18 Thread Alexander Ivanov
Initially data_end is set to the data_off image header field and must not be greater than the file size. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 5 + 1 file changed, 5 insertions(+) diff --git a/block/parallels.c b/block/parallels.c index

[PATCH v8 02/10] parallels: Incorrect data end calculation in parallels_open()

2023-07-18 Thread Alexander Ivanov
The BDRVParallelsState structure contains data_end field that is measured in sectors. In parallels_open() initially this field is set by data_off field from parallels image header. According to the parallels format documentation, data_off field contains an offset, in sectors, from the start of

[PATCH v8 08/10] parallels: Use bdrv_co_getlength() in parallels_check_outside_image()

2023-07-18 Thread Alexander Ivanov
bdrv_co_getlength() should be used in coroutine context. Replace bdrv_getlength() by bdrv_co_getlength() in parallels_check_outside_image(). Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH v8 04/10] parallels: Add "explicit" argument to parallels_check_leak()

2023-07-18 Thread Alexander Ivanov
In the on of the next patches we need to repair leaks without changing leaks and leaks_fixed info in res. Also we don't want to print any warning about leaks. Add "explicit" argument to skip info changing if the argument is false. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev ---

[PATCH v8 06/10] parallels: Add checking and repairing duplicate offsets in BAT

2023-07-18 Thread Alexander Ivanov
Cluster offsets must be unique among all the BAT entries. Find duplicate offsets in the BAT and fix it by copying the content of the relevant cluster to a newly allocated cluster and set the new cluster offset to the duplicated entry. Add host_cluster_index() helper to deduplicate the code. When

[PATCH v8 05/10] parallels: Add data_start field to BDRVParallelsState

2023-07-18 Thread Alexander Ivanov
In the next patch we will need the offset of the data area for host cluster index calculation. Add this field and setting up code. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 7 --- block/parallels.h | 1 + 2 files changed, 5 insertions(+), 3

[PATCH v8 00/10] parallels: Add duplication check, repair at open, fix bugs

2023-07-18 Thread Alexander Ivanov
Fix incorrect data end calculation in parallels_open(). Check if data_end greater than the file size. Add change_info argument to parallels_check_leak(). Add checking and repairing duplicate offsets in BAT Image repairing in parallels_open(). v8: 1: New patch. Fixed comments formatting. 2:

[PATCH v8 10/10] parallels: Add data_off repairing to parallels_open()

2023-07-18 Thread Alexander Ivanov
Place data_start/data_end calculation after reading the image header to s->header. Set s->data_start to the offset calculated in parallels_test_data_off(). Call bdrv_check() if data_off is incorrect. Signed-off-by: Alexander Ivanov --- block/parallels.c | 31 +-- 1

[PATCH v8 01/10] parallels: Fix comments formatting inside parallels driver

2023-07-18 Thread Alexander Ivanov
This patch is technically necessary as git patch rendering could result in moving some code from one place to the another and that hits checkpatch.pl warning. This problem specifically happens within next series. Signed-off-by: Alexander Ivanov --- block/parallels.c | 18 -- 1

[PATCH] hw/nvme: fix endianness issue for shadow doorbells

2023-07-18 Thread Klaus Jensen
From: Klaus Jensen In commit 2fda0726e514 ("hw/nvme: fix missing endian conversions for doorbell buffers"), we fixed shadow doorbells for big-endian guests running on little endian hosts. But I did not fix little-endian guests on big-endian hosts. Fix this. Solves issue #1765. Fixes: