xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Frediano Ziglio <frediano.ziglio@huawei.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@citrix.com>,
	Tim Deegan <tim@xen.org>
Cc: zoltan.kiss@huawei.com, xen-devel@lists.xen.org
Subject: Re: [PATCH v2 3/7] xen/arm: Make gic-v2 code handle hip04-d01 platform
Date: Tue, 04 Nov 2014 13:34:14 +0000	[thread overview]
Message-ID: <5458D5D6.9090903@linaro.org> (raw)
In-Reply-To: <5458D54F.10007@linaro.org>

On 11/04/2014 01:31 PM, Julien Grall wrote:
> On 11/03/2014 04:46 PM, Frediano Ziglio wrote:
>> The GIC in this platform is mainly compatible with the standard
>> GICv2 beside:
>> - ITARGET is extended to 16 bit to support 16 CPUs;
>> - SGI mask is extended to support 16 CPUs;
>> - maximum supported interrupt is 510.
>>
>> Signed-off-by: Frediano Ziglio <frediano.ziglio@huawei.com>
>> Signed-off-by: Zoltan Kiss <zoltan.kiss@huawei.com>
>> ---
>>  xen/arch/arm/gic-v2.c     | 89 +++++++++++++++++++++++++++++++++++++++--------
>>  xen/arch/arm/gic.c        |  3 +-
>>  xen/include/asm-arm/gic.h |  4 ++-
>>  3 files changed, 80 insertions(+), 16 deletions(-)
>>
>> diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c
>> index faad1ff..9461fe3 100644
>> --- a/xen/arch/arm/gic-v2.c
>> +++ b/xen/arch/arm/gic-v2.c
>> @@ -79,16 +79,23 @@ static struct gic_info gicv2_info;
>>   * logical CPU numbering. Let's use mapping as returned by the GIC
>>   * itself
>>   */
>> -static DEFINE_PER_CPU(u8, gic_cpu_id);
>> +static DEFINE_PER_CPU(u16, gic_cpu_id);
>>  
>>  /* Maximum cpu interface per GIC */
>> -#define NR_GIC_CPU_IF 8
>> +static unsigned int nr_gic_cpu_if = 8;
>> +static unsigned int gicd_sgi_target_shift = GICD_SGI_TARGET_SHIFT;
>> +static unsigned int gic_cpu_mask = 0xff;
>>  
>>  static inline void writeb_gicd(uint8_t val, unsigned int offset)
>>  {
>>      writeb_relaxed(val, gicv2.map_dbase + offset);
>>  }
>>  
>> +static inline void writew_gicd(uint16_t val, unsigned int offset)
>> +{
>> +    writew_relaxed(val, gicv2.map_dbase + offset);
>> +}
>> +
>>  static inline void writel_gicd(uint32_t val, unsigned int offset)
>>  {
>>      writel_relaxed(val, gicv2.map_dbase + offset);
>> @@ -132,7 +139,7 @@ static unsigned int gicv2_cpu_mask(const cpumask_t *cpumask)
>>      cpumask_and(&possible_mask, cpumask, &cpu_possible_map);
>>      for_each_cpu( cpu, &possible_mask )
>>      {
>> -        ASSERT(cpu < NR_GIC_CPU_IF);
>> +        ASSERT(cpu < nr_gic_cpu_if);
>>          mask |= per_cpu(gic_cpu_id, cpu);
>>      }
>>  
>> @@ -203,6 +210,15 @@ static unsigned int gicv2_read_irq(void)
>>      return (readl_gicc(GICC_IAR) & GICC_IA_IRQ);
>>  }
>>  
>> +/* Set target CPU mask (RAZ/WI on uniprocessor) */
>> +static void gicv2_set_irq_mask(int irq, unsigned int mask)
>> +{
>> +    if ( nr_gic_cpu_if == 16 )
> 
> This check is very confusing, and even more in patch #5.

Sorry, I meant #7.

> Code executed under this check describes your platform and not a generic
> 16-CPU support (actually there is no spec for it).
> 
> I would introduce a new boolean or hide this check in a macro.
> 
>> diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
>> index 70d10d6..8050a65 100644
>> --- a/xen/arch/arm/gic.c
>> +++ b/xen/arch/arm/gic.c
>> @@ -563,12 +563,13 @@ static void do_sgi(struct cpu_user_regs *regs, enum gic_sgi sgi)
>>  void gic_interrupt(struct cpu_user_regs *regs, int is_fiq)
>>  {
>>      unsigned int irq;
>> +    unsigned int max_irq = gic_hw_ops->info->nr_lines;
>>  
>>      do  {
>>          /* Reading IRQ will ACK it */
>>          irq = gic_hw_ops->read_irq();
>>  
>> -        if ( likely(irq >= 16 && irq < 1021) )
>> +        if ( likely(irq >= 16 && irq < max_irq) )
> 
> On the previous version I've asked that need to explain in the commit
> message why this change is valid.
> 
> Regards,
> 


-- 
Julien Grall

  reply	other threads:[~2014-11-04 13:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-03 16:46 xen/arm: Add support for Huawei hip04-d01 platform Frediano Ziglio
2014-11-03 16:46 ` [PATCH v2 1/7] xen/device_tree: Add new helper to read arrays from a DTB Frediano Ziglio
2014-11-04 13:14   ` Julien Grall
2014-11-04 13:55     ` Frediano Ziglio
2014-11-04 14:00       ` Julien Grall
2014-11-03 16:46 ` [PATCH v2 2/7] xen/arm: Implement hip04-d01 platform Frediano Ziglio
2014-11-04 13:21   ` Julien Grall
2014-11-04 13:52     ` Frediano Ziglio
2014-11-04 14:03       ` Julien Grall
2014-11-04 14:17         ` Frediano Ziglio
2014-11-04 14:23           ` Julien Grall
2014-11-03 16:46 ` [PATCH v2 3/7] xen/arm: Make gic-v2 code handle " Frediano Ziglio
2014-11-04 13:31   ` Julien Grall
2014-11-04 13:34     ` Julien Grall [this message]
2014-11-04 15:54     ` Frediano Ziglio
2014-11-04 13:35   ` Julien Grall
2014-11-03 16:46 ` [PATCH v2 4/7] xen/arm: Add support for DTBs with strange names of Hip04 GICv2 Frediano Ziglio
2014-11-03 16:46 ` [PATCH v2 5/7] xen/arm: handle GICH register changes for hip04-d01 platform Frediano Ziglio
2014-11-03 16:46 ` [PATCH v2 6/7] xen/arm: Force domains to use normal GICv2 driver on Hip04 platform Frediano Ziglio
2014-11-04 13:33   ` Julien Grall
2014-11-04 14:10     ` Frediano Ziglio
2014-11-03 16:46 ` [PATCH v2 7/7] xen/arm: Move vGIC registers " Frediano Ziglio
2014-11-04 13:38   ` Julien Grall
2014-11-04 14:42     ` Frediano Ziglio
2014-11-04 14:50       ` Ian Campbell
2014-11-04 15:48         ` Frediano Ziglio

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=5458D5D6.9090903@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=frediano.ziglio@huawei.com \
    --cc=ian.campbell@citrix.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    --cc=zoltan.kiss@huawei.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).