Re: [PATCH 0/7] kvmtool: Cleanup kernel loading

2015-11-18 Thread Andre Przywara
Hi Will, On 02/11/15 14:58, Will Deacon wrote: > On Fri, Oct 30, 2015 at 06:26:53PM +0000, Andre Przywara wrote: >> Hi, > > Hello Andre, > >> this series cleans up kvmtool's kernel loading functionality a bit. >> It has been broken out of a previous series I

Re: [PATCH 0/7] kvmtool: Cleanup kernel loading

2015-11-02 Thread Andre Przywara
Hi Dimitri, On 02/11/15 15:17, Dimitri John Ledkov wrote: > On 2 November 2015 at 14:58, Will Deacon <will.dea...@arm.com> wrote: >> On Fri, Oct 30, 2015 at 06:26:53PM +, Andre Przywara wrote: >>> Hi, >> >> Hello Andre, >> >>> this series cle

[PATCH 6/7] arm/arm64: use read_file() in kernel and initrd loading

2015-10-30 Thread Andre Przywara
Use the new read_file() wrapper in our arm/arm64 kernel image loading function instead of the private implementation. Signed-off-by: Andre Przywara <andre.przyw...@arm.com> --- arm/fdt.c | 40 ++-- 1 file changed, 18 insertions(+), 22 deletions(-) diff

[PATCH 7/7] arm: move kernel loading into arm/kvm.c

2015-10-30 Thread Andre Przywara
string. Signed-off-by: Andre Przywara <andre.przyw...@arm.com> --- arm/fdt.c | 95 +-- arm/kvm.c | 88 ++ 2 files changed, 89 insertions(+), 94 deletions(-) diff --git a/arm/f

[PATCH 3/7] powerpc: use read_file() in kernel and initrd loading

2015-10-30 Thread Andre Przywara
Replace the unsafe read-loops in the powerpc kernel image loading function with our new and safe read_file() wrapper. This should fix random fails in kernel image loading, especially from pipes and sockets. Signed-off-by: Andre Przywara <andre.przyw...@arm.com> --- powerpc/kvm.

[PATCH 5/7] x86: use read wrappers in kernel loading

2015-10-30 Thread Andre Przywara
Replace the unsafe read-loops in the x86 kernel image loading functions with our safe read_file() and read_in_full() wrappers. This should fix random fails in kernel image loading, especially from pipes and sockets. Signed-off-by: Andre Przywara <andre.przyw...@arm.com> --- x86/kvm.

[PATCH 0/7] kvmtool: Cleanup kernel loading

2015-10-30 Thread Andre Przywara
, Andre. [1] http://marc.info/?l=kvm=143825354808135=2 Andre Przywara (7): Refactor kernel image loading provide generic read_file() implementation powerpc: use read_file() in kernel and initrd loading MIPS: use read wrappers in kernel loading x86: use read wrappers in kernel loading

[PATCH 1/7] Refactor kernel image loading

2015-10-30 Thread Andre Przywara
for MIPS as special cases for those architectures (removing the arch specific code from the generic kvm.c file on the way) and rename the existing "flat binary" loader functions for the other architectures to the new name. Signed-off-by: Andre Przywara <andre.przyw...@arm.com>

[PATCH 4/7] MIPS: use read wrappers in kernel loading

2015-10-30 Thread Andre Przywara
Replace the unsafe read-loops used in the MIPS kernel image loading with our safe read_file() and read_in_full() wrappers. This should fix random fails in kernel image loading, especially from pipes and sockets. Signed-off-by: Andre Przywara <andre.przyw...@arm.com> --- mips/kvm.

[PATCH 2/7] provide generic read_file() implementation

2015-10-30 Thread Andre Przywara
to provide the only safe implementation, so take that as an inspiration to provide a generic read_file() function usable by every part of kvmtool. Signed-off-by: Andre Przywara <andre.przyw...@arm.com> --- include/kvm/read-write.h | 2 ++ util/read-write.c| 21 + 2

[PATCH 06/14] MIPS: use pseek() in ELF kernel image loading

2015-07-30 Thread Andre Przywara
Use the newly introduced pseek() function when skipping to the start offset in the ELF file. The layout of an ELF file should satisfy the constraints of pseek, so that we should be able to use a pipe file descriptor as well. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- mips/kvm.c | 4

[PATCH 12/14] powerpc: use read_file() in kernel and initrd loading

2015-07-30 Thread Andre Przywara
Replace the unsafe read-loops in the powerpc kernel image loading function with our new and safe read_file() wrapper. This should fix random fails in kernel image loading, especially from pipes and sockets. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- powerpc/kvm.c | 36

[PATCH 00/14] kvmtool: Refactor kernel image loading to allow pipes

2015-07-30 Thread Andre Przywara
architecture over to using the safe read wrappers. These patches apply on top of the latest kvmtool master branch. So far I could test arm, arm64 and x86, with MIPS and PowerPC being at least compile-tested. Cheers, Andre. Andre Przywara (14): Refactor kernel image loading arm/powerpc: remove

[PATCH 08/14] MIPS: remove seeks from load_flat_binary()

2015-07-30 Thread Andre Przywara
Remove the need to rewind the kernel image file if loading it as a flat binary by re-using the already read portion of the file passed in as a buffer. This allows the MIPS flat binary kernel image to be read from a pipe. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- mips/kvm.c | 14

[PATCH 05/14] kvmtool: introduce pseek

2015-07-30 Thread Andre Przywara
amount of data. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/read-write.h | 2 ++ util/read-write.c| 40 2 files changed, 42 insertions(+) diff --git a/include/kvm/read-write.h b/include/kvm/read-write.h index 67571f9..87eb167

[PATCH 13/14] MIPS: use read wrappers in kernel loading

2015-07-30 Thread Andre Przywara
Replace the unsafe read-loops used in the MIPS kernel image loading with our safe read_file() and read_in_full() wrappers. This should fix random fails in kernel image loading, especially from pipes and sockets. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- mips/kvm.c | 35

[PATCH 02/14] arm/powerpc: remove unneeded seeks in kernel loading

2015-07-30 Thread Andre Przywara
more work. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/fdt.c | 3 --- powerpc/kvm.c | 3 --- 2 files changed, 6 deletions(-) diff --git a/arm/fdt.c b/arm/fdt.c index ec7453f..cb4f00d 100644 --- a/arm/fdt.c +++ b/arm/fdt.c @@ -245,9 +245,6 @@ bool kvm__arch_load_kernel_image

[PATCH 10/14] provide generic read_file() implementation

2015-07-30 Thread Andre Przywara
to provide the only safe implementation, so take that as an inspiration to provide a generic read_file() function usable by every part of kvmtool. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/read-write.h | 2 ++ util/read-write.c| 21 + 2 files

[PATCH 07/14] MIPS: move ELF headers loading outside of load_elf_binary()

2015-07-30 Thread Andre Przywara
Refactor MIPS' load_elf_binary() implementation by not reading the ELF header itself, but using a pointer to a memory buffer instead. This prepares for removing the need to rewind the image file later. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- mips/kvm.c | 52

[PATCH 09/14] arm: move kernel loading into arm/kvm.c

2015-07-30 Thread Andre Przywara
string. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/fdt.c | 96 +-- arm/kvm.c | 89 ++ 2 files changed, 90 insertions(+), 95 deletions(-) diff --git a/arm/fdt.c b

[PATCH 01/14] Refactor kernel image loading

2015-07-30 Thread Andre Przywara
for MIPS as special cases for those architectures and rename the existing flat binary loader functions for the other architectures to the new name. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/fdt.c | 4 ++-- include/kvm/kvm.h | 5 ++--- kvm.c | 42

[PATCH 14/14] x86: use read wrappers in kernel loading

2015-07-30 Thread Andre Przywara
Replace the unsafe read-loops in the x86 kernel image loading functions with our safe read_file() and read_in_full() wrappers. This should fix random fails in kernel image loading, especially from pipes and sockets. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- x86/kvm.c | 40

[PATCH 11/14] arm/arm64: use read_file() in kernel and initrd loading

2015-07-30 Thread Andre Przywara
Use the new read_file() wrapper in our arm/arm64 kernel image loading function instead of the private implementation. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/kvm.c | 42 -- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git

[PATCH 04/14] x86: support loading flat binary kernel images from a pipe

2015-07-30 Thread Andre Przywara
without using a seek, so kvmtool will happily accept any file descriptor (including pipes) for the image file. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- x86/kvm.c | 48 +--- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/x86

[PATCH 03/14] x86: allow pipes for bzImage kernel images

2015-07-30 Thread Andre Przywara
Streamline the x86 kernel loading implementation by removing unneeded seeks and thus allow an x86 bzImage to be loaded from a pipe. Flat binaries are taken care of in a separate patch. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- x86/kvm.c | 11 --- 1 file changed, 4

Re: [PATCH] kvmtool: Makefile: allow overriding CC and LD

2015-06-19 Thread Andre Przywara
Hi Michael, On 19/06/15 02:14, Michael Ellerman wrote: On Thu, 2015-06-18 at 16:50 +0100, Andre Przywara wrote: Currently we set CC unconditionally to ${CROSS_COMPILE}gcc, the same for LD. Allow people to override the compiler name by specifying it explicitly on the command line or via

Re: [PATCH 2/3] powerpc: use default endianness for converting guest/init

2015-06-19 Thread Andre Przywara
Hi Michael, On 19/06/15 02:08, Michael Ellerman wrote: On Thu, 2015-06-18 at 15:52 +0100, Andre Przywara wrote: Hi, On 06/17/2015 10:43 AM, Andre Przywara wrote: For converting the guest/init binary into an object file, we call the linker binary, setting the endianness to big endian

Re: [PATCH 2/3] powerpc: use default endianness for converting guest/init

2015-06-18 Thread Andre Przywara
Hi, On 06/17/2015 10:43 AM, Andre Przywara wrote: For converting the guest/init binary into an object file, we call the linker binary, setting the endianness to big endian explicitly when compiling kvmtool for powerpc. This breaks if the compiler is actually targetting little endian (which

[PATCH] kvmtool: Makefile: allow overriding CC and LD

2015-06-18 Thread Andre Przywara
rid of the PowerPC overrides in the Makefile. Possible uses: $ make CC=gcc -m64 LD=ld -melf64ppc (build kvmtool on a PowerPC toolchain defaulting to 32-bit) $ make CC=gcc -m32 LD=ld -melf_i386 (build a 32-bit binary on a multilib-enabled x86-64 compiler) Signed-off-by: Andre Przywara andre.przyw

[PATCH v2] powerpc: add hvcall.h header from Linux

2015-06-18 Thread Andre Przywara
The powerpc code uses some PAPR hypercalls, of which we need the hypercall number. Copy just the needed macro definitions from the kernel's (private) hvcall.h file and remove the extra tricks formerly used to be able to include this header file directly. Signed-off-by: Andre Przywara andre.przyw

[PATCH 0/3] kvmtool: fixes for PowerPC

2015-06-17 Thread Andre Przywara
Hello, some patches to fix at least the build of the new kvmtool for PowerPC. I could only compile test it so far, so I'd be grateful if people more familiar with that architecture can have a look and maybe even test it on actual machines. Cheers, Andre. Andre Przywara (3): powerpc: implement

[PATCH 2/3] powerpc: use default endianness for converting guest/init

2015-06-17 Thread Andre Przywara
the explicit big endianness switch from the linker call to allow linking on little endian PowerPC builds again. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- Hi, this fixed the powerpc64le build for me, while still compiling fine for big endian. Admittedly this whole init-guest_init.o

[PATCH 3/3] powerpc: add hvcall.h header from Linux

2015-06-17 Thread Andre Przywara
The powerpc code uses some PAPR hypercalls, of which we need the hypercall number. Copy the macro definition parts from the kernel's (private) hvcall.h file and remove the extra tricks formerly used to be able to include this header file directly. Signed-off-by: Andre Przywara andre.przyw