public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Leon Romanovsky <leon@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
	Sagi Grimberg <sagi@grimberg.me>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-nvme@lists.infradead.org
Subject: Re: [PATCH v3 2/2] block-dma: properly take MMIO path
Date: Wed, 12 Nov 2025 09:38:07 -0500	[thread overview]
Message-ID: <aRSbzwpS2AuP92_n@kbusch-mbp> (raw)
In-Reply-To: <20251027-block-with-mmio-v3-2-ac3370e1f7b7@nvidia.com>

On Mon, Oct 27, 2025 at 09:30:21AM +0200, Leon Romanovsky wrote:
> @@ -732,13 +746,20 @@ static void nvme_unmap_metadata(struct request *req)
>  		return;
>  	}
>  
> -	if (!blk_rq_integrity_dma_unmap(req, dma_dev, &iod->meta_dma_state,
> -					iod->meta_total_len)) {
> +	if (iod->flags & IOD_META_P2P)
> +		map = PCI_P2PDMA_MAP_BUS_ADDR;
> +	if (iod->flags & IOD_META_MMIO) {
> +		map = PCI_P2PDMA_MAP_THRU_HOST_BRIDGE;
> +		attrs |= DMA_ATTR_MMIO;
> +	}

This should be an 'else if' no?

> @@ -760,12 +783,20 @@ static void nvme_unmap_data(struct request *req)
>  		return;
>  	}
>  
> -	if (!blk_rq_dma_unmap(req, dma_dev, &iod->dma_state, iod->total_len)) {
> +	if (iod->flags & IOD_DATA_P2P)
> +		map = PCI_P2PDMA_MAP_BUS_ADDR;
> +	if (iod->flags & IOD_DATA_MMIO) {
> +		map = PCI_P2PDMA_MAP_THRU_HOST_BRIDGE;
> +		attrs |= DMA_ATTR_MMIO;
> +	}

Same here.

> @@ -1036,6 +1067,17 @@ static blk_status_t nvme_map_data(struct request *req)
>  	if (!blk_rq_dma_map_iter_start(req, dev->dev, &iod->dma_state, &iter))
>  		return iter.status;
>  
> +	switch (iter.p2pdma.map) {
> +	case PCI_P2PDMA_MAP_BUS_ADDR:
> +		iod->flags |= IOD_DATA_P2P;
> +		break;
> +	case PCI_P2PDMA_MAP_THRU_HOST_BRIDGE:
> +		iod->flags |= IOD_DATA_MMIO;
> +		break;
> +	default:
> +		return BLK_STS_RESOURCE;
> +	}

Why is it an error if the data isn't a P2PDMA type?

> @@ -1058,6 +1100,17 @@ static blk_status_t nvme_pci_setup_meta_sgls(struct request *req)
>  						&iod->meta_dma_state, &iter))
>  		return iter.status;
>  
> +	switch (iter.p2pdma.map) {
> +	case PCI_P2PDMA_MAP_BUS_ADDR:
> +		iod->flags |= IOD_META_P2P;
> +		break;
> +	case PCI_P2PDMA_MAP_THRU_HOST_BRIDGE:
> +		iod->flags |= IOD_META_MMIO;
> +		break;
> +	default:
> +		return BLK_STS_RESOURCE;
> +	}

Same here.

  parent reply	other threads:[~2025-11-12 14:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-27  7:30 [PATCH v3 0/2] block: Enable proper MMIO memory handling for P2P DMA Leon Romanovsky
2025-10-27  7:30 ` [PATCH v3 1/2] nvme-pci: migrate to dma_map_phys instead of map_page Leon Romanovsky
2025-10-27  7:30 ` [PATCH v3 2/2] block-dma: properly take MMIO path Leon Romanovsky
2025-10-27  7:49   ` Christoph Hellwig
2025-10-27  7:57     ` Leon Romanovsky
2025-10-27  8:11       ` Leon Romanovsky
2025-10-27  8:16         ` Christoph Hellwig
2025-10-27  8:22           ` Leon Romanovsky
2025-11-12 14:38   ` Keith Busch [this message]
2025-11-12 15:16     ` Leon Romanovsky
2025-11-12 15:23       ` Keith Busch
2025-11-12 18:30         ` Leon Romanovsky
2025-11-09  7:53 ` [PATCH v3 0/2] block: Enable proper MMIO memory handling for P2P DMA Leon Romanovsky

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=aRSbzwpS2AuP92_n@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=leon@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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