* [PATCH v2 01/15] xen: arm64: Add 8250 earlyprintk support
[not found] <foo>
@ 2013-11-22 16:24 ` Ian Campbell
2013-11-22 16:27 ` [PATCH 00/15] xen: arm initial support for xgene arm64 platform Ian Campbell
2013-11-22 16:29 ` [PATCH v2 01/15] xen: arm64: Add 8250 earlyprintk support Julien Grall
2013-11-22 16:24 ` [PATCH v2 02/15] xen: arm64: Add Basic Platform support for APM X-Gene Storm Ian Campbell
` (13 subsequent siblings)
14 siblings, 2 replies; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 16:24 UTC (permalink / raw)
To: xen-devel
Cc: Ian Campbell, Anup Patel, stefano.stabellini, julien.grall, tim,
pranavkumar
From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Extracted from "Basic Platform support for APM X-Gene Storm."
Signed-off-by: Anup Patel <anup.patel@linaro.org>
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Reworked into generic 8250 driver, use EARLY_UART_REG_SHIFT.
While there observe a missing shift in the arm32 version (UART_THR is zero so
it doesn't really matter). Changed for consistency.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
v2: Drop unused early_uart_init macro
---
xen/arch/arm/Rules.mk | 6 +++++
xen/arch/arm/arm64/debug-8250.inc | 45 +++++++++++++++++++++++++++++++++++++
2 files changed, 51 insertions(+)
create mode 100644 xen/arch/arm/arm64/debug-8250.inc
diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk
index c27c2eb..aaa203e 100644
--- a/xen/arch/arm/Rules.mk
+++ b/xen/arch/arm/Rules.mk
@@ -82,6 +82,12 @@ EARLY_PRINTK_INC := 8250
EARLY_UART_BASE_ADDRESS := 0xF0406B00
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
ifneq ($(EARLY_PRINTK_INC),)
EARLY_PRINTK := y
diff --git a/xen/arch/arm/arm64/debug-8250.inc b/xen/arch/arm/arm64/debug-8250.inc
new file mode 100644
index 0000000..158549a
--- /dev/null
+++ b/xen/arch/arm/arm64/debug-8250.inc
@@ -0,0 +1,45 @@
+/*
+ * xen/arch/arm/arm64/debug-8250.inc
+ *
+ * 8250 specific debug code
+ *
+ * Copyright (c) 2013 Applied Micro.
+ *
+ * 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 <xen/8250-uart.h>
+
+/* UART wait UART to be ready to transmit
+ * xb: register which contains the UART base address
+ * c: scratch register */
+.macro early_uart_ready xb c
+1:
+ ldrb w\c, [\xb, #UART_LSR << EARLY_UART_REG_SHIFT]
+ and w\c, w\c, #UART_LSR_THRE
+ cmp w\c, #UART_LSR_THRE
+ b.ne 1b
+.endm
+
+/* UART transmit character
+ * xb: register which contains the UART base address
+ * wt: register which contains the character to transmit */
+.macro early_uart_transmit xb wt
+ /* UART_THR transmit holding */
+ strb \wt, [\xb, #UART_THR << EARLY_UART_REG_SHIFT]
+.endm
+
+/*
+ * Local variables:
+ * mode: ASM
+ * indent-tabs-mode: nil
+ * End:
+ */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH v2 02/15] xen: arm64: Add Basic Platform support for APM X-Gene Storm.
[not found] <foo>
2013-11-22 16:24 ` [PATCH v2 01/15] xen: arm64: Add 8250 earlyprintk support Ian Campbell
@ 2013-11-22 16:24 ` Ian Campbell
2013-11-22 16:35 ` Julien Grall
2013-11-22 16:24 ` [PATCH v2 03/15] xen: arm64: Add APM implementor id to processor implementers Ian Campbell
` (12 subsequent siblings)
14 siblings, 1 reply; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 16:24 UTC (permalink / raw)
To: xen-devel
Cc: Ian Campbell, Anup Patel, stefano.stabellini, julien.grall, tim,
pranavkumar
From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
This patch adds initial platform stubs for APM X-Gene.
Signed-off-by: Anup Patel <anup.patel@linaro.org>
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Drop earlyprintk (split into earlier patch). Only build on ARM64.
Drop empty init and reset hooks and enable 1:1 workaround.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
v2: Drop empty hooks, merge the 1:1 workaround patch, drop early_printk.h
---
xen/arch/arm/platforms/Makefile | 1 +
xen/arch/arm/platforms/xgene-storm.c | 52 ++++++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+)
create mode 100644 xen/arch/arm/platforms/xgene-storm.c
diff --git a/xen/arch/arm/platforms/Makefile b/xen/arch/arm/platforms/Makefile
index f0dd72c..680364f 100644
--- a/xen/arch/arm/platforms/Makefile
+++ b/xen/arch/arm/platforms/Makefile
@@ -3,3 +3,4 @@ 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) += xgene-storm.o
diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c
new file mode 100644
index 0000000..727ac2b
--- /dev/null
+++ b/xen/arch/arm/platforms/xgene-storm.c
@@ -0,0 +1,52 @@
+/*
+ * xen/arch/arm/platforms/xgene-storm.c
+ *
+ * Applied Micro's X-Gene specific settings
+ *
+ * Pranavkumar Sawargaonkar <psawargaonkar@apm.com>
+ * Anup Patel <apatel@apm.com>
+ * Copyright (c) 2013 Applied Micro.
+ *
+ * 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 <xen/config.h>
+#include <xen/device_tree.h>
+#include <xen/domain_page.h>
+#include <xen/mm.h>
+#include <xen/vmap.h>
+#include <asm/platform.h>
+
+static uint32_t xgene_storm_quirks(void)
+{
+ return PLATFORM_QUIRK_DOM0_MAPPING_11;
+}
+
+
+static const char const *xgene_storm_dt_compat[] __initdata =
+{
+ "apm,xgene-storm",
+ NULL
+};
+
+PLATFORM_START(xgene_storm, "APM X-GENE STORM")
+ .compatible = xgene_storm_dt_compat,
+ .quirks = xgene_storm_quirks,
+PLATFORM_END
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH v2 03/15] xen: arm64: Add APM implementor id to processor implementers.
[not found] <foo>
2013-11-22 16:24 ` [PATCH v2 01/15] xen: arm64: Add 8250 earlyprintk support Ian Campbell
2013-11-22 16:24 ` [PATCH v2 02/15] xen: arm64: Add Basic Platform support for APM X-Gene Storm Ian Campbell
@ 2013-11-22 16:24 ` Ian Campbell
2013-11-22 16:24 ` [PATCH v2 04/15] xen: arm: add a quirk to handle platforms with unusual GIC layout Ian Campbell
` (11 subsequent siblings)
14 siblings, 0 replies; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 16:24 UTC (permalink / raw)
To: xen-devel; +Cc: pranavkumar, julien.grall, tim, Anup Patel, stefano.stabellini
From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
This patch updates the list of processor implementers with APM implementor id.
Signed-off-by: Anup Patel <anup.patel@linaro.org>
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
xen/arch/arm/setup.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index cdcc2e7..49e1b5c 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -64,6 +64,7 @@ static const char * __initdata processor_implementers[] = {
['B'] = "Broadcom Corporation",
['D'] = "Digital Equipment Corp",
['M'] = "Motorola, Freescale Semiconductor Inc.",
+ ['P'] = "Applied Micro",
['Q'] = "Qualcomm Inc.",
['V'] = "Marvell Semiconductor Inc.",
['i'] = "Intel Corporation",
--
1.7.10.4
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH v2 04/15] xen: arm: add a quirk to handle platforms with unusual GIC layout
[not found] <foo>
` (2 preceding siblings ...)
2013-11-22 16:24 ` [PATCH v2 03/15] xen: arm64: Add APM implementor id to processor implementers Ian Campbell
@ 2013-11-22 16:24 ` Ian Campbell
2013-11-22 16:46 ` Julien Grall
2013-11-22 16:46 ` George Dunlap
2013-11-22 16:24 ` [PATCH v2 05/15] xen: arm: allow platform code to select dom0 event channel irq Ian Campbell
` (10 subsequent siblings)
14 siblings, 2 replies; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 16:24 UTC (permalink / raw)
To: xen-devel
Cc: Ian Campbell, Anup Patel, stefano.stabellini, julien.grall, tim,
pranavkumar
Use this quirk on the xgene platform.
This should ideally be fixed by an extension to the device tree bindings as
described in http://www.spinics.net/lists/devicetree/msg10473.html especially
http://www.spinics.net/lists/devicetree/msg10478.html. However for the time
being a platform specific quirk will do.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
v2: This replaces "xen: arm: GICC_DIR register at offset 0x10000 instead of 0x1000"
---
xen/arch/arm/gic.c | 6 +++++-
xen/arch/arm/platforms/xgene-storm.c | 2 +-
xen/include/asm-arm/platform.h | 5 +++++
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index ab49106..9711f5d 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -30,6 +30,7 @@
#include <xen/device_tree.h>
#include <asm/p2m.h>
#include <asm/domain.h>
+#include <asm/platform.h>
#include <asm/gic.h>
@@ -444,7 +445,10 @@ void __init gic_init(void)
BUILD_BUG_ON(FIXMAP_ADDR(FIXMAP_GICC1) !=
FIXMAP_ADDR(FIXMAP_GICC2)-PAGE_SIZE);
set_fixmap(FIXMAP_GICC1, gic.cbase >> PAGE_SHIFT, DEV_SHARED);
- set_fixmap(FIXMAP_GICC2, (gic.cbase >> PAGE_SHIFT) + 1, DEV_SHARED);
+ if ( platform_has_quirk(PLATFORM_QUIRK_GIC_64K_STRIDE) )
+ set_fixmap(FIXMAP_GICC2, (gic.cbase >> PAGE_SHIFT) + 0x10, DEV_SHARED);
+ else
+ set_fixmap(FIXMAP_GICC2, (gic.cbase >> PAGE_SHIFT) + 0x1, DEV_SHARED);
set_fixmap(FIXMAP_GICH, gic.hbase >> PAGE_SHIFT, DEV_SHARED);
/* Global settings: interrupt distributor */
diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c
index 727ac2b..d185a4a 100644
--- a/xen/arch/arm/platforms/xgene-storm.c
+++ b/xen/arch/arm/platforms/xgene-storm.c
@@ -27,7 +27,7 @@
static uint32_t xgene_storm_quirks(void)
{
- return PLATFORM_QUIRK_DOM0_MAPPING_11;
+ return PLATFORM_QUIRK_DOM0_MAPPING_11|PLATFORM_QUIRK_GIC_64K_STRIDE;
}
diff --git a/xen/include/asm-arm/platform.h b/xen/include/asm-arm/platform.h
index c282b30..c9314e5 100644
--- a/xen/include/asm-arm/platform.h
+++ b/xen/include/asm-arm/platform.h
@@ -44,6 +44,11 @@ struct platform_desc {
* Useful on platform where System MMU is not yet implemented
*/
#define PLATFORM_QUIRK_DOM0_MAPPING_11 (1 << 0)
+/*
+ * Quirk for platforms where the 4K GIC register ranges are placed at
+ * 64K stride.
+ */
+#define PLATFORM_QUIRK_GIC_64K_STRIDE (1 << 1)
void __init platform_init(void);
int __init platform_init_time(void);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH v2 05/15] xen: arm: allow platform code to select dom0 event channel irq
[not found] <foo>
` (3 preceding siblings ...)
2013-11-22 16:24 ` [PATCH v2 04/15] xen: arm: add a quirk to handle platforms with unusual GIC layout Ian Campbell
@ 2013-11-22 16:24 ` Ian Campbell
2013-11-22 16:48 ` George Dunlap
2013-11-22 17:01 ` Julien Grall
2013-11-22 16:24 ` [PATCH v2 06/15] xen: arm64: Map xgene PCI memory regions and interrupts to dom0 Ian Campbell
` (9 subsequent siblings)
14 siblings, 2 replies; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 16:24 UTC (permalink / raw)
To: xen-devel
Cc: Ian Campbell, Anup Patel, stefano.stabellini, julien.grall, tim,
pranavkumar
Currently the hardcoded use of GUEST_EVTCHN_PPI is problematic if that is a
real PPI on the platform.
We really need to be smarter about selecting an unused PPI but in the meantime
we can at least give the platform code the option of hardcoding a number which
works for the platform.
Hardcode a suitable PPI on the Xgene platform.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
xen/arch/arm/domain.c | 7 +++++--
xen/arch/arm/platform.c | 7 +++++++
xen/arch/arm/platforms/xgene-storm.c | 1 +
xen/include/asm-arm/platform.h | 5 +++++
4 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 2f57d01..52d2403 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -31,6 +31,7 @@
#include <asm/processor-ca15.h>
#include <asm/gic.h>
+#include <asm/platform.h>
#include "vtimer.h"
#include "vuart.h"
@@ -526,8 +527,10 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags)
if ( (rc = vcpu_domain_init(d)) != 0 )
goto fail;
- /* XXX dom0 needs more intelligent selection of PPI */
- d->arch.evtchn_irq = GUEST_EVTCHN_PPI;
+ if ( d->domain_id )
+ d->arch.evtchn_irq = GUEST_EVTCHN_PPI;
+ else
+ d->arch.evtchn_irq = platform_dom0_evtchn_ppi();
/*
* Virtual UART is only used by linux early printk and decompress code.
diff --git a/xen/arch/arm/platform.c b/xen/arch/arm/platform.c
index 0fbbdc7..a7f9ee4 100644
--- a/xen/arch/arm/platform.c
+++ b/xen/arch/arm/platform.c
@@ -156,6 +156,13 @@ bool_t platform_device_is_blacklisted(const struct dt_device_node *node)
return dt_match_node(blacklist, node);
}
+unsigned int platform_dom0_evtchn_ppi(void)
+{
+ if ( platform && platform->dom0_evtchn_ppi )
+ return platform->dom0_evtchn_ppi;
+ return GUEST_EVTCHN_PPI;
+}
+
/*
* Local variables:
* mode: C
diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c
index d185a4a..8658996 100644
--- a/xen/arch/arm/platforms/xgene-storm.c
+++ b/xen/arch/arm/platforms/xgene-storm.c
@@ -40,6 +40,7 @@ static const char const *xgene_storm_dt_compat[] __initdata =
PLATFORM_START(xgene_storm, "APM X-GENE STORM")
.compatible = xgene_storm_dt_compat,
.quirks = xgene_storm_quirks,
+ .dom0_evtchn_ppi = 24,
PLATFORM_END
/*
diff --git a/xen/include/asm-arm/platform.h b/xen/include/asm-arm/platform.h
index c9314e5..5900ee4 100644
--- a/xen/include/asm-arm/platform.h
+++ b/xen/include/asm-arm/platform.h
@@ -37,6 +37,10 @@ struct platform_desc {
* List of devices which must not pass-through to a guest
*/
const struct dt_device_match *blacklist_dev;
+ /*
+ * The IRQ (PPI) to use to inject event channels to dom0.
+ */
+ unsigned int dom0_evtchn_ppi;
};
/*
@@ -61,6 +65,7 @@ void platform_reset(void);
void platform_poweroff(void);
bool_t platform_has_quirk(uint32_t quirk);
bool_t platform_device_is_blacklisted(const struct dt_device_node *node);
+unsigned int platform_dom0_evtchn_ppi(void);
#define PLATFORM_START(_name, _namestr) \
static const struct platform_desc __plat_desc_##_name __used \
--
1.7.10.4
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH v2 06/15] xen: arm64: Map xgene PCI memory regions and interrupts to dom0.
[not found] <foo>
` (4 preceding siblings ...)
2013-11-22 16:24 ` [PATCH v2 05/15] xen: arm: allow platform code to select dom0 event channel irq Ian Campbell
@ 2013-11-22 16:24 ` Ian Campbell
2013-11-22 16:50 ` George Dunlap
2013-11-22 16:59 ` Julien Grall
2013-11-22 16:24 ` [PATCH v2 07/15] xen: arm: include ns16550 driver on arm64 too Ian Campbell
` (8 subsequent siblings)
14 siblings, 2 replies; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 16:24 UTC (permalink / raw)
To: xen-devel
Cc: Ian Campbell, Anup Patel, stefano.stabellini, julien.grall, tim,
pranavkumar
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
v2: This replaces "HACK: xen: arm: map PCI controller ranges region MMIOs to
dom0."
---
xen/arch/arm/platforms/xgene-storm.c | 76 ++++++++++++++++++++++++++++++++++
1 file changed, 76 insertions(+)
diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c
index 8658996..f3cc51b 100644
--- a/xen/arch/arm/platforms/xgene-storm.c
+++ b/xen/arch/arm/platforms/xgene-storm.c
@@ -24,12 +24,87 @@
#include <xen/mm.h>
#include <xen/vmap.h>
#include <asm/platform.h>
+#include <asm/gic.h>
static uint32_t xgene_storm_quirks(void)
{
return PLATFORM_QUIRK_DOM0_MAPPING_11|PLATFORM_QUIRK_GIC_64K_STRIDE;
}
+static int map_one_mmio(struct domain *d, const char *what,
+ paddr_t start, paddr_t end)
+{
+ int ret;
+
+ printk("Additional MMIO %"PRIpaddr"-%"PRIpaddr" (%s)\n",
+ start, end, what);
+ ret = map_mmio_regions(d, start, end, start);
+ if ( ret )
+ printk("Failed to map %s @ %"PRIpaddr" to dom%d\n",
+ what, start, d->domain_id);
+ return ret;
+}
+
+static int map_one_spi(struct domain *d, const char *what,
+ unsigned int spi, unsigned int type)
+{
+ struct dt_irq irq;
+ int ret;
+
+ irq.type = type;
+
+ irq.irq = spi + 32; /* SPIs start at IRQ 32 */
+
+ printk("Additional IRQ %u (%s)\n", irq.irq, what);
+
+ ret = gic_route_irq_to_guest(d, &irq, what);
+ if ( ret )
+ printk("Failed to route %s to dom%d\n", what, d->domain_id);
+
+ return ret;
+}
+
+static int xgene_storm_specific_mapping(struct domain *d)
+{
+ int ret;
+
+ /* Map the PCIe bus resources */
+ ret = map_one_mmio(d, "PCI MEM REGION", 0xe000000000UL, 0xe010000000UL);
+ if ( ret )
+ goto err;
+
+ ret = map_one_mmio(d, "PCI IO REGION", 0xe080000000UL, 0xe080010000UL);
+ if ( ret )
+ goto err;
+
+ ret = map_one_mmio(d, "PCI CFG REGION", 0xe0d0000000UL, 0xe0d0200000UL);
+ if ( ret )
+ goto err;
+ ret = map_one_mmio(d, "PCI MSI REGION", 0xe010000000UL, 0xe010800000UL);
+ if ( ret )
+ goto err;
+
+ ret = map_one_spi(d, "PCI#INTA", 0xc2, DT_IRQ_TYPE_LEVEL_HIGH);
+ if ( ret )
+ goto err;
+
+ ret = map_one_spi(d, "PCI#INTB", 0xc3, DT_IRQ_TYPE_LEVEL_HIGH);
+ if ( ret )
+ goto err;
+
+ ret = map_one_spi(d, "PCI#INTC", 0xc4, DT_IRQ_TYPE_LEVEL_HIGH);
+ if ( ret )
+ goto err;
+
+ ret = map_one_spi(d, "PCI#INTD", 0xc5, DT_IRQ_TYPE_LEVEL_HIGH);
+ if ( ret )
+ goto err;
+
+ ret = 0;
+err:
+ return ret;
+}
+
static const char const *xgene_storm_dt_compat[] __initdata =
{
@@ -40,6 +115,7 @@ static const char const *xgene_storm_dt_compat[] __initdata =
PLATFORM_START(xgene_storm, "APM X-GENE STORM")
.compatible = xgene_storm_dt_compat,
.quirks = xgene_storm_quirks,
+ .specific_mapping = xgene_storm_specific_mapping,
.dom0_evtchn_ppi = 24,
PLATFORM_END
--
1.7.10.4
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH v2 07/15] xen: arm: include ns16550 driver on arm64 too
[not found] <foo>
` (5 preceding siblings ...)
2013-11-22 16:24 ` [PATCH v2 06/15] xen: arm64: Map xgene PCI memory regions and interrupts to dom0 Ian Campbell
@ 2013-11-22 16:24 ` Ian Campbell
2013-11-22 16:24 ` [PATCH v2 08/15] xen: arm: early logging of command line Ian Campbell
` (7 subsequent siblings)
14 siblings, 0 replies; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 16:24 UTC (permalink / raw)
To: xen-devel
Cc: Ian Campbell, Anup Patel, stefano.stabellini, julien.grall, tim,
pranavkumar
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
config/arm64.mk | 1 +
1 file changed, 1 insertion(+)
diff --git a/config/arm64.mk b/config/arm64.mk
index 49055fa..15b57a4 100644
--- a/config/arm64.mk
+++ b/config/arm64.mk
@@ -7,6 +7,7 @@ CONFIG_XEN_INSTALL_SUFFIX :=
CFLAGS += #-marm -march= -mcpu= etc
HAS_PL011 := y
+HAS_NS16550 := y
# Use only if calling $(LD) directly.
LDFLAGS_DIRECT += -EL
--
1.7.10.4
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH v2 08/15] xen: arm: early logging of command line
[not found] <foo>
` (6 preceding siblings ...)
2013-11-22 16:24 ` [PATCH v2 07/15] xen: arm: include ns16550 driver on arm64 too Ian Campbell
@ 2013-11-22 16:24 ` Ian Campbell
2013-11-22 17:04 ` Ian Campbell
2013-11-22 16:24 ` [PATCH v2 09/15] xen: arm: Handle cpus nodes with #address-cells > 1 Ian Campbell
` (6 subsequent siblings)
14 siblings, 1 reply; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 16:24 UTC (permalink / raw)
To: xen-devel
Cc: Ian Campbell, Anup Patel, stefano.stabellini, julien.grall, tim,
pranavkumar
Helpful for diagnosis of bad console= parameters.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
xen/arch/arm/setup.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 49e1b5c..d252131 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -597,6 +597,7 @@ void __init start_xen(unsigned long boot_phys_offset,
{
size_t fdt_size;
int cpus, i;
+ const char *cmdline;
setup_cache();
@@ -610,7 +611,9 @@ void __init start_xen(unsigned long boot_phys_offset,
+ (fdt_paddr & ((1 << SECOND_SHIFT) - 1));
fdt_size = device_tree_early_init(device_tree_flattened, fdt_paddr);
- cmdline_parse(device_tree_bootargs(device_tree_flattened));
+ cmdline = device_tree_bootargs(device_tree_flattened);
+ early_printk("Command line: %s\n", cmdline);
+ cmdline_parse(cmdline);
setup_pagetables(boot_phys_offset, get_xen_paddr());
setup_mm(fdt_paddr, fdt_size);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH v2 09/15] xen: arm: Handle cpus nodes with #address-cells > 1
[not found] <foo>
` (7 preceding siblings ...)
2013-11-22 16:24 ` [PATCH v2 08/15] xen: arm: early logging of command line Ian Campbell
@ 2013-11-22 16:24 ` Ian Campbell
2013-11-22 16:59 ` George Dunlap
2013-11-22 17:22 ` Julien Grall
2013-11-22 16:24 ` [PATCH v2 10/15] xen: arm: Make register bit definitions unsigned Ian Campbell
` (5 subsequent siblings)
14 siblings, 2 replies; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 16:24 UTC (permalink / raw)
To: xen-devel
Cc: Ian Campbell, Anup Patel, stefano.stabellini, julien.grall, tim,
pranavkumar
The APM X-Gene Mustang board DTS has #address-cells = 2.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
v2: Use dt_read_number, check the property length
---
xen/arch/arm/smpboot.c | 34 +++++++++++++++++++++++++++++-----
1 file changed, 29 insertions(+), 5 deletions(-)
diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index 6c90fa6..b6a1307 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -125,18 +125,42 @@ void __init smp_init_cpus(void)
dt_for_each_child_node( cpus, cpu )
{
- u32 hwid;
+ const __be32 *prop;
+ u64 addr;
+ u32 reg_len, hwid;
if ( !dt_device_type_is_equal(cpu, "cpu") )
continue;
- if ( !dt_property_read_u32(cpu, "reg", &hwid) )
+ if ( dt_n_size_cells(cpu) != 0 )
+ printk(XENLOG_WARNING "cpu node `%s`: #size-cells %d\n",
+ dt_node_full_name(cpu), dt_n_size_cells(cpu));
+
+ prop = dt_get_property(cpu, "reg", ®_len);
+ if ( !prop )
+ {
+ printk(XENLOG_WARNING "cpu node `%s`: has no reg property\n",
+ dt_node_full_name(cpu));
+ continue;
+ }
+
+ if ( reg_len < dt_n_addr_cells(cpu) )
{
- printk(XENLOG_WARNING "cpu node `%s`: missing reg property\n",
+ printk(XENLOG_WARNING "cpu node `%s`: reg property too short\n",
dt_node_full_name(cpu));
continue;
}
+ addr = dt_read_number(prop, dt_n_addr_cells(cpu));
+
+ hwid = addr;
+ if ( hwid != addr )
+ {
+ printk(XENLOG_WARNING "cpu node `%s`: hwid overflow %"PRIx64"\n",
+ dt_node_full_name(cpu), addr);
+ continue;
+ }
+
/*
* 8 MSBs must be set to 0 in the DT since the reg property
* defines the MPIDR[23:0]
@@ -159,8 +183,8 @@ void __init smp_init_cpus(void)
if ( tmp_map[j] == hwid )
{
printk(XENLOG_WARNING
- "cpu node `%s`: duplicate /cpu reg properties in the DT\n",
- dt_node_full_name(cpu));
+ "cpu node `%s`: duplicate /cpu reg properties %"PRIx32" in the DT\n",
+ dt_node_full_name(cpu), hwid);
break;
}
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH v2 10/15] xen: arm: Make register bit definitions unsigned.
[not found] <foo>
` (8 preceding siblings ...)
2013-11-22 16:24 ` [PATCH v2 09/15] xen: arm: Handle cpus nodes with #address-cells > 1 Ian Campbell
@ 2013-11-22 16:24 ` Ian Campbell
2013-11-22 17:23 ` Julien Grall
2013-11-22 16:24 ` [PATCH v2 11/15] xen: arm: explicitly map 64 bit release address Ian Campbell
` (4 subsequent siblings)
14 siblings, 1 reply; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 16:24 UTC (permalink / raw)
To: xen-devel
Cc: Ian Campbell, Anup Patel, stefano.stabellini, julien.grall, tim,
Pranavkumar Sawargaonkar, pranavkumar
Otherwise the results of the shifting can be undefined and/or sign extended.
Most registers are 32-bit on both arm32 and arm64 and hence are just unsigned
ints, however HCR is 64-bit on arm64 and therefore is unsigned long.
Pointed out in the context of HCR_* by Pranavkumar Sawargaonkar.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Pranavkumar Sawargaonkar <psawargaonkar@apm.com>
---
v2:
Make 64-bit registers unsigned long
---
xen/include/asm-arm/processor.h | 144 +++++++++++++++++++--------------------
1 file changed, 72 insertions(+), 72 deletions(-)
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 3da3a3d..b2746cc 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -18,71 +18,71 @@
#define MPIDR_INVALID (~MPIDR_HWID_MASK)
/* TTBCR Translation Table Base Control Register */
-#define TTBCR_EAE 0x80000000
-#define TTBCR_N_MASK 0x07
-#define TTBCR_N_16KB 0x00
-#define TTBCR_N_8KB 0x01
-#define TTBCR_N_4KB 0x02
-#define TTBCR_N_2KB 0x03
-#define TTBCR_N_1KB 0x04
+#define TTBCR_EAE _AC(0x80000000,U)
+#define TTBCR_N_MASK _AC(0x07,U)
+#define TTBCR_N_16KB _AC(0x00,U)
+#define TTBCR_N_8KB _AC(0x01,U)
+#define TTBCR_N_4KB _AC(0x02,U)
+#define TTBCR_N_2KB _AC(0x03,U)
+#define TTBCR_N_1KB _AC(0x04,U)
/* SCTLR System Control Register. */
/* HSCTLR is a subset of this. */
-#define SCTLR_TE (1<<30)
-#define SCTLR_AFE (1<<29)
-#define SCTLR_TRE (1<<28)
-#define SCTLR_NMFI (1<<27)
-#define SCTLR_EE (1<<25)
-#define SCTLR_VE (1<<24)
-#define SCTLR_U (1<<22)
-#define SCTLR_FI (1<<21)
-#define SCTLR_WXN (1<<19)
-#define SCTLR_HA (1<<17)
-#define SCTLR_RR (1<<14)
-#define SCTLR_V (1<<13)
-#define SCTLR_I (1<<12)
-#define SCTLR_Z (1<<11)
-#define SCTLR_SW (1<<10)
-#define SCTLR_B (1<<7)
-#define SCTLR_C (1<<2)
-#define SCTLR_A (1<<1)
-#define SCTLR_M (1<<0)
-
-#define HSCTLR_BASE 0x30c51878
+#define SCTLR_TE (_AC(1,U)<<30)
+#define SCTLR_AFE (_AC(1,U)<<29)
+#define SCTLR_TRE (_AC(1,U)<<28)
+#define SCTLR_NMFI (_AC(1,U)<<27)
+#define SCTLR_EE (_AC(1,U)<<25)
+#define SCTLR_VE (_AC(1,U)<<24)
+#define SCTLR_U (_AC(1,U)<<22)
+#define SCTLR_FI (_AC(1,U)<<21)
+#define SCTLR_WXN (_AC(1,U)<<19)
+#define SCTLR_HA (_AC(1,U)<<17)
+#define SCTLR_RR (_AC(1,U)<<14)
+#define SCTLR_V (_AC(1,U)<<13)
+#define SCTLR_I (_AC(1,U)<<12)
+#define SCTLR_Z (_AC(1,U)<<11)
+#define SCTLR_SW (_AC(1,U)<<10)
+#define SCTLR_B (_AC(1,U)<<7)
+#define SCTLR_C (_AC(1,U)<<2)
+#define SCTLR_A (_AC(1,U)<<1)
+#define SCTLR_M (_AC(1,U)<<0)
+
+#define HSCTLR_BASE _AC(0x30c51878,U)
/* HCR Hyp Configuration Register */
-#define HCR_RW (1<<31) /* Register Width, ARM64 only */
-#define HCR_TGE (1<<27) /* Trap General Exceptions */
-#define HCR_TVM (1<<26) /* Trap Virtual Memory Controls */
-#define HCR_TTLB (1<<25) /* Trap TLB Maintenance Operations */
-#define HCR_TPU (1<<24) /* Trap Cache Maintenance Operations to PoU */
-#define HCR_TPC (1<<23) /* Trap Cache Maintenance Operations to PoC */
-#define HCR_TSW (1<<22) /* Trap Set/Way Cache Maintenance Operations */
-#define HCR_TAC (1<<21) /* Trap ACTLR Accesses */
-#define HCR_TIDCP (1<<20) /* Trap lockdown */
-#define HCR_TSC (1<<19) /* Trap SMC instruction */
-#define HCR_TID3 (1<<18) /* Trap ID Register Group 3 */
-#define HCR_TID2 (1<<17) /* Trap ID Register Group 2 */
-#define HCR_TID1 (1<<16) /* Trap ID Register Group 1 */
-#define HCR_TID0 (1<<15) /* Trap ID Register Group 0 */
-#define HCR_TWE (1<<14) /* Trap WFE instruction */
-#define HCR_TWI (1<<13) /* Trap WFI instruction */
-#define HCR_DC (1<<12) /* Default cacheable */
-#define HCR_BSU_MASK (3<<10) /* Barrier Shareability Upgrade */
-#define HCR_BSU_NONE (0<<10)
-#define HCR_BSU_INNER (1<<10)
-#define HCR_BSU_OUTER (2<<10)
-#define HCR_BSU_FULL (3<<10)
-#define HCR_FB (1<<9) /* Force Broadcast of Cache/BP/TLB operations */
-#define HCR_VA (1<<8) /* Virtual Asynchronous Abort */
-#define HCR_VI (1<<7) /* Virtual IRQ */
-#define HCR_VF (1<<6) /* Virtual FIQ */
-#define HCR_AMO (1<<5) /* Override CPSR.A */
-#define HCR_IMO (1<<4) /* Override CPSR.I */
-#define HCR_FMO (1<<3) /* Override CPSR.F */
-#define HCR_PTW (1<<2) /* Protected Walk */
-#define HCR_SWIO (1<<1) /* Set/Way Invalidation Override */
-#define HCR_VM (1<<0) /* Virtual MMU Enable */
+#define HCR_RW (_AC(1,UL)<<31) /* Register Width, ARM64 only */
+#define HCR_TGE (_AC(1,UL)<<27) /* Trap General Exceptions */
+#define HCR_TVM (_AC(1,UL)<<26) /* Trap Virtual Memory Controls */
+#define HCR_TTLB (_AC(1,UL)<<25) /* Trap TLB Maintenance Operations */
+#define HCR_TPU (_AC(1,UL)<<24) /* Trap Cache Maintenance Operations to PoU */
+#define HCR_TPC (_AC(1,UL)<<23) /* Trap Cache Maintenance Operations to PoC */
+#define HCR_TSW (_AC(1,UL)<<22) /* Trap Set/Way Cache Maintenance Operations */
+#define HCR_TAC (_AC(1,UL)<<21) /* Trap ACTLR Accesses */
+#define HCR_TIDCP (_AC(1,UL)<<20) /* Trap lockdown */
+#define HCR_TSC (_AC(1,UL)<<19) /* Trap SMC instruction */
+#define HCR_TID3 (_AC(1,UL)<<18) /* Trap ID Register Group 3 */
+#define HCR_TID2 (_AC(1,UL)<<17) /* Trap ID Register Group 2 */
+#define HCR_TID1 (_AC(1,UL)<<16) /* Trap ID Register Group 1 */
+#define HCR_TID0 (_AC(1,UL)<<15) /* Trap ID Register Group 0 */
+#define HCR_TWE (_AC(1,UL)<<14) /* Trap WFE instruction */
+#define HCR_TWI (_AC(1,UL)<<13) /* Trap WFI instruction */
+#define HCR_DC (_AC(1,UL)<<12) /* Default cacheable */
+#define HCR_BSU_MASK (_AC(3,UL)<<10) /* Barrier Shareability Upgrade */
+#define HCR_BSU_NONE (_AC(0,UL)<<10)
+#define HCR_BSU_INNER (_AC(1,UL)<<10)
+#define HCR_BSU_OUTER (_AC(2,UL)<<10)
+#define HCR_BSU_FULL (_AC(3,UL)<<10)
+#define HCR_FB (_AC(1,UL)<<9) /* Force Broadcast of Cache/BP/TLB operations */
+#define HCR_VA (_AC(1,UL)<<8) /* Virtual Asynchronous Abort */
+#define HCR_VI (_AC(1,UL)<<7) /* Virtual IRQ */
+#define HCR_VF (_AC(1,UL)<<6) /* Virtual FIQ */
+#define HCR_AMO (_AC(1,UL)<<5) /* Override CPSR.A */
+#define HCR_IMO (_AC(1,UL)<<4) /* Override CPSR.I */
+#define HCR_FMO (_AC(1,UL)<<3) /* Override CPSR.F */
+#define HCR_PTW (_AC(1,UL)<<2) /* Protected Walk */
+#define HCR_SWIO (_AC(1,UL)<<1) /* Set/Way Invalidation Override */
+#define HCR_VM (_AC(1,UL)<<0) /* Virtual MMU Enable */
#define HSR_EC_UNKNOWN 0x00
#define HSR_EC_WFI_WFE 0x01
@@ -346,20 +346,20 @@ union hsr {
HSR_SYSREG_OP2_MASK)
/* Physical Address Register */
-#define PAR_F (1<<0)
+#define PAR_F (_AC(1,U)<<0)
/* .... If F == 1 */
#define PAR_FSC_SHIFT (1)
-#define PAR_FSC_MASK (0x3f<<PAR_FSC_SHIFT)
-#define PAR_STAGE21 (1<<8) /* Stage 2 Fault During Stage 1 Walk */
-#define PAR_STAGE2 (1<<9) /* Stage 2 Fault */
+#define PAR_FSC_MASK (_AC(0x3f,U)<<PAR_FSC_SHIFT)
+#define PAR_STAGE21 (_AC(1,U)<<8) /* Stage 2 Fault During Stage 1 Walk */
+#define PAR_STAGE2 (_AC(1,U)<<9) /* Stage 2 Fault */
/* If F == 0 */
#define PAR_MAIR_SHIFT 56 /* Memory Attributes */
#define PAR_MAIR_MASK (0xffLL<<PAR_MAIR_SHIFT)
-#define PAR_NS (1<<9) /* Non-Secure */
+#define PAR_NS (_AC(1,U)<<9) /* Non-Secure */
#define PAR_SH_SHIFT 7 /* Shareability */
-#define PAR_SH_MASK (3<<PAR_SH_SHIFT)
+#define PAR_SH_MASK (_AC(3,U)<<PAR_SH_SHIFT)
/* Fault Status Register */
/*
@@ -372,11 +372,11 @@ union hsr {
* 10xxxx -- Other
* 11xxxx -- Implementation Defined
*/
-#define FSC_TYPE_MASK (0x3<<4)
-#define FSC_TYPE_FAULT (0x00<<4)
-#define FSC_TYPE_ABT (0x01<<4)
-#define FSC_TYPE_OTH (0x02<<4)
-#define FSC_TYPE_IMPL (0x03<<4)
+#define FSC_TYPE_MASK (_AC(0x3,U)<<4)
+#define FSC_TYPE_FAULT (_AC(0x00,U)<<4)
+#define FSC_TYPE_ABT (_AC(0x01,U)<<4)
+#define FSC_TYPE_OTH (_AC(0x02,U)<<4)
+#define FSC_TYPE_IMPL (_AC(0x03,U)<<4)
#define FSC_FLT_TRANS (0x04)
#define FSC_FLT_ACCESS (0x08)
@@ -391,7 +391,7 @@ union hsr {
#define FSC_LKD (0x34) /* Lockdown Abort */
#define FSC_CPR (0x3a) /* Coprocossor Abort */
-#define FSC_LL_MASK (0x03<<0)
+#define FSC_LL_MASK (_AC(0x03,U)<<0)
/* Time counter hypervisor control register */
#define CNTHCTL_PA (1u<<0) /* Kernel/user access to physical counter */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH v2 11/15] xen: arm: explicitly map 64 bit release address
[not found] <foo>
` (9 preceding siblings ...)
2013-11-22 16:24 ` [PATCH v2 10/15] xen: arm: Make register bit definitions unsigned Ian Campbell
@ 2013-11-22 16:24 ` Ian Campbell
2013-11-22 16:24 ` [PATCH v2 12/15] xen: arm: enable synchronous console while starting secondary CPUs Ian Campbell
` (3 subsequent siblings)
14 siblings, 0 replies; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 16:24 UTC (permalink / raw)
To: xen-devel
Cc: Ian Campbell, Anup Patel, stefano.stabellini, julien.grall, tim,
pranavkumar
In case it is outside visible ram.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
xen/arch/arm/arm64/smpboot.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/xen/arch/arm/arm64/smpboot.c b/xen/arch/arm/arm64/smpboot.c
index 8239590..8696ed6 100644
--- a/xen/arch/arm/arm64/smpboot.c
+++ b/xen/arch/arm/arm64/smpboot.c
@@ -4,6 +4,8 @@
#include <xen/errno.h>
#include <xen/mm.h>
#include <xen/smp.h>
+#include <xen/vmap.h>
+#include <asm/io.h>
struct smp_enable_ops {
int (*prepare_cpu)(int);
@@ -14,7 +16,7 @@ static struct smp_enable_ops smp_enable_ops[NR_CPUS];
static int __init smp_spin_table_cpu_up(int cpu)
{
- paddr_t *release;
+ paddr_t __iomem *release;
if (!cpu_release_addr[cpu])
{
@@ -22,12 +24,20 @@ static int __init smp_spin_table_cpu_up(int cpu)
return -ENODEV;
}
- release = __va(cpu_release_addr[cpu]);
+ release = ioremap_nocache(cpu_release_addr[cpu], 8);
+ if ( !release )
+ {
+ dprintk(XENLOG_ERR, "CPU%d: Unable to map release address\n", cpu);
+ return -EFAULT;
+ }
release[0] = __pa(init_secondary);
flush_xen_data_tlb_range_va((vaddr_t)release, sizeof(*release));
+ iounmap(release);
+
sev();
+
return 0;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH v2 12/15] xen: arm: enable synchronous console while starting secondary CPUs
[not found] <foo>
` (10 preceding siblings ...)
2013-11-22 16:24 ` [PATCH v2 11/15] xen: arm: explicitly map 64 bit release address Ian Campbell
@ 2013-11-22 16:24 ` Ian Campbell
2013-11-22 17:36 ` Julien Grall
2013-11-22 16:24 ` [PATCH v2 13/15] xen: arm: Add debug keyhandler to dump the physical GIC state Ian Campbell
` (2 subsequent siblings)
14 siblings, 1 reply; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 16:24 UTC (permalink / raw)
To: xen-devel
Cc: Keir Fraser, Ian Campbell, Anup Patel, stefano.stabellini,
julien.grall, tim, pranavkumar
Setting synchronous console ensures that any printk hits the buffer
immediately and that any outstanding queued log messages are flushed. This
ensures that such log messages are not being printed while the secondary CPU
may be using early_printk during early bringup.
Signed-of-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Keir Fraser <keir@xen.org>
---
v2: improved commit message.
---
xen/arch/arm/smpboot.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index b6a1307..f6cd9d7 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -28,6 +28,7 @@
#include <xen/softirq.h>
#include <xen/timer.h>
#include <xen/irq.h>
+#include <xen/console.h>
#include <asm/gic.h>
cpumask_t cpu_online_map;
@@ -356,6 +357,8 @@ int __cpu_up(unsigned int cpu)
if ( rc < 0 )
return rc;
+ console_start_sync(); /* Secondary may use early_printk */
+
/* Tell the remote CPU which stack to boot on. */
init_data.stack = idle_vcpu[cpu]->arch.stack;
@@ -368,6 +371,8 @@ int __cpu_up(unsigned int cpu)
rc = arch_cpu_up(cpu);
+ console_end_sync();
+
if ( rc < 0 )
{
printk("Failed to bring up CPU%d\n", cpu);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH v2 13/15] xen: arm: Add debug keyhandler to dump the physical GIC state.
[not found] <foo>
` (11 preceding siblings ...)
2013-11-22 16:24 ` [PATCH v2 12/15] xen: arm: enable synchronous console while starting secondary CPUs Ian Campbell
@ 2013-11-22 16:24 ` Ian Campbell
2013-11-22 16:37 ` Ian Campbell
2013-11-22 16:24 ` [PATCH v2 14/15] xen: arm: improve early memory map readability Ian Campbell
2013-11-22 16:24 ` [PATCH v2 15/15] xen: arm: handle 40-bit addresses in the p2m Ian Campbell
14 siblings, 1 reply; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 16:24 UTC (permalink / raw)
To: xen-devel
Cc: Ian Campbell, Anup Patel, stefano.stabellini, julien.grall, tim,
pranavkumar
Rename the existing gic_dump_info to gic_dump_info_guest reduce confusion.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
v2: s/gic_dump_info/gic_dump_info_guest/
---
xen/arch/arm/domain.c | 2 +-
xen/arch/arm/gic.c | 77 ++++++++++++++++++++++++++++++++++++++++++++-
xen/include/asm-arm/gic.h | 2 +-
3 files changed, 78 insertions(+), 3 deletions(-)
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 52d2403..59eea75 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -713,7 +713,7 @@ void arch_dump_domain_info(struct domain *d)
for_each_vcpu ( d, v )
{
- gic_dump_info(v);
+ gic_dump_info_guest(v);
}
}
diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 9711f5d..1f32e99 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -28,6 +28,7 @@
#include <xen/softirq.h>
#include <xen/list.h>
#include <xen/device_tree.h>
+#include <xen/keyhandler.h>
#include <asm/p2m.h>
#include <asm/domain.h>
#include <asm/platform.h>
@@ -386,6 +387,77 @@ int gic_irq_xlate(const u32 *intspec, unsigned int intsize,
return 0;
}
+
+static void do_dump_gic(unsigned char key)
+{
+ int irq;
+ printk("'%c' pressed -> dumping GIC state\n", key);
+
+ for ( irq = 0; irq < gic.lines; irq++ )
+ {
+ const char *type;
+ int type_nr, enable, pend, active, priority, target;
+ struct irq_desc *desc = irq_to_desc(irq);
+ uint8_t *bytereg;
+ uint32_t wordreg;
+
+ bytereg = (uint8_t *) (GICD + GICD_ITARGETSR);
+ target = bytereg[irq];
+
+ bytereg = (uint8_t *) (GICD + GICD_IPRIORITYR);
+ priority = bytereg[irq];
+
+ switch ( irq )
+ {
+ case 0 ... 15:
+ type = "SGI";
+ type_nr = irq;
+ target = 0x00; /* these are per-CPU */
+ break;
+ case 16 ... 31:
+ type = "PPI";
+ type_nr = irq - 16;
+ break;
+ default:
+ type = "SPI";
+ type_nr = irq - 32;
+ break;
+ }
+
+ wordreg = GICD[GICD_ISENABLER + irq / 32];
+ enable = !!(wordreg & (1u << (irq % 32)));
+ wordreg = GICD[GICD_ISPENDR + irq / 32];
+ pend = !!(wordreg & (1u << (irq % 32)));
+ wordreg = GICD[GICD_ISACTIVER + irq / 32];
+ active = !!(wordreg & (1u << (irq % 32)));
+
+ printk("IRQ%d %s%d: %c%c%c pri:%02x tgt:%02x ",
+ irq, type, type_nr,
+ enable ? 'e' : '-',
+ pend ? 'p' : '-',
+ active ? 'a' : '-',
+ priority, target);
+
+ if ( desc->status & IRQ_GUEST )
+ {
+ struct domain *d = desc->action->dev_id;
+ printk("dom%d %s", d->domain_id, desc->action->name);
+ }
+ else
+ {
+ printk("Xen");
+ }
+ printk("\n");
+ }
+
+}
+
+static struct keyhandler dump_gic_keyhandler = {
+ .irq_callback = 0,
+ .u.fn = do_dump_gic,
+ .desc = "dump GIC state"
+};
+
/* Set up the GIC */
void __init gic_init(void)
{
@@ -460,6 +532,9 @@ void __init gic_init(void)
gic_hyp_init();
spin_unlock(&gic.lock);
+
+ register_keyhandler('G', &dump_gic_keyhandler);
+
}
void send_SGI_mask(const cpumask_t *cpumask, enum gic_sgi sgi)
@@ -913,7 +988,7 @@ static void maintenance_interrupt(int irq, void *dev_id, struct cpu_user_regs *r
}
}
-void gic_dump_info(struct vcpu *v)
+void gic_dump_info_guest(struct vcpu *v)
{
int i;
struct pending_irq *p;
diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h
index 41f0b3b..e6369fa 100644
--- a/xen/include/asm-arm/gic.h
+++ b/xen/include/asm-arm/gic.h
@@ -189,7 +189,7 @@ extern void send_SGI_self(enum gic_sgi sgi);
extern void send_SGI_allbutself(enum gic_sgi sgi);
/* print useful debug info */
-extern void gic_dump_info(struct vcpu *v);
+extern void gic_dump_info_guest(struct vcpu *v);
/* Number of interrupt lines */
extern unsigned int gic_number_lines(void);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH v2 14/15] xen: arm: improve early memory map readability
[not found] <foo>
` (12 preceding siblings ...)
2013-11-22 16:24 ` [PATCH v2 13/15] xen: arm: Add debug keyhandler to dump the physical GIC state Ian Campbell
@ 2013-11-22 16:24 ` Ian Campbell
2013-11-22 16:24 ` [PATCH v2 15/15] xen: arm: handle 40-bit addresses in the p2m Ian Campbell
14 siblings, 0 replies; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 16:24 UTC (permalink / raw)
To: xen-devel
Cc: Ian Campbell, Anup Patel, stefano.stabellini, julien.grall, tim,
pranavkumar
Purely cosmetic, put a blank line after the early memory map to separate it
from the subsequent information. This looks better since the memory map is
preceded by a blank line too.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
---
xen/common/device_tree.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
index 44253da..943b181 100644
--- a/xen/common/device_tree.c
+++ b/xen/common/device_tree.c
@@ -452,6 +452,7 @@ static void __init early_print_info(void)
early_printk(" RESVD[%d]: %"PRIpaddr" - %"PRIpaddr"\n",
i, s, e);
}
+ early_printk("\n");
}
/**
--
1.7.10.4
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH v2 15/15] xen: arm: handle 40-bit addresses in the p2m
[not found] <foo>
` (13 preceding siblings ...)
2013-11-22 16:24 ` [PATCH v2 14/15] xen: arm: improve early memory map readability Ian Campbell
@ 2013-11-22 16:24 ` Ian Campbell
2013-11-28 17:41 ` Stefano Stabellini
14 siblings, 1 reply; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 16:24 UTC (permalink / raw)
To: xen-devel
Cc: Ian Campbell, Anup Patel, stefano.stabellini, julien.grall, tim,
pranavkumar
On the X-gene platform there are resources up this high which must be mapped
to dom0.
Remove the first level page from the p2m->pages list since it is actually two
pages and must be freed as such. Do so in p2m_teardown.
I've also punted on the implementation of dump_p2m_lookup for high
addresses...
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
v2:
Remove irrelevant commentary from commit message
No longer RFC
---
xen/arch/arm/p2m.c | 60 +++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 48 insertions(+), 12 deletions(-)
diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 82dda65..af32511 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -7,6 +7,10 @@
#include <asm/flushtlb.h>
#include <asm/gic.h>
+/* First level P2M is 2 consecutive pages */
+#define P2M_FIRST_ORDER 1
+#define P2M_FIRST_ENTRIES (LPAE_ENTRIES<<P2M_FIRST_ORDER)
+
void dump_p2m_lookup(struct domain *d, paddr_t addr)
{
struct p2m_domain *p2m = &d->arch.p2m;
@@ -14,6 +18,12 @@ void dump_p2m_lookup(struct domain *d, paddr_t addr)
printk("dom%d IPA 0x%"PRIpaddr"\n", d->domain_id, addr);
+ if ( first_linear_offset(addr) > LPAE_ENTRIES )
+ {
+ printk("Cannot dump addresses in second of first level pages...\n");
+ return;
+ }
+
printk("P2M @ %p mfn:0x%lx\n",
p2m->first_level, page_to_mfn(p2m->first_level));
@@ -31,6 +41,30 @@ void p2m_load_VTTBR(struct domain *d)
isb(); /* Ensure update is visible */
}
+static int p2m_first_level_index(paddr_t addr)
+{
+ /*
+ * 1st pages are concatenated so zeroeth offset gives us the
+ * index of the 1st page
+ */
+ return zeroeth_table_offset(addr);
+}
+
+/*
+ * Map whichever of the first pages contain addr. The caller should
+ * then use first_table_offset as an index.
+ */
+static lpae_t *p2m_map_first(struct p2m_domain *p2m, paddr_t addr)
+{
+ struct page_info *page;
+
+ BUG_ON(first_linear_offset(addr) > P2M_FIRST_ENTRIES);
+
+ page = p2m->first_level + p2m_first_level_index(addr);
+
+ return __map_domain_page(page);
+}
+
/*
* Lookup the MFN corresponding to a domain's PFN.
*
@@ -45,7 +79,7 @@ paddr_t p2m_lookup(struct domain *d, paddr_t paddr)
spin_lock(&p2m->lock);
- first = __map_domain_page(p2m->first_level);
+ first = p2m_map_first(p2m, paddr);
pte = first[first_table_offset(paddr)];
if ( !pte.p2m.valid || !pte.p2m.table )
@@ -135,18 +169,21 @@ static int create_p2m_entries(struct domain *d,
struct p2m_domain *p2m = &d->arch.p2m;
lpae_t *first = NULL, *second = NULL, *third = NULL;
paddr_t addr;
- unsigned long cur_first_offset = ~0, cur_second_offset = ~0;
+ unsigned long cur_first_page = ~0,
+ cur_first_offset = ~0,
+ cur_second_offset = ~0;
spin_lock(&p2m->lock);
- /* XXX Don't actually handle 40 bit guest physical addresses */
- BUG_ON(start_gpaddr & 0x8000000000ULL);
- BUG_ON(end_gpaddr & 0x8000000000ULL);
-
- first = __map_domain_page(p2m->first_level);
-
for(addr = start_gpaddr; addr < end_gpaddr; addr += PAGE_SIZE)
{
+ if ( cur_first_page != p2m_first_level_index(addr) )
+ {
+ if ( first ) unmap_domain_page(first);
+ first = p2m_map_first(p2m, addr);
+ cur_first_page = p2m_first_level_index(addr);
+ }
+
if ( !first[first_table_offset(addr)].p2m.valid )
{
rc = p2m_create_table(d, &first[first_table_offset(addr)]);
@@ -279,15 +316,12 @@ int p2m_alloc_table(struct domain *d)
struct page_info *page;
void *p;
- /* First level P2M is 2 consecutive pages */
- page = alloc_domheap_pages(NULL, 1, 0);
+ page = alloc_domheap_pages(NULL, P2M_FIRST_ORDER, 0);
if ( page == NULL )
return -ENOMEM;
spin_lock(&p2m->lock);
- page_list_add(page, &p2m->pages);
-
/* Clear both first level pages */
p = __map_domain_page(page);
clear_page(p);
@@ -380,6 +414,8 @@ void p2m_teardown(struct domain *d)
while ( (pg = page_list_remove_head(&p2m->pages)) )
free_domheap_page(pg);
+ free_domheap_pages(p2m->first_level, P2M_FIRST_ORDER);
+
p2m->first_level = NULL;
p2m_free_vmid(d);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 00/15] xen: arm initial support for xgene arm64 platform
2013-11-22 16:24 ` [PATCH v2 01/15] xen: arm64: Add 8250 earlyprintk support Ian Campbell
@ 2013-11-22 16:27 ` Ian Campbell
2013-11-22 17:02 ` George Dunlap
2013-11-22 16:29 ` [PATCH v2 01/15] xen: arm64: Add 8250 earlyprintk support Julien Grall
1 sibling, 1 reply; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 16:27 UTC (permalink / raw)
To: xen-devel
Cc: Anup Patel, George Dunlap, Tim Deegan, Julien Grall,
Stefano Stabellini, Pranavkumar Sawargaonkar
Damnit. Missed the --dry-run... Oh well, the patches are actually
correct I think.
The 00/15 mail would have contained:
This addresses the previous review.
In particular it drops the RFC from a couple of patches and replaces the
HACKs with clean solutions.
A==acked. H==replaces a HACK. R==release acked. r==might be release
akced but George wasn't 100% explicit.
R xen: arm64: Add 8250 earlyprintk support
A R xen: arm64: Add Basic Platform support for APM X-Gene Storm.
A R xen: arm64: Add APM implementor id to processor implementers.
H xen: arm: add a quirk to handle platforms with unusual GIC layout
A xen: arm: allow platform code to select dom0 event channel irq
H xen: arm64: Map xgene PCI memory regions and interrupts to dom0.
A R xen: arm: include ns16550 driver on arm64 too
A r xen: arm: early logging of command line
r xen: arm: Handle cpus nodes with #address-cells > 1
R xen: arm: Make register bit definitions unsigned.
A R xen: arm: explicitly map 64 bit release address
R xen: arm: enable synchronous console while starting secondary CPUs
R xen: arm: Add debug keyhandler to dump the physical GIC state.
A R xen: arm: improve early memory map readability
r xen: arm: handle 40-bit addresses in the p2m
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v2 01/15] xen: arm64: Add 8250 earlyprintk support
2013-11-22 16:24 ` [PATCH v2 01/15] xen: arm64: Add 8250 earlyprintk support Ian Campbell
2013-11-22 16:27 ` [PATCH 00/15] xen: arm initial support for xgene arm64 platform Ian Campbell
@ 2013-11-22 16:29 ` Julien Grall
1 sibling, 0 replies; 43+ messages in thread
From: Julien Grall @ 2013-11-22 16:29 UTC (permalink / raw)
To: Ian Campbell, xen-devel; +Cc: pranavkumar, tim, Anup Patel, stefano.stabellini
On 11/22/2013 04:24 PM, Ian Campbell wrote:
> From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
>
> Extracted from "Basic Platform support for APM X-Gene Storm."
>
> Signed-off-by: Anup Patel <anup.patel@linaro.org>
> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
>
> Reworked into generic 8250 driver, use EARLY_UART_REG_SHIFT.
>
> While there observe a missing shift in the arm32 version (UART_THR is zero so
> it doesn't really matter). Changed for consistency.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
> ---
> v2: Drop unused early_uart_init macro
> ---
> xen/arch/arm/Rules.mk | 6 +++++
> xen/arch/arm/arm64/debug-8250.inc | 45 +++++++++++++++++++++++++++++++++++++
> 2 files changed, 51 insertions(+)
> create mode 100644 xen/arch/arm/arm64/debug-8250.inc
>
> diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk
> index c27c2eb..aaa203e 100644
> --- a/xen/arch/arm/Rules.mk
> +++ b/xen/arch/arm/Rules.mk
> @@ -82,6 +82,12 @@ EARLY_PRINTK_INC := 8250
> EARLY_UART_BASE_ADDRESS := 0xF0406B00
> 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
>
> ifneq ($(EARLY_PRINTK_INC),)
> EARLY_PRINTK := y
> diff --git a/xen/arch/arm/arm64/debug-8250.inc b/xen/arch/arm/arm64/debug-8250.inc
> new file mode 100644
> index 0000000..158549a
> --- /dev/null
> +++ b/xen/arch/arm/arm64/debug-8250.inc
> @@ -0,0 +1,45 @@
> +/*
> + * xen/arch/arm/arm64/debug-8250.inc
> + *
> + * 8250 specific debug code
> + *
> + * Copyright (c) 2013 Applied Micro.
> + *
> + * 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 <xen/8250-uart.h>
> +
> +/* UART wait UART to be ready to transmit
> + * xb: register which contains the UART base address
> + * c: scratch register */
> +.macro early_uart_ready xb c
> +1:
> + ldrb w\c, [\xb, #UART_LSR << EARLY_UART_REG_SHIFT]
> + and w\c, w\c, #UART_LSR_THRE
> + cmp w\c, #UART_LSR_THRE
> + b.ne 1b
> +.endm
> +
> +/* UART transmit character
> + * xb: register which contains the UART base address
> + * wt: register which contains the character to transmit */
> +.macro early_uart_transmit xb wt
> + /* UART_THR transmit holding */
> + strb \wt, [\xb, #UART_THR << EARLY_UART_REG_SHIFT]
> +.endm
> +
> +/*
> + * Local variables:
> + * mode: ASM
> + * indent-tabs-mode: nil
> + * End:
> + */
>
--
Julien Grall
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v2 02/15] xen: arm64: Add Basic Platform support for APM X-Gene Storm.
2013-11-22 16:24 ` [PATCH v2 02/15] xen: arm64: Add Basic Platform support for APM X-Gene Storm Ian Campbell
@ 2013-11-22 16:35 ` Julien Grall
2013-11-22 16:43 ` Ian Campbell
0 siblings, 1 reply; 43+ messages in thread
From: Julien Grall @ 2013-11-22 16:35 UTC (permalink / raw)
To: Ian Campbell, xen-devel; +Cc: pranavkumar, tim, Anup Patel, stefano.stabellini
On 11/22/2013 04:24 PM, Ian Campbell wrote:
> From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
>
> This patch adds initial platform stubs for APM X-Gene.
>
> Signed-off-by: Anup Patel <anup.patel@linaro.org>
> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
>
> Drop earlyprintk (split into earlier patch). Only build on ARM64.
>
> Drop empty init and reset hooks and enable 1:1 workaround.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> ---
> v2: Drop empty hooks, merge the 1:1 workaround patch, drop early_printk.h
> ---
[..]
> diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c
> new file mode 100644
> index 0000000..727ac2b
> --- /dev/null
> +++ b/xen/arch/arm/platforms/xgene-storm.c
> @@ -0,0 +1,52 @@
> +/*
> + * xen/arch/arm/platforms/xgene-storm.c
> + *
> + * Applied Micro's X-Gene specific settings
> + *
> + * Pranavkumar Sawargaonkar <psawargaonkar@apm.com>
> + * Anup Patel <apatel@apm.com>
> + * Copyright (c) 2013 Applied Micro.
> + *
> + * 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 <xen/config.h>
> +#include <xen/device_tree.h>
> +#include <xen/domain_page.h>
> +#include <xen/mm.h>
> +#include <xen/vmap.h>
Do we really need these 4 includes?
> +#include <asm/platform.h>
> +
> +static uint32_t xgene_storm_quirks(void)
> +{
> + return PLATFORM_QUIRK_DOM0_MAPPING_11;
> +}
> +
> +
> +static const char const *xgene_storm_dt_compat[] __initdata =
const char * const ... __initconst
Except that:
Acked-by: Julien Grall <julien.grall@linaro.org>
> +{
> + "apm,xgene-storm",
> + NULL
> +};
> +
> +PLATFORM_START(xgene_storm, "APM X-GENE STORM")
> + .compatible = xgene_storm_dt_compat,
> + .quirks = xgene_storm_quirks,
> +PLATFORM_END
> +
> +/*
> + * Local variables:
> + * mode: C
> + * c-file-style: "BSD"
> + * c-basic-offset: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
>
--
Julien Grall
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v2 13/15] xen: arm: Add debug keyhandler to dump the physical GIC state.
2013-11-22 16:24 ` [PATCH v2 13/15] xen: arm: Add debug keyhandler to dump the physical GIC state Ian Campbell
@ 2013-11-22 16:37 ` Ian Campbell
0 siblings, 0 replies; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 16:37 UTC (permalink / raw)
To: xen-devel; +Cc: pranavkumar, julien.grall, tim, Anup Patel, stefano.stabellini
On Fri, 2013-11-22 at 16:24 +0000, Ian Campbell wrote:
> Rename the existing gic_dump_info to gic_dump_info_guest reduce confusion.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
I had intended to drop this one from the series based on Julien's
comments on v1 but I forgot.
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v2 02/15] xen: arm64: Add Basic Platform support for APM X-Gene Storm.
2013-11-22 16:35 ` Julien Grall
@ 2013-11-22 16:43 ` Ian Campbell
0 siblings, 0 replies; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 16:43 UTC (permalink / raw)
To: Julien Grall; +Cc: pranavkumar, stefano.stabellini, tim, Anup Patel, xen-devel
On Fri, 2013-11-22 at 16:35 +0000, Julien Grall wrote:
>
> On 11/22/2013 04:24 PM, Ian Campbell wrote:
> > From: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
> >
> > This patch adds initial platform stubs for APM X-Gene.
> >
> > Signed-off-by: Anup Patel <anup.patel@linaro.org>
> > Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
> >
> > Drop earlyprintk (split into earlier patch). Only build on ARM64.
> >
> > Drop empty init and reset hooks and enable 1:1 workaround.
> >
> > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> > Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > ---
> > v2: Drop empty hooks, merge the 1:1 workaround patch, drop early_printk.h
> > ---
>
> [..]
>
> > diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c
> > new file mode 100644
> > index 0000000..727ac2b
> > --- /dev/null
> > +++ b/xen/arch/arm/platforms/xgene-storm.c
> > @@ -0,0 +1,52 @@
> > +/*
> > + * xen/arch/arm/platforms/xgene-storm.c
> > + *
> > + * Applied Micro's X-Gene specific settings
> > + *
> > + * Pranavkumar Sawargaonkar <psawargaonkar@apm.com>
> > + * Anup Patel <apatel@apm.com>
> > + * Copyright (c) 2013 Applied Micro.
> > + *
> > + * 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 <xen/config.h>
>
>
> > +#include <xen/device_tree.h>
> > +#include <xen/domain_page.h>
> > +#include <xen/mm.h>
> > +#include <xen/vmap.h>
>
> Do we really need these 4 includes?
No, leftovers from an incomplete attempt to implement the reset hook
etc. Nuked.
> > +#include <asm/platform.h>
> > +
> > +static uint32_t xgene_storm_quirks(void)
> > +{
> > + return PLATFORM_QUIRK_DOM0_MAPPING_11;
> > +}
> > +
> > +
> > +static const char const *xgene_storm_dt_compat[] __initdata =
>
> const char * const ... __initconst
Done.
> Except that:
> Acked-by: Julien Grall <julien.grall@linaro.org>
Thanks.
Ian.
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v2 04/15] xen: arm: add a quirk to handle platforms with unusual GIC layout
2013-11-22 16:24 ` [PATCH v2 04/15] xen: arm: add a quirk to handle platforms with unusual GIC layout Ian Campbell
@ 2013-11-22 16:46 ` Julien Grall
2013-11-22 17:03 ` Ian Campbell
2013-11-22 16:46 ` George Dunlap
1 sibling, 1 reply; 43+ messages in thread
From: Julien Grall @ 2013-11-22 16:46 UTC (permalink / raw)
To: Ian Campbell, xen-devel; +Cc: pranavkumar, tim, Anup Patel, stefano.stabellini
On 11/22/2013 04:24 PM, Ian Campbell wrote:
> Use this quirk on the xgene platform.
With this quirk you only fix xen GIC. What about dom0/guest GIC ? I know
that Linux is not using the secondary page, but we expose 2 pages
contiguous page. With this quirk the first page is valid ... but the
second page could belong to another device.
Can we remove the second page when the quirk is enabled?
> This should ideally be fixed by an extension to the device tree bindings as
> described in http://www.spinics.net/lists/devicetree/msg10473.html especially
> http://www.spinics.net/lists/devicetree/msg10478.html. However for the time
> being a platform specific quirk will do.
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> ---
> v2: This replaces "xen: arm: GICC_DIR register at offset 0x10000 instead of 0x1000"
> ---
> xen/arch/arm/gic.c | 6 +++++-
> xen/arch/arm/platforms/xgene-storm.c | 2 +-
> xen/include/asm-arm/platform.h | 5 +++++
> 3 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
> index ab49106..9711f5d 100644
> --- a/xen/arch/arm/gic.c
> +++ b/xen/arch/arm/gic.c
> @@ -30,6 +30,7 @@
> #include <xen/device_tree.h>
> #include <asm/p2m.h>
> #include <asm/domain.h>
> +#include <asm/platform.h>
>
> #include <asm/gic.h>
>
> @@ -444,7 +445,10 @@ void __init gic_init(void)
> BUILD_BUG_ON(FIXMAP_ADDR(FIXMAP_GICC1) !=
> FIXMAP_ADDR(FIXMAP_GICC2)-PAGE_SIZE);
> set_fixmap(FIXMAP_GICC1, gic.cbase >> PAGE_SHIFT, DEV_SHARED);
> - set_fixmap(FIXMAP_GICC2, (gic.cbase >> PAGE_SHIFT) + 1, DEV_SHARED);
> + if ( platform_has_quirk(PLATFORM_QUIRK_GIC_64K_STRIDE) )
> + set_fixmap(FIXMAP_GICC2, (gic.cbase >> PAGE_SHIFT) + 0x10, DEV_SHARED);
> + else
> + set_fixmap(FIXMAP_GICC2, (gic.cbase >> PAGE_SHIFT) + 0x1, DEV_SHARED);
> set_fixmap(FIXMAP_GICH, gic.hbase >> PAGE_SHIFT, DEV_SHARED);
>
> /* Global settings: interrupt distributor */
> diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c
> index 727ac2b..d185a4a 100644
> --- a/xen/arch/arm/platforms/xgene-storm.c
> +++ b/xen/arch/arm/platforms/xgene-storm.c
> @@ -27,7 +27,7 @@
>
> static uint32_t xgene_storm_quirks(void)
> {
> - return PLATFORM_QUIRK_DOM0_MAPPING_11;
> + return PLATFORM_QUIRK_DOM0_MAPPING_11|PLATFORM_QUIRK_GIC_64K_STRIDE;
> }
>
>
> diff --git a/xen/include/asm-arm/platform.h b/xen/include/asm-arm/platform.h
> index c282b30..c9314e5 100644
> --- a/xen/include/asm-arm/platform.h
> +++ b/xen/include/asm-arm/platform.h
> @@ -44,6 +44,11 @@ struct platform_desc {
> * Useful on platform where System MMU is not yet implemented
> */
> #define PLATFORM_QUIRK_DOM0_MAPPING_11 (1 << 0)
> +/*
> + * Quirk for platforms where the 4K GIC register ranges are placed at
> + * 64K stride.
> + */
> +#define PLATFORM_QUIRK_GIC_64K_STRIDE (1 << 1)
>
> void __init platform_init(void);
> int __init platform_init_time(void);
>
--
Julien Grall
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v2 04/15] xen: arm: add a quirk to handle platforms with unusual GIC layout
2013-11-22 16:24 ` [PATCH v2 04/15] xen: arm: add a quirk to handle platforms with unusual GIC layout Ian Campbell
2013-11-22 16:46 ` Julien Grall
@ 2013-11-22 16:46 ` George Dunlap
1 sibling, 0 replies; 43+ messages in thread
From: George Dunlap @ 2013-11-22 16:46 UTC (permalink / raw)
To: Ian Campbell
Cc: Anup Patel, Stefano Stabellini, Julien Grall, Tim Deegan,
xen-devel@lists.xen.org, Pranavkumar Sawargaonkar
On Fri, Nov 22, 2013 at 4:24 PM, Ian Campbell <ian.campbell@citrix.com> wrote:
> Use this quirk on the xgene platform.
>
> This should ideally be fixed by an extension to the device tree bindings as
> described in http://www.spinics.net/lists/devicetree/msg10473.html especially
> http://www.spinics.net/lists/devicetree/msg10478.html. However for the time
> being a platform specific quirk will do.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Release-acked-by: George Dunlap <george.dunlap@eu.citrix.com>
> ---
> v2: This replaces "xen: arm: GICC_DIR register at offset 0x10000 instead of 0x1000"
> ---
> xen/arch/arm/gic.c | 6 +++++-
> xen/arch/arm/platforms/xgene-storm.c | 2 +-
> xen/include/asm-arm/platform.h | 5 +++++
> 3 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
> index ab49106..9711f5d 100644
> --- a/xen/arch/arm/gic.c
> +++ b/xen/arch/arm/gic.c
> @@ -30,6 +30,7 @@
> #include <xen/device_tree.h>
> #include <asm/p2m.h>
> #include <asm/domain.h>
> +#include <asm/platform.h>
>
> #include <asm/gic.h>
>
> @@ -444,7 +445,10 @@ void __init gic_init(void)
> BUILD_BUG_ON(FIXMAP_ADDR(FIXMAP_GICC1) !=
> FIXMAP_ADDR(FIXMAP_GICC2)-PAGE_SIZE);
> set_fixmap(FIXMAP_GICC1, gic.cbase >> PAGE_SHIFT, DEV_SHARED);
> - set_fixmap(FIXMAP_GICC2, (gic.cbase >> PAGE_SHIFT) + 1, DEV_SHARED);
> + if ( platform_has_quirk(PLATFORM_QUIRK_GIC_64K_STRIDE) )
> + set_fixmap(FIXMAP_GICC2, (gic.cbase >> PAGE_SHIFT) + 0x10, DEV_SHARED);
> + else
> + set_fixmap(FIXMAP_GICC2, (gic.cbase >> PAGE_SHIFT) + 0x1, DEV_SHARED);
> set_fixmap(FIXMAP_GICH, gic.hbase >> PAGE_SHIFT, DEV_SHARED);
>
> /* Global settings: interrupt distributor */
> diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c
> index 727ac2b..d185a4a 100644
> --- a/xen/arch/arm/platforms/xgene-storm.c
> +++ b/xen/arch/arm/platforms/xgene-storm.c
> @@ -27,7 +27,7 @@
>
> static uint32_t xgene_storm_quirks(void)
> {
> - return PLATFORM_QUIRK_DOM0_MAPPING_11;
> + return PLATFORM_QUIRK_DOM0_MAPPING_11|PLATFORM_QUIRK_GIC_64K_STRIDE;
> }
>
>
> diff --git a/xen/include/asm-arm/platform.h b/xen/include/asm-arm/platform.h
> index c282b30..c9314e5 100644
> --- a/xen/include/asm-arm/platform.h
> +++ b/xen/include/asm-arm/platform.h
> @@ -44,6 +44,11 @@ struct platform_desc {
> * Useful on platform where System MMU is not yet implemented
> */
> #define PLATFORM_QUIRK_DOM0_MAPPING_11 (1 << 0)
> +/*
> + * Quirk for platforms where the 4K GIC register ranges are placed at
> + * 64K stride.
> + */
> +#define PLATFORM_QUIRK_GIC_64K_STRIDE (1 << 1)
>
> void __init platform_init(void);
> int __init platform_init_time(void);
> --
> 1.7.10.4
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v2 05/15] xen: arm: allow platform code to select dom0 event channel irq
2013-11-22 16:24 ` [PATCH v2 05/15] xen: arm: allow platform code to select dom0 event channel irq Ian Campbell
@ 2013-11-22 16:48 ` George Dunlap
2013-11-22 17:01 ` Julien Grall
1 sibling, 0 replies; 43+ messages in thread
From: George Dunlap @ 2013-11-22 16:48 UTC (permalink / raw)
To: Ian Campbell
Cc: Anup Patel, Stefano Stabellini, Julien Grall, Tim Deegan,
xen-devel@lists.xen.org, Pranavkumar Sawargaonkar
On Fri, Nov 22, 2013 at 4:24 PM, Ian Campbell <ian.campbell@citrix.com> wrote:
> Currently the hardcoded use of GUEST_EVTCHN_PPI is problematic if that is a
> real PPI on the platform.
>
> We really need to be smarter about selecting an unused PPI but in the meantime
> we can at least give the platform code the option of hardcoding a number which
> works for the platform.
>
> Hardcode a suitable PPI on the Xgene platform.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Release-acked-by: George Dunlap <george.dunlap@eu.citrix.com>
> ---
> xen/arch/arm/domain.c | 7 +++++--
> xen/arch/arm/platform.c | 7 +++++++
> xen/arch/arm/platforms/xgene-storm.c | 1 +
> xen/include/asm-arm/platform.h | 5 +++++
> 4 files changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
> index 2f57d01..52d2403 100644
> --- a/xen/arch/arm/domain.c
> +++ b/xen/arch/arm/domain.c
> @@ -31,6 +31,7 @@
> #include <asm/processor-ca15.h>
>
> #include <asm/gic.h>
> +#include <asm/platform.h>
> #include "vtimer.h"
> #include "vuart.h"
>
> @@ -526,8 +527,10 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags)
> if ( (rc = vcpu_domain_init(d)) != 0 )
> goto fail;
>
> - /* XXX dom0 needs more intelligent selection of PPI */
> - d->arch.evtchn_irq = GUEST_EVTCHN_PPI;
> + if ( d->domain_id )
> + d->arch.evtchn_irq = GUEST_EVTCHN_PPI;
> + else
> + d->arch.evtchn_irq = platform_dom0_evtchn_ppi();
>
> /*
> * Virtual UART is only used by linux early printk and decompress code.
> diff --git a/xen/arch/arm/platform.c b/xen/arch/arm/platform.c
> index 0fbbdc7..a7f9ee4 100644
> --- a/xen/arch/arm/platform.c
> +++ b/xen/arch/arm/platform.c
> @@ -156,6 +156,13 @@ bool_t platform_device_is_blacklisted(const struct dt_device_node *node)
> return dt_match_node(blacklist, node);
> }
>
> +unsigned int platform_dom0_evtchn_ppi(void)
> +{
> + if ( platform && platform->dom0_evtchn_ppi )
> + return platform->dom0_evtchn_ppi;
> + return GUEST_EVTCHN_PPI;
> +}
> +
> /*
> * Local variables:
> * mode: C
> diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c
> index d185a4a..8658996 100644
> --- a/xen/arch/arm/platforms/xgene-storm.c
> +++ b/xen/arch/arm/platforms/xgene-storm.c
> @@ -40,6 +40,7 @@ static const char const *xgene_storm_dt_compat[] __initdata =
> PLATFORM_START(xgene_storm, "APM X-GENE STORM")
> .compatible = xgene_storm_dt_compat,
> .quirks = xgene_storm_quirks,
> + .dom0_evtchn_ppi = 24,
> PLATFORM_END
>
> /*
> diff --git a/xen/include/asm-arm/platform.h b/xen/include/asm-arm/platform.h
> index c9314e5..5900ee4 100644
> --- a/xen/include/asm-arm/platform.h
> +++ b/xen/include/asm-arm/platform.h
> @@ -37,6 +37,10 @@ struct platform_desc {
> * List of devices which must not pass-through to a guest
> */
> const struct dt_device_match *blacklist_dev;
> + /*
> + * The IRQ (PPI) to use to inject event channels to dom0.
> + */
> + unsigned int dom0_evtchn_ppi;
> };
>
> /*
> @@ -61,6 +65,7 @@ void platform_reset(void);
> void platform_poweroff(void);
> bool_t platform_has_quirk(uint32_t quirk);
> bool_t platform_device_is_blacklisted(const struct dt_device_node *node);
> +unsigned int platform_dom0_evtchn_ppi(void);
>
> #define PLATFORM_START(_name, _namestr) \
> static const struct platform_desc __plat_desc_##_name __used \
> --
> 1.7.10.4
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v2 06/15] xen: arm64: Map xgene PCI memory regions and interrupts to dom0.
2013-11-22 16:24 ` [PATCH v2 06/15] xen: arm64: Map xgene PCI memory regions and interrupts to dom0 Ian Campbell
@ 2013-11-22 16:50 ` George Dunlap
2013-11-22 16:59 ` Julien Grall
1 sibling, 0 replies; 43+ messages in thread
From: George Dunlap @ 2013-11-22 16:50 UTC (permalink / raw)
To: Ian Campbell
Cc: Anup Patel, Stefano Stabellini, Julien Grall, Tim Deegan,
xen-devel@lists.xen.org, Pranavkumar Sawargaonkar
On Fri, Nov 22, 2013 at 4:24 PM, Ian Campbell <ian.campbell@citrix.com> wrote:
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Release-acked-by: George Dunlap <george.dunlap@eu.citrix.com>
> ---
> v2: This replaces "HACK: xen: arm: map PCI controller ranges region MMIOs to
> dom0."
> ---
> xen/arch/arm/platforms/xgene-storm.c | 76 ++++++++++++++++++++++++++++++++++
> 1 file changed, 76 insertions(+)
>
> diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c
> index 8658996..f3cc51b 100644
> --- a/xen/arch/arm/platforms/xgene-storm.c
> +++ b/xen/arch/arm/platforms/xgene-storm.c
> @@ -24,12 +24,87 @@
> #include <xen/mm.h>
> #include <xen/vmap.h>
> #include <asm/platform.h>
> +#include <asm/gic.h>
>
> static uint32_t xgene_storm_quirks(void)
> {
> return PLATFORM_QUIRK_DOM0_MAPPING_11|PLATFORM_QUIRK_GIC_64K_STRIDE;
> }
>
> +static int map_one_mmio(struct domain *d, const char *what,
> + paddr_t start, paddr_t end)
> +{
> + int ret;
> +
> + printk("Additional MMIO %"PRIpaddr"-%"PRIpaddr" (%s)\n",
> + start, end, what);
> + ret = map_mmio_regions(d, start, end, start);
> + if ( ret )
> + printk("Failed to map %s @ %"PRIpaddr" to dom%d\n",
> + what, start, d->domain_id);
> + return ret;
> +}
> +
> +static int map_one_spi(struct domain *d, const char *what,
> + unsigned int spi, unsigned int type)
> +{
> + struct dt_irq irq;
> + int ret;
> +
> + irq.type = type;
> +
> + irq.irq = spi + 32; /* SPIs start at IRQ 32 */
> +
> + printk("Additional IRQ %u (%s)\n", irq.irq, what);
> +
> + ret = gic_route_irq_to_guest(d, &irq, what);
> + if ( ret )
> + printk("Failed to route %s to dom%d\n", what, d->domain_id);
> +
> + return ret;
> +}
> +
> +static int xgene_storm_specific_mapping(struct domain *d)
> +{
> + int ret;
> +
> + /* Map the PCIe bus resources */
> + ret = map_one_mmio(d, "PCI MEM REGION", 0xe000000000UL, 0xe010000000UL);
> + if ( ret )
> + goto err;
> +
> + ret = map_one_mmio(d, "PCI IO REGION", 0xe080000000UL, 0xe080010000UL);
> + if ( ret )
> + goto err;
> +
> + ret = map_one_mmio(d, "PCI CFG REGION", 0xe0d0000000UL, 0xe0d0200000UL);
> + if ( ret )
> + goto err;
> + ret = map_one_mmio(d, "PCI MSI REGION", 0xe010000000UL, 0xe010800000UL);
> + if ( ret )
> + goto err;
> +
> + ret = map_one_spi(d, "PCI#INTA", 0xc2, DT_IRQ_TYPE_LEVEL_HIGH);
> + if ( ret )
> + goto err;
> +
> + ret = map_one_spi(d, "PCI#INTB", 0xc3, DT_IRQ_TYPE_LEVEL_HIGH);
> + if ( ret )
> + goto err;
> +
> + ret = map_one_spi(d, "PCI#INTC", 0xc4, DT_IRQ_TYPE_LEVEL_HIGH);
> + if ( ret )
> + goto err;
> +
> + ret = map_one_spi(d, "PCI#INTD", 0xc5, DT_IRQ_TYPE_LEVEL_HIGH);
> + if ( ret )
> + goto err;
> +
> + ret = 0;
> +err:
> + return ret;
> +}
> +
>
> static const char const *xgene_storm_dt_compat[] __initdata =
> {
> @@ -40,6 +115,7 @@ static const char const *xgene_storm_dt_compat[] __initdata =
> PLATFORM_START(xgene_storm, "APM X-GENE STORM")
> .compatible = xgene_storm_dt_compat,
> .quirks = xgene_storm_quirks,
> + .specific_mapping = xgene_storm_specific_mapping,
> .dom0_evtchn_ppi = 24,
> PLATFORM_END
>
> --
> 1.7.10.4
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v2 09/15] xen: arm: Handle cpus nodes with #address-cells > 1
2013-11-22 16:24 ` [PATCH v2 09/15] xen: arm: Handle cpus nodes with #address-cells > 1 Ian Campbell
@ 2013-11-22 16:59 ` George Dunlap
2013-11-22 17:22 ` Julien Grall
1 sibling, 0 replies; 43+ messages in thread
From: George Dunlap @ 2013-11-22 16:59 UTC (permalink / raw)
To: Ian Campbell
Cc: Anup Patel, Stefano Stabellini, Julien Grall, Tim Deegan,
xen-devel@lists.xen.org, Pranavkumar Sawargaonkar
On Fri, Nov 22, 2013 at 4:24 PM, Ian Campbell <ian.campbell@citrix.com> wrote:
> The APM X-Gene Mustang board DTS has #address-cells = 2.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Release-acked-by: George Dunlap <george.dunlap@eu.citrix.com>
> ---
> v2: Use dt_read_number, check the property length
> ---
> xen/arch/arm/smpboot.c | 34 +++++++++++++++++++++++++++++-----
> 1 file changed, 29 insertions(+), 5 deletions(-)
>
> diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
> index 6c90fa6..b6a1307 100644
> --- a/xen/arch/arm/smpboot.c
> +++ b/xen/arch/arm/smpboot.c
> @@ -125,18 +125,42 @@ void __init smp_init_cpus(void)
>
> dt_for_each_child_node( cpus, cpu )
> {
> - u32 hwid;
> + const __be32 *prop;
> + u64 addr;
> + u32 reg_len, hwid;
>
> if ( !dt_device_type_is_equal(cpu, "cpu") )
> continue;
>
> - if ( !dt_property_read_u32(cpu, "reg", &hwid) )
> + if ( dt_n_size_cells(cpu) != 0 )
> + printk(XENLOG_WARNING "cpu node `%s`: #size-cells %d\n",
> + dt_node_full_name(cpu), dt_n_size_cells(cpu));
> +
> + prop = dt_get_property(cpu, "reg", ®_len);
> + if ( !prop )
> + {
> + printk(XENLOG_WARNING "cpu node `%s`: has no reg property\n",
> + dt_node_full_name(cpu));
> + continue;
> + }
> +
> + if ( reg_len < dt_n_addr_cells(cpu) )
> {
> - printk(XENLOG_WARNING "cpu node `%s`: missing reg property\n",
> + printk(XENLOG_WARNING "cpu node `%s`: reg property too short\n",
> dt_node_full_name(cpu));
> continue;
> }
>
> + addr = dt_read_number(prop, dt_n_addr_cells(cpu));
> +
> + hwid = addr;
> + if ( hwid != addr )
> + {
> + printk(XENLOG_WARNING "cpu node `%s`: hwid overflow %"PRIx64"\n",
> + dt_node_full_name(cpu), addr);
> + continue;
> + }
> +
> /*
> * 8 MSBs must be set to 0 in the DT since the reg property
> * defines the MPIDR[23:0]
> @@ -159,8 +183,8 @@ void __init smp_init_cpus(void)
> if ( tmp_map[j] == hwid )
> {
> printk(XENLOG_WARNING
> - "cpu node `%s`: duplicate /cpu reg properties in the DT\n",
> - dt_node_full_name(cpu));
> + "cpu node `%s`: duplicate /cpu reg properties %"PRIx32" in the DT\n",
> + dt_node_full_name(cpu), hwid);
> break;
> }
> }
> --
> 1.7.10.4
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v2 06/15] xen: arm64: Map xgene PCI memory regions and interrupts to dom0.
2013-11-22 16:24 ` [PATCH v2 06/15] xen: arm64: Map xgene PCI memory regions and interrupts to dom0 Ian Campbell
2013-11-22 16:50 ` George Dunlap
@ 2013-11-22 16:59 ` Julien Grall
2013-11-22 17:13 ` Ian Campbell
1 sibling, 1 reply; 43+ messages in thread
From: Julien Grall @ 2013-11-22 16:59 UTC (permalink / raw)
To: Ian Campbell, xen-devel; +Cc: pranavkumar, tim, Anup Patel, stefano.stabellini
Can you add a comment to specify that for the future we plan to support
PCI for all platforms ? (ie this patch a kind of "WORKAROUND" for now)
On 11/22/2013 04:24 PM, Ian Campbell wrote:
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> ---
> v2: This replaces "HACK: xen: arm: map PCI controller ranges region MMIOs to
> dom0."
> ---
> xen/arch/arm/platforms/xgene-storm.c | 76 ++++++++++++++++++++++++++++++++++
> 1 file changed, 76 insertions(+)
>
> diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c
> index 8658996..f3cc51b 100644
> --- a/xen/arch/arm/platforms/xgene-storm.c
> +++ b/xen/arch/arm/platforms/xgene-storm.c
> @@ -24,12 +24,87 @@
> #include <xen/mm.h>
> #include <xen/vmap.h>
> #include <asm/platform.h>
> +#include <asm/gic.h>
>
> static uint32_t xgene_storm_quirks(void)
> {
> return PLATFORM_QUIRK_DOM0_MAPPING_11|PLATFORM_QUIRK_GIC_64K_STRIDE;
> }
>
> +static int map_one_mmio(struct domain *d, const char *what,
> + paddr_t start, paddr_t end)
> +{
> + int ret;
> +
> + printk("Additional MMIO %"PRIpaddr"-%"PRIpaddr" (%s)\n",
> + start, end, what);
> + ret = map_mmio_regions(d, start, end, start);
> + if ( ret )
> + printk("Failed to map %s @ %"PRIpaddr" to dom%d\n",
> + what, start, d->domain_id);
> + return ret;
> +}
> +
> +static int map_one_spi(struct domain *d, const char *what,
> + unsigned int spi, unsigned int type)
> +{
> + struct dt_irq irq;
> + int ret;
> +
> + irq.type = type;
> +
> + irq.irq = spi + 32; /* SPIs start at IRQ 32 */
> +
> + printk("Additional IRQ %u (%s)\n", irq.irq, what);
> +
> + ret = gic_route_irq_to_guest(d, &irq, what);
> + if ( ret )
> + printk("Failed to route %s to dom%d\n", what, d->domain_id);
> +
> + return ret;
> +}
> +
> +static int xgene_storm_specific_mapping(struct domain *d)
> +{
> + int ret;
> +
> + /* Map the PCIe bus resources */
> + ret = map_one_mmio(d, "PCI MEM REGION", 0xe000000000UL, 0xe010000000UL);
> + if ( ret )
> + goto err;
> +
> + ret = map_one_mmio(d, "PCI IO REGION", 0xe080000000UL, 0xe080010000UL);
> + if ( ret )
> + goto err;
> +
> + ret = map_one_mmio(d, "PCI CFG REGION", 0xe0d0000000UL, 0xe0d0200000UL);
> + if ( ret )
> + goto err;
> + ret = map_one_mmio(d, "PCI MSI REGION", 0xe010000000UL, 0xe010800000UL);
> + if ( ret )
> + goto err;
> +
> + ret = map_one_spi(d, "PCI#INTA", 0xc2, DT_IRQ_TYPE_LEVEL_HIGH);
> + if ( ret )
> + goto err;
> +
> + ret = map_one_spi(d, "PCI#INTB", 0xc3, DT_IRQ_TYPE_LEVEL_HIGH);
> + if ( ret )
> + goto err;
> +
> + ret = map_one_spi(d, "PCI#INTC", 0xc4, DT_IRQ_TYPE_LEVEL_HIGH);
> + if ( ret )
> + goto err;
> +
> + ret = map_one_spi(d, "PCI#INTD", 0xc5, DT_IRQ_TYPE_LEVEL_HIGH);
> + if ( ret )
> + goto err;
> +
> + ret = 0;
> +err:
> + return ret;
> +}
> +
>
> static const char const *xgene_storm_dt_compat[] __initdata =
> {
> @@ -40,6 +115,7 @@ static const char const *xgene_storm_dt_compat[] __initdata =
> PLATFORM_START(xgene_storm, "APM X-GENE STORM")
> .compatible = xgene_storm_dt_compat,
> .quirks = xgene_storm_quirks,
> + .specific_mapping = xgene_storm_specific_mapping,
> .dom0_evtchn_ppi = 24,
> PLATFORM_END
>
>
--
Julien Grall
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v2 05/15] xen: arm: allow platform code to select dom0 event channel irq
2013-11-22 16:24 ` [PATCH v2 05/15] xen: arm: allow platform code to select dom0 event channel irq Ian Campbell
2013-11-22 16:48 ` George Dunlap
@ 2013-11-22 17:01 ` Julien Grall
1 sibling, 0 replies; 43+ messages in thread
From: Julien Grall @ 2013-11-22 17:01 UTC (permalink / raw)
To: Ian Campbell, xen-devel; +Cc: pranavkumar, tim, Anup Patel, stefano.stabellini
On 11/22/2013 04:24 PM, Ian Campbell wrote:
> Currently the hardcoded use of GUEST_EVTCHN_PPI is problematic if that is a
> real PPI on the platform.
>
> We really need to be smarter about selecting an unused PPI but in the meantime
> we can at least give the platform code the option of hardcoding a number which
> works for the platform.
>
> Hardcode a suitable PPI on the Xgene platform.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
I have a patch somewhere to find a free PPI, I forget to rework it...
and it's a bit invasive for 4.4.
Acked-by: Julien Grall <julien.grall@linaro.org>
> ---
> xen/arch/arm/domain.c | 7 +++++--
> xen/arch/arm/platform.c | 7 +++++++
> xen/arch/arm/platforms/xgene-storm.c | 1 +
> xen/include/asm-arm/platform.h | 5 +++++
> 4 files changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
> index 2f57d01..52d2403 100644
> --- a/xen/arch/arm/domain.c
> +++ b/xen/arch/arm/domain.c
> @@ -31,6 +31,7 @@
> #include <asm/processor-ca15.h>
>
> #include <asm/gic.h>
> +#include <asm/platform.h>
> #include "vtimer.h"
> #include "vuart.h"
>
> @@ -526,8 +527,10 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags)
> if ( (rc = vcpu_domain_init(d)) != 0 )
> goto fail;
>
> - /* XXX dom0 needs more intelligent selection of PPI */
> - d->arch.evtchn_irq = GUEST_EVTCHN_PPI;
> + if ( d->domain_id )
> + d->arch.evtchn_irq = GUEST_EVTCHN_PPI;
> + else
> + d->arch.evtchn_irq = platform_dom0_evtchn_ppi();
>
> /*
> * Virtual UART is only used by linux early printk and decompress code.
> diff --git a/xen/arch/arm/platform.c b/xen/arch/arm/platform.c
> index 0fbbdc7..a7f9ee4 100644
> --- a/xen/arch/arm/platform.c
> +++ b/xen/arch/arm/platform.c
> @@ -156,6 +156,13 @@ bool_t platform_device_is_blacklisted(const struct dt_device_node *node)
> return dt_match_node(blacklist, node);
> }
>
> +unsigned int platform_dom0_evtchn_ppi(void)
> +{
> + if ( platform && platform->dom0_evtchn_ppi )
> + return platform->dom0_evtchn_ppi;
> + return GUEST_EVTCHN_PPI;
> +}
> +
> /*
> * Local variables:
> * mode: C
> diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c
> index d185a4a..8658996 100644
> --- a/xen/arch/arm/platforms/xgene-storm.c
> +++ b/xen/arch/arm/platforms/xgene-storm.c
> @@ -40,6 +40,7 @@ static const char const *xgene_storm_dt_compat[] __initdata =
> PLATFORM_START(xgene_storm, "APM X-GENE STORM")
> .compatible = xgene_storm_dt_compat,
> .quirks = xgene_storm_quirks,
> + .dom0_evtchn_ppi = 24,
> PLATFORM_END
>
> /*
> diff --git a/xen/include/asm-arm/platform.h b/xen/include/asm-arm/platform.h
> index c9314e5..5900ee4 100644
> --- a/xen/include/asm-arm/platform.h
> +++ b/xen/include/asm-arm/platform.h
> @@ -37,6 +37,10 @@ struct platform_desc {
> * List of devices which must not pass-through to a guest
> */
> const struct dt_device_match *blacklist_dev;
> + /*
> + * The IRQ (PPI) to use to inject event channels to dom0.
> + */
> + unsigned int dom0_evtchn_ppi;
> };
>
> /*
> @@ -61,6 +65,7 @@ void platform_reset(void);
> void platform_poweroff(void);
> bool_t platform_has_quirk(uint32_t quirk);
> bool_t platform_device_is_blacklisted(const struct dt_device_node *node);
> +unsigned int platform_dom0_evtchn_ppi(void);
>
> #define PLATFORM_START(_name, _namestr) \
> static const struct platform_desc __plat_desc_##_name __used \
>
--
Julien Grall
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 00/15] xen: arm initial support for xgene arm64 platform
2013-11-22 16:27 ` [PATCH 00/15] xen: arm initial support for xgene arm64 platform Ian Campbell
@ 2013-11-22 17:02 ` George Dunlap
2013-11-22 17:09 ` Ian Campbell
0 siblings, 1 reply; 43+ messages in thread
From: George Dunlap @ 2013-11-22 17:02 UTC (permalink / raw)
To: Ian Campbell
Cc: Anup Patel, Tim Deegan, xen-devel@lists.xen.org, Julien Grall,
Stefano Stabellini, Pranavkumar Sawargaonkar
On Fri, Nov 22, 2013 at 4:27 PM, Ian Campbell <Ian.Campbell@citrix.com> wrote:
> Damnit. Missed the --dry-run... Oh well, the patches are actually
> correct I think.
>
> The 00/15 mail would have contained:
>
> This addresses the previous review.
>
> In particular it drops the RFC from a couple of patches and replaces the
> HACKs with clean solutions.
>
> A==acked. H==replaces a HACK. R==release acked. r==might be release
> akced but George wasn't 100% explicit.
>
> R xen: arm64: Add 8250 earlyprintk support
> A R xen: arm64: Add Basic Platform support for APM X-Gene Storm.
> A R xen: arm64: Add APM implementor id to processor implementers.
> H xen: arm: add a quirk to handle platforms with unusual GIC layout
> A xen: arm: allow platform code to select dom0 event channel irq
> H xen: arm64: Map xgene PCI memory regions and interrupts to dom0.
> A R xen: arm: include ns16550 driver on arm64 too
> A r xen: arm: early logging of command line
> r xen: arm: Handle cpus nodes with #address-cells > 1
> R xen: arm: Make register bit definitions unsigned.
> A R xen: arm: explicitly map 64 bit release address
> R xen: arm: enable synchronous console while starting secondary CPUs
> R xen: arm: Add debug keyhandler to dump the physical GIC state.
> A R xen: arm: improve early memory map readability
> r xen: arm: handle 40-bit addresses in the p2m
OK -- everything looks good release-wise.
-George
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v2 04/15] xen: arm: add a quirk to handle platforms with unusual GIC layout
2013-11-22 16:46 ` Julien Grall
@ 2013-11-22 17:03 ` Ian Campbell
2013-11-22 17:10 ` Julien Grall
0 siblings, 1 reply; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 17:03 UTC (permalink / raw)
To: Julien Grall; +Cc: stefano.stabellini, pranavkumar, tim, Anup Patel, xen-devel
On Fri, 2013-11-22 at 16:46 +0000, Julien Grall wrote:
>
> On 11/22/2013 04:24 PM, Ian Campbell wrote:
> > Use this quirk on the xgene platform.
>
> With this quirk you only fix xen GIC. What about dom0/guest GIC ? I know
> that Linux is not using the secondary page, but we expose 2 pages
> contiguous page. With this quirk the first page is valid ... but the
> second page could belong to another device.
Damn, good point.
> Can we remove the second page when the quirk is enabled?
I think what I will do is make gicv_setup map the two discontiguous 4K
regions contiguously into the guest space. This is consistent with the
DTB we expose to the guest.
The reason for the discontinuity at the h/w level is (AFAICT) to support
OSes using 64K pages and/or granules. I think we can live without these
for the time being.
Ian.
>
> > This should ideally be fixed by an extension to the device tree bindings as
> > described in http://www.spinics.net/lists/devicetree/msg10473.html especially
> > http://www.spinics.net/lists/devicetree/msg10478.html. However for the time
> > being a platform specific quirk will do.
> > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> > ---
> > v2: This replaces "xen: arm: GICC_DIR register at offset 0x10000 instead of 0x1000"
> > ---
> > xen/arch/arm/gic.c | 6 +++++-
> > xen/arch/arm/platforms/xgene-storm.c | 2 +-
> > xen/include/asm-arm/platform.h | 5 +++++
> > 3 files changed, 11 insertions(+), 2 deletions(-)
> >
> > diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
> > index ab49106..9711f5d 100644
> > --- a/xen/arch/arm/gic.c
> > +++ b/xen/arch/arm/gic.c
> > @@ -30,6 +30,7 @@
> > #include <xen/device_tree.h>
> > #include <asm/p2m.h>
> > #include <asm/domain.h>
> > +#include <asm/platform.h>
> >
> > #include <asm/gic.h>
> >
> > @@ -444,7 +445,10 @@ void __init gic_init(void)
> > BUILD_BUG_ON(FIXMAP_ADDR(FIXMAP_GICC1) !=
> > FIXMAP_ADDR(FIXMAP_GICC2)-PAGE_SIZE);
> > set_fixmap(FIXMAP_GICC1, gic.cbase >> PAGE_SHIFT, DEV_SHARED);
> > - set_fixmap(FIXMAP_GICC2, (gic.cbase >> PAGE_SHIFT) + 1, DEV_SHARED);
> > + if ( platform_has_quirk(PLATFORM_QUIRK_GIC_64K_STRIDE) )
> > + set_fixmap(FIXMAP_GICC2, (gic.cbase >> PAGE_SHIFT) + 0x10, DEV_SHARED);
> > + else
> > + set_fixmap(FIXMAP_GICC2, (gic.cbase >> PAGE_SHIFT) + 0x1, DEV_SHARED);
> > set_fixmap(FIXMAP_GICH, gic.hbase >> PAGE_SHIFT, DEV_SHARED);
> >
> > /* Global settings: interrupt distributor */
> > diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c
> > index 727ac2b..d185a4a 100644
> > --- a/xen/arch/arm/platforms/xgene-storm.c
> > +++ b/xen/arch/arm/platforms/xgene-storm.c
> > @@ -27,7 +27,7 @@
> >
> > static uint32_t xgene_storm_quirks(void)
> > {
> > - return PLATFORM_QUIRK_DOM0_MAPPING_11;
> > + return PLATFORM_QUIRK_DOM0_MAPPING_11|PLATFORM_QUIRK_GIC_64K_STRIDE;
> > }
> >
> >
> > diff --git a/xen/include/asm-arm/platform.h b/xen/include/asm-arm/platform.h
> > index c282b30..c9314e5 100644
> > --- a/xen/include/asm-arm/platform.h
> > +++ b/xen/include/asm-arm/platform.h
> > @@ -44,6 +44,11 @@ struct platform_desc {
> > * Useful on platform where System MMU is not yet implemented
> > */
> > #define PLATFORM_QUIRK_DOM0_MAPPING_11 (1 << 0)
> > +/*
> > + * Quirk for platforms where the 4K GIC register ranges are placed at
> > + * 64K stride.
> > + */
> > +#define PLATFORM_QUIRK_GIC_64K_STRIDE (1 << 1)
> >
> > void __init platform_init(void);
> > int __init platform_init_time(void);
> >
>
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v2 08/15] xen: arm: early logging of command line
2013-11-22 16:24 ` [PATCH v2 08/15] xen: arm: early logging of command line Ian Campbell
@ 2013-11-22 17:04 ` Ian Campbell
0 siblings, 0 replies; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 17:04 UTC (permalink / raw)
To: xen-devel; +Cc: pranavkumar, julien.grall, tim, Anup Patel, stefano.stabellini
On Fri, 2013-11-22 at 16:24 +0000, Ian Campbell wrote:
> Helpful for diagnosis of bad console= parameters.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> Acked-by: Julien Grall <julien.grall@linaro.org>
> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
This one is pretty much unrelated to the series and is plenty acked. I
have applied.
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 00/15] xen: arm initial support for xgene arm64 platform
2013-11-22 17:02 ` George Dunlap
@ 2013-11-22 17:09 ` Ian Campbell
2013-11-29 10:30 ` Ian Campbell
0 siblings, 1 reply; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 17:09 UTC (permalink / raw)
To: George Dunlap
Cc: Anup Patel, Tim Deegan, xen-devel@lists.xen.org, Julien Grall,
Stefano Stabellini, Pranavkumar Sawargaonkar
On Fri, 2013-11-22 at 17:02 +0000, George Dunlap wrote:
> On Fri, Nov 22, 2013 at 4:27 PM, Ian Campbell <Ian.Campbell@citrix.com> wrote:
> > Damnit. Missed the --dry-run... Oh well, the patches are actually
> > correct I think.
> >
> > The 00/15 mail would have contained:
> >
> > This addresses the previous review.
> >
> > In particular it drops the RFC from a couple of patches and replaces the
> > HACKs with clean solutions.
> >
> > A==acked. H==replaces a HACK. R==release acked. r==might be release
> > akced but George wasn't 100% explicit.
> >
> > R xen: arm64: Add 8250 earlyprintk support
> > A R xen: arm64: Add Basic Platform support for APM X-Gene Storm.
> > A R xen: arm64: Add APM implementor id to processor implementers.
> > H xen: arm: add a quirk to handle platforms with unusual GIC layout
> > A xen: arm: allow platform code to select dom0 event channel irq
> > H xen: arm64: Map xgene PCI memory regions and interrupts to dom0.
> > A R xen: arm: include ns16550 driver on arm64 too
> > A r xen: arm: early logging of command line
> > r xen: arm: Handle cpus nodes with #address-cells > 1
> > R xen: arm: Make register bit definitions unsigned.
> > A R xen: arm: explicitly map 64 bit release address
> > R xen: arm: enable synchronous console while starting secondary CPUs
> > R xen: arm: Add debug keyhandler to dump the physical GIC state.
> > A R xen: arm: improve early memory map readability
> > r xen: arm: handle 40-bit addresses in the p2m
>
> OK -- everything looks good release-wise.
Thanks.
Ian.
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v2 04/15] xen: arm: add a quirk to handle platforms with unusual GIC layout
2013-11-22 17:03 ` Ian Campbell
@ 2013-11-22 17:10 ` Julien Grall
2013-11-22 17:16 ` Ian Campbell
0 siblings, 1 reply; 43+ messages in thread
From: Julien Grall @ 2013-11-22 17:10 UTC (permalink / raw)
To: Ian Campbell; +Cc: stefano.stabellini, pranavkumar, tim, Anup Patel, xen-devel
On 11/22/2013 05:03 PM, Ian Campbell wrote:
> On Fri, 2013-11-22 at 16:46 +0000, Julien Grall wrote:
>>
>> On 11/22/2013 04:24 PM, Ian Campbell wrote:
>>> Use this quirk on the xgene platform.
>>
>> With this quirk you only fix xen GIC. What about dom0/guest GIC ? I know
>> that Linux is not using the secondary page, but we expose 2 pages
>> contiguous page. With this quirk the first page is valid ... but the
>> second page could belong to another device.
>
> Damn, good point.
>
>> Can we remove the second page when the quirk is enabled?
>
> I think what I will do is make gicv_setup map the two discontiguous 4K
> regions contiguously into the guest space. This is consistent with the
> DTB we expose to the guest.
>
> The reason for the discontinuity at the h/w level is (AFAICT) to support
> OSes using 64K pages and/or granules. I think we can live without these
> for the time being.
I'm fine with this solution as long as we are sure there is no device
memory just after the first page.
--
Julien Grall
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v2 06/15] xen: arm64: Map xgene PCI memory regions and interrupts to dom0.
2013-11-22 16:59 ` Julien Grall
@ 2013-11-22 17:13 ` Ian Campbell
2013-11-22 17:17 ` Julien Grall
0 siblings, 1 reply; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 17:13 UTC (permalink / raw)
To: Julien Grall; +Cc: pranavkumar, stefano.stabellini, tim, Anup Patel, xen-devel
On Fri, 2013-11-22 at 16:59 +0000, Julien Grall wrote:
> Can you add a comment to specify that for the future we plan to support
> PCI for all platforms ? (ie this patch a kind of "WORKAROUND" for now)
I had intended to and plain forgot.
Here is the incremental patch I just merged into this one:
diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c
index 3846f86..1f506fe 100644
--- a/xen/arch/arm/platforms/xgene-storm.c
+++ b/xen/arch/arm/platforms/xgene-storm.c
@@ -60,6 +60,12 @@ 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)
{
int ret;
That OK?
^ permalink raw reply related [flat|nested] 43+ messages in thread
* Re: [PATCH v2 04/15] xen: arm: add a quirk to handle platforms with unusual GIC layout
2013-11-22 17:10 ` Julien Grall
@ 2013-11-22 17:16 ` Ian Campbell
0 siblings, 0 replies; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 17:16 UTC (permalink / raw)
To: Julien Grall; +Cc: stefano.stabellini, pranavkumar, tim, Anup Patel, xen-devel
On Fri, 2013-11-22 at 17:10 +0000, Julien Grall wrote:
>
> On 11/22/2013 05:03 PM, Ian Campbell wrote:
> > On Fri, 2013-11-22 at 16:46 +0000, Julien Grall wrote:
> >>
> >> On 11/22/2013 04:24 PM, Ian Campbell wrote:
> >>> Use this quirk on the xgene platform.
> >>
> >> With this quirk you only fix xen GIC. What about dom0/guest GIC ? I know
> >> that Linux is not using the secondary page, but we expose 2 pages
> >> contiguous page. With this quirk the first page is valid ... but the
> >> second page could belong to another device.
> >
> > Damn, good point.
> >
> >> Can we remove the second page when the quirk is enabled?
> >
> > I think what I will do is make gicv_setup map the two discontiguous 4K
> > regions contiguously into the guest space. This is consistent with the
> > DTB we expose to the guest.
> >
> > The reason for the discontinuity at the h/w level is (AFAICT) to support
> > OSes using 64K pages and/or granules. I think we can live without these
> > for the time being.
>
> I'm fine with this solution as long as we are sure there is no device
> memory just after the first page.
The way the GIC memory map is defined that isn't possible and it's not
the case on this platform.
Ian.
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v2 06/15] xen: arm64: Map xgene PCI memory regions and interrupts to dom0.
2013-11-22 17:13 ` Ian Campbell
@ 2013-11-22 17:17 ` Julien Grall
0 siblings, 0 replies; 43+ messages in thread
From: Julien Grall @ 2013-11-22 17:17 UTC (permalink / raw)
To: Ian Campbell; +Cc: pranavkumar, stefano.stabellini, tim, Anup Patel, xen-devel
On 11/22/2013 05:13 PM, Ian Campbell wrote:
> On Fri, 2013-11-22 at 16:59 +0000, Julien Grall wrote:
>> Can you add a comment to specify that for the future we plan to support
>> PCI for all platforms ? (ie this patch a kind of "WORKAROUND" for now)
>
> I had intended to and plain forgot.
>
> Here is the incremental patch I just merged into this one:
With this incremental patch:
Acked-by: Julien Grall <julien.grall@linaro.org>
> diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c
> index 3846f86..1f506fe 100644
> --- a/xen/arch/arm/platforms/xgene-storm.c
> +++ b/xen/arch/arm/platforms/xgene-storm.c
> @@ -60,6 +60,12 @@ 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)
> {
> int ret;
>
> That OK?
>
--
Julien Grall
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v2 09/15] xen: arm: Handle cpus nodes with #address-cells > 1
2013-11-22 16:24 ` [PATCH v2 09/15] xen: arm: Handle cpus nodes with #address-cells > 1 Ian Campbell
2013-11-22 16:59 ` George Dunlap
@ 2013-11-22 17:22 ` Julien Grall
2013-11-22 17:50 ` Ian Campbell
1 sibling, 1 reply; 43+ messages in thread
From: Julien Grall @ 2013-11-22 17:22 UTC (permalink / raw)
To: Ian Campbell, xen-devel; +Cc: pranavkumar, tim, Anup Patel, stefano.stabellini
On 11/22/2013 04:24 PM, Ian Campbell wrote:
> The APM X-Gene Mustang board DTS has #address-cells = 2.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> ---
> v2: Use dt_read_number, check the property length
> ---
> xen/arch/arm/smpboot.c | 34 +++++++++++++++++++++++++++++-----
> 1 file changed, 29 insertions(+), 5 deletions(-)
>
> diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
> index 6c90fa6..b6a1307 100644
> --- a/xen/arch/arm/smpboot.c
> +++ b/xen/arch/arm/smpboot.c
> @@ -125,18 +125,42 @@ void __init smp_init_cpus(void)
>
> dt_for_each_child_node( cpus, cpu )
> {
> - u32 hwid;
> + const __be32 *prop;
> + u64 addr;
> + u32 reg_len, hwid;
>
> if ( !dt_device_type_is_equal(cpu, "cpu") )
> continue;
>
> - if ( !dt_property_read_u32(cpu, "reg", &hwid) )
> + if ( dt_n_size_cells(cpu) != 0 )
> + printk(XENLOG_WARNING "cpu node `%s`: #size-cells %d\n",
> + dt_node_full_name(cpu), dt_n_size_cells(cpu));
> +
> + prop = dt_get_property(cpu, "reg", ®_len);
> + if ( !prop )
> + {
> + printk(XENLOG_WARNING "cpu node `%s`: has no reg property\n",
> + dt_node_full_name(cpu));
> + continue;
> + }
> +
> + if ( reg_len < dt_n_addr_cells(cpu) )
dt_n_addr_cells is the number of cells not in bytes.
You must use dt_cells_to_size(dt_nr_addr_cells(cpu)), perhaps an helper
would be useful here.
--
Julien Grall
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v2 10/15] xen: arm: Make register bit definitions unsigned.
2013-11-22 16:24 ` [PATCH v2 10/15] xen: arm: Make register bit definitions unsigned Ian Campbell
@ 2013-11-22 17:23 ` Julien Grall
0 siblings, 0 replies; 43+ messages in thread
From: Julien Grall @ 2013-11-22 17:23 UTC (permalink / raw)
To: Ian Campbell, xen-devel
Cc: pranavkumar, tim, Pranavkumar Sawargaonkar, Anup Patel,
stefano.stabellini
On 11/22/2013 04:24 PM, Ian Campbell wrote:
> Otherwise the results of the shifting can be undefined and/or sign extended.
>
> Most registers are 32-bit on both arm32 and arm64 and hence are just unsigned
> ints, however HCR is 64-bit on arm64 and therefore is unsigned long.
>
> Pointed out in the context of HCR_* by Pranavkumar Sawargaonkar.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> Cc: Pranavkumar Sawargaonkar <psawargaonkar@apm.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
> ---
> v2:
> Make 64-bit registers unsigned long
> ---
> xen/include/asm-arm/processor.h | 144 +++++++++++++++++++--------------------
> 1 file changed, 72 insertions(+), 72 deletions(-)
>
> diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
> index 3da3a3d..b2746cc 100644
> --- a/xen/include/asm-arm/processor.h
> +++ b/xen/include/asm-arm/processor.h
> @@ -18,71 +18,71 @@
> #define MPIDR_INVALID (~MPIDR_HWID_MASK)
>
> /* TTBCR Translation Table Base Control Register */
> -#define TTBCR_EAE 0x80000000
> -#define TTBCR_N_MASK 0x07
> -#define TTBCR_N_16KB 0x00
> -#define TTBCR_N_8KB 0x01
> -#define TTBCR_N_4KB 0x02
> -#define TTBCR_N_2KB 0x03
> -#define TTBCR_N_1KB 0x04
> +#define TTBCR_EAE _AC(0x80000000,U)
> +#define TTBCR_N_MASK _AC(0x07,U)
> +#define TTBCR_N_16KB _AC(0x00,U)
> +#define TTBCR_N_8KB _AC(0x01,U)
> +#define TTBCR_N_4KB _AC(0x02,U)
> +#define TTBCR_N_2KB _AC(0x03,U)
> +#define TTBCR_N_1KB _AC(0x04,U)
>
> /* SCTLR System Control Register. */
> /* HSCTLR is a subset of this. */
> -#define SCTLR_TE (1<<30)
> -#define SCTLR_AFE (1<<29)
> -#define SCTLR_TRE (1<<28)
> -#define SCTLR_NMFI (1<<27)
> -#define SCTLR_EE (1<<25)
> -#define SCTLR_VE (1<<24)
> -#define SCTLR_U (1<<22)
> -#define SCTLR_FI (1<<21)
> -#define SCTLR_WXN (1<<19)
> -#define SCTLR_HA (1<<17)
> -#define SCTLR_RR (1<<14)
> -#define SCTLR_V (1<<13)
> -#define SCTLR_I (1<<12)
> -#define SCTLR_Z (1<<11)
> -#define SCTLR_SW (1<<10)
> -#define SCTLR_B (1<<7)
> -#define SCTLR_C (1<<2)
> -#define SCTLR_A (1<<1)
> -#define SCTLR_M (1<<0)
> -
> -#define HSCTLR_BASE 0x30c51878
> +#define SCTLR_TE (_AC(1,U)<<30)
> +#define SCTLR_AFE (_AC(1,U)<<29)
> +#define SCTLR_TRE (_AC(1,U)<<28)
> +#define SCTLR_NMFI (_AC(1,U)<<27)
> +#define SCTLR_EE (_AC(1,U)<<25)
> +#define SCTLR_VE (_AC(1,U)<<24)
> +#define SCTLR_U (_AC(1,U)<<22)
> +#define SCTLR_FI (_AC(1,U)<<21)
> +#define SCTLR_WXN (_AC(1,U)<<19)
> +#define SCTLR_HA (_AC(1,U)<<17)
> +#define SCTLR_RR (_AC(1,U)<<14)
> +#define SCTLR_V (_AC(1,U)<<13)
> +#define SCTLR_I (_AC(1,U)<<12)
> +#define SCTLR_Z (_AC(1,U)<<11)
> +#define SCTLR_SW (_AC(1,U)<<10)
> +#define SCTLR_B (_AC(1,U)<<7)
> +#define SCTLR_C (_AC(1,U)<<2)
> +#define SCTLR_A (_AC(1,U)<<1)
> +#define SCTLR_M (_AC(1,U)<<0)
> +
> +#define HSCTLR_BASE _AC(0x30c51878,U)
>
> /* HCR Hyp Configuration Register */
> -#define HCR_RW (1<<31) /* Register Width, ARM64 only */
> -#define HCR_TGE (1<<27) /* Trap General Exceptions */
> -#define HCR_TVM (1<<26) /* Trap Virtual Memory Controls */
> -#define HCR_TTLB (1<<25) /* Trap TLB Maintenance Operations */
> -#define HCR_TPU (1<<24) /* Trap Cache Maintenance Operations to PoU */
> -#define HCR_TPC (1<<23) /* Trap Cache Maintenance Operations to PoC */
> -#define HCR_TSW (1<<22) /* Trap Set/Way Cache Maintenance Operations */
> -#define HCR_TAC (1<<21) /* Trap ACTLR Accesses */
> -#define HCR_TIDCP (1<<20) /* Trap lockdown */
> -#define HCR_TSC (1<<19) /* Trap SMC instruction */
> -#define HCR_TID3 (1<<18) /* Trap ID Register Group 3 */
> -#define HCR_TID2 (1<<17) /* Trap ID Register Group 2 */
> -#define HCR_TID1 (1<<16) /* Trap ID Register Group 1 */
> -#define HCR_TID0 (1<<15) /* Trap ID Register Group 0 */
> -#define HCR_TWE (1<<14) /* Trap WFE instruction */
> -#define HCR_TWI (1<<13) /* Trap WFI instruction */
> -#define HCR_DC (1<<12) /* Default cacheable */
> -#define HCR_BSU_MASK (3<<10) /* Barrier Shareability Upgrade */
> -#define HCR_BSU_NONE (0<<10)
> -#define HCR_BSU_INNER (1<<10)
> -#define HCR_BSU_OUTER (2<<10)
> -#define HCR_BSU_FULL (3<<10)
> -#define HCR_FB (1<<9) /* Force Broadcast of Cache/BP/TLB operations */
> -#define HCR_VA (1<<8) /* Virtual Asynchronous Abort */
> -#define HCR_VI (1<<7) /* Virtual IRQ */
> -#define HCR_VF (1<<6) /* Virtual FIQ */
> -#define HCR_AMO (1<<5) /* Override CPSR.A */
> -#define HCR_IMO (1<<4) /* Override CPSR.I */
> -#define HCR_FMO (1<<3) /* Override CPSR.F */
> -#define HCR_PTW (1<<2) /* Protected Walk */
> -#define HCR_SWIO (1<<1) /* Set/Way Invalidation Override */
> -#define HCR_VM (1<<0) /* Virtual MMU Enable */
> +#define HCR_RW (_AC(1,UL)<<31) /* Register Width, ARM64 only */
> +#define HCR_TGE (_AC(1,UL)<<27) /* Trap General Exceptions */
> +#define HCR_TVM (_AC(1,UL)<<26) /* Trap Virtual Memory Controls */
> +#define HCR_TTLB (_AC(1,UL)<<25) /* Trap TLB Maintenance Operations */
> +#define HCR_TPU (_AC(1,UL)<<24) /* Trap Cache Maintenance Operations to PoU */
> +#define HCR_TPC (_AC(1,UL)<<23) /* Trap Cache Maintenance Operations to PoC */
> +#define HCR_TSW (_AC(1,UL)<<22) /* Trap Set/Way Cache Maintenance Operations */
> +#define HCR_TAC (_AC(1,UL)<<21) /* Trap ACTLR Accesses */
> +#define HCR_TIDCP (_AC(1,UL)<<20) /* Trap lockdown */
> +#define HCR_TSC (_AC(1,UL)<<19) /* Trap SMC instruction */
> +#define HCR_TID3 (_AC(1,UL)<<18) /* Trap ID Register Group 3 */
> +#define HCR_TID2 (_AC(1,UL)<<17) /* Trap ID Register Group 2 */
> +#define HCR_TID1 (_AC(1,UL)<<16) /* Trap ID Register Group 1 */
> +#define HCR_TID0 (_AC(1,UL)<<15) /* Trap ID Register Group 0 */
> +#define HCR_TWE (_AC(1,UL)<<14) /* Trap WFE instruction */
> +#define HCR_TWI (_AC(1,UL)<<13) /* Trap WFI instruction */
> +#define HCR_DC (_AC(1,UL)<<12) /* Default cacheable */
> +#define HCR_BSU_MASK (_AC(3,UL)<<10) /* Barrier Shareability Upgrade */
> +#define HCR_BSU_NONE (_AC(0,UL)<<10)
> +#define HCR_BSU_INNER (_AC(1,UL)<<10)
> +#define HCR_BSU_OUTER (_AC(2,UL)<<10)
> +#define HCR_BSU_FULL (_AC(3,UL)<<10)
> +#define HCR_FB (_AC(1,UL)<<9) /* Force Broadcast of Cache/BP/TLB operations */
> +#define HCR_VA (_AC(1,UL)<<8) /* Virtual Asynchronous Abort */
> +#define HCR_VI (_AC(1,UL)<<7) /* Virtual IRQ */
> +#define HCR_VF (_AC(1,UL)<<6) /* Virtual FIQ */
> +#define HCR_AMO (_AC(1,UL)<<5) /* Override CPSR.A */
> +#define HCR_IMO (_AC(1,UL)<<4) /* Override CPSR.I */
> +#define HCR_FMO (_AC(1,UL)<<3) /* Override CPSR.F */
> +#define HCR_PTW (_AC(1,UL)<<2) /* Protected Walk */
> +#define HCR_SWIO (_AC(1,UL)<<1) /* Set/Way Invalidation Override */
> +#define HCR_VM (_AC(1,UL)<<0) /* Virtual MMU Enable */
>
> #define HSR_EC_UNKNOWN 0x00
> #define HSR_EC_WFI_WFE 0x01
> @@ -346,20 +346,20 @@ union hsr {
> HSR_SYSREG_OP2_MASK)
>
> /* Physical Address Register */
> -#define PAR_F (1<<0)
> +#define PAR_F (_AC(1,U)<<0)
>
> /* .... If F == 1 */
> #define PAR_FSC_SHIFT (1)
> -#define PAR_FSC_MASK (0x3f<<PAR_FSC_SHIFT)
> -#define PAR_STAGE21 (1<<8) /* Stage 2 Fault During Stage 1 Walk */
> -#define PAR_STAGE2 (1<<9) /* Stage 2 Fault */
> +#define PAR_FSC_MASK (_AC(0x3f,U)<<PAR_FSC_SHIFT)
> +#define PAR_STAGE21 (_AC(1,U)<<8) /* Stage 2 Fault During Stage 1 Walk */
> +#define PAR_STAGE2 (_AC(1,U)<<9) /* Stage 2 Fault */
>
> /* If F == 0 */
> #define PAR_MAIR_SHIFT 56 /* Memory Attributes */
> #define PAR_MAIR_MASK (0xffLL<<PAR_MAIR_SHIFT)
> -#define PAR_NS (1<<9) /* Non-Secure */
> +#define PAR_NS (_AC(1,U)<<9) /* Non-Secure */
> #define PAR_SH_SHIFT 7 /* Shareability */
> -#define PAR_SH_MASK (3<<PAR_SH_SHIFT)
> +#define PAR_SH_MASK (_AC(3,U)<<PAR_SH_SHIFT)
>
> /* Fault Status Register */
> /*
> @@ -372,11 +372,11 @@ union hsr {
> * 10xxxx -- Other
> * 11xxxx -- Implementation Defined
> */
> -#define FSC_TYPE_MASK (0x3<<4)
> -#define FSC_TYPE_FAULT (0x00<<4)
> -#define FSC_TYPE_ABT (0x01<<4)
> -#define FSC_TYPE_OTH (0x02<<4)
> -#define FSC_TYPE_IMPL (0x03<<4)
> +#define FSC_TYPE_MASK (_AC(0x3,U)<<4)
> +#define FSC_TYPE_FAULT (_AC(0x00,U)<<4)
> +#define FSC_TYPE_ABT (_AC(0x01,U)<<4)
> +#define FSC_TYPE_OTH (_AC(0x02,U)<<4)
> +#define FSC_TYPE_IMPL (_AC(0x03,U)<<4)
>
> #define FSC_FLT_TRANS (0x04)
> #define FSC_FLT_ACCESS (0x08)
> @@ -391,7 +391,7 @@ union hsr {
> #define FSC_LKD (0x34) /* Lockdown Abort */
> #define FSC_CPR (0x3a) /* Coprocossor Abort */
>
> -#define FSC_LL_MASK (0x03<<0)
> +#define FSC_LL_MASK (_AC(0x03,U)<<0)
>
> /* Time counter hypervisor control register */
> #define CNTHCTL_PA (1u<<0) /* Kernel/user access to physical counter */
>
--
Julien Grall
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v2 12/15] xen: arm: enable synchronous console while starting secondary CPUs
2013-11-22 16:24 ` [PATCH v2 12/15] xen: arm: enable synchronous console while starting secondary CPUs Ian Campbell
@ 2013-11-22 17:36 ` Julien Grall
2013-11-22 17:49 ` Ian Campbell
0 siblings, 1 reply; 43+ messages in thread
From: Julien Grall @ 2013-11-22 17:36 UTC (permalink / raw)
To: Ian Campbell, xen-devel
Cc: Keir Fraser, pranavkumar, tim, Anup Patel, stefano.stabellini
On 11/22/2013 04:24 PM, Ian Campbell wrote:
> Setting synchronous console ensures that any printk hits the buffer
> immediately and that any outstanding queued log messages are flushed. This
> ensures that such log messages are not being printed while the secondary CPU
> may be using early_printk during early bringup.
stefano: There is some place in x86 (shutdown, kexec) when
console_*_sync are used. So far after console_endboot. I think it's also
fine for us.
> Signed-of-by: Ian Campbell <ian.campbell@citrix.com>
> Cc: Keir Fraser <keir@xen.org>
> ---
> v2: improved commit message.
> ---
> xen/arch/arm/smpboot.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
> index b6a1307..f6cd9d7 100644
> --- a/xen/arch/arm/smpboot.c
> +++ b/xen/arch/arm/smpboot.c
> @@ -28,6 +28,7 @@
> #include <xen/softirq.h>
> #include <xen/timer.h>
> #include <xen/irq.h>
> +#include <xen/console.h>
> #include <asm/gic.h>
>
> cpumask_t cpu_online_map;
> @@ -356,6 +357,8 @@ int __cpu_up(unsigned int cpu)
> if ( rc < 0 )
> return rc;
>
> + console_start_sync(); /* Secondary may use early_printk */
> +
I though have asked on the first version this question:
early printk is only enabled when CONFIG_EARLY_PRINTK is defined. Why
don't you surround console_*_sync with #ifdef CONFIG_EARLY_PRINTK?
--
Julien Grall
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v2 12/15] xen: arm: enable synchronous console while starting secondary CPUs
2013-11-22 17:36 ` Julien Grall
@ 2013-11-22 17:49 ` Ian Campbell
0 siblings, 0 replies; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 17:49 UTC (permalink / raw)
To: Julien Grall
Cc: Keir Fraser, Anup Patel, stefano.stabellini, tim, xen-devel,
pranavkumar
On Fri, 2013-11-22 at 17:36 +0000, Julien Grall wrote:
> > + console_start_sync(); /* Secondary may use early_printk */
> > +
>
> I though have asked on the first version this question:
Sorry, don't remember seeing this.
> early printk is only enabled when CONFIG_EARLY_PRINTK is defined. Why
> don't you surround console_*_sync with #ifdef CONFIG_EARLY_PRINTK?
I don't see any need, it is harmless even if !early_printk and it just
adds clutter to this function to ifdef it.
Ian.
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v2 09/15] xen: arm: Handle cpus nodes with #address-cells > 1
2013-11-22 17:22 ` Julien Grall
@ 2013-11-22 17:50 ` Ian Campbell
0 siblings, 0 replies; 43+ messages in thread
From: Ian Campbell @ 2013-11-22 17:50 UTC (permalink / raw)
To: Julien Grall; +Cc: pranavkumar, stefano.stabellini, tim, Anup Patel, xen-devel
On Fri, 2013-11-22 at 17:22 +0000, Julien Grall wrote:
> > + if ( reg_len < dt_n_addr_cells(cpu) )
>
> dt_n_addr_cells is the number of cells not in bytes.
Gah.
> You must use dt_cells_to_size(dt_nr_addr_cells(cpu)), perhaps an helper
> would be useful here.
While investigating I noticed that almost nowhere else seems to care
about this and it doesn't seem that needing to is all that common. So I
just went with the plain dt_cells_to_size:
>From 5a96dd424e484bc5d6c00022c4861873c06928fd Mon Sep 17 00:00:00 2001
From: Ian Campbell <ian.campbell@citrix.com>
Date: Thu, 10 Oct 2013 13:11:46 +0100
Subject: [PATCH] xen: arm: Handle cpus nodes with #address-cells > 1
The APM X-Gene Mustang board DTS has #address-cells = 2.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
v3: Correct check for property length (bytes not cells)
v2: Use dt_read_number, check the property length
---
xen/arch/arm/smpboot.c | 34 +++++++++++++++++++++++++++++-----
1 file changed, 29 insertions(+), 5 deletions(-)
diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index 6c90fa6..7636ab8 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -125,18 +125,42 @@ void __init smp_init_cpus(void)
dt_for_each_child_node( cpus, cpu )
{
- u32 hwid;
+ const __be32 *prop;
+ u64 addr;
+ u32 reg_len, hwid;
if ( !dt_device_type_is_equal(cpu, "cpu") )
continue;
- if ( !dt_property_read_u32(cpu, "reg", &hwid) )
+ if ( dt_n_size_cells(cpu) != 0 )
+ printk(XENLOG_WARNING "cpu node `%s`: #size-cells %d\n",
+ dt_node_full_name(cpu), dt_n_size_cells(cpu));
+
+ prop = dt_get_property(cpu, "reg", ®_len);
+ if ( !prop )
+ {
+ printk(XENLOG_WARNING "cpu node `%s`: has no reg property\n",
+ dt_node_full_name(cpu));
+ continue;
+ }
+
+ if ( reg_len < dt_cells_to_size(dt_n_addr_cells(cpu)) )
{
- printk(XENLOG_WARNING "cpu node `%s`: missing reg property\n",
+ printk(XENLOG_WARNING "cpu node `%s`: reg property too short\n",
dt_node_full_name(cpu));
continue;
}
+ addr = dt_read_number(prop, dt_n_addr_cells(cpu));
+
+ hwid = addr;
+ if ( hwid != addr )
+ {
+ printk(XENLOG_WARNING "cpu node `%s`: hwid overflow %"PRIx64"\n",
+ dt_node_full_name(cpu), addr);
+ continue;
+ }
+
/*
* 8 MSBs must be set to 0 in the DT since the reg property
* defines the MPIDR[23:0]
@@ -159,8 +183,8 @@ void __init smp_init_cpus(void)
if ( tmp_map[j] == hwid )
{
printk(XENLOG_WARNING
- "cpu node `%s`: duplicate /cpu reg properties in the DT\n",
- dt_node_full_name(cpu));
+ "cpu node `%s`: duplicate /cpu reg properties %"PRIx32" in the DT\n",
+ dt_node_full_name(cpu), hwid);
break;
}
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 43+ messages in thread
* Re: [PATCH v2 15/15] xen: arm: handle 40-bit addresses in the p2m
2013-11-22 16:24 ` [PATCH v2 15/15] xen: arm: handle 40-bit addresses in the p2m Ian Campbell
@ 2013-11-28 17:41 ` Stefano Stabellini
2013-11-28 17:45 ` Ian Campbell
0 siblings, 1 reply; 43+ messages in thread
From: Stefano Stabellini @ 2013-11-28 17:41 UTC (permalink / raw)
To: Ian Campbell
Cc: Anup Patel, stefano.stabellini, julien.grall, tim, xen-devel,
pranavkumar
On Fri, 22 Nov 2013, Ian Campbell wrote:
> On the X-gene platform there are resources up this high which must be mapped
> to dom0.
>
> Remove the first level page from the p2m->pages list since it is actually two
> pages and must be freed as such. Do so in p2m_teardown.
>
> I've also punted on the implementation of dump_p2m_lookup for high
> addresses...
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> ---
> v2:
> Remove irrelevant commentary from commit message
> No longer RFC
> ---
> xen/arch/arm/p2m.c | 60 +++++++++++++++++++++++++++++++++++++++++-----------
> 1 file changed, 48 insertions(+), 12 deletions(-)
>
> diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
> index 82dda65..af32511 100644
> --- a/xen/arch/arm/p2m.c
> +++ b/xen/arch/arm/p2m.c
> @@ -7,6 +7,10 @@
> #include <asm/flushtlb.h>
> #include <asm/gic.h>
>
> +/* First level P2M is 2 consecutive pages */
> +#define P2M_FIRST_ORDER 1
> +#define P2M_FIRST_ENTRIES (LPAE_ENTRIES<<P2M_FIRST_ORDER)
> +
> void dump_p2m_lookup(struct domain *d, paddr_t addr)
> {
> struct p2m_domain *p2m = &d->arch.p2m;
> @@ -14,6 +18,12 @@ void dump_p2m_lookup(struct domain *d, paddr_t addr)
>
> printk("dom%d IPA 0x%"PRIpaddr"\n", d->domain_id, addr);
>
> + if ( first_linear_offset(addr) > LPAE_ENTRIES )
> + {
> + printk("Cannot dump addresses in second of first level pages...\n");
> + return;
> + }
> +
> printk("P2M @ %p mfn:0x%lx\n",
> p2m->first_level, page_to_mfn(p2m->first_level));
>
> @@ -31,6 +41,30 @@ void p2m_load_VTTBR(struct domain *d)
> isb(); /* Ensure update is visible */
> }
>
> +static int p2m_first_level_index(paddr_t addr)
Would it make sense to make this an inline function?
Regardless you have my acked-by.
> +{
> + /*
> + * 1st pages are concatenated so zeroeth offset gives us the
> + * index of the 1st page
> + */
> + return zeroeth_table_offset(addr);
> +}
> +
> +/*
> + * Map whichever of the first pages contain addr. The caller should
> + * then use first_table_offset as an index.
> + */
> +static lpae_t *p2m_map_first(struct p2m_domain *p2m, paddr_t addr)
> +{
> + struct page_info *page;
> +
> + BUG_ON(first_linear_offset(addr) > P2M_FIRST_ENTRIES);
> +
> + page = p2m->first_level + p2m_first_level_index(addr);
> +
> + return __map_domain_page(page);
> +}
> +
> /*
> * Lookup the MFN corresponding to a domain's PFN.
> *
> @@ -45,7 +79,7 @@ paddr_t p2m_lookup(struct domain *d, paddr_t paddr)
>
> spin_lock(&p2m->lock);
>
> - first = __map_domain_page(p2m->first_level);
> + first = p2m_map_first(p2m, paddr);
>
> pte = first[first_table_offset(paddr)];
> if ( !pte.p2m.valid || !pte.p2m.table )
> @@ -135,18 +169,21 @@ static int create_p2m_entries(struct domain *d,
> struct p2m_domain *p2m = &d->arch.p2m;
> lpae_t *first = NULL, *second = NULL, *third = NULL;
> paddr_t addr;
> - unsigned long cur_first_offset = ~0, cur_second_offset = ~0;
> + unsigned long cur_first_page = ~0,
> + cur_first_offset = ~0,
> + cur_second_offset = ~0;
>
> spin_lock(&p2m->lock);
>
> - /* XXX Don't actually handle 40 bit guest physical addresses */
> - BUG_ON(start_gpaddr & 0x8000000000ULL);
> - BUG_ON(end_gpaddr & 0x8000000000ULL);
> -
> - first = __map_domain_page(p2m->first_level);
> -
> for(addr = start_gpaddr; addr < end_gpaddr; addr += PAGE_SIZE)
> {
> + if ( cur_first_page != p2m_first_level_index(addr) )
> + {
> + if ( first ) unmap_domain_page(first);
> + first = p2m_map_first(p2m, addr);
> + cur_first_page = p2m_first_level_index(addr);
> + }
> +
> if ( !first[first_table_offset(addr)].p2m.valid )
> {
> rc = p2m_create_table(d, &first[first_table_offset(addr)]);
> @@ -279,15 +316,12 @@ int p2m_alloc_table(struct domain *d)
> struct page_info *page;
> void *p;
>
> - /* First level P2M is 2 consecutive pages */
> - page = alloc_domheap_pages(NULL, 1, 0);
> + page = alloc_domheap_pages(NULL, P2M_FIRST_ORDER, 0);
> if ( page == NULL )
> return -ENOMEM;
>
> spin_lock(&p2m->lock);
>
> - page_list_add(page, &p2m->pages);
> -
> /* Clear both first level pages */
> p = __map_domain_page(page);
> clear_page(p);
> @@ -380,6 +414,8 @@ void p2m_teardown(struct domain *d)
> while ( (pg = page_list_remove_head(&p2m->pages)) )
> free_domheap_page(pg);
>
> + free_domheap_pages(p2m->first_level, P2M_FIRST_ORDER);
> +
> p2m->first_level = NULL;
>
> p2m_free_vmid(d);
> --
> 1.7.10.4
>
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH v2 15/15] xen: arm: handle 40-bit addresses in the p2m
2013-11-28 17:41 ` Stefano Stabellini
@ 2013-11-28 17:45 ` Ian Campbell
0 siblings, 0 replies; 43+ messages in thread
From: Ian Campbell @ 2013-11-28 17:45 UTC (permalink / raw)
To: Stefano Stabellini; +Cc: pranavkumar, julien.grall, tim, Anup Patel, xen-devel
On Thu, 2013-11-28 at 17:41 +0000, Stefano Stabellini wrote:
> On Fri, 22 Nov 2013, Ian Campbell wrote:
> > On the X-gene platform there are resources up this high which must be mapped
> > to dom0.
> >
> > Remove the first level page from the p2m->pages list since it is actually two
> > pages and must be freed as such. Do so in p2m_teardown.
> >
> > I've also punted on the implementation of dump_p2m_lookup for high
> > addresses...
> >
> > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> > ---
> > v2:
> > Remove irrelevant commentary from commit message
> > No longer RFC
> > ---
> > xen/arch/arm/p2m.c | 60 +++++++++++++++++++++++++++++++++++++++++-----------
> > 1 file changed, 48 insertions(+), 12 deletions(-)
> >
> > diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
> > index 82dda65..af32511 100644
> > --- a/xen/arch/arm/p2m.c
> > +++ b/xen/arch/arm/p2m.c
> > @@ -7,6 +7,10 @@
> > #include <asm/flushtlb.h>
> > #include <asm/gic.h>
> >
> > +/* First level P2M is 2 consecutive pages */
> > +#define P2M_FIRST_ORDER 1
> > +#define P2M_FIRST_ENTRIES (LPAE_ENTRIES<<P2M_FIRST_ORDER)
> > +
> > void dump_p2m_lookup(struct domain *d, paddr_t addr)
> > {
> > struct p2m_domain *p2m = &d->arch.p2m;
> > @@ -14,6 +18,12 @@ void dump_p2m_lookup(struct domain *d, paddr_t addr)
> >
> > printk("dom%d IPA 0x%"PRIpaddr"\n", d->domain_id, addr);
> >
> > + if ( first_linear_offset(addr) > LPAE_ENTRIES )
> > + {
> > + printk("Cannot dump addresses in second of first level pages...\n");
> > + return;
> > + }
> > +
> > printk("P2M @ %p mfn:0x%lx\n",
> > p2m->first_level, page_to_mfn(p2m->first_level));
> >
> > @@ -31,6 +41,30 @@ void p2m_load_VTTBR(struct domain *d)
> > isb(); /* Ensure update is visible */
> > }
> >
> > +static int p2m_first_level_index(paddr_t addr)
>
> Would it make sense to make this an inline function?
I'm happy to let gcc figure out if it makes sense or not based on the
callsites etc, rather than second guessing.
> Regardless you have my acked-by.
Thanks, I'll apply this series in the morning.
Ian.
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH 00/15] xen: arm initial support for xgene arm64 platform
2013-11-22 17:09 ` Ian Campbell
@ 2013-11-29 10:30 ` Ian Campbell
0 siblings, 0 replies; 43+ messages in thread
From: Ian Campbell @ 2013-11-29 10:30 UTC (permalink / raw)
To: George Dunlap
Cc: Anup Patel, Tim Deegan, xen-devel@lists.xen.org, Julien Grall,
Stefano Stabellini, Pranavkumar Sawargaonkar
On Fri, 2013-11-22 at 17:09 +0000, Ian Campbell wrote:
> > OK -- everything looks good release-wise.
>
> Thanks.
Stefano acked the last patch so I have now pushed this.
^ permalink raw reply [flat|nested] 43+ messages in thread
end of thread, other threads:[~2013-11-29 10:30 UTC | newest]
Thread overview: 43+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <foo>
2013-11-22 16:24 ` [PATCH v2 01/15] xen: arm64: Add 8250 earlyprintk support Ian Campbell
2013-11-22 16:27 ` [PATCH 00/15] xen: arm initial support for xgene arm64 platform Ian Campbell
2013-11-22 17:02 ` George Dunlap
2013-11-22 17:09 ` Ian Campbell
2013-11-29 10:30 ` Ian Campbell
2013-11-22 16:29 ` [PATCH v2 01/15] xen: arm64: Add 8250 earlyprintk support Julien Grall
2013-11-22 16:24 ` [PATCH v2 02/15] xen: arm64: Add Basic Platform support for APM X-Gene Storm Ian Campbell
2013-11-22 16:35 ` Julien Grall
2013-11-22 16:43 ` Ian Campbell
2013-11-22 16:24 ` [PATCH v2 03/15] xen: arm64: Add APM implementor id to processor implementers Ian Campbell
2013-11-22 16:24 ` [PATCH v2 04/15] xen: arm: add a quirk to handle platforms with unusual GIC layout Ian Campbell
2013-11-22 16:46 ` Julien Grall
2013-11-22 17:03 ` Ian Campbell
2013-11-22 17:10 ` Julien Grall
2013-11-22 17:16 ` Ian Campbell
2013-11-22 16:46 ` George Dunlap
2013-11-22 16:24 ` [PATCH v2 05/15] xen: arm: allow platform code to select dom0 event channel irq Ian Campbell
2013-11-22 16:48 ` George Dunlap
2013-11-22 17:01 ` Julien Grall
2013-11-22 16:24 ` [PATCH v2 06/15] xen: arm64: Map xgene PCI memory regions and interrupts to dom0 Ian Campbell
2013-11-22 16:50 ` George Dunlap
2013-11-22 16:59 ` Julien Grall
2013-11-22 17:13 ` Ian Campbell
2013-11-22 17:17 ` Julien Grall
2013-11-22 16:24 ` [PATCH v2 07/15] xen: arm: include ns16550 driver on arm64 too Ian Campbell
2013-11-22 16:24 ` [PATCH v2 08/15] xen: arm: early logging of command line Ian Campbell
2013-11-22 17:04 ` Ian Campbell
2013-11-22 16:24 ` [PATCH v2 09/15] xen: arm: Handle cpus nodes with #address-cells > 1 Ian Campbell
2013-11-22 16:59 ` George Dunlap
2013-11-22 17:22 ` Julien Grall
2013-11-22 17:50 ` Ian Campbell
2013-11-22 16:24 ` [PATCH v2 10/15] xen: arm: Make register bit definitions unsigned Ian Campbell
2013-11-22 17:23 ` Julien Grall
2013-11-22 16:24 ` [PATCH v2 11/15] xen: arm: explicitly map 64 bit release address Ian Campbell
2013-11-22 16:24 ` [PATCH v2 12/15] xen: arm: enable synchronous console while starting secondary CPUs Ian Campbell
2013-11-22 17:36 ` Julien Grall
2013-11-22 17:49 ` Ian Campbell
2013-11-22 16:24 ` [PATCH v2 13/15] xen: arm: Add debug keyhandler to dump the physical GIC state Ian Campbell
2013-11-22 16:37 ` Ian Campbell
2013-11-22 16:24 ` [PATCH v2 14/15] xen: arm: improve early memory map readability Ian Campbell
2013-11-22 16:24 ` [PATCH v2 15/15] xen: arm: handle 40-bit addresses in the p2m Ian Campbell
2013-11-28 17:41 ` Stefano Stabellini
2013-11-28 17:45 ` Ian Campbell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).