Subject: Re: [PATCH] x86: export 'pcibios_enabled'

From: Wang YanQing <[email-masked]>
Date: Mon, 26 Mar 2012 08:27:01 +0800

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?