You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qubes-linux-kernel/patches.xen/xen-unpriv-build

373 lines
12 KiB

From: jbeulich@novell.com
Subject: no need to build certain bits when building non-privileged kernel
Patch-mainline: n/a
--- head-2011-02-08.orig/arch/x86/Kconfig 2011-02-02 15:09:52.000000000 +0100
+++ head-2011-02-08/arch/x86/Kconfig 2011-02-02 15:10:34.000000000 +0100
@@ -665,6 +665,7 @@ config APB_TIMER
config DMI
default y
bool "Enable DMI scanning" if EXPERT
+ 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
@@ -745,6 +746,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
@@ -1968,13 +1970,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 XO-1"
- depends on OLPC
+ depends on OLPC && !XEN_UNPRIVILEGED_GUEST
config PCI_GOXEN_FE
bool "Xen PCI Frontend"
@@ -1985,6 +1989,7 @@ config PCI_GOXEN_FE
config PCI_GOANY
bool "Any"
+ depends on !XEN_UNPRIVILEGED_GUEST
endchoice
@@ -2185,7 +2190,7 @@ endif # X86_32
config AMD_NB
def_bool y
- depends on CPU_SUP_AMD && PCI
+ depends on CPU_SUP_AMD && PCI && !XEN_UNPRIVILEGED_GUEST
source "drivers/pcmcia/Kconfig"
@@ -2240,7 +2245,9 @@ source "net/Kconfig"
source "drivers/Kconfig"
+if !XEN_UNPRIVILEGED_GUEST
source "drivers/firmware/Kconfig"
+endif
source "fs/Kconfig"
--- head-2011-02-08.orig/arch/x86/include/mach-xen/asm/swiotlb.h 2011-02-01 15:09:47.000000000 +0100
+++ head-2011-02-08/arch/x86/include/mach-xen/asm/swiotlb.h 2011-02-02 15:10:34.000000000 +0100
@@ -1,4 +1,8 @@
#include_next <asm/swiotlb.h>
+#ifndef CONFIG_SWIOTLB
+#define swiotlb_init(verbose) ((void)(verbose))
+#endif
+
dma_addr_t swiotlb_map_single_phys(struct device *, phys_addr_t, size_t size,
int dir);
--- head-2011-02-08.orig/drivers/firmware/Kconfig 2010-11-23 16:20:20.000000000 +0100
+++ head-2011-02-08/drivers/firmware/Kconfig 2011-02-02 15:10:34.000000000 +0100
@@ -116,7 +116,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
--- head-2011-02-08.orig/drivers/pci/Kconfig 2011-02-01 15:09:47.000000000 +0100
+++ head-2011-02-08/drivers/pci/Kconfig 2011-02-02 15:10:34.000000000 +0100
@@ -74,7 +74,7 @@ config PARAVIRT_XEN_PCIDEV_FRONTEND
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
--- head-2011-02-08.orig/drivers/xen/Kconfig 2010-11-26 13:38:08.000000000 +0100
+++ head-2011-02-08/drivers/xen/Kconfig 2011-02-09 16:23:14.000000000 +0100
@@ -19,7 +19,8 @@ config XEN_PRIVILEGED_GUEST
Support for privileged operation (domain 0)
config XEN_UNPRIVILEGED_GUEST
- def_bool !XEN_PRIVILEGED_GUEST
+ def_bool y
+ depends on !XEN_PRIVILEGED_GUEST
select PM
select SUSPEND
@@ -271,6 +272,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
--- head-2011-02-08.orig/drivers/xen/balloon/balloon.c 2010-11-25 13:47:01.000000000 +0100
+++ head-2011-02-08/drivers/xen/balloon/balloon.c 2011-02-02 15:10:34.000000000 +0100
@@ -660,6 +660,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(
@@ -768,6 +771,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)
{
@@ -788,6 +792,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)
{
@@ -801,10 +808,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");
--- head-2011-02-08.orig/drivers/xen/console/console.c 2011-02-01 15:04:27.000000000 +0100
+++ head-2011-02-08/drivers/xen/console/console.c 2011-02-02 15:10:34.000000000 +0100
@@ -47,7 +47,6 @@
#include <linux/init.h>
#include <linux/console.h>
#include <linux/sysrq.h>
-#include <linux/screen_info.h>
#include <linux/vt.h>
#include <asm/io.h>
#include <asm/irq.h>
@@ -244,6 +243,7 @@ static int __init xen_console_init(void)
}
console_initcall(xen_console_init);
+#ifdef CONFIG_XEN_PRIVILEGED_GUEST
/*** Useful function for console debugging -- goes straight to Xen. ***/
asmlinkage int xprintk(const char *fmt, ...)
{
@@ -261,6 +261,7 @@ asmlinkage int xprintk(const char *fmt,
return 0;
}
+#endif
/*** Forcibly flush console data before dying. ***/
void xencons_force_flush(void)
@@ -285,6 +286,9 @@ void xencons_force_flush(void)
}
+#ifdef CONFIG_XEN_PRIVILEGED_GUEST
+#include <linux/screen_info.h>
+
void __init dom0_init_screen_info(const struct dom0_vga_console_info *info, size_t size)
{
/* This is drawn from a dump from vgacon:startup in
@@ -340,6 +344,7 @@ void __init dom0_init_screen_info(const
break;
}
}
+#endif
/******************** User-space console driver (/dev/console) ************/
--- head-2011-02-08.orig/drivers/xen/core/Makefile 2011-02-02 15:09:57.000000000 +0100
+++ head-2011-02-08/drivers/xen/core/Makefile 2011-02-02 15:10:34.000000000 +0100
@@ -2,10 +2,11 @@
# 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
-obj-$(CONFIG_ACPI_HOTPLUG_CPU) += pcpu.o
+priv-$(CONFIG_PCI) += pci.o
+priv-$(CONFIG_ACPI_HOTPLUG_CPU) += pcpu.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
--- head-2011-02-08.orig/drivers/xen/core/evtchn.c 2011-02-16 08:29:50.000000000 +0100
+++ head-2011-02-08/drivers/xen/core/evtchn.c 2011-02-16 08:30:09.000000000 +0100
@@ -1854,6 +1854,7 @@ void evtchn_register_pirq(int irq)
"fasteoi");
}
+#ifdef CONFIG_PCI_MSI
int evtchn_map_pirq(int irq, int xen_pirq)
{
if (irq < 0) {
@@ -1928,6 +1929,7 @@ int evtchn_map_pirq(int irq, int xen_pir
}
return index_from_irq(irq) ? irq : -EINVAL;
}
+#endif
int evtchn_get_xen_pirq(int irq)
{
--- head-2011-02-08.orig/drivers/xen/core/gnttab.c 2011-02-02 15:10:16.000000000 +0100
+++ head-2011-02-08/drivers/xen/core/gnttab.c 2011-02-02 15:10:34.000000000 +0100
@@ -436,8 +436,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)
@@ -507,6 +505,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);
@@ -638,6 +640,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;
--- head-2011-02-08.orig/drivers/xen/privcmd/Makefile 2007-07-10 09:42:30.000000000 +0200
+++ head-2011-02-08/drivers/xen/privcmd/Makefile 2011-02-02 15:10:34.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)
--- head-2011-02-08.orig/drivers/xen/privcmd/privcmd.c 2011-02-01 15:09:47.000000000 +0100
+++ head-2011-02-08/drivers/xen/privcmd/privcmd.c 2011-02-02 15:10:34.000000000 +0100
@@ -32,6 +32,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)
@@ -56,12 +59,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: {
@@ -86,6 +91,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))
@@ -391,6 +398,8 @@ static long privcmd_ioctl(struct file *f
}
break;
+#endif /* CONFIG_XEN_PRIVILEGED_GUEST */
+
default:
ret = -EINVAL;
break;
@@ -429,7 +438,9 @@ static const struct file_operations priv
.open = nonseekable_open,
.llseek = no_llseek,
.unlocked_ioctl = privcmd_ioctl,
+#ifdef CONFIG_XEN_PRIVILEGED_GUEST
.mmap = privcmd_mmap,
+#endif
};
static int capabilities_read(char *page, char **start, off_t off,
--- head-2011-02-08.orig/fs/compat_ioctl.c 2011-02-01 14:55:46.000000000 +0100
+++ head-2011-02-08/fs/compat_ioctl.c 2011-02-02 15:10:34.000000000 +0100
@@ -1481,7 +1481,7 @@ static long do_ioctl_trans(int fd, unsig
return do_video_stillpicture(fd, cmd, argp);
case VIDEO_SET_SPU_PALETTE:
return do_video_set_spu_palette(fd, cmd, argp);
-#ifdef CONFIG_XEN
+#ifdef CONFIG_XEN_PRIVILEGED_GUEST
case IOCTL_PRIVCMD_MMAP_32:
case IOCTL_PRIVCMD_MMAPBATCH_32:
case IOCTL_PRIVCMD_MMAPBATCH_V2_32:
--- head-2011-02-08.orig/include/xen/firmware.h 2007-07-02 08:16:19.000000000 +0200
+++ head-2011-02-08/include/xen/firmware.h 2011-02-02 15:10:34.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__ */
--- head-2011-02-08.orig/include/xen/gnttab.h 2010-11-23 15:07:01.000000000 +0100
+++ head-2011-02-08/include/xen/gnttab.h 2011-02-02 15:10:34.000000000 +0100
@@ -104,7 +104,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)
{
}