On 09/10/18 12:23, Julien Grall wrote: > On 05/10/2018 15:54, Andrew Cooper wrote: >> --- >> xen/arch/arm/domain.c | 18 ++++++++++++++++++ >> xen/arch/x86/domain.c | 6 ++++++ >> xen/common/domain.c | 3 +++ >> 3 files changed, 27 insertions(+) >> >> diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c >> index 43593a4..9676893 100644 >> --- a/xen/arch/arm/domain.c >> +++ b/xen/arch/arm/domain.c >> @@ -601,6 +601,8 @@ void vcpu_switch_to_aarch64_mode(struct vcpu *v) >> int arch_check_domain_config(struct xen_domctl_createdomain *config) >> { >> + unsigned int max_vcpus = 0; >> + >> /* Fill in the native GIC version, passed back to the >> toolstack. */ >> if ( config->arch.gic_version == XEN_DOMCTL_CONFIG_GIC_NATIVE ) >> { >> @@ -619,6 +621,22 @@ int arch_check_domain_config(struct >> xen_domctl_createdomain *config) >> } >> } >> + /* Calculate the maximum number of vcpus from the selected GIC >> version... */ >> + switch ( config->arch.gic_version ) >> + { >> + case GIC_V2: max_vcpus = 8; break; >> + case GIC_V3: max_vcpus = 255; break; >> + >> + default: >> + return -EOPNOTSUPP; >> + } > > I would prefer to keep those values in a separate helper implemented > by each vGIC.
How do you intend that working? The values can't be hooked off a GIC object, because we don't have one yet. > >> + >> + /* ... clipped at the maximum value Xen has been configured for. */ >> + max_vcpus = min(max_vcpus, MAX_VIRT_CPUS + 0u); > > + 0U feels a bit odd to read. It would be better to append u in > MAX_VIRT_CPUS. Will do. ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel