Re: [PATCH] nvme: report id controller metadata sgl support

2024-09-23 Thread Keith Busch
On Fri, Aug 30, 2024 at 12:11:57PM -0700, Keith Busch wrote: > From: Keith Busch > > The controller already supports this decoding, so just set the > ID_CTRL.SGLS field accordingly. Hi Klaus, any concerns with this one? > diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c >

Re: [PATCH v11 02/10] block/raw: add persistent reservation in/out driver

2024-09-09 Thread Keith Busch
On Mon, Sep 09, 2024 at 07:34:45PM +0800, Changqi Lu wrote: > +static int coroutine_fn GRAPH_RDLOCK > +raw_co_pr_register(BlockDriverState *bs, uint64_t old_key, > + uint64_t new_key, BlockPrType type, > + bool ptpl, bool ignore_key) > +{ > +return bdrv_co_pr

[PATCH] nvme: report id controller metadata sgl support

2024-08-30 Thread Keith Busch
From: Keith Busch The controller already supports this decoding, so just set the ID_CTRL.SGLS field accordingly. Signed-off-by: Keith Busch --- hw/nvme/ctrl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 5b1b0cabcf..68d4c19eda

Re: [PATCH] hw/nvme: Add support for setting the MQES for the NVMe emulation

2024-04-04 Thread Keith Busch
create_sq() was getting its limit from when processing the host command, and sure enough it's directly from the register field. Reviewed-by: Keith Busch

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

2023-07-18 Thread Keith Busch
did not fix little-endian guests > on big-endian hosts. Fix this. > > Solves issue #1765. > > Fixes: 3f7fe8de3d49 ("hw/nvme: Implement shadow doorbell buffer support") > Cc: qemu-sta...@nongnu.org > Reported-by: Thomas Huth > Signed-off-by: Klaus Jensen Looks good! Reviewed-by: Keith Busch

Re: [PATCH v2 5/5] hw/nvme: flexible data placement emulation

2023-02-17 Thread Keith Busch
nlb); > + > +while (nlb) { > +if (nlb < ru->ruamw) { > +ru->ruamw -= nlb; > +break; > +} > + > +nlb -= ru->ruamw; > +//trace_pci_nvme_fdp_ruh_change(ruh->rgid, ruh->ruhid); Please use the trace points if you find them useful, otherwise just delete them instead of committing commented out code. Beyond that, looks good! For the series: Reviewed-by: Keith Busch

Re: [PATCH 5/5] hw/nvme: flexible data placement emulation

2023-02-16 Thread Keith Busch
On Thu, Feb 16, 2023 at 05:48:06PM +0100, Jesper Devantier wrote: > +static bool nvme_ns_init_fdp(NvmeNamespace *ns, Error **errp) > +{ > +NvmeEnduranceGroup *endgrp = ns->endgrp; > +NvmeRuHandle *ruh; > +uint8_t lbafi = NVME_ID_NS_FLBAS_INDEX(ns->id_ns.flbas); > +unsigned int *ruhi

Re: [PATCH 5/5] hw/nvme: flexible data placement emulation

2023-02-16 Thread Keith Busch
This mostly looks fine. I need to clarify some spec decisions, though. By default, FDP feature is disabled: "The default value of this Feature shall be 0h." You can't change the value as long as namespaces exist within the group, so FDP requires NS Mgmt be supported if you're going to enable it. T

Re: [PATCH 4/5] hw/nvme: basic directives support

2023-02-16 Thread Keith Busch
On Thu, Feb 16, 2023 at 06:35:27PM +0100, Klaus Jensen wrote: > On Thu, Feb 16, 2023, at 18:23, Keith Busch wrote: > > On Thu, Feb 16, 2023 at 05:48:05PM +0100, Jesper Devantier wrote: > >> +enum NvmeDirective { > >> +NVME_DIRECTIVE_SUPPORTED = 0x0, > >>

Re: [PATCH 4/5] hw/nvme: basic directives support

2023-02-16 Thread Keith Busch
On Thu, Feb 16, 2023 at 05:48:05PM +0100, Jesper Devantier wrote: > +enum NvmeDirective { > +NVME_DIRECTIVE_SUPPORTED = 0x0, > +NVME_DIRECTIVE_ENABLED = 0x1, > +}; What's this?

Re: completion timeouts with pin-based interrupts in QEMU hw/nvme

2023-01-18 Thread Keith Busch
On Thu, Jan 19, 2023 at 01:10:57PM +1000, Alistair Francis wrote: > On Thu, Jan 19, 2023 at 12:44 PM Keith Busch wrote: > > > > Further up, it says the "interrupt gateway" is responsible for > > forwarding new interrupt requests while the level remains asserte

Re: completion timeouts with pin-based interrupts in QEMU hw/nvme

2023-01-18 Thread Keith Busch
On Thu, Jan 19, 2023 at 10:41:42AM +1000, Alistair Francis wrote: > On Thu, Jan 19, 2023 at 9:07 AM Keith Busch wrote: > > --- > > diff --git a/hw/intc/sifive_plic.c b/hw/intc/sifive_plic.c > > index c2dfacf028..f8f7af08dc 100644 > > --- a/hw/intc/sifive_plic.c >

Re: completion timeouts with pin-based interrupts in QEMU hw/nvme

2023-01-18 Thread Keith Busch
On Wed, Jan 18, 2023 at 09:33:05AM -0700, Keith Busch wrote: > On Wed, Jan 18, 2023 at 03:04:06PM +, Peter Maydell wrote: > > On Tue, 17 Jan 2023 at 19:21, Guenter Roeck wrote: > > > Anyway - any idea what to do to help figuring out what is happening ? > > >

Re: completion timeouts with pin-based interrupts in QEMU hw/nvme

2023-01-18 Thread Keith Busch
Klaus, This isn't going to help your issue, but there are at least two legacy irq bugs in the nvme qemu implementation. 1. The admin queue breaks if start with legacy and later initialize msix. 2. The legacy vector is shared among all queues, but it's being deasserted when the first queue's door

Re: completion timeouts with pin-based interrupts in QEMU hw/nvme

2023-01-18 Thread Keith Busch
On Wed, Jan 18, 2023 at 03:04:06PM +, Peter Maydell wrote: > On Tue, 17 Jan 2023 at 19:21, Guenter Roeck wrote: > > Anyway - any idea what to do to help figuring out what is happening ? > > Add tracing support to pci interrupt handling, maybe ? > > For intermittent bugs, I like recording the

Re: completion timeouts with pin-based interrupts in QEMU hw/nvme

2023-01-17 Thread Keith Busch
On Thu, Jan 12, 2023 at 02:10:51PM +0100, Klaus Jensen wrote: > Hi all (linux-nvme, qemu-devel, maintainers), > > On QEMU riscv64, which does not use MSI/MSI-X and thus relies on > pin-based interrupts, I'm seeing occasional completion timeouts, i.e. > > nvme nvme0: I/O 333 QID 1 timeout, compl

Re: completion timeouts with pin-based interrupts in QEMU hw/nvme

2023-01-16 Thread Keith Busch
On Mon, Jan 16, 2023 at 10:14:07PM +0100, Klaus Jensen wrote: > I noticed that the Linux driver does not use the INTMS/INTMC registers > to mask interrupts on the controller while processing CQEs. While not > required by the spec, it is *recommended* in setups not using MSI-X to > reduce the risk o

Re: completion timeouts with pin-based interrupts in QEMU hw/nvme

2023-01-13 Thread Keith Busch
On Fri, Jan 13, 2023 at 12:32:29PM +, Peter Maydell wrote: > On Fri, 13 Jan 2023 at 08:55, Klaus Jensen wrote: > > > > +CC qemu pci maintainers > > > > Michael, Marcel, > > > > Do you have any comments on this thread? As you can see one solution is > > to simply deassert prior to asserting, th

Re: completion timeouts with pin-based interrupts in QEMU hw/nvme

2023-01-12 Thread Keith Busch
On Thu, Jan 12, 2023 at 06:45:55PM +0100, Klaus Jensen wrote: > On Jan 12 09:34, Keith Busch wrote: > > On Thu, Jan 12, 2023 at 02:10:51PM +0100, Klaus Jensen wrote: > > > > > > The pin-based interrupt logic in hw/nvme seems sound enough to me, so I > > > am w

Re: completion timeouts with pin-based interrupts in QEMU hw/nvme

2023-01-12 Thread Keith Busch
On Thu, Jan 12, 2023 at 06:45:55PM +0100, Klaus Jensen wrote: > On Jan 12 09:34, Keith Busch wrote: > > On Thu, Jan 12, 2023 at 02:10:51PM +0100, Klaus Jensen wrote: > > > > > > The pin-based interrupt logic in hw/nvme seems sound enough to me, so I > > > am w

Re: completion timeouts with pin-based interrupts in QEMU hw/nvme

2023-01-12 Thread Keith Busch
On Thu, Jan 12, 2023 at 02:10:51PM +0100, Klaus Jensen wrote: > > The pin-based interrupt logic in hw/nvme seems sound enough to me, so I > am wondering if there is something going on with the kernel driver (but > I certainly do not rule out that hw/nvme is at fault here, since > pin-based interru

Re: [PATCH v4 1/2] hw/nvme: Support for Namespaces Management from guest OS - create-ns

2022-12-28 Thread Keith Busch
On Wed, Dec 28, 2022 at 01:41:40PM -0600, Jonathan Derrick wrote: > +static uint16_t nvme_ns_mgmt(NvmeCtrl *n, NvmeRequest *req) > +{ > +NvmeCtrl *n_p = NULL; /* primary controller */ > +NvmeIdCtrl *id = &n->id_ctrl; > +NvmeNamespace *ns; > +NvmeIdNsMgmt id_ns = {}; > +uint8

Re: [PATCH v4 2/4] hw/nvme: rename shadow doorbell related trace events

2022-12-14 Thread Keith Busch
ad respectively). > > Reviewed-by: Philippe Mathieu-Daudé > Signed-off-by: Klaus Jensen Looks good. Reviewed-by: Keith Busch

Re: [PATCH v4 3/4] hw/nvme: fix missing endian conversions for doorbell buffers

2022-12-14 Thread Keith Busch
sta...@nongnu.org > Reported-by: Guenter Roeck > Signed-off-by: Klaus Jensen Looks good. Reviewed-by: Keith Busch

Re: [PATCH v4 4/4] hw/nvme: fix missing cq eventidx update

2022-12-14 Thread Keith Busch
rted by Guenter. > > Adding the missing update to the cq eventidx fixes the issue. > > Fixes: 3f7fe8de3d49 ("hw/nvme: Implement shadow doorbell buffer support") > Cc: qemu-sta...@nongnu.org > Cc: qemu-ri...@nongnu.org > Reported-by: Guenter Roeck > Signed-off-by: Klaus Jensen Looks good. Reviewed-by: Keith Busch

Re: [PULL for-7.2 0/5] hw/nvme fixes

2022-12-04 Thread Keith Busch
On Sun, Dec 04, 2022 at 11:06:13AM -0500, Stefan Hajnoczi wrote: > On Thu, 1 Dec 2022 at 11:50, Klaus Jensen wrote: > > > > From: Klaus Jensen > > > > Hi, > > > > The following changes since commit c4ffd91aba1c3d878e99a3e7ba8aad4826728ece: > > > > Update VERSION for v7.2.0-rc3 (2022-11-29 18:15

Re: [PATCH for-7.2 1/5] hw/nvme: fix aio cancel in format

2022-11-22 Thread Keith Busch
UBH member from the above struct with this patch. Otherwise looks good. Reviewed-by: Keith Busch

Re: [PATCH v3 1/2] hw/nvme: Support for Namespaces Management from guest OS - create-ns

2022-10-27 Thread Keith Busch
On Thu, Oct 27, 2022 at 01:00:45PM -0500, Jonathan Derrick wrote: > +Parameters: > + > +``auto-ns-path=`` > + If specified indicates a support for dynamic management of nvme namespaces > + by means of nvme create-ns command. This path points > + to the storage area for backend images must exist.

Re: [PATCH] hw/nvme: reenable cqe batching

2022-10-20 Thread Keith Busch
bottom halfs and instead of > calling nvme_post_cqes() immediately (causing an interrupt per cqe), we > defer the call. Nice change, looks good! Timers never did seem to be the best fit for this. Reviewed-by: Keith Busch

[PATCHv3 1/2] block: move bdrv_qiov_is_aligned to file-posix

2022-09-29 Thread Keith Busch
From: Keith Busch There is only user of bdrv_qiov_is_aligned(), so move the alignment function to there and make it static. Signed-off-by: Keith Busch --- block/file-posix.c | 21 + block/io.c | 21 - include/block/block-io.h | 1

[PATCHv3 0/2] qemu direct io alignment fix

2022-09-29 Thread Keith Busch
From: Keith Busch Changes from v2: Split the patch so that the function move is separate from the functional change. This makes it immediately obvious what criteria is changing. (Kevin Wolf) Added received Tested-by tag in the changelog. Keith Busch (2): block: move

[PATCHv3 2/2] block: use the request length for iov alignment

2022-09-29 Thread Keith Busch
From: Keith Busch An iov length needs to be aligned to the logical block size, which may be larger than the memory alignment. Tested-by: Jens Axboe Signed-off-by: Keith Busch --- block/file-posix.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/file-posix.c b

Re: [PATCHv2] block: use the request length for iov alignment

2022-09-29 Thread Keith Busch
On Thu, Sep 29, 2022 at 07:59:50PM +0200, Kevin Wolf wrote: > Am 29.09.2022 um 18:09 hat Keith Busch geschrieben: > > On Fri, Sep 23, 2022 at 08:34:51AM -0700, Keith Busch wrote: > > > > > > An iov length needs to be aligned to the logical block size, which may >

Re: [PATCHv2] block: use the request length for iov alignment

2022-09-29 Thread Keith Busch
On Fri, Sep 23, 2022 at 08:34:51AM -0700, Keith Busch wrote: > > An iov length needs to be aligned to the logical block size, which may > be larger than the memory alignment. And since this is only used with > file-posix backing storage, move the alignment function to there, where &g

[PATCHv2] block: use the request length for iov alignment

2022-09-23 Thread Keith Busch
From: Keith Busch An iov length needs to be aligned to the logical block size, which may be larger than the memory alignment. And since this is only used with file-posix backing storage, move the alignment function to there, where the value of the request_alignment is known to be the file&#

Re: [PATCH] block: use the request length for iov alignment

2022-09-20 Thread Keith Busch
On Wed, Sep 14, 2022 at 11:36:14AM +0100, Kevin Wolf wrote: > Am 13.09.2022 um 15:12 hat Keith Busch geschrieben: > > On Thu, Sep 08, 2022 at 09:45:26AM -0700, Keith Busch wrote: > > > From: Keith Busch > > > > > > An iov length needs to be aligned to the lo

Re: [PATCH] block: use the request length for iov alignment

2022-09-15 Thread Keith Busch
On Wed, Sep 14, 2022 at 11:36:14AM +0100, Kevin Wolf wrote: > Am 13.09.2022 um 15:12 hat Keith Busch geschrieben: > > On Thu, Sep 08, 2022 at 09:45:26AM -0700, Keith Busch wrote: > > > From: Keith Busch > > > > > > An iov length needs to be aligned to the lo

Re: [PATCH] block: use the request length for iov alignment

2022-09-13 Thread Keith Busch
On Tue, Sep 13, 2022 at 03:20:23PM +0100, Damien Le Moal wrote: > On 2022/09/13 15:12, Keith Busch wrote: > > On Thu, Sep 08, 2022 at 09:45:26AM -0700, Keith Busch wrote: > >> From: Keith Busch > >> > >> An iov length needs to be aligned to the logical block

Re: [PATCH] block: use the request length for iov alignment

2022-09-13 Thread Keith Busch
On Tue, Sep 13, 2022 at 03:20:23PM +0100, Damien Le Moal wrote: > On 2022/09/13 15:12, Keith Busch wrote: > > On Thu, Sep 08, 2022 at 09:45:26AM -0700, Keith Busch wrote: > >> From: Keith Busch > >> > >> An iov length needs to be aligned to the logical block

Re: [PATCH] block: use the request length for iov alignment

2022-09-13 Thread Keith Busch
On Thu, Sep 08, 2022 at 09:45:26AM -0700, Keith Busch wrote: > From: Keith Busch > > An iov length needs to be aligned to the logical block size, which may > be larger than the memory alignment. [cc'ing some other interested folks] Any thoughts on this patch? It is fixing an

[PATCH] block: use the request length for iov alignment

2022-09-08 Thread Keith Busch
From: Keith Busch An iov length needs to be aligned to the logical block size, which may be larger than the memory alignment. Signed-off-by: Keith Busch --- block/io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/io.c b/block/io.c index 0a8cbefe86..296d4b49a7

Re: [PATCH v2 2/3] hw/nvme: use KVM irqfd when available

2022-08-26 Thread Keith Busch
On Fri, Aug 26, 2022 at 05:45:21PM +0200, Klaus Jensen wrote: > On Aug 26 09:34, Keith Busch wrote: > > On Fri, Aug 26, 2022 at 11:12:04PM +0800, Jinhao Fan wrote: > > > Use KVM's irqfd to send interrupts when possible. This approach is > > > thread safe. More

Re: [PATCH v2 2/3] hw/nvme: use KVM irqfd when available

2022-08-26 Thread Keith Busch
On Fri, Aug 26, 2022 at 11:12:04PM +0800, Jinhao Fan wrote: > Use KVM's irqfd to send interrupts when possible. This approach is > thread safe. Moreover, it does not have the inter-thread communication > overhead of plain event notifiers since handler callback are called > in the same system call a

Re: [PATCH] hw/nvme: Add helper functions for qid-db conversion

2022-08-02 Thread Keith Busch
On Wed, Aug 03, 2022 at 09:46:05AM +0800, Jinhao Fan wrote: > at 4:54 PM, Klaus Jensen wrote: > > > I am unsure if the compiler will transform that division into the shift > > if it can infer that the divisor is a power of two (it most likely > > will be able to). > > > > But I see no reason to

Re: [PATCH for-7.1 0/3] hw/nvme: misc ioeventfd fixes

2022-07-28 Thread Keith Busch
On Thu, Jul 28, 2022 at 10:25:19AM +0200, Klaus Jensen wrote: > From: Klaus Jensen > > A set of fixes/changes to the ioeventfd support. Series looks good. Reviewed-by: Keith Busch

Re: [PATCH] hw/nvme: Add options to override hardcoded values

2022-07-13 Thread Keith Busch
On Wed, Jul 13, 2022 at 09:11:41PM +0200, Mauricio Sandt wrote: > On 13/07/2022 20:48, Keith Busch wrote: > > I guess I'm missing the bigger picture here. You are supposed to be able to > > retrieve these fields with ioctl's, so not sure what this has to do with > >

Re: [PATCH] hw/nvme: Add options to override hardcoded values

2022-07-13 Thread Keith Busch
On Wed, Jul 13, 2022 at 08:06:26PM +0200, Mauricio Sandt wrote: > My specific use case that required this patch is a piece of malware that used > several IOCTLs to read model, firmware, and nqn from the NVMe attached to the > VM. Modifying that info at the hypervisor level was a much better approac

Re: [PATCH] hw/nvme: Add options to override hardcoded values

2022-07-13 Thread Keith Busch
On Sun, Jun 12, 2022 at 12:35:09AM +0200, Mauricio Sandt wrote: > This small patch is the result of some recent malware research I did > in a QEMU VM. The malware used multiple ways of querying info from > the VM disk and I needed a clean way to change those values from the > hypervisor. > > I bel

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

2022-06-16 Thread Keith Busch
On Thu, Jun 16, 2022 at 12:42:49PM +0200, Klaus Jensen wrote: > On Jun 8 03:28, Niklas Cassel via wrote: > > Hello there, > > > > considering that Linux v5.19-rc1 is out which includes support for > > NVMe TP4084: > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drive

Re: [PATCH] hw/nvme: clear aen mask on reset

2022-06-03 Thread Keith Busch
On Thu, May 12, 2022 at 11:30:55AM +0200, Klaus Jensen wrote: > From: Klaus Jensen > > The internally maintained AEN mask is not cleared on reset. Fix this. Looks good. Reviewed-by: Keith Busch

Re: [PATCH] nvme: remove bit bucket support for now

2022-06-03 Thread Keith Busch
On Fri, Jun 03, 2022 at 10:31:14PM +0200, Klaus Jensen wrote: > Keith, > > We never merged anything to fix this. I suggest we simply revert it and > get rid of the code entirely until *someone* comes up with a proper fix > ;) Yeah, that sounds right. My silly hack was okay for my Linux kernel tes

Re: [PATCH] hw/nvme: Fix deallocate when metadata is present

2022-06-03 Thread Keith Busch
me_dsm_bh() is called which deletes and sets iocb->bh to NULL. When reentry > returns from nvme_dsm_cb(), metadata deallocation takes place again, and > results in a null pointer dereference on the iocb->bh: Nice, thank you for the detailed analysis. Patch looks good. Reviewed-by: Keith Busch

Re: [PATCH v8 00/12] hw/nvme: SR-IOV with Virtualization Enhancements

2022-05-17 Thread Keith Busch
On Tue, May 17, 2022 at 01:04:56PM +0200, Klaus Jensen wrote: > > > > Should we consider this series ready to merge? > > > > Hi Lukasz and Lukasz :) > > Yes, I'm queing this up. FWIW, this looks good to me. I was hoping to give it a test run, but I don't think I'll get to that for another week

Re: [PATCH] nvme: fix bit buckets

2022-04-25 Thread Keith Busch
On Mon, Apr 25, 2022 at 11:59:30AM +0200, Klaus Jensen wrote: > The approach is neat and simple, but I don't think it has the intended > effect. The memory region addr is just left at 0x0, so we just end up > with mapping that directly into the qsg and in my test setup, this > basically does DMA to

[PATCH] nvme: fix bit buckets

2022-04-22 Thread Keith Busch
ocate a memory region to dump unwanted data. Signed-off-by: Keith Busch --- This came out easier than I thought, so we can ignore my previous feature removal patch: https://lists.nongnu.org/archive/html/qemu-block/2022-04/msg00398.html hw/nvme/ctrl.c | 9 + hw/nvme/nvme.h | 1 + 2

[PATCH] nvme: remove bit bucket support for now

2022-04-22 Thread Keith Busch
THe emulated controller correctly accounts for not including bit buckets in the controller-to-host data transfer, however it doesn't correctly account for the holes for the on-disk data offsets. Signed-off-by: Keith Busch --- hw/nvme/ctrl.c | 3 +-- 1 file changed, 1 insertion(+), 2 dele

Re: [PATCH 0/5] hw/nvme: fix namespace identifiers

2022-04-19 Thread Keith Busch
s. Series looks good. Reviewed-by: Keith Busch

Re: [PATCH] hw/nvme: fix control flow statement

2022-04-15 Thread Keith Busch
On Fri, Apr 15, 2022 at 10:27:21PM +0300, Dmitry Tikhov wrote: > Since there is no else after nvme_dsm_cb invocation, metadata associated > with non-zero block range is currently zeroed. Also this behaviour leads > to segfault since we schedule iocb->bh two times. First when entering > nvme_dsm_cb

Re: [PATCH v2 0/6] hw/nvme: enhanced protection information (64-bit guard)

2022-03-01 Thread Keith Busch
inux kernel[1]. > > [1]: > https://lore.kernel.org/linux-nvme/20220201190128.3075065-1-kbu...@kernel.org/ Thanks Klaus, this looks good to me. Reviewed-by: Keith Busch

Re: [PATCH 0/6] hw/nvme: enhanced protection information (64-bit guard)

2022-02-16 Thread Keith Busch
Linux kernel[1]. > > [1]: > https://lore.kernel.org/linux-nvme/20220201190128.3075065-1-kbu...@kernel.org/ Other than comment on 6/6, series looks good to me. Reviewed-by: Keith Busch

Re: [PATCH 6/6] hw/nvme: 64-bit pi support

2022-02-16 Thread Keith Busch
On Mon, Feb 14, 2022 at 01:30:29PM +0100, Klaus Jensen wrote: > @@ -384,6 +389,12 @@ static int nvme_ns_check_constraints(NvmeNamespace *ns, > Error **errp) > return -1; > } > > +if (ns->params.pif != NVME_PI_GUARD_16 && > +ns->params.pif != NVME_PI_GUARD_64) { > +

Re: [PATCH for-7.0 4/4] hw/nvme: add support for zoned random write area

2022-01-26 Thread Keith Busch
rwa resources, i.e. number of zones that can have a zrwa), > "zoned.zrwas" (zrwa size in LBAs), "zoned.zrwafg" (granularity in LBAs > for flushes). > > Signed-off-by: Klaus Jensen Looks good, and will just need a minor update if you choose to take the feedback from patch 2 onboard. Reviewed-by: Keith Busch

Re: [PATCH for-7.0 3/4] hw/nvme: add ozcs enum

2022-01-26 Thread Keith Busch
On Thu, Nov 25, 2021 at 08:37:34AM +0100, Klaus Jensen wrote: > From: Klaus Jensen > > Add enumeration for OZCS values. Looks good. Reviewed-by: Keith Busch

Re: [PATCH for-7.0 2/4] hw/nvme: add zone attribute get/set helpers

2022-01-26 Thread Keith Busch
On Thu, Nov 25, 2021 at 08:37:33AM +0100, Klaus Jensen wrote: > @@ -295,7 +295,7 @@ static void nvme_assign_zone_state(NvmeNamespace *ns, > NvmeZone *zone, > case NVME_ZONE_STATE_READ_ONLY: > break; > default: > -zone->d.za = 0; > +NVME_ZA_CLEAR_ALL(zone->d.za);

Re: [PATCH for-7.0 1/4] hw/nvme: add struct for zone management send

2022-01-26 Thread Keith Busch
t; +uint64_tslba; > +uint32_trsvd12; > +uint8_t zsa; > +uint8_t zsflags[3]; This should be just a single uint8_t for zsflags, followed by 'uint8_t rsvd[2]'. Otherwise, looks good. Reviewed-by: Keith Busch

Re: [PATCH] hw/nvme: fix CVE-2021-3929

2022-01-20 Thread Keith Busch
updated if that assumption ever changes. Reviewed-by: Keith Busch

Re: [PATCH 2/2] hw/nvme/ctrl: Prohibit DMA accesses to devices (CVE-2021-3929)

2021-12-16 Thread Keith Busch
non-memories regions. Looks good. Reviewed-by: Keith Busch

Re: [PATCH 1/2] hw/nvme/ctrl: Do not ignore DMA access errors

2021-12-16 Thread Keith Busch
On Thu, Dec 16, 2021 at 06:55:09PM +0100, Philippe Mathieu-Daudé wrote: > dma_buf_read/dma_buf_write() return a MemTxResult type. > Do not discard it, propagate the DMA error to the caller. > > Signed-off-by: Philippe Mathieu-Daudé Looks good. Reviewed-by: Keith Busch

Re: [PATCH v2 08/15] hw/nvme: Implement the Function Level Reset

2021-11-16 Thread Keith Busch
On Tue, Nov 16, 2021 at 04:34:39PM +0100, Łukasz Gieryk wrote: > if (!pci_is_vf(&n->parent_obj) && n->params.sriov_max_vfs) { > -pcie_sriov_pf_disable_vfs(&n->parent_obj); > +if (rst != NVME_RESET_CONTROLLER) { > +pcie_sriov_pf_disable_vfs(&n->parent_obj); Shouldn'

Re: [PATCH 0/2] hw/nvme: fix namespace attachment on controller hotplug

2021-11-16 Thread Keith Busch
ond patch changes the default for 'shared' such that namespaces > are shared by default and will thus by default be attached to hotplugged > controllers. This adds a compat property for older machine versions and > updates the documentation to reflect this. Series looks good. Reviewed-by: Keith Busch

Re: [PATCH RFC 02/13] hw/nvme: move zns helpers and types into zoned.h

2021-09-16 Thread Keith Busch
On Tue, Sep 14, 2021 at 10:37:26PM +0200, Klaus Jensen wrote: > From: Klaus Jensen > > Move ZNS related helpers and types into zoned.h. Use a common prefix > (nvme_zoned or nvme_ns_zoned) for zns related functions. Just a nitpicks on the naming, you can feel free to ignore. Since we're within N

Re: [PATCH v2] hw/nvme: Return error for fused operations

2021-09-15 Thread Keith Busch
is looks fine, I really hope hosts weren't actually trying fused commands on this target, but it's good to confirm. Reviewed-by: Keith Busch

Re: [PATCH] hw/nvme: fix validation of ASQ and ACQ

2021-08-23 Thread Keith Busch
host error if the controller was enabled with invalid queue addresses anyway. The controller only needs to verify the lower bits are clear, which we do later. Reviewed-by: Keith Busch

Re: [RFC PATCH v1] Adding Support for namespace management

2021-08-13 Thread Keith Busch
On Fri, Aug 13, 2021 at 03:02:22PM +0530, Naveen wrote: > +static uint16_t nvme_identify_ns_common(NvmeCtrl *n, NvmeRequest *req) > +{ > +NvmeIdNs id_ns = {}; > + > +id_ns.nsfeat |= (0x4 | 0x10); > +id_ns.dpc = 0x1f; > + > +NvmeLBAF lbaf[16] = { > +[0] = {.ds = 9}, > +

Re: [PATCH v6 1/5] hw/nvme: split pmrmsc register into upper and lower

2021-07-26 Thread Keith Busch
On Wed, Jul 21, 2021 at 09:48:32AM +0200, Klaus Jensen wrote: > From: Klaus Jensen > > The specification uses a set of 32 bit PMRMSCL and PMRMSCU registers to > make up the 64 bit logical PMRMSC register. > > Make it so. Looks good. Reviewed-by: Keith Busch

Re: [PATCH v5 2/5] hw/nvme: use symbolic names for registers

2021-07-19 Thread Keith Busch
" checks for each register to enforce correct positioning of the BAR offsets at build time. Reviewed-by: Keith Busch > Signed-off-by: Klaus Jensen > Reviewed-by: Gollu Appalanaidu > Reviewed-by: Philippe Mathieu-Daudé > --- > include/block/nvme.h | 29 +

Re: [RFC PATCH nvme-cli 2/2] nvme-cli/plugins/mi:add support

2021-07-09 Thread Keith Busch
> +int hal_init() > +{ > +int retval = -1; > +switch (GetSidebandInterface()) { > +case qemu_nvme_mi: > +retval = qemu_mi_init(); > +break; > +default: > +break; > +} > +return retval; > +} > + > +int hal_open() > +{ > +int retval = -1; > +swi

Re: [RFC PATCH 1/2] hw/nvme: add mi device

2021-07-09 Thread Keith Busch
On Fri, Jul 09, 2021 at 07:25:45PM +0530, Padmakar Kalghatgi wrote: > The following commands are tested with nvme-cli by hooking > to the cid of the vsock as shown above and use the socket > send/recieve commands to issue the commands and get the response. Why sockets? Shouldn't mi targets use smb

[PATCH] nvme: add 'zoned.zasl' to documentation

2021-06-29 Thread Keith Busch
Signed-off-by: Keith Busch --- docs/system/nvme.rst | 6 ++ 1 file changed, 6 insertions(+) diff --git a/docs/system/nvme.rst b/docs/system/nvme.rst index 33a15c7dbc..bff72d1c24 100644 --- a/docs/system/nvme.rst +++ b/docs/system/nvme.rst @@ -202,6 +202,12 @@ The namespace may be configured

Re: [PATCH v2] hw/nvme: fix pin-based interrupt behavior (again)

2021-06-28 Thread Keith Busch
jakub.jer...@kernkonzept.com> > > Fixes: ca247d35098d ("hw/block/nvme: fix pin-based interrupt behavior") > Reported-by: Jakub Jermář > Signed-off-by: Klaus Jensen Looks good. Reviewed-by: Keith Busch

Re: [PATCH] hw/nvme: fix missing check for PMR capability

2021-06-28 Thread Keith Busch
igured. > > Cc: qemu-sta...@nongnu.org > Fixes: 75c3c9de961d ("hw/block/nvme: disable PMR at boot up") > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/362 > Signed-off-by: Klaus Jensen Looks good. Reviewed-by: Keith Busch > --- > hw/nvme/ctrl.c | 4 +++

Re: [PATCH v2 11/11] Partially revert "hw/block/nvme: drain namespaces on sq deletion"

2021-06-28 Thread Keith Busch
On Thu, Jun 17, 2021 at 09:06:57PM +0200, Klaus Jensen wrote: > From: Klaus Jensen > > This partially reverts commit 98f84f5a4eca5c03e32fff20f246d9b4b96d6422. > > Since all "multi aio" commands are now reimplemented to properly track > the nested aiocbs, we can revert the "hack" that was introdu

Re: [PATCH v2 00/11] hw/nvme: reimplement all multi-aio commands with custom aiocbs

2021-06-25 Thread Keith Busch
f simultaneously without tracking the returned > aiocbs. Klaus, THis series looks good to me. Reviewed-by: Keith Busch

Re: [PATCH] hw/nvme: fix pin-based interrupt behavior (again)

2021-06-17 Thread Keith Busch
On Thu, Jun 17, 2021 at 12:08:20PM +0200, Klaus Jensen wrote: > if (cq->tail != cq->head) { > +if (!pending) { > +n->cq_pending++; > +} You should check cq->irq_enabled before incrementing cq_pending. You don't want to leave the irq asserted when polled queues have

Re: [PATCH v2 2/3] hw/nvme: namespace parameter for EUI-64

2021-06-14 Thread Keith Busch
On Sat, Jun 12, 2021 at 01:46:30AM +0200, Heinrich Schuchardt wrote: > +``eui64`` > + Set the EUI-64 of the namespace. This will be reported as a "IEEE Extended > + Unique Identifier" descriptor in the Namespace Identification Descriptor > List. This needs to match Identify Namespace's EUI64 fi

Re: [PATCH v2 1/2] hw/nvme: add support for boot partiotions

2021-06-01 Thread Keith Busch
On Tue, Jun 01, 2021 at 09:07:56PM +0200, Klaus Jensen wrote: > On Jun 1 11:07, Keith Busch wrote: > > On Tue, Jun 01, 2021 at 07:41:34PM +0200, Klaus Jensen wrote: > > > On Jun 1 10:19, Keith Busch wrote: > > > > On Tue, Jun 01, 2021 at 08:07:48PM +0530, Gollu App

Re: [PATCH v2 1/2] hw/nvme: add support for boot partiotions

2021-06-01 Thread Keith Busch
On Tue, Jun 01, 2021 at 07:41:34PM +0200, Klaus Jensen wrote: > On Jun 1 10:19, Keith Busch wrote: > > On Tue, Jun 01, 2021 at 08:07:48PM +0530, Gollu Appalanaidu wrote: > > > NVMe Boot Partitions provides an area that may be read by the host > > > without initializing

Re: [PATCH v2 1/2] hw/nvme: add support for boot partiotions

2021-06-01 Thread Keith Busch
On Tue, Jun 01, 2021 at 08:07:48PM +0530, Gollu Appalanaidu wrote: > NVMe Boot Partitions provides an area that may be read by the host > without initializing queues or even enabling the controller. This > allows various platform initialization code to be stored on the NVMe > device instead of some

Re: [PATCH 07/23] hw/block/nvme: Use definition to avoid dynamic stack allocation

2021-05-05 Thread Keith Busch
On Wed, May 05, 2021 at 06:09:10PM -0500, Eric Blake wrote: > On 5/5/21 5:07 PM, Philippe Mathieu-Daudé wrote: > > +Eric > > > > On 5/5/21 11:22 PM, Keith Busch wrote: > >> On Wed, May 05, 2021 at 11:10:31PM +0200, Philippe Mathieu-Daudé wrote: > >>>

Re: [PATCH 07/23] hw/block/nvme: Use definition to avoid dynamic stack allocation

2021-05-05 Thread Keith Busch
On Wed, May 05, 2021 at 11:10:31PM +0200, Philippe Mathieu-Daudé wrote: > The compiler isn't clever enough to figure 'SEG_CHUNK_SIZE' is > a constant! Help it by using a definitions instead. I don't understand. It's labeled 'const', so any reasonable compiler will place it in the 'text' segment of

Re: [PATCH 00/14] hw(/block/)nvme: spring cleaning

2021-04-20 Thread Keith Busch
On Mon, Apr 19, 2021 at 09:27:47PM +0200, Klaus Jensen wrote: > From: Klaus Jensen > > This series consists of various clean up patches. > > The final patch moves nvme emulation from hw/block to hw/nvme. Series looks good to me. Reviewed-by: Keith Busch

Re: [PATCH v3] hw/block/nvme: add device self test command support

2021-04-09 Thread Keith Busch
On Wed, Mar 31, 2021 at 02:54:27PM +0530, Gollu Appalanaidu wrote: > This is to add support for Device Self Test Command (DST) and > DST Log Page. Refer NVM Express specification 1.4b section 5.8 > ("Device Self-test command") Please don't write change logs that just say what you did. I can read t

Re: [PATCH] hw/block/nvme: slba equal to nsze is out of bounds if nlb is 1-based

2021-04-09 Thread Keith Busch
On Fri, Apr 09, 2021 at 01:55:01PM +0200, Klaus Jensen wrote: > On Apr 9 20:05, Minwoo Im wrote: > > On 21-04-09 13:14:02, Gollu Appalanaidu wrote: > > > NSZE is the total size of the namespace in logical blocks. So the max > > > addressable logical block is NLB minus 1. So your starting logical >

Re: [PATCH] hw/block/nvme: map prp fix if prp2 contains non-zero offset

2021-04-08 Thread Keith Busch
On Thu, Apr 08, 2021 at 09:53:13PM +0530, Padmakar Kalghatgi wrote: > +/* > + * The first PRP list entry, pointed by PRP2 can contain > + * offsets. Hence, we need calculate the no of entries in > + * prp2 based on the offset it has. > +

Re: [PATCH for-6.0 v2 0/8] hw/block/nvme: misc fixes

2021-04-05 Thread Keith Busch
s Series looks fine. Reviewed-by: Keith Busch

Re: [PATCH V4 0/8] hw/block/nvme: support namespace attachment

2021-03-04 Thread Keith Busch
ew. Looks good to me. Reviewed-by: Keith Busch

Re: [PATCH v4 00/12] hw/block/nvme: metadata and end-to-end data protection support

2021-03-01 Thread Keith Busch
etadata and end-to-end data protection is all joint work > with Gollu Appalanaidu. Looks fine. Reviewed-by: Keith Busch

Re: [PATCH RFC v3 12/12] hw/block/nvme: add support for the format nvm command

2021-03-01 Thread Keith Busch
On Wed, Feb 17, 2021 at 09:26:37AM +0100, Klaus Jensen wrote: > On Feb 16 15:16, Keith Busch wrote: > > On Mon, Feb 15, 2021 at 12:02:40AM +0100, Klaus Jensen wrote: > > > From: Minwoo Im > > > > > > Format NVM admin command can make a namespace or namespaces

Re: [PATCH v2 5/5] hw/block/nvme: report non-mdts command size limit for dsm

2021-03-01 Thread Keith Busch
On Mon, Mar 01, 2021 at 12:15:26PM +0100, Klaus Jensen wrote: > On Feb 22 22:12, Klaus Jensen wrote: > > On Feb 23 05:55, Keith Busch wrote: > > > On Mon, Feb 22, 2021 at 07:47:59PM +0100, Klaus Jensen wrote: > > > > +typedef struct NvmeIdCtrlNvm

Re: [PATCH V2 6/7] hw/block/nvme: support namespace attachment command

2021-02-26 Thread Keith Busch
On Thu, Feb 11, 2021 at 01:09:36AM +0900, Minwoo Im wrote: > @@ -183,6 +183,7 @@ static const uint32_t nvme_cse_acs[256] = { > [NVME_ADM_CMD_SET_FEATURES] = NVME_CMD_EFF_CSUPP, > [NVME_ADM_CMD_GET_FEATURES] = NVME_CMD_EFF_CSUPP, > [NVME_ADM_CMD_ASYNC_EV_REQ] = NVME_CMD_EF

  1   2   3   >