[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 31/49] optionrom/pvh: load initrd from fw_cfg
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 31/49] optionrom/pvh: load initrd from fw_cfg |
Date: |
Mon, 21 Jan 2019 19:06:02 +0100 |
From: Stefano Garzarella <address@hidden>
If we found initrd through fw_cfg, we can load it and use the
first module of hvm_start_info to pass initrd address and size
to the kernel.
Signed-off-by: Stefano Garzarella <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Liam Merwick <address@hidden>
Based-on: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
pc-bios/optionrom/pvh_main.c | 21 +++++++++++++++++++--
pc-bios/pvh.bin | Bin 1536 -> 1536 bytes
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/pc-bios/optionrom/pvh_main.c b/pc-bios/optionrom/pvh_main.c
index 1dcc5c9..a015e1b 100644
--- a/pc-bios/optionrom/pvh_main.c
+++ b/pc-bios/optionrom/pvh_main.c
@@ -46,6 +46,7 @@ struct pvh_e820_table {
struct pvh_e820_table pvh_e820 asm("pvh_e820") __attribute__ ((aligned));
static struct hvm_start_info start_info;
+static struct hvm_modlist_entry ramdisk_mod;
static uint8_t cmdline_buffer[CMDLINE_BUFSIZE];
@@ -71,8 +72,8 @@ extern void pvh_load_kernel(void) asm("pvh_load_kernel");
void pvh_load_kernel(void)
{
void *cmdline_addr = &cmdline_buffer;
- void *kernel_entry;
- uint32_t cmdline_size, fw_cfg_version = bios_cfg_version();
+ void *kernel_entry, *initrd_addr;
+ uint32_t cmdline_size, initrd_size, fw_cfg_version = bios_cfg_version();
start_info.magic = XEN_HVM_START_MAGIC_VALUE;
start_info.version = 1;
@@ -110,6 +111,22 @@ void pvh_load_kernel(void)
fw_cfg_version);
start_info.cmdline_paddr = (uintptr_t)cmdline_addr;
+ /* Check if we have the initrd to load */
+ bios_cfg_read_entry(&initrd_size, FW_CFG_INITRD_SIZE, 4, fw_cfg_version);
+ if (initrd_size) {
+ bios_cfg_read_entry(&initrd_addr, FW_CFG_INITRD_ADDR, 4,
+ fw_cfg_version);
+ bios_cfg_read_entry(initrd_addr, FW_CFG_INITRD_DATA, initrd_size,
+ fw_cfg_version);
+
+ ramdisk_mod.paddr = (uintptr_t)initrd_addr;
+ ramdisk_mod.size = initrd_size;
+
+ /* The first module is always ramdisk. */
+ start_info.modlist_paddr = (uintptr_t)&ramdisk_mod;
+ start_info.nr_modules = 1;
+ }
+
bios_cfg_read_entry(&kernel_entry, FW_CFG_KERNEL_ENTRY, 4, fw_cfg_version);
asm volatile("jmp *%1" : : "b"(&start_info), "c"(kernel_entry));
diff --git a/pc-bios/pvh.bin b/pc-bios/pvh.bin
index
38a41761014957d50eb55d790b6957888cbeee0a..8033080ada2db4c4613fdc3bb5a69d79c7b0c0ca
100644
GIT binary patch
delta 735
zcmZqRY2cYKndyM&#;Nv<`Y|dZ$5|Uh85k;#<{2MnZ2__v85kHA9sn{HZvYZIPJmb|
zfW&address@hidden@G+F$J<hrSC<y|`S(k`Tc4U&address@hidden<m2U
z69Yr<HjpGxgXJ;)wosrzw?N~kpkNn;ZV#5mj{zY;3Y-^99~fR*3^J!vbP15`Eo0c1
zzzXD<s2q1u0U8F>|Cout)f{N^UIC!Q4iTVG=c}~$y9I%~ogfvxH7Wv~w?60W5Uq#G
zb^8ECzJtWNSyZ}1R9F_z0NXGJNbcZ<address@hidden<}QQCW$0*+lE
zt3K!K289;TXpa96n~%su$Hm7U?k!Pcm;address@hidden<address@hidden
zax=_C9<XzTprSw{MY?NLz=GW_Dm;r5fc6|`O#zZ102C5goB<ZffeP&asaQM#EH(uy
zcAT|GlmilnFD)iJGRxEpyomk#|address@hidden;$wse*j2kg!O{z~>V*bKQ3x<N
zE|p|Lq(address@hidden>Z=Q(yf415}LN%^5^G8scV%O`y;R+Qji<3DDe^<address@hidden
Z2no&!h6hlR%ga4L7i~VsEX~MR4FFIY;aUIy
delta 434
zcmZqRY2cYKnW;f!<5YV_{Sp<C<E#!M3=9=V^Nf$Px&T>>3=9kl8-R?(1wdj)2Z)sc
address@hidden)address@hidden>5(JL3rie^-WRk9*!N9`6V0pM)?4=n{
zY40|WBv6CpVg5E%pg^}k<ENlt7lm#Qmd1|(Awde97fT-)URn$?r&BZqNcNU7>~;W}
z(J7;H+(iY*0P26n#NRp{$k;address@hidden;address@hidden&&(+mFxBa
address@hidden;address@hidden|~RS<address@hidden;
address@hidden<address@hidden(asw$-h%iT_JOV01+ui)MMdDn3812v
j<^TWx2l~|T0E*vVzWMk6|address@hidden|4(AIW9$F`FOZ8_
--
1.8.3.1
- [Qemu-devel] [PULL 05/49] vhost: restrict Linux dependency to kernel vhost, (continued)
- [Qemu-devel] [PULL 05/49] vhost: restrict Linux dependency to kernel vhost, Paolo Bonzini, 2019/01/21
- [Qemu-devel] [PULL 15/49] vhost-user-test: small changes to init_hugepagefs, Paolo Bonzini, 2019/01/21
- [Qemu-devel] [PULL 16/49] vhost-user-test: create a temporary directory per TestServer, Paolo Bonzini, 2019/01/21
- [Qemu-devel] [PULL 18/49] tests/hexloader-test: Don't pass -nographic to the QEMU under test, Paolo Bonzini, 2019/01/21
- [Qemu-devel] [PULL 21/49] configure: Add a proper check for openpty() in libutil, Paolo Bonzini, 2019/01/21
- [Qemu-devel] [PULL 22/49] cpus: ignore ESRCH in qemu_cpu_kick_thread(), Paolo Bonzini, 2019/01/21
- [Qemu-devel] [PULL 24/49] elf-ops.h: Add get_elf_note_type(), Paolo Bonzini, 2019/01/21
- [Qemu-devel] [PULL 25/49] pvh: Add x86/HVM direct boot ABI header file, Paolo Bonzini, 2019/01/21
- [Qemu-devel] [PULL 28/49] linuxboot_dma: remove duplicate definitions of FW_CFG, Paolo Bonzini, 2019/01/21
- [Qemu-devel] [PULL 23/49] elf: Add optional function ptr to load_elf() to parse ELF notes, Paolo Bonzini, 2019/01/21
- [Qemu-devel] [PULL 31/49] optionrom/pvh: load initrd from fw_cfg,
Paolo Bonzini <=
- [Qemu-devel] [PULL 32/49] i386: remove the new CPUID 'PCONFIG' from Icelake-Server CPU model, Paolo Bonzini, 2019/01/21
- [Qemu-devel] [PULL 36/49] contrib/elf2dmp: fix elf.h including, Paolo Bonzini, 2019/01/21
- [Qemu-devel] [PULL 30/49] hw/i386/pc: use PVH option rom, Paolo Bonzini, 2019/01/21
- [Qemu-devel] [PULL 39/49] contrib/elf2dmp: fix structures definitions, Paolo Bonzini, 2019/01/21
- [Qemu-devel] [PULL 26/49] pvh: Boot uncompressed kernel using direct boot ABI, Paolo Bonzini, 2019/01/21
- [Qemu-devel] [PULL 27/49] pvh: load initrd and expose it through fw_cfg, Paolo Bonzini, 2019/01/21
- [Qemu-devel] [PULL 38/49] contrib/elf2dmp: use GLib in PDB processing, Paolo Bonzini, 2019/01/21
- [Qemu-devel] [PULL 41/49] configure: enable elf2dmp build for Windows hosts, Paolo Bonzini, 2019/01/21
- [Qemu-devel] [PULL 34/49] Revert "i386: Add CPUID bit for PCONFIG", Paolo Bonzini, 2019/01/21
- [Qemu-devel] [PULL 35/49] target-i386: hvf: remove MPX support, Paolo Bonzini, 2019/01/21