qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: Peter Crosthwaite <crosthwaitepeter@gmail.com>, qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, riku.voipio@iki.fi, qemu-ppc@nongnu.org,
	Peter Crosthwaite <crosthwaite.peter@gmail.com>
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 19/19] ppc: Rename ELF_MACHINE to be PPC specific
Date: Tue, 18 Aug 2015 18:04:35 -0700	[thread overview]
Message-ID: <55D3D623.3090501@redhat.com> (raw)
In-Reply-To: <83971ae84feec2ff2df8ed57a7f819f5d70232fc.1439679104.git.crosthwaite.peter@gmail.com>

I'm wondering if the existing behavior is good:

what I have understood is we define ppc32 guests in ppc64 target to be
able to run 32bit guest with 64bit qemu, but I don't think it means an
oldworld mac is able to run a ppc64 kernel.

So I think we could use directly EM_PPC with e500, ppc440, virtex_ml507,
prep and oldworld, and EM_PPC64 with pseries/spapr. Newworld mac should
be able to run EM_PPC and EM_PPC64 kernel (G3/G4 <-> G5), according to
the machine type and not to the target.

Laurent

On 15/08/2015 16:28, Peter Crosthwaite wrote:
> From: Peter Crosthwaite <crosthwaitepeter@gmail.com>
> 
> Rename ELF_MACHINE to be PPC specific. This is used as-is by the
> various PPC bootloaders and is locally defined to ELF_MACHINE in linux
> user in PPC specific ifdeffery.
> 
> This removes another architecture specific definition from the global
> namespace (as desired by multi-arch).
> 
> Cc: Alexander Graf <agraf@suse.de>
> Cc: qemu-ppc@nongnu.org
> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
> ---
>  hw/ppc/e500.c          | 2 +-
>  hw/ppc/mac_newworld.c  | 4 ++--
>  hw/ppc/mac_oldworld.c  | 4 ++--
>  hw/ppc/ppc440_bamboo.c | 2 +-
>  hw/ppc/prep.c          | 2 +-
>  hw/ppc/spapr.c         | 4 ++--
>  hw/ppc/virtex_ml507.c  | 2 +-
>  linux-user/elfload.c   | 1 +
>  target-ppc/cpu.h       | 4 ++--
>  9 files changed, 13 insertions(+), 12 deletions(-)
> 
> diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
> index d300846..8b45bf6 100644
> --- a/hw/ppc/e500.c
> +++ b/hw/ppc/e500.c
> @@ -1017,7 +1017,7 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)
>      filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
>  
>      bios_size = load_elf(filename, NULL, NULL, &bios_entry, &loadaddr, NULL,
> -                         1, ELF_MACHINE, 0);
> +                         1, PPC_ELF_MACHINE, 0);
>      if (bios_size < 0) {
>          /*
>           * Hrm. No ELF image? Try a uImage, maybe someone is giving us an
> diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
> index 77d5c81..81d744c 100644
> --- a/hw/ppc/mac_newworld.c
> +++ b/hw/ppc/mac_newworld.c
> @@ -219,7 +219,7 @@ static void ppc_core99_init(MachineState *machine)
>      /* Load OpenBIOS (ELF) */
>      if (filename) {
>          bios_size = load_elf(filename, NULL, NULL, NULL,
> -                             NULL, NULL, 1, ELF_MACHINE, 0);
> +                             NULL, NULL, 1, PPC_ELF_MACHINE, 0);
>  
>          g_free(filename);
>      } else {
> @@ -242,7 +242,7 @@ static void ppc_core99_init(MachineState *machine)
>          kernel_base = KERNEL_LOAD_ADDR;
>  
>          kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL,
> -                               NULL, &lowaddr, NULL, 1, ELF_MACHINE, 0);
> +                               NULL, &lowaddr, NULL, 1, PPC_ELF_MACHINE, 0);
>          if (kernel_size < 0)
>              kernel_size = load_aout(kernel_filename, kernel_base,
>                                      ram_size - kernel_base, bswap_needed,
> diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
> index 06fdbaf..00cb080 100644
> --- a/hw/ppc/mac_oldworld.c
> +++ b/hw/ppc/mac_oldworld.c
> @@ -147,7 +147,7 @@ static void ppc_heathrow_init(MachineState *machine)
>      /* Load OpenBIOS (ELF) */
>      if (filename) {
>          bios_size = load_elf(filename, 0, NULL, NULL, NULL, NULL,
> -                             1, ELF_MACHINE, 0);
> +                             1, PPC_ELF_MACHINE, 0);
>          g_free(filename);
>      } else {
>          bios_size = -1;
> @@ -168,7 +168,7 @@ static void ppc_heathrow_init(MachineState *machine)
>  #endif
>          kernel_base = KERNEL_LOAD_ADDR;
>          kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL,
> -                               NULL, &lowaddr, NULL, 1, ELF_MACHINE, 0);
> +                               NULL, &lowaddr, NULL, 1, PPC_ELF_MACHINE, 0);
>          if (kernel_size < 0)
>              kernel_size = load_aout(kernel_filename, kernel_base,
>                                      ram_size - kernel_base, bswap_needed,
> diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c
> index 032fa80..c54f79d 100644
> --- a/hw/ppc/ppc440_bamboo.c
> +++ b/hw/ppc/ppc440_bamboo.c
> @@ -256,7 +256,7 @@ static void bamboo_init(MachineState *machine)
>                                NULL, NULL);
>          if (success < 0) {
>              success = load_elf(kernel_filename, NULL, NULL, &elf_entry,
> -                               &elf_lowaddr, NULL, 1, ELF_MACHINE, 0);
> +                               &elf_lowaddr, NULL, 1, PPC_ELF_MACHINE, 0);
>              entry = elf_entry;
>              loadaddr = elf_lowaddr;
>          }
> diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
> index 45b5f62..b421bff 100644
> --- a/hw/ppc/prep.c
> +++ b/hw/ppc/prep.c
> @@ -610,7 +610,7 @@ static void ppc_prep_init(MachineState *machine)
>          bios_name = BIOS_FILENAME;
>      }
>      qdev_prop_set_string(dev, "bios-name", bios_name);
> -    qdev_prop_set_uint32(dev, "elf-machine", ELF_MACHINE);
> +    qdev_prop_set_uint32(dev, "elf-machine", PPC_ELF_MACHINE);
>      pcihost = PCI_HOST_BRIDGE(dev);
>      object_property_add_child(qdev_get_machine(), "raven", OBJECT(dev), NULL);
>      qdev_init_nofail(dev);
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index bf0c64f..4500497 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1636,11 +1636,11 @@ static void ppc_spapr_init(MachineState *machine)
>          uint64_t lowaddr = 0;
>  
>          kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL,
> -                               NULL, &lowaddr, NULL, 1, ELF_MACHINE, 0);
> +                               NULL, &lowaddr, NULL, 1, PPC_ELF_MACHINE, 0);
>          if (kernel_size == ELF_LOAD_WRONG_ENDIAN) {
>              kernel_size = load_elf(kernel_filename,
>                                     translate_kernel_address, NULL,
> -                                   NULL, &lowaddr, NULL, 0, ELF_MACHINE, 0);
> +                                   NULL, &lowaddr, NULL, 0, PPC_ELF_MACHINE, 0);
>              kernel_le = kernel_size > 0;
>          }
>          if (kernel_size < 0) {
> diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c
> index de86f7c..d3cf437 100644
> --- a/hw/ppc/virtex_ml507.c
> +++ b/hw/ppc/virtex_ml507.c
> @@ -257,7 +257,7 @@ static void virtex_init(MachineState *machine)
>  
>          /* Boots a kernel elf binary.  */
>          kernel_size = load_elf(kernel_filename, NULL, NULL,
> -                               &entry, &low, &high, 1, ELF_MACHINE, 0);
> +                               &entry, &low, &high, 1, PPC_ELF_MACHINE, 0);
>          boot_info.bootstrap_pc = entry & 0x00ffffff;
>  
>          if (kernel_size < 0) {
> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> index 09e1e6a..4ade8e9 100644
> --- a/linux-user/elfload.c
> +++ b/linux-user/elfload.c
> @@ -678,6 +678,7 @@ static inline void init_thread(struct target_pt_regs *regs,
>  
>  #ifdef TARGET_PPC
>  
> +#define ELF_MACHINE    PPC_ELF_MACHINE
>  #define ELF_START_MMAP 0x80000000
>  
>  #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
> diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
> index 6f76674..2bb3934 100644
> --- a/target-ppc/cpu.h
> +++ b/target-ppc/cpu.h
> @@ -81,9 +81,9 @@
>  #include "fpu/softfloat.h"
>  
>  #if defined (TARGET_PPC64)
> -#define ELF_MACHINE     EM_PPC64
> +#define PPC_ELF_MACHINE     EM_PPC64
>  #else
> -#define ELF_MACHINE     EM_PPC
> +#define PPC_ELF_MACHINE     EM_PPC
>  #endif
>  
>  /*****************************************************************************/
> 

  reply	other threads:[~2015-08-19  1:04 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-15 23:28 [Qemu-devel] [PATCH 00/19] multi-arch+linux-user: Cleanup ELF_MACHINE Peter Crosthwaite
2015-08-15 23:28 ` [Qemu-devel] [PATCH 01/19] linux_user: elfload: Default ELF_MACHINE to ELF_ARCH Peter Crosthwaite
2015-08-15 23:28 ` [Qemu-devel] [PATCH 02/19] linux-user: elfload: Provide default for elf_check_arch Peter Crosthwaite
2015-08-15 23:28 ` [Qemu-devel] [PATCH 03/19] arm: Remove ELF_MACHINE from cpu.h Peter Crosthwaite
2015-08-15 23:28 ` [Qemu-devel] [PATCH 04/19] mb: " Peter Crosthwaite
2015-08-15 23:28 ` [Qemu-devel] [PATCH 05/19] m68k: " Peter Crosthwaite
2015-08-17  0:15   ` Greg Ungerer
2015-08-18 22:47   ` Laurent Vivier
2015-08-15 23:28 ` [Qemu-devel] [PATCH 06/19] cris: " Peter Crosthwaite
2015-08-15 23:28 ` [Qemu-devel] [PATCH 07/19] moxie: " Peter Crosthwaite
2015-08-17 18:39   ` Richard Henderson
2015-08-18  3:36     ` Peter Crosthwaite
2015-08-18  3:48       ` Richard Henderson
2015-08-23  6:49         ` Peter Crosthwaite
2015-08-23 15:43           ` Peter Maydell
2015-08-29 19:41         ` Peter Crosthwaite
2015-08-15 23:28 ` [Qemu-devel] [PATCH 08/19] unicore: " Peter Crosthwaite
2015-08-15 23:28 ` [Qemu-devel] [PATCH 10/19] or32: " Peter Crosthwaite
2015-08-15 23:28 ` [Qemu-devel] [PATCH 11/19] tricore: " Peter Crosthwaite
2015-08-18 18:01   ` Bastian Koppelmann
2015-08-15 23:28 ` [Qemu-devel] [PATCH 12/19] xtensa: " Peter Crosthwaite
2015-08-15 23:28 ` [Qemu-devel] [PATCH 13/19] sh4: " Peter Crosthwaite
2015-08-17 20:40   ` Aurelien Jarno
2015-08-15 23:28 ` [Qemu-devel] [PATCH 14/19] s390: " Peter Crosthwaite
2015-08-15 23:28 ` [Qemu-devel] [PATCH 15/19] sparc: " Peter Crosthwaite
2015-08-15 23:28 ` [Qemu-devel] [PATCH 16/19] mips: " Peter Crosthwaite
2015-08-17 20:40   ` Aurelien Jarno
2015-08-15 23:28 ` [Qemu-devel] [PATCH 17/19] alpha: " Peter Crosthwaite
2015-08-15 23:28 ` [Qemu-devel] [PATCH 18/19] i386: Rename ELF_MACHINE to be x86 specific Peter Crosthwaite
2015-08-17 19:13   ` Eduardo Habkost
2015-08-15 23:28 ` [Qemu-devel] [PATCH 19/19] ppc: Rename ELF_MACHINE to be PPC specific Peter Crosthwaite
2015-08-19  1:04   ` Laurent Vivier [this message]
2015-09-07  5:04     ` [Qemu-devel] [Qemu-ppc] " Peter Crosthwaite
2015-09-07  9:32       ` Alexander Graf
     [not found] ` <9f0ea9969cdc869442178780fa35d6ac700bcd79.1439679104.git.crosthwaite.peter@gmail.com>
2015-08-16 22:47   ` [Qemu-devel] [PATCH 09/19] lm32: Remove ELF_MACHINE from cpu.h Michael Walle
2015-08-17 18:44 ` [Qemu-devel] [PATCH 00/19] multi-arch+linux-user: Cleanup ELF_MACHINE Richard Henderson
2015-08-20  7:50 ` Riku Voipio
2015-08-22  7:03   ` Paolo Bonzini
2015-09-07  9:54 ` Paolo Bonzini
2015-09-07 17:22   ` Peter Crosthwaite

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=55D3D623.3090501@redhat.com \
    --to=lvivier@redhat.com \
    --cc=crosthwaite.peter@gmail.com \
    --cc=crosthwaitepeter@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /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 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).