Skip to contentSkip to conversation

Add ThunderX platform support

PATCH Applied [email protected] 3 participants 12 messages Mar 4, 2015 – Mar 17, 2015

lore
Share & tools
lore
#0 lore raw

v3 cover Add ThunderX platform support

From: Vijaya Kumar K <[email protected]>

Changes in v3:
- Made ThunderX GSER region mapping as separate patch
- Updated patch 3 commit message

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 (4):
xen/arm: Add ThunderX platform support xen/arm: Add GSER region to ThunderX platform mapping xen/arm: Add early printk support for ThunderX platform xen/arm: Don't pass the PSCI-0.2 node to DOM0

 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 |   67 +++++++++++++++++++++++++++++++++++++
 xen/arch/arm/setup.c              |    1 +
 5 files changed, 74 insertions(+)
 create mode 100644 xen/arch/arm/platforms/thunderx.c
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v3 1/4 xen/arm: Add ThunderX platform support

From: Vijaya Kumar K <[email protected]>

Add basic support for Cavium ThunderX platform

---
v3 changes:
- Made Thunderx specific mappings as separate patch
- Improved printk error message

v2 changes:
- Update processor_implementers[]

---
 xen/arch/arm/platforms/Makefile   |    1 +
 xen/arch/arm/platforms/thunderx.c |   41 +++++++++++++++++++++++++++++++++++++
 xen/arch/arm/setup.c              |    1 +
 3 files changed, 43 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 +41 -0

41 lines not on this page · raw message

xen/arch/arm/setup.c +1 -0
index 9a1c285..b905c9f 100644
@@ -71,6 +71,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

PATCH v2 2/4 xen/arm: Add GSER region to ThunderX platform mapping

In reply to [email protected]

From: Vijaya Kumar K <[email protected]>

Add GSER region to thunderx platfrom specific mappings. This region is not mentioned in DT. This is required by PCI driver to detect and configure pci devices attached.

In future we can remove this mapping, if pci driver in Dom does not require this.

---
 xen/arch/arm/platforms/thunderx.c |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
xen/arch/arm/platforms/thunderx.c +26 -0
index be6f24f..563d01b 100644
@@ -19,6 +19,31 @@
 
 #include <asm/platform.h>
 
+static int thunderx_specific_mapping(struct domain *d)
+{
+    paddr_t addr;
+    u64 size;
+    int res;
+
+    /* Mapping GSER region required for Dom0 */
+    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));
+    if ( res )
+    {
+         printk(XENLOG_ERR "Unable to map GSER region to dom%d"
+                " 0x%"PRIpaddr" - 0x%"PRIpaddr"\n",
+                d->domain_id,
+                addr & PAGE_MASK, PAGE_ALIGN(addr + size) - 1);
+    }
+
+    return 0;
+}
+
 static const char * const thunderx_dt_compat[] __initconst =
 {
     "cavium,thunder-88xx",
@@ -27,6 +52,7 @@ static const char * const thunderx_dt_compat[] __initconst =
 
 PLATFORM_START(thunderx, "THUNDERX")
     .compatible = thunderx_dt_compat,
+    .specific_mapping = thunderx_specific_mapping,
     .dom0_gnttab_start = 0x40000000000,
     .dom0_gnttab_size = 0x20000,
 PLATFORM_END
Signature · 1 line
1.7.9.5
#3 lore raw

Re: [PATCH v2 2/4] xen/arm: Add GSER region to ThunderX platform mapping

Quoted 8 lines · On Wed, 2015-03-04 at 11:36 +0530, [email protected] wrote:

From: Vijaya Kumar K <[email protected]>

Add GSER region to thunderx platfrom specific mappings. This region is not mentioned in DT. This is required by PCI driver to detect and configure pci devices attached.

In future we can remove this mapping, if pci driver in Dom does not require this.

How do we know what the PCI driver in dom0 needs? I don't think we can, so we can in effect never remove this specific mapping, which is a shame.

Unless you have some scheme in mind which would allow us to do so?

IMHO by far the best solution would be to add this device to the DTB so that it is correctly mapped. I'm not quite sure what that will look like since thne mainline DTB doesn't have the PCI node at all.

Quoted 50 lines
---
 xen/arch/arm/platforms/thunderx.c |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
xen/arch/arm/platforms/thunderx.c +26 -0
index be6f24f..563d01b 100644
@@ -19,6 +19,31 @@
 
 #include <asm/platform.h>
 
+static int thunderx_specific_mapping(struct domain *d)
+{
+    paddr_t addr;
+    u64 size;
+    int res;
+
+    /* Mapping GSER region required for Dom0 */
+    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));
+    if ( res )
+    {
+         printk(XENLOG_ERR "Unable to map GSER region to dom%d"
+                " 0x%"PRIpaddr" - 0x%"PRIpaddr"\n",
+                d->domain_id,
+                addr & PAGE_MASK, PAGE_ALIGN(addr + size) - 1);
+    }
+
+    return 0;
+}
+
 static const char * const thunderx_dt_compat[] __initconst =
 {
     "cavium,thunder-88xx",
@@ -27,6 +52,7 @@ static const char * const thunderx_dt_compat[] __initconst =
 
 PLATFORM_START(thunderx, "THUNDERX")
     .compatible = thunderx_dt_compat,
+    .specific_mapping = thunderx_specific_mapping,
     .dom0_gnttab_start = 0x40000000000,
     .dom0_gnttab_size = 0x20000,
 PLATFORM_END
#4 lore raw

Re: [PATCH v2 2/4] xen/arm: Add GSER region to ThunderX platform mapping

Quoted 14 lines · Ian Campbell
Quoted 8 lines · On Wed, 2015-03-04 at 11:36 +0530, [email protected] wrote:

From: Vijaya Kumar K <[email protected]>

Add GSER region to thunderx platfrom specific mappings. This region is not mentioned in DT. This is required by PCI driver to detect and configure pci devices attached.

In future we can remove this mapping, if pci driver in Dom does not require this.

How do we know what the PCI driver in dom0 needs? I don't think we can, so we can in effect never remove this specific mapping, which is a shame.

Quoted 5 lines

Unless you have some scheme in mind which would allow us to do so?

IMHO by far the best solution would be to add this device to the DTB so that it is correctly mapped. I'm not quite sure what that will look like since thne mainline DTB doesn't have the PCI node at all.

Looking at a more recent DTB which I have access to it seems like 0x87e090000000 is correctly covered by a ranges entry on the PCI controller node.

So I think all which is needed is a) to use this updated DTB and b) my series "xen: arm: Parse PCI DT nodes' ranges and interrupt-map" from last October which, as it happens, I've been working on bringing up to date yesterday and today (one more thing to clean up before I repost).

Ian.

#5 lore raw

Re: [PATCH v2 2/4] xen/arm: Add GSER region to ThunderX platform mapping

Hi Ian,

Quoted 17 lines · Ian Campbell
Quoted 16 lines · Ian Campbell
Quoted 8 lines · On Wed, 2015-03-04 at 11:36 +0530, [email protected] wrote:

From: Vijaya Kumar K <[email protected]>

Add GSER region to thunderx platfrom specific mappings. This region is not mentioned in DT. This is required by PCI driver to detect and configure pci devices attached.

In future we can remove this mapping, if pci driver in Dom does not require this.

How do we know what the PCI driver in dom0 needs? I don't think we can, so we can in effect never remove this specific mapping, which is a shame.

Unless you have some scheme in mind which would allow us to do so?

Quoted 7 lines
Quoted 3 lines

IMHO by far the best solution would be to add this device to the DTB so that it is correctly mapped. I'm not quite sure what that will look like since thne mainline DTB doesn't have the PCI node at all.

Looking at a more recent DTB which I have access to it seems like 0x87e090000000 is correctly covered by a ranges entry on the PCI controller node.

Where did you find recent DTB?. AFAIK, this region does not fall under any pci controller range.

Quoted 5 lines

So I think all which is needed is a) to use this updated DTB and b) my series "xen: arm: Parse PCI DT nodes' ranges and interrupt-map" from last October which, as it happens, I've been working on bringing up to date yesterday and today (one more thing to clean up before I repost).

Because it is not covered under any PCI ranges, your patch series still does not help.
Infact, this is common region for SERDES configuration so cannot bind to any particular pci controller range.

Regards
Vijay

#6 lore raw

Re: [PATCH v2 2/4] xen/arm: Add GSER region to ThunderX platform mapping

Quoted 24 lines · Vijay Kilari

Hi Ian,

Quoted 21 lines · Ian Campbell
Quoted 19 lines · Ian Campbell
Quoted 8 lines · On Wed, 2015-03-04 at 11:36 +0530, [email protected] wrote:

From: Vijaya Kumar K <[email protected]>

Add GSER region to thunderx platfrom specific mappings. This region is not mentioned in DT. This is required by PCI driver to detect and configure pci devices attached.

In future we can remove this mapping, if pci driver in Dom does not require this.

How do we know what the PCI driver in dom0 needs? I don't think we can, so we can in effect never remove this specific mapping, which is a shame.

Unless you have some scheme in mind which would allow us to do so?

IMHO by far the best solution would be to add this device to the DTB so that it is correctly mapped. I'm not quite sure what that will look like since thne mainline DTB doesn't have the PCI node at all.

Quoted 6 lines
Quoted 3 lines

Looking at a more recent DTB which I have access to it seems like 0x87e090000000 is correctly covered by a ranges entry on the PCI controller node.

Where did you find recent DTB?. AFAIK, this region does not fall under any pci controller range.

It was in the tree you guys sent me a little while back. ThunderX_Release_v0.3.tar.gz IIRC.

thunder-88xx-2n.dtsi in that contains a PCI node "pcie0:
pcie0@0x8480,00000000" with ranges containing this entry:

                         <0x03000000 0x87e0 0x00000000 0x87e0 0x00000000 0x01 0x00000000>,

Which covers the range from 0x87e000000000 to 0xe7f00000000, i.e. covering this region at 0x87e090000000.

Quoted 9 lines
Quoted 4 lines

So I think all which is needed is a) to use this updated DTB and b) my series "xen: arm: Parse PCI DT nodes' ranges and interrupt-map" from last October which, as it happens, I've been working on bringing up to date yesterday and today (one more thing to clean up before I repost).

Because it is not covered under any PCI ranges, your patch series still does not help.
Infact, this is common region for SERDES configuration so cannot bind to any particular pci controller range.

Even if that turns out to be the case then surely this regions needs to be defined somehow in the DT else how could it be discovered.

Ian.

#7 lore raw

PATCH v3 3/4 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
#8 lore raw

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

Hello Vijay,

Quoted 4 lines · On 4 Mar 2015 06:06, <[email protected]> wrote:

From: Vijaya Kumar K <[email protected]>

ThunderX platform uses pl011 uart.

You need to update docs/misc/arm/early-printk.txt.

Regards,

Quoted 22 lines
---
 xen/arch/arm/Rules.mk |    4 ++++
 1 file changed, 4 insertions(+)
xen/arch/arm/Rules.mk +4 -1
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
--
Quoted 2 lines

1.7.9.5

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#9 lore raw

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

Quoted 10 lines · Julien Grall

Hello Vijay,

Quoted 4 lines · On 4 Mar 2015 06:06, <[email protected]> wrote:

From: Vijaya Kumar K <[email protected]>

ThunderX platform uses pl011 uart.

You need to update docs/misc/arm/early-printk.txt.

I'll insert

"- thunderx: printk with pl011 for Cavium ThunderX processor."

as I commit. If that doesn't suit then please followup with a correction ;-)

Quoted 30 lines

Regards,

Quoted 24 lines
---
 xen/arch/arm/Rules.mk |    4 ++++
 1 file changed, 4 insertions(+)
xen/arch/arm/Rules.mk +4 -1
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
--

1.7.9.5

#10 lore raw

PATCH v3 4/4 xen/arm: Don't pass the PSCI-0.2 node to DOM0

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.

---
v3 changes:
- Updated commit message

---
 xen/arch/arm/domain_build.c |    1 +
 1 file changed, 1 insertion(+)
xen/arch/arm/domain_build.c +1 -0
index 9f1f59f..4422cfb 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