All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <ian.campbell@citrix.com>, xen-devel@lists.xen.org
Cc: tim@xen.org, stefano.stabellini@eu.citrix.com
Subject: Re: [PATCH 2/2] xen: arm: Warn if timer interrupts are not level triggered
Date: Thu, 19 Feb 2015 15:41:16 +0000	[thread overview]
Message-ID: <54E6041C.6020300@linaro.org> (raw)
In-Reply-To: <1424359443-21584-2-git-send-email-ian.campbell@citrix.com>

Hi Ian,

On 19/02/15 15:24, Ian Campbell wrote:
> Edge trigger arch timer interrupts really don't make much sense, so if
> we discover we are booting on such a system issue a warning.
> 
> So far this has only been seen on the fast model emulators which have
> both an incorrect DT description of the interrupt and a writeable
> ICFGR allowing us to program the incorrect configuration. Other
> platforms have incorrect DT descriptions (warned about by previous
> patch) but the corresponding ICFGR isn't actually writeable so the
> eventual configuration is level as desired.
> 
> I did consider overriding the incorrect DT on such systems but since
> so far it has only been observed on emulators and we have code in
> place to deal with edge triggering here I think warning is sufficient
> for now.
> 
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> ---
>  xen/arch/arm/time.c |   30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
> index 418748d..7304cd8 100644
> --- a/xen/arch/arm/time.c
> +++ b/xen/arch/arm/time.c
> @@ -198,6 +198,32 @@ static void vtimer_interrupt(int irq, void *dev_id, struct cpu_user_regs *regs)
>      vgic_vcpu_inject_irq(current, current->arch.virt_timer.irq);
>  }
>  
> +/*
> + * Arch timer interrupt really ought to be level triggered, since the
> + * design of the timer/comparator mechanism is based around that
> + * concept.
> + *
> + * However some firmware (incorrectly) describes the interrupts as
> + * edge triggered and, worse, some hardware allows us to program the
> + * interrupt contoller as edge triggered.

controller

> + *
> + * Check each interrupt and warn if we find ourselves in this situation.
> + */

Based on the comment, would it make sense to override the type of
interrupt to level in anycase? Even if the GIC allows us to write on ICFGR.

> +static void check_timer_irq_cfg(unsigned int irq, const char *which)
> +{
> +    struct irq_desc *desc = irq_to_desc(irq);
> +
> +    /*
> +     * The interrupt contoller driver will update desc->arch.type with

controller

> +     * the actual type which ended up configured in the hardware.
> +     */
> +    if ( desc->arch.type & DT_IRQ_TYPE_LEVEL_LOW )
> +        return;
> +
> +    printk(XENLOG_WARNING
> +           "WARNING: %s-timer IRQ%u is not level triggered.\n", which, irq);
> +}
> +
>  /* Set up the timer interrupt on this CPU */
>  void __cpuinit init_timer_interrupt(void)
>  {
> @@ -215,6 +241,10 @@ void __cpuinit init_timer_interrupt(void)
>                     "virtimer", NULL);
>      request_irq(timer_irq[TIMER_PHYS_NONSECURE_PPI], 0, timer_interrupt,
>                  "phytimer", NULL);
> +
> +    check_timer_irq_cfg(timer_irq[TIMER_HYP_PPI], "hypervisor");
> +    check_timer_irq_cfg(timer_irq[TIMER_VIRT_PPI], "virtual");
> +    check_timer_irq_cfg(timer_irq[TIMER_PHYS_NONSECURE_PPI], "NS-physical");
>  }
>  
>  /* Wait a set number of microseconds */
> 

Regards,


-- 
Julien Grall

  reply	other threads:[~2015-02-19 15:41 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-19 15:39 [PATCH 0/2] xen: arm: warn for gic and arch timer misconfiguration Ian Campbell
2015-02-19 15:24 ` [PATCH 1/2] xen: arm: log warning for interrupt configuration mismatch Ian Campbell
2015-02-19 15:45   ` Julien Grall
2015-02-28 22:12   ` Julien Grall
2015-03-02 11:12     ` Ian Campbell
2015-03-02 12:56       ` Julien Grall
2015-03-02 13:42         ` Ian Campbell
2015-03-02 13:48           ` Julien Grall
2015-03-02 13:53             ` Ian Campbell
2015-03-02 14:02               ` Julien Grall
2015-03-02 14:41                 ` Ian Campbell
2015-03-02 17:01         ` Ian Campbell
2015-03-03 12:20           ` Julien Grall
2015-02-19 15:24 ` [PATCH 2/2] xen: arm: Warn if timer interrupts are not level triggered Ian Campbell
2015-02-19 15:41   ` Julien Grall [this message]
2015-02-19 16:10     ` Ian Campbell
2015-02-19 16:20       ` Julien Grall
2015-02-25 14:36         ` Ian Campbell
2015-02-28 22:20   ` Julien Grall
2015-03-02 11:13     ` Ian Campbell

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=54E6041C.6020300@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=ian.campbell@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.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.