From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Anthony Perard <anthony.perard@citrix.com>,
"patches@linaro.org" <patches@linaro.org>,
Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [RFC 27/29] xen/arm: Add platform specific code for the exynos5
Date: Tue, 30 Apr 2013 16:40:42 +0100 [thread overview]
Message-ID: <517FE5FA.2070801@linaro.org> (raw)
In-Reply-To: <1367316012.3142.474.camel@zakaz.uk.xensource.com>
On 04/30/2013 11:00 AM, Ian Campbell wrote:
> On Mon, 2013-04-29 at 00:02 +0100, Julien Grall wrote:
>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
>> ---
>> xen/arch/arm/platforms/Makefile | 1 +
>> xen/arch/arm/platforms/exynos5.c | 105 +++++++++++++++++++++++++++++++
>> xen/include/asm-arm/platforms/exynos5.h | 40 ++++++++++++
>> 3 files changed, 146 insertions(+)
>> create mode 100644 xen/arch/arm/platforms/exynos5.c
>> create mode 100644 xen/include/asm-arm/platforms/exynos5.h
>>
>> diff --git a/xen/arch/arm/platforms/Makefile b/xen/arch/arm/platforms/Makefile
>> index 4313e95..ff2b65b 100644
>> --- a/xen/arch/arm/platforms/Makefile
>> +++ b/xen/arch/arm/platforms/Makefile
>> @@ -1 +1,2 @@
>> obj-y += vexpress.o
>> +obj-y += exynos5.o
>> diff --git a/xen/arch/arm/platforms/exynos5.c b/xen/arch/arm/platforms/exynos5.c
>> new file mode 100644
>> index 0000000..01e12b7
>> --- /dev/null
>> +++ b/xen/arch/arm/platforms/exynos5.c
>> @@ -0,0 +1,105 @@
>> +/*
>> + * xen/arch/arm/platforms/exynos5.c
>> + *
>> + * Exynos5 specific settings
>> + *
>> + * Julien Grall <julien.grall@linaro.org>
>> + * Copyright (c) 2013 Linaro Limited.
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License as published by
>> + * the Free Software Foundation; either version 2 of the License, or
>> + * (at your option) any later version.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> + * GNU General Public License for more details.
>> + */
>> +
>> +#include <asm/p2m.h>
>> +#include <xen/config.h>
>> +#include <xen/device_tree.h>
>> +#include <xen/domain_page.h>
>> +#include <xen/mm.h>
>> +#include <asm/platforms/exynos5.h>
>> +#include <asm/platform.h>
>> +
>> +static int exynos5_init_time(void)
>> +{
>> + uint32_t reg;
>> +
>> + // enable timer on exynos5 arndale board
>> + // should probably be done by u-boot
>
> /* */ please.
>
>> + reg = platform_read_register(EXYNOS5_MCT_G_TCON);
>> + platform_write_register(EXYNOS5_MCT_G_TCON, reg | EXYNOS5_MCT_G_TCON_START);
>> +
>> + return 0;
>> +}
>> +
>> +/* Additionnal mapping for dom0 (Not in the DTS) */
>
> "Additional mappings"
>
>> +static int exynos5_specific_mapping(struct domain *d)
>> +{
>> + paddr_t ma = 0;
>> + uint32_t *dst;
>> + int res;
>> +
>> + /*
>> + * Set temporary guest traps with 0xe14fff7c which is hvc(0xfffc)
>> + * a hyp panic!
>> + * TODO: Find why:
>> + * 1) Xen abort directly after local_abort_enable when
>> + * the p2m_populate_ram is not here.
>
> It will actually be aborting here somewhere but that abort can't be
> delivered until the point aborts are enabled. My patch "xen: arm: enable
> aborts on all physical processors." will enable aborts much earlier so
> you might get a better indication of exactly where it goes wrong.
My comment is wrong. In fact, I try to map domain memory before the
guest page table is loaded on the CPU.
>> + * 2) Linux doesn't start without this trick
>
> Ouch. I presume it doesn't actually end up calling hvc 0xfffc? Does it
> work if you just map/unmap without writing anything?
>
> What does Linux do without the trick? Touches address 0x0 perhaps? Would
> anything be mapped there on a real Exynos?
Not even.
(XEN) Guest data abort: Translation fault at level 2
(XEN) gva=40004000
(XEN) gpa=0000000040004000
(XEN) instruction syndrome invalid
(XEN) eat=0 cm=0 s1ptw=0 dfsc=6
(XEN) dom0 IPA 0x0000000040004000
(XEN) P2M @ 02ffbfc0 mfn:0xbfdfe
(XEN) 1ST[0x1] = 0x00000000bfdfb6ff
(XEN) 2ND[0x0] = 0x0000000000000000
(XEN) ----[ Xen-4.3-unstable arm32 debug=y Tainted: C ]----
(XEN) CPU: 0
(XEN) PC: 50008338
(XEN) CPSR: 800001d3 MODE:32-bit Guest SVC
(XEN) R0: 40004000 R1: 00000c12 R2: 40008000 R3: 40004000
(XEN) R4: 40008000 R5: 00000000 R6: 0000000e R7: ffffffff
(XEN) R8: 501bf8e0 R9: 40000000 R10:50000000 R11:10201105 R12:500080a8
(XEN) USR: SP: 00000000 LR: 00000000
(XEN) SVC: SP: 00000000 LR: 500083cc SPSR:000001d3
(XEN) ABT: SP: 00000000 LR: 00000000 SPSR:00000000
(XEN) UND: SP: 00000000 LR: 00000000 SPSR:00000000
(XEN) IRQ: SP: 00000000 LR: 00000000 SPSR:00000000
(XEN) FIQ: SP: 00000000 LR: 00000000 SPSR:00000000
(XEN) FIQ: R8: 00000000 R9: 00000000 R10:00000000 R11:00000000 R12:00000000
(XEN)
(XEN) TTBR0 0000000000 TTBR1 0000000000 TCR 00000000
(XEN) SCTLR 00c50078
(XEN) IFAR 00000000 DFAR 00000000
(XEN)
(XEN) HTTBR bfed2000
(XEN) HDFAR 40004000
(XEN) HIFAR 0
(XEN) HPFAR 400040
(XEN) HCR 00002835
(XEN) HSR 90000046
(XEN) VTTBR 10000bfdfe000
(XEN)
(XEN) DFSR 0 DFAR 0
(XEN) IFSR 0 IFAR 0
(XEN)
(XEN) GUEST STACK GOES HERE
(XEN) domain_crash_sync called from traps.c:968
FYI the kernel is loaded at 0x50008000.
> I had a weird one running on the v8 foundation model where I had to add
> a NOP hypercall to Linux's head.S before a certain point -- I wonder if
> this is related?
I did some test and noticed this code is at the wrong place. I didn't
find the issue because with/without this trick linux 3.9 will boot. It's
only happened on the linux 3.7 tree.
The code should be done after the kernel is loading in the memory. But I
think I should remove this code and patch the kernel. What do you think?
By the way, which kernel version do you use? What is your modification?
> It'll be a missing flush or barrier of course, the question is where ;-)
Before the unmap_domain_page, right?
>> + */
>> + p2m_populate_ram(d, 0x0, 0x1000 - 1);
>> +
>> + res = gvirt_to_maddr(0, &ma);
>> + if ( res )
>> + {
>> + printk(XENLOG_ERR "Unable to translate guest address\n");
>> + return -EFAULT;
>> + }
>> +
>> + dst = map_domain_page(ma >> PAGE_SHIFT);
>> + dst[2] = 0xe14fff7c;
>> + unmap_domain_page(dst);
>> +
>> + /* Map the chip ID */
>> + map_mmio_regions(d, EXYNOS5_PA_CHIPID, EXYNOS5_PA_CHIPID + PAGE_SIZE - 1,
>> + EXYNOS5_PA_CHIPID);
>> +
>> + /* Map the PWM region */
>> + map_mmio_regions(d, EXYNOS5_PA_TIMER,
>> + EXYNOS5_PA_TIMER + (PAGE_SIZE * 2) - 1,
>> + EXYNOS5_PA_TIMER);
>> +
>> + return 0;
>> +}
>> +
>> +static void exynos5_reset(void)
>> +{
>> + platform_write_register(EXYNOS5_SWRESET, 1);
>> +}
>> +
>> +static const char const *exynos5_dt_compat[] __initdata =
>> +{
>> + "samsung,exynos5250",
>> + NULL
>> +};
>> +
>> +PLATFORM_START(exynos5, "SAMSUNG EXYNOS5")
>> + .compatible = exynos5_dt_compat,
>> + .init_time = exynos5_init_time,
>> + .specific_mapping = exynos5_specific_mapping,
>> + .reset = exynos5_reset,
>> +PLATFORM_END
>> +
>> +/*
>> + * Local variables:
>> + * mode: C
>> + * c-file-style: "BSD"
>> + * c-basic-offset: 4
>> + * indent-tabs-mode: nil
>> + * End:
>> + */
>> diff --git a/xen/include/asm-arm/platforms/exynos5.h b/xen/include/asm-arm/platforms/exynos5.h
>> new file mode 100644
>> index 0000000..d77623c
>> --- /dev/null
>> +++ b/xen/include/asm-arm/platforms/exynos5.h
>> @@ -0,0 +1,40 @@
>> +#ifndef __ASM_ARM_PLATFORMS_EXYNOS5_H
>> +#define __ASM_ASM_PLATFORMS_EXYSNO5_H
>> +
>> +#define EXYNOS5_MCT_BASE 0x101c0000
>> +#define EXYNOS5_MCTREG(x) (EXYNOS5_MCT_BASE + (x))
>> +#define EXYNOS5_MCT_G_TCON EXYNOS5_MCTREG(0x240)
>> +#define EXYNOS5_MCT_G_TCON_START (1 << 8)
>> +
>> +#define EXYNOS5_PA_CHIPID 0x10000000
>> +#define EXYNOS5_PA_TIMER 0x12dd0000
>> +/* Base address of system controller */
>> +#define EXYNOS5_PA_PMU 0x10040000
>> +
>> +#define EXYNOS5_SWRESET (EXYNOS5_PA_PMU + 0x0400)
>> +
>> +#define S5P_PA_SYSRAM 0x02020000
>> +
>> +/* Constants below is only used in assembly because the DTS is not yet parsed */
>> +#ifdef __ASSEMBLY__
>> +
>> +/* GIC Base Address */
>> +#define EXYNOS5_GIC_BASE_ADDRESS 0x10480000
>> +
>> +/* Timer's frequency */
>> +#define EXYNOS5_TIMER_FREQUENCY (24 * 1000 * 1000) /* 24 MHz */
>> +
>> +/* Arndale machine ID */
>> +#define MACH_TYPE_SMDK5250 3774
>> +
>> +#endif /* __ASSEMBLY__ */
>> +
>> +#endif /* __ASM_ARM_PLATFORMS_EXYNOS5_H */
>> +/*
>> + * Local variables:
>> + * mode: C
>> + * c-file-style: "BSD"
>> + * c-basic-offset: 4
>> + * indent-tabs-mode: nil
>> + * End:
>> + */
>
>
next prev parent reply other threads:[~2013-04-30 15:40 UTC|newest]
Thread overview: 123+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-28 23:01 [RFC 00/29] Support multiple ARM platforms in Xen Julien Grall
2013-04-28 23:01 ` [RFC 01/29] xen/arm: lr must be included in range [0-nr_lr[ Julien Grall
2013-04-29 14:55 ` Ian Campbell
2013-04-29 15:13 ` Julien Grall
2013-04-28 23:01 ` [RFC 02/29] xen/arm: don't allow dom0 to access to vpl011 UART0 memory range Julien Grall
2013-04-29 14:57 ` Ian Campbell
2013-04-29 15:19 ` Julien Grall
2013-04-28 23:01 ` [RFC 03/29] xen/arm: Remove duplicated GICD_ICPIDR2 definition Julien Grall
2013-04-29 14:58 ` Ian Campbell
2013-04-28 23:01 ` [RFC 04/29] xen/arm: Bump early printk internal buffer to 512 Julien Grall
2013-04-29 15:01 ` Ian Campbell
2013-04-29 15:22 ` Julien Grall
2013-04-28 23:01 ` [RFC 05/29] xen/arm: Fix early_panic when EARLY_PRINTK is disabled Julien Grall
2013-04-29 15:01 ` Ian Campbell
2013-04-28 23:01 ` [RFC 06/29] xen/arm: Load dtb after dom0 kernel Julien Grall
2013-04-29 15:07 ` Ian Campbell
2013-04-29 15:29 ` Julien Grall
2013-04-28 23:01 ` [RFC 07/29] xen/arm: Create a hierarchical device tree Julien Grall
2013-04-29 15:19 ` Ian Campbell
2013-04-29 15:32 ` Julien Grall
2013-04-28 23:01 ` [RFC 08/29] xen/arm: Add helpers to use the " Julien Grall
2013-04-29 15:23 ` Ian Campbell
2013-04-29 15:40 ` Julien Grall
2013-04-29 16:55 ` Ian Campbell
2013-04-29 18:23 ` Julien Grall
2013-04-30 9:22 ` Ian Campbell
2013-04-28 23:01 ` [RFC 09/29] xen/arm: Add helpers to retrieve an address from " Julien Grall
2013-04-28 23:01 ` [RFC 10/29] xen/arm: Add helpers to retrieve an interrupt description " Julien Grall
2013-04-29 15:28 ` Ian Campbell
2013-04-29 15:45 ` Julien Grall
2013-04-29 16:56 ` Ian Campbell
2013-04-28 23:01 ` [RFC 11/29] xen/arm: Introduce gic_route_dt_irq Julien Grall
2013-04-29 15:28 ` Ian Campbell
2013-04-28 23:01 ` [RFC 12/29] xen/arm: Introduce gic_irq_xlate Julien Grall
2013-04-29 15:31 ` Ian Campbell
2013-04-29 15:52 ` Julien Grall
2013-04-28 23:01 ` [RFC 13/29] xen/arm: Use hierarchical device tree to retrieve GIC information Julien Grall
2013-04-29 15:35 ` Ian Campbell
2013-04-29 16:30 ` Julien Grall
2013-04-29 20:42 ` Julien Grall
2013-04-30 9:34 ` Ian Campbell
2013-04-30 18:04 ` Julien Grall
2013-05-01 8:14 ` Ian Campbell
2013-04-28 23:01 ` [RFC 14/29] xen/arm: Retrieve timer interrupts from the device tree Julien Grall
2013-04-29 15:38 ` Ian Campbell
2013-04-29 20:23 ` Julien Grall
2013-04-28 23:01 ` [RFC 15/29] xen/arm: Don't hardcode VGIC informations Julien Grall
2013-04-29 15:41 ` Ian Campbell
2013-04-29 16:42 ` Julien Grall
2013-04-30 9:03 ` Ian Campbell
2013-04-28 23:01 ` [RFC 16/29] xen/arm: Introduce a generic way to use a device from the device tree Julien Grall
2013-04-29 15:44 ` Ian Campbell
2013-04-29 16:58 ` Julien Grall
2013-04-28 23:02 ` [RFC 17/29] xen/arm: New callback in uart_driver to get device tree interrupt structure Julien Grall
2013-04-29 15:46 ` Ian Campbell
2013-04-29 17:09 ` Julien Grall
2013-04-30 9:05 ` Ian Campbell
2013-04-28 23:02 ` [RFC 18/29] xen/arm: add generic UART to get the device in the device tree Julien Grall
2013-04-29 15:51 ` Ian Campbell
2013-04-29 17:24 ` Julien Grall
2013-04-30 9:09 ` Ian Campbell
2013-04-30 11:05 ` Julien Grall
2013-04-30 12:41 ` Ian Campbell
2013-04-30 13:37 ` Julien Grall
2013-04-28 23:02 ` [RFC 19/29] xen/arm: Use device tree API in pl011 UART driver Julien Grall
2013-04-29 15:54 ` Ian Campbell
2013-04-29 17:27 ` Julien Grall
2013-04-28 23:02 ` [RFC 20/29] xen/arm: Use the device tree to map the address range and IRQ to dom0 Julien Grall
2013-04-29 15:59 ` Ian Campbell
2013-04-29 17:30 ` Julien Grall
2013-04-28 23:02 ` [RFC 21/29] xen/arm: WORKAROUND 1:1 memory mapping for dom0 Julien Grall
2013-04-29 16:13 ` Ian Campbell
2013-04-29 17:43 ` Julien Grall
2013-04-30 9:12 ` Ian Campbell
2013-04-28 23:02 ` [RFC 22/29] xen/arm: Allow Xen to run on multiple platform without recompilation Julien Grall
2013-04-29 16:15 ` Ian Campbell
2013-04-29 17:44 ` Julien Grall
2013-05-01 11:51 ` Stefano Stabellini
2013-04-28 23:02 ` [RFC 23/29] xen/arm: Add versatile express platform Julien Grall
2013-04-29 16:27 ` Ian Campbell
2013-04-29 17:52 ` Julien Grall
2013-04-30 9:12 ` Ian Campbell
2013-04-28 23:02 ` [RFC 24/29] xen/arm: Don't use pl011 UART by default for early printk Julien Grall
2013-04-29 16:45 ` Ian Campbell
2013-04-29 18:12 ` Julien Grall
2013-04-30 9:18 ` Ian Campbell
[not found] ` <CAPnVf8zQ-xhOqab5wVWGenJPdcRgwcr9t50EzMT372HSuPupPQ@mail.gmail.com>
2013-04-30 11:21 ` Julien Grall
2013-04-30 12:44 ` Ian Campbell
2013-04-30 13:39 ` Julien Grall
2013-04-30 13:51 ` Ian Campbell
2013-04-30 13:57 ` Julien Grall
2013-04-30 14:09 ` Ian Campbell
2013-04-30 9:00 ` Ian Campbell
2013-04-30 11:24 ` Julien Grall
2013-04-28 23:02 ` [RFC 25/29] xen/arm: Add exynos 4210 UART support Julien Grall
2013-04-29 16:51 ` Ian Campbell
2013-04-29 18:12 ` Anthony PERARD
2013-04-29 18:21 ` Julien Grall
2013-04-30 9:22 ` Ian Campbell
2013-04-28 23:02 ` [RFC 26/29] xen/arm: Add Exynos 4210 UART support for early printk Julien Grall
2013-04-30 9:53 ` Ian Campbell
2013-05-01 17:17 ` Anthony PERARD
2013-05-02 7:58 ` Ian Campbell
2013-05-02 10:51 ` Anthony PERARD
2013-05-01 17:24 ` Anthony PERARD
2013-04-28 23:02 ` [RFC 27/29] xen/arm: Add platform specific code for the exynos5 Julien Grall
2013-04-30 10:00 ` Ian Campbell
2013-04-30 15:40 ` Julien Grall [this message]
2013-04-30 15:46 ` Ian Campbell
2013-04-30 16:11 ` Julien Grall
2013-04-28 23:02 ` [RFC 28/29] xen/arm: Support secondary cpus boot and switch to hypervisor " Julien Grall
2013-04-30 10:10 ` Ian Campbell
2013-04-30 11:52 ` Julien Grall
2013-04-28 23:02 ` [RFC 29/29] xen/arm64: Remove hardcoded value for gic in assembly code Julien Grall
2013-04-30 10:11 ` Ian Campbell
2013-04-29 10:17 ` [RFC 00/29] Support multiple ARM platforms in Xen Ian Campbell
2013-04-29 10:33 ` George Dunlap
2013-04-29 12:47 ` Julien Grall
2013-04-29 12:52 ` Ian Campbell
2013-04-29 12:45 ` Julien Grall
2013-04-29 16:13 ` Ian Campbell
2013-04-29 18:20 ` Julien Grall
2013-04-30 9:19 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=517FE5FA.2070801@linaro.org \
--to=julien.grall@linaro.org \
--cc=Ian.Campbell@citrix.com \
--cc=Stefano.Stabellini@eu.citrix.com \
--cc=anthony.perard@citrix.com \
--cc=patches@linaro.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.