From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiN6n-0006Ho-2W for qemu-devel@nongnu.org; Thu, 08 May 2014 08:07:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WiN6g-00087V-Qt for qemu-devel@nongnu.org; Thu, 08 May 2014 08:07:29 -0400 Message-ID: <536B7376.8020807@suse.de> Date: Thu, 08 May 2014 14:07:18 +0200 From: Alexander Graf MIME-Version: 1.0 References: <1399442518-26303-1-git-send-email-aik@ozlabs.ru> <1399442518-26303-7-git-send-email-aik@ozlabs.ru> In-Reply-To: <1399442518-26303-7-git-send-email-aik@ozlabs.ru> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 6/6] xics: implement xics_ics_free() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org On 05/07/2014 08:01 AM, Alexey Kardashevskiy wrote: > 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)); Why does this do something different from ics_reset? Alex > + } > +} > + > +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