[PATCH v3] hw/ide/ahci: fix legacy software reset

2023-11-08 Thread Niklas Cassel
From: Niklas Cassel Legacy software contains a standard mechanism for generating a reset to a Serial ATA device - setting the SRST (software reset) bit in the Device Control register. Serial ATA has a more robust mechanism called COMRESET, also referred to as port reset. A port reset is the

Re: [PATCH v2] hw/ide/ahci: fix legacy software reset

2023-11-07 Thread Niklas Cassel
On Tue, Nov 07, 2023 at 07:14:07PM +0100, Kevin Wolf wrote: > Am 05.10.2023 um 12:04 hat Niklas Cassel geschrieben: > > From: Niklas Cassel > > > > Legacy software contains a standard mechanism for generating a reset to a > > Serial ATA device - setting the SRST

Re: [PATCH] hw/ide/ahci: trigger either error IRQ or regular IRQ, not both

2023-10-26 Thread Niklas Cassel
On Wed, Oct 11, 2023 at 03:12:20PM +0200, Niklas Cassel wrote: > From: Niklas Cassel > > According to AHCI 1.3.1, 5.3.8.1 RegFIS: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

Re: [PATCH] hw/ide/ahci: trigger either error IRQ or regular IRQ, not both

2023-10-11 Thread Niklas Cassel
On Wed, Oct 11, 2023 at 05:44:28PM +0300, Michael Tokarev wrote: > 11.10.2023 16:12, Niklas Cassel wrote: > > From: Niklas Cassel > > > > According to AHCI 1.3.1, 5.3.8.1 RegFIS:Entry, if ERR_STAT is set, > > we jump to state ERR:FatalTaskfile, which will raise a T

[PATCH] hw/ide/ahci: trigger either error IRQ or regular IRQ, not both

2023-10-11 Thread Niklas Cassel
From: Niklas Cassel According to AHCI 1.3.1, 5.3.8.1 RegFIS: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 a normal IRQ after having sent an error IRQ

[PATCH v2] hw/ide/ahci: fix legacy software reset

2023-10-05 Thread Niklas Cassel
From: Niklas Cassel Legacy software contains a standard mechanism for generating a reset to a Serial ATA device - setting the SRST (software reset) bit in the Device Control register. Serial ATA has a more robust mechanism called COMRESET, also referred to as port reset. A port reset is the

[PATCH] hw/ide/ahci: fix legacy software reset

2023-10-05 Thread Niklas Cassel
From: Niklas Cassel Legacy software contains a standard mechanism for generating a reset to a Serial ATA device - setting the SRST (software reset) bit in the Device Control register. Serial ATA has a more robust mechanism called COMRESET, also referred to as port reset. A port reset is the

Re: FreeBSD 13.2 installer does not see AHCI devices on aarch64/sbsa-ref and x86-64/q35

2023-10-03 Thread Niklas Cassel
On Tue, Oct 03, 2023 at 08:11:39PM +0300, Michael Tokarev wrote: > 26.09.2023 15:05, Niklas Cassel: > > Hello Marcin, > > > > I will have a look at this. > > Hi Marcin, Hi Niklas! > > Niklas, I remember asking you if the whole thing is okay for the -stable, &g

Re: [PATCH 1/1] hw/ide/core: terminate in-flight DMA on IDE bus reset

2023-10-03 Thread Niklas Cassel
On Mon, Sep 25, 2023 at 03:53:23PM -0400, John Snow wrote: > Niklas, I'm sorry to lean on you here a little bit - You've been > working on the SATA side of this a bit more often, can you let me know > if you think this patch is safe? FWIW, I prefer Fiona's patch series which calls blk_aio_cancel()

Re: FreeBSD 13.2 installer does not see AHCI devices on aarch64/sbsa-ref and x86-64/q35

2023-09-26 Thread Niklas Cassel
SE_AARCH64_BO [ro]... >Root mount waiting for: CAM >[..] >Root mount waiting for: CAM >ahcich0: Poll timeout on slot 1 port 0 >ahcich0: is cs 0002 ss rs 0002 tfd 170 serr >cmd c017 > >And finally it gives up. > > >v8.1.1 was bad,

Re: [Stable-7.2.6 29/37] hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set

2023-09-11 Thread Niklas Cassel
On Mon, Sep 11, 2023 at 12:07:52AM +0300, Michael Tokarev wrote: > 09.09.2023 16:04, Michael Tokarev wrote: > > From: Niklas Cassel > > > > For NCQ, PxCI is cleared on command queued successfully. > > For non-NCQ, PxCI is cleared on command completed successfully. >

Re: [SeaBIOS] new release tag?

2023-09-08 Thread Niklas Cassel
On Thu, Aug 24, 2023 at 10:56:05AM +0200, Gerd Hoffmann wrote: > On Mon, Aug 07, 2023 at 10:51:33AM +0000, Niklas Cassel via SeaBIOS wrote: > > Hello Seabios maintainers, > > > > > > I was wondering, is there any chance of getting a new release tag > > (e.g. re

Re: [PATCH v3 0/8] misc AHCI cleanups

2023-08-07 Thread Niklas Cassel
On Tue, Jul 25, 2023 at 03:00:56PM -0400, John Snow wrote: > On Tue, Jul 25, 2023 at 9:04 AM Philippe Mathieu-Daudé > wrote: > > > > Hi Niklas, John, Paolo, Kevin, > > > > On 19/7/23 12:47, Niklas Cassel wrote: > > > > >> Niklas Cassel (8

Re: [PATCH v3 0/8] misc AHCI cleanups

2023-07-19 Thread Niklas Cassel
On Fri, Jun 09, 2023 at 04:08:36PM +0200, Niklas Cassel wrote: > From: Niklas Cassel > > Hello John, > > Here comes some misc AHCI cleanups. > > Most are related to error handling. > > Please review. > > Changes since v2: > -Squashed in the test comm

[PATCH v3 0/8] misc AHCI cleanups

2023-06-09 Thread Niklas Cassel
From: Niklas Cassel Hello John, Here comes some misc AHCI cleanups. Most are related to error handling. Please review. Changes since v2: -Squashed in the test commits that were sent out as a separate series into the patch "hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set&q

[PATCH v3 2/8] hw/ide/core: set ERR_STAT in unsupported command completion

2023-06-09 Thread Niklas Cassel
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

[PATCH v3 4/8] hw/ide/ahci: simplify and document PxCI handling

2023-06-09 Thread Niklas Cassel
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

[PATCH v3 7/8] hw/ide/ahci: fix ahci_write_fis_sdb()

2023-06-09 Thread Niklas Cassel
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

[PATCH v3 6/8] hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set

2023-06-09 Thread Niklas Cassel
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

[PATCH v3 8/8] hw/ide/ahci: fix broken SError handling

2023-06-09 Thread Niklas Cassel
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

[PATCH v3 3/8] hw/ide/ahci: write D2H FIS when processing NCQ command

2023-06-09 Thread Niklas Cassel
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 zer

[PATCH v3 1/8] hw/ide/ahci: remove stray backslash

2023-06-09 Thread Niklas Cassel
From: Niklas Cassel This backslash obviously does not belong here, so remove it. Signed-off-by: Niklas Cassel Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: John Snow --- hw/ide/ahci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index

[PATCH v3 5/8] hw/ide/ahci: PxSACT and PxCI is cleared when PxCMD.ST is cleared

2023-06-09 Thread Niklas Cassel
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 clea

[PATCH 5/5] libqos/ahci: perform mandatory error recovery on error

2023-06-08 Thread Niklas Cassel
From: Niklas Cassel When the HBA encouters an error, the host has to perform error recovery, see AHCI 1.3.1 section 6.2.2.1, in order to be able issue new commands. If we don't do this, all the commands that we queue will get aborted. Some tests, e.g. test_atapi_tray()

[PATCH 3/5] libqos/ahci: simplify ahci_port_check_error()

2023-06-08 Thread Niklas Cassel
From: Niklas Cassel Modify ahci_port_check_error() to simply take a struct AHCICommand. This way, the conditionals are in line which the existing code, e.g. ahci_port_check_nonbusy(), which checks for cmd->errors. This makes the code easier to reason with, we don't want to use cmd-&g

[PATCH 2/5] libqos/ahci: fix ahci_port_check_nonbusy()

2023-06-08 Thread Niklas Cassel
From: Niklas Cassel A command that has ERR_STAT set, does not get to clear PxCI. See AHCI 1.3.1, section 5.3.8, states RegFIS:Entry and RegFIS:ClearCI, and 5.3.16.5 ERR:FatalTaskfile. Some tests, e.g. test_atapi_tray() call ahci_atapi_test_ready() with ready == false, intentionally sending a

[PATCH 4/5] libqos/ahci: improve ahci_port_check_error()

2023-06-08 Thread Niklas Cassel
From: Niklas Cassel Improve ahci_port_check_error() to also assert that PxIS.TFES is set when expecting errors. Signed-off-by: Niklas Cassel --- tests/qtest/libqos/ahci.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/qtest/libqos/ahci.c b/tests

[PATCH 1/5] libqos/ahci: fix ahci_command_wait()

2023-06-08 Thread Niklas Cassel
From: Niklas Cassel A command that has ERR_STAT set, does not get to clear PxCI. See AHCI 1.3.1, section 5.3.8, states RegFIS:Entry and RegFIS:ClearCI, and 5.3.16.5 ERR:FatalTaskfile. Some tests, e.g. test_atapi_tray() call ahci_atapi_test_ready() with ready == false, intentionally sending a

[PATCH 0/5] improve ahci test suite

2023-06-08 Thread Niklas Cassel
From: Niklas Cassel Hello John, This series should be applied on top of the series called: "[PATCH v2 0/8] misc AHCI cleanups" which can be found here: https://lists.nongnu.org/archive/html/qemu-block/2023-06/msg00038.html This series improves the ahci test suite to be in line wit

Re: [PATCH v2 5/8] hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set

2023-06-07 Thread Niklas Cassel
On Wed, Jun 07, 2023 at 06:01:17PM +0200, Niklas Cassel wrote: > On Mon, Jun 05, 2023 at 08:19:43PM -0400, John Snow wrote: > > On Thu, Jun 1, 2023 at 9:46 AM Niklas Cassel wrote: > > > > > > From: Niklas Cassel > > > > > > For NCQ, PxCI is cleared

Re: [PATCH v2 5/8] hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set

2023-06-07 Thread Niklas Cassel
On Mon, Jun 05, 2023 at 08:19:43PM -0400, John Snow wrote: > On Thu, Jun 1, 2023 at 9:46 AM Niklas Cassel wrote: > > > > From: Niklas Cassel > > > > For NCQ, PxCI is cleared on command queued successfully. > > For non-NCQ, PxCI is cleared on command completed suc

Re: [PATCH 1/1] hw/ide/core.c: fix handling of unsupported commands

2023-06-01 Thread Niklas Cassel
On Wed, May 24, 2023 at 11:20:41AM -0400, John Snow wrote: > On Wed, May 24, 2023, 4:17 AM Niklas Cassel wrote: > > > On Tue, May 23, 2023 at 10:35:56AM -0400, John Snow wrote: > > > On Mon, May 22, 2023 at 5:16???PM Mateusz Albecki < > > mateusz.p.

Re: [PATCH 0/9] misc AHCI cleanups

2023-06-01 Thread Niklas Cassel
On Wed, May 17, 2023 at 01:06:06PM -0400, John Snow wrote: > On Fri, Apr 28, 2023 at 9:22 AM Niklas Cassel wrote: > > > > From: Niklas Cassel > > > > Hello John, > > > > Hi Niklas! > > I haven't been actively involved with AHCI for a while, so

[PATCH v2 8/8] hw/ide/ahci: fix broken SError handling

2023-06-01 Thread Niklas Cassel
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

[PATCH v2 5/8] hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set

2023-06-01 Thread Niklas Cassel
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

[PATCH v2 6/8] hw/ide/ahci: PxSACT and PxCI is cleared when PxCMD.ST is cleared

2023-06-01 Thread Niklas Cassel
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 clea

[PATCH v2 7/8] hw/ide/ahci: fix ahci_write_fis_sdb()

2023-06-01 Thread Niklas Cassel
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

[PATCH v2 3/8] hw/ide/ahci: write D2H FIS on when processing NCQ command

2023-06-01 Thread Niklas Cassel
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 zer

[PATCH v2 4/8] hw/ide/ahci: simplify and document PxCI handling

2023-06-01 Thread Niklas Cassel
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

[PATCH v2 2/8] hw/ide/core: set ERR_STAT in unsupported command completion

2023-06-01 Thread Niklas Cassel
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

[PATCH v2 1/8] hw/ide/ahci: remove stray backslash

2023-06-01 Thread Niklas Cassel
From: Niklas Cassel This backslash obviously does not belong here, so remove it. Signed-off-by: Niklas Cassel Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: John Snow --- hw/ide/ahci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index

[PATCH v2 0/8] misc AHCI cleanups

2023-06-01 Thread Niklas Cassel
From: Niklas Cassel Hello John, Here comes some misc AHCI cleanups. Most are related to error handling. Please review. (I'm also working on a second series which will add support for READ LOG EXT and READ LOG DMA EXT, but I will send that one out once it is ready. (It might take a coup

Re: [PATCH 2/9] hw/ide/core: set ERR_STAT in unsupported command completion

2023-06-01 Thread Niklas Cassel
On Wed, May 17, 2023 at 05:12:57PM -0400, John Snow wrote: > On Fri, Apr 28, 2023 at 9:22 AM Niklas Cassel wrote: > > > > From: Niklas Cassel > > > > Currently, the first time sending an unsupported command > > (e.g. READ LOG DMA EXT) will not have ERR_STAT set i

Re: [PATCH 1/1] hw/ide/core.c: fix handling of unsupported commands

2023-05-24 Thread Niklas Cassel
On Tue, May 23, 2023 at 10:35:56AM -0400, John Snow wrote: > On Mon, May 22, 2023 at 5:16???PM Mateusz Albecki > > wrote: > > > > Certainly seems like my patch is wrong as it will make the abort path > execute ide_cmd_done twice. During debug I came to the conclusion that > ide_cmd_done is not ca

[PATCH 9/9] hw/ide/ahci: fix broken SError handling

2023-04-28 Thread Niklas Cassel
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

[PATCH 7/9] hw/ide/ahci: trigger either error IRQ or regular IRQ, not both

2023-04-28 Thread Niklas Cassel
From: Niklas Cassel According to AHCI 1.3.1, 5.3.8.1 RegFIS: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 a normal IRQ after having sent an error IRQ

[PATCH 6/9] hw/ide/ahci: PxSACT and PxCI is cleared when PxCMD.ST is cleared

2023-04-28 Thread Niklas Cassel
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 clea

[PATCH 2/9] hw/ide/core: set ERR_STAT in unsupported command completion

2023-04-28 Thread Niklas Cassel
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

[PATCH 5/9] hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set

2023-04-28 Thread Niklas Cassel
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

[PATCH 4/9] hw/ide/ahci: simplify and document PxCI handling

2023-04-28 Thread Niklas Cassel
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

[PATCH 1/9] hw/ide/ahci: remove stray backslash

2023-04-28 Thread Niklas Cassel
From: Niklas Cassel This backslash obviously does not belong here, so remove it. Signed-off-by: Niklas Cassel --- hw/ide/ahci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index 55902e1df7..a36e3fb77c 100644 --- a/hw/ide/ahci.c +++ b/hw

[PATCH 3/9] hw/ide/ahci: write D2H FIS on when processing NCQ command

2023-04-28 Thread Niklas Cassel
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 zer

[PATCH 8/9] hw/ide/ahci: fix ahci_write_fis_sdb()

2023-04-28 Thread Niklas Cassel
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

[PATCH 0/9] misc AHCI cleanups

2023-04-28 Thread Niklas Cassel
From: Niklas Cassel Hello John, Here comes some misc AHCI cleanups. Most are related to error handling. Please review. (I'm also working on a second series which will add support for READ LOG EXT and READ LOG DMA EXT, but I will send that one out once it is ready.) Kind regards, N

[PATCH] hw/nvme: remove param zoned.auto_transition

2022-08-12 Thread Niklas Cassel via
upposed to be optional, as then the whole point of having implictly open zones would be pointless. Therefore, remove the param zoned.auto_transition, as this was never supposed to be controller implementation specific. Signed-off-by: Niklas Cassel --- hw/nvme/ctrl.c | 35 --

Re: [PATCH] hw/nvme: force nvme-ns param 'shared' to false if no nvme-subsys node

2022-06-28 Thread Niklas Cassel
On Tue, Jun 28, 2022 at 02:22:09PM +0200, Niklas Cassel via wrote: Hello Peter, It seems that mailman configuration on qemu-devel is rewriting the "From:" field to "From: Niklas Cassel via " If found this old thread about the same issue: https://qemu-devel.nongnu.narkive.

[PATCH] hw/nvme: force nvme-ns param 'shared' to false if no nvme-subsys node

2022-06-28 Thread Niklas Cassel via
ed to more than one controller, so for this configuration, it is counterintuitive for this parameter to be set by default. Force the nvme-ns param 'shared' to false for configurations where there is no nvme-subsys node, as the namespace will never be able to attach to more than one controll

[PATCH] hw/nvme: fix example serial in documentation

2022-06-27 Thread Niklas Cassel via
hat people copying the qemu command line example won't get an error on qemu start. Signed-off-by: Niklas Cassel --- docs/system/devices/nvme.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/system/devices/nvme.rst b/docs/system/devices/nvme.rst index aba2533

[PATCH v2 3/4] hw/nvme: add support for ratified TP4084

2022-06-27 Thread Niklas Cassel via
(The controllers are enabled by SeaBIOS by default.) We could introduce a reset_time param, but this would only increase the chances that all controllers are in reset at the same time. Signed-off-by: Niklas Cassel --- hw/nvme/ctrl.c | 123 +-- hw/

[PATCH v2 4/4] hw/nvme: add new never_ready parameter to test the DNR bit

2022-06-27 Thread Niklas Cassel via
emulate a namespace that never gets ready, such that the DNR bit gets set after CRWMT amount of time. Signed-off-by: Niklas Cassel --- hw/nvme/ctrl.c | 28 +++- hw/nvme/ns.c | 1 + hw/nvme/nvme.h | 2 ++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/h

[PATCH v2 1/4] hw/nvme: claim NVMe 2.0 compliance

2022-06-27 Thread Niklas Cassel via
both CRMS.CRIMS and CRMS.CRWMS is set. Signed-off-by: Niklas Cassel --- hw/nvme/ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index f8ec4a7be3..8ca824ea14 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -204,7 +204,7 @@ #d

[PATCH v2 2/4] hw/nvme: store a pointer to the NvmeSubsystem in the NvmeNamespace

2022-06-27 Thread Niklas Cassel via
Each NvmeNamespace can be used by serveral controllers, but a NvmeNamespace can at most belong to a single NvmeSubsystem. Store a pointer to the NvmeSubsystem, if the namespace was realized with a NvmeSubsystem. This will be used by a follow up patch. Signed-off-by: Niklas Cassel --- hw/nvme

[PATCH v2 0/4] hw/nvme: add support for TP4084

2022-06-27 Thread Niklas Cassel via
v1: -Rebased on nvme-next -Set id_indep_ns->nmic if ns->params.shared in patch 3/4. Niklas Cassel (4): hw/nvme: claim NVMe 2.0 compliance hw/nvme: store a pointer to the NvmeSubsystem in the NvmeNamespace hw/nvme: add support for ratified TP4084 hw/nvme: add new never_ready paramete

[PATCH 4/4] hw/nvme: add new never_ready parameter to test the DNR bit

2022-06-07 Thread Niklas Cassel via
emulate a namespace that never gets ready, such that the DNR bit gets set after CRWMT amount of time. Signed-off-by: Niklas Cassel --- hw/nvme/ctrl.c | 28 +++- hw/nvme/ns.c | 1 + hw/nvme/nvme.h | 2 ++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/h

[PATCH 1/4] hw/nvme: claim NVMe 2.0 compliance

2022-06-07 Thread Niklas Cassel via
both CRMS.CRIMS and CRMS.CRWMS is set. Signed-off-by: Niklas Cassel --- hw/nvme/ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 1e6e0fcad9..91469834b0 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -168,7 +168,7 @@ #d

[PATCH 2/4] hw/nvme: store a pointer to the NvmeSubsystem in the NvmeNamespace

2022-06-07 Thread Niklas Cassel via
Each NvmeNamespace can be used by serveral controllers, but a NvmeNamespace can at most belong to a single NvmeSubsystem. Store a pointer to the NvmeSubsystem, if the namespace was realized with a NvmeSubsystem. This will be used by a follow up patch. Signed-off-by: Niklas Cassel --- hw/nvme

[PATCH 3/4] hw/nvme: add support for ratified TP4084

2022-06-07 Thread Niklas Cassel via
(The controllers are enabled by SeaBIOS by default.) We could introduce a reset_time param, but this would only increase the chances that all controllers are in reset at the same time. Signed-off-by: Niklas Cassel --- hw/nvme/ctrl.c | 123 +-- hw

[PATCH 0/4] hw/nvme: add support for TP4084

2022-06-07 Thread Niklas Cassel via
nvme,serial=deadbeef,crwmt=$CRWMT \ -drive file=$NS1_DATA,id=nvm-1,format=raw,if=none \ -device nvme-ns,drive=nvm-1,ready_delay=$NS1_DELAY \ -drive file=$NS2_DATA,id=nvm-2,format=raw,if=none \ -device nvme-ns,drive=nvm-2,ready_delay=$NS2_DELAY \ Nik

[PATCH] hw/riscv: virt: fix DT property mmu-type when CPU mmu option is disabled

2022-04-14 Thread Niklas Cassel via
o "riscv,none" when the CPU mmu option is disabled using rv32,mmu=off or rv64,mmu=off. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/riscv/cpus.yaml?h=v5.17 Signed-off-by: Niklas Cassel --- hw/riscv/virt.c | 10 +

Re: [PATCH] hw/nvme: add param to control auto zone transitioning to zone state closed

2021-06-07 Thread Niklas Cassel
On Mon, Jun 07, 2021 at 11:54:02AM +0200, Klaus Jensen wrote: > On Jun 1 07:30, Niklas Cassel wrote: > > On Mon, May 31, 2021 at 09:39:20PM +0200, Klaus Jensen wrote: > > > On May 31 15:42, Niklas Cassel wrote: > > > > On Fri, May 28, 2021 at 01:22:38PM +0200, Klaus

Re: [PATCH] hw/nvme: add param to control auto zone transitioning to zone state closed

2021-06-01 Thread Niklas Cassel
On Mon, May 31, 2021 at 09:39:20PM +0200, Klaus Jensen wrote: > On May 31 15:42, Niklas Cassel wrote: > > On Fri, May 28, 2021 at 01:22:38PM +0200, Klaus Jensen wrote: > > > On May 28 11:05, Niklas Cassel wrote: > > > > From: Niklas Cassel > > > >

Re: [PATCH] hw/nvme: add param to control auto zone transitioning to zone state closed

2021-05-31 Thread Niklas Cassel
On Fri, May 28, 2021 at 01:22:38PM +0200, Klaus Jensen wrote: > On May 28 11:05, Niklas Cassel wrote: > > From: Niklas Cassel > > > > In the Zoned Namespace Command Set Specification, chapter > > 2.5.1 Managing resources > > > > "The controller may tr

[PATCH] hw/nvme: add param to control auto zone transitioning to zone state closed

2021-05-28 Thread Niklas Cassel
From: Niklas Cassel In the Zoned Namespace Command Set Specification, chapter 2.5.1 Managing resources "The controller may transition zones in the ZSIO:Implicitly Opened state to the ZSC:Closed state for resource management purposes." The word may in this sentence means that aut

Re: [PATCH] hw/block/nvme: remove description for zoned.append_size_limit

2021-03-30 Thread Niklas Cassel
On Tue, Mar 23, 2021 at 12:20:32PM +0100, Klaus Jensen wrote: > On Mar 23 11:18, Niklas Cassel wrote: > > From: Niklas Cassel > > > > The description was originally removed in commit 578d914b263c > > ("hw/block/nvme: align zoned.zasl with mdts")

[PATCH] hw/block/nvme: remove description for zoned.append_size_limit

2021-03-23 Thread Niklas Cassel
From: Niklas Cassel The description was originally removed in commit 578d914b263c ("hw/block/nvme: align zoned.zasl with mdts") together with the removal of the zoned.append_size_limit parameter itself. However, it was (most likely accidentally), re-added in commit f7dcd31885cb (&quo

Re: [RFC PATCH V3 8/8] hw/block/nvme: Add Identify Active Namespace ID List

2021-01-21 Thread Niklas Cassel
On Thu, Jan 21, 2021 at 06:58:19AM +0900, Minwoo Im wrote: > > Hello Minwoo, > > > > By introducing a detached parameter, > > you are also implicitly making the following > > NVMe commands no longer be spec compliant: > > > > NVME_ID_CNS_NS, NVME_ID_CNS_CS_NS, > > NVME_ID_CNS_NS_ACTIVE_LIST, NVME

Re: [RFC PATCH V3 8/8] hw/block/nvme: Add Identify Active Namespace ID List

2021-01-20 Thread Niklas Cassel
On Wed, Jan 20, 2021 at 02:01:47AM +0900, Minwoo Im wrote: > Spec v1.4b 6.1.4 "Active and Inactive NSID Types" says: > > "Active NSIDs for a controller refer to namespaces that are attached to > that controller. Allocated NSIDs that are inactive for a controller refer > to namespaces that are not

Re: [PATCH 0/2] hw/block/nvme: zoned fixes

2021-01-20 Thread Niklas Cassel
changed, 48 insertions(+), 46 deletions(-) > > -- > 2.30.0 > > For the series: Tested-by: Niklas Cassel

NVMe ZNS zone append past zone size?

2021-01-19 Thread Niklas Cassel
Hello all, When testing with the ZNS code that is in nvme-next, I can zone append, targeting the first zone by specifying zslba 0, and then just put that call it in a while loop, it will manage to fill up not just zone0, but the whole drive. Since zslba is defined as: "Zone Start Logical Block A

Re: [PATCH v9 08/12] hw/block/nvme: Support Zoned Namespace Command Set

2020-11-06 Thread Niklas Cassel
se > done as a part of Write flow. > > Subsequent commits in this series add ZDE support and checks for > active and open zone limits. > > Signed-off-by: Niklas Cassel > Signed-off-by: Hans Holmberg > Signed-off-by: Ajay Joshi > Signed-off-by: Chaitanya Kulkarni > Si

Re: [PATCH v8 07/11] hw/block/nvme: Support Zoned Namespace Command Set

2020-10-30 Thread Niklas Cassel
se > done as a part of Write flow. > > Subsequent commits in this series add ZDE support and checks for > active and open zone limits. > > Signed-off-by: Niklas Cassel > Signed-off-by: Hans Holmberg > Signed-off-by: Ajay Joshi > Signed-off-by: Chaitanya Kulkarni > Si

Re: [PATCH v7 00/11] hw/block/nvme: Support Namespace Types and Zoned Namespace Command Set

2020-10-19 Thread Niklas Cassel
e: Merge nvme_write_zeroes() with nvme_write() > > Niklas Cassel (2): > hw/block/nvme: Add support for Namespace Types > hw/block/nvme: Support allocated CNS command variants > > block/nvme.c |2 +- > hw/block/nvme-ns.c| 295 > hw/bloc

Re: [PATCH v6 03/11] hw/block/nvme: Add support for Namespace Types

2020-10-14 Thread Niklas Cassel
On Wed, Oct 14, 2020 at 06:42:04AM +0900, Dmitry Fomichev wrote: > From: Niklas Cassel > > Define the structures and constants required to implement > Namespace Types support. > > Namespace Types introduce a new command set, "I/O Command Sets", > that allows t

Re: [PATCH v6 01/11] hw/block/nvme: Add Commands Supported and Effects log

2020-10-14 Thread Niklas Cassel
On Tue, Oct 13, 2020 at 05:50:34PM -0700, Keith Busch wrote: > On Wed, Oct 14, 2020 at 06:42:02AM +0900, Dmitry Fomichev wrote: > > +{ > > +NvmeEffectsLog log = {}; > > +uint32_t *dst_acs = log.acs, *dst_iocs = log.iocs; > > +uint32_t trans_len; > > +int i; > > + > > +trace_pci_

Re: [PATCH v6 05/11] hw/block/nvme: Support Zoned Namespace Command Set

2020-10-14 Thread Niklas Cassel
se > done as a part of Write flow. > > Subsequent commits in this series add ZDE support and checks for > active and open zone limits. > > Signed-off-by: Niklas Cassel > Signed-off-by: Hans Holmberg > Signed-off-by: Ajay Joshi > Signed-off-by: Chaitanya Kulkarni > Si

Re: [PATCH v5 09/14] hw/block/nvme: Support Zoned Namespace Command Set

2020-10-05 Thread Niklas Cassel
On Sun, Oct 04, 2020 at 11:57:07PM +, Dmitry Fomichev wrote: > On Wed, 2020-09-30 at 14:50 +0000, Niklas Cassel wrote: > > On Mon, Sep 28, 2020 at 11:35:23AM +0900, Dmitry Fomichev wrote: > > > The emulation code has been changed to advertise NVM Command Set when > > &

Re: [PATCH v5 06/14] hw/block/nvme: Add support for active/inactive namespaces

2020-10-05 Thread Niklas Cassel
On Sun, Oct 04, 2020 at 11:54:13PM +, Dmitry Fomichev wrote: > On Wed, 2020-09-30 at 13:50 +0000, Niklas Cassel wrote: > > On Mon, Sep 28, 2020 at 11:35:20AM +0900, Dmitry Fomichev wrote: > > > From: Niklas Cassel > > > > > > In NVMe, a namespace is active

Re: [PATCH v5 05/14] hw/block/nvme: Add support for Namespace Types

2020-10-01 Thread Niklas Cassel
On Thu, Oct 01, 2020 at 08:59:31AM -0700, Keith Busch wrote: > On Thu, Oct 01, 2020 at 03:50:35PM +0000, Niklas Cassel wrote: > > On Thu, Oct 01, 2020 at 09:29:22AM -0600, Keith Busch wrote: > > > On Thu, Oct 01, 2020 at 11:22:46AM +0000, Niklas Cassel wrote: > > > >

Re: [PATCH v5 05/14] hw/block/nvme: Add support for Namespace Types

2020-10-01 Thread Niklas Cassel
On Thu, Oct 01, 2020 at 09:29:22AM -0600, Keith Busch wrote: > On Thu, Oct 01, 2020 at 11:22:46AM +0000, Niklas Cassel wrote: > > On Mon, Sep 28, 2020 at 11:35:19AM +0900, Dmitry Fomichev wrote: > > > From: Niklas Cassel > > > @@ -,6 +2328,30 @@ static void nvme_wr

Re: [PATCH v5 05/14] hw/block/nvme: Add support for Namespace Types

2020-10-01 Thread Niklas Cassel
On Mon, Sep 28, 2020 at 11:35:19AM +0900, Dmitry Fomichev wrote: > From: Niklas Cassel > > Namespace Types introduce a new command set, "I/O Command Sets", > that allows the host to retrieve the command sets associated with > a namespace. Introduce support for t

Re: [PATCH v5 09/14] hw/block/nvme: Support Zoned Namespace Command Set

2020-09-30 Thread Niklas Cassel
mit doesn't yet include checks for active and open zone > limits. It is assumed that there are no limits on either active or > open zones. > > Signed-off-by: Niklas Cassel > Signed-off-by: Hans Holmberg > Signed-off-by: Ajay Joshi > Signed-off-by: Chaitanya Kulkarni

Re: [PATCH v5 09/14] hw/block/nvme: Support Zoned Namespace Command Set

2020-09-30 Thread Niklas Cassel
mit doesn't yet include checks for active and open zone > limits. It is assumed that there are no limits on either active or > open zones. > > Signed-off-by: Niklas Cassel > Signed-off-by: Hans Holmberg > Signed-off-by: Ajay Joshi > Signed-off-by: Chaitanya Kulkarni

Re: [PATCH v5 06/14] hw/block/nvme: Add support for active/inactive namespaces

2020-09-30 Thread Niklas Cassel
On Mon, Sep 28, 2020 at 11:35:20AM +0900, Dmitry Fomichev wrote: > From: Niklas Cassel > > In NVMe, a namespace is active if it exists and is attached to the > controller. > > CAP.CSS (together with the I/O Command Set data structure) defines what > command sets are suppor

Re: [PATCH v5 05/14] hw/block/nvme: Add support for Namespace Types

2020-09-30 Thread Niklas Cassel
On Mon, Sep 28, 2020 at 11:35:19AM +0900, Dmitry Fomichev wrote: > From: Niklas Cassel > > Namespace Types introduce a new command set, "I/O Command Sets", > that allows the host to retrieve the command sets associated with > a namespace. Introduce support for t

Re: [PATCH v4 06/14] hw/block/nvme: Add support for active/inactive namespaces

2020-09-24 Thread Niklas Cassel
On Thu, Sep 24, 2020 at 08:55:24PM +0200, Klaus Jensen wrote: > On Sep 24 18:17, Niklas Cassel wrote: > > On Thu, Sep 24, 2020 at 02:12:03PM +0200, Klaus Jensen wrote: > > > On Sep 24 03:20, Dmitry Fomichev wrote: > > > > From: Niklas Cassel > > > > >

Re: [PATCH v4 06/14] hw/block/nvme: Add support for active/inactive namespaces

2020-09-24 Thread Niklas Cassel
On Thu, Sep 24, 2020 at 02:12:03PM +0200, Klaus Jensen wrote: > On Sep 24 03:20, Dmitry Fomichev wrote: > > From: Niklas Cassel > > > > E.g., if the user sets CC.CSS to Admin Only, NVM namespaces should be > > marked as inactive. > > > > Hmm. I'm

Re: [PATCH v2 05/18] hw/block/nvme: Introduce the Namespace Types definitions

2020-06-30 Thread Niklas Cassel
On Tue, Jun 30, 2020 at 06:57:16AM +0200, Klaus Jensen wrote: > On Jun 18 06:34, Dmitry Fomichev wrote: > > From: Niklas Cassel > > > > Define the structures and constants required to implement > > Namespace Types support. > > > > Signed-off-by: Niklas Cas

Re: [PATCH 00/10] hw/block/nvme: namespace types and zoned namespaces

2020-06-30 Thread Niklas Cassel
On Tue, Jun 30, 2020 at 12:01:29PM +0200, Klaus Jensen wrote: > From: Klaus Jensen > > Hi all, Hello Klaus, > > This series adds support for TP 4056 ("Namespace Types") and TP 4053 > ("Zoned Namespaces") and is an alternative implementation to the one > submitted by Dmitry[1]. > > While I don

Re: [PATCH v2 05/18] hw/block/nvme: Introduce the Namespace Types definitions

2020-06-30 Thread Niklas Cassel
On Mon, Jun 29, 2020 at 07:12:47PM -0700, Alistair Francis wrote: > On Wed, Jun 17, 2020 at 2:47 PM Dmitry Fomichev > wrote: > > > > From: Niklas Cassel > > > > Define the structures and constants required to implement > > Namespace Types support.