[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PULL 18/29] s390x/kvm: cache the kvm flic in a central fun
From: |
Cornelia Huck |
Subject: |
[qemu-s390x] [PULL 18/29] s390x/kvm: cache the kvm flic in a central function |
Date: |
Fri, 9 Feb 2018 10:25:13 +0100 |
From: David Hildenbrand <address@hidden>
This avoids tons of conversions when handling interrupts.
Acked-by: Christian Borntraeger <address@hidden>
Signed-off-by: David Hildenbrand <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>
---
hw/intc/s390_flic_kvm.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c
index d277ffdd2e..3f804ad52e 100644
--- a/hw/intc/s390_flic_kvm.c
+++ b/hw/intc/s390_flic_kvm.c
@@ -35,6 +35,17 @@ typedef struct KVMS390FLICState {
bool clear_io_supported;
} KVMS390FLICState;
+static KVMS390FLICState *s390_get_kvm_flic(S390FLICState *fs)
+{
+ static KVMS390FLICState *flic;
+
+ if (!flic) {
+ /* we only have one flic device, so this is fine to cache */
+ flic = KVM_S390_FLIC(fs);
+ }
+ return flic;
+}
+
/**
* flic_get_all_irqs - store all pending irqs in buffer
* @buf: pointer to buffer which is passed to kernel
@@ -117,7 +128,7 @@ static void kvm_s390_inject_flic(S390FLICState *fs, struct
kvm_s390_irq *irq)
int r;
if (use_flic) {
- r = flic_enqueue_irqs(irq, sizeof(*irq), KVM_S390_FLIC(fs));
+ r = flic_enqueue_irqs(irq, sizeof(*irq), s390_get_kvm_flic(fs));
if (r == -ENOSYS) {
use_flic = false;
}
@@ -174,7 +185,7 @@ static void kvm_s390_inject_crw_mchk(S390FLICState *fs)
static int kvm_s390_clear_io_flic(S390FLICState *fs, uint16_t subchannel_id,
uint16_t subchannel_nr)
{
- KVMS390FLICState *flic = KVM_S390_FLIC(fs);
+ KVMS390FLICState *flic = s390_get_kvm_flic(fs);
int rc;
uint32_t sid = subchannel_id << 16 | subchannel_nr;
struct kvm_device_attr attr = {
@@ -192,7 +203,7 @@ static int kvm_s390_clear_io_flic(S390FLICState *fs,
uint16_t subchannel_id,
static int kvm_s390_modify_ais_mode(S390FLICState *fs, uint8_t isc,
uint16_t mode)
{
- KVMS390FLICState *flic = KVM_S390_FLIC(fs);
+ KVMS390FLICState *flic = s390_get_kvm_flic(fs);
struct kvm_s390_ais_req req = {
.isc = isc,
.mode = mode,
@@ -212,7 +223,7 @@ static int kvm_s390_modify_ais_mode(S390FLICState *fs,
uint8_t isc,
static int kvm_s390_inject_airq(S390FLICState *fs, uint8_t type,
uint8_t isc, uint8_t flags)
{
- KVMS390FLICState *flic = KVM_S390_FLIC(fs);
+ KVMS390FLICState *flic = s390_get_kvm_flic(fs);
uint32_t id = css_get_adapter_id(type, isc);
struct kvm_device_attr attr = {
.group = KVM_DEV_FLIC_AIRQ_INJECT,
@@ -301,7 +312,7 @@ static int kvm_s390_io_adapter_map(S390FLICState *fs,
uint32_t id,
.group = KVM_DEV_FLIC_ADAPTER_MODIFY,
.addr = (uint64_t)&req,
};
- KVMS390FLICState *flic = KVM_S390_FLIC(fs);
+ KVMS390FLICState *flic = s390_get_kvm_flic(fs);
int r;
if (!kvm_gsi_routing_enabled()) {
--
2.13.6
- [qemu-s390x] [PULL 08/29] s390x/tcg: tolerate wrong wakeups due to floating interrupts, (continued)
- [qemu-s390x] [PULL 08/29] s390x/tcg: tolerate wrong wakeups due to floating interrupts, Cornelia Huck, 2018/02/09
- [qemu-s390x] [PULL 07/29] s390x/flic: no need to call s390_io_interrupt() from flic, Cornelia Huck, 2018/02/09
- [qemu-s390x] [PULL 06/29] s390x/flic: factor out injection of floating interrupts, Cornelia Huck, 2018/02/09
- [qemu-s390x] [PULL 11/29] s390x/flic: implement qemu_s390_clear_io_flic(), Cornelia Huck, 2018/02/09
- [qemu-s390x] [PULL 05/29] s390x/tcg: simplify machine check handling, Cornelia Huck, 2018/02/09
- [qemu-s390x] [PULL 10/29] s390x/tcg: implement TEST PENDING INTERRUPTION, Cornelia Huck, 2018/02/09
- [qemu-s390x] [PULL 12/29] s390x/flic: optimize CPU wakeup for TCG, Cornelia Huck, 2018/02/09
- [qemu-s390x] [PULL 09/29] s390x/flic: make floating interrupts on TCG actually floating, Cornelia Huck, 2018/02/09
- [qemu-s390x] [PULL 13/29] s390x: fix size + content of STSI blocks, Cornelia Huck, 2018/02/09
- [qemu-s390x] [PULL 14/29] s390x/tcg: STSI overhaul, Cornelia Huck, 2018/02/09
- [qemu-s390x] [PULL 18/29] s390x/kvm: cache the kvm flic in a central function,
Cornelia Huck <=
- [qemu-s390x] [PULL 17/29] s390x/tcg: cache the qemu flic in a central function, Cornelia Huck, 2018/02/09
- [qemu-s390x] [PULL 16/29] configure: s390x supports mttcg now, Cornelia Huck, 2018/02/09
- [qemu-s390x] [PULL 15/29] s390x/tcg: remove SMP warning, Cornelia Huck, 2018/02/09
- [qemu-s390x] [PULL 20/29] s390x/sclp: fix event mask handling, Cornelia Huck, 2018/02/09
- [qemu-s390x] [PULL 21/29] s390x/tcg: wire up pci instructions, Cornelia Huck, 2018/02/09
- [qemu-s390x] [PULL 22/29] s390x/cpumodel: allow zpci features in qemu model, Cornelia Huck, 2018/02/09
- [qemu-s390x] [PULL 23/29] s390x/cpumodel: model PTFF subfunctions for Multiple-epoch facility, Cornelia Huck, 2018/02/09
- [qemu-s390x] [PULL 24/29] s390x/pci: fixup the code walking IOMMU tables, Cornelia Huck, 2018/02/09
- [qemu-s390x] [PULL 19/29] s390x/flic: cache the common flic class in a central function, Cornelia Huck, 2018/02/09
- [qemu-s390x] [PULL 25/29] s390x/pci: fixup global refresh, Cornelia Huck, 2018/02/09