Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: axboe@fb.com, ilias.apalodimas@linaro.org, sagi@grimberg.me,
	linux-nvme@lists.infradead.org, hch@lst.de
Subject: Re: [PATCH v4] nvme/pci: Split 8-byte reads
Date: Mon, 7 Oct 2019 12:28:54 -0600	[thread overview]
Message-ID: <20191007182854.GC13149@C02WT3WMHTD6> (raw)
In-Reply-To: <20191007182244.8516-1-ard.biesheuvel@linaro.org>

On Mon, Oct 07, 2019 at 08:22:44PM +0200, Ard Biesheuvel wrote:
> The nvme pci driver had split 8-byte register reads using lo_hi_readq()
> due to nvme controllers that do not support that sized access. This
> behavior was inadvertently changed to readq(), which may break those
> controllers. Restore the previous behavior.
> 
> Fixes: 7fd8930f26be4 ("nvme: add a common helper to read Identify Controller data")
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Looks good to me.

Reviewed-by: Keith Busch <kbusch@kernel.org>

> ---
>  drivers/nvme/host/pci.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index bb88681f4dc3..3fe0c5185646 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -2672,7 +2672,12 @@ static int nvme_pci_reg_write32(struct nvme_ctrl *ctrl, u32 off, u32 val)
>  
>  static int nvme_pci_reg_read64(struct nvme_ctrl *ctrl, u32 off, u64 *val)
>  {
> -	*val = readq(to_nvme_dev(ctrl)->bar + off);
> +	/*
> +	 * Split the 8-byte read into two 4-byte reads since all controllers
> +	 * support 4 byte register reads, but some do not support the larger
> +	 * access size.
> +	 */
> +	 *val = lo_hi_readq(to_nvme_dev(ctrl)->bar + off);
>  	return 0;
>  }
>  
> -- 
> 2.20.1
> 

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  reply	other threads:[~2019-10-07 18:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-07 18:22 [PATCH v4] nvme/pci: Split 8-byte reads Ard Biesheuvel
2019-10-07 18:28 ` Keith Busch [this message]
2019-10-07 18:47 ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191007182854.GC13149@C02WT3WMHTD6 \
    --to=kbusch@kernel.org \
    --cc=ard.biesheuvel@linaro.org \
    --cc=axboe@fb.com \
    --cc=hch@lst.de \
    --cc=ilias.apalodimas@linaro.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox