tools/libxl: Switch Arm guest type to PVH
v3 cover tools/libxl: Switch Arm guest type to PVH
Hi all,
This small patch series adds switch Arm guest type to PVH in libxl. See patch #2 for the rationale.
Cheers,
Julien Grall (3):
tools/libxl: Rename libxl__arch_domain_build_info_acpi_setdefault
to...
tools/libxl: Deprecate PV fields kernel, ramdisk, cmdline tools/libxl: Switch Arm guest type to PVH
docs/man/xl.cfg.pod.5.in | 5 +++-- tools/libxl/libxl_arch.h | 4 ++-- tools/libxl/libxl_arm.c | 28 +++++++++++++++++++++++++--- tools/libxl/libxl_create.c | 21 +-------------------- tools/libxl/libxl_types.idl | 6 +++--- tools/libxl/libxl_x86.c | 4 ++-- tools/xl/xl_parse.c | 4 ++++ 7 files changed, 40 insertions(+), 32 deletions(-)
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 1/3 tools/libxl: Rename libxl__arch_domain_build_info_acpi_setdefault to...
libxl__arch_domain_build_info_setdefault
A follow-up will require to modify default of multiple fields of build_info. So rename the function accordingly.
No functional change.
---
Changes in v3:
- Add Roger's reviewed-by
- Add Wei's acked-by
--- tools/libxl/libxl_arch.h | 3 +-- tools/libxl/libxl_arm.c | 4 ++-- tools/libxl/libxl_create.c | 2 +- tools/libxl/libxl_x86.c | 3 +-- 4 files changed, 5 insertions(+), 7 deletions(-)
tools/libxl/libxl_arch.h +1 -2
@@ -65,8 +65,7 @@ _hiddenint libxl__arch_domain_map_irq (libxl__gc *gc,uint32_t domid,int irq);_hidden -void libxl__arch_domain_build_info_acpi_setdefault( -libxl_domain_build_info *b_info); +void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info); _hidden int libxl__arch_extra_memory(libxl__gc *gc,
tools/libxl/libxl_arm.c +2 -2
@@ -1110,9 +1110,9 @@ int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq)return xc_domain_bind_pt_spi_irq (CTX ->xch, domid, irq, irq); } -void libxl__arch_domain_build_info_acpi_setdefault ( -libxl_domain_build_info *b_info) +void libxl__arch_domain_build_info_setdefault (libxl_domain_build_info *b_info) { +/* ACPI is disabled by default */ libxl_defbool_setdefault (&b_info->acpi, false); }
tools/libxl/libxl_create.c +1 -1
@@ -215,7 +215,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,if (!b_info->event_channels) b_info->event_channels =1023 ; -libxl__arch_domain_build_info_acpi_setdefault (b_info); +libxl__arch_domain_build_info_setdefault (b_info);libxl_defbool_setdefault (&b_info->dm_restrict, false);switch (b_info->type) {
tools/libxl/libxl_x86.c +1 -2
@@ -613,8 +613,7 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,return rc; } -void libxl__arch_domain_build_info_acpi_setdefault ( -libxl_domain_build_info *b_info) +void libxl__arch_domain_build_info_setdefault (libxl_domain_build_info *b_info) {libxl_defbool_setdefault (&b_info->acpi, true); }
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 1/2 xen/arm: vgic-v3: Delay the initialization of the domain information
In reply to Julien GrallA follow-up patch will require to know the number of vCPUs when initializating the vGICv3 domain structure. However this information is not available at domain creation. This is only known once XEN_DOMCTL_max_vpus is called for that domain.
In order to get the max vCPUs around, delay the domain part of the vGIC v3 initialization until the first vCPU of the domain is initialized.
---
This is nasty but I can't find a better way for Xen 4.11 and older. We still need it for unstable because the number of vCPUs is not known in arch_domain_init. There are discussion to rework the domain creation a bit further but I would hope to fix the bug first.
Andrew, I have CCed you to know whether you have a better idea where to place this call on Xen 4.11 and older.
Changes in v2:
- The patch is also needed for the time being on unstable
- Add Stefano's recently invented tag
- Add Shameer's tested tag
--- xen/arch/arm/vgic-v3.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
xen/arch/arm/vgic-v3.c +27 -2
@@ -1573,9 +1573,11 @@ static const struct mmio_handler_ops vgic_distr_mmio_handler = { .write = vgic_v3_distr_mmio_write, }; +static int vgic_v3_real_domain_init (struct domain *d); +static int vgic_v3_vcpu_init (struct vcpu *v) { -int i; +int i, rc;paddr_t rdist_base;struct vgic_rdist_region *region;unsigned int last_cpu;
@@ -1584,6 +1586,19 @@ static int vgic_v3_vcpu_init(struct vcpu *v)struct domain *d = v->domain;/* +* This is the earliest place where the number of vCPUs is +* known. This is required to initialize correctly the vGIC v3 +* domain structure. We only to do that when vCPU 0 is +* initilialized. +*/ +if ( v->vcpu_id ==0 ) + { + rc =vgic_v3_real_domain_init (d); +if ( rc ) +return rc; + } + +/* * Find the region where the re-distributor lives. For this purpose, * we look one region ahead as we have only the first CPU in hand. */
@@ -1641,7 +1656,7 @@ static inline unsigned int vgic_v3_rdist_count(struct domain *d)GUEST_GICV3_RDIST_REGIONS ; } -static int vgic_v3_domain_init (struct domain *d) +static int vgic_v3_real_domain_init (struct domain *d) {struct vgic_rdist_region *rdist_regions;int rdist_count, i, ret;
@@ -1733,6 +1748,16 @@ static int vgic_v3_domain_init(struct domain *d)return 0 ; } +static int vgic_v3_domain_init (struct domain *d) +{ +/* +* The domain initialization for vGIC v3 is delayed until the first vCPU +* is created. This because the initialization may require to know the +* number of vCPUs that is not known when creating the domain. +*/ +return 0 ; +} +static void vgic_v3_domain_free (struct domain *d) {vgic_v3_its_free_domain (d);
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 1/2] xen/arm: vgic-v3: Delay the initialization of the domain information
Hi,
I forgot to remove patch from the previous series before sending the new one.
Please ignore that patch. Sorry for the noise.
Cheers,
Quoted 96 lines · Julien Grall
A follow-up patch will require to know the number of vCPUs when initializating the vGICv3 domain structure. However this information is not available at domain creation. This is only known once
XEN_DOMCTL_max_vpusis called for that domain.In order to get the max vCPUs around, delay the domain part of the vGIC v3 initialization until the first vCPU of the domain is initialized.
Signed-off-by Julien Grall <[email protected]>Tested-by Shameer Kolothum <[email protected]>Acked-but-disliked-by Stefano Stabellini <[email protected]>---
Cc Andrew Cooper <[email protected]>This is nasty but I can't find a better way for Xen 4.11 and older. We still need it for unstable because the number of vCPUs is not known in
arch_domain_init. There are discussion to rework the domain creation a bit further but I would hope to fix the bug first.Andrew, I have CCed you to know whether you have a better idea where to place this call on Xen 4.11 and older.
Changes in v2:
- The patch is also needed for the time being on unstable
- Add Stefano's recently invented tag
- Add Shameer's tested tag--- xen/arch/arm/vgic-v3.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)xen/arch/arm/vgic-v3.c +27
-2@@ -1573,9 +1573,11 @@ static const struct mmio_handler_ops vgic_distr_mmio_handler = { .write = vgic_v3_distr_mmio_write, }; +static int vgic_v3_real_domain_init (struct domain *d); +static int vgic_v3_vcpu_init (struct vcpu *v) { -int i; +int i, rc;paddr_t rdist_base;struct vgic_rdist_region *region;unsigned int last_cpu;@@ -1584,6 +1586,19 @@ static int vgic_v3_vcpu_init(struct vcpu *v)struct domain *d = v->domain;/* +* This is the earliest place where the number of vCPUs is +* known. This is required to initialize correctly the vGIC v3 +* domain structure. We only to do that when vCPU 0 is +* initilialized. +*/ +if ( v->vcpu_id ==0 ) + { + rc =vgic_v3_real_domain_init (d); +if ( rc ) +return rc; + } + +/* * Find the region where the re-distributor lives. For this purpose, * we look one region ahead as we have only the first CPU in hand. */ @@ -1641,7 +1656,7 @@ static inline unsigned int vgic_v3_rdist_count(struct domain *d)GUEST_GICV3_RDIST_REGIONS ; } -static int vgic_v3_domain_init (struct domain *d) +static int vgic_v3_real_domain_init (struct domain *d) {struct vgic_rdist_region *rdist_regions;int rdist_count, i, ret;@@ -1733,6 +1748,16 @@ static int vgic_v3_domain_init(struct domain *d)return 0 ; } +static int vgic_v3_domain_init (struct domain *d) +{ +/* +* The domain initialization for vGIC v3 is delayed until the first vCPU +* is created. This because the initialization may require to know the +* number of vCPUs that is not known when creating the domain. +*/ +return 0 ; +} +static void vgic_v3_domain_free (struct domain *d) {vgic_v3_its_free_domain (d);
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 2/3 tools/libxl: Deprecate PV fields kernel, ramdisk, cmdline
In reply to Julien GrallThe PV fields kernel, ramdisk, cmdline are only there for compatibility with old toolstack. Instead of manually copying them over to there new field, use the deprecated_by attribute in the IDL.
---
Changes in v3:
- Patch added
--- tools/libxl/libxl_create.c | 19 ------------------- tools/libxl/libxl_types.idl | 6 +++--- 2 files changed, 3 insertions(+), 22 deletions(-)
tools/libxl/libxl_create.c +0 -19
@@ -368,25 +368,6 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, b_info->shadow_memkb =0 ;if (b_info->u.pv.slack_memkb ==LIBXL_MEMKB_DEFAULT ) b_info->u.pv.slack_memkb =0 ; - -/* For compatibility, fill in b_info->kernel|ramdisk|cmdline -* with the value in u.pv, later processing will use -* b_info->kernel|ramdisk|cmdline only. -* User with old APIs that passes u.pv.kernel|ramdisk|cmdline -* is not affected. -*/ -if (!b_info->kernel && b_info->u.pv.kernel) { - b_info->kernel = b_info->u.pv.kernel; - b_info->u.pv.kernel =NULL ; - } -if (!b_info->ramdisk && b_info->u.pv.ramdisk) { - b_info->ramdisk = b_info->u.pv.ramdisk; - b_info->u.pv.ramdisk =NULL ; - } -if (!b_info->cmdline && b_info->u.pv.cmdline) { - b_info->cmdline = b_info->u.pv.cmdline; - b_info->u.pv.cmdline =NULL ; - }break ;case LIBXL_DOMAIN_TYPE_PVH :libxl_defbool_setdefault (&b_info->u.pvh.pvshim, false);
tools/libxl/libxl_types.idl +3 -3
@@ -588,12 +588,12 @@ libxl_domain_build_info = Struct("domain_build_info",[ ("rdm_mem_boundary_memkb", MemKB), ("mca_caps", uint64), ])), - ("pv", Struct(None, [("kernel", string), + ("pv", Struct(None, [("kernel", string, {'deprecated_by': 'kernel'}), ("slack_memkb", MemKB), ("bootloader", string, {'deprecated_by': 'bootloader'}), ("bootloader_args", libxl_string_list, {'deprecated_by': 'bootloader_args'}), - ("cmdline", string), - ("ramdisk", string), + ("cmdline", string, {'deprecated_by': 'cmdline'}), + ("ramdisk", string, {'deprecated_by': 'ramdisk'}), ("features", string, {'const': True}), # Use host's E820 for PCI passthrough. ("e820_host", libxl_defbool),
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v3 2/3] tools/libxl: Deprecate PV fields kernel, ramdisk, cmdline
Quoted 6 lines · Julien Grall
The PV fields kernel, ramdisk, cmdline are only there for compatibility with old toolstack. Instead of manually copying them over to there new field, use the
deprecated_byattribute in the IDL.Suggested-by Roger Pau Monné <[email protected]>Signed-off-by Julien Grall <[email protected]>
Thanks.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v3 2/3] tools/libxl: Deprecate PV fields kernel, ramdisk, cmdline
In reply to Julien GrallQuoted 6 lines · Julien Grall
The PV fields kernel, ramdisk, cmdline are only there for compatibility with old toolstack. Instead of manually copying them over to there new field, use the
deprecated_byattribute in the IDL.Suggested-by Roger Pau Monné <[email protected]>Signed-off-by Julien Grall <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 2/2 xen/arm: vgic-v3: Don't create empty re-distributor regions
In reply to Julien GrallAt the moment, Xen is assuming the hardware domain will have the same number of re-distributor regions as the host. However, as the number of CPUs or the stride (e.g on GICv4) may be different we end up exposing regions which does not contain any re-distributors.
When booting, Linux will go through all the re-distributor region to check whether a property (e.g vPLIs) is available accross all the re-distributors. This will result to a data abort on empty regions because there are no underlying re-distributor.
So we need to limit the number of regions exposed to the hardware domain. The code reworked to only expose the minimun number of regions required by the hardware domain. It is assumed the regions will be populated starting from the first one.
Lastly, rename vgic_v3_rdist_count to reflect the value return by the helper.
---
Changes in v2:
- Rename vgic_v3_rdist_count to vgic_v3_max_rdist_count
- Fixup #re-distributors
- Fix typoes
- Add Shameer's tested tag
--- xen/arch/arm/gic-v3.c | 14 +++++++++++--- xen/arch/arm/vgic-v3.c | 21 ++++++++++++++++++--- 2 files changed, 29 insertions(+), 6 deletions(-)
xen/arch/arm/gic-v3.c +11 -3
@@ -1265,7 +1265,8 @@ static int gicv3_make_hwdom_dt_node(const struct domain *d,if ( res )return res; - res =fdt_property_cell (fdt,"#redistributor-regions" , gicv3.rdist_count); + res =fdt_property_cell (fdt,"#redistributor-regions" , + d->arch.vgic.nr_regions);if ( res )return res;
@@ -1274,8 +1275,10 @@ static int gicv3_make_hwdom_dt_node(const struct domain *d,* GIC has two memory regions: Distributor + rdist regions * CPU interface and virtual cpu interfaces accessesed as System registers * So cells are created only for Distributor and rdist regions +* The hardware domain may not use all the regions. So only copy +* what is necessary. */ - new_len = new_len * (gicv3.rdist_count +1 ); + new_len = new_len * (d->arch.vgic.nr_regions +1 ); hw_reg =dt_get_property (gic,"reg" , &len);if ( !hw_reg )
@@ -1466,6 +1469,7 @@ static inline bool gic_dist_supports_dvis(void) }static int gicv3_make_hwdom_madt (const struct domain *d,u32 offset) + {struct acpi_subtable_header *header;struct acpi_madt_generic_interrupt *host_gicc, *gicc;
@@ -1503,7 +1507,11 @@ static int gicv3_make_hwdom_madt(const struct domain *d, u32 offset)/* Add Generic Redistributor */ size =sizeof (struct acpi_madt_generic_redistributor ); -for ( i =0 ; i < gicv3.rdist_count; i++ ) +/* +* The hardware domain may not used all the regions. So only copy +* what is necessary. +*/ +for ( i =0 ; i < d->arch.vgic.nr_regions; i++ ) { gicr = (struct acpi_madt_generic_redistributor *)(base_ptr + table_len); gicr->header.type =ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR ;
xen/arch/arm/vgic-v3.c +18 -3
@@ -1640,7 +1640,11 @@ static int vgic_v3_vcpu_init(struct vcpu *v)return 0 ; } -static inline unsigned int vgic_v3_rdist_count (struct domain *d) +/* +* Return the maximum number possible of re-distributor regions for +* a given domain. +*/ +static inline unsigned int vgic_v3_max_rdist_count (struct domain *d) {/* * Normally there is only one GICv3 redistributor region.
@@ -1662,7 +1666,7 @@ static int vgic_v3_real_domain_init(struct domain *d)int rdist_count, i, ret;/* Allocate memory for Re-distributor regions */ - rdist_count =vgic_v3_rdist_count (d); + rdist_count =vgic_v3_max_rdist_count (d); rdist_regions = xzalloc_array(struct vgic_rdist_region, rdist_count);if ( !rdist_regions )
@@ -1695,8 +1699,19 @@ static int vgic_v3_real_domain_init(struct domain *d) d->arch.vgic.rdist_regions[i].first_cpu = first_cpu; first_cpu += size /GICV3_GICR_SIZE ; + +if ( first_cpu >= d->max_vcpus ) +break ; } +/* +* The hardware domain may not use all the re-distributors +* regions (e.g when the number of vCPUs does not match the +* number of pCPUs). Update the number of regions to avoid +* exposing unused region as they will not get emulated. +*/ + d->arch.vgic.nr_regions = i +1 ; + d->arch.vgic.intid_bits = vgic_v3_hw.intid_bits; }else
@@ -1825,7 +1840,7 @@ int vgic_v3_init(struct domain *d, int *mmio_count) }/* GICD region + number of Redistributors */ - *mmio_count =vgic_v3_rdist_count (d) +1 ; + *mmio_count =vgic_v3_max_rdist_count (d) +1 ;/* one region per ITS */ *mmio_count +=vgic_v3_its_count (d);
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH v2 2/2] xen/arm: vgic-v3: Don't create empty re-distributor regions
Hi,
I forgot to remove patch from the previous series before sending the new one.
Please ignore that patch. Sorry for the noise.
Cheers,
Quoted 136 lines · Julien Grall
At the moment, Xen is assuming the hardware domain will have the same number of re-distributor regions as the host. However, as the number of CPUs or the stride (e.g on GICv4) may be different we end up exposing regions which does not contain any re-distributors.
When booting, Linux will go through all the re-distributor region to check whether a property (e.g vPLIs) is available accross all the re-distributors. This will result to a data abort on empty regions because there are no underlying re-distributor.
So we need to limit the number of regions exposed to the hardware domain. The code reworked to only expose the minimun number of regions required by the hardware domain. It is assumed the regions will be populated starting from the first one.
Lastly, rename
vgic_v3_rdist_countto reflect the value return by the helper.Reported-by Shameerali Kolothum Thodi <[email protected]>Signed-off-by Julien Grall <[email protected]>Tested-by Shameer Kolothum <[email protected]>---
Changes in v2:
- Renamevgic_v3_rdist_counttovgic_v3_max_rdist_count
- Fixup #re-distributors
- Fix typoes
- Add Shameer's tested tag--- xen/arch/arm/gic-v3.c | 14 +++++++++++--- xen/arch/arm/vgic-v3.c | 21 ++++++++++++++++++--- 2 files changed, 29 insertions(+), 6 deletions(-)xen/arch/arm/gic-v3.c +11
-3@@ -1265,7 +1265,8 @@ static int gicv3_make_hwdom_dt_node(const struct domain *d,if ( res )return res; - res =fdt_property_cell (fdt,"#redistributor-regions" , gicv3.rdist_count); + res =fdt_property_cell (fdt,"#redistributor-regions" , + d->arch.vgic.nr_regions);if ( res )return res;@@ -1274,8 +1275,10 @@ static int gicv3_make_hwdom_dt_node(const struct domain *d,* GIC has two memory regions: Distributor + rdist regions * CPU interface and virtual cpu interfaces accessesed as System registers * So cells are created only for Distributor and rdist regions +* The hardware domain may not use all the regions. So only copy +* what is necessary. */ - new_len = new_len * (gicv3.rdist_count +1 ); + new_len = new_len * (d->arch.vgic.nr_regions +1 ); hw_reg =dt_get_property (gic,"reg" , &len);if ( !hw_reg )@@ -1466,6 +1469,7 @@ static inline bool gic_dist_supports_dvis(void) }static int gicv3_make_hwdom_madt (const struct domain *d,u32 offset) + {struct acpi_subtable_header *header;struct acpi_madt_generic_interrupt *host_gicc, *gicc;@@ -1503,7 +1507,11 @@ static int gicv3_make_hwdom_madt(const struct domain *d, u32 offset)/* Add Generic Redistributor */ size =sizeof (struct acpi_madt_generic_redistributor ); -for ( i =0 ; i < gicv3.rdist_count; i++ ) +/* +* The hardware domain may not used all the regions. So only copy +* what is necessary. +*/ +for ( i =0 ; i < d->arch.vgic.nr_regions; i++ ) { gicr = (struct acpi_madt_generic_redistributor *)(base_ptr + table_len); gicr->header.type =ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR ;xen/arch/arm/vgic-v3.c +18
-3@@ -1640,7 +1640,11 @@ static int vgic_v3_vcpu_init(struct vcpu *v)return 0 ; } -static inline unsigned int vgic_v3_rdist_count (struct domain *d) +/* +* Return the maximum number possible of re-distributor regions for +* a given domain. +*/ +static inline unsigned int vgic_v3_max_rdist_count (struct domain *d) {/* * Normally there is only one GICv3 redistributor region. @@ -1662,7 +1666,7 @@ static int vgic_v3_real_domain_init(struct domain *d)int rdist_count, i, ret;/* Allocate memory for Re-distributor regions */ - rdist_count =vgic_v3_rdist_count (d); + rdist_count =vgic_v3_max_rdist_count (d); rdist_regions = xzalloc_array(struct vgic_rdist_region, rdist_count);if ( !rdist_regions )@@ -1695,8 +1699,19 @@ static int vgic_v3_real_domain_init(struct domain *d) d->arch.vgic.rdist_regions[i].first_cpu = first_cpu; first_cpu += size /GICV3_GICR_SIZE ; + +if ( first_cpu >= d->max_vcpus ) +break ; } +/* +* The hardware domain may not use all the re-distributors +* regions (e.g when the number of vCPUs does not match the +* number of pCPUs). Update the number of regions to avoid +* exposing unused region as they will not get emulated. +*/ + d->arch.vgic.nr_regions = i +1 ; + d->arch.vgic.intid_bits = vgic_v3_hw.intid_bits; }else @@ -1825,7 +1840,7 @@ int vgic_v3_init(struct domain *d, int *mmio_count) }/* GICD region + number of Redistributors */ - *mmio_count =vgic_v3_rdist_count (d) +1 ; + *mmio_count =vgic_v3_max_rdist_count (d) +1 ;/* one region per ITS */ *mmio_count +=vgic_v3_its_count (d);
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 3/3 tools/libxl: Switch Arm guest type to PVH
In reply to Julien GrallCurrently, the toolstack is considering Arm guest always PV. However, they are very similar to PVH because HW virtualization extension are used and QEMU is not started. So switch Arm guest type to PVH.
To keep compatibility with toolstack creating Arm guest with PV type (e.g libvirt), libxl will now convert those guests to PVH.
Furthermore, the default type for Arm in xl will now be PVH to allow smooth transition for user.
---
This was discussed at Xen Summit and also in various thread on xen-devel. The latest one was when Andrew sent a patch to deny guest creation on Arm with XEN_DOMCTL_CDF_hap unset.
I suspect we first implemented Arm guest as PV in libxl because PVH was non-existent and the type was easier to avoid spawning QEMU. Note that Linux and Xen are already considering Arm guest as PVH.
Changes in v3:
- Properly reset u.pvh
- Update documentation and print
- Return ERROR_INVAL rather than ERROR_FAIL
Changes in v2:
- Rather than denying PV guest, convert them to PVH
--- docs/man/xl.cfg.pod.5.in | 5 +++-- tools/libxl/libxl_arch.h | 3 ++- tools/libxl/libxl_arm.c | 26 ++++++++++++++++++++++++-- tools/libxl/libxl_create.c | 2 +- tools/libxl/libxl_x86.c | 3 ++- tools/xl/xl_parse.c | 4 ++++ 6 files changed, 36 insertions(+), 7 deletions(-)
docs/man/xl.cfg.pod.5.in +3 -2
@@ -80,13 +80,14 @@ single host must be unique. =item B<type="pv"> Specifies that this is to be a PV domain, suitable for hosting Xen-aware -guest operating systems. This is the default. +guest operating systems. This is the default on x86. =item B<type="pvh"> Specifies that this is to be an PVH domain. That is a lightweight HVM-like guest without a device model and without many of the emulated devices -available to HVM guests. Note that this mode requires a PVH aware kernel. +available to HVM guests. Note that this mode requires a PVH aware kernel on +x86. This is the default on Arm. =item B<type="hvm">
tools/libxl/libxl_arch.h +2 -1
@@ -65,7 +65,8 @@ _hiddenint libxl__arch_domain_map_irq (libxl__gc *gc,uint32_t domid,int irq);_hidden -void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info); +void libxl__arch_domain_build_info_setdefault(libxl__gc *gc, +libxl_domain_build_info *b_info); _hidden int libxl__arch_extra_memory(libxl__gc *gc,
tools/libxl/libxl_arm.c +24 -2
@@ -953,7 +953,11 @@ int libxl__arch_domain_init_hw_description(libxl__gc *gc,int rc;uint64_t val; -assert (info->type ==LIBXL_DOMAIN_TYPE_PV ); +if (info->type !=LIBXL_DOMAIN_TYPE_PVH ) { +LOG (ERROR ,"Unsupported Arm guest type %s" , +libxl_domain_type_to_string (info->type)); +return ERROR_INVAL ; + }/* Set the value of domain param HVM_PARAM_CALLBACK_IRQ. */ val = MASK_INSR(HVM_PARAM_CALLBACK_TYPE_PPI,
@@ -1110,10 +1114,28 @@ int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq)return xc_domain_bind_pt_spi_irq (CTX ->xch, domid, irq, irq); } -void libxl__arch_domain_build_info_setdefault (libxl_domain_build_info *b_info) +void libxl__arch_domain_build_info_setdefault (libxl__gc *gc, +libxl_domain_build_info *b_info) {/* ACPI is disabled by default */ libxl_defbool_setdefault (&b_info->acpi, false); + +/* +* Arm guest are now considered as PVH by the toolstack. To allow +* compatibility with previous toolstack, PV guest are automatically +* converted to PVH. +*/ +if (b_info->type !=LIBXL_DOMAIN_TYPE_PV ) +return ; + +LOG (WARN ,"Converting PV guest to PVH." ); +LOG (WARN ,"Arm guest are now PVH." ); +LOG (WARN ,"Please fix your configuration file/toolstack." ); + +/* Re-initialize type to PVH and all associated fields to defaults. */ +memset (&b_info->u,'\0' ,sizeof (b_info->u)); + b_info->type =LIBXL_DOMAIN_TYPE_INVALID ; +libxl_domain_build_info_init_type (b_info,LIBXL_DOMAIN_TYPE_PVH ); }/*
tools/libxl/libxl_create.c +1 -1
@@ -215,7 +215,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,if (!b_info->event_channels) b_info->event_channels =1023 ; -libxl__arch_domain_build_info_setdefault (b_info); +libxl__arch_domain_build_info_setdefault (gc, b_info);libxl_defbool_setdefault (&b_info->dm_restrict, false);switch (b_info->type) {
tools/libxl/libxl_x86.c +2 -1
@@ -613,7 +613,8 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,return rc; } -void libxl__arch_domain_build_info_setdefault (libxl_domain_build_info *b_info) +void libxl__arch_domain_build_info_setdefault (libxl__gc *gc, +libxl_domain_build_info *b_info) {libxl_defbool_setdefault (&b_info->acpi, true); }
tools/xl/xl_parse.c +4 -0
@@ -1286,7 +1286,11 @@ void parse_config_data(const char *config_source, } if (c_info->type == LIBXL_DOMAIN_TYPE_INVALID) +#if defined(__arm__) || defined(__aarch64__) + c_info->type =LIBXL_DOMAIN_TYPE_PVH ; +#else c_info->type =LIBXL_DOMAIN_TYPE_PV ; +#endif xlu_cfg_get_defbool (config,"hap" , &c_info->hap,0 );
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 11 lines · Julien Grall
Currently, the toolstack is considering Arm guest always PV. However, they are very similar to PVH because HW virtualization extension are used and QEMU is not started. So switch Arm guest type to PVH.
To keep compatibility with toolstack creating Arm guest with PV type (e.g libvirt), libxl will now convert those guests to PVH.
Furthermore, the default type for Arm in xl will now be PVH to allow smooth transition for user.
Signed-off-by Julien Grall <[email protected]>
Quoted 94 lines
---
This was discussed at Xen Summit and also in various thread on xen-devel. The latest one was when Andrew sent a patch to deny guest creation on Arm with
XEN_DOMCTL_CDF_hapunset.I suspect we first implemented Arm guest as PV in libxl because PVH was non-existent and the type was easier to avoid spawning QEMU. Note that Linux and Xen are already considering Arm guest as PVH.
Changes in v3:
- Properly reset u.pvh
- Update documentation and print
- ReturnERROR_INVALrather thanERROR_FAILChanges in v2:
- Rather than denying PV guest, convert them to PVH--- docs/man/xl.cfg.pod.5.in | 5 +++-- tools/libxl/libxl_arch.h | 3 ++- tools/libxl/libxl_arm.c | 26 ++++++++++++++++++++++++-- tools/libxl/libxl_create.c | 2 +- tools/libxl/libxl_x86.c | 3 ++- tools/xl/xl_parse.c | 4 ++++ 6 files changed, 36 insertions(+), 7 deletions(-)docs/man/xl.cfg.pod.5.in +3
-2@@ -80,13 +80,14 @@ single host must be unique. =item B<type="pv"> Specifies that this is to be a PV domain, suitable for hosting Xen-aware -guest operating systems. This is the default. +guest operating systems. This is the default on x86. =item B<type="pvh"> Specifies that this is to be an PVH domain. That is a lightweight HVM-like guest without a device model and without many of the emulated devices -available to HVM guests. Note that this mode requires a PVH aware kernel. +available to HVM guests. Note that this mode requires a PVH aware kernel on +x86. This is the default on Arm. =item B<type="hvm">tools/libxl/libxl_arch.h +2
-1@@ -65,7 +65,8 @@ _hiddenint libxl__arch_domain_map_irq (libxl__gc *gc,uint32_t domid,int irq);_hidden -void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info); +void libxl__arch_domain_build_info_setdefault(libxl__gc *gc, +libxl_domain_build_info *b_info); _hidden int libxl__arch_extra_memory(libxl__gc *gc,tools/libxl/libxl_arm.c +12
-2@@ -953,7 +953,11 @@ int libxl__arch_domain_init_hw_description(libxl__gc *gc,int rc;uint64_t val; -assert (info->type ==LIBXL_DOMAIN_TYPE_PV ); +if (info->type !=LIBXL_DOMAIN_TYPE_PVH ) { +LOG (ERROR ,"Unsupported Arm guest type %s" , +libxl_domain_type_to_string (info->type)); +return ERROR_INVAL ; + }/* Set the value of domain param HVM_PARAM_CALLBACK_IRQ. */ val = MASK_INSR(HVM_PARAM_CALLBACK_TYPE_PPI,@@ -1110,10 +1114,28 @@ int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq)return xc_domain_bind_pt_spi_irq (CTX ->xch, domid, irq, irq); } -void libxl__arch_domain_build_info_setdefault (libxl_domain_build_info *b_info) +void libxl__arch_domain_build_info_setdefault (libxl__gc *gc, +libxl_domain_build_info *b_info) {/* ACPI is disabled by default */ libxl_defbool_setdefault (&b_info->acpi, false); + +/* +* Arm guest are now considered as PVH by the toolstack. To allow +* compatibility with previous toolstack, PV guest are automatically +* converted to PVH.
tools/libxl/libxl_arm.c int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq) · line 1136
Quoted 10 lines
tools/libxl/libxl_arm.c +10
-0+*/ +if (b_info->type !=LIBXL_DOMAIN_TYPE_PV ) +return ; + +LOG (WARN ,"Converting PV guest to PVH." ); +LOG (WARN ,"Arm guest are now PVH." ); +LOG (WARN ,"Please fix your configuration file/toolstack." ); + +/* Re-initialize type to PVH and all associated fields to defaults. */ +memset (&b_info->u,'\0' ,sizeof (b_info->u));
I don't really like the zeroing done here, but I think it's fine as long as it's only done when converting from PV -> PVH and after copying the deprecated fields.
Thansk, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi Roger,
Quoted 115 lines · Roger Pau Monné
Quoted 11 lines · Julien Grall
Currently, the toolstack is considering Arm guest always PV. However, they are very similar to PVH because HW virtualization extension are used and QEMU is not started. So switch Arm guest type to PVH.
To keep compatibility with toolstack creating Arm guest with PV type (e.g libvirt), libxl will now convert those guests to PVH.
Furthermore, the default type for Arm in xl will now be PVH to allow smooth transition for user.
Signed-off-by Julien Grall <[email protected]>Reviewed-by Roger Pau Monné <[email protected]>Quoted 100 lines
---
This was discussed at Xen Summit and also in various thread on xen-devel. The latest one was when Andrew sent a patch to deny guest creation on Arm with
XEN_DOMCTL_CDF_hapunset.I suspect we first implemented Arm guest as PV in libxl because PVH was non-existent and the type was easier to avoid spawning QEMU. Note that Linux and Xen are already considering Arm guest as PVH.
Changes in v3:
- Properly reset u.pvh
- Update documentation and print
- ReturnERROR_INVALrather thanERROR_FAILChanges in v2:
- Rather than denying PV guest, convert them to PVH--- docs/man/xl.cfg.pod.5.in | 5 +++-- tools/libxl/libxl_arch.h | 3 ++- tools/libxl/libxl_arm.c | 26 ++++++++++++++++++++++++-- tools/libxl/libxl_create.c | 2 +- tools/libxl/libxl_x86.c | 3 ++- tools/xl/xl_parse.c | 4 ++++ 6 files changed, 36 insertions(+), 7 deletions(-)docs/man/xl.cfg.pod.5.in +3
-2@@ -80,13 +80,14 @@ single host must be unique. =item B<type="pv"> Specifies that this is to be a PV domain, suitable for hosting Xen-aware -guest operating systems. This is the default. +guest operating systems. This is the default on x86. =item B<type="pvh"> Specifies that this is to be an PVH domain. That is a lightweight HVM-like guest without a device model and without many of the emulated devices -available to HVM guests. Note that this mode requires a PVH aware kernel. +available to HVM guests. Note that this mode requires a PVH aware kernel on +x86. This is the default on Arm. =item B<type="hvm">tools/libxl/libxl_arch.h +2
-1@@ -65,7 +65,8 @@ _hiddenint libxl__arch_domain_map_irq (libxl__gc *gc,uint32_t domid,int irq);_hidden -void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info); +void libxl__arch_domain_build_info_setdefault(libxl__gc *gc, +libxl_domain_build_info *b_info); _hidden int libxl__arch_extra_memory(libxl__gc *gc,tools/libxl/libxl_arm.c +18
-2@@ -953,7 +953,11 @@ int libxl__arch_domain_init_hw_description(libxl__gc *gc,int rc;uint64_t val; -assert (info->type ==LIBXL_DOMAIN_TYPE_PV ); +if (info->type !=LIBXL_DOMAIN_TYPE_PVH ) { +LOG (ERROR ,"Unsupported Arm guest type %s" , +libxl_domain_type_to_string (info->type)); +return ERROR_INVAL ; + }/* Set the value of domain param HVM_PARAM_CALLBACK_IRQ. */ val = MASK_INSR(HVM_PARAM_CALLBACK_TYPE_PPI,@@ -1110,10 +1114,28 @@ int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq)return xc_domain_bind_pt_spi_irq (CTX ->xch, domid, irq, irq); } -void libxl__arch_domain_build_info_setdefault (libxl_domain_build_info *b_info) +void libxl__arch_domain_build_info_setdefault (libxl__gc *gc, +libxl_domain_build_info *b_info) {/* ACPI is disabled by default */ libxl_defbool_setdefault (&b_info->acpi, false); + +/* +* Arm guest are now considered as PVH by the toolstack. To allow +* compatibility with previous toolstack, PV guest are automatically +* converted to PVH. +*/ +if (b_info->type !=LIBXL_DOMAIN_TYPE_PV ) +return ; + +LOG (WARN ,"Converting PV guest to PVH." ); +LOG (WARN ,"Arm guest are now PVH." );
Quoted 8 lines
tools/libxl/libxl_arm.c int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq) · line 1136
Quoted 4 lines
tools/libxl/libxl_arm.c +4
-0+LOG (WARN ,"Please fix your configuration file/toolstack." ); + +/* Re-initialize type to PVH and all associated fields to defaults. */ +memset (&b_info->u,'\0' ,sizeof (b_info->u));I don't really like the zeroing done here, but I think it's fine as long as it's only done when converting from PV -> PVH and after copying the deprecated fields.
I don't think we can safely avoid to re-initialize b_info->u. Some fields in u.pv are not initialized to 0 (e.g slack_memkb is initialized to ~0ULL). So you will transfer that value over to pvh union and altering the init values for PVH.
Furthermore, PVH fields may not be initialized to 0 (so far it is not the case). So the memset here will ensure that all fields are 0, then libxl_domain_build_info_init_type() will setup init value for non-zero fields.
libxl__arch_domain_build_info_setdefault is called after deprecated fields are copied and soon enough to not handle specific Guest type default.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 11 lines · Julien Grall
Currently, the toolstack is considering Arm guest always PV. However, they are very similar to PVH because HW virtualization extension are used and QEMU is not started. So switch Arm guest type to PVH.
To keep compatibility with toolstack creating Arm guest with PV type (e.g libvirt), libxl will now convert those guests to PVH.
Furthermore, the default type for Arm in xl will now be PVH to allow smooth transition for user.
Signed-off-by Julien Grall <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel