All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@citrix.com>
To: Sander Bogaert <sander.bogaert@elis.ugent.be>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	"Tim (Xen.org)" <tim@xen.org>,
	Ian Campbell <Ian.Campbell@citrix.com>,
	Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Subject: Re: [PATCH v3 04/13] xen/arm: support for guest SGI
Date: Fri, 26 Apr 2013 14:28:24 +0100	[thread overview]
Message-ID: <517A80F8.9050804@citrix.com> (raw)
In-Reply-To: <CANO7gZdUq3x6Fvpc8KQUM=jL7btsPe5Gyi-bgA0-dnyqBYF0pg@mail.gmail.com>

On 04/26/2013 01:12 PM, Sander Bogaert wrote:

> On 24 April 2013 21:07, Stefano Stabellini
> <stefano.stabellini@eu.citrix.com> wrote:
>> Trap writes to GICD_SGIR, parse the requests, inject SGIs into the right
>> guest vcpu.
>>
>> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>>
>> Changes in v3:
>> - make use of cpumask_from_bitmap.
>> ---
>>  xen/arch/arm/vgic.c       |   55 ++++++++++++++++++++++++++++++++++++++++----
>>  xen/include/asm-arm/gic.h |    3 ++
>>  2 files changed, 53 insertions(+), 5 deletions(-)
>>
>> diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
>> index b30da78..8912aab 100644
>> --- a/xen/arch/arm/vgic.c
>> +++ b/xen/arch/arm/vgic.c
>> @@ -370,6 +370,7 @@ static void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n)
>>
>>  static int vgic_distr_mmio_write(struct vcpu *v, mmio_info_t *info)
>>  {
>> +    struct domain *d = v->domain;
>>      struct hsr_dabt dabt = info->dabt;
>>      struct cpu_user_regs *regs = guest_cpu_user_regs();
>>      register_t *r = select_user_reg(regs, dabt.reg);
>> @@ -498,11 +499,55 @@ static int vgic_distr_mmio_write(struct vcpu *v, mmio_info_t *info)
>>          goto write_ignore;
>>
>>      case GICD_SGIR:
>> -        if ( dabt.size != 2 ) goto bad_width;
>> -        printk("vGICD: unhandled write %#"PRIregister" to ICFGR%d\n",
>> -               *r, gicd_reg - GICD_ICFGR);
>> -        return 0;
>> -
>> +        {
>> +            cpumask_t vcpu_mask;
>> +            int virtual_irq;
>> +            int filter;
>> +            int vcpuid;
>> +            struct vcpu *vt;
>> +            int i;
>> +            unsigned long bits;
>> +
>> +            if ( dabt.size != 2 ) goto bad_width;
>> +
>> +            filter = (*r & GICD_SGI_TARGET_LIST_MASK);
>> +            virtual_irq = (*r & GICD_SGI_INTID_MASK);
>> +
>> +            cpumask_clear(&vcpu_mask);
>> +            switch ( filter )
>> +            {
>> +                case GICD_SGI_TARGET_LIST:
>> +                    bits = (*r & GICD_SGI_TARGET_MASK) >> GICD_SGI_TARGET_SHIFT;
>> +                    vcpu_mask = cpumask_from_bitmap(&bits, 8);
>> +                    break;
>> +                case GICD_SGI_TARGET_OTHERS:
>> +                    for ( i = 0; i < d->max_vcpus; i++ )
>> +                    {
>> +                        if ( i != current->vcpu_id && d->vcpu[i] != NULL )
>> +                            cpumask_set_cpu(i, &vcpu_mask);
>> +                    }
>> +                case GICD_SGI_TARGET_SELF:
>> +                    vcpu_mask = *cpumask_of(current->vcpu_id);
>> +                    break;
>> +                default:
>> +                    printk("vGICD: unhandled GICD_SGIR write %x with wrong TargetListFilter field\n", *r);
>> +                    return 0;
>> +            }
>> +
>> +            for_each_cpu( vcpuid, &vcpu_mask )
>> +            {
>> +                if ( vcpuid >= d->max_vcpus || (vt = d->vcpu[vcpuid]) == NULL ||
>> +                        virtual_irq >= 16 )
>> +                {
>> +                    printk("vGICD: GICD_SGIR write r=%x vcpu_mask=%lx, wrong CPUTargetList\n",
>> +                           *r, *cpumask_bits(&vcpu_mask));
>> +                    return 0;
>> +                }
>> +                vgic_vcpu_inject_irq(vt, virtual_irq, 1);
>> +            }
>> +            return 1;
>> +        }
>> +
>>      case GICD_CPENDSGIR ... GICD_CPENDSGIRN:
>>          if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width;
>>          printk("vGICD: unhandled %s write %#"PRIregister" to ICPENDSGIR%d\n",
>> diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h
>> index 92711d5..4f2c8b8 100644
>> --- a/xen/include/asm-arm/gic.h
>> +++ b/xen/include/asm-arm/gic.h
>> @@ -51,12 +51,15 @@
>>  #define GICD_SPENDSGIRN (0xF2C/4)
>>  #define GICD_ICPIDR2    (0xFE8/4)
>>
>> +#define GICD_SGI_TARGET_LIST_SHIFT   (24)
>> +#define GICD_SGI_TARGET_LIST_MASK    (0x3UL << GICD_SGI_TARGET_LIST_SHIFT)
>>  #define GICD_SGI_TARGET_LIST   (0UL<<24)
>>  #define GICD_SGI_TARGET_OTHERS (1UL<<24)
>>  #define GICD_SGI_TARGET_SELF   (2UL<<24)
>>  #define GICD_SGI_TARGET_SHIFT  (16)
>>  #define GICD_SGI_TARGET_MASK   (0xFFUL<<GICD_SGI_TARGET_SHIFT)
>>  #define GICD_SGI_GROUP1        (1UL<<15)
>> +#define GICD_SGI_INTID_MASK    (0xFUL)
>>
>>  #define GICC_CTLR       (0x0000/4)
>>  #define GICC_PMR        (0x0004/4)
>> --
>> 1.7.2.5
>>
>>
> 
> Hi,
> 
> I've been running crashme ( executing random instructions ) on Xen on
> Arm installed on an Arndale board. I'm using Julien's dom0 and Xen
> branch. The Xen branch wasn't updated in a few days.
> 
> I managed to crash Xen from dom0 userspace:
> (XEN)
> (XEN) ****************************************
> (XEN) Panic on CPU 1:
> (XEN) Unhandled SGI 2 on CPU1
> (XEN) ****************************************
> (XEN)
> (XEN) Reboot in five seconds...
> 
> Tracking this back to the source:
> xen/arch/arm/gic.c:648 static void do_sgi
> xen/arch/arm/gic.c:671 void gic_interrupt
>

> From what I understood from the source all sgi's except 0 & 1
> would/will cause this panic since they are just not handled. I was
> wondering if this patch would fix that because going over it didn't
> convince me it would. The reason I'm asking and not just trying it
> because it's not easy to reproduce a crashme crash.


Could you give me the latest commit ID/tag you use? On the latest
arndale branch, SGI 2 should be handled. Xen use this SGI to call
function on another CPU.

-- 
Julien

  parent reply	other threads:[~2013-04-26 13:28 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-24 19:06 [PATCH v3 0/13] xen/arm: guest SMP support Stefano Stabellini
2013-04-24 19:07 ` [PATCH v3 01/13] xen/arm: basic PSCI support, implement cpu_on and cpu_off Stefano Stabellini
2013-04-25  9:53   ` Ian Campbell
2013-04-25 10:57     ` Stefano Stabellini
2013-04-25 11:31       ` Ian Campbell
2013-04-24 19:07 ` [PATCH v3 02/13] xen/arm: allocate secondaries dom0 vcpus Stefano Stabellini
2013-04-25 10:08   ` Ian Campbell
2013-04-26 13:23     ` Stefano Stabellini
2013-04-26 13:25       ` Ian Campbell
2013-04-24 19:07 ` [PATCH v3 03/13] xen: introduce cpumask_from_bitmap Stefano Stabellini
2013-04-25  9:24   ` Jan Beulich
2013-04-25 10:01     ` Ian Campbell
2013-04-25 14:26       ` Keir Fraser
2013-04-25 14:42         ` Ian Campbell
2013-04-25 14:44           ` Ian Campbell
2013-04-25 14:51             ` Ian Campbell
2013-04-25 15:13               ` Keir Fraser
2013-04-25 15:23                 ` Ian Campbell
2013-04-25 17:20                   ` Keir Fraser
2013-04-25 15:08             ` Stefano Stabellini
2013-04-25 15:17               ` Keir Fraser
2013-04-25 15:18               ` Jan Beulich
2013-04-25 15:17             ` Jan Beulich
2013-04-25 10:01     ` Stefano Stabellini
2013-04-25 10:08       ` Jan Beulich
2013-04-25 10:35         ` Stefano Stabellini
2013-04-25 10:49           ` Jan Beulich
2013-04-25 11:38             ` Stefano Stabellini
2013-04-25 12:49               ` Jan Beulich
2013-04-25 14:27                 ` Keir Fraser
2013-04-24 19:07 ` [PATCH v3 04/13] xen/arm: support for guest SGI Stefano Stabellini
2013-04-25 10:16   ` Ian Campbell
2013-04-25 19:03   ` Julien Grall
2013-04-26  9:05     ` Ian Campbell
2013-04-26 11:46       ` Julien Grall
2013-04-26 12:12   ` Sander Bogaert
2013-04-26 13:07     ` Stefano Stabellini
2013-04-26 13:24     ` Ian Campbell
2013-04-26 13:35       ` Julien Grall
2013-04-26 13:56         ` Sander Bogaert
2013-04-26 14:10           ` Ian Campbell
2013-04-26 13:28     ` Julien Grall [this message]
2013-04-24 19:07 ` [PATCH v3 05/13] xen/arm: early_ioremap: allocate virtual addresses from top to bottom Stefano Stabellini
2013-04-25 10:27   ` Ian Campbell
2013-04-24 19:07 ` [PATCH v3 06/13] xen/arm: implement arch_vmap_virt_end Stefano Stabellini
2013-04-25 10:29   ` Ian Campbell
2013-04-24 19:07 ` [PATCH v3 07/13] xen/arm: compile and initialize vmap Stefano Stabellini
2013-04-25 10:41   ` Ian Campbell
2013-04-25 17:04     ` Stefano Stabellini
2013-04-26  9:00       ` Ian Campbell
2013-04-26 12:02         ` Stefano Stabellini
2013-04-26 13:21           ` Ian Campbell
2013-04-24 19:07 ` [PATCH v3 08/13] xen/arm: implement map_domain_page_global and unmap_domain_page_global Stefano Stabellini
2013-04-25 10:43   ` Ian Campbell
2013-04-24 19:07 ` [PATCH v3 09/13] xen: move VCPUOP_register_vcpu_info to common code Stefano Stabellini
2013-04-25 10:45   ` Ian Campbell
2013-04-24 19:07 ` [PATCH v3 10/13] xen/arm: support VCPUOP_register_vcpu_info Stefano Stabellini
2013-04-25 10:50   ` Ian Campbell
2013-04-25 11:38     ` Stefano Stabellini
2013-04-25 11:40       ` Ian Campbell
2013-04-25 11:41         ` Stefano Stabellini
2013-04-25 14:29       ` Keir Fraser
2013-04-25 14:39         ` Ian Campbell
2013-04-24 19:07 ` [PATCH v3 11/13] xen/arm: send IPIs to inject irqs into guest vcpus running on different pcpus Stefano Stabellini
2013-04-25 11:00   ` Ian Campbell
2013-04-26 13:39     ` Stefano Stabellini
2013-04-26 14:08       ` Ian Campbell
2013-04-24 19:07 ` [PATCH v3 12/13] xen/arm: start the vtimer Xen timers on the processor they should be running on Stefano Stabellini
2013-04-25 11:03   ` Ian Campbell
2013-04-26 14:30     ` Stefano Stabellini
2013-04-26 14:35       ` Ian Campbell
2013-04-26 14:36         ` Stefano Stabellini
2013-04-24 19:07 ` [PATCH v3 13/13] xen/arm: initialize virt_timer and phys_timer with the same values on all vcpus Stefano Stabellini
2013-04-25 11:21   ` Ian Campbell
2013-04-26 14:30     ` Stefano Stabellini
2013-04-26 14:37       ` 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=517A80F8.9050804@citrix.com \
    --to=julien.grall@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=sander.bogaert@elis.ugent.be \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xensource.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 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.