* [PATCH] Update KVM kernel module to allow a larger BIOS image. @ 2009-07-16 0:12 Jordan Justen 2009-07-16 0:12 ` [PATCH] Update qemu-kvm " Jordan Justen 0 siblings, 1 reply; 10+ messages in thread From: Jordan Justen @ 2009-07-16 0:12 UTC (permalink / raw) To: kvm-devel; +Cc: Jordan Justen Previously the KVM kernel module would allocate the address range of 0xfffbc000-0xfffbcfff for the EPT Indentity Page Tables. This change moves that to 0xfeffc000-0xfeffcfff. Another issue related to this change is the VMC TSS Pages were located at 0xfffbd000-0xfffbffff. This is controlled by the qemu-kvm code. A separate change will move them to 0xfeffd000-0xfeffffff. >From a high level, these are the effects of these two changes: Previously, the KVM would only accommodate a 256KB BIOS image. With these changes, the BIOS image may now grow to 16MB. Motivation for making these changes: A larger firmware image size allows alternative BIOS images to be used with KVM. Some possible uses are to enable UEFI firmware or coreboot firmware. Additionally, an alternative firmware might include a linux kernel+initrd payload, which would require several megabytes. Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> --- arch/x86/include/asm/vmx.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h index 272514c..0086332 100644 --- a/arch/x86/include/asm/vmx.h +++ b/arch/x86/include/asm/vmx.h @@ -372,7 +372,7 @@ enum vmcs_field { #define VMX_EPT_EXECUTABLE_MASK 0x4ull #define VMX_EPT_IGMT_BIT (1ull << 6) -#define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfffbc000ul +#define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfeffc000ul #define ASM_VMX_VMCLEAR_RAX ".byte 0x66, 0x0f, 0xc7, 0x30" -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH] Update qemu-kvm to allow a larger BIOS image. 2009-07-16 0:12 [PATCH] Update KVM kernel module to allow a larger BIOS image Jordan Justen @ 2009-07-16 0:12 ` Jordan Justen 2009-07-16 1:34 ` Sheng Yang 0 siblings, 1 reply; 10+ messages in thread From: Jordan Justen @ 2009-07-16 0:12 UTC (permalink / raw) To: kvm-devel; +Cc: Jordan Justen Previously the KVM kernel module would allocate the address range of 0xfffbc000-0xfffbcfff for the EPT Indentity Page Tables. A separate patch is moving that to 0xfeffc000-0xfeffcfff. This patch updates qemu-kvm to move the VMX TSS Pages & update the KVM BIOS code to update the E820 BIOS call memory reservations. Previously, the VMC TSS Pages were located at 0xfffbd000-0xfffbffff. This change moved them to 0xfeffd000-0xfeffffff. This change also updates the KVM bios such that the E820 locations are returned properly for these two changes. >From a high level, these are the effects of these two changes: Previously, the KVM would only accommodate a 256KB BIOS image. With these changes, the BIOS image may now grow to 16MB. Motivation for making these changes: A larger firmware image size allows alternative BIOS images to be used with KVM. Some possible uses are to enable UEFI firmware or coreboot firmware. Additionally, an alternative firmware might include a linux kernel+initrd payload, which would require several megabytes. Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> --- kvm/bios/rombios.c | 8 ++++---- kvm/include/x86/asm/vmx.h | 2 +- qemu-kvm-x86.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kvm/bios/rombios.c b/kvm/bios/rombios.c index 6186199..2d0c153 100644 --- a/kvm/bios/rombios.c +++ b/kvm/bios/rombios.c @@ -4596,14 +4596,14 @@ ASM_END case 5: /* 4 pages before the bios, 3 pages for vmx tss pages, * the other page for EPT real mode pagetable */ - set_e820_range(ES, regs.u.r16.di, 0xfffbc000L, - 0xfffc0000L, 0, 0, 2); + set_e820_range(ES, regs.u.r16.di, 0xfeffc000L, + 0xff000000L, 0, 0, 2); regs.u.r32.ebx = 6; break; case 6: - /* 256KB BIOS area at the end of 4 GB */ + /* 16MB BIOS area at the end of 4 GB */ set_e820_range(ES, regs.u.r16.di, - 0xfffc0000L, 0x00000000L ,0, 0, 2); + 0xff000000L, 0x00000000L ,0, 0, 2); if (extra_highbits_memory_size || extra_lowbits_memory_size) regs.u.r32.ebx = 7; else diff --git a/kvm/include/x86/asm/vmx.h b/kvm/include/x86/asm/vmx.h index df8d4f9..99e2bb9 100644 --- a/kvm/include/x86/asm/vmx.h +++ b/kvm/include/x86/asm/vmx.h @@ -403,7 +403,7 @@ enum vmcs_field { #define VMX_EPT_EXECUTABLE_MASK 0x4ull #define VMX_EPT_IGMT_BIT (1ull << 6) -#define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfffbc000ul +#define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfeffc000ul #define ASM_VMX_VMCLEAR_RAX ".byte 0x66, 0x0f, 0xc7, 0x30" diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c index daf60b6..b5306aa 100644 --- a/qemu-kvm-x86.c +++ b/qemu-kvm-x86.c @@ -63,7 +63,7 @@ static int kvm_init_tss(kvm_context_t kvm) * this address is 3 pages before the bios, and the bios should present * as unavaible memory */ - r = kvm_set_tss_addr(kvm, 0xfffbd000); + r = kvm_set_tss_addr(kvm, 0xfeffd000); if (r < 0) { fprintf(stderr, "kvm_init_tss: unable to set tss addr\n"); return r; -- 1.6.0.4 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] Update qemu-kvm to allow a larger BIOS image. 2009-07-16 0:12 ` [PATCH] Update qemu-kvm " Jordan Justen @ 2009-07-16 1:34 ` Sheng Yang 2009-07-16 2:58 ` Jordan Justen 0 siblings, 1 reply; 10+ messages in thread From: Sheng Yang @ 2009-07-16 1:34 UTC (permalink / raw) To: kvm; +Cc: Jordan Justen On Thursday 16 July 2009 08:12:15 Jordan Justen wrote: > Previously the KVM kernel module would allocate the address range > of 0xfffbc000-0xfffbcfff for the EPT Indentity Page Tables. > A separate patch is moving that to 0xfeffc000-0xfeffcfff. Hi Jordan You need one more patch for upstream kvm, to include the modification of vmx.h. > > This patch updates qemu-kvm to move the VMX TSS Pages & update the > KVM BIOS code to update the E820 BIOS call memory reservations. > > Previously, the VMC TSS Pages were located at 0xfffbd000-0xfffbffff. > This change moved them to 0xfeffd000-0xfeffffff. > > This change also updates the KVM bios such that the E820 locations > are returned properly for these two changes. > > From a high level, these are the effects of these two changes: > > Previously, the KVM would only accommodate a 256KB BIOS image. With > these changes, the BIOS image may now grow to 16MB. > > Motivation for making these changes: > > A larger firmware image size allows alternative BIOS images to be > used with KVM. Some possible uses are to enable UEFI firmware > or coreboot firmware. Additionally, an alternative firmware might > include a linux kernel+initrd payload, which would require several > megabytes. I think if you update bios to UEFI, the E820 should be represented by UEFI rather than current bios? -- regards Yang, Sheng > Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> > --- > kvm/bios/rombios.c | 8 ++++---- > kvm/include/x86/asm/vmx.h | 2 +- > qemu-kvm-x86.c | 2 +- > 3 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/kvm/bios/rombios.c b/kvm/bios/rombios.c > index 6186199..2d0c153 100644 > --- a/kvm/bios/rombios.c > +++ b/kvm/bios/rombios.c > @@ -4596,14 +4596,14 @@ ASM_END > case 5: > /* 4 pages before the bios, 3 pages for vmx tss > pages, * the other page for EPT real mode pagetable */ > - set_e820_range(ES, regs.u.r16.di, 0xfffbc000L, > - 0xfffc0000L, 0, 0, 2); > + set_e820_range(ES, regs.u.r16.di, 0xfeffc000L, > + 0xff000000L, 0, 0, 2); > regs.u.r32.ebx = 6; > break; > case 6: > - /* 256KB BIOS area at the end of 4 GB */ > + /* 16MB BIOS area at the end of 4 GB */ > set_e820_range(ES, regs.u.r16.di, > - 0xfffc0000L, 0x00000000L ,0, 0, 2); > + 0xff000000L, 0x00000000L ,0, 0, 2); > if (extra_highbits_memory_size || > extra_lowbits_memory_size) regs.u.r32.ebx = 7; > else > diff --git a/kvm/include/x86/asm/vmx.h b/kvm/include/x86/asm/vmx.h > index df8d4f9..99e2bb9 100644 > --- a/kvm/include/x86/asm/vmx.h > +++ b/kvm/include/x86/asm/vmx.h > @@ -403,7 +403,7 @@ enum vmcs_field { > #define VMX_EPT_EXECUTABLE_MASK 0x4ull > #define VMX_EPT_IGMT_BIT (1ull << 6) > > -#define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfffbc000ul > +#define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfeffc000ul > > > #define ASM_VMX_VMCLEAR_RAX ".byte 0x66, 0x0f, 0xc7, 0x30" > diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c > index daf60b6..b5306aa 100644 > --- a/qemu-kvm-x86.c > +++ b/qemu-kvm-x86.c > @@ -63,7 +63,7 @@ static int kvm_init_tss(kvm_context_t kvm) > * this address is 3 pages before the bios, and the bios should present > * as unavaible memory > */ > - r = kvm_set_tss_addr(kvm, 0xfffbd000); > + r = kvm_set_tss_addr(kvm, 0xfeffd000); > if (r < 0) { > fprintf(stderr, "kvm_init_tss: unable to set tss addr\n"); > return r; ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Update qemu-kvm to allow a larger BIOS image. 2009-07-16 1:34 ` Sheng Yang @ 2009-07-16 2:58 ` Jordan Justen 2009-07-16 3:08 ` Sheng Yang 0 siblings, 1 reply; 10+ messages in thread From: Jordan Justen @ 2009-07-16 2:58 UTC (permalink / raw) To: Sheng Yang; +Cc: kvm, Jordan Justen On Wed, Jul 15, 2009 at 6:34 PM, Sheng Yang <sheng@linux.intel.com> wrote: > > On Thursday 16 July 2009 08:12:15 Jordan Justen wrote: > > Previously the KVM kernel module would allocate the address range > > of 0xfffbc000-0xfffbcfff for the EPT Indentity Page Tables. > > A separate patch is moving that to 0xfeffc000-0xfeffcfff. > > Hi Jordan > > You need one more patch for upstream kvm, to include the modification of > vmx.h. I sent a separate patch for vmx.h for the git://git.kernel.org/pub/scm/virt/kvm/kvm.git tree. Do I need a patch for another copy of vmx.h? > > > > This patch updates qemu-kvm to move the VMX TSS Pages & update the > > KVM BIOS code to update the E820 BIOS call memory reservations. > > > > Previously, the VMC TSS Pages were located at 0xfffbd000-0xfffbffff. > > This change moved them to 0xfeffd000-0xfeffffff. > > > > This change also updates the KVM bios such that the E820 locations > > are returned properly for these two changes. > > > > From a high level, these are the effects of these two changes: > > > > Previously, the KVM would only accommodate a 256KB BIOS image. With > > these changes, the BIOS image may now grow to 16MB. > > > > Motivation for making these changes: > > > > A larger firmware image size allows alternative BIOS images to be > > used with KVM. Some possible uses are to enable UEFI firmware > > or coreboot firmware. Additionally, an alternative firmware might > > include a linux kernel+initrd payload, which would require several > > megabytes. > > I think if you update bios to UEFI, the E820 should be represented by UEFI > rather than current bios? Yeah, that is true. But, that firmware would be separate from the qemu-kvm tree at this time, right? But, in this patch it is critical that the 'VMX TSS Pages' are moved within qemu-kvm so the conflict with the larger bios.bin is removed. > > -- > regards > Yang, Sheng > > > Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> > > --- > > kvm/bios/rombios.c | 8 ++++---- > > kvm/include/x86/asm/vmx.h | 2 +- > > qemu-kvm-x86.c | 2 +- > > 3 files changed, 6 insertions(+), 6 deletions(-) > > > > diff --git a/kvm/bios/rombios.c b/kvm/bios/rombios.c > > index 6186199..2d0c153 100644 > > --- a/kvm/bios/rombios.c > > +++ b/kvm/bios/rombios.c > > @@ -4596,14 +4596,14 @@ ASM_END > > case 5: > > /* 4 pages before the bios, 3 pages for vmx tss > > pages, * the other page for EPT real mode pagetable */ > > - set_e820_range(ES, regs.u.r16.di, 0xfffbc000L, > > - 0xfffc0000L, 0, 0, 2); > > + set_e820_range(ES, regs.u.r16.di, 0xfeffc000L, > > + 0xff000000L, 0, 0, 2); > > regs.u.r32.ebx = 6; > > break; > > case 6: > > - /* 256KB BIOS area at the end of 4 GB */ > > + /* 16MB BIOS area at the end of 4 GB */ > > set_e820_range(ES, regs.u.r16.di, > > - 0xfffc0000L, 0x00000000L ,0, 0, 2); > > + 0xff000000L, 0x00000000L ,0, 0, 2); > > if (extra_highbits_memory_size || > > extra_lowbits_memory_size) regs.u.r32.ebx = 7; > > else > > diff --git a/kvm/include/x86/asm/vmx.h b/kvm/include/x86/asm/vmx.h > > index df8d4f9..99e2bb9 100644 > > --- a/kvm/include/x86/asm/vmx.h > > +++ b/kvm/include/x86/asm/vmx.h > > @@ -403,7 +403,7 @@ enum vmcs_field { > > #define VMX_EPT_EXECUTABLE_MASK 0x4ull > > #define VMX_EPT_IGMT_BIT (1ull << 6) > > > > -#define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfffbc000ul > > +#define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfeffc000ul > > > > > > #define ASM_VMX_VMCLEAR_RAX ".byte 0x66, 0x0f, 0xc7, 0x30" > > diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c > > index daf60b6..b5306aa 100644 > > --- a/qemu-kvm-x86.c > > +++ b/qemu-kvm-x86.c > > @@ -63,7 +63,7 @@ static int kvm_init_tss(kvm_context_t kvm) > > * this address is 3 pages before the bios, and the bios should present > > * as unavaible memory > > */ > > - r = kvm_set_tss_addr(kvm, 0xfffbd000); > > + r = kvm_set_tss_addr(kvm, 0xfeffd000); > > if (r < 0) { > > fprintf(stderr, "kvm_init_tss: unable to set tss addr\n"); > > return r; > > > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Update qemu-kvm to allow a larger BIOS image. 2009-07-16 2:58 ` Jordan Justen @ 2009-07-16 3:08 ` Sheng Yang 2009-07-16 4:57 ` Jordan Justen 0 siblings, 1 reply; 10+ messages in thread From: Sheng Yang @ 2009-07-16 3:08 UTC (permalink / raw) To: kvm; +Cc: Jordan Justen, Jordan Justen, Marcelo Tosatti On Thursday 16 July 2009 10:58:53 Jordan Justen wrote: > On Wed, Jul 15, 2009 at 6:34 PM, Sheng Yang <sheng@linux.intel.com> wrote: > > On Thursday 16 July 2009 08:12:15 Jordan Justen wrote: > > > Previously the KVM kernel module would allocate the address range > > > of 0xfffbc000-0xfffbcfff for the EPT Indentity Page Tables. > > > A separate patch is moving that to 0xfeffc000-0xfeffcfff. > > > > Hi Jordan > > > > You need one more patch for upstream kvm, to include the modification of > > vmx.h. > > I sent a separate patch for vmx.h for the > git://git.kernel.org/pub/scm/virt/kvm/kvm.git tree. Do I > need a patch for another copy of vmx.h? Oh, sorry, overlook that one...(I just think the second one is a update to the first...) :( > > > > This patch updates qemu-kvm to move the VMX TSS Pages & update the > > > KVM BIOS code to update the E820 BIOS call memory reservations. > > > > > > Previously, the VMC TSS Pages were located at 0xfffbd000-0xfffbffff. > > > This change moved them to 0xfeffd000-0xfeffffff. > > > > > > This change also updates the KVM bios such that the E820 locations > > > are returned properly for these two changes. > > > > > > From a high level, these are the effects of these two changes: > > > > > > Previously, the KVM would only accommodate a 256KB BIOS image. With > > > these changes, the BIOS image may now grow to 16MB. > > > > > > Motivation for making these changes: > > > > > > A larger firmware image size allows alternative BIOS images to be > > > used with KVM. Some possible uses are to enable UEFI firmware > > > or coreboot firmware. Additionally, an alternative firmware might > > > include a linux kernel+initrd payload, which would require several > > > megabytes. > > > > I think if you update bios to UEFI, the E820 should be represented by > > UEFI rather than current bios? > > Yeah, that is true. But, that firmware would be separate from the qemu-kvm > tree at this time, right? Yes, so currently from QEmu-kvm side, I think it may not necessary to update, for the patches haven't followed up yet... > > But, in this patch it is critical that the 'VMX TSS Pages' are moved within > qemu-kvm so the conflict with the larger bios.bin is removed. Well, for we are using a small size bios now, and larger bios would be totally another story, I don't think push the modification now to the upstream make sense. These modification can go with further patches with UEFI at any time in the future. -- regards Yang, Sheng > > > -- > > regards > > Yang, Sheng > > > > > Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> > > > --- > > > kvm/bios/rombios.c | 8 ++++---- > > > kvm/include/x86/asm/vmx.h | 2 +- > > > qemu-kvm-x86.c | 2 +- > > > 3 files changed, 6 insertions(+), 6 deletions(-) > > > > > > diff --git a/kvm/bios/rombios.c b/kvm/bios/rombios.c > > > index 6186199..2d0c153 100644 > > > --- a/kvm/bios/rombios.c > > > +++ b/kvm/bios/rombios.c > > > @@ -4596,14 +4596,14 @@ ASM_END > > > case 5: > > > /* 4 pages before the bios, 3 pages for vmx > > > tss pages, * the other page for EPT real mode pagetable */ > > > - set_e820_range(ES, regs.u.r16.di, 0xfffbc000L, > > > - 0xfffc0000L, 0, 0, 2); > > > + set_e820_range(ES, regs.u.r16.di, 0xfeffc000L, > > > + 0xff000000L, 0, 0, 2); > > > regs.u.r32.ebx = 6; > > > break; > > > case 6: > > > - /* 256KB BIOS area at the end of 4 GB */ > > > + /* 16MB BIOS area at the end of 4 GB */ > > > set_e820_range(ES, regs.u.r16.di, > > > - 0xfffc0000L, 0x00000000L ,0, 0, > > > 2); + 0xff000000L, 0x00000000L > > > ,0, 0, 2); if (extra_highbits_memory_size || > > > extra_lowbits_memory_size) regs.u.r32.ebx = 7; > > > else > > > diff --git a/kvm/include/x86/asm/vmx.h b/kvm/include/x86/asm/vmx.h > > > index df8d4f9..99e2bb9 100644 > > > --- a/kvm/include/x86/asm/vmx.h > > > +++ b/kvm/include/x86/asm/vmx.h > > > @@ -403,7 +403,7 @@ enum vmcs_field { > > > #define VMX_EPT_EXECUTABLE_MASK 0x4ull > > > #define VMX_EPT_IGMT_BIT (1ull << 6) > > > > > > -#define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfffbc000ul > > > +#define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfeffc000ul > > > > > > > > > #define ASM_VMX_VMCLEAR_RAX ".byte 0x66, 0x0f, 0xc7, 0x30" > > > diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c > > > index daf60b6..b5306aa 100644 > > > --- a/qemu-kvm-x86.c > > > +++ b/qemu-kvm-x86.c > > > @@ -63,7 +63,7 @@ static int kvm_init_tss(kvm_context_t kvm) > > > * this address is 3 pages before the bios, and the bios > > > should present * as unavaible memory > > > */ > > > - r = kvm_set_tss_addr(kvm, 0xfffbd000); > > > + r = kvm_set_tss_addr(kvm, 0xfeffd000); > > > if (r < 0) { > > > fprintf(stderr, "kvm_init_tss: unable to set tss > > > addr\n"); return r; > > > > -- > > To unsubscribe from this list: send the line "unsubscribe kvm" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Update qemu-kvm to allow a larger BIOS image. 2009-07-16 3:08 ` Sheng Yang @ 2009-07-16 4:57 ` Jordan Justen 2009-07-16 5:37 ` Sheng Yang 0 siblings, 1 reply; 10+ messages in thread From: Jordan Justen @ 2009-07-16 4:57 UTC (permalink / raw) To: Sheng Yang; +Cc: kvm, Jordan Justen, Marcelo Tosatti On Wed, Jul 15, 2009 at 8:08 PM, Sheng Yang<sheng@linux.intel.com> wrote: > On Thursday 16 July 2009 10:58:53 Jordan Justen wrote: >> On Wed, Jul 15, 2009 at 6:34 PM, Sheng Yang <sheng@linux.intel.com> wrote: >> > On Thursday 16 July 2009 08:12:15 Jordan Justen wrote: >> > > >> > > Motivation for making these changes: >> > > >> > > A larger firmware image size allows alternative BIOS images to be >> > > used with KVM. Some possible uses are to enable UEFI firmware >> > > or coreboot firmware. Additionally, an alternative firmware might >> > > include a linux kernel+initrd payload, which would require several >> > > megabytes. >> > >> > I think if you update bios to UEFI, the E820 should be represented by >> > UEFI rather than current bios? >> >> Yeah, that is true. But, that firmware would be separate from the qemu-kvm >> tree at this time, right? > > Yes, so currently from QEmu-kvm side, I think it may not necessary to update, > for the patches haven't followed up yet... Of the two patches (1. kvm kernel module, 2. qemu-kvm), I think it is best if the qemu-kvm change happens first. Since the qemu-kvm patch will cause the qemu-kvm bios to add more memory regions as reserved, the new change to qemu-kvm will be compatible with both the old and new versions of the kvm kernel module. >> But, in this patch it is critical that the 'VMX TSS Pages' are moved within >> qemu-kvm so the conflict with the larger bios.bin is removed. > > Well, for we are using a small size bios now, and larger bios would be totally > another story, I don't think push the modification now to the upstream make > sense. These modification can go with further patches with UEFI at any time in > the future. I am working on this UEFI firmware project which currently supports QEMU: https://edk2.tianocore.org/OVMF.html I would like it to also support KVM, and I found that it can already boot the UEFI shell on KVM if these two patches are applied. If these patches make some progress, I will update OVMF to reserve the appropriate memory regions. > -- > regards > Yang, Sheng > >> >> > -- >> > regards >> > Yang, Sheng >> > >> > > Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> >> > > --- >> > > kvm/bios/rombios.c | 8 ++++---- >> > > kvm/include/x86/asm/vmx.h | 2 +- >> > > qemu-kvm-x86.c | 2 +- >> > > 3 files changed, 6 insertions(+), 6 deletions(-) >> > > >> > > diff --git a/kvm/bios/rombios.c b/kvm/bios/rombios.c >> > > index 6186199..2d0c153 100644 >> > > --- a/kvm/bios/rombios.c >> > > +++ b/kvm/bios/rombios.c >> > > @@ -4596,14 +4596,14 @@ ASM_END >> > > case 5: >> > > /* 4 pages before the bios, 3 pages for vmx >> > > tss pages, * the other page for EPT real mode pagetable */ >> > > - set_e820_range(ES, regs.u.r16.di, 0xfffbc000L, >> > > - 0xfffc0000L, 0, 0, 2); >> > > + set_e820_range(ES, regs.u.r16.di, 0xfeffc000L, >> > > + 0xff000000L, 0, 0, 2); >> > > regs.u.r32.ebx = 6; >> > > break; >> > > case 6: >> > > - /* 256KB BIOS area at the end of 4 GB */ >> > > + /* 16MB BIOS area at the end of 4 GB */ >> > > set_e820_range(ES, regs.u.r16.di, >> > > - 0xfffc0000L, 0x00000000L ,0, 0, >> > > 2); + 0xff000000L, 0x00000000L >> > > ,0, 0, 2); if (extra_highbits_memory_size || >> > > extra_lowbits_memory_size) regs.u.r32.ebx = 7; >> > > else >> > > diff --git a/kvm/include/x86/asm/vmx.h b/kvm/include/x86/asm/vmx.h >> > > index df8d4f9..99e2bb9 100644 >> > > --- a/kvm/include/x86/asm/vmx.h >> > > +++ b/kvm/include/x86/asm/vmx.h >> > > @@ -403,7 +403,7 @@ enum vmcs_field { >> > > #define VMX_EPT_EXECUTABLE_MASK 0x4ull >> > > #define VMX_EPT_IGMT_BIT (1ull << 6) >> > > >> > > -#define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfffbc000ul >> > > +#define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfeffc000ul >> > > >> > > >> > > #define ASM_VMX_VMCLEAR_RAX ".byte 0x66, 0x0f, 0xc7, 0x30" >> > > diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c >> > > index daf60b6..b5306aa 100644 >> > > --- a/qemu-kvm-x86.c >> > > +++ b/qemu-kvm-x86.c >> > > @@ -63,7 +63,7 @@ static int kvm_init_tss(kvm_context_t kvm) >> > > * this address is 3 pages before the bios, and the bios >> > > should present * as unavaible memory >> > > */ >> > > - r = kvm_set_tss_addr(kvm, 0xfffbd000); >> > > + r = kvm_set_tss_addr(kvm, 0xfeffd000); >> > > if (r < 0) { >> > > fprintf(stderr, "kvm_init_tss: unable to set tss >> > > addr\n"); return r; >> > >> > -- >> > To unsubscribe from this list: send the line "unsubscribe kvm" in >> > the body of a message to majordomo@vger.kernel.org >> > More majordomo info at http://vger.kernel.org/majordomo-info.html >> >> -- >> To unsubscribe from this list: send the line "unsubscribe kvm" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html > > > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Update qemu-kvm to allow a larger BIOS image. 2009-07-16 4:57 ` Jordan Justen @ 2009-07-16 5:37 ` Sheng Yang 2009-07-16 17:57 ` Jordan Justen 0 siblings, 1 reply; 10+ messages in thread From: Sheng Yang @ 2009-07-16 5:37 UTC (permalink / raw) To: kvm; +Cc: Jordan Justen, Jordan Justen, Marcelo Tosatti On Thursday 16 July 2009 12:57:02 Jordan Justen wrote: > On Wed, Jul 15, 2009 at 8:08 PM, Sheng Yang<sheng@linux.intel.com> wrote: > > On Thursday 16 July 2009 10:58:53 Jordan Justen wrote: > >> On Wed, Jul 15, 2009 at 6:34 PM, Sheng Yang <sheng@linux.intel.com> wrote: > >> > On Thursday 16 July 2009 08:12:15 Jordan Justen wrote: > >> > > Motivation for making these changes: > >> > > > >> > > A larger firmware image size allows alternative BIOS images to be > >> > > used with KVM. Some possible uses are to enable UEFI firmware > >> > > or coreboot firmware. Additionally, an alternative firmware might > >> > > include a linux kernel+initrd payload, which would require several > >> > > megabytes. > >> > > >> > I think if you update bios to UEFI, the E820 should be represented by > >> > UEFI rather than current bios? > >> > >> Yeah, that is true. But, that firmware would be separate from the > >> qemu-kvm tree at this time, right? > > > > Yes, so currently from QEmu-kvm side, I think it may not necessary to > > update, for the patches haven't followed up yet... > > Of the two patches (1. kvm kernel module, 2. qemu-kvm), I think it > is best if the qemu-kvm change happens first. Since the qemu-kvm > patch will cause the qemu-kvm bios to add more memory regions > as reserved, the new change to qemu-kvm will be compatible with > both the old and new versions of the kvm kernel module. > > >> But, in this patch it is critical that the 'VMX TSS Pages' are moved > >> within qemu-kvm so the conflict with the larger bios.bin is removed. > > > > Well, for we are using a small size bios now, and larger bios would be > > totally another story, I don't think push the modification now to the > > upstream make sense. These modification can go with further patches with > > UEFI at any time in the future. > > I am working on this UEFI firmware project which currently supports QEMU: > https://edk2.tianocore.org/OVMF.html > > I would like it to also support KVM, and I found that it can already boot > the UEFI shell on KVM if these two patches are applied. > > If these patches make some progress, I will update OVMF to reserve the > appropriate memory regions. Make sense to me. So what's mattered here is not bios, but qemu-kvm and kvm code. The user can replace bios binary by UEFI binary easily, but not with kvm related part. I realized you still need separate the qemu-kvm patch into two: one for bios and another for qemu. And I just hope this modification won't break some old OS(any OS got assumption about bios size? I think Tiano team should have idea on it)... -- regards Yang, Sheng > > > -- > > regards > > Yang, Sheng > > > >> > -- > >> > regards > >> > Yang, Sheng > >> > > >> > > Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> > >> > > --- > >> > > kvm/bios/rombios.c | 8 ++++---- > >> > > kvm/include/x86/asm/vmx.h | 2 +- > >> > > qemu-kvm-x86.c | 2 +- > >> > > 3 files changed, 6 insertions(+), 6 deletions(-) > >> > > > >> > > diff --git a/kvm/bios/rombios.c b/kvm/bios/rombios.c > >> > > index 6186199..2d0c153 100644 > >> > > --- a/kvm/bios/rombios.c > >> > > +++ b/kvm/bios/rombios.c > >> > > @@ -4596,14 +4596,14 @@ ASM_END > >> > > case 5: > >> > > /* 4 pages before the bios, 3 pages for vmx > >> > > tss pages, * the other page for EPT real mode pagetable */ > >> > > - set_e820_range(ES, regs.u.r16.di, > >> > > 0xfffbc000L, - 0xfffc0000L, 0, > >> > > 0, 2); + set_e820_range(ES, regs.u.r16.di, > >> > > 0xfeffc000L, + 0xff000000L, 0, > >> > > 0, 2); regs.u.r32.ebx = 6; > >> > > break; > >> > > case 6: > >> > > - /* 256KB BIOS area at the end of 4 GB */ > >> > > + /* 16MB BIOS area at the end of 4 GB */ > >> > > set_e820_range(ES, regs.u.r16.di, > >> > > - 0xfffc0000L, 0x00000000L ,0, > >> > > 0, 2); + 0xff000000L, > >> > > 0x00000000L ,0, 0, 2); if (extra_highbits_memory_size || > >> > > extra_lowbits_memory_size) regs.u.r32.ebx = 7; > >> > > else > >> > > diff --git a/kvm/include/x86/asm/vmx.h b/kvm/include/x86/asm/vmx.h > >> > > index df8d4f9..99e2bb9 100644 > >> > > --- a/kvm/include/x86/asm/vmx.h > >> > > +++ b/kvm/include/x86/asm/vmx.h > >> > > @@ -403,7 +403,7 @@ enum vmcs_field { > >> > > #define VMX_EPT_EXECUTABLE_MASK 0x4ull > >> > > #define VMX_EPT_IGMT_BIT (1ull << 6) > >> > > > >> > > -#define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfffbc000ul > >> > > +#define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfeffc000ul > >> > > > >> > > > >> > > #define ASM_VMX_VMCLEAR_RAX ".byte 0x66, 0x0f, 0xc7, 0x30" > >> > > diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c > >> > > index daf60b6..b5306aa 100644 > >> > > --- a/qemu-kvm-x86.c > >> > > +++ b/qemu-kvm-x86.c > >> > > @@ -63,7 +63,7 @@ static int kvm_init_tss(kvm_context_t kvm) > >> > > * this address is 3 pages before the bios, and the > >> > > bios should present * as unavaible memory > >> > > */ > >> > > - r = kvm_set_tss_addr(kvm, 0xfffbd000); > >> > > + r = kvm_set_tss_addr(kvm, 0xfeffd000); > >> > > if (r < 0) { > >> > > fprintf(stderr, "kvm_init_tss: unable to set > >> > > tss addr\n"); return r; > >> > > >> > -- > >> > To unsubscribe from this list: send the line "unsubscribe kvm" in > >> > the body of a message to majordomo@vger.kernel.org > >> > More majordomo info at http://vger.kernel.org/majordomo-info.html > >> > >> -- > >> To unsubscribe from this list: send the line "unsubscribe kvm" in > >> the body of a message to majordomo@vger.kernel.org > >> More majordomo info at http://vger.kernel.org/majordomo-info.html > > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Update qemu-kvm to allow a larger BIOS image. 2009-07-16 5:37 ` Sheng Yang @ 2009-07-16 17:57 ` Jordan Justen 2009-07-22 19:04 ` Cristi Magherusan 0 siblings, 1 reply; 10+ messages in thread From: Jordan Justen @ 2009-07-16 17:57 UTC (permalink / raw) To: Sheng Yang; +Cc: kvm, Jordan Justen, Marcelo Tosatti On Wed, Jul 15, 2009 at 10:37 PM, Sheng Yang<sheng@linux.intel.com> wrote: > Make sense to me. So what's mattered here is not bios, but qemu-kvm and kvm > code. The user can replace bios binary by UEFI binary easily, but not with kvm > related part. > > I realized you still need separate the qemu-kvm patch into two: one for bios > and another for qemu. Okay, I will split this change apart. > And I just hope this modification won't break some old > OS(any OS got assumption about bios size? I think Tiano team should have idea > on it)... I don't think the OS should care about the bios size, but it is important to update the INT15-E820 memory ranges to help make sure the OS knows which regions are in use. Even without the E820 change, I think it would be unlikely for an OS to try utilize these memory regions, but it is definitely better to properly describe it. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Update qemu-kvm to allow a larger BIOS image. 2009-07-16 17:57 ` Jordan Justen @ 2009-07-22 19:04 ` Cristi Magherusan 2009-07-23 1:42 ` Sheng Yang 0 siblings, 1 reply; 10+ messages in thread From: Cristi Magherusan @ 2009-07-22 19:04 UTC (permalink / raw) To: Jordan Justen; +Cc: Sheng Yang, kvm, Jordan Justen, Marcelo Tosatti [-- Attachment #1: Type: text/plain, Size: 1363 bytes --] On Thu, 2009-07-16 at 10:57 -0700, Jordan Justen wrote: > On Wed, Jul 15, 2009 at 10:37 PM, Sheng Yang<sheng@linux.intel.com> wrote: > > Make sense to me. So what's mattered here is not bios, but qemu-kvm and kvm > > code. The user can replace bios binary by UEFI binary easily, but not with kvm > > related part. > > > > I realized you still need separate the qemu-kvm patch into two: one for bios > > and another for qemu. > > Okay, I will split this change apart. > > > And I just hope this modification won't break some old > > OS(any OS got assumption about bios size? I think Tiano team should have idea > > on it)... > > I don't think the OS should care about the bios size, but it is > important to update the INT15-E820 memory ranges to help > make sure the OS knows which regions are in use. > > Even without the E820 change, I think it would be unlikely > for an OS to try utilize these memory regions, but it is > definitely better to properly describe it. Hello, I don't know if I get this right, but is it enough to apply this patch to KVM-userspace, or do I also need to have a patched kernel in order to get large images (my image is 4MB) to work in KVM? Thanks, Cristi -- Ing. Cristi Măgherușan, System/Network Engineer Technical University of Cluj-Napoca, Romania http://cc.utcluj.ro +40264 401247 [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 197 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Update qemu-kvm to allow a larger BIOS image. 2009-07-22 19:04 ` Cristi Magherusan @ 2009-07-23 1:42 ` Sheng Yang 0 siblings, 0 replies; 10+ messages in thread From: Sheng Yang @ 2009-07-23 1:42 UTC (permalink / raw) To: Cristi Magherusan; +Cc: Jordan Justen, kvm, Jordan Justen, Marcelo Tosatti On Thursday 23 July 2009 03:04:33 Cristi Magherusan wrote: > On Thu, 2009-07-16 at 10:57 -0700, Jordan Justen wrote: > > On Wed, Jul 15, 2009 at 10:37 PM, Sheng Yang<sheng@linux.intel.com> wrote: > > > Make sense to me. So what's mattered here is not bios, but qemu-kvm and > > > kvm code. The user can replace bios binary by UEFI binary easily, but > > > not with kvm related part. > > > > > > I realized you still need separate the qemu-kvm patch into two: one for > > > bios and another for qemu. > > > > Okay, I will split this change apart. > > > > > And I just hope this modification won't break some old > > > OS(any OS got assumption about bios size? I think Tiano team should > > > have idea on it)... > > > > I don't think the OS should care about the bios size, but it is > > important to update the INT15-E820 memory ranges to help > > make sure the OS knows which regions are in use. > > > > Even without the E820 change, I think it would be unlikely > > for an OS to try utilize these memory regions, but it is > > definitely better to properly describe it. > > Hello, > > I don't know if I get this right, but is it enough to apply this patch > to KVM-userspace, or do I also need to have a patched kernel in order to > get large images (my image is 4MB) to work in KVM? > You need a patched KVM kernel modules for this. And you can use Jordan's patch currently(http://article.gmane.org/gmane.comp.emulators.kvm.devel/37344). The first one for BIOS(apply to qemu-kvm tree), second of qemu-kvm, and the third for KVM modules. -- regards Yang, Sheng ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2009-07-23 1:42 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-07-16 0:12 [PATCH] Update KVM kernel module to allow a larger BIOS image Jordan Justen 2009-07-16 0:12 ` [PATCH] Update qemu-kvm " Jordan Justen 2009-07-16 1:34 ` Sheng Yang 2009-07-16 2:58 ` Jordan Justen 2009-07-16 3:08 ` Sheng Yang 2009-07-16 4:57 ` Jordan Justen 2009-07-16 5:37 ` Sheng Yang 2009-07-16 17:57 ` Jordan Justen 2009-07-22 19:04 ` Cristi Magherusan 2009-07-23 1:42 ` Sheng Yang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox