Skip to contentSkip to conversation

Minor ACPI fixes for PVHv2 DomU

PATCH Superseded Roger Pau Monne 3 participants 5 messages Nov 7, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#1 lore raw

PATCH 1/2 libxc: properly account for the page offset when copying ACPI data

Or else ACPI data is always copied at the start of the page pointed by guest_addr_out, ignoring the page offset.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Boris Ostrovsky <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>

---
 tools/libxc/xc_dom_core.c | 3 +++
 1 file changed, 3 insertions(+)
tools/libxc/xc_dom_core.c +3 -0
index e177667..cbc1a43 100644
@@ -1118,6 +1118,9 @@ static int xc_dom_load_acpi(struct xc_dom_image *dom)
             goto err;
         }
 
+        ptr = (uint8_t *)ptr +
+              (dom->acpi_modules[i].guest_addr_out & ~XC_PAGE_MASK);
+
         memcpy(ptr, dom->acpi_modules[i].data, dom->acpi_modules[i].length);
         munmap(ptr, XC_PAGE_SIZE * num_pages);
 
Signature · 7 lines
2.7.4 (Apple Git-66)


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#2 lore raw

Re: [PATCH for-4.8 1/2] libxc: properly account for the page offset when copying ACPI data

Quoted 18 lines · Roger Pau Monne

Or else ACPI data is always copied at the start of the page pointed by guest_addr_out, ignoring the page offset.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Boris Ostrovsky <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>

---
 tools/libxc/xc_dom_core.c | 3 +++
 1 file changed, 3 insertions(+)
tools/libxc/xc_dom_core.c +0 -0
index e177667..cbc1a43 100644

tools/libxc/xc_dom_core.c static int xc_dom_load_acpi(struct xc_dom_image *dom) · line 1122

Quoted 5 lines
tools/libxc/xc_dom_core.c +2 -0
@@ -1118,6 +1118,9 @@ static int xc_dom_load_acpi(struct xc_dom_image *dom)
             goto err;
         }
 
+        ptr = (uint8_t *)ptr +
+              (dom->acpi_modules[i].guest_addr_out & ~XC_PAGE_MASK);

You also need to adjust the num_pages calculation, or you risk memcpy()'ing off the end of the foreign mapping.

~Andrew

tools/libxc/xc_dom_core.c static int xc_dom_load_acpi(struct xc_dom_image *dom) · line 1126

Quoted 4 lines
tools/libxc/xc_dom_core.c +1 -0
+
         memcpy(ptr, dom->acpi_modules[i].data, dom->acpi_modules[i].length);
         munmap(ptr, XC_PAGE_SIZE * num_pages);
 

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw

PATCH 2/2 libxc: set rsdp pointer for PVHv2 guests

In reply to Roger Pau Monne

Set the address of the RSDP in the HVM start info structure for PVHv2 DomUs that have ACPI tables.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Boris Ostrovsky <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>

---
 tools/libxc/xc_dom_x86.c | 3 +++
 1 file changed, 3 insertions(+)
tools/libxc/xc_dom_x86.c +3 -0
index 0eab8a7..0f52520 100644
@@ -1797,6 +1797,9 @@ static int bootlate_hvm(struct xc_dom_image *dom)
             modlist[0].size = dom->ramdisk_seg.vend - dom->ramdisk_seg.vstart;
             start_info->nr_modules = 1;
         }
+
+        /* Module 0 is the RSDP */
+        start_info->rsdp_paddr = dom->acpi_modules[0].guest_addr_out ? : 0;
     }
     else
     {
Signature · 7 lines
2.7.4 (Apple Git-66)


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#4 lore raw

Re: [PATCH for-4.8 2/2] libxc: set rsdp pointer for PVHv2 guests

Quoted 18 lines · Roger Pau Monne

Set the address of the RSDP in the HVM start info structure for PVHv2 DomUs that have ACPI tables.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Boris Ostrovsky <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>

---
 tools/libxc/xc_dom_x86.c | 3 +++
 1 file changed, 3 insertions(+)
tools/libxc/xc_dom_x86.c +0 -0
index 0eab8a7..0f52520 100644

tools/libxc/xc_dom_x86.c static int bootlate_hvm(struct xc_dom_image *dom) · line 1801

Quoted 5 lines
tools/libxc/xc_dom_x86.c +2 -0
@@ -1797,6 +1797,9 @@ static int bootlate_hvm(struct xc_dom_image *dom)
             modlist[0].size = dom->ramdisk_seg.vend - dom->ramdisk_seg.vstart;
             start_info->nr_modules = 1;
         }
+
+        /* Module 0 is the RSDP */

I'd say "ACPI module 0" because modlist (right above the comment) also operates on modules and that may confuse people (it did for me).

-boris

tools/libxc/xc_dom_x86.c static int bootlate_hvm(struct xc_dom_image *dom) · line 1805

Quoted 4 lines
tools/libxc/xc_dom_x86.c +1 -0
+        start_info->rsdp_paddr = dom->acpi_modules[0].guest_addr_out ? : 0;
     }
     else
     {

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel