xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Bei Guan <gbtju85@gmail.com>
To: Attilio Rao <attilio.rao@citrix.com>
Cc: Xen Devel <xen-devel@lists.xensource.com>,
	Jordan Justen <jljusten@gmail.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	"Andrei E. Warkentin" <andrey.warkentin@gmail.com>
Subject: [PATCH]Load the cirrus vga rom for the OVMF UEFI support in hvmloader
Date: Thu, 22 Mar 2012 16:29:54 +0800	[thread overview]
Message-ID: <CAEQjb-ThzvV735OqBycnu2J08UFcZVBkA_uCha5y4RF4w0OYJw@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 3841 bytes --]

Hi All,

Now, OVMF UEFI can boot on the Xen hvmloader. But, there is no VGA bios for
OVMF from the source code hvmloader/ovmf.c in the upstream Xen.
I have tried the vgabios provided by Xen, but I can see nothing through the
vnc client or sdl graphic window. Actually, if we check the boot trace log
of OVMF, we find that OVMF has booted into the OS installer grub.
When I try the cirrus_vga bios (named OvmfVideo.rom in edk2) provided by
OVMF, I can see the OVMF boot successfully through the vnc client or sdl
graphic window.

So, this patch makes the hvmloader load the cirrus_vga bios for OVMF on
Xen. Any suggestions and comments are appreciated.


diff -r 4e1d091d10d8 tools/firmware/Makefile
--- a/tools/firmware/Makefile Fri Mar 16 15:24:25 2012 +0000
+++ b/tools/firmware/Makefile Thu Mar 22 15:47:22 2012 +0800
@@ -6,12 +6,17 @@
 INST_DIR := $(DESTDIR)$(XENFIRMWAREDIR)

 SUBDIRS-y :=
+SUBDIRS-$(CONFIG_OVMF) += ovmf
 SUBDIRS-$(CONFIG_SEABIOS) += seabios-dir
 SUBDIRS-$(CONFIG_ROMBIOS) += rombios
 SUBDIRS-$(CONFIG_ROMBIOS) += vgabios
 SUBDIRS-$(CONFIG_ROMBIOS) += etherboot
 SUBDIRS-y += hvmloader

+ovmf:
+ GIT=$(GIT) $(XEN_ROOT)/scripts/git-checkout.sh $(OVMF_UPSTREAM_URL)
$(OVMF_UPSTREAM_REVISION) ovmf
+ cp ovmf-makefile ovmf/Makefile;
+
 seabios-dir:
  GIT=$(GIT) $(XEN_ROOT)/scripts/git-checkout.sh $(SEABIOS_UPSTREAM_URL)
$(SEABIOS_UPSTREAM_TAG) seabios-dir
  cp seabios-config seabios-dir/.config;
@@ -44,9 +49,35 @@
 subdir-distclean-etherboot: .phony
  $(MAKE) -C etherboot distclean

+subdir-distclean-ovmf: .phony
+ rm -rf ovmf ovmf-remote
+
 subdir-distclean-seabios-dir: .phony
  rm -rf seabios-dir seabios-dir-remote

+.PHONY: ovmf-find
+ovmf-find:
+ if test -d $(OVMF_UPSTREAM_URL) ; then \
+ mkdir -p ovmf; \
+ else \
+ export GIT=$(GIT); \
+ $(XEN_ROOT)/scripts/git-checkout.sh $(OVMF_UPSTREAM_URL)
$(OVMF_UPSTREAM_REVISION) ovmf ; \
+ fi
+
+.PHONY: ovmf-force-update
+ovmf-force-update:
+ set -ex; \
+ if [ "$(OVMF_UPSTREAM_REVISION)" ]; then \
+ cd ovmf-remote; \
+ $(GIT) fetch origin; \
+ $(GIT) reset --hard $(OVMF_UPSTREAM_REVISION); \
+ fi
+
+subdir-clean-ovmf:
+ set -e; if test -d ovmf/.; then \
+ $(MAKE) -C ovmf clean; \
+ fi
+
 .PHONY: seabios-dir-force-update
 seabios-dir-force-update:
  set -ex; \
diff -r 4e1d091d10d8 tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile Fri Mar 16 15:24:25 2012 +0000
+++ b/tools/firmware/hvmloader/Makefile Thu Mar 22 15:47:22 2012 +0800
@@ -57,7 +57,8 @@
 OBJS += ovmf.o
 CFLAGS += -DENABLE_OVMF
 OVMF_ROM := $(OVMF_DIR)/ovmf.bin
-ROMS += $(OVMF_ROM)
+OVMF_CIRRUS_VGA_ROM := $(OVMF_DIR)/ovmf-cirrus-vga.bin
+ROMS += $(OVMF_ROM) $(OVMF_CIRRUS_VGA_ROM)
 endif

 ifeq ($(CONFIG_ROMBIOS),y)
@@ -122,6 +123,11 @@
  sh ./mkhex etherboot $(ETHERBOOT_ROMS) >> $@.new
  echo "#endif" >> $@.new
 endif
+ifneq ($(OVMF_CIRRUS_VGA_ROM),)
+ echo "#ifdef ROM_INCLUDE_OVMF_CIRRUS_VGA" >> $@.new
+ sh ./mkhex ovmf_cirrus_vga $(OVMF_CIRRUS_VGA_ROM) >> $@.new
+ echo "#endif" >> $@.new
+endif

  mv $@.new $@

diff -r 4e1d091d10d8 tools/firmware/hvmloader/ovmf.c
--- a/tools/firmware/hvmloader/ovmf.c Fri Mar 16 15:24:25 2012 +0000
+++ b/tools/firmware/hvmloader/ovmf.c Thu Mar 22 15:47:22 2012 +0800
@@ -36,6 +36,7 @@
 #include <xen/memory.h>

 #define ROM_INCLUDE_OVMF
+#define ROM_INCLUDE_OVMF_CIRRUS_VGA
 #include "roms.inc"

 #define OVMF_BEGIN              0xFFF00000ULL
@@ -55,6 +56,12 @@
     xen_pfn_t mfn;
     uint64_t addr = OVMF_BEGIN;

+    /* Copy video ROM. */
+    memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
+     ovmf_cirrus_vga, sizeof(ovmf_cirrus_vga));
+    printf("OVMF Cirrus [0x%x-0x%x]\n", VGABIOS_PHYSICAL_ADDRESS,
+        VGABIOS_PHYSICAL_ADDRESS + sizeof(ovmf_cirrus_vga));
+
     /* Copy low-reset vector portion. */
     memcpy((void *) LOWCHUNK_BEGIN, (uint8_t *) config->image
            + OVMF_SIZE


Best Regards,
Bei Guan

[-- Attachment #1.2: Type: text/html, Size: 7470 bytes --]

[-- Attachment #2: ovmf-on-xen.patch --]
[-- Type: text/x-patch, Size: 3179 bytes --]

diff -r 4e1d091d10d8 tools/firmware/Makefile
--- a/tools/firmware/Makefile	Fri Mar 16 15:24:25 2012 +0000
+++ b/tools/firmware/Makefile	Thu Mar 22 15:47:22 2012 +0800
@@ -6,12 +6,17 @@
 INST_DIR := $(DESTDIR)$(XENFIRMWAREDIR)
 
 SUBDIRS-y :=
+SUBDIRS-$(CONFIG_OVMF) += ovmf
 SUBDIRS-$(CONFIG_SEABIOS) += seabios-dir
 SUBDIRS-$(CONFIG_ROMBIOS) += rombios
 SUBDIRS-$(CONFIG_ROMBIOS) += vgabios
 SUBDIRS-$(CONFIG_ROMBIOS) += etherboot
 SUBDIRS-y += hvmloader
 
+ovmf:
+	GIT=$(GIT) $(XEN_ROOT)/scripts/git-checkout.sh $(OVMF_UPSTREAM_URL) $(OVMF_UPSTREAM_REVISION) ovmf
+	cp ovmf-makefile ovmf/Makefile;
+
 seabios-dir:
 	GIT=$(GIT) $(XEN_ROOT)/scripts/git-checkout.sh $(SEABIOS_UPSTREAM_URL) $(SEABIOS_UPSTREAM_TAG) seabios-dir
 	cp seabios-config seabios-dir/.config;
@@ -44,9 +49,35 @@
 subdir-distclean-etherboot: .phony
 	$(MAKE) -C etherboot distclean
 
+subdir-distclean-ovmf: .phony
+	rm -rf ovmf ovmf-remote
+
 subdir-distclean-seabios-dir: .phony
 	rm -rf seabios-dir seabios-dir-remote
 
+.PHONY: ovmf-find
+ovmf-find:
+	if test -d $(OVMF_UPSTREAM_URL) ; then \
+		mkdir -p ovmf; \
+	else \
+		export GIT=$(GIT); \
+		$(XEN_ROOT)/scripts/git-checkout.sh $(OVMF_UPSTREAM_URL) $(OVMF_UPSTREAM_REVISION) ovmf ; \
+	fi
+
+.PHONY: ovmf-force-update
+ovmf-force-update:
+	set -ex; \
+	if [ "$(OVMF_UPSTREAM_REVISION)" ]; then \
+		cd ovmf-remote; \
+		$(GIT) fetch origin; \
+		$(GIT) reset --hard $(OVMF_UPSTREAM_REVISION); \
+	fi
+
+subdir-clean-ovmf:
+	set -e; if test -d ovmf/.; then \
+		$(MAKE) -C ovmf clean; \
+	fi
+
 .PHONY: seabios-dir-force-update
 seabios-dir-force-update:
 	set -ex; \
diff -r 4e1d091d10d8 tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile	Fri Mar 16 15:24:25 2012 +0000
+++ b/tools/firmware/hvmloader/Makefile	Thu Mar 22 15:47:22 2012 +0800
@@ -57,7 +57,8 @@
 OBJS += ovmf.o
 CFLAGS += -DENABLE_OVMF
 OVMF_ROM := $(OVMF_DIR)/ovmf.bin
-ROMS += $(OVMF_ROM)
+OVMF_CIRRUS_VGA_ROM := $(OVMF_DIR)/ovmf-cirrus-vga.bin
+ROMS += $(OVMF_ROM) $(OVMF_CIRRUS_VGA_ROM)
 endif
 
 ifeq ($(CONFIG_ROMBIOS),y)
@@ -122,6 +123,11 @@
 	sh ./mkhex etherboot $(ETHERBOOT_ROMS) >> $@.new
 	echo "#endif" >> $@.new
 endif
+ifneq ($(OVMF_CIRRUS_VGA_ROM),)
+	echo "#ifdef ROM_INCLUDE_OVMF_CIRRUS_VGA" >> $@.new
+	sh ./mkhex ovmf_cirrus_vga $(OVMF_CIRRUS_VGA_ROM) >> $@.new
+	echo "#endif" >> $@.new
+endif
 
 	mv $@.new $@
 
diff -r 4e1d091d10d8 tools/firmware/hvmloader/ovmf.c
--- a/tools/firmware/hvmloader/ovmf.c	Fri Mar 16 15:24:25 2012 +0000
+++ b/tools/firmware/hvmloader/ovmf.c	Thu Mar 22 15:47:22 2012 +0800
@@ -36,6 +36,7 @@
 #include <xen/memory.h>
 
 #define ROM_INCLUDE_OVMF
+#define ROM_INCLUDE_OVMF_CIRRUS_VGA
 #include "roms.inc"
 
 #define OVMF_BEGIN              0xFFF00000ULL
@@ -55,6 +56,12 @@
     xen_pfn_t mfn;
     uint64_t addr = OVMF_BEGIN;
 
+    /* Copy video ROM. */
+    memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
+    	ovmf_cirrus_vga, sizeof(ovmf_cirrus_vga));
+    printf("OVMF Cirrus [0x%x-0x%x]\n", VGABIOS_PHYSICAL_ADDRESS,
+        VGABIOS_PHYSICAL_ADDRESS + sizeof(ovmf_cirrus_vga));
+
     /* Copy low-reset vector portion. */
     memcpy((void *) LOWCHUNK_BEGIN, (uint8_t *) config->image
            + OVMF_SIZE

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

             reply	other threads:[~2012-03-22  8:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-22  8:29 Bei Guan [this message]
2012-03-22  8:57 ` [PATCH]Load the cirrus vga rom for the OVMF UEFI support in hvmloader Ian Campbell
2012-03-22  9:24   ` Jan Beulich
2012-03-22 19:27   ` Jordan Justen
2012-03-22 11:37 ` Attilio Rao
2012-03-22 13:33   ` Bei Guan
2012-03-22 14:43   ` Bei Guan
2012-03-22 19:37     ` Jordan Justen
2012-03-23  4:03       ` Bei Guan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAEQjb-ThzvV735OqBycnu2J08UFcZVBkA_uCha5y4RF4w0OYJw@mail.gmail.com \
    --to=gbtju85@gmail.com \
    --cc=andrey.warkentin@gmail.com \
    --cc=attilio.rao@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=jljusten@gmail.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).