aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorFei Li <sherrylf@linux.vnet.ibm.com>2017-03-17 10:28:30 +0100
committerCornelia Huck <cornelia.huck@de.ibm.com>2017-04-21 09:32:09 +0200
commitbc66d6cbca780c5b8c237b9d355caa8274e5b312 (patch)
treedc20c5152425522930d706fc807445858911441b /hw
parentc572d3f313a3580bc2a1ec7c14a25a2ac40c32ca (diff)
s390x/flic: cache flic in s390_get_flic
s390_get_flic() is called many times to obtain the flic. This wastes a lot of time as it calls object_resolve_path() every time. Let's cache S390FLICState by defining it as static. Signed-off-by: Fei Li <sherrylf@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/intc/s390_flic.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c
index bef4caf980..711c11454f 100644
--- a/hw/intc/s390_flic.c
+++ b/hw/intc/s390_flic.c
@@ -21,11 +21,14 @@
S390FLICState *s390_get_flic(void)
{
- S390FLICState *fs;
+ static S390FLICState *fs;
- fs = S390_FLIC_COMMON(object_resolve_path(TYPE_KVM_S390_FLIC, NULL));
if (!fs) {
- fs = S390_FLIC_COMMON(object_resolve_path(TYPE_QEMU_S390_FLIC, NULL));
+ fs = S390_FLIC_COMMON(object_resolve_path(TYPE_KVM_S390_FLIC, NULL));
+ if (!fs) {
+ fs = S390_FLIC_COMMON(object_resolve_path(TYPE_QEMU_S390_FLIC,
+ NULL));
+ }
}
return fs;
}