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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With the introduction of kvm__arch_load_kernel_image() we are sure
that nobody peeks at the kernel image files before, so rewinding
the file to its beginning is unnecessary.
Remove those seeks in the arm and powerpc implementations.
This allows to use a pipe instead of a regular file for the kernel
image, enabling on-the-fly uncompression or downloading via the
command line.
$ lkvm run -k <(zcat zImage.gz) ...
$ lkvm run -k <(wget -O - http://foo.com/guest.zImage) ...

This is limited to the kernel images for the arm/arm64 and powerpc
architectures for now, other architectures and initrds need more work.

Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx>
---
 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(struct kvm *kvm, int fd_kernel, int fd_initrd,
 	void *pos, *kernel_end, *limit;
 	unsigned long guest_addr;
 
-	if (lseek(fd_kernel, 0, SEEK_SET) < 0)
-		die_perror("lseek");
-
 	/*
 	 * Linux requires the initrd and dtb to be mapped inside lowmem,
 	 * so we can't just place them at the top of memory.
diff --git a/powerpc/kvm.c b/powerpc/kvm.c
index 13bba30..87d0f9e 100644
--- a/powerpc/kvm.c
+++ b/powerpc/kvm.c
@@ -165,9 +165,6 @@ bool kvm__arch_load_kernel_image(struct kvm *kvm, int fd_kernel, int fd_initrd,
 	void *i_start;
 	int nr;
 
-	if (lseek(fd_kernel, 0, SEEK_SET) < 0)
-		die_perror("lseek");
-
 	p = k_start = guest_flat_to_host(kvm, KERNEL_LOAD_ADDR);
 
 	while ((nr = read(fd_kernel, p, 65536)) > 0)
-- 
2.3.5

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux