[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 2/4] xen/ppc: Set up a basic C environment


  • To: Shawn Anastasio <sanastasio@xxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 19 Jul 2023 15:44:06 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CDH2XijaVJK3u8I3j4/hzsc3lwCobWMlEVsdpwYOlVw=; b=eN9laLIUJk+oaq+UPs0WjFStNp1Vu3wZexCjvT7Upj/IH1Qmy+HO8/4jknRdiLrtmtapgOA4l10rdpawW5BQGFmJx6gMXCzrgb4ny2QEErY5VBG+C87o5GCHYtIyELglR6I3nAlvh/VxkO4RlxfbpievBf2F3g6iIrpiRMjdhbcWN3tK5h0ZbDdCS2QJpwLquNVZXOpGJSpWy9p2AbSVBIFnwUUU7VR/dU4gExYAH1bZR2PP1JTBPvUXRdxy80UCzVcDbHErH+YK8pF62WH5CkfLsRzzPivJbIBe2rQpcvA9Med1O6h+HB+cNFvrLfian5hWUy8dxlKjyE2sCpuu0g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UV46Rh/Efi4X0ylb0LX/3a+jfPjneS4mxhUdarPx0Wd0Cr5KLvnV3FIvGEs4K7SShtH+zxpCmAIF4NqApg9EBSuuvDnrmsSxhHLgUFAepj4y8GKio2hQYx1RPXRn4pAQyTYoxD7PJhsqjgcu5ikiGNUoEkVwLkm7u5YDXO5SVLK5hRfwp3krTxevbHVdqOygWY/OboiSOuOH3776KYMFAA+06+vdZBGnj8FpaIQUPZr6KpSud+2kwxiuAAZZbvZl2B2F17ritdtixDz6hnM1G1cTJiF5DRk+sdxriwmlqLRuAy8Z/ohKA8bI0OO0R0zX4G21uyy0YyCoQLQgDbqNSQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Timothy Pearson <tpearson@xxxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 19 Jul 2023 13:44:25 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 18.07.2023 22:20, Shawn Anastasio wrote:
> Update ppc64/head.S to set up an initial boot stack, zero the .bss
> section, and jump to C.
> 
> Also refactor the endian fixup trampoline into its own macro, since it
> will need to be used in multiple places, including every time we make a
> call into firmware (see next commit).

Please avoid statements making relative connections between patches or
commits. You can't know how many commits will end up between both
patches; there's no guarantee any series will be committed all in one
go. (In rare cases, where needed for one reason or another, committers
may be asked to keep things together.)

That said, such statements are much less of a problem if given in the
remarks section, which isn't going to be committed.

> --- a/xen/arch/ppc/include/asm/config.h
> +++ b/xen/arch/ppc/include/asm/config.h
> @@ -43,7 +43,7 @@
>  
>  #define SMP_CACHE_BYTES (1 << 6)
>  
> -#define STACK_ORDER 2
> +#define STACK_ORDER 0

>From the v3 discussion I thought it would follow that the description
gain mention of this change (and the why behind it). Strictly speaking
this could be a separate change (at which point stating the "why"
would hopefully be an obvious part), but I wouldn't want to go as far
as demanding this to be split off.

> --- a/xen/arch/ppc/ppc64/head.S
> +++ b/xen/arch/ppc/ppc64/head.S
> @@ -1,30 +1,28 @@
>  /* SPDX-License-Identifier: GPL-2.0-or-later */
>  
> +#include <asm/asm-defns.h>
> +
>      .section .text.header, "ax", %progbits
>  
>  ENTRY(start)
>      /*
> -     * Depending on how we were booted, the CPU could be running in either
> -     * Little Endian or Big Endian mode. The following trampoline from Linux
> -     * cleverly uses an instruction that encodes to a NOP if the CPU's
> -     * endianness matches the assumption of the assembler (LE, in our case)
> -     * or a branch to code that performs the endian switch in the other case.
> +     * NOTE: argument registers (r3-r9) must be preserved until the C 
> entrypoint
>       */
> -    tdi 0, 0, 0x48    /* Reverse endian of b . + 8          */
> -    b . + 44          /* Skip trampoline if endian is good  */
> -    .long 0xa600607d  /* mfmsr r11                          */
> -    .long 0x01006b69  /* xori r11,r11,1                     */
> -    .long 0x00004039  /* li r10,0                           */
> -    .long 0x6401417d  /* mtmsrd r10,1                       */
> -    .long 0x05009f42  /* bcl 20,31,$+4                      */
> -    .long 0xa602487d  /* mflr r10                           */
> -    .long 0x14004a39  /* addi r10,r10,20                    */
> -    .long 0xa6035a7d  /* mtsrr0 r10                         */
> -    .long 0xa6037b7d  /* mtsrr1 r11                         */
> -    .long 0x2400004c  /* rfid                               */
> -
> -    /* Now that the endianness is confirmed, continue */
> -1:  b 1b
> +    FIXUP_ENDIAN
> +
> +    /* set up the TOC pointer */
> +    LOAD_IMM32(%r2, .TOC.)
> +
> +    /* set up the initial stack */
> +    LOAD_IMM32(%r1, cpu0_boot_stack)

Similarly I had hoped that if not a code comment, a sentence in the
description would appear regarding the (temporary) non-PIC-ness.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.