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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 11 Jun 2015 16:22:24 +0000
From:	jakeo@...rosoft.com
To:	gregkh@...uxfoundation.org, kys@...rosoft.com,
	linux-kernel@...r.kernel.org, devel@...uxdriverproject.org,
	olaf@...fle.de, apw@...onical.com, vkuznets@...hat.com,
	linux-pci@...r.kernel.org, bhelgaas@...gle.com,
	mebersol@...rosoft.com, haiyangz@...rosoft.com
Cc:	Jake Oshins <jakeo@...rosoft.com>
Subject: [PATCH 3/6] arch:x86:hv: Add mechanism for Hyper-V paravirt drivers to hook msi message creation

From: Jake Oshins <jakeo@...rosoft.com>

Signed-off-by: Jake Oshins <jakeo@...rosoft.com>
---
 arch/x86/include/asm/mshyperv.h |  2 ++
 arch/x86/kernel/cpu/mshyperv.c  | 30 ++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index c163215..bf7789e 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -19,5 +19,7 @@ void hyperv_callback_vector(void);
 void hyperv_vector_handler(struct pt_regs *regs);
 void hv_setup_vmbus_irq(void (*handler)(void));
 void hv_remove_vmbus_irq(void);
+void hyperv_install_interrupt_translation(struct x86_msi_ops *new_ops);
+void hyperv_uninstall_interrupt_translation(void);
 
 #endif
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 939155f..816e329 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -69,6 +69,36 @@ void hv_remove_vmbus_irq(void)
 }
 EXPORT_SYMBOL_GPL(hv_setup_vmbus_irq);
 EXPORT_SYMBOL_GPL(hv_remove_vmbus_irq);
+
+struct x86_msi_ops old_msi_ops;
+
+void hyperv_install_interrupt_translation(struct x86_msi_ops *new_ops)
+{
+	old_msi_ops.setup_msi_irqs = xchg(&(x86_msi.setup_msi_irqs),
+					  new_ops->setup_msi_irqs);
+	old_msi_ops.compose_msi_msg = xchg(&(x86_msi.compose_msi_msg),
+					   new_ops->compose_msi_msg);
+	old_msi_ops.teardown_msi_irqs = xchg(&(x86_msi.teardown_msi_irqs),
+					     new_ops->teardown_msi_irqs);
+	old_msi_ops.restore_msi_irqs = xchg(&(x86_msi.restore_msi_irqs),
+					    new_ops->restore_msi_irqs);
+
+	new_ops->setup_msi_irqs = old_msi_ops.setup_msi_irqs;
+	new_ops->compose_msi_msg = old_msi_ops.compose_msi_msg;
+	new_ops->teardown_msi_irqs = old_msi_ops.teardown_msi_irqs;
+	new_ops->restore_msi_irqs = old_msi_ops.restore_msi_irqs;
+}
+EXPORT_SYMBOL_GPL(hyperv_install_interrupt_translation);
+
+void hyperv_uninstall_interrupt_translation(void)
+{
+	xchg(&(x86_msi.setup_msi_irqs), old_msi_ops.setup_msi_irqs);
+	xchg(&(x86_msi.compose_msi_msg), old_msi_ops.compose_msi_msg);
+	xchg(&(x86_msi.teardown_msi_irqs), old_msi_ops.teardown_msi_irqs);
+	xchg(&(x86_msi.restore_msi_irqs), old_msi_ops.restore_msi_irqs);
+}
+EXPORT_SYMBOL_GPL(hyperv_uninstall_interrupt_translation);
+
 #endif
 
 static uint32_t  __init ms_hyperv_platform(void)
-- 
1.9.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