All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH 01/15] target-tricore: Add target stubs and qom-cpu
Date: Mon, 7 Jul 2014 20:24:05 +0100	[thread overview]
Message-ID: <CAFEAcA_YnUF8f2JymPFCvrr2kJqNf5u=Do5Xo3M-h2cvn9zumg@mail.gmail.com> (raw)
In-Reply-To: <1404756822-3253-2-git-send-email-kbastian@mail.uni-paderborn.de>

On 7 July 2014 19:13, Bastian Koppelmann <kbastian@mail.uni-paderborn.de> wrote:
> Add TriCore target stubs, QOM cpu and basic machine.
>
> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
> ---
>  arch_init.c                         |   2 +
>  configure                           |  13 ++
>  cpu-exec.c                          |  11 +-
>  cpus.c                              |   6 +
>  default-configs/tricore-softmmu.mak |   3 +
>  include/elf.h                       |   2 +
>  include/sysemu/arch_init.h          |   1 +
>  target-tricore/Makefile.objs        |   2 +
>  target-tricore/cpu-qom.h            |  71 +++++++
>  target-tricore/cpu.c                | 121 ++++++++++++
>  target-tricore/cpu.h                | 380 ++++++++++++++++++++++++++++++++++++
>  target-tricore/helper.c             |  36 ++++
>  target-tricore/helper.h             |   0
>  target-tricore/machine.c            |  21 ++
>  target-tricore/op_helper.c          |  27 +++
>  target-tricore/translate.c          | 108 ++++++++++
>  target-tricore/translate_init.c     |  21 ++
>  target-tricore/tricore-defs.h       |  28 +++
>  user-exec.c                         |  17 ++
>  19 files changed, 869 insertions(+), 1 deletion(-)
>  create mode 100644 default-configs/tricore-softmmu.mak
>  create mode 100644 target-tricore/Makefile.objs
>  create mode 100644 target-tricore/cpu-qom.h
>  create mode 100644 target-tricore/cpu.c
>  create mode 100644 target-tricore/cpu.h
>  create mode 100644 target-tricore/helper.c
>  create mode 100644 target-tricore/helper.h
>  create mode 100644 target-tricore/machine.c
>  create mode 100644 target-tricore/op_helper.c
>  create mode 100644 target-tricore/translate.c
>  create mode 100644 target-tricore/translate_init.c
>  create mode 100644 target-tricore/tricore-defs.h

I think you probably want the configure and default-configs changes
to be at the end of the patch series (or at least part way through it),
not at the start.
The general approach is:
 * some patches which implement the basic absolute minimum
    functionality, usefully split up
 * then add the configure and default-configs changes that allow
    the user to select the target and include it in the default target
    list

> diff --git a/configure b/configure
> index 7dd43fd..a976862 100755
> --- a/configure
> +++ b/configure
> @@ -495,6 +495,8 @@ elif check_define __mips__ ; then
>    cpu="mips"
>  elif check_define __ia64__ ; then
>    cpu="ia64"
> +elif check_define __tricore__ ; then
> +  cpu="tricore"
>  elif check_define __s390__ ; then
>    if check_define __s390x__ ; then
>      cpu="s390x"

This is for supporting compilation of QEMU on a tricore
*host*. That is a bit pointless since you don't provide a
TCG target backend. In any case if you want to add support
for that I suggest restricting it to its own separate patchset.

> @@ -533,6 +535,9 @@ case "$cpu" in
>    mips*)
>      cpu="mips"
>    ;;
> +  tricore*)
> +    cpu="tricore"
> +  ;;

Also host CPU related. (I suggest looking at where the
configure script handles the "moxie" target type, since that's
an example of a CPU type we handle only as a guest CPU
and not as a host CPU, so it's a good indication of where you
need to add tricore cases.)

>    sparc|sun4[cdmuv])
>      cpu="sparc"
>    ;;
> @@ -4958,6 +4963,10 @@ case "$target_name" in
>      TARGET_BASE_ARCH=mips
>      echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
>    ;;
> +  tricore)
> +    TARGET_ARCH=tricore

You don't need this line, because the default value for
TARGET_ARCH is the target name; only those cases in this
case statement where the CPU target name might be different
need to set TARGET_ARCH specifically.

> +    target_phys_bits=32
> +  ;;
>    moxie)
>    ;;
>    or32)
> @@ -5155,6 +5164,10 @@ for i in $ARCH $TARGET_BASE_ARCH ; do
>      echo "CONFIG_MIPS_DIS=y"  >> $config_target_mak
>      echo "CONFIG_MIPS_DIS=y"  >> config-all-disas.mak
>    ;;
> +  tricore*)
> +    echo "CONFIG_TRICORE_DIS=y" >> $config_target_mak
> +    echo "CONFIG_TRICORE_DIS=y" >> config-all-disas.mak
> +  ;;

Diffstat says you haven't got a disassembler in this patch,
so what is this for? Don't add it until/unless you add the
disassembler code.

> --- /dev/null
> +++ b/target-tricore/machine.c
> @@ -0,0 +1,21 @@
> +/*
> + *  Copyright (c) 2012-2014 Bastian Koppelmann C-Lab/University Paderborn
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2 of the License, or (at your option) any later version.
> + *
> + * This library 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
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include "hw/hw.h"
> +#include "hw/boards.h"
> +
> +#include "cpu.h"

This file has no content; don't add it until it's got some useful code in it...

> diff --git a/user-exec.c b/user-exec.c
> index 1ff8673..beba4d5 100644
> --- a/user-exec.c
> +++ b/user-exec.c
> @@ -614,6 +614,23 @@ int cpu_signal_handler(int host_signum, void *pinfo,
>                               is_write, &uc->uc_sigmask, puc);
>  }
>
> +#elif defined(__tricore__)
> +
> +int cpu_signal_handler(int host_signum, void *pinfo,
> +                       void *puc)
> +{
> +    printf("cpu_signal_handler\n");
> +  /*  siginfo_t *info = pinfo;
> +    struct ucontext *uc = puc;
> +    greg_t pc = uc->uc_mcontext.pc;
> +    int is_write;
> +    is_write = 0;
> +    return handle_cpu_signal(pc, (unsigned long)info->si_addr,
> +                             is_write, &uc->uc_sigmask, puc);*/
> +    return 0;
> +}
> +
> +

This is also host-CPU support; don't put it in this patchset.
(Also, don't include commented out code like that...)

thanks
-- PMM

  parent reply	other threads:[~2014-07-07 19:24 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-07 18:13 [Qemu-devel] [PATCH 00/15] TriCore architecture guest implementation Bastian Koppelmann
2014-07-07 18:13 ` [Qemu-devel] [PATCH 01/15] target-tricore: Add target stubs and qom-cpu Bastian Koppelmann
2014-07-07 19:09   ` Richard Henderson
2014-07-07 19:14   ` Richard Henderson
2014-07-07 19:24   ` Peter Maydell [this message]
2014-07-11 11:05     ` Bastian Koppelmann
2014-07-11 11:10       ` Peter Maydell
2014-07-07 18:13 ` [Qemu-devel] [PATCH 02/15] target-tricore: Add board for systemmode Bastian Koppelmann
2014-07-07 18:13 ` [Qemu-devel] [PATCH 03/15] target-tricore: Add softmmu support Bastian Koppelmann
2014-07-07 18:13 ` [Qemu-devel] [PATCH 04/15] target-tricore: Add initialization for translation Bastian Koppelmann
2014-07-07 18:13 ` [Qemu-devel] [PATCH 05/15] target-tricore: Add masks and opcodes for decoding Bastian Koppelmann
2014-07-07 19:37   ` Richard Henderson
2014-07-07 18:13 ` [Qemu-devel] [PATCH 06/15] target-tricore: Add instructions of SRC opcode format Bastian Koppelmann
2014-07-07 20:06   ` Richard Henderson
2014-07-07 20:56   ` Max Filippov
2014-07-07 18:13 ` [Qemu-devel] [PATCH 07/15] target-tricore: Add instructions of SRR " Bastian Koppelmann
2014-07-07 20:17   ` Richard Henderson
2014-07-07 18:13 ` [Qemu-devel] [PATCH 08/15] target-tricore: Add instructions of SSR " Bastian Koppelmann
2014-07-07 20:22   ` Richard Henderson
2014-07-07 18:13 ` [Qemu-devel] [PATCH 09/15] target-tricore: Add instructions of SRRS and SLRO " Bastian Koppelmann
2014-07-07 20:30   ` Richard Henderson
2014-07-07 18:13 ` [Qemu-devel] [PATCH 10/15] target-tricore: Add instructions of SB " Bastian Koppelmann
2014-07-08  4:41   ` Richard Henderson
2014-07-07 18:13 ` [Qemu-devel] [PATCH 11/15] target-tricore: Add instructions of SBC and SBRN " Bastian Koppelmann
2014-07-08  4:47   ` Richard Henderson
2014-07-07 18:13 ` [Qemu-devel] [PATCH 12/15] target-tricore: Add instructions of SBR " Bastian Koppelmann
2014-07-08  5:26   ` Richard Henderson
2014-07-07 18:13 ` [Qemu-devel] [PATCH 13/15] target-tricore: Add instructions of SC " Bastian Koppelmann
2014-07-08  5:32   ` Richard Henderson
2014-07-07 18:13 ` [Qemu-devel] [PATCH 14/15] target-tricore: Add instructions of SLR, SSRO and SRO " Bastian Koppelmann
2014-07-08  5:36   ` Richard Henderson
2014-07-07 18:13 ` [Qemu-devel] [PATCH 15/15] target-tricore: Add instructions of SR " Bastian Koppelmann
2014-07-08  5:58   ` Richard Henderson

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='CAFEAcA_YnUF8f2JymPFCvrr2kJqNf5u=Do5Xo3M-h2cvn9zumg@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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.