* Question about using #ifdef CONFIG_PPC64 in driver code [not found] <CAFCwf11-MzroWUmj4qOgwLTibqsdOmPP9cHJjXZmS0Pgr3bEOQ@mail.gmail.com> @ 2019-10-06 9:33 ` Oded Gabbay 2019-10-07 5:59 ` Greg Kroah-Hartman 2019-10-07 6:48 ` Christoph Hellwig 0 siblings, 2 replies; 3+ messages in thread From: Oded Gabbay @ 2019-10-06 9:33 UTC (permalink / raw) To: Greg Kroah-Hartman, Linux-Kernel@Vger. Kernel. Org Hi Greg, a while ago we had an argument about identifying in my driver's code whether I'm running on x86 or powerpc. I tried to do something dynamically (based on parent pci bridge ID), and you and other people objected to it. I see in other drivers (more then a few) that they are using #ifdef CONFIG_PPC64 in some places for similar things (e.g. to run code that is only needed in case of powerpc). e.g. from ocxl driver in misc: #ifdef CONFIG_PPC64 static long afu_ioctl_enable_p9_wait(struct ocxl_context *ctx, ... #endif and also: #ifdef CONFIG_PPC64 if (cpu_has_feature(CPU_FTR_P9_TIDR)) arg.flags[0] |= OCXL_IOCTL_FEATURES_FLAGS0_P9_WAIT; #endif Is this approach acceptable on you ? Can I do something similar in my driver: #ifdef CONFIG_PPC64 foo (64) #else foo (48) #endif Thanks, Oded ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Question about using #ifdef CONFIG_PPC64 in driver code 2019-10-06 9:33 ` Question about using #ifdef CONFIG_PPC64 in driver code Oded Gabbay @ 2019-10-07 5:59 ` Greg Kroah-Hartman 2019-10-07 6:48 ` Christoph Hellwig 1 sibling, 0 replies; 3+ messages in thread From: Greg Kroah-Hartman @ 2019-10-07 5:59 UTC (permalink / raw) To: Oded Gabbay; +Cc: Linux-Kernel@Vger. Kernel. Org On Sun, Oct 06, 2019 at 12:33:31PM +0300, Oded Gabbay wrote: > Hi Greg, > a while ago we had an argument about identifying in my driver's code > whether I'm running on x86 or powerpc. I tried to do something > dynamically (based on parent pci bridge ID), and you and other people > objected to it. > > I see in other drivers (more then a few) that they are using #ifdef > CONFIG_PPC64 in some places for similar things (e.g. to run code that > is only needed in case of powerpc). > > e.g. from ocxl driver in misc: > > #ifdef CONFIG_PPC64 > static long afu_ioctl_enable_p9_wait(struct ocxl_context *ctx, > ... > #endif > and also: > > #ifdef CONFIG_PPC64 > if (cpu_has_feature(CPU_FTR_P9_TIDR)) > arg.flags[0] |= OCXL_IOCTL_FEATURES_FLAGS0_P9_WAIT; > #endif ocxl is arguably maybe an exception here, given that it is a PPC64 bus only from what I can tell. Odd that they are using this option, but I think it might be just to keep CONFIG_TEST to work properly. > Is this approach acceptable on you ? > Can I do something similar in my driver: > > #ifdef CONFIG_PPC64 > foo (64) > #else > foo (48) > #endif The thing is, why do you need this? What makes that platform somehow unique for your driver? Focus on that and you should be able to detect it specifically, not just the processor type (which usually is on a wide range of hardware types.) thanks, greg k-h ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Question about using #ifdef CONFIG_PPC64 in driver code 2019-10-06 9:33 ` Question about using #ifdef CONFIG_PPC64 in driver code Oded Gabbay 2019-10-07 5:59 ` Greg Kroah-Hartman @ 2019-10-07 6:48 ` Christoph Hellwig 1 sibling, 0 replies; 3+ messages in thread From: Christoph Hellwig @ 2019-10-07 6:48 UTC (permalink / raw) To: Oded Gabbay; +Cc: Greg Kroah-Hartman, Linux-Kernel@Vger. Kernel. Org On Sun, Oct 06, 2019 at 12:33:31PM +0300, Oded Gabbay wrote: > Hi Greg, > a while ago we had an argument about identifying in my driver's code > whether I'm running on x86 or powerpc. I tried to do something > dynamically (based on parent pci bridge ID), and you and other people > objected to it. > > I see in other drivers (more then a few) that they are using #ifdef > CONFIG_PPC64 in some places for similar things (e.g. to run code that > is only needed in case of powerpc). > e.g. from ocxl driver in misc: > > #ifdef CONFIG_PPC64 > static long afu_ioctl_enable_p9_wait(struct ocxl_context *ctx, > ... > #endif > and also: > > #ifdef CONFIG_PPC64 > if (cpu_has_feature(CPU_FTR_P9_TIDR)) > arg.flags[0] |= OCXL_IOCTL_FEATURES_FLAGS0_P9_WAIT; > #endif > > Is this approach acceptable on you ? This is a pretty horrible example and needs to be fixed up. > Can I do something similar in my driver: > > #ifdef CONFIG_PPC64 > foo (64) > #else > foo (48) > #endif No, you can't. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-07 6:48 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <CAFCwf11-MzroWUmj4qOgwLTibqsdOmPP9cHJjXZmS0Pgr3bEOQ@mail.gmail.com> 2019-10-06 9:33 ` Question about using #ifdef CONFIG_PPC64 in driver code Oded Gabbay 2019-10-07 5:59 ` Greg Kroah-Hartman 2019-10-07 6:48 ` Christoph Hellwig
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.