From: Julien Grall <julien.grall@linaro.org>
To: Frediano Ziglio <frediano.ziglio@huawei.com>,
Ian Campbell <ian.campbell@citrix.com>,
Stefano Stabellini <stefano.stabellini@citrix.com>,
Tim Deegan <tim@xen.org>
Cc: zoltan.kiss@huawei.com, xen-devel@lists.xen.org
Subject: Re: [PATCH 01/10] xen/arm: Implement hip04-d01 platform
Date: Mon, 03 Nov 2014 13:39:04 +0000 [thread overview]
Message-ID: <54578578.5050801@linaro.org> (raw)
In-Reply-To: <1415009522-6344-2-git-send-email-frediano.ziglio@huawei.com>
Hi Frediano,
On 11/03/2014 10:11 AM, Frediano Ziglio wrote:
> Add this new platform to Xen.
> This platform require specific code to initialize CPUs.
s/require/requires/
I guess your platform doesn't support PSCI?
>
> Signed-off-by: Frediano Ziglio <frediano.ziglio@huawei.com>
> Signed-off-by: Zoltan Kiss <zoltan.kiss@huawei.com>
> ---
[..]
> diff --git a/xen/arch/arm/platforms/hip04.c b/xen/arch/arm/platforms/hip04.c
> new file mode 100644
> index 0000000..bf38c23
> --- /dev/null
> +++ b/xen/arch/arm/platforms/hip04.c
> @@ -0,0 +1,258 @@
[..]
> +
> +struct hip04_secondary_cpu_data {
coding style:
struct hip04_secondary_cpu_data
{
> + u32 bootwrapper_phys;
> + u32 bootwrapper_size;
> + u32 bootwrapper_magic;
> + u32 relocation_entry;
> + u32 relocation_size;
> +};
> +
> +static void __iomem *relocation, *sysctrl, *fabric;
> +static int hip04_cpu_table[HIP04_MAX_CLUSTERS][HIP04_MAX_CPUS_PER_CLUSTER];
> +static struct hip04_secondary_cpu_data hip04_boot;
> +
> +static void hip04_reset(void)
> +{
> + /* TODO */
Why did you implement the reset in a separate patch rather than here?
> +}
> +
> +static void hip04_set_snoop_filter(unsigned int cluster, unsigned int on)
> +{
> + unsigned long data;
> +
> + if (!fabric)
Coding style:
if ( !fabric )
> + return;
> + data = readl_relaxed(fabric + FAB_SF_MODE);
> + if (on)
if ( on )
> + data |= 1 << cluster;
> + else
> + data &= ~(1 << cluster);
> + writel_relaxed(data, fabric + FAB_SF_MODE);
> + while (1) {
while ( 1 )
{
> + if (data == readl_relaxed(fabric + FAB_SF_MODE))
if ( ... )
> + break;
> + }
The loop is turning in an infinite loop if the reading value is never
correct.
> +}
> +
> +static bool __init hip04_cpu_table_init(void)
> +{
> + unsigned int mpidr, cpu, cluster;
> +
> + mpidr = cpu_logical_map(smp_processor_id());
> + cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
> + cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
> +
> + if (cluster >= HIP04_MAX_CLUSTERS ||
> + cpu >= HIP04_MAX_CPUS_PER_CLUSTER) {
if ( ...
... )
{
> + printk(XENLOG_ERR "%s: boot CPU is out of bound!\n", __func__);
> + return false;
> + }
> + hip04_set_snoop_filter(cluster, 1);
> + hip04_cpu_table[cluster][cpu] = 1;
Missing blank line
> + return true;
> +}
> +
> +static bool hip04_cluster_down(unsigned int cluster)
> +{
> + int i;
> +
> + for (i = 0; i < HIP04_MAX_CPUS_PER_CLUSTER; i++)
for ( ... )
> + if (hip04_cpu_table[cluster][i])
if ( ... )
> + return false;
> + return true;
> +}
> +
> +static void hip04_cluster_up(unsigned int cluster)
> +{
> + unsigned long data, mask;
> +
> + if ( hip04_cluster_down(cluster) ) {
Wouldn't it be easier to return if the cluster is up? It will one layer
of indentation.
> + data = CLUSTER_L2_RESET_BIT | CLUSTER_DEBUG_RESET_BIT;
> + writel_relaxed(data, sysctrl + SC_CPU_RESET_DREQ(cluster));
> + do {
> + mask = CLUSTER_L2_RESET_STATUS | \
> + CLUSTER_DEBUG_RESET_STATUS;
> + data = readl_relaxed(sysctrl + \
> + SC_CPU_RESET_STATUS(cluster));
> + } while (data & mask);
> + hip04_set_snoop_filter(cluster, 1);
> + }
> +}
> +
> +static int __init hip04_smp_init(void)
> +{
> + struct dt_device_node *np, *np_fab;
The device node are not modified so:
const struct
[..]
> + writel_relaxed(hip04_boot.bootwrapper_phys, relocation);
> + writel_relaxed(hip04_boot.bootwrapper_magic, relocation + 4);
> + writel_relaxed(__pa(init_secondary), relocation + 8);
> + writel_relaxed(0, relocation + 12);
> +
> + return 0;
> +
> +err:
For consistence, you should unmap everything you mapped with ioremap_*
> + printk("%s", msg);
> + return -ENXIO;
> +}
> +
> +static int hip04_cpu_up(int cpu)
> +{
> + unsigned int cluster = cpu / 4;
The number 4 is confusing here, why not using the define you've created
above? Such as HIP04_MAX_CPUS_PER_CLUSTER
> + unsigned long data;
The coding style requires a blank line after the declarations block.
> + cpu %= 4;
Ditto for the number 4.
Regards,
--
Julien Grall
next prev parent reply other threads:[~2014-11-03 13:39 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-03 10:11 xen/arm: Add support for Huawei hip04-d01 platform Frediano Ziglio
2014-11-03 10:11 ` [PATCH 01/10] xen/arm: Implement " Frediano Ziglio
2014-11-03 13:39 ` Julien Grall [this message]
2015-01-13 11:58 ` Ian Campbell
2015-01-13 14:09 ` Frediano Ziglio
2015-01-13 14:42 ` Ian Campbell
2015-01-13 15:11 ` Frediano Ziglio
2015-01-13 15:23 ` Ian Campbell
2015-01-13 15:48 ` Frediano Ziglio
2015-02-19 14:23 ` Frediano Ziglio
2015-02-19 16:19 ` Ian Campbell
2014-11-03 10:11 ` [PATCH 02/10] xen/arm: Implement hip04-d01 board reboot Frediano Ziglio
2014-11-03 13:40 ` Julien Grall
2014-11-03 10:11 ` [PATCH 03/10] xen/arm: Define quirk for Hip04 GICv2 divergence Frediano Ziglio
2014-11-03 13:50 ` Julien Grall
2014-11-03 13:54 ` Ian Campbell
2014-11-03 10:11 ` [PATCH 04/10] xen/arm: Make gic-v2 code handle hip04-d01 platform Frediano Ziglio
2014-11-03 14:10 ` Julien Grall
2015-01-13 11:54 ` Ian Campbell
2015-01-13 13:36 ` Frediano Ziglio
2014-11-03 10:11 ` [PATCH 05/10] xen/arm: Add support for DTBs with strange names of Hip04 GICv2 Frediano Ziglio
2014-11-03 10:11 ` [PATCH 06/10] xen/arm: handle GICH register changes for hip04-d01 platform Frediano Ziglio
2014-11-03 14:12 ` Julien Grall
2014-11-03 10:11 ` [PATCH 07/10] xen/arm: Force domains to use normal GICv2 driver on Hip04 platform Frediano Ziglio
2014-11-03 14:16 ` Julien Grall
2015-01-13 11:54 ` Ian Campbell
2014-11-03 10:12 ` [PATCH 08/10] xen/arm: Move vGIC registers " Frediano Ziglio
2014-11-03 10:12 ` [PATCH 09/10] xen/device_tree: Add new helper to read arrays from a DTB Frediano Ziglio
2014-11-03 14:14 ` Julien Grall
2014-11-03 14:15 ` Julien Grall
2014-11-03 10:12 ` [PATCH 10/10] xen/arm: Handle different bootwrapper locations for Hip04 platform Frediano Ziglio
2014-11-03 14:13 ` Julien Grall
2014-11-03 15:28 ` Frediano Ziglio
2014-11-03 15:33 ` Julien Grall
2014-11-03 15:36 ` Frediano Ziglio
2014-11-03 15:40 ` 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=54578578.5050801@linaro.org \
--to=julien.grall@linaro.org \
--cc=frediano.ziglio@huawei.com \
--cc=ian.campbell@citrix.com \
--cc=stefano.stabellini@citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.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 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.