Skip to contentSkip to conversation

Introduce HMV without dm and new boot ABI

RFC PATCH Superseded Roger Pau Monne 8 participants 43 messages Jun 22, 2015 – Jul 10, 2015 Arm/actions semi architecture

v1 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

cover Introduce HMV without dm and new boot ABI

Before reading any further, keep in mind this is a VERY inital RFC prototype series. Many things are not finished, and those that are done make heavy use of duck tape in order to keep things into place.

Now that you are warned, this series is split in the following order:

- Patches from 1 to 7 switch HVM domain contruction to use the xc_dom_* family of functions, like they are used to build PV domains.
- Patches from 8 to 13 introduce the creation of HVM domains without firmware, which is replaced by directly loading a kernel like it's done for PV guests. A new boot ABI based on the discussion in the thread "RFC:
making the PVH 64bit ABI as stable" is also introduced, although it's not finished.

Some things that are missing from the new boot ABI:

- Although it supports loading a ramdisk, there's still now defined way into how to pass this ramdisk to the guest. I'm thinking of using a HVMPARAM or simply setting a GP register to contain the address of the ramdisk. Ideally I would like to support loading more than one ramdisk.

Some patches contain comments after the SoB, which in general describe the shortcommings of the implementation. The aim of those is to initiate discussion about whether the aproach taken is TRTTD.

I've only tested this on Intel hw, but I see no reason why it shouldn't work on AMD. I've managed to boot FreeBSD up to the point were it should jump into user-space (I just didn't have a VBD attached to the VM so it just sits waiting for a valid disk). I have not tried to boot it any further since I think that's fine for the purpose of this series.

The series can also be found in the following git repo:

git://xenbits.xen.org/people/royger/xen.git branch hvm_without_dm_v1

And for the FreeBSD part:

git://xenbits.xen.org/people/royger/freebsd.git branch new_entry_point_v1

In case someone wants to give it a try, I've uploaded a FreeBSD kernel that should work when booted into this mode:

https://people.freebsd.org/~royger/kernel_no_dm

The config file that I've used is:

<config>
kernel="/path/to/kernel_no_dm"

builder="hvm"
device_model_version="none"

memory=128
vcpus=1
name = "freebsd"
</config>

Thanks, Roger.

#1 lore raw

RFC PATCH 1/13 libxc: split x86 HVM setup_guest into smaller logical functions

This is just a preparatory change to clean up the code in setup_guest. Should not introduce any functional changes.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Elena Ufimtseva <[email protected]>
---
 tools/libxc/xc_hvm_build_x86.c | 198 ++++++++++++++++++++++++-----------------
 1 file changed, 117 insertions(+), 81 deletions(-)
tools/libxc/xc_hvm_build_x86.c +117 -81
index 003ea06..f7616a8 100644
@@ -232,28 +232,20 @@ static int check_mmio_hole(uint64_t start, uint64_t memsize,
         return 1;
 }
 
-static int setup_guest(xc_interface *xch,
-                       uint32_t dom, struct xc_hvm_build_args *args,
-                       char *image, unsigned long image_size)
+static int xc_hvm_populate_memory(xc_interface *xch, uint32_t dom,
+                                  struct xc_hvm_build_args *args,
+                                  xen_pfn_t *page_array)
 {
-    xen_pfn_t *page_array = NULL;
     unsigned long i, vmemid, nr_pages = args->mem_size >> PAGE_SHIFT;
     unsigned long p2m_size;
     unsigned long target_pages = args->mem_target >> PAGE_SHIFT;
-    unsigned long entry_eip, cur_pages, cur_pfn;
-    void *hvm_info_page;
-    uint32_t *ident_pt;
-    struct elf_binary elf;
-    uint64_t v_start, v_end;
-    uint64_t m_start = 0, m_end = 0;
+    unsigned long cur_pages, cur_pfn;
     int rc;
     xen_capabilities_info_t caps;
     unsigned long stat_normal_pages = 0, stat_2mb_pages = 0, 
         stat_1gb_pages = 0;
     unsigned int memflags = 0;
     int claim_enabled = args->claim_enabled;
-    xen_pfn_t special_array[NR_SPECIAL_PAGES];
-    xen_pfn_t ioreq_server_array[NR_IOREQ_SERVER_PAGES];
     uint64_t total_pages;
     xen_vmemrange_t dummy_vmemrange[2];
     unsigned int dummy_vnode_to_pnode[1];
@@ -261,19 +253,6 @@ static int setup_guest(xc_interface *xch,
     unsigned int *vnode_to_pnode;
     unsigned int nr_vmemranges, nr_vnodes;
 
-    memset(&elf, 0, sizeof(elf));
-    if ( elf_init(&elf, image, image_size) != 0 )
-    {
-        PERROR("Could not initialise ELF image");
-        goto error_out;
-    }
-
-    xc_elf_set_logfile(xch, &elf, 1);
-
-    elf_parse_binary(&elf);
-    v_start = 0;
-    v_end = args->mem_size;
-
     if ( nr_pages > target_pages )
         memflags |= XENMEMF_populate_on_demand;
 
@@ -346,24 +325,6 @@ static int setup_guest(xc_interface *xch,
         goto error_out;
     }
 
-    if ( modules_init(args, v_end, &elf, &m_start, &m_end) != 0 )
-    {
-        ERROR("Insufficient space to load modules.");
-        goto error_out;
-    }
-
-    DPRINTF("VIRTUAL MEMORY ARRANGEMENT:\n");
-    DPRINTF("  Loader:   %016"PRIx64"->%016"PRIx64"\n", elf.pstart, elf.pend);
-    DPRINTF("  Modules:  %016"PRIx64"->%016"PRIx64"\n", m_start, m_end);
-    DPRINTF("  TOTAL:    %016"PRIx64"->%016"PRIx64"\n", v_start, v_end);
-    DPRINTF("  ENTRY:    %016"PRIx64"\n", elf_uval(&elf, elf.ehdr, e_entry));
-
-    if ( (page_array = malloc(p2m_size * sizeof(xen_pfn_t))) == NULL )
-    {
-        PERROR("Could not allocate memory.");
-        goto error_out;
-    }
-
     for ( i = 0; i < p2m_size; i++ )
         page_array[i] = ((xen_pfn_t)-1);
     for ( vmemid = 0; vmemid < nr_vmemranges; vmemid++ )
@@ -563,7 +524,54 @@ static int setup_guest(xc_interface *xch,
     DPRINTF("  4KB PAGES: 0x%016lx\n", stat_normal_pages);
     DPRINTF("  2MB PAGES: 0x%016lx\n", stat_2mb_pages);
     DPRINTF("  1GB PAGES: 0x%016lx\n", stat_1gb_pages);
-    
+
+    rc = 0;
+    goto out;
+ error_out:
+    rc = -1;
+ out:
+
+    /* ensure no unclaimed pages are left unused */
+    xc_domain_claim_pages(xch, dom, 0 /* cancels the claim */);
+
+    return rc;
+}
+
+static int xc_hvm_load_image(xc_interface *xch,
+                       uint32_t dom, struct xc_hvm_build_args *args,
+                       xen_pfn_t *page_array)
+{
+    unsigned long entry_eip, image_size;
+    struct elf_binary elf;
+    uint64_t v_start, v_end;
+    uint64_t m_start = 0, m_end = 0;
+    char *image;
+    int rc;
+
+    image = xc_read_image(xch, args->image_file_name, &image_size);
+    if ( image == NULL )
+        return -1;
+
+    memset(&elf, 0, sizeof(elf));
+    if ( elf_init(&elf, image, image_size) != 0 )
+        goto error_out;
+
+    xc_elf_set_logfile(xch, &elf, 1);
+
+    elf_parse_binary(&elf);
+    v_start = 0;
+    v_end = args->mem_size;
+
+    if ( modules_init(args, v_end, &elf, &m_start, &m_end) != 0 )
+    {
+        ERROR("Insufficient space to load modules.");
+        goto error_out;
+    }
+
+    DPRINTF("VIRTUAL MEMORY ARRANGEMENT:\n");
+    DPRINTF("  Loader:   %016"PRIx64"->%016"PRIx64"\n", elf.pstart, elf.pend);
+    DPRINTF("  Modules:  %016"PRIx64"->%016"PRIx64"\n", m_start, m_end);
+
     if ( loadelfimage(xch, &elf, dom, page_array) != 0 )
     {
         PERROR("Could not load ELF image");
@@ -576,6 +584,44 @@ static int setup_guest(xc_interface *xch,
         goto error_out;
     }
 
+    /* Insert JMP <rel32> instruction at address 0x0 to reach entry point. */
+    entry_eip = elf_uval(&elf, elf.ehdr, e_entry);
+    if ( entry_eip != 0 )
+    {
+        char *page0 = xc_map_foreign_range(
+            xch, dom, PAGE_SIZE, PROT_READ | PROT_WRITE, 0);
+        if ( page0 == NULL )
+            goto error_out;
+        page0[0] = 0xe9;
+        *(uint32_t *)&page0[1] = entry_eip - 5;
+        munmap(page0, PAGE_SIZE);
+    }
+
+    rc = 0;
+    goto out;
+ error_out:
+    rc = -1;
+ out:
+    if ( elf_check_broken(&elf) )
+        ERROR("HVM ELF broken: %s", elf_check_broken(&elf));
+    free(image);
+
+    return rc;
+}
+
+static int xc_hvm_populate_params(xc_interface *xch, uint32_t dom,
+                                  struct xc_hvm_build_args *args)
+{
+    unsigned long i;
+    void *hvm_info_page;
+    uint32_t *ident_pt;
+    uint64_t v_end;
+    int rc;
+    xen_pfn_t special_array[NR_SPECIAL_PAGES];
+    xen_pfn_t ioreq_server_array[NR_IOREQ_SERVER_PAGES];
+
+    v_end = args->mem_size;
+
     if ( (hvm_info_page = xc_map_foreign_range(
               xch, dom, PAGE_SIZE, PROT_READ | PROT_WRITE,
               HVM_INFO_PFN)) == NULL )
@@ -664,34 +710,12 @@ static int setup_guest(xc_interface *xch,
     xc_hvm_param_set(xch, dom, HVM_PARAM_IDENT_PT,
                      special_pfn(SPECIALPAGE_IDENT_PT) << PAGE_SHIFT);
 
-    /* Insert JMP <rel32> instruction at address 0x0 to reach entry point. */
-    entry_eip = elf_uval(&elf, elf.ehdr, e_entry);
-    if ( entry_eip != 0 )
-    {
-        char *page0 = xc_map_foreign_range(
-            xch, dom, PAGE_SIZE, PROT_READ | PROT_WRITE, 0);
-        if ( page0 == NULL )
-        {
-            PERROR("Could not map page0");
-            goto error_out;
-        }
-        page0[0] = 0xe9;
-        *(uint32_t *)&page0[1] = entry_eip - 5;
-        munmap(page0, PAGE_SIZE);
-    }
-
     rc = 0;
     goto out;
  error_out:
     rc = -1;
  out:
-    if ( elf_check_broken(&elf) )
-        ERROR("HVM ELF broken: %s", elf_check_broken(&elf));
-
-    /* ensure no unclaimed pages are left unused */
-    xc_domain_claim_pages(xch, dom, 0 /* cancels the claim */);
 
-    free(page_array);
     return rc;
 }
 
@@ -702,9 +726,8 @@ int xc_hvm_build(xc_interface *xch, uint32_t domid,
                  struct xc_hvm_build_args *hvm_args)
 {
     struct xc_hvm_build_args args = *hvm_args;
-    void *image;
-    unsigned long image_size;
-    int sts;
+    xen_pfn_t *parray = NULL;
+    int rc;
 
     if ( domid == 0 )
         return -1;
@@ -715,24 +738,37 @@ int xc_hvm_build(xc_interface *xch, uint32_t domid,
     if ( args.mem_size < (2ull << 20) || args.mem_target < (2ull << 20) )
         return -1;
 
-    image = xc_read_image(xch, args.image_file_name, &image_size);
-    if ( image == NULL )
+    parray = malloc((args.mem_size >> PAGE_SHIFT) * sizeof(xen_pfn_t));
+    if ( parray == NULL )
         return -1;
 
-    sts = setup_guest(xch, domid, &args, image, image_size);
-
-    if (!sts)
+    rc = xc_hvm_populate_memory(xch, domid, &args, parray);
+    if ( rc != 0 )
     {
-        /* Return module load addresses to caller */
-        hvm_args->acpi_module.guest_addr_out = 
-            args.acpi_module.guest_addr_out;
-        hvm_args->smbios_module.guest_addr_out = 
-            args.smbios_module.guest_addr_out;
+        PERROR("xc_hvm_populate_memory failed");
+        goto out;
+    }
+    rc = xc_hvm_load_image(xch, domid, &args, parray);
+    if ( rc != 0 )
+    {
+        PERROR("xc_hvm_load_image failed");
+        goto out;
+    }
+    rc = xc_hvm_populate_params(xch, domid, &args);
+    if ( rc != 0 )
+    {
+        PERROR("xc_hvm_populate_params failed");
+        goto out;
     }
 
-    free(image);
+    /* Return module load addresses to caller */
+    hvm_args->acpi_module.guest_addr_out = args.acpi_module.guest_addr_out;
+    hvm_args->smbios_module.guest_addr_out = args.smbios_module.guest_addr_out;
 
-    return sts;
+out:
+    free(parray);
+
+    return rc;
 }
 
 /* xc_hvm_build_target_mem: 
Signature · 7 lines
1.9.5 (Apple Git-50.3)


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

RFC PATCH 2/13 libxc: unify xc_dom_p2m_{host/guest}

In reply to Roger Pau Monne

Unify both functions into xc_dom_p2m. Should not introduce any functional change.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Elena Ufimtseva <[email protected]>
---
 stubdom/grub/kexec.c              |  4 ++--
 tools/libxc/include/xc_dom.h      | 14 ++------------
 tools/libxc/xc_dom_boot.c         | 10 +++++-----
 tools/libxc/xc_dom_compat_linux.c |  4 ++--
 tools/libxc/xc_dom_x86.c          | 32 ++++++++++++++++----------------
 tools/libxl/libxl_dom.c           |  4 ++--
 6 files changed, 29 insertions(+), 39 deletions(-)
stubdom/grub/kexec.c +2 -2
index 4c33b25..0b2f4f3 100644
@@ -358,9 +358,9 @@ void kexec(void *kernel, long kernel_size, void *module, long module_size, char
 #ifdef __x86_64__
                 MMUEXT_PIN_L4_TABLE,
 #endif
-                xc_dom_p2m_host(dom, dom->pgtables_seg.pfn),
+                xc_dom_p2m(dom, dom->pgtables_seg.pfn),
                 dom->guest_domid)) != 0 ) {
-        grub_printf("pin_table(%lx) returned %d\n", xc_dom_p2m_host(dom,
+        grub_printf("pin_table(%lx) returned %d\n", xc_dom_p2m(dom,
                     dom->pgtables_seg.pfn), rc);
         errnum = ERR_BOOT_FAILURE;
         goto out_remap;
tools/libxc/include/xc_dom.h +2 -12
index a7d059a..ec9e293 100644
@@ -376,19 +376,9 @@ static inline void *xc_dom_vaddr_to_ptr(struct xc_dom_image *dom,
     return ptr + offset;
 }
 
-static inline xen_pfn_t xc_dom_p2m_host(struct xc_dom_image *dom, xen_pfn_t pfn)
+static inline xen_pfn_t xc_dom_p2m(struct xc_dom_image *dom, xen_pfn_t pfn)
 {
-    if (dom->shadow_enabled)
-        return pfn;
-    if (pfn < dom->rambase_pfn || pfn >= dom->rambase_pfn + dom->total_pages)
-        return INVALID_MFN;
-    return dom->p2m_host[pfn - dom->rambase_pfn];
-}
-
-static inline xen_pfn_t xc_dom_p2m_guest(struct xc_dom_image *dom,
-                                         xen_pfn_t pfn)
-{
-    if (xc_dom_feature_translated(dom))
+    if ( dom->shadow_enabled || xc_dom_feature_translated(dom) )
         return pfn;
     if (pfn < dom->rambase_pfn || pfn >= dom->rambase_pfn + dom->total_pages)
         return INVALID_MFN;
tools/libxc/xc_dom_boot.c +5 -5
index f82db2d..fda9e52 100644
@@ -54,7 +54,7 @@ static int setup_hypercall_page(struct xc_dom_image *dom)
                   dom->parms.virt_hypercall, pfn);
     domctl.cmd = XEN_DOMCTL_hypercall_init;
     domctl.domain = dom->guest_domid;
-    domctl.u.hypercall_init.gmfn = xc_dom_p2m_guest(dom, pfn);
+    domctl.u.hypercall_init.gmfn = xc_dom_p2m(dom, pfn);
     rc = do_domctl(dom->xch, &domctl);
     if ( rc != 0 )
         xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
@@ -84,7 +84,7 @@ static int clear_page(struct xc_dom_image *dom, xen_pfn_t pfn)
     if ( pfn == 0 )
         return 0;
 
-    dst = xc_dom_p2m_host(dom, pfn);
+    dst = xc_dom_p2m(dom, pfn);
     DOMPRINTF("%s: pfn 0x%" PRIpfn ", mfn 0x%" PRIpfn "",
               __FUNCTION__, pfn, dst);
     rc = xc_clear_domain_page(dom->xch, dom->guest_domid, dst);
@@ -178,7 +178,7 @@ void *xc_dom_boot_domU_map(struct xc_dom_image *dom, xen_pfn_t pfn,
     }
 
     for ( i = 0; i < count; i++ )
-        entries[i].mfn = xc_dom_p2m_host(dom, pfn + i);
+        entries[i].mfn = xc_dom_p2m(dom, pfn + i);
 
     ptr = xc_map_foreign_ranges(dom->xch, dom->guest_domid,
                 count << page_shift, PROT_READ | PROT_WRITE, 1 << page_shift,
@@ -435,8 +435,8 @@ int xc_dom_gnttab_init(struct xc_dom_image *dom)
                                       dom->console_domid, dom->xenstore_domid);
     } else {
         return xc_dom_gnttab_seed(dom->xch, dom->guest_domid,
-                                  xc_dom_p2m_host(dom, dom->console_pfn),
-                                  xc_dom_p2m_host(dom, dom->xenstore_pfn),
+                                  xc_dom_p2m(dom, dom->console_pfn),
+                                  xc_dom_p2m(dom, dom->xenstore_pfn),
                                   dom->console_domid, dom->xenstore_domid);
     }
 }
tools/libxc/xc_dom_compat_linux.c +2 -2
index 2c14a0f..acccde9 100644
@@ -65,8 +65,8 @@ static int xc_linux_build_internal(struct xc_dom_image *dom,
     if ( (rc = xc_dom_gnttab_init(dom)) != 0)
         goto out;
 
-    *console_mfn = xc_dom_p2m_host(dom, dom->console_pfn);
-    *store_mfn = xc_dom_p2m_host(dom, dom->xenstore_pfn);
+    *console_mfn = xc_dom_p2m(dom, dom->console_pfn);
+    *store_mfn = xc_dom_p2m(dom, dom->xenstore_pfn);
 
  out:
     return rc;
tools/libxc/xc_dom_x86.c +16 -16
index 920fe42..0d80c18 100644
@@ -248,7 +248,7 @@ static int setup_pgtables_x86_32_pae(struct xc_dom_image *dom)
     unsigned long l3off, l2off = 0, l1off;
     xen_vaddr_t addr;
     xen_pfn_t pgpfn;
-    xen_pfn_t l3mfn = xc_dom_p2m_guest(dom, l3pfn);
+    xen_pfn_t l3mfn = xc_dom_p2m(dom, l3pfn);
 
     if ( dom->parms.pae == 1 )
     {
@@ -280,7 +280,7 @@ static int setup_pgtables_x86_32_pae(struct xc_dom_image *dom)
                 goto pfn_error;
             l3off = l3_table_offset_pae(addr);
             l3tab[l3off] =
-                pfn_to_paddr(xc_dom_p2m_guest(dom, l2pfn)) | L3_PROT;
+                pfn_to_paddr(xc_dom_p2m(dom, l2pfn)) | L3_PROT;
             l2pfn++;
         }
 
@@ -292,7 +292,7 @@ static int setup_pgtables_x86_32_pae(struct xc_dom_image *dom)
                 goto pfn_error;
             l2off = l2_table_offset_pae(addr);
             l2tab[l2off] =
-                pfn_to_paddr(xc_dom_p2m_guest(dom, l1pfn)) | L2_PROT;
+                pfn_to_paddr(xc_dom_p2m(dom, l1pfn)) | L2_PROT;
             l1pfn++;
         }
 
@@ -300,7 +300,7 @@ static int setup_pgtables_x86_32_pae(struct xc_dom_image *dom)
         l1off = l1_table_offset_pae(addr);
         pgpfn = (addr - dom->parms.virt_base) >> PAGE_SHIFT_X86;
         l1tab[l1off] =
-            pfn_to_paddr(xc_dom_p2m_guest(dom, pgpfn)) | L1_PROT;
+            pfn_to_paddr(xc_dom_p2m(dom, pgpfn)) | L1_PROT;
         if ( (addr >= dom->pgtables_seg.vstart) &&
              (addr < dom->pgtables_seg.vend) )
             l1tab[l1off] &= ~_PAGE_RW; /* page tables are r/o */
@@ -316,7 +316,7 @@ static int setup_pgtables_x86_32_pae(struct xc_dom_image *dom)
     if ( dom->virt_pgtab_end <= 0xc0000000 )
     {
         DOMPRINTF("%s: PAE: extra l2 page table for l3#3", __FUNCTION__);
-        l3tab[3] = pfn_to_paddr(xc_dom_p2m_guest(dom, l2pfn)) | L3_PROT;
+        l3tab[3] = pfn_to_paddr(xc_dom_p2m(dom, l2pfn)) | L3_PROT;
     }
     return 0;
 
@@ -375,7 +375,7 @@ static int setup_pgtables_x86_64(struct xc_dom_image *dom)
                 goto pfn_error;
             l4off = l4_table_offset_x86_64(addr);
             l4tab[l4off] =
-                pfn_to_paddr(xc_dom_p2m_guest(dom, l3pfn)) | L4_PROT;
+                pfn_to_paddr(xc_dom_p2m(dom, l3pfn)) | L4_PROT;
             l3pfn++;
         }
 
@@ -387,7 +387,7 @@ static int setup_pgtables_x86_64(struct xc_dom_image *dom)
                 goto pfn_error;
             l3off = l3_table_offset_x86_64(addr);
             l3tab[l3off] =
-                pfn_to_paddr(xc_dom_p2m_guest(dom, l2pfn)) | L3_PROT;
+                pfn_to_paddr(xc_dom_p2m(dom, l2pfn)) | L3_PROT;
             l2pfn++;
         }
 
@@ -399,7 +399,7 @@ static int setup_pgtables_x86_64(struct xc_dom_image *dom)
                 goto pfn_error;
             l2off = l2_table_offset_x86_64(addr);
             l2tab[l2off] =
-                pfn_to_paddr(xc_dom_p2m_guest(dom, l1pfn)) | L2_PROT;
+                pfn_to_paddr(xc_dom_p2m(dom, l1pfn)) | L2_PROT;
             l1pfn++;
         }
 
@@ -407,7 +407,7 @@ static int setup_pgtables_x86_64(struct xc_dom_image *dom)
         l1off = l1_table_offset_x86_64(addr);
         pgpfn = (addr - dom->parms.virt_base) >> PAGE_SHIFT_X86;
         l1tab[l1off] =
-            pfn_to_paddr(xc_dom_p2m_guest(dom, pgpfn)) | L1_PROT;
+            pfn_to_paddr(xc_dom_p2m(dom, pgpfn)) | L1_PROT;
         if ( (!dom->pvh_enabled)                &&
              (addr >= dom->pgtables_seg.vstart) &&
              (addr < dom->pgtables_seg.vend) )
@@ -490,9 +490,9 @@ static int start_info_x86_32(struct xc_dom_image *dom)
     start_info->mfn_list = dom->p2m_seg.vstart;
 
     start_info->flags = dom->flags;
-    start_info->store_mfn = xc_dom_p2m_guest(dom, dom->xenstore_pfn);
+    start_info->store_mfn = xc_dom_p2m(dom, dom->xenstore_pfn);
     start_info->store_evtchn = dom->xenstore_evtchn;
-    start_info->console.domU.mfn = xc_dom_p2m_guest(dom, dom->console_pfn);
+    start_info->console.domU.mfn = xc_dom_p2m(dom, dom->console_pfn);
     start_info->console.domU.evtchn = dom->console_evtchn;
 
     if ( dom->ramdisk_blob )
@@ -536,9 +536,9 @@ static int start_info_x86_64(struct xc_dom_image *dom)
     start_info->mfn_list = dom->p2m_seg.vstart;
 
     start_info->flags = dom->flags;
-    start_info->store_mfn = xc_dom_p2m_guest(dom, dom->xenstore_pfn);
+    start_info->store_mfn = xc_dom_p2m(dom, dom->xenstore_pfn);
     start_info->store_evtchn = dom->xenstore_evtchn;
-    start_info->console.domU.mfn = xc_dom_p2m_guest(dom, dom->console_pfn);
+    start_info->console.domU.mfn = xc_dom_p2m(dom, dom->console_pfn);
     start_info->console.domU.evtchn = dom->console_evtchn;
 
     if ( dom->ramdisk_blob )
@@ -622,7 +622,7 @@ static int vcpu_x86_32(struct xc_dom_image *dom, void *ptr)
          dom->parms.pae == 3 /* bimodal */ )
         ctxt->vm_assist |= (1UL << VMASST_TYPE_pae_extended_cr3);
 
-    cr3_pfn = xc_dom_p2m_guest(dom, dom->pgtables_seg.pfn);
+    cr3_pfn = xc_dom_p2m(dom, dom->pgtables_seg.pfn);
     ctxt->ctrlreg[3] = xen_pfn_to_cr3_x86_32(cr3_pfn);
     DOMPRINTF("%s: cr3: pfn 0x%" PRIpfn " mfn 0x%" PRIpfn "",
               __FUNCTION__, dom->pgtables_seg.pfn, cr3_pfn);
@@ -648,7 +648,7 @@ static int vcpu_x86_64(struct xc_dom_image *dom, void *ptr)
     ctxt->user_regs.rflags = 1 << 9; /* Interrupt Enable */
 
     ctxt->flags = VGCF_in_kernel_X86_64 | VGCF_online_X86_64;
-    cr3_pfn = xc_dom_p2m_guest(dom, dom->pgtables_seg.pfn);
+    cr3_pfn = xc_dom_p2m(dom, dom->pgtables_seg.pfn);
     ctxt->ctrlreg[3] = xen_pfn_to_cr3_x86_64(cr3_pfn);
     DOMPRINTF("%s: cr3: pfn 0x%" PRIpfn " mfn 0x%" PRIpfn "",
               __FUNCTION__, dom->pgtables_seg.pfn, cr3_pfn);
@@ -1020,7 +1020,7 @@ int arch_setup_bootlate(struct xc_dom_image *dom)
         /* paravirtualized guest */
         xc_dom_unmap_one(dom, dom->pgtables_seg.pfn);
         rc = pin_table(dom->xch, pgd_type,
-                       xc_dom_p2m_host(dom, dom->pgtables_seg.pfn),
+                       xc_dom_p2m(dom, dom->pgtables_seg.pfn),
                        dom->guest_domid);
         if ( rc != 0 )
         {
tools/libxl/libxl_dom.c +2 -2
index 600393d..a970a8b 100644
@@ -745,8 +745,8 @@ int libxl__build_pv(libxl__gc *gc, uint32_t domid,
         state->console_mfn = dom->console_pfn;
         state->store_mfn = dom->xenstore_pfn;
     } else {
-        state->console_mfn = xc_dom_p2m_host(dom, dom->console_pfn);
-        state->store_mfn = xc_dom_p2m_host(dom, dom->xenstore_pfn);
+        state->console_mfn = xc_dom_p2m(dom, dom->console_pfn);
+        state->store_mfn = xc_dom_p2m(dom, dom->xenstore_pfn);
     }
 
     libxl__file_reference_unmap(&state->pv_kernel);
Signature · 7 lines
1.9.5 (Apple Git-50.3)


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

RFC PATCH 3/13 libxc: introduce the notion of a container type

In reply to Roger Pau Monne

Introduce the notion of a container type into xc_dom_image. This will be needed by later changes that will also use xc_dom_image in order to build HVM guests.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Elena Ufimtseva <[email protected]>
---
 tools/libxc/include/xc_dom.h | 6 ++++++
 tools/libxc/xc_dom_x86.c     | 4 ++++
 tools/libxl/libxl_dom.c      | 1 +
 3 files changed, 11 insertions(+)
tools/libxc/include/xc_dom.h +6 -0
index ec9e293..f7b5f0f 100644
@@ -180,6 +180,12 @@ struct xc_dom_image {
     struct xc_dom_arch *arch_hooks;
     /* allocate up to virt_alloc_end */
     int (*allocate) (struct xc_dom_image * dom, xen_vaddr_t up_to);
+
+    /* Container type (HVM or PV). */
+    enum {
+        XC_DOM_PV_CONTAINER,
+        XC_DOM_HVM_CONTAINER,
+    } container_type;
 };
 
 /* --- pluggable kernel loader ------------------------------------- */
tools/libxc/xc_dom_x86.c +4 -0
index 0d80c18..b89f5c2 100644
@@ -1071,6 +1071,10 @@ int arch_setup_bootlate(struct xc_dom_image *dom)
 
 int xc_dom_feature_translated(struct xc_dom_image *dom)
 {
+    /* Guests running inside HVM containers are always auto-translated. */
+    if ( dom->container_type == XC_DOM_HVM_CONTAINER )
+        return 1;
+
     return elf_xen_feature_get(XENFEAT_auto_translated_physmap, dom->f_active);
 }
 
tools/libxl/libxl_dom.c +1 -0
index a970a8b..8907bd6 100644
@@ -626,6 +626,7 @@ int libxl__build_pv(libxl__gc *gc, uint32_t domid,
     }
 
     dom->pvh_enabled = state->pvh_enabled;
+    dom->container_type = XC_DOM_PV_CONTAINER;
 
     LOG(DEBUG, "pv kernel mapped %d path %s", state->pv_kernel.mapped, state->pv_kernel.path);
 
Signature · 7 lines
1.9.5 (Apple Git-50.3)


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

RFC PATCH 4/13 libxc: allow arch_setup_meminit to populate HVM domain memory

In reply to Roger Pau Monne

Introduce a new arch_setup_meminit_hvm that's going to be used to populate HVM domain memory. Rename arch_setup_meminit to arch_setup_meminit_hvm_pv and introduce a stub arch_setup_meminit that will call the right meminit function depending on the contains type.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Elena Ufimtseva <[email protected]>

---
I think that both arch_setup_meminit_hvm and arch_setup_meminit_pv could be unified into a single meminit function. I have however not looked into it, and just created arch_setup_meminit_hvm based on the code in xc_hvm_populate_memory.

---
 tools/libxc/include/xc_dom.h |   8 +
 tools/libxc/xc_dom_x86.c     | 365 +++++++++++++++++++++++++++++++++++++++++--
 tools/libxl/libxl_dom.c      |   1 +
 3 files changed, 362 insertions(+), 12 deletions(-)
tools/libxc/include/xc_dom.h +8 -0
index f7b5f0f..051a7de 100644
@@ -186,6 +186,14 @@ struct xc_dom_image {
         XC_DOM_PV_CONTAINER,
         XC_DOM_HVM_CONTAINER,
     } container_type;
+
+    /* HVM specific fields. */
+    xen_pfn_t target_pages;
+    xen_pfn_t mmio_start;
+    xen_pfn_t mmio_size;
+    xen_pfn_t lowmem_end;
+    xen_pfn_t highmem_end;
+    int vga_hole;
 };
 
 /* --- pluggable kernel loader ------------------------------------- */
tools/libxc/xc_dom_x86.c +353 -12

424 lines not on this page · raw message

tools/libxl/libxl_dom.c +1 -0
index 8907bd6..6273052 100644
@@ -666,6 +666,7 @@ int libxl__build_pv(libxl__gc *gc, uint32_t domid,
     dom->xenstore_evtchn = state->store_port;
     dom->xenstore_domid = state->store_domid;
     dom->claim_enabled = libxl_defbool_val(info->claim_mode);
+    dom->vga_hole = 0;
 
     if (info->num_vnuma_nodes != 0) {
         unsigned int i;
Signature · 7 lines
1.9.5 (Apple Git-50.3)


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

Re: [PATCH RFC v1 04/13] libxc: allow arch_setup_meminit to populate HVM domain memory

Quoted 2 lines · Roger Pau Monne

Introduce a new arch_setup_meminit_hvm that's going to be used to populate HVM domain memory. Rename arch_setup_meminit to arch_setup_meminit_hvm_pv

arch_setup_meminit_hvm/pv

Quoted 29 lines

and introduce a stub arch_setup_meminit that will call the right meminit function depending on the contains type.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Elena Ufimtseva <[email protected]>

---
I think that both arch_setup_meminit_hvm and arch_setup_meminit_pv could be unified into a single meminit function. I have however not looked into it, and just created arch_setup_meminit_hvm based on the code in xc_hvm_populate_memory.

---
 tools/libxc/include/xc_dom.h |   8 +
 tools/libxc/xc_dom_x86.c     | 365 +++++++++++++++++++++++++++++++++++++++++--
 tools/libxl/libxl_dom.c      |   1 +
 3 files changed, 362 insertions(+), 12 deletions(-)
tools/libxc/include/xc_dom.h +0 -0
index f7b5f0f..051a7de 100644

tools/libxc/include/xc_dom.h struct xc_dom_image { · line 195

Quoted 10 lines
tools/libxc/include/xc_dom.h +7 -0
@@ -186,6 +186,14 @@ struct xc_dom_image {
         XC_DOM_PV_CONTAINER,
         XC_DOM_HVM_CONTAINER,
     } container_type;
+
+    /* HVM specific fields. */
+    xen_pfn_t target_pages;
+    xen_pfn_t mmio_start;
+    xen_pfn_t mmio_size;
+    xen_pfn_t lowmem_end;
+    xen_pfn_t highmem_end;

These fields are in xc_hvm_build_args. I think you can use that structure.

tools/libxc/include/xc_dom.h struct xc_dom_image { · line 196

Quoted 1 line
tools/libxc/include/xc_dom.h +1 -0
+    int vga_hole;

bool vga_hole.

Wei.

#6 lore raw

Re: [PATCH RFC v1 04/13] libxc: allow arch_setup_meminit to populate HVM domain memory

Quoted 40 lines · Wei Liu
Quoted 2 lines · Roger Pau Monne

Introduce a new arch_setup_meminit_hvm that's going to be used to populate HVM domain memory. Rename arch_setup_meminit to arch_setup_meminit_hvm_pv

arch_setup_meminit_hvm/pv

Quoted 34 lines

and introduce a stub arch_setup_meminit that will call the right meminit function depending on the contains type.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Elena Ufimtseva <[email protected]>

---
I think that both arch_setup_meminit_hvm and arch_setup_meminit_pv could be unified into a single meminit function. I have however not looked into it, and just created arch_setup_meminit_hvm based on the code in xc_hvm_populate_memory.

---
 tools/libxc/include/xc_dom.h |   8 +
 tools/libxc/xc_dom_x86.c     | 365 +++++++++++++++++++++++++++++++++++++++++--
 tools/libxl/libxl_dom.c      |   1 +
 3 files changed, 362 insertions(+), 12 deletions(-)
tools/libxc/include/xc_dom.h +2 -0
index f7b5f0f..051a7de 100644
@@ -186,6 +186,14 @@ struct xc_dom_image {
         XC_DOM_PV_CONTAINER,
         XC_DOM_HVM_CONTAINER,
     } container_type;
+
+    /* HVM specific fields. */
Quoted 8 lines

tools/libxc/include/xc_dom.h struct xc_dom_image { · line 195

Quoted 5 lines
tools/libxc/include/xc_dom.h +5 -0
+    xen_pfn_t target_pages;
+    xen_pfn_t mmio_start;
+    xen_pfn_t mmio_size;
+    xen_pfn_t lowmem_end;
+    xen_pfn_t highmem_end;

These fields are in xc_hvm_build_args. I think you can use that structure.

Never mind this. I see you delete that structure later.

Quoted 6 lines

tools/libxc/include/xc_dom.h struct xc_dom_image { · line 196

Quoted 2 lines
tools/libxc/include/xc_dom.h +1 -0
+    int vga_hole;

bool vga_hole.

Wei.

#7 lore raw

RFC PATCH 5/13 libxc: introduce a domain loader for HVM guest firmware

In reply to Roger Pau Monne

Introduce a very simple (and dummy) domain loader to be used to load the firmware (hvmloader) into HVM guests. Since hmvloader is just a 32bit elf executable the loader is fairly simple.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Elena Ufimtseva <[email protected]>
---
 tools/libxc/Makefile           |   1 +
 tools/libxc/include/xc_dom.h   |   7 +
 tools/libxc/xc_dom_hvmloader.c | 316 +++++++++++++++++++++++++++++++++++++++++
 xen/include/xen/libelf.h       |   1 +
 4 files changed, 325 insertions(+)
 create mode 100644 tools/libxc/xc_dom_hvmloader.c
tools/libxc/Makefile +1 -0
index 55782c8..7f860d7 100644
@@ -86,6 +86,7 @@ GUEST_SRCS-y                 += xc_dom_core.c xc_dom_boot.c
 GUEST_SRCS-y                 += xc_dom_elfloader.c
 GUEST_SRCS-$(CONFIG_X86)     += xc_dom_bzimageloader.c
 GUEST_SRCS-$(CONFIG_X86)     += xc_dom_decompress_lz4.c
+GUEST_SRCS-$(CONFIG_X86)     += xc_dom_hvmloader.c
 GUEST_SRCS-$(CONFIG_ARM)     += xc_dom_armzimageloader.c
 GUEST_SRCS-y                 += xc_dom_binloader.c
 GUEST_SRCS-y                 += xc_dom_compat_linux.c
tools/libxc/include/xc_dom.h +7 -0
index 051a7de..caeb1c8 100644
@@ -15,6 +15,7 @@
  */
 
 #include <xen/libelf/libelf.h>
+#include <xenguest.h>
 
 #define INVALID_P2M_ENTRY   ((xen_pfn_t)-1)
 
@@ -194,6 +195,12 @@ struct xc_dom_image {
     xen_pfn_t lowmem_end;
     xen_pfn_t highmem_end;
     int vga_hole;
+
+    /* Extra ACPI tables passed to HVMLOADER */
+    struct xc_hvm_firmware_module acpi_module;
+
+    /* Extra SMBIOS structures passed to HVMLOADER */
+    struct xc_hvm_firmware_module smbios_module;
 };
 
 /* --- pluggable kernel loader ------------------------------------- */
tools/libxc/xc_dom_hvmloader.c new file +316 -0

316 lines not on this page · raw message

xen/include/xen/libelf.h +1 -0
index 6393040..03d449e 100644
@@ -424,6 +424,7 @@ struct elf_dom_parms {
     uint64_t elf_paddr_offset;
     uint32_t f_supported[XENFEAT_NR_SUBMAPS];
     uint32_t f_required[XENFEAT_NR_SUBMAPS];
+    uint32_t phys_entry;
 
     /* calculated */
     uint64_t virt_offset;
Signature · 7 lines
1.9.5 (Apple Git-50.3)


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

Re: [PATCH RFC v1 05/13] libxc: introduce a domain loader for HVM guest firmware

Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 22.06.15 at 18:11, <[email protected]> wrote:

Introduce a very simple (and dummy) domain loader to be used to load the firmware (hvmloader) into HVM guests. Since hmvloader is just a 32bit elf executable the loader is fairly simple.

But hvmloader gets loaded fine today - why is this needed?

Jan

#9 lore raw

Re: [PATCH RFC v1 05/13] libxc: introduce a domain loader for HVM guest firmware

El 23/06/15 a les 11.29, Jan Beulich ha escrit:

Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 22.06.15 at 18:11, <[email protected]> wrote:

Introduce a very simple (and dummy) domain loader to be used to load the firmware (hvmloader) into HVM guests. Since hmvloader is just a 32bit elf executable the loader is fairly simple.

But hvmloader gets loaded fine today - why is this needed?

So that we can use the same set of xc_dom_* functions that we currently use on x86 to build PV guests, instead of the crappy setup_guest stub that we have in xc_hvm_build_x86.c.

As said in the cover letter, patches 1 to 7 aim at unifying the way HVM and PV guests are created on x86.

Roger.

#10 lore raw

Re: [PATCH RFC v1 05/13] libxc: introduce a domain loader for HVM guest firmware

In reply to Roger Pau Monne

. snip..

Quoted 1 line

+static elf_negerrnoval check_elf_kernel(struct xc_dom_image *dom, bool verbose)

why don't we want the verbose to be always true?

Quoted 44 lines
tools/libxc/xc_dom_hvmloader.c new file +44 -0
+{
+    if ( dom->kernel_blob == NULL )
+    {
+        if ( verbose )
+            xc_dom_panic(dom->xch,
+                         XC_INTERNAL_ERROR, "%s: no kernel image loaded",
+                         __FUNCTION__);
+        return -EINVAL;
+    }
+
+    if ( !elf_is_elfbinary(dom->kernel_blob, dom->kernel_size) )
+    {
+        if ( verbose )
+            xc_dom_panic(dom->xch,
+                         XC_INVALID_KERNEL, "%s: kernel is not an ELF image",
+                         __FUNCTION__);
+        return -EINVAL;
+    }
+    return 0;
+}
+
+static elf_negerrnoval xc_dom_probe_hvm_kernel(struct xc_dom_image *dom)
+{
+    struct elf_binary elf;
+    int rc;
+
+    /* This loader is designed for HVM guest firmware. */
+    if ( dom->container_type != XC_DOM_HVM_CONTAINER )
+        return -EINVAL;
+
+    rc = check_elf_kernel(dom, 0);
+    if ( rc != 0 )
+        return rc;
+
+    rc = elf_init(&elf, dom->kernel_blob, dom->kernel_size);
+    if ( rc != 0 )
+        return rc;
+
+    /*
+     * We need to check that there are no Xen ELFNOTES, or
+     * else we might be trying to load a PV kernel.
+     */
+    elf_parse_binary(&elf);
+    rc = elf_xen_parse(&elf, &dom->parms);

tools/libxc/xc_dom_hvmloader.c line 89

Quoted 10 lines
tools/libxc/xc_dom_hvmloader.c new file +10 -0
+    if ( rc == 0 )
+        return -EINVAL;
+
+    return 0;
+}
+
+static elf_errorstatus xc_dom_parse_hvm_kernel(struct xc_dom_image *dom)
+    /*
+     * This function sometimes returns -1 for error and sometimes
+     * an errno value.  ?!?!

The definition for this error type says:

include/xen/libelf.h:typedef int elf_negerrnoval; /* 0: ok; -EFOO: error */

so it should be -EXX thought that is at odd with the libxc API - which is -1 for errors and errno carries the bug. But that would require xc_dom_parse return value to be 'int', not elf_errorstatus.

#11 lore raw

RFC PATCH 6/13 libxc: introduce a xc_dom_arch for hvm-3.0-x86_32 guests

In reply to Roger Pau Monne

This xc_dom_arch will be used in order to build HVM domains. The code is based on the existing xc_hvm_populate_params function.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Elena Ufimtseva <[email protected]>

---
This is abusing the alloc_magic_pages hook in order to setup everything, which is not the best approach but it works. In later versions I would like to break alloc_magic_pages_hvm into smaller functions that can be used to populate the remaining hooks (start_info and shared_info).

---
 tools/libxc/xc_dom_x86.c | 183 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 183 insertions(+)
tools/libxc/xc_dom_x86.c +183 -0
index 8a1ef24..0d9ec42 100644
@@ -49,6 +49,20 @@
 
 #define VGA_HOLE_SIZE (0x20)
 
+#define SPECIALPAGE_PAGING   0
+#define SPECIALPAGE_ACCESS   1
+#define SPECIALPAGE_SHARING  2
+#define SPECIALPAGE_BUFIOREQ 3
+#define SPECIALPAGE_XENSTORE 4
+#define SPECIALPAGE_IOREQ    5
+#define SPECIALPAGE_IDENT_PT 6
+#define SPECIALPAGE_CONSOLE  7
+#define NR_SPECIAL_PAGES     8
+#define special_pfn(x) (0xff000u - NR_SPECIAL_PAGES + (x))
+
+#define NR_IOREQ_SERVER_PAGES 8
+#define ioreq_server_pfn(x) (special_pfn(0) - NR_IOREQ_SERVER_PAGES + (x))
+
 #define bits_to_mask(bits)       (((xen_vaddr_t)1 << (bits))-1)
 #define round_down(addr, mask)   ((addr) & ~(mask))
 #define round_up(addr, mask)     ((addr) | (mask))
@@ -467,6 +481,135 @@ static int alloc_magic_pages(struct xc_dom_image *dom)
     return 0;
 }
 
+static void build_hvm_info(void *hvm_info_page, struct xc_dom_image *dom)
+{
+    struct hvm_info_table *hvm_info = (struct hvm_info_table *)
+        (((unsigned char *)hvm_info_page) + HVM_INFO_OFFSET);
+    uint8_t sum;
+    int i;
+
+    memset(hvm_info_page, 0, PAGE_SIZE);
+
+    /* Fill in the header. */
+    strncpy(hvm_info->signature, "HVM INFO", 8);
+    hvm_info->length = sizeof(struct hvm_info_table);
+
+    /* Sensible defaults: these can be overridden by the caller. */
+    hvm_info->apic_mode = 1;
+    hvm_info->nr_vcpus = 1;
+    memset(hvm_info->vcpu_online, 0xff, sizeof(hvm_info->vcpu_online));
+
+    /* Memory parameters. */
+    hvm_info->low_mem_pgend = dom->lowmem_end >> PAGE_SHIFT;
+    hvm_info->high_mem_pgend = dom->highmem_end >> PAGE_SHIFT;
+    hvm_info->reserved_mem_pgstart = ioreq_server_pfn(0);
+
+    /* Finish with the checksum. */
+    for ( i = 0, sum = 0; i < hvm_info->length; i++ )
+        sum += ((uint8_t *)hvm_info)[i];
+    hvm_info->checksum = -sum;
+}
+
+static int alloc_magic_pages_hvm(struct xc_dom_image *dom)
+{
+    unsigned long i;
+    void *hvm_info_page;
+    uint32_t *ident_pt, domid = dom->guest_domid;
+    int rc;
+    xen_pfn_t special_array[NR_SPECIAL_PAGES];
+    xen_pfn_t ioreq_server_array[NR_IOREQ_SERVER_PAGES];
+    xc_interface *xch = dom->xch;
+
+    if ( (hvm_info_page = xc_map_foreign_range(
+              xch, domid, PAGE_SIZE, PROT_READ | PROT_WRITE,
+              HVM_INFO_PFN)) == NULL )
+        goto error_out;
+    build_hvm_info(hvm_info_page, dom);
+    munmap(hvm_info_page, PAGE_SIZE);
+
+    /* Allocate and clear special pages. */
+    for ( i = 0; i < NR_SPECIAL_PAGES; i++ )
+        special_array[i] = special_pfn(i);
+
+    rc = xc_domain_populate_physmap_exact(xch, domid, NR_SPECIAL_PAGES, 0, 0,
+                                          special_array);
+    if ( rc != 0 )
+    {
+        DOMPRINTF("Could not allocate special pages.");
+        goto error_out;
+    }
+
+    if ( xc_clear_domain_pages(xch, domid, special_pfn(0), NR_SPECIAL_PAGES) )
+            goto error_out;
+
+    xc_hvm_param_set(xch, domid, HVM_PARAM_STORE_PFN,
+                     special_pfn(SPECIALPAGE_XENSTORE));
+    xc_hvm_param_set(xch, domid, HVM_PARAM_BUFIOREQ_PFN,
+                     special_pfn(SPECIALPAGE_BUFIOREQ));
+    xc_hvm_param_set(xch, domid, HVM_PARAM_IOREQ_PFN,
+                     special_pfn(SPECIALPAGE_IOREQ));
+    xc_hvm_param_set(xch, domid, HVM_PARAM_CONSOLE_PFN,
+                     special_pfn(SPECIALPAGE_CONSOLE));
+    xc_hvm_param_set(xch, domid, HVM_PARAM_PAGING_RING_PFN,
+                     special_pfn(SPECIALPAGE_PAGING));
+    xc_hvm_param_set(xch, domid, HVM_PARAM_MONITOR_RING_PFN,
+                     special_pfn(SPECIALPAGE_ACCESS));
+    xc_hvm_param_set(xch, domid, HVM_PARAM_SHARING_RING_PFN,
+                     special_pfn(SPECIALPAGE_SHARING));
+
+    /*
+     * Allocate and clear additional ioreq server pages. The default
+     * server will use the IOREQ and BUFIOREQ special pages above.
+     */
+    for ( i = 0; i < NR_IOREQ_SERVER_PAGES; i++ )
+        ioreq_server_array[i] = ioreq_server_pfn(i);
+
+    rc = xc_domain_populate_physmap_exact(xch, domid, NR_IOREQ_SERVER_PAGES, 0,
+                                          0, ioreq_server_array);
+    if ( rc != 0 )
+    {
+        DOMPRINTF("Could not allocate ioreq server pages.");
+        goto error_out;
+    }
+
+    if ( xc_clear_domain_pages(xch, domid, ioreq_server_pfn(0),
+                               NR_IOREQ_SERVER_PAGES) )
+            goto error_out;
+
+    /* Tell the domain where the pages are and how many there are */
+    xc_hvm_param_set(xch, domid, HVM_PARAM_IOREQ_SERVER_PFN,
+                     ioreq_server_pfn(0));
+    xc_hvm_param_set(xch, domid, HVM_PARAM_NR_IOREQ_SERVER_PAGES,
+                     NR_IOREQ_SERVER_PAGES);
+
+    /*
+     * Identity-map page table is required for running with CR0.PG=0 when
+     * using Intel EPT. Create a 32-bit non-PAE page directory of superpages.
+     */
+    if ( (ident_pt = xc_map_foreign_range(
+              xch, domid, PAGE_SIZE, PROT_READ | PROT_WRITE,
+              special_pfn(SPECIALPAGE_IDENT_PT))) == NULL )
+        goto error_out;
+    for ( i = 0; i < PAGE_SIZE / sizeof(*ident_pt); i++ )
+        ident_pt[i] = ((i << 22) | _PAGE_PRESENT | _PAGE_RW | _PAGE_USER |
+                       _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_PSE);
+    munmap(ident_pt, PAGE_SIZE);
+    xc_hvm_param_set(xch, domid, HVM_PARAM_IDENT_PT,
+                     special_pfn(SPECIALPAGE_IDENT_PT) << PAGE_SHIFT);
+
+    dom->console_pfn = special_pfn(SPECIALPAGE_CONSOLE);
+    dom->xenstore_pfn = special_pfn(SPECIALPAGE_XENSTORE);
+    dom->parms.virt_hypercall = -1;
+
+    rc = 0;
+    goto out;
+ error_out:
+    rc = -1;
+ out:
+
+    return rc;
+}
+
 /* ------------------------------------------------------------------------ */
 
 static int start_info_x86_32(struct xc_dom_image *dom)
@@ -674,6 +817,28 @@ static int vcpu_x86_64(struct xc_dom_image *dom, void *ptr)
     return 0;
 }
 
+static int vcpu_hvm(struct xc_dom_image *dom, void *ptr)
+{
+    vcpu_guest_context_x86_64_t *ctxt = ptr;
+
+    DOMPRINTF_CALLED(dom->xch);
+
+    /* clear everything */
+    memset(ctxt, 0, sizeof(*ctxt));
+
+    ctxt->user_regs.ds = FLAT_KERNEL_DS_X86_32;
+    ctxt->user_regs.es = FLAT_KERNEL_DS_X86_32;
+    ctxt->user_regs.fs = FLAT_KERNEL_DS_X86_32;
+    ctxt->user_regs.gs = FLAT_KERNEL_DS_X86_32;
+    ctxt->user_regs.ss = FLAT_KERNEL_SS_X86_32;
+    ctxt->user_regs.cs = FLAT_KERNEL_CS_X86_32;
+    ctxt->user_regs.rip = dom->parms.phys_entry;
+
+    ctxt->flags = VGCF_in_kernel_X86_32 | VGCF_online_X86_32;
+
+    return 0;
+}
+
 /* ------------------------------------------------------------------------ */
 
 static struct xc_dom_arch xc_dom_32_pae = {
@@ -702,10 +867,24 @@ static struct xc_dom_arch xc_dom_64 = {
     .vcpu = vcpu_x86_64,
 };
 
+static struct xc_dom_arch xc_hvm_32 = {
+    .guest_type = "hvm-3.0-x86_32",
+    .native_protocol = XEN_IO_PROTO_ABI_X86_32,
+    .page_shift = PAGE_SHIFT_X86,
+    .sizeof_pfn = 4,
+    .alloc_magic_pages = alloc_magic_pages_hvm,
+    .count_pgtables = NULL,
+    .setup_pgtables = NULL,
+    .start_info = NULL,
+    .shared_info = NULL,
+    .vcpu = vcpu_hvm,
+};
+
 static void __init register_arch_hooks(void)
 {
     xc_dom_register_arch_hooks(&xc_dom_32_pae);
     xc_dom_register_arch_hooks(&xc_dom_64);
+    xc_dom_register_arch_hooks(&xc_hvm_32);
 }
 
 static int x86_compat(xc_interface *xch, domid_t domid, char *guest_type)
@@ -1352,6 +1531,10 @@ int arch_setup_bootlate(struct xc_dom_image *dom)
     xen_pfn_t shinfo;
     int i, rc;
 
+    if ( dom->container_type == XC_DOM_HVM_CONTAINER )
+        /* Nothing to do for HVM-type guests. */
+        return 0;
+
     for ( i = 0; i < ARRAY_SIZE(types); i++ )
         if ( !strcmp(types[i].guest, dom->guest_type) )
             pgd_type = types[i].pgd_type;
Signature · 7 lines
1.9.5 (Apple Git-50.3)


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

RFC PATCH 7/13 libxl: switch HVM domain building to use xc_dom_* helpers

In reply to Roger Pau Monne

Now that we have all the code in place HVM domain building in libxl can be switched to use the xc_dom_* family of functions, just like they are used in order to build PV guests.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Elena Ufimtseva <[email protected]>

---
TBH HVM building still avoids calling some xc_dom_* functions that are called in order to build PV guests. IMHO we should look into having the exact same flow in order to build PV or HVM domains, so libxl__build_pv and libxl__build_hvm can be unified into a single function.

---
 tools/libxl/libxl_dom.c      | 146 ++++++++++++++++++++++++++++---------------
 tools/libxl/libxl_internal.h |   2 +-
 tools/libxl/libxl_vnuma.c    |  12 ++--
 3 files changed, 105 insertions(+), 55 deletions(-)
tools/libxl/libxl_dom.c +97 -49
index 6273052..12ede26 100644
@@ -801,39 +801,39 @@ static int hvm_build_set_params(xc_interface *handle, uint32_t domid,
 
 static int hvm_build_set_xs_values(libxl__gc *gc,
                                    uint32_t domid,
-                                   struct xc_hvm_build_args *args)
+                                   struct xc_dom_image *dom)
 {
     char *path = NULL;
     int ret = 0;
 
-    if (args->smbios_module.guest_addr_out) {
+    if (dom->smbios_module.guest_addr_out) {
         path = GCSPRINTF("/local/domain/%d/"HVM_XS_SMBIOS_PT_ADDRESS, domid);
 
         ret = libxl__xs_write(gc, XBT_NULL, path, "0x%"PRIx64,
-                              args->smbios_module.guest_addr_out);
+                              dom->smbios_module.guest_addr_out);
         if (ret)
             goto err;
 
         path = GCSPRINTF("/local/domain/%d/"HVM_XS_SMBIOS_PT_LENGTH, domid);
 
         ret = libxl__xs_write(gc, XBT_NULL, path, "0x%x",
-                              args->smbios_module.length);
+                              dom->smbios_module.length);
         if (ret)
             goto err;
     }
 
-    if (args->acpi_module.guest_addr_out) {
+    if (dom->acpi_module.guest_addr_out) {
         path = GCSPRINTF("/local/domain/%d/"HVM_XS_ACPI_PT_ADDRESS, domid);
 
         ret = libxl__xs_write(gc, XBT_NULL, path, "0x%"PRIx64,
-                              args->acpi_module.guest_addr_out);
+                              dom->acpi_module.guest_addr_out);
         if (ret)
             goto err;
 
         path = GCSPRINTF("/local/domain/%d/"HVM_XS_ACPI_PT_LENGTH, domid);
 
         ret = libxl__xs_write(gc, XBT_NULL, path, "0x%x",
-                              args->acpi_module.length);
+                              dom->acpi_module.length);
         if (ret)
             goto err;
     }
@@ -847,7 +847,7 @@ err:
 
 static int libxl__domain_firmware(libxl__gc *gc,
                                   libxl_domain_build_info *info,
-                                  struct xc_hvm_build_args *args)
+                                  struct xc_dom_image *dom)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     const char *firmware;
@@ -873,8 +873,13 @@ static int libxl__domain_firmware(libxl__gc *gc,
             break;
         }
     }
-    args->image_file_name = libxl__abs_path(gc, firmware,
-                                            libxl__xenfirmwaredir_path());
+
+    rc = xc_dom_kernel_file(dom, libxl__abs_path(gc, firmware,
+                                                 libxl__xenfirmwaredir_path()));
+    if (rc != 0) {
+        LOGE(ERROR, "xc_dom_kernel_file failed");
+        goto out;
+    }
 
     if (info->u.hvm.smbios_firmware) {
         data = NULL;
@@ -888,8 +893,8 @@ static int libxl__domain_firmware(libxl__gc *gc,
         libxl__ptr_add(gc, data);
         if (datalen) {
             /* Only accept non-empty files */
-            args->smbios_module.data = data;
-            args->smbios_module.length = (uint32_t)datalen;
+            dom->smbios_module.data = data;
+            dom->smbios_module.length = (uint32_t)datalen;
         }
     }
 
@@ -905,8 +910,8 @@ static int libxl__domain_firmware(libxl__gc *gc,
         libxl__ptr_add(gc, data);
         if (datalen) {
             /* Only accept non-empty files */
-            args->acpi_module.data = data;
-            args->acpi_module.length = (uint32_t)datalen;
+            dom->acpi_module.data = data;
+            dom->acpi_module.length = (uint32_t)datalen;
         }
     }
 
@@ -920,50 +925,61 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
               libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
-    struct xc_hvm_build_args args = {};
     int ret, rc = ERROR_FAIL;
-    uint64_t mmio_start, lowmem_end, highmem_end;
+    uint64_t mmio_start, lowmem_end, highmem_end, mem_size;
+    struct xc_dom_image *dom = NULL;
+
+    xc_dom_loginit(ctx->xch);
+
+    dom = xc_dom_allocate(ctx->xch, NULL, NULL);
+    if (!dom) {
+        LOGE(ERROR, "xc_dom_allocate failed");
+        goto out;
+    }
+
+    dom->container_type = XC_DOM_HVM_CONTAINER;
 
-    memset(&args, 0, sizeof(struct xc_hvm_build_args));
     /* The params from the configuration file are in Mb, which are then
      * multiplied by 1 Kb. This was then divided off when calling
      * the old xc_hvm_build_target_mem() which then turned them to bytes.
      * Do all this in one step here...
      */
-    args.mem_size = (uint64_t)(info->max_memkb - info->video_memkb) << 10;
-    args.mem_target = (uint64_t)(info->target_memkb - info->video_memkb) << 10;
-    args.claim_enabled = libxl_defbool_val(info->claim_mode);
+    mem_size = (uint64_t)(info->max_memkb - info->video_memkb) << 10;
+    dom->target_pages = (uint64_t)(info->target_memkb - info->video_memkb) >> 2;
+    dom->claim_enabled = libxl_defbool_val(info->claim_mode);
     if (info->u.hvm.mmio_hole_memkb) {
         uint64_t max_ram_below_4g = (1ULL << 32) -
             (info->u.hvm.mmio_hole_memkb << 10);
 
         if (max_ram_below_4g < HVM_BELOW_4G_MMIO_START)
-            args.mmio_size = info->u.hvm.mmio_hole_memkb << 10;
+            dom->mmio_size = info->u.hvm.mmio_hole_memkb << 10;
     }
-    if (libxl__domain_firmware(gc, info, &args)) {
+    if (libxl__domain_firmware(gc, info, dom)) {
         LOG(ERROR, "initializing domain firmware failed");
         goto out;
     }
-    if (args.mem_target == 0)
-        args.mem_target = args.mem_size;
-    if (args.mmio_size == 0)
-        args.mmio_size = HVM_BELOW_4G_MMIO_LENGTH;
-    lowmem_end = args.mem_size;
+
+    if (dom->target_pages == 0)
+        dom->target_pages = mem_size >> XC_PAGE_SHIFT;
+    if (dom->mmio_size == 0)
+        dom->mmio_size = HVM_BELOW_4G_MMIO_LENGTH;
+    lowmem_end = mem_size;
     highmem_end = 0;
-    mmio_start = (1ull << 32) - args.mmio_size;
+    mmio_start = (1ull << 32) - dom->mmio_size;
     if (lowmem_end > mmio_start)
     {
         highmem_end = (1ull << 32) + (lowmem_end - mmio_start);
         lowmem_end = mmio_start;
     }
-    args.lowmem_end = lowmem_end;
-    args.highmem_end = highmem_end;
-    args.mmio_start = mmio_start;
+    dom->lowmem_end = lowmem_end;
+    dom->highmem_end = highmem_end;
+    dom->mmio_start = mmio_start;
+    dom->vga_hole = 1;
 
     if (info->num_vnuma_nodes != 0) {
         int i;
 
-        ret = libxl__vnuma_build_vmemrange_hvm(gc, domid, info, state, &args);
+        ret = libxl__vnuma_build_vmemrange_hvm(gc, domid, info, state, dom);
         if (ret) {
             LOGEV(ERROR, ret, "hvm build vmemranges failed");
             goto out;
@@ -973,27 +989,57 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
         ret = set_vnuma_info(gc, domid, info, state);
         if (ret) goto out;
 
-        args.nr_vmemranges = state->num_vmemranges;
-        args.vmemranges = libxl__malloc(gc, sizeof(*args.vmemranges) *
-                                        args.nr_vmemranges);
+        dom->nr_vmemranges = state->num_vmemranges;
+        dom->vmemranges = libxl__malloc(gc, sizeof(*dom->vmemranges) *
+                                        dom->nr_vmemranges);
 
-        for (i = 0; i < args.nr_vmemranges; i++) {
-            args.vmemranges[i].start = state->vmemranges[i].start;
-            args.vmemranges[i].end   = state->vmemranges[i].end;
-            args.vmemranges[i].flags = state->vmemranges[i].flags;
-            args.vmemranges[i].nid   = state->vmemranges[i].nid;
+        for (i = 0; i < dom->nr_vmemranges; i++) {
+            dom->vmemranges[i].start = state->vmemranges[i].start;
+            dom->vmemranges[i].end   = state->vmemranges[i].end;
+            dom->vmemranges[i].flags = state->vmemranges[i].flags;
+            dom->vmemranges[i].nid   = state->vmemranges[i].nid;
         }
 
-        args.nr_vnodes = info->num_vnuma_nodes;
-        args.vnode_to_pnode = libxl__malloc(gc, sizeof(*args.vnode_to_pnode) *
-                                            args.nr_vnodes);
-        for (i = 0; i < args.nr_vnodes; i++)
-            args.vnode_to_pnode[i] = info->vnuma_nodes[i].pnode;
+        dom->nr_vnodes = info->num_vnuma_nodes;
+        dom->vnode_to_pnode = libxl__malloc(gc, sizeof(*dom->vnode_to_pnode) *
+                                            dom->nr_vnodes);
+        for (i = 0; i < dom->nr_vnodes; i++)
+            dom->vnode_to_pnode[i] = info->vnuma_nodes[i].pnode;
+    }
+
+    rc = xc_dom_boot_xen_init(dom, ctx->xch, domid);
+    if (rc != 0) {
+        LOGE(ERROR, "xc_dom_boot_xen_init failed");
+        goto out;
     }
 
-    ret = xc_hvm_build(ctx->xch, domid, &args);
-    if (ret) {
-        LOGEV(ERROR, ret, "hvm building failed");
+    rc = xc_dom_parse_image(dom);
+    if (rc != 0) {
+        LOGE(ERROR, "xc_dom_parse_image failed");
+        goto out;
+    }
+
+    rc = xc_dom_mem_init(dom, mem_size / (1024 * 1024));
+    if (rc != 0) {
+        LOGE(ERROR, "xc_dom_mem_init failed");
+        goto out;
+    }
+
+    rc = xc_dom_boot_mem_init(dom);
+    if (rc != 0) {
+        LOGE(ERROR, "xc_dom_boot_mem_init failed");
+        goto out;
+    }
+
+    rc = xc_dom_build_image(dom);
+    if (rc != 0) {
+        LOGE(ERROR, "xc_dom_build_image failed");
+        goto out;
+    }
+
+    rc = xc_dom_boot_image(dom);
+    if (rc != 0) {
+        LOGE(ERROR, "xc_dom_boot_image failed");
         goto out;
     }
 
@@ -1006,14 +1052,16 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
         goto out;
     }
 
-    ret = hvm_build_set_xs_values(gc, domid, &args);
+    ret = hvm_build_set_xs_values(gc, domid, dom);
     if (ret) {
         LOG(ERROR, "hvm build set xenstore values failed (ret=%d)", ret);
         goto out;
     }
 
+    xc_dom_release(dom);
     return 0;
 out:
+    if (dom != NULL) xc_dom_release(dom);
     return rc;
 }
 
tools/libxl/libxl_internal.h +1 -1
index e96d6b5..71b3714 100644
@@ -3461,7 +3461,7 @@ int libxl__vnuma_build_vmemrange_hvm(libxl__gc *gc,
                                      uint32_t domid,
                                      libxl_domain_build_info *b_info,
                                      libxl__domain_build_state *state,
-                                     struct xc_hvm_build_args *args);
+                                     struct xc_dom_image *dom);
 bool libxl__vnuma_configured(const libxl_domain_build_info *b_info);
 
 _hidden int libxl__ms_vm_genid_set(libxl__gc *gc, uint32_t domid,
tools/libxl/libxl_vnuma.c +7 -5
index 56856d2..db22799 100644
@@ -17,6 +17,8 @@
 #include "libxl_arch.h"
 #include <stdlib.h>
 
+#include <xc_dom.h>
+
 bool libxl__vnuma_configured(const libxl_domain_build_info *b_info)
 {
     return b_info->num_vnuma_nodes != 0;
@@ -252,7 +254,7 @@ int libxl__vnuma_build_vmemrange_hvm(libxl__gc *gc,
                                      uint32_t domid,
                                      libxl_domain_build_info *b_info,
                                      libxl__domain_build_state *state,
-                                     struct xc_hvm_build_args *args)
+                                     struct xc_dom_image *dom)
 {
     uint64_t hole_start, hole_end, next;
     int nid, nr_vmemrange;
@@ -264,10 +266,10 @@ int libxl__vnuma_build_vmemrange_hvm(libxl__gc *gc,
      * Guest physical address space layout:
      * [0, hole_start) [hole_start, hole_end) [hole_end, highmem_end)
      */
-    hole_start = args->lowmem_end < args->mmio_start ?
-        args->lowmem_end : args->mmio_start;
-    hole_end = (args->mmio_start + args->mmio_size) > (1ULL << 32) ?
-        (args->mmio_start + args->mmio_size) : (1ULL << 32);
+    hole_start = dom->lowmem_end < dom->mmio_start ?
+        dom->lowmem_end : dom->mmio_start;
+    hole_end = (dom->mmio_start + dom->mmio_size) > (1ULL << 32) ?
+        (dom->mmio_start + dom->mmio_size) : (1ULL << 32);
 
     assert(state->vmemranges == NULL);
 
Signature · 7 lines
1.9.5 (Apple Git-50.3)


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

RFC PATCH 8/13 libxc: remove dead x86 HVM code

In reply to Roger Pau Monne

Remove xc_hvm_build_x86.c since xc_hvm_build is not longer used in order to create HVM guests.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Elena Ufimtseva <[email protected]>
---
 tools/libxc/Makefile              |   1 -
 tools/libxc/include/xenguest.h    |  44 ---
 tools/libxc/xc_hvm_build_x86.c    | 805 --------------------------------------
 tools/libxc/xg_private.c          |   9 -
 tools/python/xen/lowlevel/xc/xc.c |  81 ----
 5 files changed, 940 deletions(-)
 delete mode 100644 tools/libxc/xc_hvm_build_x86.c
tools/libxc/Makefile +0 -1
index 7f860d7..c738c46 100644
@@ -93,7 +93,6 @@ GUEST_SRCS-y                 += xc_dom_compat_linux.c
 
 GUEST_SRCS-$(CONFIG_X86)     += xc_dom_x86.c
 GUEST_SRCS-$(CONFIG_X86)     += xc_cpuid_x86.c
-GUEST_SRCS-$(CONFIG_X86)     += xc_hvm_build_x86.c
 GUEST_SRCS-$(CONFIG_ARM)     += xc_dom_arm.c
 GUEST_SRCS-$(CONFIG_ARM)     += xc_hvm_build_arm.c
 
tools/libxc/include/xenguest.h +0 -44

50 lines not on this page · raw message

tools/libxc/xc_hvm_build_x86.c deleted +0 -805

805 lines not on this page · raw message

tools/libxc/xg_private.c +0 -9
index c52cb44..98f33b2 100644
@@ -188,15 +188,6 @@ unsigned long csum_page(void *page)
     return sum ^ (sum>>32);
 }
 
-__attribute__((weak)) 
-    int xc_hvm_build(xc_interface *xch,
-                     uint32_t domid,
-                     struct xc_hvm_build_args *hvm_args)
-{
-    errno = ENOSYS;
-    return -1;
-}
-
 /*
  * Local variables:
  * mode: C
tools/python/xen/lowlevel/xc/xc.c +0 -81

93 lines not on this page · raw message

Signature · 7 lines
1.9.5 (Apple Git-50.3)


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

RFC PATCH 9/13 elfnotes: intorduce a new PHYS_ENTRY elfnote

In reply to Roger Pau Monne

This new elfnote contains the 32bit entry point into the kernel. Xen will use this entry point in order to launch the guest kernel in 32bit protected mode with paging disabled.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Elena Ufimtseva <[email protected]>
---
 tools/xcutils/readnotes.c          |  3 +++
 xen/common/libelf/libelf-dominfo.c |  4 ++++
 xen/include/public/elfnote.h       | 11 ++++++++++-
 3 files changed, 17 insertions(+), 1 deletion(-)
tools/xcutils/readnotes.c +3 -0
index 5fa445e..863ea5f 100644
@@ -159,6 +159,9 @@ static unsigned print_notes(struct elf_binary *elf, ELF_HANDLE_DECL(elf_note) st
 		case XEN_ELFNOTE_L1_MFN_VALID:
 			print_l1_mfn_valid_note("L1_MFN_VALID", elf , note);
 			break;
+		case XEN_ELFNOTE_PHYS_ENTRY:
+			print_numeric_note("PHYS_ENTRY", elf , note);
+			break;
 		default:
 			printf("unknown note type %#x\n",
 			       (unsigned)elf_uval(elf, note, type));
xen/common/libelf/libelf-dominfo.c +4 -0
index 0771323..ca0e327 100644
@@ -120,6 +120,7 @@ elf_errorstatus elf_xen_parse_note(struct elf_binary *elf,
         [XEN_ELFNOTE_BSD_SYMTAB] = { "BSD_SYMTAB", 1},
         [XEN_ELFNOTE_SUSPEND_CANCEL] = { "SUSPEND_CANCEL", 0 },
         [XEN_ELFNOTE_MOD_START_PFN] = { "MOD_START_PFN", 0 },
+        [XEN_ELFNOTE_PHYS_ENTRY] = { "PHYS_ENTRY", 0 },
     };
 /* *INDENT-ON* */
 
@@ -213,6 +214,9 @@ elf_errorstatus elf_xen_parse_note(struct elf_binary *elf,
                 elf, note, sizeof(*parms->f_supported), i);
         break;
 
+    case XEN_ELFNOTE_PHYS_ENTRY:
+        parms->phys_entry = val;
+        break;
     }
     return 0;
 }
xen/include/public/elfnote.h +10 -1
index 3824a94..b5232cd 100644
@@ -200,9 +200,18 @@
 #define XEN_ELFNOTE_SUPPORTED_FEATURES 17
 
 /*
+ * Physical entry point into the kernel.
+ *
+ * 32bit entry point into the kernel. Xen will use this entry point
+ * in order to launch the guest kernel in 32bit protected mode
+ * with paging disabled.
+ */
+#define XEN_ELFNOTE_PHYS_ENTRY 18
+
+/*
  * The number of the highest elfnote defined.
  */
-#define XEN_ELFNOTE_MAX XEN_ELFNOTE_SUPPORTED_FEATURES
+#define XEN_ELFNOTE_MAX XEN_ELFNOTE_PHYS_ENTRY
 
 /*
  * System information exported through crash notes.
Signature · 7 lines
1.9.5 (Apple Git-50.3)


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

Re: [PATCH RFC v1 09/13] elfnotes: intorduce a new PHYS_ENTRY elfnote

xen/common/libelf/libelf-dominfo.c elf_errorstatus elf_xen_parse_note(struct elf_binary *elf, · line 218

Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 22.06.15 at 18:11, <[email protected]> wrote:
xen/common/libelf/libelf-dominfo.c +2 -0
@@ -213,6 +214,9 @@ elf_errorstatus elf_xen_parse_note(struct elf_binary *elf,
                 elf, note, sizeof(*parms->f_supported), i);
         break;
 
+    case XEN_ELFNOTE_PHYS_ENTRY:
+        parms->phys_entry = val;

I don't think I've seen this field having got added in an earlier patch, and it's also not getting added here.

xen/include/public/elfnote.h line 209

Quoted 13 lines
xen/include/public/elfnote.h +7 -0
@@ -200,9 +200,18 @@
 #define XEN_ELFNOTE_SUPPORTED_FEATURES 17
 
 /*
+ * Physical entry point into the kernel.
+ *
+ * 32bit entry point into the kernel. Xen will use this entry point
+ * in order to launch the guest kernel in 32bit protected mode
+ * with paging disabled.
+ */
+#define XEN_ELFNOTE_PHYS_ENTRY 18

Perhaps XEN_ELFNOTE_PHYS_ENTRY32 or XEN_ELFNOTE_PHYS32_ENTRY then?

Jan

#16 lore raw

Re: [PATCH RFC v1 09/13] elfnotes: intorduce a new PHYS_ENTRY elfnote

El 23/06/15 a les 11.35, Jan Beulich ha escrit:

Quoted 10 lines

xen/common/libelf/libelf-dominfo.c elf_errorstatus elf_xen_parse_note(struct elf_binary *elf, · line 218

Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 22.06.15 at 18:11, <[email protected]> wrote:
xen/common/libelf/libelf-dominfo.c +2 -0
@@ -213,6 +214,9 @@ elf_errorstatus elf_xen_parse_note(struct elf_binary *elf,
                 elf, note, sizeof(*parms->f_supported), i);
         break;
 
+    case XEN_ELFNOTE_PHYS_ENTRY:
+        parms->phys_entry = val;

I don't think I've seen this field having got added in an earlier patch, and it's also not getting added here.

Yes, it's added in patch 5, because it's also used by the HVM-generic loader.

Quoted 5 lines
Quoted 5 lines
xen/include/public/elfnote.h +0 -0
@@ -200,9 +200,18 @@
 #define XEN_ELFNOTE_SUPPORTED_FEATURES 17
 
Quoted 11 lines

xen/include/public/elfnote.h line 209

Quoted 8 lines
xen/include/public/elfnote.h +7 -0
 /*
+ * Physical entry point into the kernel.
+ *
+ * 32bit entry point into the kernel. Xen will use this entry point
+ * in order to launch the guest kernel in 32bit protected mode
+ * with paging disabled.
+ */
+#define XEN_ELFNOTE_PHYS_ENTRY 18

Perhaps XEN_ELFNOTE_PHYS_ENTRY32 or XEN_ELFNOTE_PHYS32_ENTRY then?

That's fine, I don't mind changing it. Although AFAIK it's not possible to have a 64bit physical entry point (paging-disabled).

Roger.

#17 lore raw

Re: [PATCH RFC v1 09/13] elfnotes: intorduce a new PHYS_ENTRY elfnote

Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 23.06.15 at 11:40, <[email protected]> wrote:

El 23/06/15 a les 11.35, Jan Beulich ha escrit:

Quoted 2 lines

Review elf_errorstatus elf_xen_parse_note(struct elf_binary

Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 22.06.15 at 18:11, <[email protected]> wrote:
(quoted diff) +0 -0
@@ -213,6 +214,9 @@ elf_errorstatus elf_xen_parse_note(struct elf_binary 

*elf,

Quoted 3 lines
Quoted 3 lines
xen/common/libelf/libelf-dominfo.c +0 -0
                 elf, note, sizeof(*parms->f_supported), i);
         break;
 
Quoted 8 lines
Quoted 5 lines

xen/common/libelf/libelf-dominfo.c elf_errorstatus elf_xen_parse_note(struct elf_binary *elf, · line 218

Quoted 2 lines
xen/common/libelf/libelf-dominfo.c +2 -0
+    case XEN_ELFNOTE_PHYS_ENTRY:
+        parms->phys_entry = val;

I don't think I've seen this field having got added in an earlier patch, and it's also not getting added here.

Yes, it's added in patch 5, because it's also used by the HVM-generic loader.

So indeed missed it (being in an otherwise tools only patch). Sorry.

Quoted 17 lines
Quoted 5 lines
Quoted 5 lines
xen/include/public/elfnote.h +0 -0
@@ -200,9 +200,18 @@
 #define XEN_ELFNOTE_SUPPORTED_FEATURES 17
 
Quoted 11 lines

xen/include/public/elfnote.h line 209

Quoted 8 lines
xen/include/public/elfnote.h +7 -0
 /*
+ * Physical entry point into the kernel.
+ *
+ * 32bit entry point into the kernel. Xen will use this entry point
+ * in order to launch the guest kernel in 32bit protected mode
+ * with paging disabled.
+ */
+#define XEN_ELFNOTE_PHYS_ENTRY 18

Perhaps XEN_ELFNOTE_PHYS_ENTRY32 or XEN_ELFNOTE_PHYS32_ENTRY then?

Quoted 2 lines

That's fine, I don't mind changing it. Although AFAIK it's not possible to have a 64bit physical entry point (paging-disabled).

That depends on the perspective you take: Under UEFI the kernel would be entered in pseudo-physical (1:1 mapped virtual) mode. And that's certainly a model to at least keep in mind.

Jan

#18 lore raw

RFC PATCH 10/13 lib{xc/xl}: allow the creation of HVM domains with a kernel

In reply to Roger Pau Monne

Replace the firmware loaded into HVM guests with an OS kernel. Since the HVM builder now uses the PV xc_dom_* set of functions this kernel will be parsed and loaded inside the guest like on PV, but the container is a pure HVM guest.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Elena Ufimtseva <[email protected]>

---
Only xc_dom_elfloader has been switched in order to use hvm-3.0-x86_32, other loaders need to be adapted also.

---
 tools/libxc/xc_dom_elfloader.c |  4 ++++
 tools/libxl/libxl_dom.c        | 17 +++++++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)
tools/libxc/xc_dom_elfloader.c +4 -0
index 6ce1062..2f05015 100644
@@ -57,6 +57,10 @@ static char *xc_dom_guest_type(struct xc_dom_image *dom,
 {
     uint64_t machine = elf_uval(elf, elf->ehdr, e_machine);
 
+    if ( dom->container_type == XC_DOM_HVM_CONTAINER &&
+         dom->parms.phys_entry != UNSET_ADDR )
+        return "hvm-3.0-x86_32";
+
     switch ( machine )
     {
     case EM_386:
tools/libxl/libxl_dom.c +13 -4
index 12ede26..8ee14b9 100644
@@ -874,10 +874,20 @@ static int libxl__domain_firmware(libxl__gc *gc,
         }
     }
 
-    rc = xc_dom_kernel_file(dom, libxl__abs_path(gc, firmware,
+    if (info->kernel != NULL) {
+        /* Try to load a kernel instead of the firmware. */
+        rc = xc_dom_kernel_file(dom, info->kernel);
+        if (rc == 0 && info->ramdisk != NULL)
+            rc = xc_dom_ramdisk_file(dom, info->ramdisk);
+        dom->vga_hole = 0;
+    } else {
+        rc = xc_dom_kernel_file(dom, libxl__abs_path(gc, firmware,
                                                  libxl__xenfirmwaredir_path()));
+        dom->vga_hole = 1;
+    }
+
     if (rc != 0) {
-        LOGE(ERROR, "xc_dom_kernel_file failed");
+        LOGE(ERROR, "xc_dom_{kernel_file/ramdisk_file} failed");
         goto out;
     }
 
@@ -931,7 +941,7 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
 
     xc_dom_loginit(ctx->xch);
 
-    dom = xc_dom_allocate(ctx->xch, NULL, NULL);
+    dom = xc_dom_allocate(ctx->xch, info->cmdline, NULL);
     if (!dom) {
         LOGE(ERROR, "xc_dom_allocate failed");
         goto out;
@@ -974,7 +984,6 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
     dom->lowmem_end = lowmem_end;
     dom->highmem_end = highmem_end;
     dom->mmio_start = mmio_start;
-    dom->vga_hole = 1;
 
     if (info->num_vnuma_nodes != 0) {
         int i;
Signature · 7 lines
1.9.5 (Apple Git-50.3)


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

Re: [PATCH RFC v1 10/13] lib{xc/xl}: allow the creation of HVM domains with a kernel

I think the subject line should be changed a bit.

We already support HVM direct kernel boot with QEMU. Now you're implementing that without QEMU.

Wei.

#20 lore raw

RFC PATCH 11/13 xen/libxl: allow creating HVM guests without a device model

In reply to Roger Pau Monne

Intorduce a new device model version (NONE) that can be used to specify that no device model should be used. Propagate this to Xen by creating a new XEN_DOMCTL_CDF_noemu flag that disables some of the emulation done inside of Xen.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Elena Ufimtseva <[email protected]>

---
IMHO the XEN_DOMCTL_CDF_noemu flag should be expanded into multiple smaller flags that can be used to disable specific emulated devices, like the vlapic, vioapic, vhpet...

Also hvm_mmio_handlers should become domain specific in order to populate it with the usable handlers only.

---
 tools/libxl/libxl.c              |  7 +++----
 tools/libxl/libxl_create.c       | 16 ++++++++++++++++
 tools/libxl/libxl_dom.c          |  6 ++++++
 tools/libxl/libxl_types.idl      |  1 +
 tools/libxl/xl_cmdimpl.c         |  2 ++
 xen/arch/x86/domain.c            |  2 +-
 xen/arch/x86/hvm/hvm.c           | 14 +++++++++-----
 xen/arch/x86/hvm/intercept.c     |  6 ++++++
 xen/common/domctl.c              |  5 ++++-
 xen/include/asm-x86/hvm/domain.h |  1 +
 xen/include/asm-x86/hvm/hvm.h    |  2 +-
 xen/include/public/domctl.h      |  3 +++
 xen/include/xen/sched.h          |  4 ++++
 13 files changed, 57 insertions(+), 12 deletions(-)
tools/libxl/libxl.c +3 -4
index d86ea62..7c83486 100644
@@ -1587,11 +1587,10 @@ void libxl__destroy_domid(libxl__egc *egc, libxl__destroy_domid_state *dis)
 
     switch (libxl__domain_type(gc, domid)) {
     case LIBXL_DOMAIN_TYPE_HVM:
-        if (!libxl_get_stubdom_id(CTX, domid))
-            dm_present = 1;
-        else
+        if (libxl_get_stubdom_id(CTX, domid)) {
             dm_present = 0;
-        break;
+            break;
+        }
     case LIBXL_DOMAIN_TYPE_PV:
         pid = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "/local/domain/%d/image/device-model-pid", domid));
         dm_present = (pid != NULL);
tools/libxl/libxl_create.c +16 -0
index 86384d2..06cf02c 100644
@@ -164,6 +164,8 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
                 b_info->u.hvm.bios = LIBXL_BIOS_TYPE_ROMBIOS; break;
             case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
                 b_info->u.hvm.bios = LIBXL_BIOS_TYPE_SEABIOS; break;
+            case LIBXL_DEVICE_MODEL_VERSION_NONE:
+                break;
             default:return ERROR_INVAL;
             }
 
@@ -177,6 +179,8 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
             if (b_info->u.hvm.bios == LIBXL_BIOS_TYPE_ROMBIOS)
                 return ERROR_INVAL;
             break;
+        case LIBXL_DEVICE_MODEL_VERSION_NONE:
+            break;
         default:abort();
         }
 
@@ -278,6 +282,9 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
                 break;
             }
             break;
+        case LIBXL_DEVICE_MODEL_VERSION_NONE:
+            b_info->video_memkb = 0;
+            break;
         case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
         default:
             switch (b_info->u.hvm.vga.kind) {
@@ -535,6 +542,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
 
     /* convenience aliases */
     libxl_domain_create_info *info = &d_config->c_info;
+    libxl_domain_build_info *b_info = &d_config->b_info;
 
     assert(!libxl_domid_valid_guest(*domid));
 
@@ -549,6 +557,8 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
         flags |= XEN_DOMCTL_CDF_hvm_guest;
         flags |= libxl_defbool_val(info->hap) ? XEN_DOMCTL_CDF_hap : 0;
         flags |= libxl_defbool_val(info->oos) ? 0 : XEN_DOMCTL_CDF_oos_off;
+        if (b_info->device_model_version == LIBXL_DEVICE_MODEL_VERSION_NONE)
+            flags |= XEN_DOMCTL_CDF_noemu;
     } else if (libxl_defbool_val(info->pvh)) {
         flags |= XEN_DOMCTL_CDF_pvh_guest;
         if (!libxl_defbool_val(info->hap)) {
@@ -1293,6 +1303,12 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev,
         libxl__device_console_add(gc, domid, &console, state, &device);
         libxl__device_console_dispose(&console);
 
+        if (d_config->b_info.device_model_version ==
+            LIBXL_DEVICE_MODEL_VERSION_NONE) {
+            domcreate_devmodel_started(egc, &dcs->dmss.dm, 0);
+            return;
+        }
+
         libxl_device_vkb_init(&vkb);
         libxl__device_vkb_add(gc, domid, &vkb);
         libxl_device_vkb_dispose(&vkb);
tools/libxl/libxl_dom.c +6 -0
index 8ee14b9..d948546 100644
@@ -866,6 +866,12 @@ static int libxl__domain_firmware(libxl__gc *gc,
         case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
             firmware = "hvmloader";
             break;
+        case LIBXL_DEVICE_MODEL_VERSION_NONE:
+            if (info->kernel == NULL) {
+                LOG(ERROR, "no device model requested without a kernel");
+                return ERROR_FAIL;
+            }
+            break;
         default:
             LOG(ERROR, "invalid device model version %d",
                 info->device_model_version);
tools/libxl/libxl_types.idl +1 -0
index 23f27d4..0b75834 100644
@@ -83,6 +83,7 @@ libxl_device_model_version = Enumeration("device_model_version", [
     (0, "UNKNOWN"),
     (1, "QEMU_XEN_TRADITIONAL"), # Historical qemu-xen device model (qemu-dm)
     (2, "QEMU_XEN"),             # Upstream based qemu-xen device model
+    (3, "NONE"),                 # No device model
     ])
 
 libxl_console_type = Enumeration("console_type", [
tools/libxl/xl_cmdimpl.c +2 -0
index c858068..3d9b3d4 100644
@@ -2067,6 +2067,8 @@ skip_vfb:
         } else if (!strcmp(buf, "qemu-xen")) {
             b_info->device_model_version
                 = LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN;
+        } else if (!strcmp(buf, "none")) {
+            b_info->device_model_version = LIBXL_DEVICE_MODEL_VERSION_NONE;
         } else {
             fprintf(stderr,
                     "Unknown device_model_version \"%s\" specified\n", buf);
xen/arch/x86/domain.c +1 -1
index 0363650..bad0872 100644
@@ -610,7 +610,7 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags,
 
     if ( has_hvm_container_domain(d) )
     {
-        if ( (rc = hvm_domain_initialise(d)) != 0 )
+        if ( (rc = hvm_domain_initialise(d, domcr_flags)) != 0 )
         {
             iommu_domain_destroy(d);
             goto fail;
xen/arch/x86/hvm/hvm.c +9 -5
index d5e5242..7694c9e 100644
@@ -343,7 +343,7 @@ u64 hvm_get_guest_tsc_adjust(struct vcpu *v)
 void hvm_migrate_timers(struct vcpu *v)
 {
     /* PVH doesn't use rtc and emulated timers, it uses pvclock mechanism. */
-    if ( is_pvh_vcpu(v) )
+    if ( is_pvh_vcpu(v) || v->domain->arch.hvm_domain.no_emu )
         return;
 
     rtc_migrate_timers(v);
@@ -1423,7 +1423,7 @@ static int hvm_set_dm_domain(struct domain *d, domid_t domid)
     return rc;
 }
 
-int hvm_domain_initialise(struct domain *d)
+int hvm_domain_initialise(struct domain *d, unsigned int domcr_flags)
 {
     int rc;
 
@@ -1485,9 +1485,10 @@ int hvm_domain_initialise(struct domain *d)
     else
         d->arch.hvm_domain.io_bitmap = hvm_io_bitmap;
 
-    if ( is_pvh_domain(d) )
+    if ( is_pvh_domain(d) || domcr_flags & DOMCRF_noemu )
     {
         register_portio_handler(d, 0, 0x10003, handle_pvh_io);
+        d->arch.hvm_domain.no_emu = TRUE;
         return 0;
     }
 
@@ -1531,7 +1532,7 @@ int hvm_domain_initialise(struct domain *d)
 
 void hvm_domain_relinquish_resources(struct domain *d)
 {
-    if ( is_pvh_domain(d) )
+    if ( is_pvh_domain(d) || d->arch.hvm_domain.no_emu )
         return;
 
     if ( hvm_funcs.nhvm_domain_relinquish_resources )
@@ -1557,7 +1558,7 @@ void hvm_domain_destroy(struct domain *d)
 
     hvm_destroy_cacheattr_region_list(d);
 
-    if ( is_pvh_domain(d) )
+    if ( is_pvh_domain(d) || d->arch.hvm_domain.no_emu )
         return;
 
     hvm_funcs.domain_destroy(d);
@@ -2327,6 +2328,9 @@ int hvm_vcpu_initialise(struct vcpu *v)
         return 0;
     }
 
+    if ( d->arch.hvm_domain.no_emu )
+        return 0;
+
     rc = setup_compat_arg_xlat(v); /* teardown: free_compat_arg_xlat() */
     if ( rc != 0 )
         goto fail4;
xen/arch/x86/hvm/intercept.c +6 -0
index d52a48c..b7bc3c7 100644
@@ -168,6 +168,9 @@ bool_t hvm_mmio_internal(paddr_t gpa)
     struct vcpu *curr = current;
     unsigned int i;
 
+    if ( curr->domain->arch.hvm_domain.no_emu )
+        return 0;
+
     for ( i = 0; i < HVM_MMIO_HANDLER_NR; ++i )
         if ( hvm_mmio_handlers[i]->check_handler(curr, gpa) )
             return 1;
@@ -180,6 +183,9 @@ int hvm_mmio_intercept(ioreq_t *p)
     struct vcpu *v = current;
     int i;
 
+    if ( v->domain->arch.hvm_domain.no_emu )
+        return X86EMUL_UNHANDLEABLE;
+
     for ( i = 0; i < HVM_MMIO_HANDLER_NR; i++ )
     {
         hvm_mmio_check_t check_handler =
xen/common/domctl.c +4 -1
index ce517a7..1ce7ae0 100644
@@ -550,7 +550,8 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
                | XEN_DOMCTL_CDF_pvh_guest
                | XEN_DOMCTL_CDF_hap
                | XEN_DOMCTL_CDF_s3_integrity
-               | XEN_DOMCTL_CDF_oos_off)) )
+               | XEN_DOMCTL_CDF_oos_off
+               | XEN_DOMCTL_CDF_noemu)) )
             break;
 
         dom = op->domain;
@@ -592,6 +593,8 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
             domcr_flags |= DOMCRF_s3_integrity;
         if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_oos_off )
             domcr_flags |= DOMCRF_oos_off;
+        if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_noemu )
+            domcr_flags |= DOMCRF_noemu;
 
         d = domain_create(dom, domcr_flags, op->u.createdomain.ssidref,
                           &op->u.createdomain.config);
xen/include/asm-x86/hvm/domain.h +1 -0
index ad68fcf..948ced8 100644
@@ -135,6 +135,7 @@ struct hvm_domain {
     bool_t                 mem_sharing_enabled;
     bool_t                 qemu_mapcache_invalidate;
     bool_t                 is_s3_suspended;
+    bool_t                 no_emu;
 
     /*
      * TSC value that VCPUs use to calculate their tsc_offset value.
xen/include/asm-x86/hvm/hvm.h +1 -1
index 77eeac5..68c987a 100644
@@ -217,7 +217,7 @@ extern s8 hvm_port80_allowed;
 extern const struct hvm_function_table *start_svm(void);
 extern const struct hvm_function_table *start_vmx(void);
 
-int hvm_domain_initialise(struct domain *d);
+int hvm_domain_initialise(struct domain *d, unsigned int domcr_flags);
 void hvm_domain_relinquish_resources(struct domain *d);
 void hvm_domain_destroy(struct domain *d);
 
xen/include/public/domctl.h +3 -0
index bc45ea5..4e9d7e7 100644
@@ -63,6 +63,9 @@ struct xen_domctl_createdomain {
  /* Is this a PVH guest (as opposed to an HVM or PV guest)? */
 #define _XEN_DOMCTL_CDF_pvh_guest     4
 #define XEN_DOMCTL_CDF_pvh_guest      (1U<<_XEN_DOMCTL_CDF_pvh_guest)
+ /* Disable emulated devices */
+#define _XEN_DOMCTL_CDF_noemu         5
+#define XEN_DOMCTL_CDF_noemu          (1U<<_XEN_DOMCTL_CDF_noemu)
     uint32_t flags;
     struct xen_arch_domainconfig config;
 };
xen/include/xen/sched.h +4 -0
index 604d047..0aaff1e 100644
@@ -552,6 +552,10 @@ struct domain *domain_create(domid_t domid, unsigned int domcr_flags,
  /* DOMCRF_pvh: Create PV domain in HVM container. */
 #define _DOMCRF_pvh             5
 #define DOMCRF_pvh              (1U<<_DOMCRF_pvh)
+/* DOMCRF_noemu: Create a HVM domain without emulated devices. */
+/* XXX: Should be split into smaller flags that disable specific devices? */
+#define _DOMCRF_noemu           6
+#define DOMCRF_noemu            (1U<<_DOMCRF_noemu)
 
 /*
  * rcu_lock_domain_by_id() is more efficient than get_domain_by_id().
Signature · 7 lines
1.9.5 (Apple Git-50.3)


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

Re: [PATCH RFC v1 11/13] xen/libxl: allow creating HVM guests without a device model

xen/arch/x86/hvm/hvm.c u64 hvm_get_guest_tsc_adjust(struct vcpu *v) · line 346

Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 22.06.15 at 18:11, <[email protected]> wrote:
xen/arch/x86/hvm/hvm.c +1 -1
@@ -343,7 +343,7 @@ u64 hvm_get_guest_tsc_adjust(struct vcpu *v)
 void hvm_migrate_timers(struct vcpu *v)
 {
     /* PVH doesn't use rtc and emulated timers, it uses pvclock mechanism. */
-    if ( is_pvh_vcpu(v) )
+    if ( is_pvh_vcpu(v) || v->domain->arch.hvm_domain.no_emu )

Why would you need to keep the is-PVH check when you have ...

xen/arch/x86/hvm/hvm.c int hvm_domain_initialise(struct domain *d) · line 1491

Quoted 9 lines
xen/arch/x86/hvm/hvm.c +2 -1
@@ -1485,9 +1485,10 @@ int hvm_domain_initialise(struct domain *d)
     else
         d->arch.hvm_domain.io_bitmap = hvm_io_bitmap;
 
-    if ( is_pvh_domain(d) )
+    if ( is_pvh_domain(d) || domcr_flags & DOMCRF_noemu )
     {
         register_portio_handler(d, 0, 0x10003, handle_pvh_io);
+        d->arch.hvm_domain.no_emu = TRUE;

... this (which of course shouldn't use TRUE).

xen/arch/x86/hvm/hvm.c int hvm_vcpu_initialise(struct vcpu *v) · line 2334

Quoted 8 lines
xen/arch/x86/hvm/hvm.c +3 -0
@@ -2327,6 +2328,9 @@ int hvm_vcpu_initialise(struct vcpu *v)
         return 0;
     }
 
+    if ( d->arch.hvm_domain.no_emu )
+        return 0;
+
     rc = setup_compat_arg_xlat(v); /* teardown: free_compat_arg_xlat() */

How are you going to get away without an argument translation area?

Jan

#22 lore raw

RFC PATCH 12/13 xen: allow 64bit HVM guests to use XENMEM_memory_map

In reply to Roger Pau Monne

Enable this hypercall for 64bit HVM guests in order to fetch the e820 memory map in the absence of an emulated BIOS. The memory map is populated and notified to Xen in arch_setup_meminit_hvm.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Elena Ufimtseva <[email protected]>

---
I see no reason to not enable it for 32bit HVM guests, but let's leave that for later.

---
 tools/libxc/xc_dom_x86.c | 29 ++++++++++++++++++++++++++++-
 xen/arch/x86/hvm/hvm.c   |  1 -
 xen/arch/x86/mm.c        |  6 ------
 3 files changed, 28 insertions(+), 8 deletions(-)
tools/libxc/xc_dom_x86.c +28 -1
index 0d9ec42..3a57ded 100644
@@ -1154,6 +1154,7 @@ static int check_mmio_hole(uint64_t start, uint64_t memsize,
         return 1;
 }
 
+#define MAX_E820_ENTRIES    128
 static int arch_setup_meminit_hvm(struct xc_dom_image *dom)
 {
     unsigned long i, vmemid, nr_pages = dom->total_pages;
@@ -1174,6 +1175,8 @@ static int arch_setup_meminit_hvm(struct xc_dom_image *dom)
     unsigned int nr_vmemranges, nr_vnodes;
     xc_interface *xch = dom->xch;
     uint32_t domid = dom->guest_domid;
+    struct e820entry entries[MAX_E820_ENTRIES];
+    int e820_index = 0;
 
     if ( nr_pages > target_pages )
         memflags |= XENMEMF_populate_on_demand;
@@ -1224,6 +1227,13 @@ static int arch_setup_meminit_hvm(struct xc_dom_image *dom)
         vnode_to_pnode = dom->vnode_to_pnode;
     }
 
+    /* Add one additional memeory range to account for the VGA hole */
+    if ( (nr_vmemranges + (dom->vga_hole ? 1 : 0)) > MAX_E820_ENTRIES )
+    {
+        DOMPRINTF("Too many memory ranges");
+        goto error_out;
+    }
+
     total_pages = 0;
     p2m_size = 0;
     for ( i = 0; i < nr_vmemranges; i++ )
@@ -1313,9 +1323,13 @@ static int arch_setup_meminit_hvm(struct xc_dom_image *dom)
      * Under 2MB mode, we allocate pages in batches of no more than 8MB to 
      * ensure that we can be preempted and hence dom0 remains responsive.
      */
-    if ( dom->vga_hole )
+    if ( dom->vga_hole ) {
         rc = xc_domain_populate_physmap_exact(
             xch, domid, 0xa0, 0, memflags, &dom->p2m_host[0x00]);
+        entries[e820_index].addr = 0;
+        entries[e820_index].size = 0xa0 << PAGE_SHIFT;
+        entries[e820_index++].type = E820_RAM;
+    }
 
     stat_normal_pages = 0;
     for ( vmemid = 0; vmemid < nr_vmemranges; vmemid++ )
@@ -1342,6 +1356,12 @@ static int arch_setup_meminit_hvm(struct xc_dom_image *dom)
         else
             cur_pages = vmemranges[vmemid].start >> PAGE_SHIFT;
 
+                /* Build an e820 map. */
+        entries[e820_index].addr = cur_pages << PAGE_SHIFT;
+        entries[e820_index].size = vmemranges[vmemid].end -
+                                   entries[e820_index].addr;
+        entries[e820_index++].type = E820_RAM;
+
         while ( (rc == 0) && (end_pages > cur_pages) )
         {
             /* Clip count to maximum 1GB extent. */
@@ -1459,6 +1479,13 @@ static int arch_setup_meminit_hvm(struct xc_dom_image *dom)
     DPRINTF("  2MB PAGES: 0x%016lx\n", stat_2mb_pages);
     DPRINTF("  1GB PAGES: 0x%016lx\n", stat_1gb_pages);
 
+    rc = xc_domain_set_memory_map(xch, domid, entries, e820_index);
+    if ( rc != 0 )
+    {
+        DOMPRINTF("unable to set memory map.");
+        goto error_out;
+    }
+
     rc = 0;
     goto out;
  error_out:
xen/arch/x86/hvm/hvm.c +0 -1
index 7694c9e..98109e2 100644
@@ -4749,7 +4749,6 @@ static long hvm_memory_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
     switch ( cmd & MEMOP_CMD_MASK )
     {
-    case XENMEM_memory_map:
     case XENMEM_machine_memory_map:
     case XENMEM_machphys_mapping:
         return -ENOSYS;
xen/arch/x86/mm.c +0 -6
index 9e08c9b..fcb8682 100644
@@ -4717,12 +4717,6 @@ long arch_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
             return rc;
         }
 
-        if ( is_hvm_domain(d) )
-        {
-            rcu_unlock_domain(d);
-            return -EPERM;
-        }
-
         e820 = xmalloc_array(e820entry_t, fmap.map.nr_entries);
         if ( e820 == NULL )
         {
Signature · 7 lines
1.9.5 (Apple Git-50.3)


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

Re: [PATCH RFC v1 12/13] xen: allow 64bit HVM guests to use XENMEM_memory_map

Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 22.06.15 at 18:11, <[email protected]> wrote:

Enable this hypercall for 64bit HVM guests in order to fetch the e820 memory map in the absence of an emulated BIOS. The memory map is populated and notified to Xen in arch_setup_meminit_hvm.

I see no reason why this should be limited to 64-bit guests.

Jan

#24 lore raw

RFC PATCH 13/13 xenconsole: try to attach to PV console if HVM fails

In reply to Roger Pau Monne

HVM guests have always used the emulated serial console by default, but if the emulated serial pty cannot be fetched from xenstore try to use the PV console instead.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Elena Ufimtseva <[email protected]>
---
 tools/console/client/main.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
tools/console/client/main.c +8 -3
index f4c783b..c92553e 100644
@@ -279,7 +279,7 @@ int main(int argc, char **argv)
 		{ 0 },
 
 	};
-	char *dom_path = NULL, *path = NULL;
+	char *dom_path = NULL, *path = NULL, *test = NULL;
 	int spty, xsfd;
 	struct xs_handle *xs;
 	char *end;
@@ -357,9 +357,14 @@ int main(int argc, char **argv)
 	path = malloc(strlen(dom_path) + strlen("/device/console/0/tty") + 5);
 	if (path == NULL)
 		err(ENOMEM, "malloc");
-	if (type == CONSOLE_SERIAL)
+	if (type == CONSOLE_SERIAL) {
 		snprintf(path, strlen(dom_path) + strlen("/serial/0/tty") + 5, "%s/serial/%d/tty", dom_path, num);
-	else {
+		test = xs_read(xs, XBT_NULL, path, NULL);
+		free(test);
+		if (test == NULL)
+			goto pv_console;
+	} else {
+pv_console:
 		if (num == 0)
 			snprintf(path, strlen(dom_path) + strlen("/console/tty") + 1, "%s/console/tty", dom_path);
 		else
Signature · 7 lines
1.9.5 (Apple Git-50.3)


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#25 lore raw
In reply to Roger Pau Monne

Hi Roger,

given that this patch series is actually using the Xen "hvm" builder, I take that all the PVH code paths in Xen or the guest kernel are not actually used, correct? This is more like PV on HVM without QEMU, right?

Do you think think this can work for Dom0 too?

Would that make all the PVH stuff in Xen and Linux effectively useless?

Thanks,

Stefano

Quoted 64 lines · Roger Pau Monne

Before reading any further, keep in mind this is a VERY inital RFC prototype series. Many things are not finished, and those that are done make heavy use of duck tape in order to keep things into place.

Now that you are warned, this series is split in the following order:

- Patches from 1 to 7 switch HVM domain contruction to use the xc_dom_* family of functions, like they are used to build PV domains.
- Patches from 8 to 13 introduce the creation of HVM domains without firmware, which is replaced by directly loading a kernel like it's done for PV guests. A new boot ABI based on the discussion in the thread "RFC:
making the PVH 64bit ABI as stable" is also introduced, although it's not finished.

Some things that are missing from the new boot ABI:

- Although it supports loading a ramdisk, there's still now defined way into how to pass this ramdisk to the guest. I'm thinking of using a HVMPARAM or simply setting a GP register to contain the address of the ramdisk. Ideally I would like to support loading more than one ramdisk.

Some patches contain comments after the SoB, which in general describe the shortcommings of the implementation. The aim of those is to initiate discussion about whether the aproach taken is TRTTD.

I've only tested this on Intel hw, but I see no reason why it shouldn't work on AMD. I've managed to boot FreeBSD up to the point were it should jump into user-space (I just didn't have a VBD attached to the VM so it just sits waiting for a valid disk). I have not tried to boot it any further since I think that's fine for the purpose of this series.

The series can also be found in the following git repo:

git://xenbits.xen.org/people/royger/xen.git branch hvm_without_dm_v1

And for the FreeBSD part:

git://xenbits.xen.org/people/royger/freebsd.git branch new_entry_point_v1

In case someone wants to give it a try, I've uploaded a FreeBSD kernel that should work when booted into this mode:

https://people.freebsd.org/~royger/kernel_no_dm

The config file that I've used is:

<config>
kernel="/path/to/kernel_no_dm"

builder="hvm"
device_model_version="none"

memory=128
vcpus=1
name = "freebsd"
</config>

Thanks, Roger.

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

#26 lore raw
Quoted 5 lines · Stefano Stabellini

Hi Roger,

given that this patch series is actually using the Xen "hvm" builder, I take that all the PVH code paths in Xen or the guest kernel are not actually used, correct? This is more like PV on HVM without QEMU, right?

Are you saying it should be called now 'HVM-diet' ? Or 'HVMlite' instead of PVH since it is looking at this from the HVM perspective instead of PVH?

Quoted 4 lines

Do you think think this can work for Dom0 too?

Would that make all the PVH stuff in Xen and Linux effectively useless?

No. The AP bootup is still the same. So would all the hypercalls I think.

Quoted 70 lines

Thanks,

Stefano

Quoted 64 lines · Roger Pau Monne

Before reading any further, keep in mind this is a VERY inital RFC prototype series. Many things are not finished, and those that are done make heavy use of duck tape in order to keep things into place.

Now that you are warned, this series is split in the following order:

- Patches from 1 to 7 switch HVM domain contruction to use the xc_dom_* family of functions, like they are used to build PV domains.
- Patches from 8 to 13 introduce the creation of HVM domains without firmware, which is replaced by directly loading a kernel like it's done for PV guests. A new boot ABI based on the discussion in the thread "RFC:
making the PVH 64bit ABI as stable" is also introduced, although it's not finished.

Some things that are missing from the new boot ABI:

- Although it supports loading a ramdisk, there's still now defined way into how to pass this ramdisk to the guest. I'm thinking of using a HVMPARAM or simply setting a GP register to contain the address of the ramdisk. Ideally I would like to support loading more than one ramdisk.

Some patches contain comments after the SoB, which in general describe the shortcommings of the implementation. The aim of those is to initiate discussion about whether the aproach taken is TRTTD.

I've only tested this on Intel hw, but I see no reason why it shouldn't work on AMD. I've managed to boot FreeBSD up to the point were it should jump into user-space (I just didn't have a VBD attached to the VM so it just sits waiting for a valid disk). I have not tried to boot it any further since I think that's fine for the purpose of this series.

The series can also be found in the following git repo:

git://xenbits.xen.org/people/royger/xen.git branch hvm_without_dm_v1

And for the FreeBSD part:

git://xenbits.xen.org/people/royger/freebsd.git branch new_entry_point_v1

In case someone wants to give it a try, I've uploaded a FreeBSD kernel that should work when booted into this mode:

https://people.freebsd.org/~royger/kernel_no_dm

The config file that I've used is:

<config>
kernel="/path/to/kernel_no_dm"

builder="hvm"
device_model_version="none"

memory=128
vcpus=1
name = "freebsd"
</config>

Thanks, Roger.

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

#27 lore raw

El 22/06/15 a les 20.05, Konrad Rzeszutek Wilk ha escrit:

Quoted 12 lines · Stefano Stabellini
Quoted 5 lines

Hi Roger,

given that this patch series is actually using the Xen "hvm" builder, I take that all the PVH code paths in Xen or the guest kernel are not actually used, correct? This is more like PV on HVM without QEMU, right?

Are you saying it should be called now 'HVM-diet' ? Or 'HVMlite' instead of PVH since it is looking at this from the HVM perspective instead of PVH?

Quoted 1 line
Quoted 5 lines
Quoted 3 lines

Do you think think this can work for Dom0 too?

Would that make all the PVH stuff in Xen and Linux effectively useless?

No. The AP bootup is still the same. So would all the hypercalls I think.

This is something that we have not discussed, but for HVM domains the vCPU initialize hypercall only allows starting the vCPU in 32bit mode with paging disabled (just like how we are starting the BSP). I'm fine with that and I don't mind implementing a small trampoline for APs also, but would like to hear opinions about it.

Roger.

#28 lore raw
In reply to Konrad Rzeszutek Wilk
Quoted 9 lines · Konrad Rzeszutek Wilk
Quoted 5 lines · Stefano Stabellini

Hi Roger,

given that this patch series is actually using the Xen "hvm" builder, I take that all the PVH code paths in Xen or the guest kernel are not actually used, correct? This is more like PV on HVM without QEMU, right?

Are you saying it should be called now 'HVM-diet' ? Or 'HVMlite' instead of PVH since it is looking at this from the HVM perspective instead of PVH?

HVMlite doesn't sound bad :-)

I don't know if we should introduce a new name for this, but I wanted to point out that this is different from PVH from Xen point of view. In particular most of the outstanding PVH work items (32bit, AMD) on the hypervisor would be redudant if we get this to work, right? If that is the case, then I think it is best we agree on which road we want to take going forward as soon as possible to avoid duplicated or wasted efforts.

In fact it is not clear to me if/when we get this to work, what would be the remaining open issues to complete "HVMlite". Roger?

Quoted 76 lines
Quoted 3 lines

Do you think think this can work for Dom0 too?

Would that make all the PVH stuff in Xen and Linux effectively useless?

No. The AP bootup is still the same. So would all the hypercalls I think.

Quoted 70 lines

Thanks,

Stefano

Quoted 64 lines · Roger Pau Monne

Before reading any further, keep in mind this is a VERY inital RFC prototype series. Many things are not finished, and those that are done make heavy use of duck tape in order to keep things into place.

Now that you are warned, this series is split in the following order:

- Patches from 1 to 7 switch HVM domain contruction to use the xc_dom_* family of functions, like they are used to build PV domains.
- Patches from 8 to 13 introduce the creation of HVM domains without firmware, which is replaced by directly loading a kernel like it's done for PV guests. A new boot ABI based on the discussion in the thread "RFC:
making the PVH 64bit ABI as stable" is also introduced, although it's not finished.

Some things that are missing from the new boot ABI:

- Although it supports loading a ramdisk, there's still now defined way into how to pass this ramdisk to the guest. I'm thinking of using a HVMPARAM or simply setting a GP register to contain the address of the ramdisk. Ideally I would like to support loading more than one ramdisk.

Some patches contain comments after the SoB, which in general describe the shortcommings of the implementation. The aim of those is to initiate discussion about whether the aproach taken is TRTTD.

I've only tested this on Intel hw, but I see no reason why it shouldn't work on AMD. I've managed to boot FreeBSD up to the point were it should jump into user-space (I just didn't have a VBD attached to the VM so it just sits waiting for a valid disk). I have not tried to boot it any further since I think that's fine for the purpose of this series.

The series can also be found in the following git repo:

git://xenbits.xen.org/people/royger/xen.git branch hvm_without_dm_v1

And for the FreeBSD part:

git://xenbits.xen.org/people/royger/freebsd.git branch new_entry_point_v1

In case someone wants to give it a try, I've uploaded a FreeBSD kernel that should work when booted into this mode:

https://people.freebsd.org/~royger/kernel_no_dm

The config file that I've used is:

<config>
kernel="/path/to/kernel_no_dm"

builder="hvm"
device_model_version="none"

memory=128
vcpus=1
name = "freebsd"
</config>

Thanks, Roger.

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

#29 lore raw
Quoted 6 lines · Stefano Stabellini

I don't know if we should introduce a new name for this, but I wanted to point out that this is different from PVH from Xen point of view. In particular most of the outstanding PVH work items (32bit, AMD) on the hypervisor would be redudant if we get this to work, right? If that is the case, then I think it is best we agree on which road we want to take going forward as soon as possible to avoid duplicated or wasted efforts.

I think what you are saying is we either want to pursue this path _or_ PVH, but not both, and I would be inclined to agree, it seems to me like duplication of both effort and functionality to do both.

Ian.

#30 lore raw
Quoted 11 lines · Ian Campbell
Quoted 6 lines · Stefano Stabellini

I don't know if we should introduce a new name for this, but I wanted to point out that this is different from PVH from Xen point of view. In particular most of the outstanding PVH work items (32bit, AMD) on the hypervisor would be redudant if we get this to work, right? If that is the case, then I think it is best we agree on which road we want to take going forward as soon as possible to avoid duplicated or wasted efforts.

I think what you are saying is we either want to pursue this path _or_ PVH, but not both, and I would be inclined to agree, it seems to me like duplication of both effort and functionality to do both.

Right, especially given that they both seem to provide similar functionalities.

#31 lore raw
Quoted 8 lines · Stefano Stabellini
Quoted 7 lines · Ian Campbell
Quoted 6 lines · Stefano Stabellini

I don't know if we should introduce a new name for this, but I wanted to point out that this is different from PVH from Xen point of view. In particular most of the outstanding PVH work items (32bit, AMD) on the hypervisor would be redudant if we get this to work, right? If that is the case, then I think it is best we agree on which road we want to take going forward as soon as possible to avoid duplicated or wasted efforts.

Quoted 5 lines
Quoted 3 lines

I think what you are saying is we either want to pursue this path _or_ PVH, but not both, and I would be inclined to agree, it seems to me like duplication of both effort and functionality to do both.

Right, especially given that they both seem to provide similar functionalities.

Given that 32-bit support of existing PVH model looks pretty simple and required AMD changes are also well understood (right?) and do not appear particularly invasive I would argue for finishing those two while continuing to work on unified boot model.

-boris

#32 lore raw
In reply to Stefano Stabellini

El 23/06/15 a les 12.55, Stefano Stabellini ha escrit:

Quoted 20 lines · Konrad Rzeszutek Wilk
Quoted 9 lines · Stefano Stabellini
Quoted 5 lines

Hi Roger,

given that this patch series is actually using the Xen "hvm" builder, I take that all the PVH code paths in Xen or the guest kernel are not actually used, correct? This is more like PV on HVM without QEMU, right?

Are you saying it should be called now 'HVM-diet' ? Or 'HVMlite' instead of PVH since it is looking at this from the HVM perspective instead of PVH?

HVMlite doesn't sound bad :-)

I don't know if we should introduce a new name for this, but I wanted to point out that this is different from PVH from Xen point of view. In particular most of the outstanding PVH work items (32bit, AMD) on the hypervisor would be redudant if we get this to work, right? If that is the case, then I think it is best we agree on which road we want to take going forward as soon as possible to avoid duplicated or wasted efforts.

Quoted 2 lines

In fact it is not clear to me if/when we get this to work, what would be the remaining open issues to complete "HVMlite". Roger?

The following items are already working out of the box with the current patch set:

- 32bit* and 64bit guest modes.
- Intel support.
- AMD support**.
- HAP support.
- Shadow support.

* 32bit CPU mode works, but I don't think 32bit hypercalls will work, see Jan's reply to patch 11. I plan to fix this in the next iteration.
** Untested.

What needs to be done (ordered by priority):

- Clean up the patches, this patch series was done in less than a week.
- Finish the boot ABI (this would also be needed for PVH anyway).
- Convert the rest of xc_dom_*loaders in order to use the physical entry point when present, right now xc_dom_elfloader is the only one usable with HVMlite. This is quite trivial (see patch 10, it's a 4 LOC change).
- Dom0 support.
- Migration.
- PCI pass-through.

IMHO this is what we agreed to do with PVH, make it an HVM guest without a device model and without the emulated devices inside of Xen. Sooner or later we would need to make that change anyway in order to properly integrate PVH into Xen, and we get a bunch of new features for free as compared to PVH.

I don't think of this as "throw PVH out of the window and start something completely new from scratch", we are going to reuse some of the code paths used by PVH inside of Xen. From a guest POV the changes needed to move from PVH into HVMlite are regarding the boot ABI only, which we already agreed that should be changed anyway.

Roger.

#33 lore raw
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 24.06.15 at 11:47, <[email protected]> wrote:

What needs to be done (ordered by priority):

- Clean up the patches, this patch series was done in less than a week.
- Finish the boot ABI (this would also be needed for PVH anyway).
- Convert the rest of xc_dom_*loaders in order to use the physical entry point when present, right now xc_dom_elfloader is the only one usable with HVMlite. This is quite trivial (see patch 10, it's a 4 LOC change).
- Dom0 support.
- Migration.
- PCI pass-through.

IMHO this is what we agreed to do with PVH, make it an HVM guest without a device model and without the emulated devices inside of Xen. Sooner or later we would need to make that change anyway in order to properly integrate PVH into Xen, and we get a bunch of new features for free as compared to PVH.

Quoted 5 lines

I don't think of this as "throw PVH out of the window and start something completely new from scratch", we are going to reuse some of the code paths used by PVH inside of Xen. From a guest POV the changes needed to move from PVH into HVMlite are regarding the boot ABI only, which we already agreed that should be changed anyway.

I have to admit that I'm having a hard time making myself a clear picture of what the intention now is, namely with feature freeze being in about 2.5 weeks: If we assume that this series gets ready in time, should we drop Boris' 32-bit support patches? Would then be unfortunate if the series here didn't get ready.

Otoh I don't think this and Boris' code conflict, and what we got in the tree PVH-wise is kind of a mess right now anyway, so adding to it just a few more bits (actually getting rid of some fixme-s, i.e. reducing messiness), so I'd be inclined to take the rest of Boris' series once ready, and if the series here gets ready too it could then also go in. Which would then mean for someone (perhaps after 4.6 was branched) to clean up any no longer necessary PVH special cases, unifying things towards what we seem to now call HVMlite.

Jan

#34 lore raw

El 24/06/15 a les 12.05, Jan Beulich ha escrit:

Quoted 25 lines
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 24.06.15 at 11:47, <[email protected]> wrote:

What needs to be done (ordered by priority):

- Clean up the patches, this patch series was done in less than a week.
- Finish the boot ABI (this would also be needed for PVH anyway).
- Convert the rest of xc_dom_*loaders in order to use the physical entry point when present, right now xc_dom_elfloader is the only one usable with HVMlite. This is quite trivial (see patch 10, it's a 4 LOC change).
- Dom0 support.
- Migration.
- PCI pass-through.

IMHO this is what we agreed to do with PVH, make it an HVM guest without a device model and without the emulated devices inside of Xen. Sooner or later we would need to make that change anyway in order to properly integrate PVH into Xen, and we get a bunch of new features for free as compared to PVH.

Quoted 5 lines

I don't think of this as "throw PVH out of the window and start something completely new from scratch", we are going to reuse some of the code paths used by PVH inside of Xen. From a guest POV the changes needed to move from PVH into HVMlite are regarding the boot ABI only, which we already agreed that should be changed anyway.

Quoted 5 lines

I have to admit that I'm having a hard time making myself a clear picture of what the intention now is, namely with feature freeze being in about 2.5 weeks: If we assume that this series gets ready in time, should we drop Boris' 32-bit support patches? Would then be unfortunate if the series here didn't get ready.

TBH I'm not going to make any promises of this being ready before the 4.6 feature freeze, not until I get some feedback from the tools maintainers regarding the libxc changes to unify the PV and HVM domain creation paths.

Quoted 9 lines

Otoh I don't think this and Boris' code conflict, and what we got in the tree PVH-wise is kind of a mess right now anyway, so adding to it just a few more bits (actually getting rid of some fixme-s, i.e. reducing messiness), so I'd be inclined to take the rest of Boris' series once ready, and if the series here gets ready too it could then also go in. Which would then mean for someone (perhaps after 4.6 was branched) to clean up any no longer necessary PVH special cases, unifying things towards what we seem to now call HVMlite.

I'm not against merging the 32bit support series for PVH, but I'm certainly not going to invest time in adding 32bit PVH entry points to any OSes.

Roger.

#35 lore raw
Quoted 30 lines · Roger Pau Monné

El 24/06/15 a les 12.05, Jan Beulich ha escrit:

Quoted 24 lines
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 24.06.15 at 11:47, <[email protected]> wrote:

What needs to be done (ordered by priority):

- Clean up the patches, this patch series was done in less than a week.
- Finish the boot ABI (this would also be needed for PVH anyway).
- Convert the rest of xc_dom_*loaders in order to use the physical entry point when present, right now xc_dom_elfloader is the only one usable with HVMlite. This is quite trivial (see patch 10, it's a 4 LOC change).
- Dom0 support.
- Migration.
- PCI pass-through.

IMHO this is what we agreed to do with PVH, make it an HVM guest without a device model and without the emulated devices inside of Xen. Sooner or later we would need to make that change anyway in order to properly integrate PVH into Xen, and we get a bunch of new features for free as compared to PVH.

Quoted 5 lines

I don't think of this as "throw PVH out of the window and start something completely new from scratch", we are going to reuse some of the code paths used by PVH inside of Xen. From a guest POV the changes needed to move from PVH into HVMlite are regarding the boot ABI only, which we already agreed that should be changed anyway.

Quoted 5 lines

I have to admit that I'm having a hard time making myself a clear picture of what the intention now is, namely with feature freeze being in about 2.5 weeks: If we assume that this series gets ready in time, should we drop Boris' 32-bit support patches? Would then be unfortunate if the series here didn't get ready.

Quoted 4 lines

TBH I'm not going to make any promises of this being ready before the 4.6 feature freeze, not until I get some feedback from the tools maintainers regarding the libxc changes to unify the PV and HVM domain creation paths.

FWIW, I gave this a quick spin on Monday and crashed the hypervisor on a NULL pointer right away in vapic code. Which, I assume, is not surprising since we are not supposed to be there in the first place.

I'll try it again later today (I was out yesterday), maybe I messed something up.

Quoted 10 lines
Quoted 10 lines

Otoh I don't think this and Boris' code conflict, and what we got in the tree PVH-wise is kind of a mess right now anyway, so adding to it just a few more bits (actually getting rid of some fixme-s, i.e. reducing messiness), so I'd be inclined to take the rest of Boris' series once ready, and if the series here gets ready too it could then also go in. Which would then mean for someone (perhaps after 4.6 was branched) to clean up any no longer necessary PVH special cases, unifying things towards what we seem to now call HVMlite.

Quoted 3 lines

I'm not against merging the 32bit support series for PVH, but I'm certainly not going to invest time in adding 32bit PVH entry points to any OSes.

What about Tim's proposal (http://lists.xen.org/archives/html/xen-devel/2014-12/msg00596.html)? Can this work be made part of it? At least, make it extendable to that?

-boris

#36 lore raw

El 24/06/15 a les 13.52, Boris Ostrovsky ha escrit:

Quoted 40 lines · Roger Pau Monné
Quoted 34 lines

El 24/06/15 a les 12.05, Jan Beulich ha escrit:

Quoted 28 lines
Quoted 23 lines
Quoted 1 line
Quoted 1 line · On 24.06.15 at 11:47, <[email protected]> wrote:

What needs to be done (ordered by priority):

- Clean up the patches, this patch series was done in less than a
week.
- Finish the boot ABI (this would also be needed for PVH anyway).
- Convert the rest of xc_dom_*loaders in order to use the physical entry point when present, right now xc_dom_elfloader is the only
one
usable with HVMlite. This is quite trivial (see patch 10, it's a 4 LOC change).
- Dom0 support.
- Migration.
- PCI pass-through.

IMHO this is what we agreed to do with PVH, make it an HVM guest without
a device model and without the emulated devices inside of Xen. Sooner or
later we would need to make that change anyway in order to properly integrate PVH into Xen, and we get a bunch of new features for free as compared to PVH.

Quoted 5 lines

I don't think of this as "throw PVH out of the window and start something completely new from scratch", we are going to reuse some of the code paths used by PVH inside of Xen. From a guest POV the changes needed to move from PVH into HVMlite are regarding the boot ABI only, which we already agreed that should be changed anyway.

Quoted 5 lines

I have to admit that I'm having a hard time making myself a clear picture of what the intention now is, namely with feature freeze being in about 2.5 weeks: If we assume that this series gets ready in time, should we drop Boris' 32-bit support patches? Would then be unfortunate if the series here didn't get ready.

Quoted 4 lines

TBH I'm not going to make any promises of this being ready before the 4.6 feature freeze, not until I get some feedback from the tools maintainers regarding the libxc changes to unify the PV and HVM domain creation paths.

Quoted 6 lines

FWIW, I gave this a quick spin on Monday and crashed the hypervisor on a NULL pointer right away in vapic code. Which, I assume, is not surprising since we are not supposed to be there in the first place.

I'll try it again later today (I was out yesterday), maybe I messed something up.

Yes, feature disabling is still not 100% done I'm afraid. For example if your hw supports vAPIC it will be enabled anyway, which can then lead to all kinds of trouble. As said, this is very initial and I've only tested it on one Nehalem box which doesn't have vAPIC.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

Otoh I don't think this and Boris' code conflict, and what we got in the tree PVH-wise is kind of a mess right now anyway, so adding to it just a few more bits (actually getting rid of some fixme-s, i.e. reducing messiness), so I'd be inclined to take the rest of Boris' series once ready, and if the series here gets ready too it could then also go in. Which would then mean for someone (perhaps after 4.6 was branched) to clean up any no longer necessary PVH special cases, unifying things towards what we seem to now call HVMlite.

Quoted 7 lines
Quoted 3 lines

I'm not against merging the 32bit support series for PVH, but I'm certainly not going to invest time in adding 32bit PVH entry points to any OSes.

What about Tim's proposal
(http://lists.xen.org/archives/html/xen-devel/2014-12/msg00596.html)?
Can this work be made part of it? At least, make it extendable to that?

Yes, the aim of this work is to address some of the points expressed in that email, mainly merge PVH into HVM. But as we have already spoken, the entry point of HVMlite or whatever we call it is going to be different from the traditional PV/PVH entry point.

Roger.

#37 lore raw
Quoted 67 lines · Roger Pau Monné

El 24/06/15 a les 13.52, Boris Ostrovsky ha escrit:

Quoted 40 lines · Roger Pau Monné
Quoted 34 lines

El 24/06/15 a les 12.05, Jan Beulich ha escrit:

Quoted 28 lines
Quoted 23 lines
Quoted 1 line
Quoted 1 line · On 24.06.15 at 11:47, <[email protected]> wrote:

What needs to be done (ordered by priority):

- Clean up the patches, this patch series was done in less than a
week.
- Finish the boot ABI (this would also be needed for PVH anyway).
- Convert the rest of xc_dom_*loaders in order to use the physical entry point when present, right now xc_dom_elfloader is the only
one
usable with HVMlite. This is quite trivial (see patch 10, it's a 4 LOC change).
- Dom0 support.
- Migration.
- PCI pass-through.

IMHO this is what we agreed to do with PVH, make it an HVM guest without
a device model and without the emulated devices inside of Xen. Sooner or
later we would need to make that change anyway in order to properly integrate PVH into Xen, and we get a bunch of new features for free as compared to PVH.

Quoted 5 lines

I don't think of this as "throw PVH out of the window and start something completely new from scratch", we are going to reuse some of the code paths used by PVH inside of Xen. From a guest POV the changes needed to move from PVH into HVMlite are regarding the boot ABI only, which we already agreed that should be changed anyway.

Quoted 5 lines

I have to admit that I'm having a hard time making myself a clear picture of what the intention now is, namely with feature freeze being in about 2.5 weeks: If we assume that this series gets ready in time, should we drop Boris' 32-bit support patches? Would then be unfortunate if the series here didn't get ready.

Quoted 4 lines

TBH I'm not going to make any promises of this being ready before the 4.6 feature freeze, not until I get some feedback from the tools maintainers regarding the libxc changes to unify the PV and HVM domain creation paths.

Quoted 6 lines

FWIW, I gave this a quick spin on Monday and crashed the hypervisor on a NULL pointer right away in vapic code. Which, I assume, is not surprising since we are not supposed to be there in the first place.

I'll try it again later today (I was out yesterday), maybe I messed something up.

Yes, feature disabling is still not 100% done I'm afraid. For example if your hw supports vAPIC it will be enabled anyway, which can then lead to all kinds of trouble. As said, this is very initial and I've only tested it on one Nehalem box which doesn't have vAPIC.

Quoted 14 lines
Quoted 13 lines
Quoted 10 lines

Otoh I don't think this and Boris' code conflict, and what we got in the tree PVH-wise is kind of a mess right now anyway, so adding to it just a few more bits (actually getting rid of some fixme-s, i.e. reducing messiness), so I'd be inclined to take the rest of Boris' series once ready, and if the series here gets ready too it could then also go in. Which would then mean for someone (perhaps after 4.6 was branched) to clean up any no longer necessary PVH special cases, unifying things towards what we seem to now call HVMlite.

I'm not against merging the 32bit support series for PVH, but I'm certainly not going to invest time in adding 32bit PVH entry points to any OSes.

Quoted 8 lines
Quoted 3 lines

What about Tim's proposal
(http://lists.xen.org/archives/html/xen-devel/2014-12/msg00596.html)?
Can this work be made part of it? At least, make it extendable to that?

Yes, the aim of this work is to address some of the points expressed in that email, mainly merge PVH into HVM. But as we have already spoken, the entry point of HVMlite or whatever we call it is going to be different from the traditional PV/PVH entry point.

Right. If you were to take a sharpie where would you put in the list that Tim had written out?

And to my eye - it looks as the HVMLIte boot entry and the old PVH bootpaths can co-exist for some time until they get merged together?

This would have the nice benefit of being able to troubleshoot issues easier as you have an existing codepath for 'old-PVH' and new bootup path and can figure out what is missing to make it work (with the Linux kernel at least).

#38 lore raw
In reply to Boris Ostrovsky
Quoted 53 lines · Boris Ostrovsky
Quoted 30 lines · Roger Pau Monné

El 24/06/15 a les 12.05, Jan Beulich ha escrit:

Quoted 24 lines
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 24.06.15 at 11:47, <[email protected]> wrote:

What needs to be done (ordered by priority):

- Clean up the patches, this patch series was done in less than a week.
- Finish the boot ABI (this would also be needed for PVH anyway).
- Convert the rest of xc_dom_*loaders in order to use the physical entry point when present, right now xc_dom_elfloader is the only one usable with HVMlite. This is quite trivial (see patch 10, it's a 4 LOC change).
- Dom0 support.
- Migration.
- PCI pass-through.

IMHO this is what we agreed to do with PVH, make it an HVM guest without a device model and without the emulated devices inside of Xen. Sooner or later we would need to make that change anyway in order to properly integrate PVH into Xen, and we get a bunch of new features for free as compared to PVH.

Quoted 5 lines

I don't think of this as "throw PVH out of the window and start something completely new from scratch", we are going to reuse some of the code paths used by PVH inside of Xen. From a guest POV the changes needed to move from PVH into HVMlite are regarding the boot ABI only, which we already agreed that should be changed anyway.

Quoted 5 lines

I have to admit that I'm having a hard time making myself a clear picture of what the intention now is, namely with feature freeze being in about 2.5 weeks: If we assume that this series gets ready in time, should we drop Boris' 32-bit support patches? Would then be unfortunate if the series here didn't get ready.

Quoted 4 lines

TBH I'm not going to make any promises of this being ready before the 4.6 feature freeze, not until I get some feedback from the tools maintainers regarding the libxc changes to unify the PV and HVM domain creation paths.

FWIW, I gave this a quick spin on Monday and crashed the hypervisor on a NULL pointer right away in vapic code. Which, I assume, is not surprising since we are not supposed to be there in the first place.

I'll try it again later today (I was out yesterday), maybe I messed something up.

Quoted 10 lines
Quoted 10 lines

Otoh I don't think this and Boris' code conflict, and what we got in the tree PVH-wise is kind of a mess right now anyway, so adding to it just a few more bits (actually getting rid of some fixme-s, i.e. reducing messiness), so I'd be inclined to take the rest of Boris' series once ready, and if the series here gets ready too it could then also go in. Which would then mean for someone (perhaps after 4.6 was branched) to clean up any no longer necessary PVH special cases, unifying things towards what we seem to now call HVMlite.

Quoted 7 lines
Quoted 3 lines

I'm not against merging the 32bit support series for PVH, but I'm certainly not going to invest time in adding 32bit PVH entry points to any OSes.

What about Tim's proposal
(http://lists.xen.org/archives/html/xen-devel/2014-12/msg00596.html)?
Can this work be made part of it? At least, make it extendable to that?

FWIW, I think this new scheme (start at HVM and remove things) is approaching the same end result from the other direction: Xen itself no longer needs to have a concept of PVH, and the guests get to keep their useful new interface. As such, I heartily approve. :)

Cheers,

Tim.

#39 lore raw
In reply to Roger Pau Monné
Quoted 41 lines · Roger Pau Monné

El 23/06/15 a les 12.55, Stefano Stabellini ha escrit:

Quoted 20 lines · Konrad Rzeszutek Wilk
Quoted 9 lines · Stefano Stabellini
Quoted 5 lines

Hi Roger,

given that this patch series is actually using the Xen "hvm" builder, I take that all the PVH code paths in Xen or the guest kernel are not actually used, correct? This is more like PV on HVM without QEMU, right?

Are you saying it should be called now 'HVM-diet' ? Or 'HVMlite' instead of PVH since it is looking at this from the HVM perspective instead of PVH?

HVMlite doesn't sound bad :-)

I don't know if we should introduce a new name for this, but I wanted to point out that this is different from PVH from Xen point of view. In particular most of the outstanding PVH work items (32bit, AMD) on the hypervisor would be redudant if we get this to work, right? If that is the case, then I think it is best we agree on which road we want to take going forward as soon as possible to avoid duplicated or wasted efforts.

Quoted 2 lines

In fact it is not clear to me if/when we get this to work, what would be the remaining open issues to complete "HVMlite". Roger?

The following items are already working out of the box with the current patch set:

- 32bit* and 64bit guest modes.
- Intel support.
- AMD support**.
- HAP support.
- Shadow support.

* 32bit CPU mode works, but I don't think 32bit hypercalls will work, see Jan's reply to patch 11. I plan to fix this in the next iteration.
** Untested.

What needs to be done (ordered by priority):

Quoted 7 lines

- Clean up the patches, this patch series was done in less than a week.
- Finish the boot ABI (this would also be needed for PVH anyway).
- Convert the rest of xc_dom_*loaders in order to use the physical entry point when present, right now xc_dom_elfloader is the only one usable with HVMlite. This is quite trivial (see patch 10, it's a 4 LOC change).
- Dom0 support.

What do you think that Dom0 support is going to entail?

Quoted 1 line

- Migration.

This is just HVM migration minus saving/restoring the QEMU state file, isn't it?

Quoted 1 line

- PCI pass-through.

Do we really need PCI pass-through? I see HVMlite mostly useful for Dom0, but also for higher security Linux and BSD guests. If a user wants PCI pass-through, she can always use PV on HVM.

Or do you mean allowing PCI pass-through to HVM guests on an HVMlite Dom0?

Quoted 11 lines

IMHO this is what we agreed to do with PVH, make it an HVM guest without a device model and without the emulated devices inside of Xen. Sooner or later we would need to make that change anyway in order to properly integrate PVH into Xen, and we get a bunch of new features for free as compared to PVH.

I don't think of this as "throw PVH out of the window and start something completely new from scratch", we are going to reuse some of the code paths used by PVH inside of Xen. From a guest POV the changes needed to move from PVH into HVMlite are regarding the boot ABI only, which we already agreed that should be changed anyway.

Sure, I just wanted to highlight that some work items could become redundant so that we don't waste any time on those.

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

#40 lore raw
Quoted 6 lines · Stefano Stabellini
Quoted 1 line · Roger Pau Monné

- PCI pass-through.

Do we really need PCI pass-through? I see HVMlite mostly useful for Dom0, but also for higher security Linux and BSD guests. If a user wants PCI pass-through, she can always use PV on HVM.

Why is this model not useful for a generic domU? I thought that it should eventually become a replacement for what we now have as PVH?

-boris

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

#41 lore raw
Quoted 10 lines · Boris Ostrovsky
Quoted 6 lines · Stefano Stabellini
Quoted 1 line · Roger Pau Monné

- PCI pass-through.

Do we really need PCI pass-through? I see HVMlite mostly useful for Dom0, but also for higher security Linux and BSD guests. If a user wants PCI pass-through, she can always use PV on HVM.

Why is this model not useful for a generic domU? I thought that it should eventually become a replacement for what we now have as PVH?

It is useful as generic DomU because it provides a smaller surface of attack compared to PV on HVM guests. At the same time using PCI pass-through increases that surface of attack again, decreasing the value of HVMLite/PVH, at least in my view. But you are right that it might be nice to have it for feature completeness, if nothing else.

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

#42 lore raw
In reply to Stefano Stabellini

Hello,

El 22/06/15 a les 19.55, Stefano Stabellini ha escrit:

Quoted 7 lines

Hi Roger,

given that this patch series is actually using the Xen "hvm" builder, I take that all the PVH code paths in Xen or the guest kernel are not actually used, correct? This is more like PV on HVM without QEMU, right?

From a Xen POV this is not a PVH guest (it's an HVM guest), although I'm

using some code paths which are shared with PVH. In the guest (in this case FreeBSD) I'm using the same paths as PVH, since the exposed interface is very similar. We probably aim at enabling the same set of hypercalls that are enabled on PVH.

Quoted 1 line

Do you think think this can work for Dom0 too?

I don't see why it couldn't be made to work.

Quoted 1 line

Would that make all the PVH stuff in Xen and Linux effectively useless?

No, I expect that some code paths inside of Xen will be shared between PVH and this HVM-without-dm guest type.

Then from a guest POV the interface is quite similar, so most of the code present in Linux and FreeBSD in order to run as a PVH guest can be reused for this new guest mode. If you take a look at the FreeBSD patch the change is just mostly during early boot in order to set the page tables and jump into long mode, then the rest is quite similar to PVH.

Forgot to mention, I've also tested it with hap=0 (so using shadow) and it seems to work fine.

Roger.