diff mbox

[Xen-devel,V3,3/3] amd/seattle: Initial revision of AMD Seattle support

Message ID 1412285135-25468-4-git-send-email-suravee.suthikulpanit@amd.com
State New
Headers show

Commit Message

Suthikulpanit, Suravee Oct. 2, 2014, 9:25 p.m. UTC
From: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>

This patch add inital (minimal) platform support for AMD Seattle,
which mainly just define the matching ID, and specify system_off,
and system_reset mechanism.

Initially, the firmware only support a subset of PSCI-0.2 functions,
system-off and sytem-reset. The mechanism for bring up auxiliary processors
is still using spin-table.

Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
---
 xen/arch/arm/platforms/Makefile  |  1 +
 xen/arch/arm/platforms/seattle.c | 65 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+)
 create mode 100644 xen/arch/arm/platforms/seattle.c

Comments

Julien Grall Oct. 2, 2014, 9:46 p.m. UTC | #1
Hi Suravee,

On 02/10/2014 22:25, suravee.suthikulpanit@amd.com wrote:
> From: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
>
> This patch add inital (minimal) platform support for AMD Seattle,
> which mainly just define the matching ID, and specify system_off,
> and system_reset mechanism.
>
> Initially, the firmware only support a subset of PSCI-0.2 functions,
> system-off and sytem-reset. The mechanism for bring up auxiliary processors
> is still using spin-table.
>
> Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>

I let you decide for the smc call... So:

Reviewed-by: Julien Grall <julien.grall@linaro.org>

Regards,

> ---
>   xen/arch/arm/platforms/Makefile  |  1 +
>   xen/arch/arm/platforms/seattle.c | 65 ++++++++++++++++++++++++++++++++++++++++
>   2 files changed, 66 insertions(+)
>   create mode 100644 xen/arch/arm/platforms/seattle.c
>
> diff --git a/xen/arch/arm/platforms/Makefile b/xen/arch/arm/platforms/Makefile
> index 680364f..e1fde6e 100644
> --- a/xen/arch/arm/platforms/Makefile
> +++ b/xen/arch/arm/platforms/Makefile
> @@ -3,4 +3,5 @@ obj-$(CONFIG_ARM_32) += exynos5.o
>   obj-$(CONFIG_ARM_32) += midway.o
>   obj-$(CONFIG_ARM_32) += omap5.o
>   obj-$(CONFIG_ARM_32) += sunxi.o
> +obj-$(CONFIG_ARM_64) += seattle.o
>   obj-$(CONFIG_ARM_64) += xgene-storm.o
> diff --git a/xen/arch/arm/platforms/seattle.c b/xen/arch/arm/platforms/seattle.c
> new file mode 100644
> index 0000000..d298393
> --- /dev/null
> +++ b/xen/arch/arm/platforms/seattle.c
> @@ -0,0 +1,65 @@
> +/*
> + * xen/arch/arm/seattle.c
> + *
> + * AMD Seattle specific settings
> + *
> + * Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> + * Copyright (c) 2014 Advance Micro Devices Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#include <asm/platform.h>
> +#include <asm/psci.h>
> +
> +static const char * const seattle_dt_compat[] __initconst =
> +{
> +    "amd,seattle",
> +    NULL
> +};
> +
> +/* Seattle firmware only implements PSCI handler for
> + * system off and system reset at this point.
> + * This is temporary until full PSCI-0.2 is supported.
> + * Then, these function will be removed.
> + */
> +static noinline void seattle_smc_psci(register_t func_id)
> +{
> +    asm volatile(
> +        "smc #0"
> +        : "+r" (func_id)
> +        :);
> +}
> +
> +static void seattle_system_reset(void)
> +{
> +    seattle_smc_psci(PSCI_0_2_FN_SYSTEM_RESET);
> +}
> +
> +static void seattle_system_off(void)
> +{
> +    seattle_smc_psci(PSCI_0_2_FN_SYSTEM_OFF);
> +}
> +
> +PLATFORM_START(seattle, "SEATTLE")
> +    .compatible = seattle_dt_compat,
> +    .reset      = seattle_system_reset,
> +    .poweroff   = seattle_system_off,
> +PLATFORM_END
> +
> +/*
> + * Local variables:
> + * mode: C
> + * c-file-style: "BSD"
> + * c-basic-offset: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
>
Julien Grall Oct. 2, 2014, 10:24 p.m. UTC | #2
Hi Suravee,

On 02/10/2014 22:25, suravee.suthikulpanit@amd.com wrote:
> From: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
>
> This patch add inital (minimal) platform support for AMD Seattle,
> which mainly just define the matching ID, and specify system_off,
> and system_reset mechanism.
>
> Initially, the firmware only support a subset of PSCI-0.2 functions,
> system-off and sytem-reset. The mechanism for bring up auxiliary processors
> is still using spin-table.

I forgot to ask, did you check that the grant-table mapping (by default 
mapped 0xb0000000-0xb0020000) doesn't overlap to the RAM or another 
device on your platform?

If it's the case I would define .dom0_gnttab_start and .dom0_gnttab_size.

Regards,

> Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> ---
>   xen/arch/arm/platforms/Makefile  |  1 +
>   xen/arch/arm/platforms/seattle.c | 65 ++++++++++++++++++++++++++++++++++++++++
>   2 files changed, 66 insertions(+)
>   create mode 100644 xen/arch/arm/platforms/seattle.c
>
> diff --git a/xen/arch/arm/platforms/Makefile b/xen/arch/arm/platforms/Makefile
> index 680364f..e1fde6e 100644
> --- a/xen/arch/arm/platforms/Makefile
> +++ b/xen/arch/arm/platforms/Makefile
> @@ -3,4 +3,5 @@ obj-$(CONFIG_ARM_32) += exynos5.o
>   obj-$(CONFIG_ARM_32) += midway.o
>   obj-$(CONFIG_ARM_32) += omap5.o
>   obj-$(CONFIG_ARM_32) += sunxi.o
> +obj-$(CONFIG_ARM_64) += seattle.o
>   obj-$(CONFIG_ARM_64) += xgene-storm.o
> diff --git a/xen/arch/arm/platforms/seattle.c b/xen/arch/arm/platforms/seattle.c
> new file mode 100644
> index 0000000..d298393
> --- /dev/null
> +++ b/xen/arch/arm/platforms/seattle.c
> @@ -0,0 +1,65 @@
> +/*
> + * xen/arch/arm/seattle.c
> + *
> + * AMD Seattle specific settings
> + *
> + * Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> + * Copyright (c) 2014 Advance Micro Devices Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#include <asm/platform.h>
> +#include <asm/psci.h>
> +
> +static const char * const seattle_dt_compat[] __initconst =
> +{
> +    "amd,seattle",
> +    NULL
> +};
> +
> +/* Seattle firmware only implements PSCI handler for
> + * system off and system reset at this point.
> + * This is temporary until full PSCI-0.2 is supported.
> + * Then, these function will be removed.
> + */
> +static noinline void seattle_smc_psci(register_t func_id)
> +{
> +    asm volatile(
> +        "smc #0"
> +        : "+r" (func_id)
> +        :);
> +}
> +
> +static void seattle_system_reset(void)
> +{
> +    seattle_smc_psci(PSCI_0_2_FN_SYSTEM_RESET);
> +}
> +
> +static void seattle_system_off(void)
> +{
> +    seattle_smc_psci(PSCI_0_2_FN_SYSTEM_OFF);
> +}
> +
> +PLATFORM_START(seattle, "SEATTLE")
> +    .compatible = seattle_dt_compat,
> +    .reset      = seattle_system_reset,
> +    .poweroff   = seattle_system_off,
> +PLATFORM_END
> +
> +/*
> + * Local variables:
> + * mode: C
> + * c-file-style: "BSD"
> + * c-basic-offset: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
>
Suthikulpanit, Suravee Oct. 3, 2014, 12:22 a.m. UTC | #3
On 10/02/2014 05:24 PM, Julien Grall wrote:
> I forgot to ask, did you check that the grant-table mapping (by default
> mapped 0xb0000000-0xb0020000) doesn't overlap to the RAM or another
> device on your platform?
>
> If it's the case I would define .dom0_gnttab_start and .dom0_gnttab_size.
>
> Regards,

Actually, the default mapping will be overlapped with where PCI MMIO 
region is supposed to be.  Are there any restrictions on the location of 
this can be? (e.g below 4G, alignment, etc.)

Suravee
Ian Campbell Oct. 3, 2014, 8:43 a.m. UTC | #4
On Thu, 2014-10-02 at 19:22 -0500, Suravee Suthikulpanit wrote:
> 
> On 10/02/2014 05:24 PM, Julien Grall wrote:
> > I forgot to ask, did you check that the grant-table mapping (by default
> > mapped 0xb0000000-0xb0020000) doesn't overlap to the RAM or another
> > device on your platform?
> >
> > If it's the case I would define .dom0_gnttab_start and .dom0_gnttab_size.
> >
> > Regards,
> 
> Actually, the default mapping will be overlapped with where PCI MMIO 
> region is supposed to be.  Are there any restrictions on the location of 
> this can be? (e.g below 4G, alignment, etc.)

Not especially. Obviously it needs to be at an IPA which the guest can
map, so if you expect to run 32-bit dom0 (or even if you don't expect
but it is a possibility) then finding somewhere under 4GB would be nice
to have.

Alignment can be whatever, but again it might be nice to make it
somewhat naturally aligned.

We've got a plan to get rid of this annoying requirement to specify this
manually in 4.6...

Ian.
diff mbox

Patch

diff --git a/xen/arch/arm/platforms/Makefile b/xen/arch/arm/platforms/Makefile
index 680364f..e1fde6e 100644
--- a/xen/arch/arm/platforms/Makefile
+++ b/xen/arch/arm/platforms/Makefile
@@ -3,4 +3,5 @@  obj-$(CONFIG_ARM_32) += exynos5.o
 obj-$(CONFIG_ARM_32) += midway.o
 obj-$(CONFIG_ARM_32) += omap5.o
 obj-$(CONFIG_ARM_32) += sunxi.o
+obj-$(CONFIG_ARM_64) += seattle.o
 obj-$(CONFIG_ARM_64) += xgene-storm.o
diff --git a/xen/arch/arm/platforms/seattle.c b/xen/arch/arm/platforms/seattle.c
new file mode 100644
index 0000000..d298393
--- /dev/null
+++ b/xen/arch/arm/platforms/seattle.c
@@ -0,0 +1,65 @@ 
+/*
+ * xen/arch/arm/seattle.c
+ *
+ * AMD Seattle specific settings
+ *
+ * Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
+ * Copyright (c) 2014 Advance Micro Devices Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <asm/platform.h>
+#include <asm/psci.h>
+
+static const char * const seattle_dt_compat[] __initconst =
+{
+    "amd,seattle",
+    NULL
+};
+
+/* Seattle firmware only implements PSCI handler for
+ * system off and system reset at this point.
+ * This is temporary until full PSCI-0.2 is supported.
+ * Then, these function will be removed.
+ */
+static noinline void seattle_smc_psci(register_t func_id)
+{
+    asm volatile(
+        "smc #0"
+        : "+r" (func_id)
+        :);
+}
+
+static void seattle_system_reset(void)
+{
+    seattle_smc_psci(PSCI_0_2_FN_SYSTEM_RESET);
+}
+
+static void seattle_system_off(void)
+{
+    seattle_smc_psci(PSCI_0_2_FN_SYSTEM_OFF);
+}
+
+PLATFORM_START(seattle, "SEATTLE")
+    .compatible = seattle_dt_compat,
+    .reset      = seattle_system_reset,
+    .poweroff   = seattle_system_off,
+PLATFORM_END
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */