[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 7/8] spapr: move spapr_ics_free() under irq_free_block
From: |
Cédric Le Goater |
Subject: |
[Qemu-ppc] [PATCH 7/8] spapr: move spapr_ics_free() under irq_free_block() operation |
Date: |
Sun, 29 Oct 2017 19:12:16 +0100 |
So we can now use bitmap_clear() which is slightly more efficent but
more important, it removes the usage of ics_valid_irq() which has a
reference to the 'ics' object of the machine.
Signed-off-by: Cédric Le Goater <address@hidden>
---
hw/intc/trace-events | 2 --
hw/intc/xics_spapr.c | 19 ++-----------------
hw/ppc/spapr.c | 11 ++++++++++-
hw/ppc/trace-events | 2 ++
4 files changed, 14 insertions(+), 20 deletions(-)
diff --git a/hw/intc/trace-events b/hw/intc/trace-events
index b86f242b0fcf..e34ecf7a16e5 100644
--- a/hw/intc/trace-events
+++ b/hw/intc/trace-events
@@ -65,8 +65,6 @@ xics_ics_simple_reject(int nr, int srcno) "reject irq 0x%x
[src %d]"
xics_ics_simple_eoi(int nr) "ics_eoi: irq 0x%x"
xics_alloc(int irq) "irq %d"
xics_alloc_block(int first, int num, bool lsi, int align) "first irq %d, %d
irqs, lsi=%d, alignnum %d"
-xics_ics_free(int src, int irq, int num) "Source#%d, first irq %d, %d irqs"
-xics_ics_free_warn(int src, int irq) "Source#%d, irq %d is already free"
# hw/intc/s390_flic_kvm.c
flic_create_device(int err) "flic: create device failed %d"
diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c
index 23d81ff83182..4ba23fe5125b 100644
--- a/hw/intc/xics_spapr.c
+++ b/hw/intc/xics_spapr.c
@@ -304,25 +304,10 @@ int spapr_ics_alloc_block(ICSState *ics, int num, bool
lsi,
return first;
}
-static void ics_free(ICSState *ics, int irq, int num)
-{
- int i;
- XICSFabricClass *xic = XICS_FABRIC_GET_CLASS(ics->xics);
-
- for (i = irq; i < irq + num; ++i) {
- if (xic->irq_test(ics->xics, i)) {
- trace_xics_ics_free_warn(0, i);
- }
- xic->irq_free_block(ics->xics, i, 1);
- }
-}
-
void spapr_ics_free(ICSState *ics, int irq, int num)
{
- if (ics_valid_irq(ics, irq)) {
- trace_xics_ics_free(0, irq, num);
- ics_free(ics, irq, num);
- }
+ XICSFabricClass *xic = XICS_FABRIC_GET_CLASS(ics->xics);
+ xic->irq_free_block(ics->xics, irq, num);
}
void spapr_dt_xics(int nr_servers, void *fdt, uint32_t phandle)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 557d89d9ecb5..f8224ea3e894 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3629,8 +3629,17 @@ static void spapr_irq_free_block(XICSFabric *xi, int
irq, int num)
{
sPAPRMachineState *spapr = SPAPR_MACHINE(xi);
int srcno = irq - spapr->irq_base;
+ int i;
- bitmap_clear(spapr->irq_map, srcno, num);
+ if (srcno >= 0 && srcno < spapr->nr_irqs) {
+ trace_spapr_irq_free(0, irq, num);
+ for (i = srcno; i < srcno + num; ++i) {
+ if (!test_bit(i, spapr->irq_map)) {
+ trace_spapr_irq_free_warn(0, i);
+ }
+ }
+ bitmap_clear(spapr->irq_map, srcno, num);
+ }
}
static bool spapr_irq_is_lsi(XICSFabric *xi, int irq)
diff --git a/hw/ppc/trace-events b/hw/ppc/trace-events
index 4a6a6490fa78..dc9ab4c4deb3 100644
--- a/hw/ppc/trace-events
+++ b/hw/ppc/trace-events
@@ -12,6 +12,8 @@ spapr_pci_msi_retry(unsigned config_addr, unsigned req_num,
unsigned max_irqs) "
# hw/ppc/spapr.c
spapr_cas_failed(unsigned long n) "DT diff buffer is too small: %ld bytes"
spapr_cas_continue(unsigned long n) "Copy changes to the guest: %ld bytes"
+spapr_irq_free(int src, int irq, int num) "Source#%d, first irq %d, %d irqs"
+spapr_irq_free_warn(int src, int irq) "Source#%d, irq %d is already free"
# hw/ppc/spapr_hcall.c
spapr_cas_pvr_try(uint32_t pvr) "0x%x"
--
2.13.6
- [Qemu-ppc] [PATCH 0/8] introduce an IRQ allocator at the machine level, Cédric Le Goater, 2017/10/29
- [Qemu-ppc] [PATCH 2/8] spapr: introduce a machine class flag to handle migration compatibility, Cédric Le Goater, 2017/10/29
- [Qemu-ppc] [PATCH 1/8] spapr: introduce an IRQ allocator at the machine level, Cédric Le Goater, 2017/10/29
- [Qemu-ppc] [PATCH 3/8] pnv: introduce an irq_test() operation, Cédric Le Goater, 2017/10/29
- [Qemu-ppc] [PATCH 4/8] spapr: split the IRQ number space for LSI interrupts, Cédric Le Goater, 2017/10/29
- [Qemu-ppc] [PATCH 5/8] spapr: introduce an is_lsi() operation, Cédric Le Goater, 2017/10/29
- [Qemu-ppc] [PATCH 6/8] sparp: merge ics_set_irq_type() in irq_alloc_block() operation, Cédric Le Goater, 2017/10/29
- [Qemu-ppc] [PATCH 7/8] spapr: move spapr_ics_free() under irq_free_block() operation,
Cédric Le Goater <=
- [Qemu-ppc] [PATCH 8/8] spapr: use sPAPRMachineState in spapr_ics_* prototypes, Cédric Le Goater, 2017/10/29