Sophie

Sophie

distrib > Mandriva > current > x86_64 > by-pkgid > d41cc2729f5f0fbbd2607b14a49457f3 > files > 50

kernel-xen-2.6.32.11-2mdv2010.1.src.rpm

From: jbeulich@novell.com
Subject: no need to build certain bits when building non-privileged kernel
Patch-mainline: n/a

--- sle11sp1-2010-03-29.orig/arch/x86/Kconfig	2010-02-09 17:06:32.000000000 +0100
+++ sle11sp1-2010-03-29/arch/x86/Kconfig	2010-02-09 17:19:17.000000000 +0100
@@ -698,6 +698,7 @@ config HPET_EMULATE_RTC
 config DMI
 	default y
 	bool "Enable DMI scanning" if EMBEDDED
+	depends on !XEN_UNPRIVILEGED_GUEST
 	---help---
 	  Enabled scanning of DMI to identify machine quirks. Say Y
 	  here unless you have verified that your setup is not
@@ -778,6 +779,7 @@ config AMD_IOMMU_STATS
 # need this always selected by IOMMU for the VIA workaround
 config SWIOTLB
 	def_bool y if X86_64 || XEN
+	prompt "Software I/O TLB" if XEN_UNPRIVILEGED_GUEST && !XEN_PCIDEV_FRONTEND
 	---help---
 	  Support for software bounce buffers used on x86-64 systems
 	  which don't have a hardware IOMMU (e.g. the current generation
@@ -1974,13 +1976,15 @@ config PCI_GOBIOS
 
 config PCI_GOMMCONFIG
 	bool "MMConfig"
+	depends on !XEN_UNPRIVILEGED_GUEST
 
 config PCI_GODIRECT
 	bool "Direct"
+	depends on !XEN_UNPRIVILEGED_GUEST
 
 config PCI_GOOLPC
 	bool "OLPC"
-	depends on OLPC
+	depends on OLPC && !XEN_UNPRIVILEGED_GUEST
 
 config PCI_GOXEN_FE
 	bool "Xen PCI Frontend"
@@ -1991,6 +1995,7 @@ config PCI_GOXEN_FE
 
 config PCI_GOANY
 	bool "Any"
+	depends on !XEN_UNPRIVILEGED_GUEST
 
 endchoice
 
@@ -2021,7 +2026,7 @@ config PCI_MMCONFIG
 
 config XEN_PCIDEV_FRONTEND
 	def_bool y
-	prompt "Xen PCI Frontend" if X86_64
+	prompt "Xen PCI Frontend" if X86_64 && !XEN_UNPRIVILEGED_GUEST
 	depends on PCI && XEN && (PCI_GOXEN_FE || PCI_GOANY || X86_64)
  	select HOTPLUG
 	help
@@ -2226,7 +2231,9 @@ source "net/Kconfig"
 
 source "drivers/Kconfig"
 
+if !XEN_UNPRIVILEGED_GUEST
 source "drivers/firmware/Kconfig"
+endif
 
 source "fs/Kconfig"
 
--- sle11sp1-2010-03-29.orig/arch/x86/include/mach-xen/asm/swiotlb.h	2009-11-06 10:51:32.000000000 +0100
+++ sle11sp1-2010-03-29/arch/x86/include/mach-xen/asm/swiotlb.h	2010-01-27 15:05:03.000000000 +0100
@@ -1,4 +1,8 @@
 #include_next <asm/swiotlb.h>
 
+#ifndef CONFIG_SWIOTLB
+#define swiotlb_init()
+#endif
+
 dma_addr_t swiotlb_map_single_phys(struct device *, phys_addr_t, size_t size,
 				   int dir);
--- sle11sp1-2010-03-29.orig/drivers/firmware/Kconfig	2009-11-06 10:51:32.000000000 +0100
+++ sle11sp1-2010-03-29/drivers/firmware/Kconfig	2009-11-06 11:10:32.000000000 +0100
@@ -114,7 +114,7 @@ config DMIID
 
 config ISCSI_IBFT_FIND
 	bool "iSCSI Boot Firmware Table Attributes"
-	depends on X86 && !XEN_UNPRIVILEGED_GUEST
+	depends on X86
 	default n
 	help
 	  This option enables the kernel to find the region of memory
--- sle11sp1-2010-03-29.orig/drivers/xen/Kconfig	2010-03-29 09:13:14.000000000 +0200
+++ sle11sp1-2010-03-29/drivers/xen/Kconfig	2010-03-29 09:13:58.000000000 +0200
@@ -274,6 +274,7 @@ config XEN_USB_FRONTEND_HCD_PM
 
 config XEN_GRANT_DEV
 	tristate "User-space granted page access driver"
+	depends on XEN_BACKEND != n
 	default XEN_PRIVILEGED_GUEST
 	help
 	  Device for accessing (in user-space) pages that have been granted
--- sle11sp1-2010-03-29.orig/drivers/xen/balloon/balloon.c	2010-02-02 15:08:54.000000000 +0100
+++ sle11sp1-2010-03-29/drivers/xen/balloon/balloon.c	2010-03-31 10:00:17.000000000 +0200
@@ -663,6 +663,9 @@ void balloon_update_driver_allowance(lon
 	bs.driver_pages += delta;
 	balloon_unlock(flags);
 }
+EXPORT_SYMBOL_GPL(balloon_update_driver_allowance);
+
+#if defined(CONFIG_XEN_BACKEND) || defined(CONFIG_XEN_BACKEND_MODULE)
 
 #ifdef CONFIG_XEN
 static int dealloc_pte_fn(
@@ -771,6 +774,7 @@ struct page **alloc_empty_pages_and_page
 	pagevec = NULL;
 	goto out;
 }
+EXPORT_SYMBOL_GPL(alloc_empty_pages_and_pagevec);
 
 void free_empty_pages_and_pagevec(struct page **pagevec, int nr_pages)
 {
@@ -791,6 +795,9 @@ void free_empty_pages_and_pagevec(struct
 
 	schedule_work(&balloon_worker);
 }
+EXPORT_SYMBOL_GPL(free_empty_pages_and_pagevec);
+
+#endif /* CONFIG_XEN_BACKEND */
 
 void balloon_release_driver_page(struct page *page)
 {
@@ -804,10 +811,6 @@ void balloon_release_driver_page(struct 
 
 	schedule_work(&balloon_worker);
 }
-
-EXPORT_SYMBOL_GPL(balloon_update_driver_allowance);
-EXPORT_SYMBOL_GPL(alloc_empty_pages_and_pagevec);
-EXPORT_SYMBOL_GPL(free_empty_pages_and_pagevec);
 EXPORT_SYMBOL_GPL(balloon_release_driver_page);
 
 MODULE_LICENSE("Dual BSD/GPL");
--- sle11sp1-2010-03-29.orig/drivers/xen/core/Makefile	2010-01-04 16:17:00.000000000 +0100
+++ sle11sp1-2010-03-29/drivers/xen/core/Makefile	2009-11-06 11:10:32.000000000 +0100
@@ -2,9 +2,10 @@
 # Makefile for the linux kernel.
 #
 
-obj-y := evtchn.o gnttab.o reboot.o machine_reboot.o firmware.o
+obj-y := evtchn.o gnttab.o reboot.o machine_reboot.o
 
-obj-$(CONFIG_PCI)		+= pci.o
+priv-$(CONFIG_PCI)		+= pci.o
+obj-$(CONFIG_XEN_PRIVILEGED_GUEST) += firmware.o $(priv-y)
 obj-$(CONFIG_PROC_FS)		+= xen_proc.o
 obj-$(CONFIG_SYS_HYPERVISOR)	+= hypervisor_sysfs.o
 obj-$(CONFIG_HOTPLUG_CPU)	+= cpu_hotplug.o
--- sle11sp1-2010-03-29.orig/drivers/xen/core/gnttab.c	2010-02-02 15:10:01.000000000 +0100
+++ sle11sp1-2010-03-29/drivers/xen/core/gnttab.c	2009-12-15 09:29:45.000000000 +0100
@@ -437,8 +437,6 @@ static inline unsigned int max_nr_grant_
 
 #ifdef CONFIG_XEN
 
-static DEFINE_SEQLOCK(gnttab_dma_lock);
-
 #ifdef CONFIG_X86
 static int map_pte_fn(pte_t *pte, struct page *pmd_page,
 		      unsigned long addr, void *data)
@@ -508,6 +506,10 @@ static int gnttab_map(unsigned int start
 	return 0;
 }
 
+#if defined(CONFIG_XEN_BACKEND) || defined(CONFIG_XEN_BACKEND_MODULE)
+
+static DEFINE_SEQLOCK(gnttab_dma_lock);
+
 static void gnttab_page_free(struct page *page, unsigned int order)
 {
 	BUG_ON(order);
@@ -639,6 +641,8 @@ void __gnttab_dma_map_page(struct page *
 	} while (unlikely(read_seqretry(&gnttab_dma_lock, seq)));
 }
 
+#endif /* CONFIG_XEN_BACKEND */
+
 #ifdef __HAVE_ARCH_PTE_SPECIAL
 
 static unsigned int GNTMAP_pte_special;
--- sle11sp1-2010-03-29.orig/drivers/xen/privcmd/Makefile	2007-07-10 09:42:30.000000000 +0200
+++ sle11sp1-2010-03-29/drivers/xen/privcmd/Makefile	2009-12-18 08:20:46.000000000 +0100
@@ -1,3 +1,3 @@
-
-obj-y	+= privcmd.o
-obj-$(CONFIG_COMPAT)	+= compat_privcmd.o
+priv-$(CONFIG_COMPAT) := compat_privcmd.o
+obj-y := privcmd.o
+obj-$(CONFIG_XEN_PRIVILEGED_GUEST) += $(priv-y)
--- sle11sp1-2010-03-29.orig/drivers/xen/privcmd/privcmd.c	2010-01-27 14:39:09.000000000 +0100
+++ sle11sp1-2010-03-29/drivers/xen/privcmd/privcmd.c	2010-01-27 15:05:18.000000000 +0100
@@ -33,6 +33,9 @@
 static struct proc_dir_entry *privcmd_intf;
 static struct proc_dir_entry *capabilities_intf;
 
+#ifndef CONFIG_XEN_PRIVILEGED_GUEST
+#define HAVE_ARCH_PRIVCMD_MMAP
+#endif
 #ifndef HAVE_ARCH_PRIVCMD_MMAP
 static int enforce_singleshot_mapping_fn(pte_t *pte, struct page *pmd_page,
 					 unsigned long addr, void *data)
@@ -57,12 +60,14 @@ static long privcmd_ioctl(struct file *f
 {
 	long ret;
 	void __user *udata = (void __user *) data;
+#ifdef CONFIG_XEN_PRIVILEGED_GUEST
 	unsigned long i, addr, nr, nr_pages;
 	int paged_out;
 	struct mm_struct *mm = current->mm;
 	struct vm_area_struct *vma;
 	LIST_HEAD(pagelist);
 	struct list_head *l, *l2;
+#endif
 
 	switch (cmd) {
 	case IOCTL_PRIVCMD_HYPERCALL: {
@@ -87,6 +92,8 @@ static long privcmd_ioctl(struct file *f
 	}
 	break;
 
+#ifdef CONFIG_XEN_PRIVILEGED_GUEST
+
 	case IOCTL_PRIVCMD_MMAP: {
 #define MMAP_NR_PER_PAGE \
 	(unsigned long)((PAGE_SIZE - sizeof(*l)) / sizeof(*msg))
@@ -392,6 +399,8 @@ static long privcmd_ioctl(struct file *f
 	}
 	break;
 
+#endif /* CONFIG_XEN_PRIVILEGED_GUEST */
+
 	default:
 		ret = -EINVAL;
 		break;
@@ -427,7 +436,9 @@ static int privcmd_mmap(struct file * fi
 
 static const struct file_operations privcmd_file_ops = {
 	.unlocked_ioctl = privcmd_ioctl,
+#ifdef CONFIG_XEN_PRIVILEGED_GUEST
 	.mmap = privcmd_mmap,
+#endif
 };
 
 static int capabilities_read(char *page, char **start, off_t off,
--- sle11sp1-2010-03-29.orig/fs/compat_ioctl.c	2010-03-05 10:13:02.000000000 +0100
+++ sle11sp1-2010-03-29/fs/compat_ioctl.c	2010-03-05 10:25:22.000000000 +0100
@@ -2741,10 +2741,12 @@ IGNORE_IOCTL(FBIOSCURSOR32)
 IGNORE_IOCTL(FBIOGCURSOR32)
 #endif
 
-#ifdef CONFIG_XEN
+#ifdef CONFIG_XEN_PRIVILEGED_GUEST
 HANDLE_IOCTL(IOCTL_PRIVCMD_MMAP_32, privcmd_ioctl_32)
 HANDLE_IOCTL(IOCTL_PRIVCMD_MMAPBATCH_32, privcmd_ioctl_32)
 HANDLE_IOCTL(IOCTL_PRIVCMD_MMAPBATCH_V2_32, privcmd_ioctl_32)
+#endif
+#ifdef CONFIG_XEN
 COMPATIBLE_IOCTL(IOCTL_PRIVCMD_HYPERCALL)
 COMPATIBLE_IOCTL(IOCTL_EVTCHN_BIND_VIRQ)
 COMPATIBLE_IOCTL(IOCTL_EVTCHN_BIND_INTERDOMAIN)
--- sle11sp1-2010-03-29.orig/include/xen/firmware.h	2007-07-02 08:16:19.000000000 +0200
+++ sle11sp1-2010-03-29/include/xen/firmware.h	2009-11-06 11:10:32.000000000 +0100
@@ -5,6 +5,10 @@
 void copy_edd(void);
 #endif
 
+#ifdef CONFIG_XEN_PRIVILEGED_GUEST
 void copy_edid(void);
+#else
+static inline void copy_edid(void) {}
+#endif
 
 #endif /* __XEN_FIRMWARE_H__ */
--- sle11sp1-2010-03-29.orig/include/xen/gnttab.h	2009-11-06 11:10:15.000000000 +0100
+++ sle11sp1-2010-03-29/include/xen/gnttab.h	2009-12-15 09:54:17.000000000 +0100
@@ -103,7 +103,11 @@ void gnttab_grant_foreign_transfer_ref(g
 				       unsigned long pfn);
 
 int gnttab_copy_grant_page(grant_ref_t ref, struct page **pagep);
+#if defined(CONFIG_XEN_BACKEND) || defined(CONFIG_XEN_BACKEND_MODULE)
 void __gnttab_dma_map_page(struct page *page);
+#else
+#define __gnttab_dma_map_page __gnttab_dma_unmap_page
+#endif
 static inline void __gnttab_dma_unmap_page(struct page *page)
 {
 }