[PULL for-6.2 7/7] hw/ide/ahci: fix broken SError handling

2023-09-06 Thread John Snow
From: Niklas Cassel When encountering an NCQ error, you should not write the NCQ tag to the SError register. This is completely wrong. The SError register has a clear definition, where each bit represents a different error, see PxSERR definition in AHCI 1.3.1. If we write a random value (like

Re: [PULL for-6.2 0/7] Ide patches

2023-09-06 Thread John Snow
I guess the last time I sent IDE patches was for 6.2 and that tag got stuck in my git-publish invocation, oops. I am not suggesting we break the laws of causality to merge these patches. On Wed, Sep 6, 2023 at 11:42 PM John Snow wrote: > > The following changes since commit

[PULL for-6.2 3/7] hw/ide/ahci: simplify and document PxCI handling

2023-09-06 Thread John Snow
From: Niklas Cassel The AHCI spec states that: For NCQ, PxCI is cleared on command queued successfully. For non-NCQ, PxCI is cleared on command completed successfully. (A non-NCQ command that completes with error does not clear PxCI.) The current QEMU implementation either clears PxCI in

[PULL for-6.2 4/7] hw/ide/ahci: PxSACT and PxCI is cleared when PxCMD.ST is cleared

2023-09-06 Thread John Snow
From: Niklas Cassel According to AHCI 1.3.1 definition of PxSACT: This field is cleared when PxCMD.ST is written from a '1' to a '0' by software. This field is not cleared by a COMRESET or a software reset. According to AHCI 1.3.1 definition of PxCI: This field is also cleared when PxCMD.ST is

[PULL for-6.2 6/7] hw/ide/ahci: fix ahci_write_fis_sdb()

2023-09-06 Thread John Snow
From: Niklas Cassel When there is an error, we need to raise a TFES error irq, see AHCI 1.3.1, 5.3.13.1 SDB:Entry. If ERR_STAT is set, we jump to state ERR:FatalTaskfile, which will raise a TFES IRQ unconditionally, regardless if the I bit is set in the FIS or not. Thus, we should never raise

[PULL for-6.2 0/7] Ide patches

2023-09-06 Thread John Snow
The following changes since commit c152379422a204109f34ca2b43ecc538c7d738ae: Merge tag 'ui-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging (2023-09-06 11:16:01 -0400) are available in the Git repository at: https://gitlab.com/jsnow/qemu.git tags/ide-pull-request for

[PULL for-6.2 1/7] hw/ide/core: set ERR_STAT in unsupported command completion

2023-09-06 Thread John Snow
From: Niklas Cassel Currently, the first time sending an unsupported command (e.g. READ LOG DMA EXT) will not have ERR_STAT set in the completion. Sending the unsupported command again, will correctly have ERR_STAT set. When ide_cmd_permitted() returns false, it calls ide_abort_command().

[PULL for-6.2 2/7] hw/ide/ahci: write D2H FIS when processing NCQ command

2023-09-06 Thread John Snow
From: Niklas Cassel The way that BUSY + PxCI is cleared for NCQ (FPDMA QUEUED) commands is described in SATA 3.5a Gold: 11.15 FPDMA QUEUED command protocol DFPDMAQ2: ClearInterfaceBsy "Transmit Register Device to Host FIS with the BSY bit cleared to zero and the DRQ bit cleared to zero and

[PULL for-6.2 5/7] hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set

2023-09-06 Thread John Snow
From: Niklas Cassel For NCQ, PxCI is cleared on command queued successfully. For non-NCQ, PxCI is cleared on command completed successfully. Successfully means ERR_STAT, BUSY and DRQ are all cleared. A command that has ERR_STAT set, does not get to clear PxCI. See AHCI 1.3.1, section 5.3.8,

Re: [PATCH v3 1/4] docs/qcow2: add the zoned format feature

2023-09-06 Thread Stefan Hajnoczi
On Mon, Aug 28, 2023 at 11:09:52PM +0800, Sam Li wrote: > Add the specs for the zoned format feature of the qcow2 driver. > The qcow2 file can be taken as zoned device and passed through by > virtio-blk device or NVMe ZNS device to the guest given zoned > information. > > Signed-off-by: Sam Li >

Re: [PATCH v6 06/17] nbd/server: Support a request payload

2023-09-06 Thread Eric Blake
On Tue, Sep 05, 2023 at 05:36:15PM +0300, Vladimir Sementsov-Ogievskiy wrote: > On 29.08.23 20:58, Eric Blake wrote: > > Upcoming additions to support NBD 64-bit effect lengths allow for the > > possibility to distinguish between payload length (capped at 32M) and > > effect length (64 bits,

Re: [PATCH v6 04/17] nbd: Prepare for 64-bit request effect lengths

2023-09-06 Thread Eric Blake
On Tue, Sep 05, 2023 at 05:41:33PM +0300, Vladimir Sementsov-Ogievskiy wrote: > > > > @@ -1899,7 +1899,7 @@ static int coroutine_fn > > > > nbd_co_send_simple_reply(NBDClient *client, > > > > NBDRequest *request, > > > >

[PULL 18/18] iotests: Add test for data_off check

2023-09-06 Thread Denis V. Lunev
From: Alexander Ivanov Write a pattern to the first cluster. Corrupt the data_off field and check if the field was repaired on image opening and the pattern has not changed. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev Signed-off-by: Denis V. Lunev ---

[PULL 11/18] parallels: Add data_off repairing to parallels_open()

2023-09-06 Thread Denis V. Lunev
From: 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 Reviewed-by: Denis V. Lunev

[PULL 16/18] iotests: Fix cluster size in parallels images tests (131)

2023-09-06 Thread Denis V. Lunev
From: Alexander Ivanov In this test cluster size is 64k, but modern tools generate images with cluster size 1M. Calculate cluster size using track field from image header. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev Signed-off-by: Denis V. Lunev --- tests/qemu-iotests/131

[PULL 15/18] iotests: Refactor tests of parallels images checks (131)

2023-09-06 Thread Denis V. Lunev
From: Alexander Ivanov Replace hardcoded numbers by variables. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev Signed-off-by: Denis V. Lunev --- tests/qemu-iotests/131 | 29 - 1 file changed, 16 insertions(+), 13 deletions(-) diff --git

[PULL 13/18] iotests: Add leak check test for parallels format

2023-09-06 Thread Denis V. Lunev
From: Alexander Ivanov Write a pattern to the last cluster, extend the image by 1 claster, repair and check that the last cluster still has the same pattern. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev Signed-off-by: Denis V. Lunev ---

[PULL 10/18] parallels: Add data_off check

2023-09-06 Thread Denis V. Lunev
From: 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 Reviewed-by: Denis V. Lunev Signed-off-by: Denis V. Lunev --- block/parallels.c | 80

[PULL 17/18] iotests: Fix test 131 after repair was added to parallels_open()

2023-09-06 Thread Denis V. Lunev
From: Alexander Ivanov Images repairing in parallels_open() was added, thus parallels tests fail. Access to an image leads to repairing the image. Further image check don't detect any corruption. Remove reads after image creation in test 131. Signed-off-by: Alexander Ivanov Reviewed-by: Denis

[PULL 12/18] iotests: Add out-of-image check test for parallels format

2023-09-06 Thread Denis V. Lunev
From: Alexander Ivanov Fill the image with a pattern to generate entries in the BAT, set the first BAT entry outside the image, try to read the corrupted image. At the image opening it should be repaired, check for zeroes in the first cluster. Signed-off-by: Alexander Ivanov Reviewed-by: Denis

[PULL 14/18] iotests: Add test for BAT entries duplication check

2023-09-06 Thread Denis V. Lunev
From: Alexander Ivanov Fill a parallels image with a pattern and write another pattern to the second cluster. Corrupt the image and check if the pattern changes. Repair the image and check the patterns on guest and host sides. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev

[PULL 07/18] parallels: Add checking and repairing duplicate offsets in BAT

2023-09-06 Thread Denis V. Lunev
From: 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

[PULL 05/18] parallels: Add "explicit" argument to parallels_check_leak()

2023-09-06 Thread Denis V. Lunev
From: 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

[PULL 08/18] parallels: Image repairing in parallels_open()

2023-09-06 Thread Denis V. Lunev
From: 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 Signed-off-by: Denis V. Lunev --- block/parallels.c | 70 +-- 1 file

[PULL 01/18] MAINTAINERS: add tree to keep parallels format driver changes

2023-09-06 Thread Denis V. Lunev
Driver changes are driving by me for now. At least we need to get functionally complete check and repair procedure for now. Signed-off-by: Denis V. Lunev Reviewed-by: Vladimir Sementsov-Ogievskiy CC: Stefan Hajnoczi --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git

[PULL 06/18] parallels: Add data_start field to BDRVParallelsState

2023-09-06 Thread Denis V. Lunev
From: 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 Signed-off-by: Denis V. Lunev --- block/parallels.c | 7 ---

[PULL 09/18] parallels: Use bdrv_co_getlength() in parallels_check_outside_image()

2023-09-06 Thread Denis V. Lunev
From: 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 Signed-off-by: Denis V. Lunev --- block/parallels.c | 2 +- 1 file

[PULL 02/18] parallels: Fix comments formatting inside parallels driver

2023-09-06 Thread Denis V. Lunev
From: 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 Reviewed-by: Denis V.

[PULL 00/18] Parallels format driver

2023-09-06 Thread Denis V. Lunev
Merge tag 'pull-request-2023-08-31' of https://gitlab.com/thuth/qemu into staging (2023-09-05 09:22:13 -0400) are available in the Git repository at: https://src.openvz.org/scm/~den/qemu.git tags/pull-parallels-2023-09-06 for you to fetch changes up to

[PULL 03/18] parallels: Incorrect data end calculation in parallels_open()

2023-09-06 Thread Denis V. Lunev
From: 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

[PULL 04/18] parallels: Check if data_end greater than the file size

2023-09-06 Thread Denis V. Lunev
From: 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 Signed-off-by: Denis V. Lunev --- block/parallels.c | 5 + 1 file changed, 5 insertions(+) diff

Re: [PULL 00/14] Block layer patches

2023-09-06 Thread Stefan Hajnoczi
test-bdrv-drain is failing. I think my coroutine wrapper patch might be necessary: https://gitlab.com/qemu-project/qemu/-/jobs/5029372308#L4907 I have dropped this patch series for the time being. Feel free to remove my patches and send a new revision. I will debug the test-bdrv-drain issue.

[PATCH 1/3] iotests: use TEST_IMG_FILE instead of TEST_IMG in _require_large_file

2023-09-06 Thread Denis V. Lunev
We need to check that we are able to create large enough file which is used as an export base rather than connection URL. Unfortunately, there are cases when the TEST_IMG_FILE is not defined. We should fallback to TEST_IMG in that case. This problem has been detected when running ./check -nbd

[PATCH 3/3] iotests: distinguish 'skipped' and 'not run' states

2023-09-06 Thread Denis V. Lunev
Each particular testcase could skipped intentionally and accidentally. For example the test is not designed for a particular image format or is not run due to the missed library. The latter case is unwanted in reality. Though the discussion has revealed that failing the test in such a case would

[PATCH 0/3] separated wanted and unwanted skips in QEMU iotests

2023-09-06 Thread Denis V. Lunev
Some time ago there was a discussion in the QEMU mailing list about the situation when some IO tests were not run and thus the patch has added a regression, namely https://lists.gnu.org/archive/html/qemu-devel/2023-08/msg02381.html This series contains a possible answer to the problem. Let us

[PATCH 2/3] iotests: improve 'not run' message for nbd-multiconn test

2023-09-06 Thread Denis V. Lunev
The test actually requires Python bindings to libnbd rather than libnbd itself. Clarify that inside the message. Signed-off-by: Denis V. Lunev CC: Kevin Wolf CC: Hanna Reitz CC: Eric Blake CC: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/tests/nbd-multiconn | 2 +- 1 file changed, 1

Re: [PULL 00/14] Block patches

2023-09-06 Thread Stefan Hajnoczi
On Fri, 1 Sept 2023 at 04:18, Hanna Czenczek wrote: > > The following changes since commit f5fe7c17ac4e309e47e78f0f9761aebc8d2f2c81: > > Merge tag 'pull-tcg-20230823-2' of https://gitlab.com/rth7680/qemu into > staging (2023-08-28 16:07:04 -0400) > > are available in the Git repository at: > >

[PATCH v2 1/2] hw/ide: reset: cancel async DMA operation before resetting state

2023-09-06 Thread Fiona Ebner
If there is a pending DMA operation during ide_bus_reset(), the fact that the IDEState is already reset before the operation is canceled can be problematic. In particular, ide_dma_cb() might be called and then use the reset IDEState which contains the signature after the reset. When used to

[PATCH v2 2/2] tests/qtest: ahci-test: add test exposing reset issue with pending callback

2023-09-06 Thread Fiona Ebner
Before commit "hw/ide: reset: cancel async DMA operation before resetting state", this test would fail, because a reset with a pending write operation would lead to an unsolicited write to the first sector of the disk. The test writes a pattern to the beginning of the disk and verifies that it is

Re: [PATCH v2] qdict: Preserve order for iterating qdict elements

2023-09-06 Thread Daniel P . Berrangé
On Wed, Sep 06, 2023 at 12:25:30PM +0200, David Hildenbrand wrote: > On 04.09.23 18:38, Daniel P. Berrangé wrote: > > On Sat, Sep 02, 2023 at 05:40:40PM +0800, William Tsai wrote: > > > Changing the structure of qdict so that it can preserve order when > > > iterating qdict. This will fix

Re: [PATCH v2] qdict: Preserve order for iterating qdict elements

2023-09-06 Thread David Hildenbrand
On 04.09.23 18:38, Daniel P. Berrangé wrote: On Sat, Sep 02, 2023 at 05:40:40PM +0800, William Tsai wrote: Changing the structure of qdict so that it can preserve order when iterating qdict. This will fix array_properties as it relies on `len-` prefixed argument to be set first. Resolves:

Re: [PATCH v2 3/3] tests/qemu-iotests/197: add testcase for CoR with subclusters

2023-09-06 Thread Denis V. Lunev
On 7/11/23 19:25, Andrey Drobyshev wrote: Add testcase which checks that allocations during copy-on-read are performed on the subcluster basis when subclusters are enabled in target image. This testcase also triggers the following assert with previous commit not being applied, so we check that

[PATCH 3/8] qemu-nbd: move srcpath into struct NbdClientOpts

2023-09-06 Thread Denis V. Lunev
We pass other parameters into nbd_client_thread() in this way. This patch makes the code more consistent. Signed-off-by: Denis V. Lunev CC: Eric Blake CC: Vladimir Sementsov-Ogievskiy --- qemu-nbd.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git

[PATCH v3 0/8] qemu-nbd: Restore "qemu-nbd -v --fork" output

2023-09-06 Thread Denis V. Lunev
This series contains the fix to the regression introduced with 5c56dd27a2 plus documentation update. Changes from v2: - fixed error message of dup2 (patch #1) - removed options copy as suggested by Eric - moved all other options used in nbd_client_thread() to struct NbdClientOpts for

[PATCH 7/8] qemu-nbd: document -v behavior in respect to --fork in man

2023-09-06 Thread Denis V. Lunev
Signed-off-by: Denis V. Lunev CC: Eric Blake CC: Vladimir Sementsov-Ogievskiy --- docs/tools/qemu-nbd.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/tools/qemu-nbd.rst b/docs/tools/qemu-nbd.rst index faf6349ea5..5c48ee7345 100644 --- a/docs/tools/qemu-nbd.rst

[PATCH 5/8] qemu-nbd: invent nbd_client_release_pipe() helper

2023-09-06 Thread Denis V. Lunev
Move the code from main() and nbd_client_thread() into the specific helper. This code is going to be grown. Signed-off-by: Denis V. Lunev CC: Eric Blake CC: Vladimir Sementsov-Ogievskiy --- qemu-nbd.c | 23 --- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git

[PATCH 6/8] qemu-nbd: Restore "qemu-nbd -v --fork" output

2023-09-06 Thread Denis V. Lunev
Closing stderr earlier is good for daemonized qemu-nbd under ssh earlier, but breaks the case where -v is being used to track what is happening in the server, as in iotest 233. When we know we are verbose, we should preserve original stderr and restore it once the setup stage is done. This commit

[PATCH 2/8] qemu-nbd: define struct NbdClientOpts when HAVE_NBD_DEVICE is not defined

2023-09-06 Thread Denis V. Lunev
This patch also drops definition of some locals in main() to avoid useless data copy. Signed-off-by: Denis V. Lunev CC: Eric Blake CC: Vladimir Sementsov-Ogievskiy --- qemu-nbd.c | 60 -- 1 file changed, 27 insertions(+), 33 deletions(-)

[PATCH 1/8] qemu-nbd: improve error message for dup2 error

2023-09-06 Thread Denis V. Lunev
This error is happened when we are not able to close the pipe to the parent (to trace errors in the child process) and assign stderr to /dev/null as required by the daemonizing convention. Signed-off-by: Denis V. Lunev Suggested-by: Eric Blake CC: Eric Blake CC: Vladimir Sementsov-Ogievskiy

[PATCH 4/8] qemu-nbd: put saddr into into struct NbdClientOpts

2023-09-06 Thread Denis V. Lunev
We pass other parameters into nbd_client_thread() in this way. This patch makes the code more consistent. Signed-off-by: Denis V. Lunev CC: Eric Blake CC: Vladimir Sementsov-Ogievskiy --- qemu-nbd.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/qemu-nbd.c

[PATCH 8/8] qemu-nbd: fix formatting in main()

2023-09-06 Thread Denis V. Lunev
Just a formatting, no functional changes. Signed-off-by: Denis V. Lunev CC: Eric Blake CC: Vladimir Sementsov-Ogievskiy --- Do not really sure that this patch is mandatory, just stabs my eye. Feel free to drop if this is too useless. qemu-nbd.c | 3 ++- 1 file changed, 2 insertions(+), 1

Re: [PATCH v3 07/20] virtio: add vhost-user-base and a generic vhost-user-device

2023-09-06 Thread Matias Ezequiel Vara Larsen
On Tue, Sep 05, 2023 at 06:01:56PM +0100, Alex Bennée wrote: > > Matias Ezequiel Vara Larsen writes: > > > On Mon, Jul 10, 2023 at 04:35:09PM +0100, Alex Bennée wrote: > >> In theory we shouldn't need to repeat so much boilerplate to support > >> vhost-user backends. This provides a generic

Re: [PATCH 05/21] block: Introduce bdrv_schedule_unref()

2023-09-06 Thread Kevin Wolf
Am 05.09.2023 um 18:39 hat Kevin Wolf geschrieben: > Am 22.08.2023 um 21:01 hat Stefan Hajnoczi geschrieben: > > On Thu, Aug 17, 2023 at 02:50:04PM +0200, Kevin Wolf wrote: > > > bdrv_unref() is called by a lot of places that need to hold the graph > > > lock (it naturally happens in the context

[PATCH v10 2/4] hw/ufs: Support for Query Transfer Requests

2023-09-06 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 Reviewed-by: Stefan Hajnoczi --- hw/ufs/trace-events | 1 + hw/ufs/ufs.c|

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

2023-09-06 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 v10 4/4] tests/qtest: Introduce tests for UFS

2023-09-06 Thread Jeuk Kim
From: Jeuk Kim This patch includes the following tests Test mmio read Test ufs device initialization and ufs-lu recognition Test I/O (Performs a write followed by a read to verify) Signed-off-by: Jeuk Kim Acked-by: Thomas Huth Reviewed-by: Stefan Hajnoczi --- MAINTAINERS |

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

2023-09-06 Thread Jeuk Kim
Since v9: - Added the "UFS_" prefix to all define and enum defined in block/ufs.h. This fixes https://gitlab.com/qemu-project/qemu/-/jobs/4977255992 which is a win32 build error. - Fixed not to use pointer type casting (uint32_t * -> unsigned long *). It causes the bug in the find_first_bit()

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

2023-09-06 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 Reviewed-by: Stefan Hajnoczi --- hw/ufs/lu.c | 1445