linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] NVMe: Using PRACT bit to generate and verify PI by controller
@ 2015-07-28 14:33 Alok Pandey
  2015-07-30 20:00 ` Keith Busch
  0 siblings, 1 reply; 5+ messages in thread
From: Alok Pandey @ 2015-07-28 14:33 UTC (permalink / raw)


This patch enables the PRCHK and reftag support when PRACT bit is set, and
block layer integrity is disabled.

Signed-off-by: Alok Pandey <pandey.alok at samsung.com>
---
 drivers/block/nvme-core.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index 7920c27..ede8fb6 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -815,11 +815,10 @@ static int nvme_submit_iod(struct nvme_queue *nvmeq, struct nvme_iod *iod,
 	cmnd->rw.slba = cpu_to_le64(nvme_block_nr(ns, blk_rq_pos(req)));
 	cmnd->rw.length = cpu_to_le16((blk_rq_bytes(req) >> ns->lba_shift) - 1);
 
-	if (blk_integrity_rq(req)) {
-		cmnd->rw.metadata = cpu_to_le64(sg_dma_address(iod->meta_sg));
+	if (ns->ms) {
 		switch (ns->pi_type) {
 		case NVME_NS_DPS_PI_TYPE3:
-			control |= NVME_RW_PRINFO_PRCHK_GUARD;
+		control |= NVME_RW_PRINFO_PRCHK_GUARD;
 			break;
 		case NVME_NS_DPS_PI_TYPE1:
 		case NVME_NS_DPS_PI_TYPE2:
@@ -829,8 +828,12 @@ static int nvme_submit_iod(struct nvme_queue *nvmeq, struct nvme_iod *iod,
 					nvme_block_nr(ns, blk_rq_pos(req)));
 			break;
 		}
-	} else if (ns->ms)
-		control |= NVME_RW_PRINFO_PRACT;
+		if (blk_integrity_rq(req))
+			cmnd->rw.metadata =
+				cpu_to_le64(sg_dma_address(iod->meta_sg));
+		else
+			control |= NVME_RW_PRINFO_PRACT;
+	}
 
 	cmnd->rw.control = cpu_to_le16(control);
 	cmnd->rw.dsmgmt = cpu_to_le32(dsmgmt);
@@ -1989,7 +1992,7 @@ static int nvme_revalidate_disk(struct gendisk *disk)
 								!ns->ext)
 		nvme_init_integrity(ns);
 
-	if (ns->ms && !blk_get_integrity(disk))
+	if (ns->ms && !(ns->ms == 8 && ns->pi_type) && !blk_get_integrity(disk))
 		set_capacity(disk, 0);
 	else
 		set_capacity(disk, le64_to_cpup(&id->nsze) << (ns->lba_shift - 9));
-- 
1.9.1

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

* [PATCH V2] NVMe: Using PRACT bit to generate and verify PI by controller
  2015-07-28 14:33 [PATCH V2] NVMe: Using PRACT bit to generate and verify PI by controller Alok Pandey
@ 2015-07-30 20:00 ` Keith Busch
  2015-08-26  4:46   ` Alok
  0 siblings, 1 reply; 5+ messages in thread
From: Keith Busch @ 2015-07-30 20:00 UTC (permalink / raw)


On Tue, 28 Jul 2015, Alok Pandey wrote:
> This patch enables the PRCHK and reftag support when PRACT bit is set, and
> block layer integrity is disabled.

Thanks!

Reviewed-by: Keith Busch <keith.busch at intel.com>

> Signed-off-by: Alok Pandey <pandey.alok at samsung.com>
> ---
> @@ -815,11 +815,10 @@ static int nvme_submit_iod(struct nvme_queue *nvmeq, struct nvme_iod *iod,
> 	cmnd->rw.slba = cpu_to_le64(nvme_block_nr(ns, blk_rq_pos(req)));
> 	cmnd->rw.length = cpu_to_le16((blk_rq_bytes(req) >> ns->lba_shift) - 1);
>
> -	if (blk_integrity_rq(req)) {
> -		cmnd->rw.metadata = cpu_to_le64(sg_dma_address(iod->meta_sg));
> +	if (ns->ms) {
> 		switch (ns->pi_type) {
> 		case NVME_NS_DPS_PI_TYPE3:
> -			control |= NVME_RW_PRINFO_PRCHK_GUARD;
> +		control |= NVME_RW_PRINFO_PRCHK_GUARD;
> 			break;

Though the tab change here must have been an accident.

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

* [PATCH V2] NVMe: Using PRACT bit to generate and verify PI by controller
  2015-07-30 20:00 ` Keith Busch
@ 2015-08-26  4:46   ` Alok
  2015-08-26 14:59     ` Jens Axboe
  0 siblings, 1 reply; 5+ messages in thread
From: Alok @ 2015-08-26  4:46 UTC (permalink / raw)


Can it be picked up.

Thanks,
Alok

-----Original Message-----
From: Linux-nvme [mailto:linux-nvme-bounces@lists.infradead.org] On Behalf
Of Keith Busch
Sent: Friday, July 31, 2015 1:30 AM
To: Alok Pandey
Cc: keith.busch at intel.com; linux-nvme at lists.infradead.org
Subject: Re: [PATCH V2] NVMe: Using PRACT bit to generate and verify PI by
controller

On Tue, 28 Jul 2015, Alok Pandey wrote:
> This patch enables the PRCHK and reftag support when PRACT bit is set, 
> and block layer integrity is disabled.

Thanks!

Reviewed-by: Keith Busch <keith.busch at intel.com>

> Signed-off-by: Alok Pandey <pandey.alok at samsung.com>
> ---
> @@ -815,11 +815,10 @@ static int nvme_submit_iod(struct nvme_queue *nvmeq,
struct nvme_iod *iod,
> 	cmnd->rw.slba = cpu_to_le64(nvme_block_nr(ns, blk_rq_pos(req)));
> 	cmnd->rw.length = cpu_to_le16((blk_rq_bytes(req) >> ns->lba_shift) -

> 1);
>
> -	if (blk_integrity_rq(req)) {
> -		cmnd->rw.metadata =
cpu_to_le64(sg_dma_address(iod->meta_sg));
> +	if (ns->ms) {
> 		switch (ns->pi_type) {
> 		case NVME_NS_DPS_PI_TYPE3:
> -			control |= NVME_RW_PRINFO_PRCHK_GUARD;
> +		control |= NVME_RW_PRINFO_PRCHK_GUARD;
> 			break;

Though the tab change here must have been an accident.

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

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

* [PATCH V2] NVMe: Using PRACT bit to generate and verify PI by controller
  2015-08-26  4:46   ` Alok
@ 2015-08-26 14:59     ` Jens Axboe
  2015-08-26 15:00       ` Jens Axboe
  0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2015-08-26 14:59 UTC (permalink / raw)


On 08/25/2015 10:46 PM, Alok wrote:
> Can it be picked up.

Applied for 4.3:

http://git.kernel.dk/cgit/linux-block/commit/?h=for-4.3/drivers&id=e3f879bf1ea3e03f433d292b0114807785f0754b

Please double check the patch, I had to hand apply it due to conflicts. 
In the future, base patches for revision x.y of the kernel against 
for-x.y/drivers. Thanks!

-- 
Jens Axboe

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

* [PATCH V2] NVMe: Using PRACT bit to generate and verify PI by controller
  2015-08-26 14:59     ` Jens Axboe
@ 2015-08-26 15:00       ` Jens Axboe
  0 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2015-08-26 15:00 UTC (permalink / raw)


On 08/26/2015 08:59 AM, Jens Axboe wrote:
> On 08/25/2015 10:46 PM, Alok wrote:
>> Can it be picked up.
>
> Applied for 4.3:
>
> http://git.kernel.dk/cgit/linux-block/commit/?h=for-4.3/drivers&id=e3f879bf1ea3e03f433d292b0114807785f0754b
>
>
> Please double check the patch, I had to hand apply it due to conflicts.
> In the future, base patches for revision x.y of the kernel against
> for-x.y/drivers. Thanks!

Ooops, this is the right commit, of course:

http://git.kernel.dk/cgit/linux-block/commit/?h=for-4.3/drivers&id=e19b127f5b76ec03b9c52b64f117dc75bb39eda1


-- 
Jens Axboe

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

end of thread, other threads:[~2015-08-26 15:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-28 14:33 [PATCH V2] NVMe: Using PRACT bit to generate and verify PI by controller Alok Pandey
2015-07-30 20:00 ` Keith Busch
2015-08-26  4:46   ` Alok
2015-08-26 14:59     ` Jens Axboe
2015-08-26 15:00       ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).