All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Leon Romanovsky <leon@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>, Keith Busch <kbusch@kernel.org>,
	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: Mon, 27 Oct 2025 08:49:22 +0100	[thread overview]
Message-ID: <20251027074922.GA14543@lst.de> (raw)
In-Reply-To: <20251027-block-with-mmio-v3-2-ac3370e1f7b7@nvidia.com>

> +	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;

I almost wonder if we should just the pci_p2pdma_map_type values into
place.  But that's a future cleanup, I'd rather get this going now.

> +static inline bool blk_rq_dma_unmap(struct request *req, struct device *dma_dev,
> +		struct dma_iova_state *state, size_t mapped_len,
> +		enum pci_p2pdma_map_type map)
>  {
> -	if (is_p2p)
> +	if (map == PCI_P2PDMA_MAP_BUS_ADDR)
>  		return true;
>  
>  	if (dma_use_iova(state)) {
> +		unsigned int attrs = 0;
> +
> +		if (map == PCI_P2PDMA_MAP_THRU_HOST_BRIDGE)
> +			attrs |= DMA_ATTR_MMIO;
> +
>  		dma_iova_destroy(dma_dev, state, mapped_len, rq_dma_dir(req),
> -				 0);
> +				 attrs);

The only thing in req that is used now is the data directrion.  I'd be
almost tempted to just pass that and lift this to dma-mapping.h.

But I guess we could just do that in a follow on to not drag in
another subsystem.

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

  reply	other threads:[~2025-10-27  7:49 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 [this message]
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
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=20251027074922.GA14543@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=kbusch@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.