direct-io.hg

changeset 11202:bb52372aa17f

[LINUX] Replace uses of CONFIG_XEN_PRIVILEGED_GUEST with is_initial_xendomain().
Signed-off-by: Jan Beulich <jbeulich@novell.com>
author kaf24@localhost.localdomain
date Sat Aug 19 12:08:12 2006 +0100 (2006-08-19)
parents a71c265924d2
children 26576f1dbadb
files linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c linux-2.6-xen-sparse/arch/i386/pci/irq-xen.c linux-2.6-xen-sparse/arch/x86_64/kernel/genapic_xen.c linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c	Sat Aug 19 12:07:07 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c	Sat Aug 19 12:08:12 2006 +0100
     1.3 @@ -184,7 +184,6 @@ static struct resource code_resource = {
     1.4  	.flags	= IORESOURCE_BUSY | IORESOURCE_MEM
     1.5  };
     1.6  
     1.7 -#ifdef CONFIG_XEN_PRIVILEGED_GUEST
     1.8  static struct resource system_rom_resource = {
     1.9  	.name	= "System ROM",
    1.10  	.start	= 0xf0000,
    1.11 @@ -240,7 +239,6 @@ static struct resource video_rom_resourc
    1.12  	.end	= 0xc7fff,
    1.13  	.flags	= IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
    1.14  };
    1.15 -#endif
    1.16  
    1.17  static struct resource video_ram_resource = {
    1.18  	.name	= "Video RAM area",
    1.19 @@ -299,7 +297,6 @@ static struct resource standard_io_resou
    1.20  #define STANDARD_IO_RESOURCES \
    1.21  	(sizeof standard_io_resources / sizeof standard_io_resources[0])
    1.22  
    1.23 -#ifdef CONFIG_XEN_PRIVILEGED_GUEST
    1.24  #define romsignature(x) (*(unsigned short *)(x) == 0xaa55)
    1.25  
    1.26  static int __init romchecksum(unsigned char *rom, unsigned long length)
    1.27 @@ -317,9 +314,11 @@ static void __init probe_roms(void)
    1.28  	unsigned char *rom;
    1.29  	int	      i;
    1.30  
    1.31 +#ifdef CONFIG_XEN
    1.32  	/* Nothing to do if not running in dom0. */
    1.33  	if (!is_initial_xendomain())
    1.34  		return;
    1.35 +#endif
    1.36  
    1.37  	/* video rom */
    1.38  	upper = adapter_rom_resources[0].start;
    1.39 @@ -379,7 +378,6 @@ static void __init probe_roms(void)
    1.40  		start = adapter_rom_resources[i++].end & ~2047UL;
    1.41  	}
    1.42  }
    1.43 -#endif
    1.44  
    1.45  /*
    1.46   * Point at the empty zero page to start with. We map the real shared_info
    1.47 @@ -1359,9 +1357,7 @@ legacy_init_iomem_resources(struct e820e
    1.48  {
    1.49  	int i;
    1.50  
    1.51 -#if defined(CONFIG_XEN_PRIVILEGED_GUEST) || !defined(CONFIG_XEN)
    1.52  	probe_roms();
    1.53 -#endif
    1.54  
    1.55  	for (i = 0; i < nr_map; i++) {
    1.56  		struct resource *res;
     2.1 --- a/linux-2.6-xen-sparse/arch/i386/pci/irq-xen.c	Sat Aug 19 12:07:07 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/arch/i386/pci/irq-xen.c	Sat Aug 19 12:08:12 2006 +0100
     2.3 @@ -95,7 +95,10 @@ static struct irq_routing_table * __init
     2.4  	u8 *addr;
     2.5  	struct irq_routing_table *rt;
     2.6  
     2.7 -#ifdef CONFIG_XEN_PRIVILEGED_GUEST
     2.8 +#ifdef CONFIG_XEN
     2.9 +	if (!is_initial_xendomain())
    2.10 +		return NULL;
    2.11 +#endif
    2.12  	if (pirq_table_addr) {
    2.13  		rt = pirq_check_routing_table((u8 *) isa_bus_to_virt(pirq_table_addr));
    2.14  		if (rt)
    2.15 @@ -107,7 +110,6 @@ static struct irq_routing_table * __init
    2.16  		if (rt)
    2.17  			return rt;
    2.18  	}
    2.19 -#endif
    2.20  	
    2.21  	return NULL;
    2.22  }
     3.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/genapic_xen.c	Sat Aug 19 12:07:07 2006 +0100
     3.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/genapic_xen.c	Sat Aug 19 12:08:12 2006 +0100
     3.3 @@ -17,14 +17,8 @@
     3.4  #include <linux/kernel.h>
     3.5  #include <linux/ctype.h>
     3.6  #include <linux/init.h>
     3.7 -#ifdef CONFIG_XEN_PRIVILEGED_GUEST
     3.8  #include <asm/smp.h>
     3.9  #include <asm/ipi.h>
    3.10 -#else
    3.11 -#include <asm/apic.h>
    3.12 -#include <asm/apicdef.h>
    3.13 -#include <asm/genapic.h>
    3.14 -#endif
    3.15  #include <xen/evtchn.h>
    3.16  
    3.17  DECLARE_PER_CPU(int, ipi_to_irq[NR_IPIS]);
    3.18 @@ -118,14 +112,12 @@ static void xen_send_IPI_mask(cpumask_t 
    3.19  	local_irq_restore(flags);
    3.20  }
    3.21  
    3.22 -#ifdef CONFIG_XEN_PRIVILEGED_GUEST
    3.23  static int xen_apic_id_registered(void)
    3.24  {
    3.25  	/* better be set */
    3.26  	Dprintk("%s\n", __FUNCTION__);
    3.27  	return physid_isset(smp_processor_id(), phys_cpu_present_map);
    3.28  }
    3.29 -#endif
    3.30  
    3.31  static unsigned int xen_cpu_mask_to_apicid(cpumask_t cpumask)
    3.32  {
    3.33 @@ -144,15 +136,11 @@ static unsigned int phys_pkg_id(int inde
    3.34  
    3.35  struct genapic apic_xen =  {
    3.36  	.name = "xen",
    3.37 -#ifdef CONFIG_XEN_PRIVILEGED_GUEST
    3.38  	.int_delivery_mode = dest_LowestPrio,
    3.39 -#endif
    3.40  	.int_dest_mode = (APIC_DEST_LOGICAL != 0),
    3.41  	.int_delivery_dest = APIC_DEST_LOGICAL | APIC_DM_LOWEST,
    3.42  	.target_cpus = xen_target_cpus,
    3.43 -#ifdef CONFIG_XEN_PRIVILEGED_GUEST
    3.44  	.apic_id_registered = xen_apic_id_registered,
    3.45 -#endif
    3.46  	.init_apic_ldr = xen_init_apic_ldr,
    3.47  	.send_IPI_all = xen_send_IPI_all,
    3.48  	.send_IPI_allbutself = xen_send_IPI_allbutself,
     4.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c	Sat Aug 19 12:07:07 2006 +0100
     4.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c	Sat Aug 19 12:08:12 2006 +0100
     4.3 @@ -189,7 +189,6 @@ struct resource code_resource = {
     4.4  
     4.5  #define IORESOURCE_ROM (IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM)
     4.6  
     4.7 -#if defined(CONFIG_XEN_PRIVILEGED_GUEST) || !defined(CONFIG_XEN)
     4.8  static struct resource system_rom_resource = {
     4.9  	.name = "System ROM",
    4.10  	.start = 0xf0000,
    4.11 @@ -218,19 +217,16 @@ static struct resource adapter_rom_resou
    4.12  	{ .name = "Adapter ROM", .start = 0, .end = 0,
    4.13  		.flags = IORESOURCE_ROM }
    4.14  };
    4.15 -#endif
    4.16  
    4.17  #define ADAPTER_ROM_RESOURCES \
    4.18  	(sizeof adapter_rom_resources / sizeof adapter_rom_resources[0])
    4.19  
    4.20 -#if defined(CONFIG_XEN_PRIVILEGED_GUEST) || !defined(CONFIG_XEN)
    4.21  static struct resource video_rom_resource = {
    4.22  	.name = "Video ROM",
    4.23  	.start = 0xc0000,
    4.24  	.end = 0xc7fff,
    4.25  	.flags = IORESOURCE_ROM,
    4.26  };
    4.27 -#endif
    4.28  
    4.29  static struct resource video_ram_resource = {
    4.30  	.name = "Video RAM area",
    4.31 @@ -239,7 +235,6 @@ static struct resource video_ram_resourc
    4.32  	.flags = IORESOURCE_RAM,
    4.33  };
    4.34  
    4.35 -#if defined(CONFIG_XEN_PRIVILEGED_GUEST) || !defined(CONFIG_XEN)
    4.36  #define romsignature(x) (*(unsigned short *)(x) == 0xaa55)
    4.37  
    4.38  static int __init romchecksum(unsigned char *rom, unsigned long length)
    4.39 @@ -257,6 +252,12 @@ static void __init probe_roms(void)
    4.40  	unsigned char *rom;
    4.41  	int	      i;
    4.42  
    4.43 +#ifdef CONFIG_XEN
    4.44 +	/* Nothing to do if not running in dom0. */
    4.45 +	if (!is_initial_xendomain())
    4.46 +		return;
    4.47 +#endif
    4.48 +
    4.49  	/* video rom */
    4.50  	upper = adapter_rom_resources[0].start;
    4.51  	for (start = video_rom_resource.start; start < upper; start += 2048) {
    4.52 @@ -315,7 +316,6 @@ static void __init probe_roms(void)
    4.53  		start = adapter_rom_resources[i++].end & ~2047UL;
    4.54  	}
    4.55  }
    4.56 -#endif
    4.57  
    4.58  static __init void parse_cmdline_early (char ** cmdline_p)
    4.59  {
    4.60 @@ -625,11 +625,8 @@ static void __init reserve_ebda_region(v
    4.61  void __init setup_arch(char **cmdline_p)
    4.62  {
    4.63  	unsigned long kernel_end;
    4.64 -
    4.65 -#if defined(CONFIG_XEN_PRIVILEGED_GUEST)
    4.66  	struct e820entry *machine_e820;
    4.67  	struct xen_memory_map memmap;
    4.68 -#endif
    4.69  
    4.70  #ifdef CONFIG_XEN
    4.71  	/* Register a call for panic conditions. */
    4.72 @@ -936,8 +933,8 @@ void __init setup_arch(char **cmdline_p)
    4.73  	 * Request address space for all standard RAM and ROM resources
    4.74  	 * and also for regions reported as reserved by the e820.
    4.75  	 */
    4.76 -#if defined(CONFIG_XEN_PRIVILEGED_GUEST)
    4.77  	probe_roms();
    4.78 +#ifdef CONFIG_XEN
    4.79  	if (is_initial_xendomain()) {
    4.80  		machine_e820 = alloc_bootmem_low_pages(PAGE_SIZE);
    4.81  
    4.82 @@ -948,13 +945,8 @@ void __init setup_arch(char **cmdline_p)
    4.83  
    4.84  		e820_reserve_resources(machine_e820, memmap.nr_entries);
    4.85  	} else
    4.86 -		e820_reserve_resources(e820.map, e820.nr_map);
    4.87 -#elif defined(CONFIG_XEN)
    4.88 +#endif
    4.89  	e820_reserve_resources(e820.map, e820.nr_map);
    4.90 -#else
    4.91 -	probe_roms();
    4.92 -	e820_reserve_resources(e820.map, e820.nr_map);
    4.93 -#endif
    4.94  
    4.95  	request_resource(&iomem_resource, &video_ram_resource);
    4.96  
    4.97 @@ -965,12 +957,12 @@ void __init setup_arch(char **cmdline_p)
    4.98  		request_resource(&ioport_resource, &standard_io_resources[i]);
    4.99  	}
   4.100  
   4.101 -#if defined(CONFIG_XEN_PRIVILEGED_GUEST)
   4.102 +#ifdef CONFIG_XEN
   4.103  	if (is_initial_xendomain()) {
   4.104  		e820_setup_gap(machine_e820, memmap.nr_entries);
   4.105  		free_bootmem(__pa(machine_e820), PAGE_SIZE);
   4.106  	}
   4.107 -#elif !defined(CONFIG_XEN)
   4.108 +#else
   4.109  	e820_setup_gap(e820.map, e820.nr_map);
   4.110  #endif
   4.111  
     5.1 --- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Sat Aug 19 12:07:07 2006 +0100
     5.2 +++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Sat Aug 19 12:08:12 2006 +0100
     5.3 @@ -108,7 +108,6 @@ static int privcmd_ioctl(struct inode *i
     5.4  	}
     5.5  	break;
     5.6  
     5.7 -#if defined(CONFIG_XEN_PRIVILEGED_GUEST)
     5.8  	case IOCTL_PRIVCMD_MMAP: {
     5.9  #define PRIVCMD_MMAP_SZ 32
    5.10  		privcmd_mmap_t mmapcmd;
    5.11 @@ -116,6 +115,9 @@ static int privcmd_ioctl(struct inode *i
    5.12  		privcmd_mmap_entry_t __user *p;
    5.13  		int i, rc;
    5.14  
    5.15 +		if (!is_initial_xendomain())
    5.16 +			return -EPERM;
    5.17 +
    5.18  		if (copy_from_user(&mmapcmd, udata, sizeof(mmapcmd)))
    5.19  			return -EFAULT;
    5.20  
    5.21 @@ -165,6 +167,9 @@ static int privcmd_ioctl(struct inode *i
    5.22  		unsigned long addr, mfn;
    5.23  		int i;
    5.24  
    5.25 +		if (!is_initial_xendomain())
    5.26 +			return -EPERM;
    5.27 +
    5.28  		if (copy_from_user(&m, udata, sizeof(m))) {
    5.29  			ret = -EFAULT;
    5.30  			goto batch_err;
    5.31 @@ -215,7 +220,6 @@ static int privcmd_ioctl(struct inode *i
    5.32  		break;
    5.33  	}
    5.34  	break;
    5.35 -#endif
    5.36  
    5.37  	default:
    5.38  		ret = -EINVAL;
     6.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h	Sat Aug 19 12:07:07 2006 +0100
     6.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h	Sat Aug 19 12:08:12 2006 +0100
     6.3 @@ -58,7 +58,7 @@ extern shared_info_t *HYPERVISOR_shared_
     6.4  
     6.5  /* arch/xen/i386/kernel/setup.c */
     6.6  extern start_info_t *xen_start_info;
     6.7 -#ifdef CONFIG_XEN
     6.8 +#ifdef CONFIG_XEN_PRIVILEGED_GUEST
     6.9  #define is_initial_xendomain() (xen_start_info->flags & SIF_INITDOMAIN)
    6.10  #else
    6.11  #define is_initial_xendomain() 0