From patchwork Tue Jul 10 13:46:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 170183 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2F34C2C0207 for ; Tue, 10 Jul 2012 23:47:19 +1000 (EST) Received: from localhost ([::1]:41182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Soamb-0001Cq-2j for incoming@patchwork.ozlabs.org; Tue, 10 Jul 2012 09:47:17 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Soalz-0008Av-JB for qemu-devel@nongnu.org; Tue, 10 Jul 2012 09:46:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Soalx-00015l-7E for qemu-devel@nongnu.org; Tue, 10 Jul 2012 09:46:39 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:34715) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Soalx-00014e-0Z for qemu-devel@nongnu.org; Tue, 10 Jul 2012 09:46:37 -0400 Received: by mail-pb0-f45.google.com with SMTP id ro12so335205pbb.4 for ; Tue, 10 Jul 2012 06:46:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=E3MngvgxOAquHGvV1i+R1LD/foojGA7BWLEetBqhO2M=; b=PX5nIN3xYfBugCZQo1nPPGg4kRgN11tFVP5xxC0WrbDVeUEUA/AbU2IU26H+hT5Jvw JczJTR+oXNkeyCwXY90rd5J4Wt97a4yBrDEhwk73BfOSA3YNRwUKXdbD6+ygkVBCK1Tc KjeP5jIdC0so1fll77lTRK2qWxpipgeLPl2f967qXLvbhXu6cNC03FJQ7/nPb0qBQEyV 9QaqpMMEctiSBKn/cs/nnIjdnMmWJOzbE+i/HO+X5GmXfvcYijhvvS3p/pjQ8Juayo8Z G8COCjGEuOtQ1OKeTzVkYMhbNPJ2KQpdSEFATNr5/tcMEAV1OoM0LdD4/P7JYnZevQ+Q OlNA== Received: by 10.68.189.104 with SMTP id gh8mr24324945pbc.152.1341927996083; Tue, 10 Jul 2012 06:46:36 -0700 (PDT) Received: from ka1.ozlabs.ibm.com (ibmaus65.lnk.telstra.net. [165.228.126.9]) by mx.google.com with ESMTPS id pz9sm8349748pbb.61.2012.07.10.06.46.33 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 10 Jul 2012 06:46:35 -0700 (PDT) From: Alexey Kardashevskiy To: Date: Tue, 10 Jul 2012 23:46:12 +1000 Message-Id: <1341927973-5615-5-git-send-email-aik@ozlabs.ru> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1341927973-5615-1-git-send-email-aik@ozlabs.ru> References: <1341927973-5615-1-git-send-email-aik@ozlabs.ru> X-Gm-Message-State: ALoCoQmiTAG9wJKefhAzykuf0tGlxTtNzfwd93GITh9Q56aJR25f1noJvM7Jckz2Gm30oYhXfk9W X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: Alexey Kardashevskiy , Jan Kiszka , qemu-devel@nongnu.org, Alexander Graf , qemu-ppc@nongnu.org, David Gibson Subject: [Qemu-devel] [PATCH] xics: added end-of-interrupt (EOI) handlers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Normally when the host driver gets called via interrupt, it disables IRQ first, then handles it and enables back. In the case of PCI pass through, the actual handling is done by the guest so the host driver needs to know when to enable IRQ back. The patch introduces add/remove callback API and EOI initialization for the XICS interrupt controller. Signed-off-by: Alexey Kardashevskiy --- hw/xics.c | 18 ++++++++++++++++++ hw/xics.h | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/hw/xics.c b/hw/xics.c index 668a0d6..de7833e 100644 --- a/hw/xics.c +++ b/hw/xics.c @@ -170,6 +170,7 @@ struct ics_irq_state { int sent:1; int rejected:1; int masked_pending:1; + NotifierList eoi_notifier; }; struct ics_state { @@ -309,6 +310,8 @@ static void ics_eoi(struct ics_state *ics, int nr) if (irq->type == XICS_LSI) { irq->sent = 0; } + + notifier_list_notify(&irq->eoi_notifier, NULL); } /* @@ -536,6 +539,7 @@ struct icp_state *xics_system_init(int nr_irqs) for (i = 0; i < nr_irqs; i++) { ics->irqs[i].priority = 0xff; ics->irqs[i].saved_priority = 0xff; + notifier_list_init(&ics->irqs[i].eoi_notifier); } ics->qirqs = qemu_allocate_irqs(ics_set_irq, ics, nr_irqs); @@ -552,3 +556,17 @@ struct icp_state *xics_system_init(int nr_irqs) return icp; } + +void xics_add_eoi_notifier(Notifier *notify, uint32_t srcno) +{ + struct ics_state *ics = spapr->icp->ics; + struct ics_irq_state *irq = &ics->irqs[srcno - ics->offset]; + + notifier_list_add(&irq->eoi_notifier, notify); +} + +void xics_remove_eoi_notifier(Notifier *notify) +{ + notifier_remove(notify); +} + diff --git a/hw/xics.h b/hw/xics.h index 2080159..762243c 100644 --- a/hw/xics.h +++ b/hw/xics.h @@ -27,6 +27,8 @@ #if !defined(__XICS_H__) #define __XICS_H__ +#include "notify.h" + #define XICS_IPI 0x2 struct icp_state; @@ -41,4 +43,7 @@ qemu_irq xics_assign_irq(struct icp_state *icp, int irq, struct icp_state *xics_system_init(int nr_irqs); +void xics_add_eoi_notifier(Notifier *notify, uint32_t srcno); +void xics_remove_eoi_notifier(Notifier *notify); + #endif /* __XICS_H__ */