From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chen Baozi Subject: Re: [PATCH V5 05/10] xen/arm64: gicv3: Use AFF1 when translating ICC_SGI1R_EL1 to cpumask Date: Sat, 30 May 2015 19:15:38 +0800 Message-ID: <20150530111538.GA10939@cbz-thinkpad> References: <1432984051-10838-1-git-send-email-cbz@baozis.org> <1432984051-10838-6-git-send-email-cbz@baozis.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YzDim-0007tv-1w for xen-devel@lists.xenproject.org; Mon, 01 Jun 2015 00:36:52 +0000 Received: by pablj1 with SMTP id lj1so11652060pab.3 for ; Sun, 31 May 2015 17:36:48 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1432984051-10838-6-git-send-email-cbz@baozis.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Julien Grall , Ian Campbell List-Id: xen-devel@lists.xenproject.org On Sat, May 30, 2015 at 07:07:26PM +0800, Chen Baozi wrote: > From: Chen Baozi > > To support more than 16 vCPUs, we have to calculate cpumask with AFF1 > field value in ICC_SGI1R_EL1. > > Signed-off-by: Chen Baozi > --- > xen/arch/arm/vgic-v3.c | 9 ++++++++- > xen/include/asm-arm/gic_v3_defs.h | 3 +++ > 2 files changed, 11 insertions(+), 1 deletion(-) > > diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c > index a283c8c..21d8d3f 100644 > --- a/xen/arch/arm/vgic-v3.c > +++ b/xen/arch/arm/vgic-v3.c > @@ -976,10 +976,17 @@ static inline void gicv3_sgir_to_cpumask(cpumask_t *cpumask, > const register_t sgir) > { > unsigned long target_list; > + int aff1; > > target_list = sgir & ICH_SGI_TARGETLIST_MASK; > - bitmap_copy(cpumask_bits(cpumask), &target_list, ICH_SGI_TARGET_BITS); > + /* We assume that only AFF1 is used in ICC_SGI1R_EL1. */ > + aff1 = (sgir >> ICH_SGI_AFFINITY_LEVEL(1)) & ICH_SGI_AFFx_MASK; > > + BUILD_BUG_ON(sizeof(cpumask_t)*8 < MAX_VIRT_CPUS); > + BUG_ON(((aff1+1) * ICH_SGI_TARGET_BITS) > NR_CPUS); > + > + memcpy((uint16_t *)cpumask + aff1, &target_list, > + (ICH_SGI_TARGET_BITS/8)); > } > > static int vgic_v3_to_sgi(struct vcpu *v, register_t sgir) > diff --git a/xen/include/asm-arm/gic_v3_defs.h b/xen/include/asm-arm/gic_v3_defs.h > index e106e67..3743e66 100644 > --- a/xen/include/asm-arm/gic_v3_defs.h > +++ b/xen/include/asm-arm/gic_v3_defs.h > @@ -153,6 +153,9 @@ > #define ICH_SGI_IRQ_MASK 0xf > #define ICH_SGI_TARGETLIST_MASK 0xffff > #define ICH_SGI_TARGET_BITS 16 > +#define ICH_SGI_AFFx_MASK 0xff > +#define ICH_SGI_AFFINITY_LEVEL(x) (16 * (x)) > + ^^ Sorry for the unnecessary trailing line... Baozi.