From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: xen-devel@lists.xen.org
Cc: edgar.iglesias@xilinx.com, julien.grall@arm.com, sstabellini@kernel.org
Subject: [RFC for-4.8 6/6] xen/arm: Avoid multiple dev class lookups in handle_node
Date: Fri, 20 May 2016 17:51:28 +0200 [thread overview]
Message-ID: <1463759488-11900-7-git-send-email-edgar.iglesias@gmail.com> (raw)
In-Reply-To: <1463759488-11900-1-git-send-email-edgar.iglesias@gmail.com>
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
Avoid looking up the device class multiple times in handle_node().
This optimization should not have any functional change.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
xen/arch/arm/domain_build.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 15b6dbe..65c2df7 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1213,6 +1213,7 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo,
{ /* sentinel */ },
};
const struct device_desc *desc;
+ enum device_class dev_class;
struct dt_device_node *child;
int res;
const char *name;
@@ -1235,12 +1236,13 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo,
}
desc = device_get_desc(node);
+ dev_class = desc ? desc->class : DEVICE_UNKNOWN;
/*
* Replace these nodes with our own. Note that the original may be
* used_by DOMID_XEN so this check comes first.
*/
- if ( device_get_class(node) == DEVICE_GIC )
+ if ( dev_class == DEVICE_GIC )
return make_gic_node(d, kinfo->fdt, node);
if ( dt_match_node(timer_matches, node) )
return make_timer_node(d, kinfo->fdt, node);
@@ -1256,7 +1258,7 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo,
* Even if the IOMMU device is not used by Xen, it should not be
* passthrough to DOM0
*/
- if ( device_get_class(node) == DEVICE_IOMMU )
+ if ( dev_class == DEVICE_IOMMU )
{
DPRINT(" IOMMU, skip it\n");
return 0;
--
2.5.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-05-20 15:51 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-20 15:51 [RFC for-4.8 0/6] xen/arm: Add support for mapping mmio-sram nodes into dom0 Edgar E. Iglesias
2016-05-20 15:51 ` [RFC for-4.8 1/6] xen/arm: Add device_get_desc() Edgar E. Iglesias
2016-05-20 15:51 ` [RFC for-4.8 2/6] xen/arm: Add an optional map function to the device descriptor Edgar E. Iglesias
2016-05-20 15:51 ` [RFC for-4.8 3/6] xen/arm: Add a DEVICE_MEMORY class Edgar E. Iglesias
2016-05-20 15:51 ` [RFC for-4.8 4/6] xen/arm: Add helper functions to map RWX memory regions Edgar E. Iglesias
2016-05-23 15:36 ` Julien Grall
2016-05-24 14:14 ` Edgar E. Iglesias
2016-05-20 15:51 ` [RFC for-4.8 5/6] xen/arm: Add an mmio-sram device Edgar E. Iglesias
2016-05-20 15:51 ` Edgar E. Iglesias [this message]
2016-05-23 10:29 ` [RFC for-4.8 0/6] xen/arm: Add support for mapping mmio-sram nodes into dom0 Julien Grall
2016-05-23 11:56 ` Edgar E. Iglesias
2016-05-23 13:02 ` Julien Grall
2016-05-23 14:02 ` Edgar E. Iglesias
2016-05-23 15:13 ` Julien Grall
2016-05-23 15:42 ` Edgar E. Iglesias
2016-05-24 19:44 ` Julien Grall
2016-05-25 9:43 ` Stefano Stabellini
2016-05-25 9:52 ` Julien Grall
2016-05-25 10:00 ` Stefano Stabellini
2016-05-25 10:35 ` Edgar E. Iglesias
2016-05-25 13:29 ` Edgar E. Iglesias
2016-05-25 14:24 ` Julien Grall
2016-06-03 13:10 ` Edgar E. Iglesias
2016-05-25 9:31 ` Stefano Stabellini
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=1463759488-11900-7-git-send-email-edgar.iglesias@gmail.com \
--to=edgar.iglesias@gmail.com \
--cc=edgar.iglesias@xilinx.com \
--cc=julien.grall@arm.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xen.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).