From: Eric Auger <eric.auger@linaro.org>
To: Rob Herring <robherring2@gmail.com>
Cc: eric.auger@st.com, "QEMU Developers" <qemu-devel@nongnu.org>,
qemu-arm@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>,
alex.williamson@redhat.com,
"David Gibson" <david@gibson.dropbear.id.au>,
"Thomas Lendacky" <thomas.lendacky@amd.com>,
thuth@redhat.com, b.reynal@virtualopensystems.com,
"Linaro Patches" <patches@linaro.org>,
"Peter Crosthwaite" <crosthwaitepeter@gmail.com>,
"Suravee Suthikulanit" <suravee.suthikulpanit@amd.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Christoffer Dall" <christoffer.dall@linaro.org>
Subject: Re: [Qemu-devel] [PATCH v6 2/8] device_tree: introduce load_device_tree_from_sysfs
Date: Mon, 1 Feb 2016 17:22:47 +0100 [thread overview]
Message-ID: <56AF8657.6060303@linaro.org> (raw)
In-Reply-To: <CAL_JsqLdCLnOUcnZe+d9uXmWp6fneuwska28vAeaWi7VJ6sBiw@mail.gmail.com>
Hi Rob,
On 02/01/2016 05:15 PM, Rob Herring wrote:
> On Mon, Feb 1, 2016 at 7:51 AM, Eric Auger <eric.auger@linaro.org> wrote:
>> This function returns the host device tree blob from sysfs
>> (/proc/device-tree). It uses a recursive function inspired
>> from dtc read_fstree.
>>
>> Signed-off-by: Eric Auger <eric.auger@linaro.org>
>>
>> ---
>> v5 -> v6:
>> - fix some spelling mistakes
>> - error_report + exit replaced by error_setg
>> - const char *parent_node;
>> - use g_strdup_printf instead of g_strjoin
>> - add a doc comment for load_device_tree_from_sysfs
>> v1 -> v2:
>> - do not implement/expose read_fstree and load_device_tree_from_sysfs
>> if CONFIG_LINUX is not defined (lstat is not implemeted in mingw)
>> - correct indentation in read_fstree
>> - use /proc/device-tree symlink instead of /sys/firmware/devicetree/base
>> path (kernel.org/doc/Documentation/ABI/testing/sysfs-firmware-ofw)
>> - use g_file_get_contents in read_fstree
>> - introduce SYSFS_DT_BASEDIR macro and use strlen
>> - exit on error in load_device_tree_from_sysfs
>> - user error_setg
>>
>> RFC -> v1:
>> - remove runtime dependency on dtc binary and introduce read_fstree
>> ---
>> device_tree.c | 99 ++++++++++++++++++++++++++++++++++++++++++++
>> include/sysemu/device_tree.h | 8 ++++
>> 2 files changed, 107 insertions(+)
>>
>> diff --git a/device_tree.c b/device_tree.c
>> index a9f5f8e..3797182 100644
>> --- a/device_tree.c
>> +++ b/device_tree.c
>> @@ -17,6 +17,9 @@
>> #include <fcntl.h>
>> #include <unistd.h>
>> #include <stdlib.h>
>> +#ifdef CONFIG_LINUX
>> +#include <dirent.h>
>> +#endif
>>
>> #include "qemu-common.h"
>> #include "qemu/error-report.h"
>> @@ -117,6 +120,102 @@ fail:
>> return NULL;
>> }
>>
>> +#ifdef CONFIG_LINUX
>> +
>> +#define SYSFS_DT_BASEDIR "/proc/device-tree"
>
> Use the sysfs path (/sys/firmware/device-tree/ IIRC) as this is just a
> symlink to sysfs and /proc is considered the legacy path.
I used the sysfs originally but I eventually found:
https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-firmware-ofw
which states:
"Userspace must not use the /sys/firmware/devicetree/base
path directly, but instead should follow /proc/device-tree
symlink. It is possible that the absolute path will change
in the future, but the symlink is the stable ABI.
"
Do you confirm this statement is outdated.
Thank you in advance
Best Regards
Eric
>
> Rob
>
next prev parent reply other threads:[~2016-02-01 16:23 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-01 13:51 [PATCH v6 0/8] AMD XGBE KVM platform passthrough Eric Auger
2016-02-01 13:51 ` [PATCH v6 1/8] hw/vfio/platform: amd-xgbe device Eric Auger
2016-02-01 13:51 ` [PATCH v6 2/8] device_tree: introduce load_device_tree_from_sysfs Eric Auger
2016-02-01 16:15 ` [Qemu-devel] " Rob Herring
2016-02-01 16:22 ` Eric Auger [this message]
2016-02-01 16:27 ` Rob Herring
2016-02-01 16:31 ` Eric Auger
2016-02-16 18:37 ` Peter Maydell
2016-02-01 13:51 ` [PATCH v6 3/8] device_tree: introduce qemu_fdt_node_path Eric Auger
2016-02-16 18:38 ` Peter Maydell
2016-02-01 13:51 ` [PATCH v6 4/8] device_tree: qemu_fdt_getprop converted to use the error API Eric Auger
2016-02-01 13:51 ` [PATCH v6 5/8] device_tree: qemu_fdt_getprop_cell " Eric Auger
2016-02-01 13:51 ` [PATCH v6 6/8] hw/arm/sysbus-fdt: helpers for clock node generation Eric Auger
2016-02-01 13:51 ` [PATCH v6 7/8] hw/arm/sysbus-fdt: enable amd-xgbe dynamic instantiation Eric Auger
2016-02-16 18:34 ` Peter Maydell
2016-02-01 13:51 ` [PATCH v6 8/8] hw/arm/sysbus-fdt: remove qemu_fdt_setprop returned value check Eric Auger
2016-02-16 18:40 ` Peter Maydell
2016-02-16 18:40 ` [PATCH v6 0/8] AMD XGBE KVM platform passthrough Peter Maydell
2016-02-17 19:59 ` Alex Williamson
2016-02-18 17:59 ` Eric Auger
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=56AF8657.6060303@linaro.org \
--to=eric.auger@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=alex.williamson@redhat.com \
--cc=b.reynal@virtualopensystems.com \
--cc=christoffer.dall@linaro.org \
--cc=crosthwaitepeter@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=eric.auger@st.com \
--cc=patches@linaro.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=robherring2@gmail.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=thomas.lendacky@amd.com \
--cc=thuth@redhat.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).