From: Julien Grall <julien.grall@citrix.com>
To: Ian Campbell <ian.campbell@citrix.com>, xen-devel@lists.xenproject.org
Cc: Zoltan Kiss <zoltan.kiss@huawei.com>, stefano.stabellini@eu.citrix.com
Subject: Re: [PATCH v3 1/3] xen/arm: gic: Check the size of the CPU and vCPU interface retrieved from DT
Date: Tue, 6 Oct 2015 15:39:16 +0100 [thread overview]
Message-ID: <5613DD14.5080800@citrix.com> (raw)
In-Reply-To: <1444140688.5302.193.camel@citrix.com>
On 06/10/15 15:11, Ian Campbell wrote:
> On Mon, 2015-10-05 at 15:17 +0100, Julien Grall wrote:
>> @@ -641,7 +643,29 @@ static int __init gicv2_init(void)
>> panic("GICv2: Cannot find the maintenance IRQ");
>> gicv2_info.maintenance_irq = res;
>>
>> - /* TODO: Add check on distributor, cpu size */
>> + /* TODO: Add check on distributor */
>> +
>> + /*
>> + * The GICv2 CPU interface should at least be 8KB. Although, most of the DT
>> + * doesn't correctly set it and use the GICv1 CPU interface size (i.e 4KB).
>> + * Warn and then fixup.
>> + */
>> + if ( csize < SZ_8K )
>> + {
>> + printk(XENLOG_WARNING "GICv2: WARNING: "
>> + "The GICC size is wrong: %#"PRIx64" expected %#x\n",
>> + csize, SZ_8K);
>
> "is too small"?
Ok.
>
>> + csize = SZ_8K;
>> + }
>> +
>> + /*
>> + * Check if the CPU interface and virtual CPU interface have the
>> + * same size.
>> + */
>> + if ( csize != vsize )
>> + printk(XENLOG_WARNING "GICv2: WARNING: "
>> + "Sizes of GICC (%#"PRIpaddr") and GICV (%#"PRIpaddr") don't match\n",
>> + csize, vsize);
>
> Should we also force them to be equal? Either
> csize = vsize = min(csize,vsize)
If we restrict csize we will get to some other troubles later because
vsize may be only 4KB.
> or
> vsize = csize
>
> (probably the first)?
None of them.
>
>> + /*
>> + * Only allow support of GICv2 compatible when the CPU interface
>> + * and virtual CPU interface are 8KB
>> + * XXX: Handle other size?
>> + */
>> + if ( csize != SZ_8K && vsize != SZ_8K )
>
> I think you meant || ? Otherwise this is happy so long as one of them is
> right rather than requiring both of them to be 8K.
Right.
>
> WRT to the XXX I think I'd be happier if this was < SZ_8K for each.
> Otherwise some future GIC which is compatible but has extensions to the
> register space would needlessly require changes here. But I can live with
> this.
The GICv2 CPU interface is always at least 8KB. Having an higher value
may mean that the GIC is aliased.
GICv2 on GICv3 is only used for guest. I prefer to restrict the usage to
known and safe value until we have someone using different size.
This will avoid to expose unwanted data/value to a guest.
Regards,
--
Julien Grall
next prev parent reply other threads:[~2015-10-06 14:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-05 14:17 [PATCH v3 0/3] xen/arm: gic-v2: Detect automatically aliased GIC 400 Julien Grall
2015-10-05 14:17 ` [PATCH v3 1/3] xen/arm: gic: Check the size of the CPU and vCPU interface retrieved from DT Julien Grall
2015-10-06 14:11 ` Ian Campbell
2015-10-06 14:39 ` Julien Grall [this message]
2015-10-06 14:55 ` Ian Campbell
2015-10-07 15:07 ` Julien Grall
2015-10-08 13:01 ` Ian Campbell
2015-10-05 14:17 ` [PATCH v3 2/3] xen/arm: gic-v2: Automatically detect aliased GIC400 Julien Grall
2015-10-05 14:17 ` [PATCH v3 3/3] xen/arm: platform: Drop the quirks callback Julien Grall
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=5613DD14.5080800@citrix.com \
--to=julien.grall@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xenproject.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).