[PATCH] paravirt: Be careful about touching BIOS address space
BIOS ROM areas may not be mapped into the guest address space, so be careful when touching those addresses to make sure they appear to be mapped. [akpm@osdl.org: fix unused var warning] AK: Changed __get_user to probe_kernel_address Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Andi Kleen <ak@suse.de> Cc: Jeremy Fitzhardinge <jeremy@goop.org> Cc: Andi Kleen <ak@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org>
This commit is contained in:
parent
da181a8b39
commit
bd472c794b
|
@ -9,6 +9,7 @@
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <linux/efi.h>
|
#include <linux/efi.h>
|
||||||
#include <linux/pfn.h>
|
#include <linux/pfn.h>
|
||||||
|
#include <linux/uaccess.h>
|
||||||
|
|
||||||
#include <asm/pgtable.h>
|
#include <asm/pgtable.h>
|
||||||
#include <asm/page.h>
|
#include <asm/page.h>
|
||||||
|
@ -155,7 +156,14 @@ static struct resource standard_io_resources[] = { {
|
||||||
.flags = IORESOURCE_BUSY | IORESOURCE_IO
|
.flags = IORESOURCE_BUSY | IORESOURCE_IO
|
||||||
} };
|
} };
|
||||||
|
|
||||||
#define romsignature(x) (*(unsigned short *)(x) == 0xaa55)
|
static int romsignature(const unsigned char *x)
|
||||||
|
{
|
||||||
|
unsigned short sig;
|
||||||
|
int ret = 0;
|
||||||
|
if (probe_kernel_address((const unsigned short *)x, sig) == 0)
|
||||||
|
ret = (sig == 0xaa55);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static int __init romchecksum(unsigned char *rom, unsigned long length)
|
static int __init romchecksum(unsigned char *rom, unsigned long length)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <linux/pci.h>
|
#include <linux/pci.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
#include <linux/uaccess.h>
|
||||||
#include "pci.h"
|
#include "pci.h"
|
||||||
#include "pci-functions.h"
|
#include "pci-functions.h"
|
||||||
|
|
||||||
|
@ -314,6 +315,10 @@ static struct pci_raw_ops * __devinit pci_find_bios(void)
|
||||||
for (check = (union bios32 *) __va(0xe0000);
|
for (check = (union bios32 *) __va(0xe0000);
|
||||||
check <= (union bios32 *) __va(0xffff0);
|
check <= (union bios32 *) __va(0xffff0);
|
||||||
++check) {
|
++check) {
|
||||||
|
long sig;
|
||||||
|
if (probe_kernel_address(&check->fields.signature, sig))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (check->fields.signature != BIOS32_SIGNATURE)
|
if (check->fields.signature != BIOS32_SIGNATURE)
|
||||||
continue;
|
continue;
|
||||||
length = check->fields.length * 16;
|
length = check->fields.length * 16;
|
||||||
|
@ -331,11 +336,13 @@ static struct pci_raw_ops * __devinit pci_find_bios(void)
|
||||||
}
|
}
|
||||||
DBG("PCI: BIOS32 Service Directory structure at 0x%p\n", check);
|
DBG("PCI: BIOS32 Service Directory structure at 0x%p\n", check);
|
||||||
if (check->fields.entry >= 0x100000) {
|
if (check->fields.entry >= 0x100000) {
|
||||||
printk("PCI: BIOS32 entry (0x%p) in high memory, cannot use.\n", check);
|
printk("PCI: BIOS32 entry (0x%p) in high memory, "
|
||||||
|
"cannot use.\n", check);
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
unsigned long bios32_entry = check->fields.entry;
|
unsigned long bios32_entry = check->fields.entry;
|
||||||
DBG("PCI: BIOS32 Service Directory entry at 0x%lx\n", bios32_entry);
|
DBG("PCI: BIOS32 Service Directory entry at 0x%lx\n",
|
||||||
|
bios32_entry);
|
||||||
bios32_indirect.address = bios32_entry + PAGE_OFFSET;
|
bios32_indirect.address = bios32_entry + PAGE_OFFSET;
|
||||||
if (check_pcibios())
|
if (check_pcibios())
|
||||||
return &pci_bios_access;
|
return &pci_bios_access;
|
||||||
|
|
Loading…
Reference in New Issue