Olaf Hering
2012-Mar-16 07:48 UTC
[PATCH 0 of 4] 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 kdump unmodified_drivers: use upstream sync_bitops if available unmodified_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(+)
Olaf Hering
2012-Mar-16 07:48 UTC
[PATCH 1 of 4] unmodified_drivers: hide xen_cpuid_base() in version 2.6.38+
# HG changeset patch # User Olaf Hering <olaf@aepfle.de> # Date 1331883705 -3600 # Node ID 5504366919926f8a2d6fc7fdc392e6218ae6c702 # Parent 1b68427875f7ffe3025ea13c7f6e8cf71ce54769 unmodified_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 Signed-off-by: Olaf Hering <olaf@aepfle.de> Acked-by: Jan Beulich <jbeulich@suse.com> diff -r 1b68427875f7 -r 550436691992 unmodified_drivers/linux-2.6/platform-pci/platform-pci.c --- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c +++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c @@ -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) {
Olaf Hering
2012-Mar-16 07:48 UTC
[PATCH 2 of 4] unmodified_drivers: add pfn_is_ram helper for kdump
# HG changeset patch # User Olaf Hering <olaf@aepfle.de> # Date 1331883706 -3600 # Node ID dacdcaaf113263ee748bef99d175b1b7e7013be5 # Parent 5504366919926f8a2d6fc7fdc392e6218ae6c702 unmodified_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). Signed-off-by: Olaf Hering <olaf@aepfle.de> diff -r 550436691992 -r dacdcaaf1132 unmodified_drivers/linux-2.6/platform-pci/platform-pci.c --- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c +++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c @@ -351,6 +351,32 @@ static int check_platform_magic(struct d return -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(s if ((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);
Olaf Hering
2012-Mar-16 07:48 UTC
[PATCH 3 of 4] unmodified_drivers: use upstream sync_bitops if available
# HG changeset patch # User Olaf Hering <olaf@aepfle.de> # Date 1331883707 -3600 # Node ID d721480672b9686011cef0965cefd81a969277b0 # Parent dacdcaaf113263ee748bef99d175b1b7e7013be5 unmodified_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. Signed-off-by: Olaf Hering <olaf@aepfle.de> diff -r dacdcaaf1132 -r d721480672b9 unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h --- a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h +++ b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h @@ -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
Olaf Hering
2012-Mar-16 07:48 UTC
[PATCH 4 of 4] unmodified_drivers: compile vcd.c into blkfront if available
# HG changeset patch # User Olaf Hering <olaf@aepfle.de> # Date 1331883708 -3600 # Node ID 321e3ada9b40a0b164ac617f26d254fc3354c024 # Parent d721480672b9686011cef0965cefd81a969277b0 unmodified_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. Signed-off-by: Olaf Hering <olaf@aepfle.de> diff -r d721480672b9 -r 321e3ada9b40 unmodified_drivers/linux-2.6/blkfront/Kbuild --- a/unmodified_drivers/linux-2.6/blkfront/Kbuild +++ b/unmodified_drivers/linux-2.6/blkfront/Kbuild @@ -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)))
Jan Beulich
2012-Mar-16 09:07 UTC
Re: [PATCH 4 of 4] unmodified_drivers: compile vcd.c into blkfront if available
>>> On 16.03.12 at 08:48, Olaf Hering <olaf@aepfle.de> wrote: > # HG changeset patch > # User Olaf Hering <olaf@aepfle.de> > # Date 1331883708 -3600 > # Node ID 321e3ada9b40a0b164ac617f26d254fc3354c024 > # Parent d721480672b9686011cef0965cefd81a969277b0 > unmodified_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. > > Signed-off-by: Olaf Hering <olaf@aepfle.de> > > diff -r d721480672b9 -r 321e3ada9b40 > unmodified_drivers/linux-2.6/blkfront/Kbuild > --- a/unmodified_drivers/linux-2.6/blkfront/Kbuild > +++ b/unmodified_drivers/linux-2.6/blkfront/Kbuild > @@ -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 .