public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Oded Gabbay <oded.gabbay@gmail.com>,
	Greg KH <gregkh@linuxfoundation.org>,
	linuxppc-dev@ozlabs.org, Christoph Hellwig <hch@infradead.org>
Cc: "Linux-Kernel@Vger. Kernel. Org" <linux-kernel@vger.kernel.org>,
	Oliver OHalloran <oliveroh@au1.ibm.com>,
	Russell Currey <ruscur@au1.ibm.com>
Subject: Re: [PATCH v2 8/8] habanalabs: enable 64-bit DMA mask in POWER9
Date: Wed, 12 Jun 2019 08:53:07 +1000	[thread overview]
Message-ID: <ca81ca5d56a3a12db5a92f5cf9745763a86572e8.camel@kernel.crashing.org> (raw)
In-Reply-To: <CAFCwf134nTD4FM_9Q+THQ7ZAZzGxhs15O6EheaRJMqM5wxi+aA@mail.gmail.com>

On Tue, 2019-06-11 at 20:22 +0300, Oded Gabbay wrote:
> 
> > So, to summarize:
> > If I call pci_set_dma_mask with 48, then it fails on POWER9. However,
> > in runtime, I don't know if its POWER9 or not, so upon failure I will
> > call it again with 32, which makes our device pretty much unusable.
> > If I call pci_set_dma_mask with 64, and do the dedicated configuration
> > in Goya's PCIe controller, then it won't work on x86-64, because bit
> > 59 will be set and the host won't like it (I checked it). In addition,
> > I might get addresses above 50 bits, which my device can't generate.
> > 
> > I hope this makes things more clear. Now, please explain to me how I
> > can call pci_set_dma_mask without any regard to whether I run on
> > x86-64 or POWER9, considering what I wrote above ?
> > 
> > Thanks,
> > Oded
> 
> Adding ppc mailing list.

You can't. Your device is broken. Devices that don't support DMAing to
the full 64-bit deserve to be added to the trash pile.

As a result, getting it to work will require hacks. Some GPUs have
similar issues and require similar hacks, it's unfortunate.

Added a couple of guys on CC who might be able to help get those hacks
right.

It's still very fishy .. the idea is to detect the case where setting a
64-bit mask will give your system memory mapped at a fixed high address
(1 << 59 in our case) and program that in your chip in the "Fixed high
bits" register that you seem to have (also make sure it doesn't affect
MSIs or it will break them).

This will only work as long as all of the system memory can be
addressed at an offset from that fixed address that itself fits your
device addressing capabilities (50 bits in this case). It may or may
not be the case but there's no way to check since the DMA mask logic
won't really apply.

You might want to consider fixing your HW in the next iteration... This
is going to bite you when x86 increases the max physical memory for
example, or on other architectures.

Cheers,
Ben.





  reply	other threads:[~2019-06-11 22:53 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-11  9:21 [PATCH v2 8/8] habanalabs: enable 64-bit DMA mask in POWER9 Oded Gabbay
2019-06-11  9:58 ` Greg KH
2019-06-11 11:47   ` Oded Gabbay
2019-06-11 15:17   ` Christoph Hellwig
2019-06-11 15:26     ` Greg KH
2019-06-11 17:03       ` Oded Gabbay
2019-06-11 17:22         ` Oded Gabbay
2019-06-11 22:53           ` Benjamin Herrenschmidt [this message]
2019-06-12  5:45             ` Oliver O'Halloran
2019-06-12  8:17               ` Benjamin Herrenschmidt
2019-06-12  6:25             ` Oded Gabbay
2019-06-12  8:18               ` Benjamin Herrenschmidt
2019-06-12  6:35           ` Oliver O'Halloran
2019-06-12  6:53             ` Christoph Hellwig
2019-06-12 11:48               ` Oliver O'Halloran
2019-06-15 12:12       ` Oded Gabbay
2019-06-16  9:55         ` Christoph Hellwig
2019-06-16 11:24           ` Oded Gabbay
2019-06-17  8:19             ` Christoph Hellwig
2019-06-17  8:35               ` Oded Gabbay
2019-06-24  6:53                 ` Oded Gabbay
2019-06-24  6:58                   ` 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=ca81ca5d56a3a12db5a92f5cf9745763a86572e8.camel@kernel.crashing.org \
    --to=benh@kernel.crashing.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=oded.gabbay@gmail.com \
    --cc=oliveroh@au1.ibm.com \
    --cc=ruscur@au1.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox