unmodified_drivers: misc changes for xenlinux PVonHVM drivers
PATCH 1/1 unmodified_drivers: misc changes for xenlinux PVonHVM drivers
This series of patches is used since some time to compile the PVonHVM drivers against the forward ported xenlinux tree used in openSuSE.
Please review and apply.
Changes:unmodified_drivers: hide xen_cpuid_base() in version 2.6.38+unmodified_drivers: add pfn_is_ram helper for kdumpunmodified_drivers: use upstream sync_bitops if availableunmodified_drivers: compile vcd.c into blkfront if available
unmodified_drivers/linux-2.6/blkfront/Kbuild | 1 unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h | 10 +++ unmodified_drivers/linux-2.6/platform-pci/platform-pci.c | 31 ++++++++++ 3 files changed, 42 insertions(+)
PATCH 1/1 unmodified_drivers: hide xen_cpuid_base() in version 2.6.38+
# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1331883705 -3600
# Node ID 5504366919926f8a2d6fc7fdc392e6218ae6c702 # Parent 1b68427875f7ffe3025ea13c7f6e8cf71ce54769unmodified_drivers: hide xen_cpuid_base() in version 2.6.38+
Allow compilation of PVonHVM drivers with forward-ported xenlinux sources in openSuSE 12.1. xen_cpuid_base() is now in mainline, the copy in the xen tree leads to a compilation error. The current state leads to a compile error:
/usr/src/packages/BUILD/xen-4.2.24547/non-dbg/obj/default/platform-pci/platform-pci.c:121: error: redefinition of 'xen_cpuid_base' /usr/src/linux-3.0.13-0.11/arch/x86/include/asm/xen/hypervisor.h:43: error: previous definition of 'xen_cpuid_base' was here
The reason is that the kernel sources are searched before the xen sources for asm/hypervisor.h:
/usr/src/linux-3.0.13-0.11/arch/x86/include/asm/hypervisor.h /usr/src/packages/BUILD/xen-4.2.24547/non-dbg/obj/default/include/asm/hypervisor.h
unmodified_drivers/linux-2.6/platform-pci/platform-pci.c +2 -0
@@ -118,6 +118,7 @@ unsigned long alloc_xen_mmio(unsigned lo #ifndef __ia64__ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38) static uint32_t xen_cpuid_base(void) { uint32_t base, eax, ebx, ecx, edx;
@@ -136,6 +137,7 @@ static uint32_t xen_cpuid_base(void) return 0; } +#endif static int init_hypercall_stubs (void ) {
PATCH 1/1 unmodified_drivers: add pfn_is_ram helper for kdump
In reply to Olaf Hering# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1331883706 -3600
# Node ID dacdcaaf113263ee748bef99d175b1b7e7013be5 # Parent 5504366919926f8a2d6fc7fdc392e6218ae6c702unmodified_drivers: add pfn_is_ram helper for kdump
Register pfn_is_ram helper speed up reading /proc/vmcore in the kdump kernel. It is compiled only if the kernel source is recent enough to have the pfn_is_ram helper (v3.0-rc1, commit 997c136f518c5debd63847e78e2a8694f56dcf90).
unmodified_drivers/linux-2.6/platform-pci/platform-pci.c +29 -0
@@ -351,6 +351,32 @@ static int check_platform_magic(struct dreturn -ENODEV ; } +#if defined(HAVE_OLDMEM_PFN_IS_RAM ) +static int xen_oldmem_pfn_is_ram (unsigned long pfn) +{ +struct xen_hvm_get_mem_type a; +int ret; + + a.domid =DOMID_SELF ; + a.pfn = pfn; +if (HYPERVISOR_hvm_op (HVMOP_get_mem_type, &a)) +return -ENXIO ; + +switch (a.mem_type) { +case HVMMEM_mmio_dm: + ret =0 ; +break ; +case HVMMEM_ram_rw: +case HVMMEM_ram_ro: +default : + ret =1 ; +break ; + } + +return ret; +} +#endif +static int __devinit platform_pci_init (struct pci_dev *pdev,const struct pci_device_id *ent) {
@@ -419,6 +445,9 @@ static int __devinit platform_pci_init(sif ((ret =xen_panic_handler_init ())) goto out; +#if defined(HAVE_OLDMEM_PFN_IS_RAM ) +register_oldmem_pfn_is_ram (&xen_oldmem_pfn_is_ram); +#endif out:if (ret) {pci_release_region (pdev,0 );
PATCH 1/1 unmodified_drivers: use upstream sync_bitops if available
In reply to Olaf Hering# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1331883707 -3600
# Node ID d721480672b9686011cef0965cefd81a969277b0 # Parent dacdcaaf113263ee748bef99d175b1b7e7013be5unmodified_drivers: use upstream sync_bitops if available
The forward ported xenlinux sources in openSuSE 12.2 were switched from the old synch_bitops to the sync_bitops since kernel version 3.3. Add compat macros to use either old or new helpers depending on used kernel source version.
unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h +10 -0
@@ -161,4 +161,14 @@ typedef irqreturn_t (*irq_handler_t)(int#define atomic_cmpxchg (v, old, new) (cmpxchg(&((v)->counter), (old), (new)))#endif +#ifdef sync_test_bit +#define synch_change_bit sync_change_bit +#define synch_clear_bit sync_clear_bit +#define synch_set_bit sync_set_bit +#define synch_test_and_change_bit sync_test_and_change_bit +#define synch_test_and_clear_bit sync_test_and_clear_bit +#define synch_test_and_set_bit sync_test_and_set_bit +#define synch_test_bit sync_test_bit#endif + +#endif
PATCH 1/1 unmodified_drivers: compile vcd.c into blkfront if available
In reply to Olaf Hering# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1331883708 -3600
# Node ID 321e3ada9b40a0b164ac617f26d254fc3354c024 # Parent d721480672b9686011cef0965cefd81a969277b0unmodified_drivers: compile vcd.c into blkfront if available
The forward ported xenlinux sources in openSuSE have a PV CDROM driver since a long time. Detect the presence of this driver and compile it into the xen_vbd module.
unmodified_drivers/linux-2.6/blkfront/Kbuild +1 -0
@@ -3,3 +3,4 @@ include $(M)/overrides.mk obj-m += xen-vbd.o xen-vbd-objs := blkfront.o vbd.o +xen-vbd-objs += $(patsubst %.c,%.o,$(notdir $(wildcard $(src)/vcd.c)))
Re: [PATCH 4 of 4] unmodified_drivers: compile vcd.c into blkfront if available
Quoted 19 lines
Quoted 1 line
Quoted 1 line · Olaf Hering
# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1331883708 -3600
# Node ID321e3ada9b40a0b164ac617f26d254fc3354c024# Parentd721480672b9686011cef0965cefd81a969277b0unmodified_drivers: compilevcd.cinto blkfront if availableThe forward ported xenlinux sources in openSuSE have a PV CDROM driver since a long time. Detect the presence of this driver and compile it into the
xen_vbdmodule.Signed-off-by Olaf Hering <[email protected]>diff -r
d721480672b9-r321e3ada9b40
unmodified_drivers/linux-2.6/blkfront/Kbuild
unmodified_drivers/linux-2.6/blkfront/Kbuild include $(M)/overrides.mk · line 6
Quoted 4 lines
unmodified_drivers/linux-2.6/blkfront/Kbuild +1
-0@@ -3,3 +3,4 @@ include $(M)/overrides.mk obj-m += xen-vbd.o xen-vbd-objs := blkfront.o vbd.o +xen-vbd-objs += $(patsubst %.c,%.o,$(notdir $(wildcard $(src)/vcd.c)))
This is an entirely Novell/SuSE-only thing, we shouldn't bother upstream with that (unless someone decides to upstream the base kernel code too, which seems pointless for the old tree). Further more, just last week I eliminated the need for compiling this file when building the pv drivers (the change above will need to be dropped from our patches once the kernel side change gets submitted to the build system), largely because we don't allow blkfront to handle CDs anyway (see the master branch's current patches.xen/xen-blkfront-hvm-no-cdrom).
Jan
.