lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun,  9 Nov 2014 23:10:30 +0800
From:	Jiang Liu <jiang.liu@...ux.intel.com>
To:	Bjorn Helgaas <bhelgaas@...gle.com>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	"Rafael J. Wysocki" <rjw@...ysocki.net>,
	Randy Dunlap <rdunlap@...radead.org>,
	Yinghai Lu <yinghai@...nel.org>,
	Borislav Petkov <bp@...en8.de>,
	Grant Likely <grant.likely@...aro.org>,
	Marc Zyngier <marc.zyngier@....com>,
	Yingjoe Chen <yingjoe.chen@...iatek.com>,
	Matthias Brugger <matthias.bgg@...il.com>,
	Jiang Liu <jiang.liu@...ux.intel.com>,
	Yijing Wang <wangyijing@...wei.com>,
	Alexander Gordeev <agordeev@...hat.com>
Cc:	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Tony Luck <tony.luck@...el.com>,
	Joerg Roedel <joro@...tes.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	x86@...nel.org, linux-kernel@...r.kernel.org,
	linux-pci@...r.kernel.org, linux-acpi@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org
Subject: [RFC Part4 v1 08/17] PCI/MSI: Use irq_chip.irq_write_msi_msg() to share common code

Change PCI MSI code to use irq_chip.irq_write_msi_msg() to share more
common code later.

Signed-off-by: Jiang Liu <jiang.liu@...ux.intel.com>
---
 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);
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists