linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Question - check in runtime which architecture am I running on
@ 2019-06-11 12:30 Oded Gabbay
  2019-06-11 14:07 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Oded Gabbay @ 2019-06-11 12:30 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Greg Kroah-Hartman, Linux-Kernel@Vger. Kernel. Org

Hello POWER developers,

I'm trying to find out if there is an internal kernel API so that a
PCI driver can call it to check if its PCI device is running inside a
POWER9 machine. Alternatively, if that's not available, if it is
running on a machine with powerpc architecture.

I need this information as my device (Goya AI accelerator)
unfortunately needs a slightly different configuration of its PCIe
controller in case of POWER9 (need to set bit 59 to be 1 in all
outbound transactions).

Currently I'm reading the PCI vendor and device ID of the parent PCI
bus device and checking if it is PHB4 but that is an ugly hack. (see
this commit - https://github.com/HabanaAI/linux/commit/1efd75ad5c9779b99a9a38c899e4e25e227626bf)

I dug through the code but didn't find anything that can help me so I
thought of asking more experienced people.

Thanks,
Oded

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question - check in runtime which architecture am I running on
  2019-06-11 12:30 Question - check in runtime which architecture am I running on Oded Gabbay
@ 2019-06-11 14:07 ` Christoph Hellwig
  2019-06-11 17:21   ` Oded Gabbay
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2019-06-11 14:07 UTC (permalink / raw)
  To: Oded Gabbay
  Cc: linuxppc-dev, Linux-Kernel@Vger. Kernel. Org, Greg Kroah-Hartman

On Tue, Jun 11, 2019 at 03:30:08PM +0300, Oded Gabbay wrote:
> Hello POWER developers,
> 
> I'm trying to find out if there is an internal kernel API so that a
> PCI driver can call it to check if its PCI device is running inside a
> POWER9 machine. Alternatively, if that's not available, if it is
> running on a machine with powerpc architecture.

Your driver has absolutely not business knowing this.

> 
> I need this information as my device (Goya AI accelerator)
> unfortunately needs a slightly different configuration of its PCIe
> controller in case of POWER9 (need to set bit 59 to be 1 in all
> outbound transactions).

No, it doesn't.  You can query the output from dma_get_required_mask
to optimize for the DMA addresses you get, and otherwise you simply
set the maximum dma mask you support.  That is about the control you
get, and nothing else is a drivers business.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question - check in runtime which architecture am I running on
  2019-06-11 14:07 ` Christoph Hellwig
@ 2019-06-11 17:21   ` Oded Gabbay
  0 siblings, 0 replies; 3+ messages in thread
From: Oded Gabbay @ 2019-06-11 17:21 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linuxppc-dev, Linux-Kernel@Vger. Kernel. Org, Greg Kroah-Hartman

On Tue, Jun 11, 2019 at 5:07 PM Christoph Hellwig <hch@infradead.org> wrote:
>
> On Tue, Jun 11, 2019 at 03:30:08PM +0300, Oded Gabbay wrote:
> > Hello POWER developers,
> >
> > I'm trying to find out if there is an internal kernel API so that a
> > PCI driver can call it to check if its PCI device is running inside a
> > POWER9 machine. Alternatively, if that's not available, if it is
> > running on a machine with powerpc architecture.
>
> Your driver has absolutely not business knowing this.
>
> >
> > I need this information as my device (Goya AI accelerator)
> > unfortunately needs a slightly different configuration of its PCIe
> > controller in case of POWER9 (need to set bit 59 to be 1 in all
> > outbound transactions).
>
> No, it doesn't.  You can query the output from dma_get_required_mask
> to optimize for the DMA addresses you get, and otherwise you simply
> set the maximum dma mask you support.  That is about the control you
> get, and nothing else is a drivers business.

I don't want to conduct two discussions as I saw you answered on my patch.
I'll add the ppc mailing list to my patch.
Oded

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-11 17:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-11 12:30 Question - check in runtime which architecture am I running on Oded Gabbay
2019-06-11 14:07 ` Christoph Hellwig
2019-06-11 17:21   ` Oded Gabbay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).