All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>, Keith Busch <kbusch@kernel.org>,
	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 10:11:42 +0200	[thread overview]
Message-ID: <20251027081142.GG12554@unreal> (raw)
In-Reply-To: <20251027075738.GF12554@unreal>

On Mon, Oct 27, 2025 at 09:57:38AM +0200, Leon Romanovsky wrote:
> On Mon, Oct 27, 2025 at 08:49:22AM +0100, Christoph Hellwig wrote:
> > > +	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.
> 
> I thought about it, but decided to use flags as more space efficient.
> PCI_P2PDMA_MAP_BUS_ADDR == 3 and PCI_P2PDMA_MAP_THRU_HOST_BRIDGE == 4.
> It means that will need to occupy 6 bits (extra u8 IOD field), while
> this flags encoding takes only 4 bits (without extra IOD field).

BTW, one can reorganize pci_p2pdma_map_type to make sure that
PCI_P2PDMA_MAP_BUS_ADDR will be 2 and PCI_P2PDMA_MAP_THRU_HOST_BRIDGE
will be 3, so it will be possible to take 2 bits per-type instead of 3.

diff --git a/include/linux/pci-p2pdma.h b/include/linux/pci-p2pdma.h
index 951f81a38f3a..2280e5a55b1f 100644
--- a/include/linux/pci-p2pdma.h
+++ b/include/linux/pci-p2pdma.h
@@ -112,14 +112,6 @@ enum pci_p2pdma_map_type {
         */
        PCI_P2PDMA_MAP_NONE,

-       /*
-        * PCI_P2PDMA_MAP_NOT_SUPPORTED: Indicates the transaction will
-        * traverse the host bridge and the host bridge is not in the
-        * allowlist. DMA Mapping routines should return an error when
-        * this is returned.
-        */
-       PCI_P2PDMA_MAP_NOT_SUPPORTED,
-
        /*
         * PCI_P2PDMA_MAP_BUS_ADDR: Indicates that two devices can talk to
         * each other directly through a PCI switch and the transaction will
@@ -136,6 +128,14 @@ enum pci_p2pdma_map_type {
         * case of IOMMUs) should be used to program the DMA engine.
         */
        PCI_P2PDMA_MAP_THRU_HOST_BRIDGE,
+
+       /*
+        * PCI_P2PDMA_MAP_NOT_SUPPORTED: Indicates the transaction will
+        * traverse the host bridge and the host bridge is not in the
+        * allowlist. DMA Mapping routines should return an error when
+        * this is returned.
+        */
+       PCI_P2PDMA_MAP_NOT_SUPPORTED,
 };

 struct pci_p2pdma_map_state {

Thanks

  reply	other threads:[~2025-10-27  8:11 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 [this message]
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=20251027081142.GG12554@unreal \
    --to=leon@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=kbusch@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.