From patchwork Fri May 20 15:51:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 9129863 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BF3046048B for ; Fri, 20 May 2016 15:53:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE61721BED for ; Fri, 20 May 2016 15:53:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BE2327BFE; Fri, 20 May 2016 15:53:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 461CB21BED for ; Fri, 20 May 2016 15:53:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b3miC-0007DR-BX; Fri, 20 May 2016 15:51:40 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b3miB-0007Ct-Oc for xen-devel@lists.xen.org; Fri, 20 May 2016 15:51:39 +0000 Received: from [85.158.139.211] by server-14.bemta-5.messagelabs.com id AF/FA-29484-A823F375; Fri, 20 May 2016 15:51:38 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPIsWRWlGSWpSXmKPExsXiVRvkrNtlZB9 u8PuPuMWSj4tZHBg9ju7+zRTAGMWamZeUX5HAmnG48RpTwWreio9vn7I3MG7l6mLk4hASmMgo cXL2d0YQh0XgJYtE47O9zCCOhEA/q8S89zOBHE4gJ0bi3PntUHa1RHvnMhYQW0hAXeL0ux1sE KNmMkkcv7WRDSTBJmAisffPAyYQW0RAWuLa58uMIDazgK/EzZ3HweLCAsESZ7e1gcVZBFQlOv 9NZAWxeQU8JP6s6weKcwAtk5NYcCEdJMwp4CnRvuIcI8ReD4mWHQdZJjAKLGBkWMWoXpxaVJZ apGupl1SUmZ5RkpuYmaNraGCql5taXJyYnpqTmFSsl5yfu4kRGFgMQLCDcW2r8yFGSQ4mJVFe NXH7cCG+pPyUyozE4oz4otKc1OJDjDIcHEoSvCsNgXKCRanpqRVpmTnAEIdJS3DwKInwXgJJ8 xYXJOYWZ6ZDpE4x6nJsmXpvLZMQS15+XqqUOO9VkCIBkKKM0jy4EbB4u8QoKyXMywh0lBBPQW pRbmYJqvwrRnEORiVh3mKQKTyZeSVwm14BHcEEdMQtMRuQI0oSEVJSDYxRHJpTzm08oXjk6nu FlNf3eETv+0hstExedGtutUHm+kYVnspT02y2a8x5drH21A5pgaXxUnN91E7OmvAjuVhvwhrV pm+9P4S7rVlaFD4p1G6Uze+zXye19FeVbbz/Y81rs9ja9ZfNf+NdKO2kv58vUojl+aJjtZzpH J91RHUUYlr79NMCnimxFGckGmoxFxUnAgAsxONYsgIAAA== X-Env-Sender: edgar.iglesias@gmail.com X-Msg-Ref: server-16.tower-206.messagelabs.com!1463759498!24830731!1 X-Originating-IP: [74.125.82.67] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 16482 invoked from network); 20 May 2016 15:51:38 -0000 Received: from mail-wm0-f67.google.com (HELO mail-wm0-f67.google.com) (74.125.82.67) by server-16.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 20 May 2016 15:51:38 -0000 Received: by mail-wm0-f67.google.com with SMTP id s63so15723823wme.2 for ; Fri, 20 May 2016 08:51:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/hrvEIBJdOxWxxnK8hpyKDaFqK29jJs5p6MIjal70gM=; b=X5k/aJ6XEwE3Z/6fSo/XxDd/lNQjU/oJG7Voy9wuqERRUAFwNww9LXOj0S29sK+Xxr l0w5+uOw9B6kx34G6p5jgKJBZzDnNhVVzk/VDeSUHV/ywrz/aZHjx40tFLrTLaJF5C1L xZ6gGfJRNzU22TopSgwTVsALBv+OKuajfId0OdD4gw6QcOsqctGLbcTSQHbwMAFX14ax uKcW0RL4+ejLkqeq1p/FLLw3DdaL/tt0zm9Zyrz9wsNwwXbhPr8uSZkVRAdnN/e1JI9V WJbncbBZ5OtD236wGtLRzlBeBETV4kwQIK9V5RelFtesJNtF2fGmkRk1E6I3Ony108Le 0ogA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/hrvEIBJdOxWxxnK8hpyKDaFqK29jJs5p6MIjal70gM=; b=c1egvRLAIKiyIIb6++wpA8pwIPZEDSA1EdrxOEJHA2O5qS42gP/4QcR8PkiuWCttI9 3YMim7KuSoFAeKHRDML3CXrYoeMpOwnnrWMVV6Tknmb/saFEGQwCNI5A5cEnrGMxfDxJ Vz+pOxxs8RRWktBg+Nj/6QYmJEejQKIMKGkG619YVETtNh3Wsf9xYngPBO6bGT/kTdje cGNoUlu4PohBtkLGI6WdVRwKYdg9YIVXIj2V56Qi+uy5RGjfzbduzvq7lVwariWt5Vt0 NnuVo00P9JsP0itIJWpBvkN3xDJv3gCr6Rwe1GKKbI+Wt4h9n3K4Wfxjz9WA20wjbCU9 Ss0A== X-Gm-Message-State: AOPr4FWow4Dyka2sUBnWaXKV6Wd+m9gfAZU6by3BHbxiD0En7hhUChNeKQLMqygeoZ7V3w== X-Received: by 10.194.118.195 with SMTP id ko3mr4654669wjb.178.1463759498035; Fri, 20 May 2016 08:51:38 -0700 (PDT) Received: from localhost (81-231-233-234-no56.tbcn.telia.com. [81.231.233.234]) by smtp.gmail.com with ESMTPSA id jq1sm20353225wjc.28.2016.05.20.08.51.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 May 2016 08:51:37 -0700 (PDT) From: "Edgar E. Iglesias" To: xen-devel@lists.xen.org Date: Fri, 20 May 2016 17:51:28 +0200 Message-Id: <1463759488-11900-7-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1463759488-11900-1-git-send-email-edgar.iglesias@gmail.com> References: <1463759488-11900-1-git-send-email-edgar.iglesias@gmail.com> Cc: edgar.iglesias@xilinx.com, julien.grall@arm.com, sstabellini@kernel.org Subject: [Xen-devel] [RFC for-4.8 6/6] xen/arm: Avoid multiple dev class lookups in handle_node X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Edgar E. Iglesias" 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 --- 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;