|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] device-tree: optimize dt_device_for_passthrough()
The dt_device_for_passthrough() is called many times during Xen
initialization and Dom0 creation. On every call it traverses struct
dt_device_node properties list and compares compares properties name with
"xen,passthrough" which is runtime overhead. This can be optimized by
marking dt_device_node as passthrough while unflattening DT.
This patch introduced new struct dt_device_node property "is_passthrough"
which is filled if "xen,passthrough" property is present while unflattening
DT and dt_device_for_passthrough() just return it's value.
Signed-off-by: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
---
xen/common/device-tree/device-tree.c | 7 +++++--
xen/include/xen/device_tree.h | 2 ++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/xen/common/device-tree/device-tree.c
b/xen/common/device-tree/device-tree.c
index d0528c582565..a329aaf576da 100644
--- a/xen/common/device-tree/device-tree.c
+++ b/xen/common/device-tree/device-tree.c
@@ -1682,8 +1682,7 @@ bool dt_device_is_available(const struct dt_device_node
*device)
bool dt_device_for_passthrough(const struct dt_device_node *device)
{
- return (dt_find_property(device, "xen,passthrough", NULL) != NULL);
-
+ return device->is_passthrough;
}
static int __dt_parse_phandle_with_args(const struct dt_device_node *np,
@@ -1913,6 +1912,7 @@ static unsigned long unflatten_dt_node(const void *fdt,
np->used_by = 0;
/* By default the device is not protected */
np->is_protected = false;
+ np->is_passthrough = false;
INIT_LIST_HEAD(&np->domain_list);
if ( new_format )
@@ -2001,6 +2001,9 @@ static unsigned long unflatten_dt_node(const void *fdt,
* stuff */
if ( strcmp(pname, "ibm,phandle") == 0 )
np->phandle = be32_to_cpup((__be32 *)*p);
+
+ if ( strcmp(pname, "xen,passthrough") == 0 )
+ np->is_passthrough = true;
pp->name = pname;
pp->length = sz;
pp->value = (void *)*p;
diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
index 5ff763bb80bb..96001d5b7843 100644
--- a/xen/include/xen/device_tree.h
+++ b/xen/include/xen/device_tree.h
@@ -94,6 +94,8 @@ struct dt_device_node {
/* IOMMU specific fields */
bool is_protected;
+ /* Indicates DT device is for passthrough */
+ bool is_passthrough;
#ifdef CONFIG_STATIC_EVTCHN
/* HACK: Remove this if there is a need of space */
--
2.34.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |