From patchwork Sun Nov 9 15:10:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 5261251 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D97D39F295 for ; Sun, 9 Nov 2014 15:12:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1A7812015D for ; Sun, 9 Nov 2014 15:12:27 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3996820122 for ; Sun, 9 Nov 2014 15:12:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XnU7O-0005EF-3h; Sun, 09 Nov 2014 15:09:30 +0000 Received: from mga09.intel.com ([134.134.136.24]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XnU7D-0004od-Ge for linux-arm-kernel@lists.infradead.org; Sun, 09 Nov 2014 15:09:20 +0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 09 Nov 2014 07:07:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,346,1413270000"; d="scan'208";a="604933103" Received: from gerry-dev.bj.intel.com ([10.238.158.52]) by orsmga001.jf.intel.com with ESMTP; 09 Nov 2014 07:08:53 -0800 From: Jiang Liu To: Bjorn Helgaas , Benjamin Herrenschmidt , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "Rafael J. Wysocki" , Randy Dunlap , Yinghai Lu , Borislav Petkov , Grant Likely , Marc Zyngier , Yingjoe Chen , Matthias Brugger , Jiang Liu , Yijing Wang , Alexander Gordeev Subject: [RFC Part4 v1 08/17] PCI/MSI: Use irq_chip.irq_write_msi_msg() to share common code Date: Sun, 9 Nov 2014 23:10:30 +0800 Message-Id: <1415545839-28263-9-git-send-email-jiang.liu@linux.intel.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1415545839-28263-1-git-send-email-jiang.liu@linux.intel.com> References: <1415545839-28263-1-git-send-email-jiang.liu@linux.intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141109_070919_583234_8013A446 X-CRM114-Status: GOOD ( 15.08 ) X-Spam-Score: -5.3 (-----) Cc: Tony Luck , Konrad Rzeszutek Wilk , Greg Kroah-Hartman , Joerg Roedel , x86@kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org, Andrew Morton , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, UNPARSEABLE_RELAY, URIBL_RHS_DOB autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Change PCI MSI code to use irq_chip.irq_write_msi_msg() to share more common code later. Signed-off-by: Jiang Liu --- drivers/pci/msi.c | 24 ++++++------------------ include/linux/msi.h | 3 +++ 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index b811739b43c5..cc6207e3b6bc 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -1111,7 +1111,7 @@ int msi_domain_set_affinity(struct irq_data *data, const struct cpumask *mask, ret = parent->chip->irq_set_affinity(parent, mask, force); if (ret >= 0 && ret != IRQ_SET_MASK_OK_DONE) { irq_chip_compose_msi_msg(data, &msg); - __write_msi_msg(data->msi_desc, &msg); + irq_chip_write_msi_msg(data, &msg); } return ret; @@ -1177,32 +1177,20 @@ static void msi_domain_free(struct irq_domain *domain, unsigned int virq, irq_domain_free_irqs_top(domain, virq, nr_irqs); } -static void msi_domain_activate(struct irq_domain *domain, - struct irq_data *irq_data) +void msi_domain_activate(struct irq_domain *domain, struct irq_data *irq_data) { struct msi_msg msg; - /* - * irq_data->chip_data is MSI/MSI-X offset. - * MSI-X message is written per-IRQ, the offset is always 0. - * MSI message denotes a contiguous group of IRQs, written for 0th IRQ. - */ - if (irq_data->chip_data) - return; - BUG_ON(irq_chip_compose_msi_msg(irq_data, &msg)); - __write_msi_msg(irq_data->msi_desc, &msg); + irq_chip_write_msi_msg(irq_data, &msg); } -static void msi_domain_deactivate(struct irq_domain *domain, - struct irq_data *irq_data) +void msi_domain_deactivate(struct irq_domain *domain, struct irq_data *irq_data) { struct msi_msg msg; - if (!irq_data->chip_data) { - memset(&msg, 0, sizeof(msg)); - __write_msi_msg(irq_data->msi_desc, &msg); - } + memset(&msg, 0, sizeof(msg)); + irq_chip_write_msi_msg(irq_data, &msg); } static struct irq_domain_ops msi_domain_ops = { diff --git a/include/linux/msi.h b/include/linux/msi.h index 312197f64070..bd0f9d8c6fe1 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -81,6 +81,9 @@ struct irq_chip; int msi_domain_set_affinity(struct irq_data *data, const struct cpumask *mask, bool force); +void msi_domain_activate(struct irq_domain *domain, struct irq_data *irq_data); +void msi_domain_deactivate(struct irq_domain *domain, + struct irq_data *irq_data); struct irq_domain *msi_create_irq_domain(struct device_node *of_node, struct irq_chip *chip, struct irq_domain *parent);