qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Antony Pavlov <antonynpavlov@gmail.com>
Cc: Alex Dumitrache <broscutamaker@gmail.com>,
	Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
	Giovanni Condello <condellog@gmail.com>,
	g3gg0 <georg.hofstetter@lx-networking.de>,
	Peter Maydell <peter.maydell@linaro.org>,
	qemu-devel@nongnu.org, Paul Brook <paul@codesourcery.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [RFC 2/5] hw/arm: add very initial support for Canon DIGIC SoC
Date: Fri, 30 Aug 2013 18:27:27 +0200	[thread overview]
Message-ID: <5220C7EF.7080509@suse.de> (raw)
In-Reply-To: <20130829233623.b05e3fe616e160dff7fa5a50@gmail.com>

Am 29.08.2013 21:36, schrieb Antony Pavlov:
> On Thu, 29 Aug 2013 14:15:40 +0200
> Andreas Färber <afaerber@suse.de> wrote:
> 
>> Am 29.08.2013 11:33, schrieb Antony Pavlov:
>>> DIGIC is Canon Inc.'s name for a family of SoC
>>> for digital cameras and camcorders.
>>>
>>> There is no publicly available specification for
>>> DIGIC chips. All information about DIGIC chip
>>> internals is based on reverse engineering efforts
>>> made by CHDK (http://chdk.wikia.com) and
>>> Magic Lantern (http://www.magiclantern.fm) projects
>>> contributors.
>>>
>>> Also this patch adds initial support for Canon
>>> PowerShot A1100 IS compact camera.
>>>
>>> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
>>> ---
>>>  default-configs/arm-softmmu.mak |  1 +
>>>  hw/arm/Makefile.objs            |  2 +-
>>>  hw/arm/digic.c                  | 85 +++++++++++++++++++++++++++++++++++++++++
>>>  3 files changed, 87 insertions(+), 1 deletion(-)
>>>  create mode 100644 hw/arm/digic.c
>>>
>>> diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak
>>> index ac0815d..0d1d783 100644
>>> --- a/default-configs/arm-softmmu.mak
>>> +++ b/default-configs/arm-softmmu.mak
>>> @@ -63,6 +63,7 @@ CONFIG_FRAMEBUFFER=y
>>>  CONFIG_XILINX_SPIPS=y
>>>  
>>>  CONFIG_A9SCU=y
>>> +CONFIG_DIGIC=y
>>>  CONFIG_MARVELL_88W8618=y
>>>  CONFIG_OMAP=y
>>>  CONFIG_TSC210X=y
>>> diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs
>>> index 3671b42..53d5ffd 100644
>>> --- a/hw/arm/Makefile.objs
>>> +++ b/hw/arm/Makefile.objs
>>> @@ -1,4 +1,4 @@
>>> -obj-y += boot.o collie.o exynos4_boards.o gumstix.o highbank.o
>>> +obj-y += boot.o collie.o digic.o exynos4_boards.o gumstix.o highbank.o
>>>  obj-y += integratorcp.o kzm.o mainstone.o musicpal.o nseries.o
>>>  obj-y += omap_sx1.o palm.o realview.o spitz.o stellaris.o
>>>  obj-y += tosa.o versatilepb.o vexpress.o xilinx_zynq.o z2.o
>>> diff --git a/hw/arm/digic.c b/hw/arm/digic.c
>>> new file mode 100644
>>> index 0000000..3259b38
>>> --- /dev/null
>>> +++ b/hw/arm/digic.c
>>> @@ -0,0 +1,85 @@
>>> +/*
>>> + * QEMU model of the Canon SoC.
>>> + *
>>> + * Copyright (C) 2013 Antony Pavlov <antonynpavlov@gmail.com>
>>> + *
>>> + * This model is based on reverse engineering efforts
>>> + * made by CHDK (http://chdk.wikia.com) and
>>> + * Magic Lantern (http://www.magiclantern.fm) projects
>>> + * contributors.
>>> + *
>>> + * 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 "exec/address-spaces.h"
>>> +#include "hw/sysbus.h"
>>> +#include "hw/boards.h"
>>> +
>>> +typedef struct {
>>
>> structs should not be anonymous, just reuse the typedef name.
>>
>>> +    ARMCPU *cpu;
>>> +    MemoryRegion ram;
>>> +} DigicState;
>>> +
>>> +typedef struct {
>>> +    hwaddr ram_size;
>>> +} DigicBoard;
>>> +
>>> +static DigicState *digic4_create(void)
>>> +{
>>> +    DigicState *s = g_new(DigicState, 1);
>>> +
>>> +    s->cpu = cpu_arm_init("arm946e-s");
>>> +    if (!s->cpu) {
>>> +        fprintf(stderr, "Unable to find CPU definition\n");
>>> +        exit(1);
>>> +    }
>>> +
>>> +    return s;
>>> +}
>>
>> Please separate the SoC from the boards by placing them in different
>> files (and commits).
> 
> I'm agree.
> 
>> DigicState should be a QOM type derived from TYPE_DEVICE. Since you're
>> hardcoding the CPU type, please use object_initialize() to create it
>> in-place - note we're about to extend that function but rebase will be
>> trivial.
> 
> I have just examinied platforms with hardcoded cpu: pxa2xx, exynos4210.
> They don't use object_initialize().
> Is there any significant difference between hardcoded cpu type
> and variable cpu type with selected default cpu type?
> 
> I try to find a example of object_initialize() usage for cpu initialisation
> in repo but I have no success. Can you point me one or explain your design
> pattern?

My Tegra2 SoC emulation uses the new pattern:
http://repo.or.cz/w/qemu/afaerber.git/shortlog/refs/heads/tegra

But you can just look at existing non-CPU users of object_initialize().
For a non-x86 CPU you don't need qdev_set_parent_bus(), but you do need
object_property_set_bool(obj, true, "realized", &err) in your realize
function and error_propagate(errp, err) to your caller.

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  parent reply	other threads:[~2013-08-30 16:27 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-29  9:33 [Qemu-devel] [RFC 0/5] add initial support for Canon DIGIC SoC Antony Pavlov
2013-08-29  9:33 ` [Qemu-devel] [RFC 1/5] target-arm: add ARM946E-S CPU Antony Pavlov
2013-08-29 10:44   ` Peter Maydell
2013-08-29 10:52     ` Antony Pavlov
2013-08-29 18:17     ` Antony Pavlov
2013-08-30  5:09       ` Peter Crosthwaite
2013-08-30  7:29         ` Peter Maydell
2013-08-30  8:06           ` Antony Pavlov
2013-08-29  9:33 ` [Qemu-devel] [RFC 2/5] hw/arm: add very initial support for Canon DIGIC SoC Antony Pavlov
2013-08-29 12:15   ` Andreas Färber
2013-08-29 19:36     ` Antony Pavlov
2013-08-29 20:16       ` Peter Maydell
2013-08-30  5:07         ` Peter Crosthwaite
2013-08-30  8:10           ` Antony Pavlov
2013-08-30 17:53           ` Andreas Färber
2013-08-30 16:27       ` Andreas Färber [this message]
2013-08-29 14:29   ` Condello
2013-08-29 16:22     ` Antony Pavlov
2013-08-29  9:33 ` [Qemu-devel] [RFC 3/5] hw/arm/digic: add timer support Antony Pavlov
2013-08-29  9:33 ` [Qemu-devel] [RFC 4/5] hw/arm/digic: add UART support Antony Pavlov
2013-08-30  5:16   ` Peter Crosthwaite
2013-08-30  8:31     ` Antony Pavlov

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=5220C7EF.7080509@suse.de \
    --to=afaerber@suse.de \
    --cc=antonynpavlov@gmail.com \
    --cc=broscutamaker@gmail.com \
    --cc=condellog@gmail.com \
    --cc=georg.hofstetter@lx-networking.de \
    --cc=paul@codesourcery.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.crosthwaite@xilinx.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).