Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xen: Make xen-blkfront write its protocol ABI to xenstore

Frontends are expected to write their protocol ABI to xenstore. Since
the protocol ABI defaults to the backend's native ABI, things work
fine without that as long as the frontend's native ABI is identical to
the backend's native ABI. This is not the case for xen-blkfront
running 32-on-64, because its ABI differs between 32 and 64 bit, and
thus needs this fix.

Based on http://xenbits.xensource.com/xen-unstable.hg?rev/c545932a18f3
and http://xenbits.xensource.com/xen-unstable.hg?rev/ffe52263b430 by
Gerd Hoffmann <kraxel@suse.de>

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Jeremy Fitzhardinge <Jeremy.Fitzhardinge@citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

authored by

Markus Armbruster and committed by
Ingo Molnar
3e334239 b15993fc

+28
+7
drivers/block/xen-blkfront.c
··· 47 47 48 48 #include <xen/interface/grant_table.h> 49 49 #include <xen/interface/io/blkif.h> 50 + #include <xen/interface/io/protocols.h> 50 51 51 52 #include <asm/xen/hypervisor.h> 52 53 ··· 613 612 "event-channel", "%u", info->evtchn); 614 613 if (err) { 615 614 message = "writing event-channel"; 615 + goto abort_transaction; 616 + } 617 + err = xenbus_printf(xbt, dev->nodename, "protocol", "%s", 618 + XEN_IO_PROTO_ABI_NATIVE); 619 + if (err) { 620 + message = "writing protocol"; 616 621 goto abort_transaction; 617 622 } 618 623
+21
include/xen/interface/io/protocols.h
··· 1 + #ifndef __XEN_PROTOCOLS_H__ 2 + #define __XEN_PROTOCOLS_H__ 3 + 4 + #define XEN_IO_PROTO_ABI_X86_32 "x86_32-abi" 5 + #define XEN_IO_PROTO_ABI_X86_64 "x86_64-abi" 6 + #define XEN_IO_PROTO_ABI_IA64 "ia64-abi" 7 + #define XEN_IO_PROTO_ABI_POWERPC64 "powerpc64-abi" 8 + 9 + #if defined(__i386__) 10 + # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_32 11 + #elif defined(__x86_64__) 12 + # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_64 13 + #elif defined(__ia64__) 14 + # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_IA64 15 + #elif defined(__powerpc64__) 16 + # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_POWERPC64 17 + #else 18 + # error arch fixup needed here 19 + #endif 20 + 21 + #endif