qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
Cc: qemu-ppc Mailing List <qemu-ppc@nongnu.org>,
	Alexander Graf <agraf@suse.de>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 07/31] dt: add helper for phandle allocation
Date: Wed, 6 Jun 2012 19:31:18 -0500	[thread overview]
Message-ID: <4FCFF656.4070909@freescale.com> (raw)
In-Reply-To: <CAEgOgz7FxR42V1iZuVqNE5MPcaMO6SM3RK6hV0Z_sE_YaCzoxQ@mail.gmail.com>

On 06/06/2012 07:15 PM, Peter Crosthwaite wrote:
> On Thu, Jun 7, 2012 at 2:55 AM, Scott Wood <scottwood@freescale.com> wrote:
>> On 06/06/2012 11:00 AM, Alexander Graf wrote:
>>> On 06/06/2012 07:18 AM, Peter Crosthwaite wrote:
>>>> On Wed, 2012-06-06 at 01:52 +0200, Alexander Graf wrote:
>>>>> +uint32_t qemu_devtree_alloc_phandle(void *fdt)
>>>>> +{
>>>>> +    static int phandle = 0x8000;
>>>> can easily double check for duplicates. Would also allow you to start
>>>> from 1 rather than magic number 0x8000?
>>
>> You can't check for duplicates, because the tree fragments you'll be
>> conflicting with haven't been added to the tree yet.  That's done by a
>> tool operating on the tree output by the first pass of qemu, and is fed
>> back into the second pass of qemu.
>>
> 
> Im not sure what you mean by "fragments [which] havent been added to
> the tree yet"?

The use case I have in mind is running QEMU once in dumpdtb mode,
merging in fragments from the host device tree for directly assigned
devices, and passing the result back to a second invocation of QEMU.

For the first pass of QEMU, the managing tool would look at the host
device tree to determine a suitable phandle range to pass to QEMU.

> Im thinking here of the use model where you use the DTB
> API to modify and existing DTB (probably pc-bios/foo.dtb). Yes, for
> Alex's series im not sure it wins anything as you are starting a DTB
> from scratch (which will have no pre-existing phandles), but it guards
> against a potentially very obscure and hard to find bug in some other
> potential uses of this API.

I'm not sure the API misuse it would protect against is particularly
likely -- you'd have to have some phandle creators ignore the API, and
others use the API, and the misbehaving phandle generator has to do its
thing before the conflicting API-compliant phandle generation.  Doing a
phandle search is a fairly heavy operation, which may not be the biggest
concern here, but still it shouldn't be called trivially.

It would be different if QEMU were adding nodes to an existing tree,
rather than creating a tree from scratch.

In any case, it doesn't eliminate the need for passing in a starting point.

-Scott

  reply	other threads:[~2012-06-07  0:31 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-05 23:52 [Qemu-devel] [PATCH 00/31] PPC: mpc8544ds: Create device tree dynamically Alexander Graf
2012-06-05 23:52 ` [Qemu-devel] [PATCH 01/31] dt: allow add_subnode to create root subnodes Alexander Graf
2012-06-06  5:30   ` Peter Crosthwaite
2012-06-05 23:52 ` [Qemu-devel] [PATCH 02/31] dt: add helpers for 2, 3 and 4 cell adds Alexander Graf
2012-06-06  5:01   ` Peter Crosthwaite
2012-06-06 15:55     ` Alexander Graf
2012-06-06 21:52       ` Scott Wood
2012-06-06 23:45         ` [Qemu-devel] [Qemu-ppc] " David Gibson
2012-06-07 11:27           ` Alexander Graf
2012-06-07 12:13             ` David Gibson
2012-06-08 13:00               ` Alexander Graf
2012-06-08 14:15                 ` David Gibson
2012-06-05 23:52 ` [Qemu-devel] [PATCH 03/31] dt: add helper for phandle references Alexander Graf
2012-06-06  5:06   ` Peter Crosthwaite
2012-06-05 23:52 ` [Qemu-devel] [PATCH 04/31] dt: temporarily disable subtree creation failure check Alexander Graf
2012-06-06  5:32   ` Peter Crosthwaite
2012-06-06 15:58     ` Alexander Graf
2012-06-05 23:52 ` [Qemu-devel] [PATCH 05/31] dt: add helper for phandle enumeration Alexander Graf
2012-06-06  5:11   ` Peter Crosthwaite
2012-06-06 15:58     ` Alexander Graf
2012-06-07  0:28       ` Peter Crosthwaite
2012-06-08 12:46         ` Alexander Graf
2012-06-09  1:02           ` Peter Crosthwaite
2012-06-19 14:03             ` Alexander Graf
2012-06-05 23:52 ` [Qemu-devel] [PATCH 06/31] dt: add helper for empty dt creation Alexander Graf
2012-06-06  5:34   ` Peter Crosthwaite
2012-06-05 23:52 ` [Qemu-devel] [PATCH 07/31] dt: add helper for phandle allocation Alexander Graf
2012-06-06  5:18   ` Peter Crosthwaite
2012-06-06 16:00     ` Alexander Graf
2012-06-06 16:55       ` Scott Wood
2012-06-07  0:15         ` Peter Crosthwaite
2012-06-07  0:31           ` Scott Wood [this message]
2012-06-05 23:52 ` [Qemu-devel] [PATCH 08/31] dt: add helper for 64bit cell adds Alexander Graf
2012-06-06  5:20   ` Peter Crosthwaite
2012-06-05 23:53 ` [Qemu-devel] [PATCH 09/31] PPC: e500: require libfdt Alexander Graf
2012-06-05 23:53 ` [Qemu-devel] [PATCH 10/31] PPC: e500: dt: create memory node dynamically Alexander Graf
2012-06-05 23:53 ` [Qemu-devel] [PATCH 11/31] PPC: e500: dt: create /cpus " Alexander Graf
2012-06-05 23:53 ` [Qemu-devel] [PATCH 12/31] PPC: e500: dt: create /hypervisor " Alexander Graf
2012-06-05 23:53 ` [Qemu-devel] [PATCH 13/31] PPC: e500: dt: create / " Alexander Graf
2012-06-05 23:53 ` [Qemu-devel] [PATCH 14/31] PPC: e500: dt: create /chosen " Alexander Graf
2012-06-05 23:53 ` [Qemu-devel] [PATCH 15/31] PPC: e500: dt: create /soc8544 " Alexander Graf
2012-06-05 23:53 ` [Qemu-devel] [PATCH 16/31] PPC: e500: dt: create serial nodes dynamically Alexander Graf
2012-06-05 23:53 ` [Qemu-devel] [PATCH 17/31] PPC: e500: dt: create mpic node dynamically Alexander Graf
2012-06-05 23:53 ` [Qemu-devel] [PATCH 18/31] PPC: e500: dt: create global-utils " Alexander Graf
2012-06-05 23:53 ` [Qemu-devel] [PATCH 19/31] PPC: e500: dt: create pci " Alexander Graf
2012-06-05 23:53 ` [Qemu-devel] [PATCH 20/31] PPC: e500: dt: start with empty device tree Alexander Graf
2012-06-05 23:53 ` [Qemu-devel] [PATCH 21/31] dt: Add -machine dumpdtb option to dump the current dtb Alexander Graf
2012-06-05 23:53 ` [Qemu-devel] [PATCH 22/31] PPC: e500: dt: use 64bit cell helper Alexander Graf
2012-06-05 23:53 ` [Qemu-devel] [PATCH 23/31] PPC: e500: dt: use target_phys_addr_t for ramsize Alexander Graf
2012-06-05 23:53 ` [Qemu-devel] [PATCH 24/31] PPC: e500: enable manual loading of dtb blob Alexander Graf
2012-06-05 23:53 ` [Qemu-devel] [PATCH 25/31] Revert "dt: temporarily disable subtree creation failure check" Alexander Graf
2012-06-05 23:53 ` [Qemu-devel] [PATCH 26/31] PPC: e500: Use new MPIC dt format Alexander Graf
2012-06-07 21:08   ` [Qemu-devel] [Qemu-ppc] " Blue Swirl
2012-06-05 23:53 ` [Qemu-devel] [PATCH 27/31] PPC: e500: Use new SOC " Alexander Graf
2012-06-05 23:53 ` [Qemu-devel] [PATCH 28/31] PPC: e500: Define addresses as always 64bit Alexander Graf
2012-06-05 23:53 ` [Qemu-devel] [PATCH 29/31] PPC: e500: Extend address/size of / to 64bit Alexander Graf
2012-06-05 23:53 ` [Qemu-devel] [PATCH 30/31] dt: Add global option to set phandle start offset Alexander Graf
2012-06-05 23:53 ` [Qemu-devel] [PATCH 31/31] PPC: e500: Refactor serial dt generation Alexander Graf
2012-06-07 21:09 ` [Qemu-devel] [PATCH 00/31] PPC: mpc8544ds: Create device tree dynamically Blue Swirl
2012-06-19 12:54   ` Alexander Graf
2012-06-19 18:39     ` Blue Swirl
2012-06-19 19:14       ` Alexander Graf
  -- strict thread matches above, loose matches on Subject: below --
2012-06-19 19:14 Alexander Graf
2012-06-19 19:15 ` [Qemu-devel] [PATCH 07/31] dt: add helper for phandle allocation 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=4FCFF656.4070909@freescale.com \
    --to=scottwood@freescale.com \
    --cc=agraf@suse.de \
    --cc=peter.crosthwaite@petalogix.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).