mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] lightnvm: pass dma address to hardware rather than pointer
@ 2016-05-03 15:22 Arnd Bergmann
  2016-05-03 16:14 ` Javier González
  2016-05-03 17:41 ` Matias Bjørling
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2016-05-03 15:22 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe
  Cc: Javier González, Arnd Bergmann, Matias Bjørling,
	linux-nvme, linux-kernel

A recent change to lightnvm added code to pass a kernel pointer
to the hardware, which gcc complained about:

drivers/nvme/host/lightnvm.c: In function 'nvme_nvm_rqtocmd':
drivers/nvme/host/lightnvm.c:472:32: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  c->ph_rw.metadata = cpu_to_le64(rqd->meta_list);

It looks like this has no way of working anyway, so this changes
the code to pass the dma_address instead. This was most likely
what was intended here. Neither of the two are currently ever
written to, so the effect is the same for now.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: a34b1eb78e21 ("lightnvm: enable metadata to be sent to device")
---
 drivers/nvme/host/lightnvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index fadeb54bc7df..65de1e56e59a 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -469,7 +469,7 @@ static inline void nvme_nvm_rqtocmd(struct request *rq, struct nvm_rq *rqd,
 	c->ph_rw.opcode = rqd->opcode;
 	c->ph_rw.nsid = cpu_to_le32(ns->ns_id);
 	c->ph_rw.spba = cpu_to_le64(rqd->ppa_addr.ppa);
-	c->ph_rw.metadata = cpu_to_le64(rqd->meta_list);
+	c->ph_rw.metadata = cpu_to_le64(rqd->dma_meta_list);
 	c->ph_rw.control = cpu_to_le16(rqd->flags);
 	c->ph_rw.length = cpu_to_le16(rqd->nr_pages - 1);
 
-- 
2.7.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] lightnvm: pass dma address to hardware rather than pointer
  2016-05-03 15:22 [PATCH] lightnvm: pass dma address to hardware rather than pointer Arnd Bergmann
@ 2016-05-03 16:14 ` Javier González
  2016-05-03 17:41 ` Matias Bjørling
  1 sibling, 0 replies; 3+ messages in thread
From: Javier González @ 2016-05-03 16:14 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Keith Busch, Jens Axboe, Matias Bjørling, linux-nvme, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 863 bytes --]

> 
> On 03 May 2016, at 17:22, Arnd Bergmann <arnd@arndb.de> wrote:
> 
> A recent change to lightnvm added code to pass a kernel pointer
> to the hardware, which gcc complained about:
> 
> drivers/nvme/host/lightnvm.c: In function 'nvme_nvm_rqtocmd':
> drivers/nvme/host/lightnvm.c:472:32: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>  c->ph_rw.metadata = cpu_to_le64(rqd->meta_list);
> 
> It looks like this has no way of working anyway, so this changes
> the code to pass the dma_address instead. This was most likely
> what was intended here. Neither of the two are currently ever
> written to, so the effect is the same for now.
> 

Thanks Arnd.

It was my mistake. I had it fixed in the pblk branch, where we use the
metadata field and was waiting to send it together with other fixes.

Javier.

[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 842 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] lightnvm: pass dma address to hardware rather than pointer
  2016-05-03 15:22 [PATCH] lightnvm: pass dma address to hardware rather than pointer Arnd Bergmann
  2016-05-03 16:14 ` Javier González
@ 2016-05-03 17:41 ` Matias Bjørling
  1 sibling, 0 replies; 3+ messages in thread
From: Matias Bjørling @ 2016-05-03 17:41 UTC (permalink / raw)
  To: Arnd Bergmann, Keith Busch, Jens Axboe
  Cc: Javier González, linux-nvme, linux-kernel

On 05/03/2016 05:22 PM, Arnd Bergmann wrote:
> A recent change to lightnvm added code to pass a kernel pointer
> to the hardware, which gcc complained about:
>
> drivers/nvme/host/lightnvm.c: In function 'nvme_nvm_rqtocmd':
> drivers/nvme/host/lightnvm.c:472:32: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>    c->ph_rw.metadata = cpu_to_le64(rqd->meta_list);
>
> It looks like this has no way of working anyway, so this changes
> the code to pass the dma_address instead. This was most likely
> what was intended here. Neither of the two are currently ever
> written to, so the effect is the same for now.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: a34b1eb78e21 ("lightnvm: enable metadata to be sent to device")
> ---
>   drivers/nvme/host/lightnvm.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
> index fadeb54bc7df..65de1e56e59a 100644
> --- a/drivers/nvme/host/lightnvm.c
> +++ b/drivers/nvme/host/lightnvm.c
> @@ -469,7 +469,7 @@ static inline void nvme_nvm_rqtocmd(struct request *rq, struct nvm_rq *rqd,
>   	c->ph_rw.opcode = rqd->opcode;
>   	c->ph_rw.nsid = cpu_to_le32(ns->ns_id);
>   	c->ph_rw.spba = cpu_to_le64(rqd->ppa_addr.ppa);
> -	c->ph_rw.metadata = cpu_to_le64(rqd->meta_list);
> +	c->ph_rw.metadata = cpu_to_le64(rqd->dma_meta_list);
>   	c->ph_rw.control = cpu_to_le16(rqd->flags);
>   	c->ph_rw.length = cpu_to_le16(rqd->nr_pages - 1);
>
>

Thanks Arnd, good catch. I haven't sent the 4.7 patches upstream yet. Do 
you want me to squash your patch into Javier's or keep it separately?

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-05-03 17:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-03 15:22 [PATCH] lightnvm: pass dma address to hardware rather than pointer Arnd Bergmann
2016-05-03 16:14 ` Javier González
2016-05-03 17:41 ` Matias Bjørling

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®