From: Julien Grall <julien.grall@linaro.org>
To: Vijay Kilari <vijay.kilari@gmail.com>
Cc: Ian Campbell <Ian.Campbell@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Prasun Kapoor <Prasun.Kapoor@caviumnetworks.com>,
Vijaya Kumar K <vijaya.kumar@caviumnetworks.com>,
Tim Deegan <tim@xen.org>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
Stefano Stabellini <stefano.stabellini@citrix.com>
Subject: Re: [PATCH v7a 13/14] xen/arm: split vgic driver into generic and vgic-v2 driver
Date: Wed, 02 Jul 2014 10:01:52 +0100 [thread overview]
Message-ID: <53B3CA80.6070901@linaro.org> (raw)
In-Reply-To: <CALicx6t_B9ntggz=r=YZQ0q1GfrF6u1ku+4EcGvw=Uq7nUTmvw@mail.gmail.com>
On 02/07/14 07:39, Vijay Kilari wrote:
> On Tue, Jul 1, 2014 at 6:38 PM, Julien Grall <julien.grall@linaro.org> wrote:
>
>>> -static int vgic_to_sgi(struct vcpu *v, register_t sgir)
>>> +/* TODO: unsigned long is used to fit vcpu_mask. Change to cpu_mask */
>>> +int vgic_to_sgi(struct vcpu *v, register_t sgir, enum gic_sgi_mode irqmode, int virq,
>>> + unsigned long vcpu_mask)
>>
>>
>> [..]
>>
>>> + case SGI_TARGET_OTHERS:
>>
>> [..]
>>
>>> + break;
>>> + case SGI_TARGET_SELF:
>>> + set_bit(current->vcpu_id, &vcpu_mask);
>>
>> I already said it on V4, V5 and now V6a and don't see any change or
>> comment from you side.
>>
>> For SGI_TARGET_{OTHERS,SELF}, you can't assume that vcpu_mask will be
>> equal to 0...
>>
>> It comes directly guest write to GICD_SIGR. Please make sure to handle
>> it correctly or the guest could send SGI to the wrong VCPUs.
>
> Sorry I missed this patch to fix the comments.
>
> First, if Guest uses this series of patches, mask is not written to GICD_SGIR
> for OTHERS & SELF case in v2 driver
That's not a reason to make buggy assumption. You will have to fix some
day for another GIC driver. It's better to fix it today otherwise we
will forget it later.
> static void gicv2_send_SGI(enum gic_sgi sgi, enum gic_sgi_mode irqmode,
> const cpumask_t *cpu_mask)
> {
> unsigned int mask = 0;
>
> switch ( irqmode )
> {
> case SGI_TARGET_OTHERS:
> writel_relaxed(GICD_SGI_TARGET_OTHERS | sgi, GICD + GICD_SGIR);
> break;
> case SGI_TARGET_SELF:
> writel_relaxed(GICD_SGI_TARGET_SELF | sgi, GICD + GICD_SGIR);
> break;
>
> Even if Guest writes some values to mask, then only way I check is to forcefully
> make vcpu_mask as 0 for OTHERS & SELF case before using it with warning
For the GICv2 POV it's perfectly valid to write garbage in CPUTargetList
while we send an SGI to ourself. I'm fine with vcpu_mask = 0, but the
warning is not useful as it's not a bug.
>>
>> [..]
>>
>>> +struct vgic_ops {
>>> + /* Initialize vGIC */
>>> + int (*vcpu_init)(struct vcpu *v);
>>> + /* Domain specific initialization of vGIC */
>>> + int (*domain_init)(struct domain *d);
>>> + /* SGI handler of vGIC */
>>> + int (*send_sgi)(struct vcpu *v, register_t sgir);
>>
>> You've introduced vgic_send_sgi here, I'm not sure to understand why...
>> Can you give more input?
>
> You have asked me make sending sgi as a callback.
> So I have introduced the following way
>
> On GICD_SGIR write by guest, vgic-v2.c calls vgic_send_sgi()
> which will call the registered callback (*send_sgi).
> Here send_sgi is registered with vgic_v2_to_sgi() which will inject
> sgi
IIRC, I've asked this change for the SGI support on VGICv3 to handle
sysreg per vGIC.
IHMO, here it's as no-sense because the usage looks useless. I would
like to see your GICv3 series before saying this is OK.
>>
>>> +};
>>> +
>>> /* Number of ranks of interrupt registers for a domain */
>>> #define DOMAIN_NR_RANKS(d) (((d)->arch.vgic.nr_lines+31)/32)
>>>
>>> @@ -133,6 +142,8 @@ static inline void vgic_byte_write(uint32_t *reg, uint32_t var, int offset)
>>> *reg |= var;
>>> }
>>>
>>> +extern enum gic_sgi_mode irqmode;
>>> +
>>
>> Hu? What is used for?
>
> This is forward declaration for below function in vgic.h file. May
> be extern is not required here
> extern int vgic_to_sgi(struct vcpu *v, register_t sgir,
> enum gic_sgi_mode irqmode, int virq,
> unsigned long vcpu_mask);
Forward declaration of what? Here, you are defining an external variable
"irqmode" which is never used.
Regards,
--
Julien Grall
next prev parent reply other threads:[~2014-07-02 9:01 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-01 6:41 [PATCH v7a 00/14] GIC and VGIC code refactoring vijay.kilari
2014-07-01 6:41 ` [PATCH v7a 01/14] xen/arm: make sgi handling generic vijay.kilari
2014-07-01 11:13 ` Julien Grall
2014-07-02 10:51 ` Ian Campbell
2014-07-01 6:41 ` [PATCH v7a 02/14] xen/arm: use ioremap to map gic-v2 registers vijay.kilari
2014-07-01 6:41 ` [PATCH v7a 03/14] xen/arm: segregate and split GIC low level functionality vijay.kilari
2014-07-01 11:32 ` Julien Grall
2014-07-01 6:41 ` [PATCH v7a 04/14] xen/arm: move GIC context data structure to gic driver vijay.kilari
2014-07-01 6:41 ` [PATCH v7a 05/14] xen/arm: use device api to detect GIC version vijay.kilari
2014-07-01 6:41 ` [PATCH v7a 06/14] xen/arm: switch to dynamic allocation of vgic rank vijay.kilari
2014-07-01 6:41 ` [PATCH v7a 07/14] xen/arm: prefix byte_read and byte_write functions with vgic vijay.kilari
2014-07-01 6:41 ` [PATCH v7a 08/14] xen/arm: move vgic defines to vgic header file vijay.kilari
2014-07-01 6:41 ` [PATCH v7a 09/14] xen/arm: move and rename is_vcpu_running function to sched.h vijay.kilari
2014-07-01 7:55 ` Jan Beulich
2014-07-01 9:32 ` George Dunlap
2014-07-02 11:19 ` Ian Campbell
2014-07-02 13:03 ` Vijay Kilari
2014-07-01 6:41 ` [PATCH v7a 10/14] xen/arm: move pending_irq structure to vgic header file vijay.kilari
2014-07-01 6:41 ` [PATCH v7a 11/14] xen/arm: calculate vgic irq rank based on register size vijay.kilari
2014-07-01 6:41 ` [PATCH v7a 12/14] xen/arm: Remove REG macro in vgic driver vijay.kilari
2014-07-01 6:41 ` [PATCH v7a 13/14] xen/arm: split vgic driver into generic and vgic-v2 driver vijay.kilari
2014-07-01 13:08 ` Julien Grall
2014-07-02 6:39 ` Vijay Kilari
2014-07-02 9:01 ` Julien Grall [this message]
2014-07-01 6:41 ` [PATCH v7a 14/14] xen/arm: Restrict saving of gic register for idle domain vijay.kilari
2014-07-04 14:25 ` Stefano Stabellini
2014-07-01 11:06 ` [PATCH v7a 00/14] GIC and VGIC code refactoring Julien Grall
2014-07-02 11:41 ` 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=53B3CA80.6070901@linaro.org \
--to=julien.grall@linaro.org \
--cc=Ian.Campbell@citrix.com \
--cc=Prasun.Kapoor@caviumnetworks.com \
--cc=stefano.stabellini@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=tim@xen.org \
--cc=vijay.kilari@gmail.com \
--cc=vijaya.kumar@caviumnetworks.com \
--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.