From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: Alexander Graf <agraf@suse.de>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 6/6] xics: implement xics_ics_free()
Date: Fri, 09 May 2014 12:13:18 +1000 [thread overview]
Message-ID: <536C39BE.3020608@ozlabs.ru> (raw)
In-Reply-To: <536B7376.8020807@suse.de>
On 05/08/2014 10:07 PM, Alexander Graf wrote:
> On 05/07/2014 08:01 AM, Alexey Kardashevskiy wrote:
>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>> ---
>> 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?
ics_reset() resets the interrupt state which still remains allocated and
assigned to some device. ics_free() clears the descriptor and this
interrupt may be now returned if someone asks for a new interrupt (pci
hotplug, intx->msi switch).
> 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
>
--
Alexey
prev parent reply other threads:[~2014-05-09 2:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-07 6:01 [Qemu-devel] [PATCH 0/6] move interrupts from spapr to xics Alexey Kardashevskiy
2014-05-07 6:01 ` [Qemu-devel] [PATCH 1/6] xics: add flags for interrupts Alexey Kardashevskiy
2014-05-07 13:09 ` Mike Day
2014-05-09 3:12 ` Alexey Kardashevskiy
2014-05-09 12:20 ` Mike Day
2014-05-08 11:52 ` Alexander Graf
2014-05-08 12:08 ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
2014-05-07 6:01 ` [Qemu-devel] [PATCH 2/6] xics: add find_server Alexey Kardashevskiy
2014-05-07 13:14 ` Mike Day
2014-05-07 6:01 ` [Qemu-devel] [PATCH 3/6] xics: disable flags reset on xics reset Alexey Kardashevskiy
2014-05-08 11:57 ` Alexander Graf
2014-05-07 6:01 ` [Qemu-devel] [PATCH 4/6] spapr: move interrupt allocator to xics Alexey Kardashevskiy
2014-05-07 6:01 ` [Qemu-devel] [PATCH 5/6] spapr: remove @next_irq Alexey Kardashevskiy
2014-05-07 6:01 ` [Qemu-devel] [PATCH 6/6] xics: implement xics_ics_free() Alexey Kardashevskiy
2014-05-08 12:07 ` Alexander Graf
2014-05-09 2:13 ` Alexey Kardashevskiy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=536C39BE.3020608@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=agraf@suse.de \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).