All of lore.kernel.org
 help / color / mirror / Atom feed
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 24/29] xen/arm: Don't use pl011 UART by default for early printk
Date: Mon, 29 Apr 2013 19:12:10 +0100	[thread overview]
Message-ID: <517EB7FA.9030404@linaro.org> (raw)
In-Reply-To: <1367253944.3142.387.camel@zakaz.uk.xensource.com>

On 04/29/2013 05:45 PM, Ian Campbell wrote:

> On Mon, 2013-04-29 at 00:02 +0100, Julien Grall wrote:
>> Add CONFIG_EARLY_PRINTK options in configs/arm{32,64}.mk to let the user
>> to choose if he wants to have early output, ie before the console is initialized.
> 
> These shouldn't go in config/arm*.mk but should be handed in
> xen/arch/arm/


I don't understand why, it's a config option and the user can modify
arm32.mk

>>
>> This code is specific for each UART. When CONFIG_EARLY_PRINTK is enabled,
>> Xen will only be able to run on a board with this UART.
>>
>> If a developper wants to add support for a new UART, he must implement the
>> following function/variable:
>>    - early_uart_paddr: variable which contains the physical base address
>>    for the UART
>>    - early_uart_init: initialize the UART
>>    - early_uart_ready: check and wait until the UART can transmit a new
>>    character
>>    - early_uart_transmit: transmit a character
>>
>> For more details about the parameters of each function,
>> see arm{32,64}/debug-pl011.S comments.
> 
> It's a damned shame the asm isn't compatible, oh well...
> 
>> diff --git a/config/arm32.mk b/config/arm32.mk
>> index f64f0c1..83a7767 100644
>> --- a/config/arm32.mk
>> +++ b/config/arm32.mk
>> @@ -7,6 +7,17 @@ CONFIG_ARM_$(XEN_OS) := y
>>  # Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb:
>>  CFLAGS += -marm
>>
>> +# Xen early debugging function
>> +# This is helpful if you are debbuging code that executes before the console
>> +# is initialized.
>> +# Note that selecting this option will limit Xen to a single UART
>> +# definition. Attempting to boot Xen image on a different platform *will
>> +# not work*, so this option should not be enable for Xens that are
>> +# intended to be portable.
>> +# Possible value:
>> +#   - none: no early printk
> 
> Blank/unset would represent none? Or you mean literal "none"?

I choose to use literal "none", but finally I think it's better to have
blank/unset.

>> +#   - pl011: printk with PL011 UART
>> +CONFIG_EARLY_PRINTK := none
> 
> I guess you mean literal none...
> 
> Can this be overriden on command line or in .config? You may need to
> use ?= so it can be.

Yes. Make overrides all "local" variables with the ones on the command line.

>>  HAS_PL011 := y
>>
>>  # Use only if calling $(LD) directly.
>> diff --git a/config/arm64.mk b/config/arm64.mk
>> index b2457eb..6187df8 100644
>> --- a/config/arm64.mk
>> +++ b/config/arm64.mk
>> @@ -4,6 +4,17 @@ CONFIG_ARM_$(XEN_OS) := y
>>
>>  CFLAGS += #-marm -march= -mcpu= etc
>>
>> +# Xen early debugging function
>> +# This is helpful if you are debbuging code that executes before the console
>> +# is initialized.
>> +# Note that selecting this option will limit Xen to a single UART
>> +# definition. Attempting to boot Xen image on a different platform *will
>> +# not work*, so this option should not be enable for Xens that are
>> +# intended to be portable.
>> +# Possible value:
>> +#   - none: no early printk
>> +#   - pl011: printk with PL011 UART
>> +CONFIG_EARLY_PRINTK := none
> 
> Shall we create config/arm.mk, included from arm32 and arm64 and reduce
> the duplication?


I think so.

>> diff --git a/xen/arch/arm/arm32/Makefile b/xen/arch/arm/arm32/Makefile
>> index 1ad3364..6af8ca3 100644
>> --- a/xen/arch/arm/arm32/Makefile
>> +++ b/xen/arch/arm/arm32/Makefile
>> @@ -5,4 +5,7 @@ obj-y += mode_switch.o
>>  obj-y += proc-ca15.o
>>
>>  obj-y += traps.o
>> -obj-y += domain.o
>> \ No newline at end of file
>> +obj-y += domain.o
>> +
>> +obj-$(EARLY_PRINTK) += debug.o
>> +obj-$(CONFIG_EARLY_PL011) += debug-pl011.o
> 
> This could become
> 	obj-$(EARLY_PRINTK) += debug-$(CONFIG_EARLY_PRINTK).o 
> and save adding a new one for each name? And if you create a stub
> debug-none.S you could just make it obj-y ? Should we gate this on
> debug=y?


What does debug=y do?

I think we don't need debug-none.S if CONFIG_EARLY_PRINTK is unset when
early printk is disabled. We just need to check in Rules.mk is
CONFIG_EARLY_PRINTK is set or not and defined EARLY_PRINTK.

>> @@ -106,8 +106,10 @@ past_zImage:
>>          bne   1b
>>
>>  boot_cpu:
>> -#ifdef EARLY_UART_ADDRESS
>> -        ldr   r11, =EARLY_UART_ADDRESS  /* r11 := UART base address */
>> +#ifdef EARLY_PRINTK
>> +        ldr   r0, =early_uart_paddr     /* VA of early_uart_paddr */
>> +        add   r0, r0, r10               /* PA of early_uart_paddr */
>> +        ldr   r11, [r0]                 /* r11 := UART base address */
> 
> If head.S were to #include debug-pl011.inc would that simplify some of
> this stuff?


It's also used in debug.s, which is a wrapper for the C early printk.

If we use macros instead of functions the code will be simplified. All
link register used will be removed.

I will rework this patch.

-- 
Julien

  reply	other threads:[~2013-04-29 18:12 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 [this message]
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
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=517EB7FA.9030404@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.