From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Whuvt-00034Z-JL for qemu-devel@nongnu.org; Wed, 07 May 2014 02:02:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Whuvj-0002Gh-At for qemu-devel@nongnu.org; Wed, 07 May 2014 02:02:21 -0400 Received: from e23smtp06.au.ibm.com ([202.81.31.148]:57429) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Whuvi-0002FN-Gx for qemu-devel@nongnu.org; Wed, 07 May 2014 02:02:11 -0400 Received: from /spool/local by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 7 May 2014 16:02:06 +1000 From: Alexey Kardashevskiy Date: Wed, 7 May 2014 16:01:58 +1000 Message-Id: <1399442518-26303-7-git-send-email-aik@ozlabs.ru> In-Reply-To: <1399442518-26303-1-git-send-email-aik@ozlabs.ru> References: <1399442518-26303-1-git-send-email-aik@ozlabs.ru> Subject: [Qemu-devel] [PATCH 6/6] xics: implement xics_ics_free() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexey Kardashevskiy , qemu-ppc@nongnu.org, Alexander Graf Signed-off-by: Alexey Kardashevskiy --- hw/intc/xics.c | 24 ++++++++++++++++++++++++ include/hw/ppc/xics.h | 1 + trace-events | 2 ++ 3 files changed, 27 insertions(+) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index faf304c..2316519 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -755,6 +755,30 @@ int xics_alloc_block(XICSState *icp, int server, int num, bool lsi, bool align) return first + ics->offset; } +static void ics_free(ICSState *ics, int srcno, int num) +{ + int i; + + for (i = srcno; i < srcno + num; ++i) { + if (ICS_IRQ_FREE(ics, i)) { + trace_xics_ics_free_warn(ics - ics->icp->ics, i + ics->offset); + } + memset(&ics->irqs[i], 0, sizeof(ICSIRQState)); + } +} + +void xics_free(XICSState *icp, int server, int irq, int num) +{ + ICSState *ics = &icp->ics[server]; + + assert(server == 0); + + trace_xics_ics_free(ics - icp->ics, irq, num); + if (server >= 0) { + ics_free(ics, irq - ics->offset, num); + } +} + /* * Guest interfaces */ diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 0f01a21..e5d8f47 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -158,6 +158,7 @@ struct ICSIRQState { qemu_irq xics_get_qirq(XICSState *icp, int irq); int xics_alloc(XICSState *icp, int server, int irq_hint, bool lsi); int xics_alloc_block(XICSState *icp, int server, int num, bool lsi, bool align); +void xics_free(XICSState *icp, int server, int irq, int num); void xics_cpu_setup(XICSState *icp, PowerPCCPU *cpu); diff --git a/trace-events b/trace-events index 8cf8fb2..5ca126c 100644 --- a/trace-events +++ b/trace-events @@ -1179,6 +1179,8 @@ xics_alloc(int server, int irq) "server#%d, irq %d" xics_alloc_failed_hint(int server, int irq) "server#%d, irq %d is already in use" xics_alloc_failed_no_left(int server) "server#%d, no irq left" xics_alloc_block(int server, int first, int num, bool lsi, int align) "server#%d, first irq %d, %d irqs, lsi=%d, alignnum %d" +xics_ics_free(int server, int irq, int num) "server#%d, first irq %d, %d irqs" +xics_ics_free_warn(int server, int irq) "server#%d, irq %d is already free" # hw/ppc/spapr_iommu.c spapr_iommu_put(uint64_t liobn, uint64_t ioba, uint64_t tce, uint64_t ret) "liobn=%"PRIx64" ioba=0x%"PRIx64" tce=0x%"PRIx64" ret=%"PRId64 -- 1.8.4.rc4