Skip to contentSkip to conversation

Minor ACPI fixes for PVHv2 DomU

PATCH In review Roger Pau Monne 4 participants 8 messages Nov 7, 2016 – Nov 8, 2016

lore
Share & tools
lore
#1 lore raw

PATCH v2 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]>
---
Changes since v1:
- Also fix the calculation of the required number of pages so that the offset is taken into account.

---
 tools/libxc/xc_dom_core.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tools/libxc/xc_dom_core.c +6 -2
index e177667..ad819dd 100644
@@ -1090,8 +1090,9 @@ static int xc_dom_load_acpi(struct xc_dom_image *dom)
                   dom->acpi_modules[i].length,
                   dom->acpi_modules[i].guest_addr_out);
 
-        num_pages = (dom->acpi_modules[i].length + (XC_PAGE_SIZE - 1)) >>
-                       XC_PAGE_SHIFT;
+        num_pages = (dom->acpi_modules[i].length +
+                     (dom->acpi_modules[i].guest_addr_out & ~XC_PAGE_MASK) +
+                     (XC_PAGE_SIZE - 1)) >> XC_PAGE_SHIFT;
         extents = malloc(num_pages * sizeof(*extents));
         if ( !extents )
         {
@@ -1118,6 +1119,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 v2 for-4.8 1/2] libxc: properly account for the page offset when copying ACPI data

Quoted 9 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]>

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

Reviewed-by on v2 1/2
#3 lore raw

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

In reply to Roger Pau Monne
Quoted 9 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]>

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

#4 lore raw

PATCH v2 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]>
---
Changes since v1:
- Reword code comment.

---
 tools/libxc/xc_dom_x86.c | 3 +++
 1 file changed, 3 insertions(+)
tools/libxc/xc_dom_x86.c +3 -0
index 0eab8a7..6495e7f 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;
         }
+
+        /* ACPI 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
Reviewed-by on v2 2/2
#5 lore raw

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

Quoted 9 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]>

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

Reviewed-by on v2 2/2
#6 lore raw

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

In reply to Roger Pau Monne
Quoted 9 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]>

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