All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Lobakin <alexandr.lobakin@intel.com>
To: 이왕석 <wangseok.lee@samsung.com>
Cc: "Alexander Lobakin" <alexandr.lobakin@intel.com>,
	"Christoph Hellwig" <hch@infradead.org>,
	"jingoohan1@gmail.com" <jingoohan1@gmail.com>,
	"gustavo.pimentel@synopsys.com" <gustavo.pimentel@synopsys.com>,
	"lorenzo.pieralisi@arm.com" <lorenzo.pieralisi@arm.com>,
	"robh@kernel.org" <robh@kernel.org>,
	"kw@linux.com" <kw@linux.com>,
	"bhelgaas@google.com" <bhelgaas@google.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"jesper.nilsson@axis.com" <jesper.nilsson@axis.com>,
	"vkoul@kernel.org" <vkoul@kernel.org>,
	"kernel@axis.com" <kernel@axis.com>, 전문기 <moonki.jun@samsung.com>
Subject: Re: [PATCH] PCI: dwc: Modify the check about MSI DMA mask 32-bit
Date: Wed, 30 Mar 2022 11:35:26 +0200	[thread overview]
Message-ID: <20220330093526.2728238-1-alexandr.lobakin@intel.com> (raw)
In-Reply-To: <20220330035203epcms2p8fb560f4f953c5a2c8fff020432adc9bd@epcms2p8>

From: 이왕석 <wangseok.lee@samsung.com>
Date: Wed, 30 Mar 2022 12:52:03 +0900

> > --------- Original Message ---------
> > Sender : Alexander Lobakin <alexandr.lobakin@intel.com>
> > Date : 2022-03-28 23:34 (GMT+9)
> > Title : Re: [PATCH] PCI: dwc: Modify the check about MSI DMA mask 32-bit
> >
> > From: 이왕석 <wangseok.lee@samsung.com>
> > Date: Mon, 28 Mar 2022 11:30:09 +0900
> >
> >>  If dma_mask is more than 32 bits this will trigger an error occurs when
> >>  dma_map_single_attrs() is performed.
> >>  
> >>  dma_map_single_attrs() -> dma_map_page_attrs()->
> >>  error return in dma_direct_map_page().
> >>  
> >>  On ARTPEC-8, this fails with:
> >>  artpec8-pcie 17200000.pcie: DMA addr 0x0000000106b052c8+2 overflow
> >>  (mask ffffffff, bus limit 27fffffff)
> >
> > Isn't it a bug in the platform DMA code? dma_set_mask(32)
> > explicitly says that the system *must not* give DMA addresses wider
> > than 32 bits. If the system can't satisfy this requirement, then it
> > should return failure on dma_set_mask(32) -- this way you will only
> > get the corresponding warning, but there'll be no overflows (as the
> > mask will not be changed).
> > The idea of this call is to try to avoid getting 33+ bit mappings
> > so that PCI controllers which support only 32-bit masks could still
> > work correctly on the 64-bit systems. If the call fails, then this
> > message gets printed that you've been warned and it's your
> > responsibility to make sure that the controller won't get truncated
> > addresses. Having the call succeeded and then 33+ bit DMA addresses
> > is wrong.
> >
> > Please correct me if I'm wrong.
> >
> 
> Hello, Alexander Lobakin
> Thanks for your review.
> 
> You are right.
> My concern is that case of trying to use 33+bit dma mappings on 
> 64bit system.
> It is about the call sequence of the functions related to dma 
> setting, not the operation of the dma_set_mask() function.
> If dma_set_mask(33+) is performed before dw_pcie_host_init()
> for using 33+bit dma mapping, following error occurs 
> in dma_map_single_attrs()
> ex) DMA addr 0x0000000106b052c8+2 overflow 
>    (mask ffffffff, bus limit 27fffffff)
> dma_set_mask(33+) -> dw_pcie_host_init(): dma_set_mask(32) ->
> dma_map_single_attrs() -> 
> error return in dma_direct_map_page(): 
> because dma addr is 33+ but masking value is 32
> 
> So if the user has already set dma_mask to 33+ in order to use 33+,
> i suggested to modify dma_set_mask(32) not to be called.
> 
> Please let me know your opinion.

I'm not super familiar with the DMA internals, so adding Chris here,
maybe he'd like to comment, but anyway, the lower/arch layer must
not give the DMA addresses wider than the number of bits passed to
dma_set_mask() if that call returned 0.

> 
> Thank you.

--- 8< ---

> >>  -- 
> >>  2.9.5
> >
> > Thanks,
> > Al

Thanks,
Al

  reply	other threads:[~2022-03-30  9:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20220328023009epcms2p309a5dfc2ff29d0a9945f65799963193c@epcms2p3>
2022-03-28  2:30 ` [PATCH] PCI: dwc: Modify the check about MSI DMA mask 32-bit 이왕석
2022-03-28 14:32   ` Alexander Lobakin
     [not found]   ` <CGME20220328143454epcas2p27a340d09e9f4e74af1eaa44559e372a5@epcms2p8>
2022-03-30  3:52     ` 이왕석
2022-03-30  9:35       ` Alexander Lobakin [this message]
2022-03-30 15:45         ` Christoph Hellwig
     [not found]         ` <CGME20220328143454epcas2p27a340d09e9f4e74af1eaa44559e372a5@epcms2p7>
2022-03-31  5:34           ` 이왕석
2022-04-08  5:32           ` Wangseok Lee
2022-04-08  5:39             ` Christoph Hellwig
2022-04-08 15:47             ` Lorenzo Pieralisi
     [not found]             ` <CGME20220328143454epcas2p27a340d09e9f4e74af1eaa44559e372a5@epcms2p5>
2022-04-11  6:59               ` Wangseok Lee
2022-04-11  7:10                 ` Christoph Hellwig
     [not found]                 ` <CGME20220328143454epcas2p27a340d09e9f4e74af1eaa44559e372a5@epcms2p1>
2022-04-11  9:47                   ` Wangseok Lee
2022-04-11 12:54                     ` Christoph Hellwig
2022-04-13 11:54                       ` Robin Murphy
2022-04-18  3:12                   ` Wangseok Lee
     [not found]         ` <CGME20220328143454epcas2p27a340d09e9f4e74af1eaa44559e372a5@epcms2p4>
2022-04-08  2:34           ` Wangseok Lee
2022-04-08  5:06             ` Christoph Hellwig

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=20220330093526.2728238-1-alexandr.lobakin@intel.com \
    --to=alexandr.lobakin@intel.com \
    --cc=bhelgaas@google.com \
    --cc=gustavo.pimentel@synopsys.com \
    --cc=hch@infradead.org \
    --cc=jesper.nilsson@axis.com \
    --cc=jingoohan1@gmail.com \
    --cc=kernel@axis.com \
    --cc=kw@linux.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=moonki.jun@samsung.com \
    --cc=robh@kernel.org \
    --cc=vkoul@kernel.org \
    --cc=wangseok.lee@samsung.com \
    /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.