From: Alexander Graf <agraf@suse.de>
To: Scott Wood <scottwood@freescale.com>
Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com,
eric.auger@linaro.org, qemu-devel@nongnu.org,
qemu-ppc@nongnu.org, sean.stalley@intel.com, pbonzini@redhat.com,
afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH 6/6] e500: Add support for eTSEC in device tree
Date: Wed, 02 Jul 2014 19:24:53 +0200 [thread overview]
Message-ID: <53B44065.7040508@suse.de> (raw)
In-Reply-To: <1404255396.21434.11.camel@snotra.buserror.net>
On 02.07.14 00:56, Scott Wood wrote:
> On Tue, 2014-07-01 at 23:49 +0200, Alexander Graf wrote:
>> This patch adds support to expose eTSEC devices in the dynamically created
>> guest facing device tree. This allows us to expose eTSEC devices into guests
>> without changes in the machine file.
>>
>> Because we can now tell the guest about eTSEC devices this patch allows the
>> user to specify eTSEC devices via -device at all.
>>
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>> ---
>> hw/ppc/e500.c | 34 ++++++++++++++++++++++++++++++++++
>> 1 file changed, 34 insertions(+)
>>
>> diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
>> index bf704b0..bebff6f 100644
>> --- a/hw/ppc/e500.c
>> +++ b/hw/ppc/e500.c
>> @@ -37,6 +37,7 @@
>> #include "qemu/host-utils.h"
>> #include "hw/pci-host/ppce500.h"
>> #include "qemu/error-report.h"
>> +#include "hw/net/fsl_etsec/etsec.h"
>>
>> #define EPAPR_MAGIC (0x45504150)
>> #define BINARY_DEVICE_TREE_FILE "mpc8544ds.dtb"
>> @@ -139,6 +140,34 @@ typedef struct PlatformDevtreeData {
>> int id;
>> } PlatformDevtreeData;
>>
>> +static int create_devtree_etsec(eTSEC *etsec, PlatformDevtreeData *data)
>> +{
>> + SysBusDevice *sbdev = &etsec->busdev;
>> + gchar *node = g_strdup_printf("/platform/ethernet@%d", data->id);
> The unit address is supposed to match reg. It's not an arbitrary
> disambiguator.
So what do we do in case we don't have any reg, but only an IRQ line? Oh
well - I guess we can cross that line when we get to it.
>
>> + gchar *group = g_strdup_printf("%s/queue-group", node);
>> + void *fdt = data->fdt;
>> +
>> + qemu_fdt_add_subnode(fdt, node);
>> + qemu_fdt_setprop_string(fdt, node, "device_type", "network");
>> + qemu_fdt_setprop_string(fdt, node, "compatible", "fsl,etsec2");
>> + qemu_fdt_setprop_string(fdt, node, "model", "eTSEC");
>> + qemu_fdt_setprop(fdt, node, "local-mac-address", etsec->conf.macaddr.a, 6);
>> + qemu_fdt_setprop_cells(fdt, node, "fixed-link", 0, 1, 1000, 0, 0);
>> +
>> + qemu_fdt_add_subnode(fdt, group);
>> + qemu_fdt_setprop_cells(fdt, group, "reg", sbdev->user_mmios[0], 0x1000);
>> + qemu_fdt_setprop_phandle(fdt, group, "interrupt-parent", data->mpic);
> Why not do interrupt-parent in the parent node, or top of tree?
Parent sounds appealing :). In fact, it's already there - this copy is
simply useless.
>
>> + qemu_fdt_setprop_cells(fdt, group, "interrupts",
>> + data->irq_start + sbdev->user_irqs[0], 0x0,
>> + data->irq_start + sbdev->user_irqs[1], 0x0,
>> + data->irq_start + sbdev->user_irqs[2], 0x0);
> Are we still using two-cell interrupt specifiers? If so, we should
> switch before the assumption gets encoded into random device files.
Random device files should never get any device tree bits encoded.
Device tree generation is responsibility of the machine file.
So we can easily convert the whole thing to the 4-cell when we start to
support different interrupt types :)
> Also, why are these interrupts edge triggered?
Good catch - they're 0x2 on real hardware.
Alex
next prev parent reply other threads:[~2014-07-02 17:25 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-01 21:49 [Qemu-devel] [PATCH 0/6] Dynamic sysbus device allocation support Alexander Graf
2014-07-01 21:49 ` [Qemu-devel] [PATCH 1/6] qom: macroify integer property helpers Alexander Graf
2014-07-02 3:29 ` Peter Crosthwaite
2014-07-02 7:39 ` Alexander Graf
2014-07-01 21:49 ` [Qemu-devel] [PATCH 2/6] qom: Allow to make integer qom properties writeable Alexander Graf
2014-07-02 3:48 ` Peter Crosthwaite
2014-07-02 7:46 ` Alexander Graf
2014-07-01 21:49 ` [Qemu-devel] [PATCH 3/6] sysbus: Add user map hints Alexander Graf
2014-07-02 4:12 ` Peter Crosthwaite
2014-07-02 8:24 ` Alexander Graf
2014-07-02 8:26 ` Paolo Bonzini
2014-07-02 9:03 ` Peter Crosthwaite
2014-07-02 9:07 ` Alexander Graf
2014-07-02 9:17 ` Paolo Bonzini
2014-07-02 9:19 ` Alexander Graf
2014-07-02 9:26 ` Paolo Bonzini
2014-07-01 21:49 ` [Qemu-devel] [PATCH 4/6] sysbus: Make devices spawnable via -device Alexander Graf
2014-07-02 6:32 ` Paolo Bonzini
2014-07-02 15:36 ` Alexander Graf
2014-07-01 21:49 ` [Qemu-devel] [PATCH 5/6] PPC: e500: Support dynamically spawned sysbus devices Alexander Graf
2014-07-01 22:50 ` Scott Wood
2014-07-02 17:12 ` Alexander Graf
2014-07-02 17:26 ` Scott Wood
2014-07-02 17:30 ` Alexander Graf
2014-07-02 17:52 ` Scott Wood
2014-07-02 17:59 ` Alexander Graf
2014-07-02 19:34 ` Scott Wood
2014-07-02 20:59 ` Alexander Graf
2014-07-01 21:49 ` [Qemu-devel] [PATCH 6/6] e500: Add support for eTSEC in device tree Alexander Graf
2014-07-01 22:56 ` Scott Wood
2014-07-02 17:24 ` Alexander Graf [this message]
2014-07-02 17:32 ` Scott Wood
2014-07-02 17:34 ` Alexander Graf
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=53B44065.7040508@suse.de \
--to=agraf@suse.de \
--cc=afaerber@suse.de \
--cc=eric.auger@linaro.org \
--cc=pbonzini@redhat.com \
--cc=peter.crosthwaite@xilinx.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=scottwood@freescale.com \
--cc=sean.stalley@intel.com \
/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).