qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: "Andreas Färber" <afaerber@suse.de>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Anthony Liguori <aliguori@us.ibm.com>,
	qemu-devel@nongnu.org, Paul Brook <paul@codesourcery.com>
Subject: Re: [Qemu-devel] [PATCH RFC 6/7] target-arm: Introduce QOM CPU and use for it CPUID lookup
Date: Sun, 29 Jan 2012 20:19:34 -0600	[thread overview]
Message-ID: <4F25FE36.90306@codemonkey.ws> (raw)
In-Reply-To: <1327843531-32403-7-git-send-email-afaerber@suse.de>

On 01/29/2012 07:25 AM, Andreas Färber wrote:
> Create a CPU subclass, and register classes matching all CPU models.
> Don't name the file target-arm/cpu.c so that the user emulators can
> still easily pick up the base class in hw/cpu.c via VPATH.
>
> Make arm_cpu_list() enumerate CPU subclasses.
>
> Replace cpu_arm_find_by_name()'s string ->  CPUID lookup by storing the
> CPUID in the class.
> NB: CPUIDs were first introduced by Paul Brook in r1765 (2006).
>
> Signed-off-by: Andreas Färber<afaerber@suse.de>
> Cc: Anthony Liguori<aliguori@us.ibm.com>
> Cc: Paul Brook<paul@codesourcery.com>
> Cc: Peter Maydell<peter.maydell@linaro.org>
> ---
>   Makefile.target       |    1 +
>   target-arm/cpu-core.c |  268 +++++++++++++++++++++++++++++++++++++++++++++++++
>   target-arm/cpu-core.h |   33 ++++++
>   target-arm/helper.c   |   80 ++++-----------
>   4 files changed, 324 insertions(+), 58 deletions(-)
>   create mode 100644 target-arm/cpu-core.c
>   create mode 100644 target-arm/cpu-core.h
>
> diff --git a/Makefile.target b/Makefile.target
> index 5d3470e..96043c4 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -80,6 +80,7 @@ endif
>   libobj-$(TARGET_SPARC64) += vis_helper.o
>   libobj-$(CONFIG_NEED_MMU) += mmu.o
>   libobj-$(TARGET_ARM) += neon_helper.o iwmmxt_helper.o
> +libobj-$(TARGET_ARM) += cpu-core.o
>   ifeq ($(TARGET_BASE_ARCH), sparc)
>   libobj-y += fop_helper.o cc_helper.o win_helper.o mmu_helper.o ldst_helper.o
>   libobj-y += cpu_init.o
> diff --git a/target-arm/cpu-core.c b/target-arm/cpu-core.c
> new file mode 100644
> index 0000000..9761d8e
> --- /dev/null
> +++ b/target-arm/cpu-core.c
> @@ -0,0 +1,268 @@
> +/*
> + * QEMU ARM CPU core
> + *
> + * Copyright (c) 2012 SUSE LINUX Products GmbH
> + *
> + * Licensed under the terms of the GNU GPL version 2
> + * or (at your option) any later version.
> + */
> +
> +#include "cpu-core.h"
> +#include "qemu-common.h"
> +
> +/* CPU models */
> +
> +static void arm926_class_init(ObjectClass *klass, void *data)
> +{
> +    ARMCPUClass *k = ARM_CPU_CLASS(klass);
> +
> +    k->id = 0x41069265;
> +}
> +
> +static void arm946_class_init(ObjectClass *klass, void *data)
> +{
> +    ARMCPUClass *k = ARM_CPU_CLASS(klass);
> +
> +    k->id = 0x41059461;
> +}

In a situation like this, you probably want to make use of the class_data field 
in TypeInfo.  You can use that to create a bunch of types based on a table.

Take a look at hw/eepro100.c for an example of this (although read the comment 
for the reference to class_data and why we can't use it until after the next 
series).

Regards,

Anthony Liguori

  reply	other threads:[~2012-01-30  2:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-29 13:25 [Qemu-devel] [PATCH RFC 0/7] Introduce QOM CPU and use for target-arm Andreas Färber
2012-01-29 13:25 ` [Qemu-devel] [PATCH 1/7][RESEND] qom: Introduce object_class_is_abstract() Andreas Färber
2012-01-29 13:25 ` [Qemu-devel] [PATCH RFC 2/7] qom: Register QOM infrastructure early Andreas Färber
2012-01-29 13:25 ` [Qemu-devel] [PATCH RFC 3/7] qom: Add QOM support to user emulators Andreas Färber
2012-01-29 13:25 ` [Qemu-devel] [PATCH RFC 4/7] qom: Introduce CPU class Andreas Färber
2012-01-30  2:14   ` Anthony Liguori
2012-01-30 11:58     ` Andreas Färber
2012-01-31 10:36     ` Andreas Färber
2012-01-29 13:25 ` [Qemu-devel] [PATCH RFC 5/7] cpu: Introduce cpu_class_foreach() Andreas Färber
2012-01-30  2:16   ` Anthony Liguori
2012-01-30 12:02     ` Andreas Färber
2012-01-29 13:25 ` [Qemu-devel] [PATCH RFC 6/7] target-arm: Introduce QOM CPU and use for it CPUID lookup Andreas Färber
2012-01-30  2:19   ` Anthony Liguori [this message]
2012-01-30 12:11     ` Andreas Färber
2012-01-29 13:25 ` [Qemu-devel] [PATCH RFC 7/7] target-arm: Embed CPUARMState in QOM ARMCPU Andreas Färber
2012-01-30  2:22   ` Anthony Liguori
2012-01-30 12:52     ` Andreas Färber
2012-01-30 16:01     ` Andreas Färber
2012-01-29 23:50 ` [Qemu-devel] [PATCH RFC 8/7] target-arm: Use IoC for CPU init Andreas Färber
2012-01-30  2:23   ` Anthony Liguori
2012-01-29 23:50 ` [Qemu-devel] [PATCH RFC 9/7] target-arm: Move CPU feature flags to class Andreas Färber
2012-01-30 19:27   ` Andreas Färber

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=4F25FE36.90306@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=paul@codesourcery.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.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 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).