From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wang YanQing Date: Mon, 26 Mar 2012 00:27:01 +0000 Subject: Re: [PATCH] x86: export 'pcibios_enabled' Message-Id: <20120326002701.GA3624@udknight> List-Id: References: <20120313204114.e160849af7dbe5a4b4e5c0ad@canb.auug.org.au> <4F5FAE63.3090908@xenotime.net> <4F5FE9AD.7000204@zytor.com> <20120314092955.2250a782@pyramind.ukuu.org.uk> <4F607A18.8080004@gmx.de> <20120314112137.68fa4f70@pyramind.ukuu.org.uk> <20120322004135.GA4253@udknight> In-Reply-To: <20120322004135.GA4253@udknight> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Alan Cox , Florian Tobias Schandinat , "H. Peter Anvin" , Randy Dunlap , Stephen Rothwell , linux-next@vger.kernel.org, LKML , Michal Januszewski , linux-fbdev@vger.kernel.org, x86@kernel.org, Andrew Morton On Thu, Mar 22, 2012 at 08:41:35AM +0800, Wang YanQing wrote: > On Wed, Mar 14, 2012 at 11:21:37AM +0000, Alan Cox wrote: > > You can use set_memory_x() to mark memory executable (and _nx to set it back). > > > NO I can't, if I set_memory_x and don't set pcibios_enabled = 1, then > static_protections will still failed because pcibios_enabled = 0, > and I don't want to use set_memory_x, because I don't want to give the user > of uvesafb that feeling "I will lost BIOS NX protection if I choice uvesafb." > > > If you really need to know if NX is being used then the check > > > > if (__supported_pte_mask & PTE_NX) > > > > will do the trick and the variable is exported. > I don't understand what do you mean, do you means CONFIG_X86_PAE for 32? Or CONFIG_X86_64? > when NX is being used, the pci bios is NX or not also depend on > ACPI.ACPI on or off all will influnce the code path in pci_arch_init, > decide the set_bios_x have chance to execute or not.See > https://lkml.org/lkml/2011/11/16/84 > > By the way _PAGE_NX instead of PTE_NX, right? > > > I'd suggest however you wrap that in a cpu_has_nx() type macro somewhere > > in the arch headers. > > > The same above. > > > If you go poking around pcibios values you are going to get burned if > > someone is ever bored enough to make NX and PCIBIOS work together > > differently. > > > Indeed according to 5bd5a452662bc37c54fb6828db1a3faf87e6511c, who bring me > the trouble, check the pcibios_enabled is the only simple and good way to > resolve the Oops I meet. > > If you really don't want it, and if I am not all wrong about your "helper method", > you means you want export the below: > int check_pcibios_enabled()? > See https://lkml.org/lkml/2012/2/26/124 > > Thanks. > Sorry for the delay reply and cross email threads, Alan Cox. But I still can't find a better way then to check the pcibios_enabled variable, any better suggestion?