xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <Ian.Campbell@citrix.com>
To: vijay.kilari@gmail.com
Cc: stefano.stabellini@eu.citrix.com,
	Prasun.Kapoor@caviumnetworks.com,
	vijaya.kumar@caviumnetworks.com, julien.grall@linaro.org,
	tim@xen.org, xen-devel@lists.xen.org,
	stefano.stabellini@citrix.com, manish.jaggi@caviumnetworks.com
Subject: Re: [PATCH v7 1/5] xen/arm: Add support for GIC v3
Date: Wed, 16 Jul 2014 12:41:49 +0100	[thread overview]
Message-ID: <1405510909.7019.86.camel@kazak.uk.xensource.com> (raw)
In-Reply-To: <1405083092-20216-2-git-send-email-vijay.kilari@gmail.com>

On Fri, 2014-07-11 at 18:21 +0530, vijay.kilari@gmail.com wrote:
> +static inline void gicv3_restore_lrs(int nr_lrs, const struct vcpu *v)

Other similar functions you have here use gicv3.nr_foo directly.

> +    case 1:
> +        WRITE_SYSREG(v->arch.gic.v3.lr[0], ICH_LR0_EL2);
> +         break;

Nit: whitespace.

> +static void gicv3_save_state(struct vcpu *v)
> +{
> +
> +    /* No need for spinlocks here because interrupts are disabled around
> +     * this call and it only accesses struct vcpu fields that cannot be
> +     * accessed simultaneously by another pCPU.
> +     *
> +     * Make sure all stores to the GIC via the memory mapped interface
> +     * are now visible to the system register interface
> +     */
> +    dsb(sy);
> +    gicv3_save_lrs(gicv3_info.nr_lrs, v);
> +    save_aprn_regs(&v->arch.gic);
> +    v->arch.gic.v3.vmcr = READ_SYSREG32(ICH_VMCR_EL2);
> +    v->arch.gic.v3.sre_el1 = READ_SYSREG32(ICC_SRE_EL1);
> +}
> +
> +static void gicv3_restore_state(const struct vcpu *v)
> +{
> +    WRITE_SYSREG32(v->arch.gic.v3.sre_el1, ICC_SRE_EL1);
> +    WRITE_SYSREG32(v->arch.gic.v3.vmcr, ICH_VMCR_EL2);
> +    restore_aprn_regs(&v->arch.gic);
> +    gicv3_restore_lrs(gicv3_info.nr_lrs, v);
> +
> +    /*
> +     * Make sure all stores are visible the GIC
> +     */
> +    dsb(sy);
> +}

A reference to Section 4.8.17 of the GICv3 spec alongside these
functions would be very useful.


> +static void __cpuinit gicv3_hyp_disable(void)
> +{
> +    uint32_t vtr;
> +
> +    vtr = READ_SYSREG32(ICH_HCR_EL2);
> +    vtr &= ~0x1;

Please can you add a define for this value, or reuse GICH_HCR_EN if
ICH_HCR_EL2 is compatible with GICv2 GICH_HCR.

Also calling the temporary vtr is confusing, ICH_VTR_EL2 is a different
register.

> +static u16 gicv3_compute_target_list(int *base_cpu, const struct cpumask *mask,
> +                                     uint64_t cluster_id)
> +{
> +    int cpu = *base_cpu;
> +    uint64_t mpidr = cpu_logical_map(cpu);
> +    u16 tlist = 0;
> +
> +    while ( cpu < nr_cpu_ids )
> +    {
> +        /*
> +         * If we ever get a cluster of more than 16 CPUs, just
> +         * scream and skip that CPU.
> +         */
> +        if ( (mpidr & 0xff) >= 16 )

MPIPDR_EFF0_MASK if that's what this is, and at least once more in this
function.

> +        {
> +            dprintk(XENLOG_WARNING, "GICv3:Cluster with more than 16's cpus\n");
> +            goto out;

Please validate this and complain in gicv3_init not every time we send
an SGI.

> +static void gicv3_send_sgi(enum gic_sgi sgi, enum gic_sgi_mode mode,
> +                           const cpumask_t *cpumask)
> +{
> +    int cpu = 0;
> +    uint64_t val;
> +
> +    for_each_cpu(cpu, cpumask)
> +    {
> +        /* Mask lower 8 bits. It represent cpu in affinity level 0 */
> +        uint64_t cluster_id = cpu_logical_map(cpu) & ~0xffUL;

Use MPIDR_AFF0_MASK not 0xff.

> diff --git a/xen/include/asm-arm/gic_v3_defs.h b/xen/include/asm-arm/gic_v3_defs.h
> new file mode 100644
> index 0000000..1c32e0c
> --- /dev/null
> +++ b/xen/include/asm-arm/gic_v3_defs.h

> +#ifndef __ASM_ARM_GIC_V3_DEFS_H__
> +#define __ASM_ARM_GIC_V3_DEFS_H__
> +
> +/*
> + * Additional registers defined in GIC v3.
> + * Common GICD registers are defined in gic.h
> + */
> +
> +#define GICD_STATUSR                 (0x010)
> [...][
> +#define GICV3_GICD_PIDR0             (0x92)

What is the distinction between variables with GIC[DR]_ prefixes and
those with GICV3_GIC[DR]_ ones?

> diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
> index e81b80e..7aef378 100644
> --- a/xen/include/xen/lib.h
> +++ b/xen/include/xen/lib.h
> @@ -67,6 +67,8 @@ do {                                                            \
>  
>  #define reserve_bootmem(_p,_l) ((void)0)
>  
> +#define SZ_64K  0x00010000

This was already discussed in v6.

Ian.

  reply	other threads:[~2014-07-16 11:41 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-11 12:51 [PATCH v7 0/5] xen/arm: Add GICv3 support vijay.kilari
2014-07-11 12:51 ` [PATCH v7 1/5] xen/arm: Add support for GIC v3 vijay.kilari
2014-07-16 11:41   ` Ian Campbell [this message]
2014-07-22  9:48     ` Vijay Kilari
2014-07-22 10:01       ` Julien Grall
2014-07-22 10:43         ` Ian Campbell
2014-07-22 11:13           ` Julien Grall
2014-07-22 11:30             ` Vijay Kilari
2014-07-22 11:45               ` Ian Campbell
2014-07-22 10:39       ` Ian Campbell
2014-07-22 10:49         ` Vijay Kilari
2014-07-22 10:55           ` Ian Campbell
2014-07-22 11:12             ` Vijay Kilari
2014-07-22 11:15               ` Julien Grall
2014-07-22 11:19                 ` Ian Campbell
2014-07-11 12:51 ` [PATCH v7 2/5] xen/arm: Add virtual GICv3 support vijay.kilari
2014-07-14 15:59   ` Julien Grall
2014-07-16 11:47   ` Ian Campbell
2014-07-16 11:56     ` Vijay Kilari
2014-07-11 12:51 ` [PATCH v7 3/5] xen/arm: Update Dom0 GIC dt node with GICv3 information vijay.kilari
2014-07-16 11:53   ` Ian Campbell
2014-07-11 12:51 ` [PATCH v7 4/5] xen/arm: add SGI handling for GICv3 vijay.kilari
2014-07-11 13:43   ` Julien Grall
2014-07-11 14:08     ` Ian Campbell
2014-07-11 14:12       ` Julien Grall
2014-07-11 14:18         ` Ian Campbell
2014-07-22 13:48   ` Stefano Stabellini
2014-07-22 14:13     ` Vijay Kilari
2014-07-23  5:48       ` Vijay Kilari
2014-07-23 10:35         ` Stefano Stabellini
2014-07-11 12:51 ` [PATCH v7 5/5] xen/arm: check for GICv3 platform support vijay.kilari
2014-07-16 12:11   ` Ian Campbell
2014-07-16 10:35 ` [PATCH v7 0/5] xen/arm: Add GICv3 support Ian Campbell
2014-07-16 11:47   ` Vijay Kilari
2014-07-16 12:38     ` Ian Campbell
2014-07-16 13:32       ` Ian Campbell
2014-07-23 10:51         ` Vijay Kilari
2014-07-23 11:31           ` 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=1405510909.7019.86.camel@kazak.uk.xensource.com \
    --to=ian.campbell@citrix.com \
    --cc=Prasun.Kapoor@caviumnetworks.com \
    --cc=julien.grall@linaro.org \
    --cc=manish.jaggi@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 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).