From: Eric Auger <eric.auger@linaro.org>
To: Shanker Donthineni <shankerd@codeaurora.org>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Christopher Covington <ccovingt@quicinc.com>,
Vikram Sethi <vikrams@codeaurora.org>,
Alexander Graf <agraf@suse.de>, Kaya Sinan <okaya@codeaurora.org>,
Alex Williamson <alex.williamson@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/2] hw/arm/sysbus-fdt: rename xgmac platform fdt node creation function
Date: Mon, 1 Feb 2016 15:24:29 +0100 [thread overview]
Message-ID: <56AF6A9D.7030906@linaro.org> (raw)
In-Reply-To: <1454108405-4822-2-git-send-email-shankerd@codeaurora.org>
Hi Vikram, Shanker,
On 01/30/2016 12:00 AM, Shanker Donthineni wrote:
> From: Vikram Sethi <vikrams@codeaurora.org>
>
> The function that creates a device tree node for the Calxeda XGMAC
> platform device is fairly generic and can be reused for other
> platform devices that require just reg, interrupts and dma-coherent
> properties. Rename add_calxeda_midway_xgmac_fdt_node to
> add_generic_platform_fdt_node to allow reuse.
>
> Signed-off-by: Vikram Sethi <vikrams@codeaurora.org>
> Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
> ---
> hw/arm/sysbus-fdt.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/arm/sysbus-fdt.c b/hw/arm/sysbus-fdt.c
> index 9d28797..6ee7af2 100644
> --- a/hw/arm/sysbus-fdt.c
> +++ b/hw/arm/sysbus-fdt.c
> @@ -64,7 +64,7 @@ typedef struct NodeCreationPair {
> * Generates a simple node with following properties:
> * compatible string, regs, interrupts, dma-coherent
> */
> -static int add_calxeda_midway_xgmac_fdt_node(SysBusDevice *sbdev, void *opaque)
> +static int add_generic_platform_fdt_node(SysBusDevice *sbdev, void *opaque)
> {
> PlatformBusFDTData *data = opaque;
> PlatformBusDevice *pbus = data->pbus;
> @@ -125,7 +125,7 @@ fail_reg:
>
> /* list of supported dynamic sysbus devices */
> static const NodeCreationPair add_fdt_node_functions[] = {
> - {TYPE_VFIO_CALXEDA_XGMAC, add_calxeda_midway_xgmac_fdt_node},
> + {TYPE_VFIO_CALXEDA_XGMAC, add_generic_platform_fdt_node},
Introducing such a "generic" node creation function was discussed in the
past and Alex Graf (added in CC) warned against that. What is arguable
is that interrupts are defined here as level sensitive and you have the
dma-coherent property set. So where does genericity starts and where
does it end? But Maybe Alex changed his mind ;-)
The type of IRQ can be retrieved generically by looking at intp->flags &
VFIO_IRQ_INFO_AUTOMASKED as I did in add_amd_xgbe_fdt_node ([PATCH v6
7/8] hw/arm/sysbus-fdt: enable amd-xgbe dynamic instantiation)
The dma-coherent property can now be retrieved from host device-tree
using the helpers introduced in the above series. However if you use
ACPI on host there is no such helper yet.
Maybe another approach to factorize the code is to introduce a helper
routine that adds the reg and interrupts properties to the node, using
the above detection of IRQ type and you keep a differentiated function
for HiDma, adding the dma-coherent capability.
Hope it helps
Best Regards
Eric
> {"", NULL}, /* last element */
> };
>
>
next prev parent reply other threads:[~2016-02-01 14:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-29 23:00 [Qemu-devel] [PATCH 0/2] VFIO-Platform support for Qualcomm Technologies, Inc HiDMA Shanker Donthineni
2016-01-29 23:00 ` [Qemu-devel] [PATCH 1/2] hw/arm/sysbus-fdt: rename xgmac platform fdt node creation function Shanker Donthineni
2016-02-01 14:24 ` Eric Auger [this message]
2016-01-29 23:00 ` [Qemu-devel] [PATCH 2/2] hw/vfio/platform: Add Qualcomm Technologies, Inc HiDMA device support Shanker Donthineni
2016-02-01 14:37 ` Eric Auger
2016-02-02 2:31 ` Shanker Donthineni
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=56AF6A9D.7030906@linaro.org \
--to=eric.auger@linaro.org \
--cc=agraf@suse.de \
--cc=alex.williamson@redhat.com \
--cc=ccovingt@quicinc.com \
--cc=okaya@codeaurora.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=shankerd@codeaurora.org \
--cc=vikrams@codeaurora.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).