[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH xm/xl enhancements for vptm 3/6] add iomem option to xl
Sorry I forgot about the allow boolean, and yes its compatible with xm in terms of how ioport and irq are implemented. On 09/19/2012 08:33 AM, Ian Campbell wrote: > On Tue, 2012-09-18 at 19:15 +0100, Matthew Fioravante wrote: >> This patch adds a new option for xen config files for directly mapping >> hardware io memory into a vm. >> >> iomem=['pagenum,size',..] >> >> Where pagenum is the page number and size is the number of page. >> example (for a tpm: >> iomem=['fed40,5'] > Please can you patch the docs too. > > Your implementation seems to also support a third field "allow"? > > Did xm/xend have similar functionality? Is this compatible with the > syntax? > > Also this patch is whitespace mangled again I'm afraid (I expect they > all are so I'll stop mentioning it) > >> Signed off by Matthew Fioravante matthew.fioravante@xxxxxxxxxx >> >> diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h >> --- a/tools/libxl/libxl.h >> +++ b/tools/libxl/libxl.h >> @@ -477,7 +477,7 @@ typedef struct { >> libxl_domain_create_info c_info; >> libxl_domain_build_info b_info; >> >> - int num_disks, num_vifs, num_pcidevs, num_vfbs, num_vkbs, num_vtpms; >> + int num_disks, num_vifs, num_pcidevs, num_vfbs, num_vkbs, >> num_vtpms, num_iorngs; >> >> libxl_device_disk *disks; >> libxl_device_nic *vifs; >> @@ -485,6 +485,7 @@ typedef struct { >> libxl_device_vfb *vfbs; >> libxl_device_vkb *vkbs; >> libxl_device_vtpm *vtpms; >> + libxl_iomem_range *iorngs; >> >> libxl_action_on_shutdown on_poweroff; >> libxl_action_on_shutdown on_reboot; >> diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c >> --- a/tools/libxl/libxl_create.c >> +++ b/tools/libxl/libxl_create.c >> @@ -58,6 +58,10 @@ void libxl_domain_config_dispose(libxl_domain_config >> *d_config) >> libxl_device_vtpm_dispose(&d_config->vtpms[i]); >> free(d_config->vtpms); >> >> + for (i=0; i<d_config->num_iorngs; i++) >> + libxl_iomem_range_dispose(&d_config->iorngs[i]); >> + free(d_config->iorngs); >> + >> libxl_domain_create_info_dispose(&d_config->c_info); >> libxl_domain_build_info_dispose(&d_config->b_info); >> } >> @@ -718,6 +722,15 @@ static void domcreate_bootloader_done(libxl__egc *egc, >> >> store_libxl_entry(gc, domid, &d_config->b_info); >> >> + for (i = 0; i < d_config->num_iorngs; i++) { >> + ret = xc_domain_iomem_permission(ctx->xch, domid, >> d_config->iorngs[i].start, d_config->iorngs[i].length, >> d_config->iorngs[i].allow); >> + if (ret) { >> + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, >> + "cannot add iomem range %d to domain: %d", i, ret); >> + ret = ERROR_FAIL; >> + goto error_out; >> + } >> + } >> for (i = 0; i < d_config->num_disks; i++) { >> ret = libxl_device_disk_add(ctx, domid, &d_config->disks[i]); >> if (ret) { >> diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl >> --- a/tools/libxl/libxl_types.idl >> +++ b/tools/libxl/libxl_types.idl >> @@ -317,6 +317,12 @@ libxl_domain_build_info = Struct("domain_build_info",[ >> ], dir=DIR_IN >> ) >> >> +libxl_iomem_range = Struct("iomem_range", [ >> + ("start", uint64), >> + ("length", uint64), >> + ("allow", bool), >> +]); >> + >> libxl_device_vfb = Struct("device_vfb", [ >> ("backend_domid", libxl_domid), >> ("devid", libxl_devid), >> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c >> --- a/tools/libxl/xl_cmdimpl.c >> +++ b/tools/libxl/xl_cmdimpl.c >> @@ -560,7 +560,7 @@ static void parse_config_data(const char *config_source, >> const char *buf; >> long l; >> XLU_Config *config; >> - XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids, *vtpms; >> + XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids, *vtpms, >> *iomems; >> int pci_power_mgmt = 0; >> int pci_msitranslate = 1; >> int pci_permissive = 0; >> @@ -1145,6 +1145,42 @@ skip_vfb: >> libxl_defbool_set(&b_info->u.pv.e820_host, true); >> } >> >> + if(!xlu_cfg_get_list(config, "iomem", &iomems, 0, 0)) { >> + int i; >> + for(i =0; (buf = xlu_cfg_get_listitem(iomems, i)) != NULL; ++i) { >> + libxl_iomem_range *iorng; >> + char* buf2 = strdup(buf); >> + char *st, *len, *al; >> + >> + d_config->iorngs = realloc(d_config->iorngs, >> sizeof(libxl_iomem_range) * (d_config->num_iorngs + 1)); >> + iorng = d_config->iorngs + d_config->num_iorngs; >> + >> + libxl_iomem_range_init(iorng); >> + >> + st = strtok(buf2, ","); >> + len = strtok(NULL, ","); >> + al = strtok(NULL, ","); >> + >> + if(st == NULL || len == NULL || >> + sscanf(st, "%" PRIx64, &iorng->start) != 1 || >> + sscanf(len, "%" PRIu64, &iorng->length) != 1 || >> + (al != NULL && ((al[0] != '1' && al[0] != '0') || al[1] >> != '\0')) >> + ) { >> + fprintf(stderr, "Malformed iomem specification!\n"); >> + free(buf2); >> + exit(1); >> + } >> + if(al != NULL) { >> + iorng->allow = al[0] - '0'; >> + } else { >> + iorng->allow = 1; >> + } >> + >> + free(buf2); >> + d_config->num_iorngs++; >> + } >> + } >> + >> switch (xlu_cfg_get_list(config, "cpuid", &cpuids, 0, 1)) { >> case 0: >> { > Attachment:
smime.p7s _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |