From patchwork Tue Jul 10 13:46:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 170181 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 56D9E2C0203 for ; Tue, 10 Jul 2012 23:46:52 +1000 (EST) Received: from localhost ([::1]:38591 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoamA-0008E0-5C for incoming@patchwork.ozlabs.org; Tue, 10 Jul 2012 09:46:50 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52907) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Soalz-0008Ax-SU for qemu-devel@nongnu.org; Tue, 10 Jul 2012 09:46:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Soalp-00014W-Hg for qemu-devel@nongnu.org; Tue, 10 Jul 2012 09:46:39 -0400 Received: from mail-gh0-f173.google.com ([209.85.160.173]:63449) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Soalp-000148-Db for qemu-devel@nongnu.org; Tue, 10 Jul 2012 09:46:29 -0400 Received: by ghrr14 with SMTP id r14so12153244ghr.4 for ; Tue, 10 Jul 2012 06:46:27 -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=v7w37IvRAmjfpPfBa1NYkYm725UmgCtUymSTIpPaTes=; b=X7jXtKCNxhmhv4yghhiGIQEB8J8vtSuvN1FB8xQPrn4Fd5HSOdVhVe2qQk9SacvPzA KYutU35i6pzSjGvsNeyU9xibfFzFgqc7yOmLayitDRsq3vD8Fn6qEjKr5xN8aFXKINKJ XvPb6fYEzETnOg6xV0I4Yvo/v9JHD9Bd+PzFzB1eySfVswb2PHivFxYrhLLLd3IcGCmX t2UvtdfwVgtOLQKtrn7iRxFFDGXA68GEoXLmrSXz30uUnJxrNMOUYh3zOf51qxxk/ZnD T1FmwoLcDYu9Rg7gRm0ntBrlTkLZWCyC+Ydfps/q8F4otLL7Aw5BxtAyjr+heYCjgltz 9Vew== Received: by 10.66.83.69 with SMTP id o5mr73758633pay.34.1341927987314; Tue, 10 Jul 2012 06:46:27 -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.24 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 10 Jul 2012 06:46:26 -0700 (PDT) From: Alexey Kardashevskiy To: Date: Tue, 10 Jul 2012 23:46:09 +1000 Message-Id: <1341927973-5615-2-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: ALoCoQmPPC/bHpxj/rZg4yP1obya/8uMYTB+7va6olyY4eXoJ2Q27uHUysiJbveB6lxW/Wb/2Bsy X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.173 Cc: Alexey Kardashevskiy , qemu-devel@nongnu.org, Alexander Graf , qemu-ppc@nongnu.org, David Gibson Subject: [Qemu-devel] [PATCH] pseries pci: removed cached qemu_irq from PCI host bus 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 As it is a very quick operation to resolve qirq from IRQ number, it makes no sense to cache it anywhere but its original source i.e. XICS. Also, the upcoming support for MSIX is going to add much more IRQs per PHB. So we will have to cache them as well for consistency, and for that we will have to create an array of qemu_irq pointers. So it is simplier to keep only IRQ numbers (one per INTx line) and the first MSI IRQ number with vectors number (will be added later). Signed-off-by: Alexey Kardashevskiy --- hw/spapr_pci.c | 14 +++++--------- hw/spapr_pci.h | 1 - 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/hw/spapr_pci.c b/hw/spapr_pci.c index b3032d2..1318390 100644 --- a/hw/spapr_pci.c +++ b/hw/spapr_pci.c @@ -223,7 +223,9 @@ static void pci_spapr_set_irq(void *opaque, int irq_num, int level) */ sPAPRPHBState *phb = opaque; - qemu_set_irq(phb->lsi_table[irq_num].qirq, level); + qemu_set_irq(xics_assign_irq(spapr->icp, + phb->lsi_table[irq_num].dt_irq, XICS_LSI), + level); } static uint64_t spapr_io_read(void *opaque, target_phys_addr_t addr, @@ -329,16 +331,10 @@ static int spapr_phb_init(SysBusDevice *s) /* Initialize the LSI table */ for (i = 0; i < PCI_NUM_PINS; i++) { - qemu_irq qirq; - uint32_t num; - - qirq = spapr_allocate_lsi(0, &num); - if (!qirq) { + if (!spapr_allocate_lsi(0, &phb->lsi_table[i].dt_irq)) { + fprintf(stderr, "Failed to allocate LSI IRQ pin %u\n", i); return -1; } - - phb->lsi_table[i].dt_irq = num; - phb->lsi_table[i].qirq = qirq; } return 0; diff --git a/hw/spapr_pci.h b/hw/spapr_pci.h index dd66f4b..11c3ee1 100644 --- a/hw/spapr_pci.h +++ b/hw/spapr_pci.h @@ -41,7 +41,6 @@ typedef struct sPAPRPHBState { struct { uint32_t dt_irq; - qemu_irq qirq; } lsi_table[PCI_NUM_PINS]; QLIST_ENTRY(sPAPRPHBState) list;