linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wang YanQing <udknight@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@elte.hu,
	hpa@linux.intel.com, x86@kernel.org, spock@gentoo.org
Subject: [PATCH 1/2] x86:add function to check BIOS whether NX
Date: Thu, 23 Feb 2012 14:34:35 +0800	[thread overview]
Message-ID: <20120223063435.GA4090@udknight> (raw)

Although we don't want any RWX memory in system,
but there are still some may need it, for example
uvesafb, so we give them this function to check
and ajust themself.

Signed-off-by: Wang YanQing <udknight@gmail.com>
---
 arch/x86/include/asm/pci.h |    1 +
 arch/x86/mm/pageattr.c     |    2 +-
 arch/x86/pci/pcbios.c      |   11 +++++++++++
 3 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index df75d07..31d657b 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -66,6 +66,7 @@ extern unsigned long pci_mem_start;
 #define PCIBIOS_MIN_CARDBUS_IO	0x4000
 
 extern int pcibios_enabled;
+extern int check_pcibios_enabled(void);
 void pcibios_config_init(void);
 struct pci_bus *pcibios_scan_root(int bus);
 
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index e1ebde3..b1fb064 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -260,7 +260,7 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address,
 	 * PCI BIOS based config access (CONFIG_PCI_GOBIOS) support.
 	 */
 #ifdef CONFIG_PCI_BIOS
-	if (pcibios_enabled && within(pfn, BIOS_BEGIN >> PAGE_SHIFT, BIOS_END >> PAGE_SHIFT))
+	if (check_pcibios_enabled() && within(pfn, BIOS_BEGIN >> PAGE_SHIFT, BIOS_END >> PAGE_SHIFT))
 		pgprot_val(forbidden) |= _PAGE_NX;
 #endif
 
diff --git a/arch/x86/pci/pcbios.c b/arch/x86/pci/pcbios.c
index da8fe05..86e0674 100644
--- a/arch/x86/pci/pcbios.c
+++ b/arch/x86/pci/pcbios.c
@@ -28,6 +28,17 @@
 
 int pcibios_enabled;
 
+/*
+  Although we don't want any RWX memory in system,
+  but there are still some may need it, so we give
+  them this function to check and ajust themself.
+*/
+int check_pcibios_enabled()
+{
+	return pcibios_enabled;
+}
+EXPORT_SYMBOL(check_pcibios_enabled);
+
 /* According to the BIOS specification at:
  * http://members.datafast.net.au/dft0802/specs/bios21.pdf, we could
  * restrict the x zone to some pages and make it ro. But this may be
-- 
1.7.3.4


             reply	other threads:[~2012-02-23  6:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-23  6:34 Wang YanQing [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-02-27  1:02 [PATCH 1/2] x86:add function to check BIOS whether NX Wang YanQing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120223063435.GA4090@udknight \
    --to=udknight@gmail.com \
    --cc=hpa@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=spock@gentoo.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).