Re: [Qemu-devel] [PATCH 1/2] nvme: implement the DSM command

2017-02-02 Thread Paolo Bonzini
> On Wed, Feb 01, 2017 at 12:29:22PM -0800, Paolo Bonzini wrote: > > On 01/02/2017 08:40, Stefan Hajnoczi wrote: > > >> +goto out_free_range; > > >> +} > > >> + > > >> +if (dma_buf_write((uint8_t *)range, sizeof(range), &qsg)) { > > > > > > Did you mean sizeof(*range) * nr? > > >

Re: [Qemu-devel] [PATCH 1/2] nvme: implement the DSM command

2017-02-02 Thread Stefan Hajnoczi
On Wed, Feb 01, 2017 at 12:29:22PM -0800, Paolo Bonzini wrote: > On 01/02/2017 08:40, Stefan Hajnoczi wrote: > >> +goto out_free_range; > >> +} > >> + > >> +if (dma_buf_write((uint8_t *)range, sizeof(range), &qsg)) { > > > > Did you mean sizeof(*range) * nr? > > Did you also mean

Re: [Qemu-devel] [PATCH 1/2] nvme: implement the DSM command

2017-02-01 Thread Paolo Bonzini
On 01/02/2017 08:40, Stefan Hajnoczi wrote: >> +range = g_new(NvmeDsmRange, nr); >> + >> +if (nvme_map_prp(&qsg, le64_to_cpu(cmd->prp1), le64_to_cpu(cmd->prp2), >> +sizeof(range), n)) { This should be sizeof(*range) * nr, like the DMA below. >> +goto out_free_range;

Re: [Qemu-devel] [PATCH 1/2] nvme: implement the DSM command

2017-02-01 Thread Stefan Hajnoczi
On Mon, Jan 30, 2017 at 07:13:51PM +0100, Christoph Hellwig wrote: > +static uint16_t nvme_dsm_discard(NvmeCtrl *n, NvmeNamespace *ns, NvmeCmd > *cmd, > +NvmeRequest *req) > +{ > +uint16_t nr = (le32_to_cpu(cmd->cdw10) & 0xff) + 1; > +uint8_t lba_index = NVME_ID_NS_FLBAS_INDEX(ns->id_n

Re: [Qemu-devel] [PATCH 1/2] nvme: implement the DSM command

2017-01-30 Thread Keith Busch
On Mon, Jan 30, 2017 at 07:13:51PM +0100, Christoph Hellwig wrote: > Support deallocating of LBAs using the DSM command by wiring it up to > the qemu discard implementation. The other DSM operations which are > purely advisory are ignored for now. > > Based on an implementation by Keith Busch in