From: Julien Grall <julien.grall@citrix.com>
To: Chen Baozi <cbz@baozis.org>, xen-devel@lists.xenproject.org
Cc: Julien Grall <julien.grall@citrix.com>,
Chen Baozi <baozich@gmail.com>,
Ian Campbell <ian.campbell@citrix.com>
Subject: Re: [PATCH V2 3/8] xen/arm: Add funtions of mapping between vCPUID and vMPIDR
Date: Sat, 23 May 2015 19:36:49 +0100 [thread overview]
Message-ID: <5560C8C1.3030504@citrix.com> (raw)
In-Reply-To: <1432389153-28207-4-git-send-email-cbz@baozis.org>
Hi Chen,
Title: s/funtions/functions/
On 23/05/2015 14:52, Chen Baozi wrote:
> From: Chen Baozi <baozich@gmail.com>
>
> GICv3 restricts that the maximum number of CPUs in affinity 0 (one
> cluster) is 16. That is to say the upper 4 bits of affinity 0 is unused.
> Current implementation considers that AFF0 is equal to vCPUID, which
> makes all vCPUs in one cluster, limiting its number to 16. If we would
> like to support more than 16 number of vCPU in one guest, we need to
> make use of AFF1. Considering the unused upper 4 bits, we need to create
> a pair of functions mapping the vCPUID and vMPIDR.
The functions you are adding don't deal with the vMPIDR but only a part
of it used for the affinity.
I would rename the title and modify this last sentence to reflect it.
> Signed-off-by: Chen Baozi <baozich@gmail.com>
> ---
> xen/include/asm-arm/domain.h | 34 ++++++++++++++++++++++++++++++++++
> 1 file changed, 34 insertions(+)
>
> diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
> index 75b17af..9d3e406 100644
> --- a/xen/include/asm-arm/domain.h
> +++ b/xen/include/asm-arm/domain.h
> @@ -266,6 +266,40 @@ static inline unsigned int domain_max_vcpus(const struct domain *d)
> return MAX_VIRT_CPUS;
> }
>
> +/*
> + * Due to the restriction of GICv3, the number of vCPUs in AFF0 is
> + * limited to 16, thus only the first 4 bits of AFF0 are legal. We will
> + * use the first 2 affinity levels here, expanding the number of vCPU up
> + * to 4096 (16*256), which is more than 128 PEs that GIC-500 supports.
> + *
> + * Since we don't save information of vCPU's topology (affinity) in
> + * vMPIDR at the moment, we map the vcpuid to the vMPIDR linearly.
> + *
> + * XXX: May have multi-threading or virtual cluster information in the
We may have ...
> + * future.
> + */
> +static inline unsigned int vaffinity_to_vcpuid(register_t vaff)
> +{
> + unsigned int vcpuid;
> +
> + vaff &= MPIDR_HWID_MASK;
> +
> + vcpuid = (vaff >> MPIDR_LEVEL_SHIFT(0)) & 0x0f;
You can use MPIDR_AFFINITY_LEVEL(0)
> + vcpuid |= ((vaff >> MPIDR_LEVEL_SHIFT(1)) & 0xff) << 4;
Same here with 1.
> + return vcpuid;
> +}
> +
> +static inline register_t vcpuid_to_vaffinity(unsigned int vcpuid)
> +{
> + register_t vaff;
I would add a BUILD_BUG_ON(MAX_VIRT_CPUS < ((1 << 12))) in order to
catch MAX_VIRT_CPUS increasing without changing the mapping between the
VCPU ID and the affinity.
> + vaff = (vcpuid & 0x0f) << MPIDR_LEVEL_SHIFT(0);
> + vaff |= ((vcpuid >> 4) & 0xff) << MPIDR_LEVEL_SHIFT(1);
s/0xff/MPIDR_LEVEL_MASK/
> +
> + return vaff;
> +}
> +
> #endif /* __ASM_DOMAIN_H__ */
>
> /*
>
Regards,
--
Julien Grall
next prev parent reply other threads:[~2015-05-23 18:36 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-23 13:52 [PATCH V2 0/8] Support more than 8 vcpus on arm64 with GICv3 Chen Baozi
2015-05-23 13:52 ` [PATCH V2 1/8] xen/arm64: increase MAX_VIRT_CPUS to 128 on arm64 Chen Baozi
2015-05-23 14:46 ` Julien Grall
2015-05-25 1:01 ` Chen Baozi
2015-05-25 9:46 ` Julien Grall
2015-05-23 13:52 ` [PATCH V2 2/8] xen/arm: gic-v3: Increase the size of GICR in address space for guest Chen Baozi
2015-05-23 14:48 ` Julien Grall
2015-05-23 13:52 ` [PATCH V2 3/8] xen/arm: Add funtions of mapping between vCPUID and vMPIDR Chen Baozi
2015-05-23 18:36 ` Julien Grall [this message]
2015-05-23 13:52 ` [PATCH V2 4/8] xen/arm: Use the new mapping relations " Chen Baozi
2015-05-24 12:51 ` Julien Grall
2015-05-25 2:34 ` Chen Baozi
2015-05-25 9:53 ` Julien Grall
2015-05-23 13:52 ` [PATCH V2 5/8] xen/arm: vGIC: Consider AFF1 when injecting SGI Chen Baozi
2015-05-26 14:36 ` Julien Grall
2015-05-23 13:52 ` [PATCH V2 6/8] tools/libxl: Make DT node of GICv3 according to max_vcpus Chen Baozi
2015-05-26 14:40 ` Julien Grall
2015-05-23 13:52 ` [PATCH V2 7/8] tools/libxl: Set logical CPUID in DT node equal to MPIDR for domU Chen Baozi
2015-05-26 14:48 ` Julien Grall
2015-05-23 13:52 ` [PATCH V2 8/8] xen/arm: Set logical CPUID in DT node for dom0 the same as MPIDR Chen Baozi
2015-05-26 14:50 ` Julien Grall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5560C8C1.3030504@citrix.com \
--to=julien.grall@citrix.com \
--cc=baozich@gmail.com \
--cc=cbz@baozis.org \
--cc=ian.campbell@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.