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  linux-cve-announce  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]
Message-Id: <1414635488-14137-7-git-send-email-cernekee@gmail.com>
Date:	Wed, 29 Oct 2014 19:17:59 -0700
From:	Kevin Cernekee <cernekee@...il.com>
To:	arnd@...db.de, f.fainelli@...il.com, tglx@...utronix.de,
	jason@...edaemon.net, ralf@...ux-mips.org, lethal@...ux-sh.org
Cc:	linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
	mbizon@...ebox.fr, jogo@...nwrt.org, linux-mips@...ux-mips.org
Subject: [PATCH V2 06/15] genirq: Generic chip: Optimize for fixed-endian systems

Allow the compiler to inline an LE MMIO access if the configuration only
supports LE registers, or a BE MMIO access if the configuration only
supports BE registers.  If the configuration supports both (possibly
a multiplatform kernel) then make the decision at runtime.

Signed-off-by: Kevin Cernekee <cernekee@...il.com>
---
 kernel/irq/Kconfig        |  5 +++++
 kernel/irq/Makefile       |  1 +
 kernel/irq/generic-chip.c | 10 +++++++++-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/Kconfig b/kernel/irq/Kconfig
index 225086b..6283c8c 100644
--- a/kernel/irq/Kconfig
+++ b/kernel/irq/Kconfig
@@ -51,6 +51,11 @@ config GENERIC_IRQ_CHIP
        bool
        select IRQ_DOMAIN
 
+# Same as above, but use big-endian MMIO accesses
+config GENERIC_IRQ_CHIP_BE
+       bool
+       select IRQ_DOMAIN
+
 # Generic irq_domain hw <--> linux irq number translation
 config IRQ_DOMAIN
 	bool
diff --git a/kernel/irq/Makefile b/kernel/irq/Makefile
index fff1738..34c2b0f 100644
--- a/kernel/irq/Makefile
+++ b/kernel/irq/Makefile
@@ -1,6 +1,7 @@
 
 obj-y := irqdesc.o handle.o manage.o spurious.o resend.o chip.o dummychip.o devres.o
 obj-$(CONFIG_GENERIC_IRQ_CHIP) += generic-chip.o
+obj-$(CONFIG_GENERIC_IRQ_CHIP_BE) += generic-chip.o
 obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o
 obj-$(CONFIG_IRQ_DOMAIN) += irqdomain.o
 obj-$(CONFIG_PROC_FS) += proc.o
diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c
index c1890bb..457ea48 100644
--- a/kernel/irq/generic-chip.c
+++ b/kernel/irq/generic-chip.c
@@ -9,6 +9,7 @@
 #include <linux/export.h>
 #include <linux/irqdomain.h>
 #include <linux/interrupt.h>
+#include <linux/kconfig.h>
 #include <linux/kernel_stat.h>
 #include <linux/syscore_ops.h>
 
@@ -19,7 +20,14 @@ static DEFINE_RAW_SPINLOCK(gc_lock);
 
 static int is_big_endian(struct irq_chip_generic *gc)
 {
-	return !!(gc->domain->gc->gc_flags & IRQ_GC_BE_IO);
+	if (IS_ENABLED(CONFIG_GENERIC_IRQ_CHIP) &&
+	    !IS_ENABLED(CONFIG_GENERIC_IRQ_CHIP_BE))
+		return 0;
+	else if (IS_ENABLED(CONFIG_GENERIC_IRQ_CHIP_BE) &&
+		 !IS_ENABLED(CONFIG_GENERIC_IRQ_CHIP))
+		return 1;
+	else
+		return !!(gc->domain->gc->gc_flags & IRQ_GC_BE_IO);
 }
 
 static void irq_reg_writel(struct irq_chip_generic *gc,
-- 
2.1.1

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ