lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191007064823.GB25561@infradead.org>
Date:   Sun, 6 Oct 2019 23:48:23 -0700
From:   Christoph Hellwig <hch@...radead.org>
To:     Oded Gabbay <oded.gabbay@...il.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Linux-Kernel@...r. Kernel. Org" <linux-kernel@...r.kernel.org>
Subject: Re: Question about using #ifdef CONFIG_PPC64 in driver code

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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ