Skip to contentSkip to conversation

Add ThunderX platform support

PATCH Superseded [email protected] 3 participants 13 messages Feb 18, 2015 – Mar 3, 2015

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add ThunderX platform support

From: Vijaya Kumar K <[email protected]>

Changes in v2:
- Updated patch 3 commit message
- Updated processor_implementers[] with implementor info in xen/arch/arm/setup.c

Changes in v1:
- Add support for ThunderX platform
- Add early printk support
- Add psci-0.2 check while parsing dt node

Vijaya Kumar K (3):
xen/arm: Add ThunderX platform support xen/arm: Add early printk support for ThunderX platform xen/arm: Skip parsing psci-0.2 from host device tree

 xen/arch/arm/Rules.mk             |    4 +++
 xen/arch/arm/domain_build.c       |    1 +
 xen/arch/arm/platforms/Makefile   |    1 +
 xen/arch/arm/platforms/thunderx.c |   66 +++++++++++++++++++++++++++++++++++++
 xen/arch/arm/setup.c              |    1 +
 5 files changed, 73 insertions(+)
 create mode 100644 xen/arch/arm/platforms/thunderx.c
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 1/3 xen/arm: Add ThunderX platform support

From: Vijaya Kumar K <[email protected]>

Add basic support for Cavium ThunderX platform

---
 xen/arch/arm/platforms/Makefile   |    1 +
 xen/arch/arm/platforms/thunderx.c |   66 +++++++++++++++++++++++++++++++++++++
 xen/arch/arm/setup.c              |    1 +
 3 files changed, 68 insertions(+)
xen/arch/arm/platforms/Makefile +1 -0
index e173fec..d9f98f9 100644
@@ -7,3 +7,4 @@ obj-$(CONFIG_ARM_32) += sunxi.o
 obj-$(CONFIG_ARM_32) += rcar2.o
 obj-$(CONFIG_ARM_64) += seattle.o
 obj-$(CONFIG_ARM_64) += xgene-storm.o
+obj-$(CONFIG_ARM_64) += thunderx.o
xen/arch/arm/platforms/thunderx.c new file +66 -0

66 lines not on this page · raw message

xen/arch/arm/setup.c +1 -0
index a916ca6..43b626b 100644
@@ -66,6 +66,7 @@ static void __init init_idle_domain(void)
 static const char * __initdata processor_implementers[] = {
     ['A'] = "ARM Limited",
     ['B'] = "Broadcom Corporation",
+    ['C'] = "Cavium Inc.",
     ['D'] = "Digital Equipment Corp",
     ['M'] = "Motorola, Freescale Semiconductor Inc.",
     ['P'] = "Applied Micro",
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH v2 1/3] xen/arm: Add ThunderX platform support

Hello Vijay,

Quoted 43 lines · On 18/02/2015 12:19, [email protected] wrote:

From: Vijaya Kumar K <[email protected]>

Add basic support for Cavium ThunderX platform

---
  xen/arch/arm/platforms/Makefile   |    1 +
  xen/arch/arm/platforms/thunderx.c |   66 +++++++++++++++++++++++++++++++++++++
  xen/arch/arm/setup.c              |    1 +
  3 files changed, 68 insertions(+)
xen/arch/arm/platforms/Makefile +1 -0
index e173fec..d9f98f9 100644
@@ -7,3 +7,4 @@ obj-$(CONFIG_ARM_32) += sunxi.o
  obj-$(CONFIG_ARM_32) += rcar2.o
  obj-$(CONFIG_ARM_64) += seattle.o
  obj-$(CONFIG_ARM_64) += xgene-storm.o
+obj-$(CONFIG_ARM_64) += thunderx.o
xen/arch/arm/platforms/thunderx.c new file +17 -0
new file mode 100644
index 0000000..96560e1
@@ -0,0 +1,66 @@
+/*
+ * xen/arch/arm/platforms/thunderx.c
+ *
+ * Cavium Thunder specific settings
+ *
+ * Vijaya Kumar K <[email protected]>
+ * Copyright (c) 2015 Cavium 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.

xen/arch/arm/platforms/thunderx.c line 27

Quoted 10 lines
xen/arch/arm/platforms/thunderx.c new file +10 -0
+ */
+
+#include <asm/platform.h>
+
+static int thunderx_specific_mapping(struct domain *d)
+{
+    uint64_t addr, size;
+    int res;
+
+    /* Mappings GSER region required for dom0 */

Mapping

xen/arch/arm/platforms/thunderx.c line 34

Quoted 7 lines
xen/arch/arm/platforms/thunderx.c new file +7 -0
+    addr = 0x87e090000000;
+    size = 0xd000000;
+
+    res = map_mmio_regions(d,
+                           paddr_to_pfn(addr & PAGE_MASK),
+                           DIV_ROUND_UP(size, PAGE_SIZE),
+                           paddr_to_pfn(addr & PAGE_MASK));

OOI, why this region is not described in the DT? Is it a PCI device?

xen/arch/arm/platforms/thunderx.c line 37

Quoted 3 lines
xen/arch/arm/platforms/thunderx.c new file +3 -0
+    if ( res )
+    {
+         printk(XENLOG_ERR "Unable to map to dom%d region"

It would be more clear to specify the name of the region i.e "GSER region"

Regards,

Signature · 1 line
Julien Grall
#3 lore raw

Re: [PATCH v2 1/3] xen/arm: Add ThunderX platform support

Quoted 1 line · Julien Grall
Quoted 1 line

+ uint64_t addr, size;

Please use paddr_t and PRIpaddr etc.

Quoted 6 lines

xen/arch/arm/platforms/thunderx.c line 34

Quoted 4 lines
xen/arch/arm/platforms/thunderx.c new file +4 -0
+    res = map_mmio_regions(d,
+                           paddr_to_pfn(addr & PAGE_MASK),
+                           DIV_ROUND_UP(size, PAGE_SIZE),
+                           paddr_to_pfn(addr & PAGE_MASK));

OOI, why this region is not described in the DT? Is it a PCI device?

I'm curious too.

Quoted 5 lines

xen/arch/arm/platforms/thunderx.c line 37

Quoted 3 lines
xen/arch/arm/platforms/thunderx.c new file +3 -0
+    if ( res )
+    {
+         printk(XENLOG_ERR "Unable to map to dom%d region"

It would be more clear to specify the name of the region i.e "GSER region"

Agreed.

Ian.

#4 lore raw

Re: [PATCH v2 1/3] xen/arm: Add ThunderX platform support

Quoted 12 lines · Ian Campbell
Quoted 1 line · Julien Grall
Quoted 1 line

+ uint64_t addr, size;

Please use paddr_t and PRIpaddr etc.

Quoted 6 lines

xen/arch/arm/platforms/thunderx.c line 34

Quoted 4 lines
xen/arch/arm/platforms/thunderx.c new file +4 -0
+    res = map_mmio_regions(d,
+                           paddr_to_pfn(addr & PAGE_MASK),
+                           DIV_ROUND_UP(size, PAGE_SIZE),
+                           paddr_to_pfn(addr & PAGE_MASK));

OOI, why this region is not described in the DT? Is it a PCI device?

It is not PCI device. it is Global SerDes configuration region. It is not
mentioned in DT.

Quoted 9 lines

I'm curious too.

Quoted 5 lines

xen/arch/arm/platforms/thunderx.c line 37

Quoted 3 lines
xen/arch/arm/platforms/thunderx.c new file +3 -0
+    if ( res )
+    {
+         printk(XENLOG_ERR "Unable to map to dom%d region"

It would be more clear to specify the name of the region i.e "GSER region"

Agreed.

OK. will be fixed

Regards,
Vijay

#5 lore raw

Re: [PATCH v2 1/3] xen/arm: Add ThunderX platform support

Quoted 11 lines · Vijay Kilari
Quoted 10 lines · Ian Campbell
Quoted 1 line · Julien Grall
Quoted 1 line

+ uint64_t addr, size;

Please use paddr_t and PRIpaddr etc.

Quoted 5 lines
Quoted 4 lines
xen/arch/arm/platforms/thunderx.c new file +4 -0
+    res = map_mmio_regions(d,
+                           paddr_to_pfn(addr & PAGE_MASK),
+                           DIV_ROUND_UP(size, PAGE_SIZE),
+                           paddr_to_pfn(addr & PAGE_MASK));
Quoted 5 lines
Quoted 2 lines
Quoted 1 line

OOI, why this region is not described in the DT? Is it a PCI device?

It is not PCI device. it is Global SerDes configuration region. It is not
mentioned in DT.

Why not? Should it be?

Quoted 15 lines
Quoted 10 lines

I'm curious too.

Quoted 5 lines

xen/arch/arm/platforms/thunderx.c line 37

Quoted 3 lines
xen/arch/arm/platforms/thunderx.c new file +3 -0
+    if ( res )
+    {
+         printk(XENLOG_ERR "Unable to map to dom%d region"

It would be more clear to specify the name of the region i.e "GSER region"

Agreed.

OK. will be fixed

Regards,
Vijay

#6 lore raw

Re: [PATCH v2 1/3] xen/arm: Add ThunderX platform support

Quoted 12 lines · Ian Campbell
Quoted 11 lines · Vijay Kilari
Quoted 10 lines · Ian Campbell
Quoted 1 line · Julien Grall
Quoted 1 line

+ uint64_t addr, size;

Please use paddr_t and PRIpaddr etc.

Quoted 5 lines
Quoted 4 lines
xen/arch/arm/platforms/thunderx.c new file +4 -0
+    res = map_mmio_regions(d,
+                           paddr_to_pfn(addr & PAGE_MASK),
+                           DIV_ROUND_UP(size, PAGE_SIZE),
+                           paddr_to_pfn(addr & PAGE_MASK));
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line

OOI, why this region is not described in the DT? Is it a PCI device?

It is not PCI device. it is Global SerDes configuration region. It is not
mentioned in DT.

Why not? Should it be?

There is no specific driver in dom0 for this.
It is only used by thunder pci driver in dom0 to configure serdes. In future we plan to
get rid of this. But for now we can have this mapping.

Quoted 18 lines
Quoted 16 lines
Quoted 11 lines

I'm curious too.

Quoted 5 lines

xen/arch/arm/platforms/thunderx.c line 37

Quoted 3 lines
xen/arch/arm/platforms/thunderx.c new file +3 -0
+    if ( res )
+    {
+         printk(XENLOG_ERR "Unable to map to dom%d region"

It would be more clear to specify the name of the region i.e "GSER region"

Agreed.

OK. will be fixed

Regards,
Vijay

#7 lore raw

Re: [PATCH v2 1/3] xen/arm: Add ThunderX platform support

Quoted 16 lines · Vijay Kilari
Quoted 15 lines · Ian Campbell
Quoted 14 lines · Vijay Kilari
Quoted 12 lines · Ian Campbell
Quoted 1 line · Julien Grall
Quoted 1 line

+ uint64_t addr, size;

Please use paddr_t and PRIpaddr etc.

Quoted 6 lines

xen/arch/arm/platforms/thunderx.c line 34

Quoted 4 lines
xen/arch/arm/platforms/thunderx.c new file +4 -0
+    res = map_mmio_regions(d,
+                           paddr_to_pfn(addr & PAGE_MASK),
+                           DIV_ROUND_UP(size, PAGE_SIZE),
+                           paddr_to_pfn(addr & PAGE_MASK));

OOI, why this region is not described in the DT? Is it a PCI device?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

It is not PCI device. it is Global SerDes configuration region. It is not
mentioned in DT.

Why not? Should it be?

There is no specific driver in dom0 for this.
It is only used by thunder pci driver in dom0 to configure serdes.

A DT is supposed to describe the hardware, so the presence or absence of a driver in the kernel doesn't really come in to it.

Quoted 2 lines

In future we plan to get rid of this. But for now we can have this mapping.

The problem is that removing this mapping in the future may, depending on how it is all done, break compatibility with older kernels.

Could you describe how you plan to get rid of it please so I can see if we need to worry about that sort of thing here?

To avoid blocking the rest of the series it might be a good idea to factor out this specific mapping into a separate patch, then the rest can go in, plus you can then use the commit message to explain what the plan is etc.

#8 lore raw

PATCH v2 2/3 xen/arm: Add early printk support for ThunderX platform

In reply to [email protected]

From: Vijaya Kumar K <[email protected]>

ThunderX platform uses pl011 uart.

---
 xen/arch/arm/Rules.mk |    4 ++++
 1 file changed, 4 insertions(+)
xen/arch/arm/Rules.mk +4 -0
index c7bd227..54efa91 100644
@@ -113,6 +113,10 @@ ifeq ($(CONFIG_EARLY_PRINTK), lager)
 EARLY_PRINTK_INC := scif
 EARLY_UART_BASE_ADDRESS := 0xe6e60000
 endif
+ifeq ($(CONFIG_EARLY_PRINTK), thunderx)
+EARLY_PRINTK_INC := pl011
+EARLY_UART_BASE_ADDRESS := 0x87e024000000
+endif
 
 ifneq ($(EARLY_PRINTK_INC),)
 EARLY_PRINTK := y
Signature · 1 line
1.7.9.5
Acked-by on v2 2/3
#9 lore raw

Re: [PATCH v2 2/3] xen/arm: Add early printk support for ThunderX platform

Quoted 5 lines · On Wed, 2015-02-18 at 17:49 +0530, [email protected] wrote:

From: Vijaya Kumar K <[email protected]>

ThunderX platform uses pl011 uart.

Quoted 19 lines
---
 xen/arch/arm/Rules.mk |    4 ++++
 1 file changed, 4 insertions(+)
xen/arch/arm/Rules.mk +4 -0
index c7bd227..54efa91 100644
@@ -113,6 +113,10 @@ ifeq ($(CONFIG_EARLY_PRINTK), lager)
 EARLY_PRINTK_INC := scif
 EARLY_UART_BASE_ADDRESS := 0xe6e60000
 endif
+ifeq ($(CONFIG_EARLY_PRINTK), thunderx)
+EARLY_PRINTK_INC := pl011
+EARLY_UART_BASE_ADDRESS := 0x87e024000000
+endif
 
 ifneq ($(EARLY_PRINTK_INC),)
 EARLY_PRINTK := y
#10 lore raw

PATCH v2 3/3 xen/arm: Skip parsing psci-0.2 from host device tree

In reply to [email protected]

From: Vijaya Kumar K <[email protected]>

psci node is generated by xen for dom0.
if the host device tree has psci-0.2 skip parsing this node and avoid copying from host device tree to dom0 device tree

---
 xen/arch/arm/domain_build.c |    1 +
 1 file changed, 1 insertion(+)
xen/arch/arm/domain_build.c +1 -0
index c2dcb49..0be639b 100644
@@ -1029,6 +1029,7 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo,
         DT_MATCH_COMPATIBLE("xen,multiboot-module"),
         DT_MATCH_COMPATIBLE("multiboot,module"),
         DT_MATCH_COMPATIBLE("arm,psci"),
+        DT_MATCH_COMPATIBLE("arm,psci-0.2"),
         DT_MATCH_PATH("/cpus"),
         DT_MATCH_TYPE("memory"),
         /* The memory mapped timer is not supported by Xen. */
Signature · 1 line
1.7.9.5
Acked-by on v2 3/3
#11 lore raw

Re: [PATCH v2 3/3] xen/arm: Skip parsing psci-0.2 from host device tree

Quoted 7 lines · On Wed, 2015-02-18 at 17:49 +0530, [email protected] wrote:

From: Vijaya Kumar K <[email protected]>

psci node is generated by xen for dom0.
if the host device tree has psci-0.2 skip parsing this node and avoid copying from host device tree to dom0 device tree

Seems like a candidate for backport to 4.5.

Quoted 16 lines
---
 xen/arch/arm/domain_build.c |    1 +
 1 file changed, 1 insertion(+)
xen/arch/arm/domain_build.c +1 -0
index c2dcb49..0be639b 100644
@@ -1029,6 +1029,7 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo,
         DT_MATCH_COMPATIBLE("xen,multiboot-module"),
         DT_MATCH_COMPATIBLE("multiboot,module"),
         DT_MATCH_COMPATIBLE("arm,psci"),
+        DT_MATCH_COMPATIBLE("arm,psci-0.2"),
         DT_MATCH_PATH("/cpus"),
         DT_MATCH_TYPE("memory"),
         /* The memory mapped timer is not supported by Xen. */
#12 lore raw

Re: [PATCH v2 3/3] xen/arm: Skip parsing psci-0.2 from host device tree

I think the title of the commit message is misleading.

I gave the impression that we don't want to parse the PSCI-0.2 for Xen, which is obviously wrong.

A better title would be: "Don't pass the PSCI-0.2 node to the DOM0"

Quoted 6 lines · Ian Campbell
Quoted 5 lines · On Wed, 2015-02-18 at 17:49 +0530, [email protected] wrote:

From: Vijaya Kumar K <[email protected]>

psci node is generated by xen for dom0.
if the host device tree has psci-0.2 skip parsing this node and avoid copying from host device tree to dom0 device tree

Missing "." at the end of the sentence.

Quoted 6 lines
Quoted 2 lines

Seems like a candidate for backport to 4.5.

I think so.

Regards,

Signature · 1 line
Julien Grall