xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hvmloader / qemu-xen: Getting rid of resource conflict for OpRegion.
@ 2012-12-20  3:52 G.R.
  2012-12-20  3:56 ` G.R.
  0 siblings, 1 reply; 26+ messages in thread
From: G.R. @ 2012-12-20  3:52 UTC (permalink / raw)
  To: Jean Guyader, xen-devel

This is hvmloader part of the change that gets rid of the resource
conflict warning in the guest kernel.
The OpRegion may not always be page aligned.
As a result one extra page is required to fully accommodate the
OpRegion in that case.
Just reserve one more page here.

Signed-off-by: Timothy Guo <firemeteor@users.sourceforge.net>

diff -r 11b4bc743b1f tools/firmware/hvmloader/e820.c
--- a/tools/firmware/hvmloader/e820.c    Mon Dec 17 14:59:11 2012 +0000
+++ b/tools/firmware/hvmloader/e820.c    Thu Dec 20 00:07:40 2012 +0800
@@ -142,11 +142,11 @@ int build_e820_table(struct e820entry *e
         nr++;

         e820[nr].addr = igd_opregion_base;
-        e820[nr].size = 2 * PAGE_SIZE;
+        e820[nr].size = 3 * PAGE_SIZE;
         e820[nr].type = E820_NVS;
         nr++;

-        e820[nr].addr = igd_opregion_base + 2 * PAGE_SIZE;
+        e820[nr].addr = igd_opregion_base + 3 * PAGE_SIZE;
         e820[nr].size = (uint32_t)-e820[nr].addr;
         e820[nr].type = E820_RESERVED;
         nr++;
diff -r 11b4bc743b1f tools/firmware/hvmloader/pci.c
--- a/tools/firmware/hvmloader/pci.c    Mon Dec 17 14:59:11 2012 +0000
+++ b/tools/firmware/hvmloader/pci.c    Thu Dec 20 00:07:40 2012 +0800
@@ -98,7 +98,7 @@ void pci_setup(void)
                 virtual_vga = VGA_pt;
                 if ( vendor_id == 0x8086 )
                 {
-                    igd_opregion_pgbase = mem_hole_alloc(2);
+                    igd_opregion_pgbase = mem_hole_alloc(3);
                     /*
                      * Write the the OpRegion offset to give the opregion
                      * address to the device model. The device model will trap


This is qemu-xen part of the change that gets rid of the resource
conflict warning in the guest kernel.
If the host OpRegion is page aligned, two pages will be sufficient.
Otherwise, we need to map one more page to have it fully accommodated
-- the guest kernel would map this extra page and complain about
resource conflict.

Signed-off-by: Timothy Guo <firemeteor@users.sourceforge.net>

diff --git a/hw/pt-graphics.c b/hw/pt-graphics.c
index c6f8869..3f2b285 100644
--- a/hw/pt-graphics.c
+++ b/hw/pt-graphics.c
@@ -81,6 +81,7 @@ uint32_t igd_read_opregion(struct pt_dev *pci_dev)
 void igd_write_opregion(struct pt_dev *real_dev, uint32_t val)
 {
     uint32_t host_opregion = 0;
+    uint32_t map_size = 2;
     int ret;

     if ( igd_guest_opregion )
@@ -74,11 +93,13 @@ void igd_write_opregion(struct pt_dev *real_dev,
uint32_t val)
     host_opregion = pt_pci_host_read(real_dev->pci_dev, PCI_INTEL_OPREGION, 4);
     igd_guest_opregion = (val & ~0xfff) | (host_opregion & 0xfff);
     PT_LOG("Map OpRegion: %x -> %x\n", host_opregion, igd_guest_opregion);
+    //If the opregion is not page-aligned, map one more page to fit
the entire region.
+    map_size += (host_opregion & 0xfff) != 0;

     ret = xc_domain_memory_mapping(xc_handle, domid,
             igd_guest_opregion >> XC_PAGE_SHIFT,
             host_opregion >> XC_PAGE_SHIFT,
-            2,
+            map_size,
             DPCI_ADD_MAPPING);

     if ( ret != 0 )

^ permalink raw reply related	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2013-01-15 16:44 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-20  3:52 [PATCH] hvmloader / qemu-xen: Getting rid of resource conflict for OpRegion G.R.
2012-12-20  3:56 ` G.R.
2012-12-20 10:41   ` Ian Campbell
2012-12-20 13:03     ` Keir Fraser
2012-12-20 13:31       ` G.R.
2012-12-20 14:19         ` Keir Fraser
2012-12-20 15:06           ` G.R.
2012-12-20 18:27             ` Ross Philipson
2012-12-21  3:59               ` G.R.
2012-12-21 15:55                 ` Ross Philipson
2012-12-21 16:49                   ` G.R.
2012-12-21 17:03                     ` Ross Philipson
2012-12-21 17:26                       ` Ross Philipson
2012-12-23  6:11                         ` G.R.
2013-01-02 16:34                           ` Ross Philipson
2013-01-04  7:25                             ` G.R.
2013-01-09 15:34                             ` G.R.
2013-01-09 16:36                               ` Ross Philipson
2013-01-10 10:27                                 ` G.R.
2013-01-10 13:40                                   ` Ross Philipson
2013-01-10 16:29                                     ` G.R.
2013-01-14 16:01                                       ` Ross Philipson
2013-01-15 16:44                                         ` G.R.
2012-12-20 19:44             ` Jean Guyader
2012-12-20 19:50       ` Ian Campbell
2012-12-21  3:51         ` G.R.

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).