xen: arm: xgene bug fixes + support for McDivitt
v2 cover xen: arm: xgene bug fixes + support for McDivitt
These patches:
* fix up an off by one bug in the xgene mapping of additional PCI bus resources, which would cause an additional extra page to be mapped
* correct the size of the mapped regions to match the docs
* adds support for the other 4 PCI buses on the chip, which enables mcdivitt and presumably most other Xgene based platforms which uses PCI buses other than pcie0.
* adds earlyprintk for the mcdivitt platform
They can also be found at:
git://xenbits.xen.org/people/ianc/xen.git mcdivitt-v2
McDivitt is the X-Gene based HP Moonshot cartridge (McDivitt is the code name, I think the product is called m400, not quite sure).
Other than the bug fixes I'd like to see the mcdivitt support (specifically the "other 4 PCI buses" one) in 4.5 because Moonshot is an interesting and exciting platform for arm64. It is also being used for ongoing work on Xen on ARM on Openstack in Linaro. The earlyprintk patch is totally harmless unless it's explicitly enabled at compile time, IMHO if we are taking the rest we may as well throw it in...
The risk here is that we break the existing support for the Mustang platform, which would be the most likely failure case for the second patch. I've tested these on a Mustang, including firing up a PCI NIC device. The new mappings are a superset of the existing ones so the potential for breakage should be quite small.
I've also successfully tested on a McDivitt.
Ian.
PATCH v2 1/5 xen: arm: Add earlyprintk for McDivitt.
---
v2: Remove pointless/unused baud rate setting.
A bunch of other entries have these, but cleaning them up is out of scope here I think.
--- xen/arch/arm/Rules.mk | 5 +++++ 1 file changed, 5 insertions(+)
xen/arch/arm/Rules.mk +5 -0
@@ -95,6 +95,11 @@ EARLY_PRINTK_BAUD := 115200 EARLY_UART_BASE_ADDRESS := 0x1c020000 EARLY_UART_REG_SHIFT := 2 endif +ifeq ($(CONFIG_EARLY_PRINTK), xgene-mcdivitt) +EARLY_PRINTK_INC := 8250 +EARLY_UART_BASE_ADDRESS := 0x1c021000 +EARLY_UART_REG_SHIFT := 2 +endif ifeq ($(CONFIG_EARLY_PRINTK), juno) EARLY_PRINTK_INC := pl011 EARLY_PRINTK_BAUD := 115200
Signature · 1 line
1.7.10.4
Re: [PATCH v2 for-4.5 1/5] xen: arm: Add earlyprintk for McDivitt.
Hi Ian,
Quoted 7 lines · Ian Campbell
Signed-off-by Ian Campbell <[email protected]>---
v2: Remove pointless/unused baud rate setting.A bunch of other entries have these, but cleaning them up is out of scope here I think.
Agreed.
Regards,
Quoted 21 lines
--- xen/arch/arm/Rules.mk | 5 +++++ 1 file changed, 5 insertions(+)xen/arch/arm/Rules.mk +5
-0@@ -95,6 +95,11 @@ EARLY_PRINTK_BAUD := 115200 EARLY_UART_BASE_ADDRESS := 0x1c020000 EARLY_UART_REG_SHIFT := 2 endif +ifeq ($(CONFIG_EARLY_PRINTK), xgene-mcdivitt) +EARLY_PRINTK_INC := 8250 +EARLY_UART_BASE_ADDRESS := 0x1c021000 +EARLY_UART_REG_SHIFT := 2 +endif ifeq ($(CONFIG_EARLY_PRINTK), juno) EARLY_PRINTK_INC := pl011 EARLY_PRINTK_BAUD := 115200
Signature · 1 line
Julien Grall
PATCH v2 2/5 xen: arm: Drop EARLY_PRINTK_BAUD from entries which don't set ..._INIT_UART
In reply to Ian CampbellEARLY_PRINTK_BAUD doesn't do anything unless EARLY_PRINTK_INIT_UART is set.
Furthermore only the pl011 driver implements the init routine at all, so the entries which use 8250 and specified a BAUD were doubly wrong.
---
v2: New patch.
--- xen/arch/arm/Rules.mk | 7 ------- 1 file changed, 7 deletions(-)
xen/arch/arm/Rules.mk +0 -7
@@ -45,7 +45,6 @@ ifeq ($(debug),y) # Early printk for versatile express ifeq ($(CONFIG_EARLY_PRINTK), vexpress) EARLY_PRINTK_INC := pl011 -EARLY_PRINTK_BAUD := 38400 EARLY_UART_BASE_ADDRESS := 0x1c090000 endif ifeq ($(CONFIG_EARLY_PRINTK), fastmodel)
@@ -56,12 +55,10 @@ EARLY_UART_BASE_ADDRESS := 0x1c090000 endif ifeq ($(CONFIG_EARLY_PRINTK), exynos5250) EARLY_PRINTK_INC := exynos4210 -EARLY_PRINTK_BAUD := 115200 EARLY_UART_BASE_ADDRESS := 0x12c20000 endif ifeq ($(CONFIG_EARLY_PRINTK), midway) EARLY_PRINTK_INC := pl011 -EARLY_PRINTK_BAUD := 115200 EARLY_UART_BASE_ADDRESS := 0xfff36000 endif ifeq ($(CONFIG_EARLY_PRINTK), omap5432)
@@ -91,7 +88,6 @@ EARLY_UART_REG_SHIFT := 2 endif ifeq ($(CONFIG_EARLY_PRINTK), xgene-storm) EARLY_PRINTK_INC := 8250 -EARLY_PRINTK_BAUD := 115200 EARLY_UART_BASE_ADDRESS := 0x1c020000 EARLY_UART_REG_SHIFT := 2 endif
@@ -102,18 +98,15 @@ EARLY_UART_REG_SHIFT := 2 endif ifeq ($(CONFIG_EARLY_PRINTK), juno) EARLY_PRINTK_INC := pl011 -EARLY_PRINTK_BAUD := 115200 EARLY_UART_BASE_ADDRESS := 0x7ff80000 endif ifeq ($(CONFIG_EARLY_PRINTK), hip04-d01) EARLY_PRINTK_INC := 8250 -EARLY_PRINTK_BAUD := 115200 EARLY_UART_BASE_ADDRESS := 0xE4007000 EARLY_UART_REG_SHIFT := 2 endif ifeq ($(CONFIG_EARLY_PRINTK), seattle) EARLY_PRINTK_INC := pl011 -EARLY_PRINTK_BAUD := 115200 EARLY_UART_BASE_ADDRESS := 0xe1010000 endif
Signature · 1 line
1.7.10.4
Re: [PATCH v2 for-4.5 2/5] xen: arm: Drop EARLY_PRINTK_BAUD from entries which don't set ..._INIT_UART
Hi Ian,
Quoted 4 lines · Ian Campbell
EARLY_PRINTK_BAUDdoesn't do anything unlessEARLY_PRINTK_INIT_UARTis set.Furthermore only the pl011 driver implements the init routine at all, so the entries which use 8250 and specified a BAUD were doubly wrong.
NIT: and exynos4210
Maybe "use 8250" should be replaced by "other UARTs drivers"?
Quoted 1 line
Signed-off-by Ian Campbell <[email protected]>
Regards,
Quoted 59 lines
---
v2: New patch.--- xen/arch/arm/Rules.mk | 7 ------- 1 file changed, 7 deletions(-)xen/arch/arm/Rules.mk +0
-7@@ -45,7 +45,6 @@ ifeq ($(debug),y) # Early printk for versatile express ifeq ($(CONFIG_EARLY_PRINTK), vexpress) EARLY_PRINTK_INC := pl011 -EARLY_PRINTK_BAUD := 38400 EARLY_UART_BASE_ADDRESS := 0x1c090000 endif ifeq ($(CONFIG_EARLY_PRINTK), fastmodel)@@ -56,12 +55,10 @@ EARLY_UART_BASE_ADDRESS := 0x1c090000 endif ifeq ($(CONFIG_EARLY_PRINTK), exynos5250) EARLY_PRINTK_INC := exynos4210 -EARLY_PRINTK_BAUD := 115200 EARLY_UART_BASE_ADDRESS := 0x12c20000 endif ifeq ($(CONFIG_EARLY_PRINTK), midway) EARLY_PRINTK_INC := pl011 -EARLY_PRINTK_BAUD := 115200 EARLY_UART_BASE_ADDRESS := 0xfff36000 endif ifeq ($(CONFIG_EARLY_PRINTK), omap5432)@@ -91,7 +88,6 @@ EARLY_UART_REG_SHIFT := 2 endif ifeq ($(CONFIG_EARLY_PRINTK), xgene-storm) EARLY_PRINTK_INC := 8250 -EARLY_PRINTK_BAUD := 115200 EARLY_UART_BASE_ADDRESS := 0x1c020000 EARLY_UART_REG_SHIFT := 2 endif@@ -102,18 +98,15 @@ EARLY_UART_REG_SHIFT := 2 endif ifeq ($(CONFIG_EARLY_PRINTK), juno) EARLY_PRINTK_INC := pl011 -EARLY_PRINTK_BAUD := 115200 EARLY_UART_BASE_ADDRESS := 0x7ff80000 endif ifeq ($(CONFIG_EARLY_PRINTK), hip04-d01) EARLY_PRINTK_INC := 8250 -EARLY_PRINTK_BAUD := 115200 EARLY_UART_BASE_ADDRESS := 0xE4007000 EARLY_UART_REG_SHIFT := 2 endif ifeq ($(CONFIG_EARLY_PRINTK), seattle) EARLY_PRINTK_INC := pl011 -EARLY_PRINTK_BAUD := 115200 EARLY_UART_BASE_ADDRESS := 0xe1010000 endif
Signature · 1 line
Julien Grall
PATCH v2 3/5 xen: arm: correct off by one in xgene-storm's map_one_mmio
In reply to Ian CampbellThe callers pass the end as the pfn immediately *after* the last page to be mapped, therefore adding one is incorrect and causes an additional page to be mapped.
At the same time correct the printing of the mfn values, zero-padding them to 16 digits as for a paddr when they are frame numbers is just confusing.
---
v2: Fix the other printk format string too.
--- xen/arch/arm/platforms/xgene-storm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
xen/arch/arm/platforms/xgene-storm.c +3 -3
@@ -45,11 +45,11 @@ static int map_one_mmio(struct domain *d, const char *what, {int ret; -printk ("Additional MMIO %" PRIpaddr"-%" PRIpaddr" (%s)\n" , +printk ("Additional MMIO %lx-%lx (%s)\n" , start, end, what); - ret =map_mmio_regions (d, start, end - start +1 , start); + ret =map_mmio_regions (d, start, end - start, start);if ( ret ) -printk ("Failed to map %s @ %" PRIpaddr" to dom%d\n" , +printk ("Failed to map %s @ %lx to dom%d\n" , what, start, d->domain_id);return ret; }
Signature · 1 line
1.7.10.4
Re: [PATCH v2 for-4.5 3/5] xen: arm: correct off by one in xgene-storm's map_one_mmio
Hi Ian,
Quoted 8 lines · Ian Campbell
The callers pass the end as the pfn immediately *after* the last page to be mapped, therefore adding one is incorrect and causes an additional page to be mapped.
At the same time correct the printing of the mfn values, zero-padding them to 16 digits as for a paddr when they are frame numbers is just confusing.
Signed-off-by Ian Campbell <[email protected]>
Regards,
Quoted 26 lines
---
v2: Fix the other printk format string too.--- xen/arch/arm/platforms/xgene-storm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)xen/arch/arm/platforms/xgene-storm.c +3
-3@@ -45,11 +45,11 @@ static int map_one_mmio(struct domain *d, const char *what, {int ret; -printk ("Additional MMIO %" PRIpaddr"-%" PRIpaddr" (%s)\n" , +printk ("Additional MMIO %lx-%lx (%s)\n" , start, end, what); - ret =map_mmio_regions (d, start, end - start +1 , start); + ret =map_mmio_regions (d, start, end - start, start);if ( ret ) -printk ("Failed to map %s @ %" PRIpaddr" to dom%d\n" , +printk ("Failed to map %s @ %lx to dom%d\n" , what, start, d->domain_id);return ret; }
Signature · 1 line
Julien Grall
PATCH v2 4/5 xen: arm: correct specific mappings for PCIE0 on X-Gene
In reply to Ian CampbellThe region assigned to PCIE0, according to the docs, is 0x0e000000000 to 0x10000000000. They make no distinction between PCI CFG and PCI IO mem within this range (in fact, I'm not sure that isn't up to the driver).
--- xen/arch/arm/platforms/xgene-storm.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-)
xen/arch/arm/platforms/xgene-storm.c +2 -16
@@ -89,22 +89,8 @@ static int xgene_storm_specific_mapping(struct domain *d)int ret;/* Map the PCIe bus resources */ - ret =map_one_mmio (d,"PCI MEM REGION" ,paddr_to_pfn (0xe000000000UL ), -paddr_to_pfn (0xe010000000UL )); -if ( ret ) - goto err; - - ret =map_one_mmio (d,"PCI IO REGION" ,paddr_to_pfn (0xe080000000UL ), -paddr_to_pfn (0xe080010000UL )); -if ( ret ) - goto err; - - ret =map_one_mmio (d,"PCI CFG REGION" ,paddr_to_pfn (0xe0d0000000UL ), -paddr_to_pfn (0xe0d0200000UL )); -if ( ret ) - goto err; - ret =map_one_mmio (d,"PCI MSI REGION" ,paddr_to_pfn (0xe010000000UL ), -paddr_to_pfn (0xe010800000UL )); + ret =map_one_mmio (d,"PCI MEMORY" ,paddr_to_pfn (0x0e000000000UL ), +paddr_to_pfn (0x01000000000UL ));if ( ret ) goto err;
Signature · 1 line
1.7.10.4
PATCH v2 5/5 xen: arm: Support the other 4 PCI buses on Xgene
In reply to Ian CampbellCurrently we only establish specific mappings for pcie0, which is used on the Mustang platform. However at least McDivitt uses pcie3. So wire up all the others, based on whether the corresponding DT node is marked as available.
This results in no change for Mustang.
---
v2: - Didn't constify dt node pointer -- dt_find_compatible_node needs a
non-const
- Print a message when ignoring an unknown bus
- Log with dt node full anme instead of CFG space address.
- Log at start of xgene_storm_pcie_specific_mapping instead of in the caller after the fact.
--- xen/arch/arm/platforms/xgene-storm.c | 89 +++++++++++++++++++++++++++++----- 1 file changed, 76 insertions(+), 13 deletions(-)
xen/arch/arm/platforms/xgene-storm.c +76 -13
@@ -78,35 +78,35 @@ static int map_one_spi(struct domain *d, const char *what,return ret; } -/* -* Xen does not currently support mapping MMIO regions and interrupt -* for bus child devices (referenced via the "ranges" and -* "interrupt-map" properties to domain 0). Instead for now map the -* necessary resources manually. -*/ -static int xgene_storm_specific_mapping (struct domain *d) +/* Creates MMIO mappings base..end as well as 4 SPIs from the given base. */ +static int xgene_storm_pcie_specific_mapping (struct domain *d, +const struct dt_device_node *node, +paddr_t base,paddr_t end, +int base_spi) {int ret; +printk ("Mapping additional regions for PCIe device %s\n" , +dt_node_full_name (node)); +/* Map the PCIe bus resources */ - ret =map_one_mmio (d,"PCI MEMORY" ,paddr_to_pfn (0x0e000000000UL ), -paddr_to_pfn (0x01000000000UL )); + ret =map_one_mmio (d,"PCI MEMORY" ,paddr_to_pfn (base),paddr_to_pfn (end));if ( ret ) goto err; - ret =map_one_spi (d,"PCI#INTA" ,0xc2 ,DT_IRQ_TYPE_LEVEL_HIGH ); + ret =map_one_spi (d,"PCI#INTA" , base_spi+0 ,DT_IRQ_TYPE_LEVEL_HIGH );if ( ret ) goto err; - ret =map_one_spi (d,"PCI#INTB" ,0xc3 ,DT_IRQ_TYPE_LEVEL_HIGH ); + ret =map_one_spi (d,"PCI#INTB" , base_spi+1 ,DT_IRQ_TYPE_LEVEL_HIGH );if ( ret ) goto err; - ret =map_one_spi (d,"PCI#INTC" ,0xc4 ,DT_IRQ_TYPE_LEVEL_HIGH ); + ret =map_one_spi (d,"PCI#INTC" , base_spi+2 ,DT_IRQ_TYPE_LEVEL_HIGH );if ( ret ) goto err; - ret =map_one_spi (d,"PCI#INTD" ,0xc5 ,DT_IRQ_TYPE_LEVEL_HIGH ); + ret =map_one_spi (d,"PCI#INTD" , base_spi+3 ,DT_IRQ_TYPE_LEVEL_HIGH );if ( ret ) goto err;
@@ -115,6 +115,69 @@ err:return ret; } +/* +* Xen does not currently support mapping MMIO regions and interrupt +* for bus child devices (referenced via the "ranges" and +* "interrupt-map" properties to domain 0). Instead for now map the +* necessary resources manually. +*/ +static int xgene_storm_specific_mapping (struct domain *d) +{ +struct dt_device_node *node =NULL ; +int ret; + +while ( (node =dt_find_compatible_node (node,"pci" ,"apm,xgene-pcie" )) ) + { +u64 addr; + +/* Identify the bus via it's control register address */ + ret =dt_device_get_address (node,0 , &addr,NULL ); +if ( ret <0 ) +return ret; + +if ( !dt_device_is_available (node) ) +continue ; + +switch ( addr ) + { +case 0x1f2b0000 :/* PCIe0 */ + ret =xgene_storm_pcie_specific_mapping (d, + node, +0x0e000000000UL ,0x10000000000UL ,0xc2 ); +break ; +case 0x1f2c0000 :/* PCIe1 */ + ret =xgene_storm_pcie_specific_mapping (d, + node, +0x0d000000000UL ,0x0e000000000UL ,0xc8 ); +break ; +case 0x1f2d0000 :/* PCIe2 */ + ret =xgene_storm_pcie_specific_mapping (d, + node, +0x09000000000UL ,0x0a000000000UL ,0xce ); +break ; +case 0x1f500000 :/* PCIe3 */ + ret =xgene_storm_pcie_specific_mapping (d, + node, +0x0a000000000UL ,0x0c000000000UL ,0xd4 ); +break ; +case 0x1f510000 :/* PCIe4 */ + ret =xgene_storm_pcie_specific_mapping (d, + node, +0x0c000000000UL ,0x0d000000000UL ,0xda ); +break ; + +default : +printk ("Ignoring unknown PCI bus %s\n" ,dt_node_full_name (node)); +continue ; + } + +if ( ret <0 ) +return ret; + } + +return 0 ; +} +static void xgene_storm_reset (void ) {void __iomem *addr;
Signature · 1 line
1.7.10.4
Re: [PATCH v2 for-4.5 5/5] xen: arm: Support the other 4 PCI buses on Xgene
Hi Ian,
Quoted 11 lines · Ian Campbell
Currently we only establish specific mappings for pcie0, which is used on the Mustang platform. However at least McDivitt uses pcie3. So wire up all the others, based on whether the corresponding DT node is marked as available.
This results in no change for Mustang.
Signed-off-by Ian Campbell <[email protected]>---
v2: - Didn't constify dt node pointer --dt_find_compatible_nodeneeds a
non-const
Oh right. A bit annoying, I will look at it to see if we can constify the parameter in Xen 4.6.
Regards,
Quoted 132 lines
- Print a message when ignoring an unknown bus
- Log with dt node full anme instead of CFG space address.
- Log at start ofxgene_storm_pcie_specific_mappinginstead of in the caller after the fact.--- xen/arch/arm/platforms/xgene-storm.c | 89 +++++++++++++++++++++++++++++----- 1 file changed, 76 insertions(+), 13 deletions(-)xen/arch/arm/platforms/xgene-storm.c +76
-13@@ -78,35 +78,35 @@ static int map_one_spi(struct domain *d, const char *what,return ret; } -/* -* Xen does not currently support mapping MMIO regions and interrupt -* for bus child devices (referenced via the "ranges" and -* "interrupt-map" properties to domain 0). Instead for now map the -* necessary resources manually. -*/ -static int xgene_storm_specific_mapping (struct domain *d) +/* Creates MMIO mappings base..end as well as 4 SPIs from the given base. */ +static int xgene_storm_pcie_specific_mapping (struct domain *d, +const struct dt_device_node *node, +paddr_t base,paddr_t end, +int base_spi) {int ret; +printk ("Mapping additional regions for PCIe device %s\n" , +dt_node_full_name (node)); +/* Map the PCIe bus resources */ - ret =map_one_mmio (d,"PCI MEMORY" ,paddr_to_pfn (0x0e000000000UL ), -paddr_to_pfn (0x01000000000UL )); + ret =map_one_mmio (d,"PCI MEMORY" ,paddr_to_pfn (base),paddr_to_pfn (end));if ( ret ) goto err; - ret =map_one_spi (d,"PCI#INTA" ,0xc2 ,DT_IRQ_TYPE_LEVEL_HIGH ); + ret =map_one_spi (d,"PCI#INTA" , base_spi+0 ,DT_IRQ_TYPE_LEVEL_HIGH );if ( ret ) goto err; - ret =map_one_spi (d,"PCI#INTB" ,0xc3 ,DT_IRQ_TYPE_LEVEL_HIGH ); + ret =map_one_spi (d,"PCI#INTB" , base_spi+1 ,DT_IRQ_TYPE_LEVEL_HIGH );if ( ret ) goto err; - ret =map_one_spi (d,"PCI#INTC" ,0xc4 ,DT_IRQ_TYPE_LEVEL_HIGH ); + ret =map_one_spi (d,"PCI#INTC" , base_spi+2 ,DT_IRQ_TYPE_LEVEL_HIGH );if ( ret ) goto err; - ret =map_one_spi (d,"PCI#INTD" ,0xc5 ,DT_IRQ_TYPE_LEVEL_HIGH ); + ret =map_one_spi (d,"PCI#INTD" , base_spi+3 ,DT_IRQ_TYPE_LEVEL_HIGH );if ( ret ) goto err;@@ -115,6 +115,69 @@ err:return ret; } +/* +* Xen does not currently support mapping MMIO regions and interrupt +* for bus child devices (referenced via the "ranges" and +* "interrupt-map" properties to domain 0). Instead for now map the +* necessary resources manually. +*/ +static int xgene_storm_specific_mapping (struct domain *d) +{ +struct dt_device_node *node =NULL ; +int ret; + +while ( (node =dt_find_compatible_node (node,"pci" ,"apm,xgene-pcie" )) ) + { +u64 addr; + +/* Identify the bus via it's control register address */ + ret =dt_device_get_address (node,0 , &addr,NULL ); +if ( ret <0 ) +return ret; + +if ( !dt_device_is_available (node) ) +continue ; + +switch ( addr ) + { +case 0x1f2b0000 :/* PCIe0 */ + ret =xgene_storm_pcie_specific_mapping (d, + node, +0x0e000000000UL ,0x10000000000UL ,0xc2 ); +break ; +case 0x1f2c0000 :/* PCIe1 */ + ret =xgene_storm_pcie_specific_mapping (d, + node, +0x0d000000000UL ,0x0e000000000UL ,0xc8 ); +break ; +case 0x1f2d0000 :/* PCIe2 */ + ret =xgene_storm_pcie_specific_mapping (d, + node, +0x09000000000UL ,0x0a000000000UL ,0xce ); +break ; +case 0x1f500000 :/* PCIe3 */ + ret =xgene_storm_pcie_specific_mapping (d, + node, +0x0a000000000UL ,0x0c000000000UL ,0xd4 ); +break ; +case 0x1f510000 :/* PCIe4 */ + ret =xgene_storm_pcie_specific_mapping (d, + node, +0x0c000000000UL ,0x0d000000000UL ,0xda ); +break ; + +default : +printk ("Ignoring unknown PCI bus %s\n" ,dt_node_full_name (node)); +continue ; + } + +if ( ret <0 ) +return ret; + } + +return 0 ; +} +static void xgene_storm_reset (void ) {void __iomem *addr;
Signature · 1 line
Julien Grall
Re: [PATCH v2 for-4.5 5/5] xen: arm: Support the other 4 PCI buses on Xgene
In reply to Ian CampbellHi Ian,
Quoted 143 lines · Ian Campbell
Currently we only establish specific mappings for pcie0, which is used on the Mustang platform. However at least McDivitt uses pcie3. So wire up all the others, based on whether the corresponding DT node is marked as available.
This results in no change for Mustang.
Signed-off-by Ian Campbell <[email protected]>---
v2: - Didn't constify dt node pointer --dt_find_compatible_nodeneeds a
non-const
- Print a message when ignoring an unknown bus
- Log with dt node full anme instead of CFG space address.
- Log at start ofxgene_storm_pcie_specific_mappinginstead of in the caller after the fact.--- xen/arch/arm/platforms/xgene-storm.c | 89 +++++++++++++++++++++++++++++----- 1 file changed, 76 insertions(+), 13 deletions(-)xen/arch/arm/platforms/xgene-storm.c +76
-14@@ -78,35 +78,35 @@ static int map_one_spi(struct domain *d, const char *what,return ret; } -/* -* Xen does not currently support mapping MMIO regions and interrupt -* for bus child devices (referenced via the "ranges" and -* "interrupt-map" properties to domain 0). Instead for now map the -* necessary resources manually. -*/ -static int xgene_storm_specific_mapping (struct domain *d) +/* Creates MMIO mappings base..end as well as 4 SPIs from the given base. */ +static int xgene_storm_pcie_specific_mapping (struct domain *d, +const struct dt_device_node *node, +paddr_t base,paddr_t end, +int base_spi) {int ret; +printk ("Mapping additional regions for PCIe device %s\n" , +dt_node_full_name (node)); +/* Map the PCIe bus resources */ - ret =map_one_mmio (d,"PCI MEMORY" ,paddr_to_pfn (0x0e000000000UL ), -paddr_to_pfn (0x01000000000UL )); + ret =map_one_mmio (d,"PCI MEMORY" ,paddr_to_pfn (base),paddr_to_pfn (end));if ( ret ) goto err; - ret =map_one_spi (d,"PCI#INTA" ,0xc2 ,DT_IRQ_TYPE_LEVEL_HIGH ); + ret =map_one_spi (d,"PCI#INTA" , base_spi+0 ,DT_IRQ_TYPE_LEVEL_HIGH );if ( ret ) goto err; - ret =map_one_spi (d,"PCI#INTB" ,0xc3 ,DT_IRQ_TYPE_LEVEL_HIGH ); + ret =map_one_spi (d,"PCI#INTB" , base_spi+1 ,DT_IRQ_TYPE_LEVEL_HIGH );if ( ret ) goto err; - ret =map_one_spi (d,"PCI#INTC" ,0xc4 ,DT_IRQ_TYPE_LEVEL_HIGH ); + ret =map_one_spi (d,"PCI#INTC" , base_spi+2 ,DT_IRQ_TYPE_LEVEL_HIGH );if ( ret ) goto err; - ret =map_one_spi (d,"PCI#INTD" ,0xc5 ,DT_IRQ_TYPE_LEVEL_HIGH ); + ret =map_one_spi (d,"PCI#INTD" , base_spi+3 ,DT_IRQ_TYPE_LEVEL_HIGH );if ( ret ) goto err;@@ -115,6 +115,69 @@ err:return ret; } +/* +* Xen does not currently support mapping MMIO regions and interrupt +* for bus child devices (referenced via the "ranges" and +* "interrupt-map" properties to domain 0). Instead for now map the +* necessary resources manually. +*/ +static int xgene_storm_specific_mapping (struct domain *d) +{ +struct dt_device_node *node =NULL ; +int ret; + +while ( (node =dt_find_compatible_node (node,"pci" ,"apm,xgene-pcie" )) ) + { +u64 addr; + +/* Identify the bus via it's control register address */ + ret =dt_device_get_address (node,0 , &addr,NULL ); +if ( ret <0 ) +return ret; + +if ( !dt_device_is_available (node) ) +continue ; + +switch ( addr ) + { +case 0x1f2b0000 :/* PCIe0 */ + ret =xgene_storm_pcie_specific_mapping (d, + node, +0x0e000000000UL ,0x10000000000UL ,0xc2 ); +break ; +case 0x1f2c0000 :/* PCIe1 */ + ret =xgene_storm_pcie_specific_mapping (d, + node, +0x0d000000000UL ,0x0e000000000UL ,0xc8 ); +break ; +case 0x1f2d0000 :/* PCIe2 */ + ret =xgene_storm_pcie_specific_mapping (d, + node, +0x09000000000UL ,0x0a000000000UL ,0xce ); +break ; +case 0x1f500000 :/* PCIe3 */ + ret =xgene_storm_pcie_specific_mapping (d, + node, +0x0a000000000UL ,0x0c000000000UL ,0xd4 ); +break ; +case 0x1f510000 :/* PCIe4 */ + ret =xgene_storm_pcie_specific_mapping (d, + node, +0x0c000000000UL ,0x0d000000000UL ,0xda ); +break ; + +default : +printk ("Ignoring unknown PCI bus %s\n" ,dt_node_full_name (node)); +continue ; + } + +if ( ret <0 ) +return ret; + } + +return 0 ; +} +static void xgene_storm_reset (void ) {void __iomem *addr; --
Quoted 2 lines
1.7.10.4
Patch looks good.
Thanks,
Pranav
Re: [PATCH v2 for-4.5 5/5] xen: arm: Support the other 4 PCI buses on Xgene
Quoted 2 lines · Pranavkumar Sawargaonkar
Patch looks good.
Thanks to Julien and you for the review.
Konrad already indicated that he was OK with this for 4.5, so committed.
Ian
Quoted 11 lines · Ian Campbell
These patches:
* fix up an off by one bug in the xgene mapping of additional PCI bus resources, which would cause an additional extra page to be mapped
* correct the size of the mapped regions to match the docs
* adds support for the other 4 PCI buses on the chip, which enables mcdivitt and presumably most other Xgene based platforms which uses PCI buses other than pcie0.
* adds earlyprintk for the mcdivitt platform
Quoted 2 lines
They can also be found at:
git://xenbits.xen.org/people/ianc/xen.gitmcdivitt-v2
#1-#4 can go in - aka Release-Acked-by: Konrad Rzeszutek Wilk <[email protected]> For #5 I would appreciate an ARM knowledgeble person to review it.
Ian Campbell
AppliedQuoted 12 lines · Konrad Rzeszutek Wilk
Quoted 11 lines · Ian Campbell
These patches:
* fix up an off by one bug in the xgene mapping of additional PCI bus resources, which would cause an additional extra page to be mapped
* correct the size of the mapped regions to match the docs
* adds support for the other 4 PCI buses on the chip, which enables mcdivitt and presumably most other Xgene based platforms which uses PCI buses other than pcie0.
* adds earlyprintk for the mcdivitt platform
Quoted 4 lines
Quoted 2 lines
They can also be found at:
git://xenbits.xen.org/people/ianc/xen.gitmcdivitt-v2#1-#4 can go in - aka Release-Acked-by: Konrad Rzeszutek Wilk <[email protected]>
Applied, with a tweak to one of the ocmmit message suggested by Julien.
Quoted 1 line
For #5 I would appreciate an ARM knowledgeble person to review it.
Acked by Julien now, are you ok for it to go in?
Quoted 16 lines · Ian Campbell
Quoted 15 lines · Konrad Rzeszutek Wilk
Quoted 13 lines · Ian Campbell
These patches:
* fix up an off by one bug in the xgene mapping of additional PCI bus resources, which would cause an additional extra page to be mapped
* correct the size of the mapped regions to match the docs
* adds support for the other 4 PCI buses on the chip, which enables mcdivitt and presumably most other Xgene based platforms which uses PCI buses other than pcie0.
* adds earlyprintk for the mcdivitt platformThey can also be found at:
git://xenbits.xen.org/people/ianc/xen.gitmcdivitt-v2
Quoted 8 lines
Quoted 1 line
#1-#4 can go in - aka Release-Acked-by: Konrad Rzeszutek Wilk <[email protected]>
Applied, with a tweak to one of the ocmmit message suggested by Julien.
Quoted 1 line
For #5 I would appreciate an ARM knowledgeble person to review it.
Acked by Julien now, are you ok for it to go in?
Yes. Thank you!