Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1288758

[PATCH v10 1/7] drivers:hv: Export a function that maps Linux CPU num onto Hyper-V proc num

Path csiph.com!news.mixmin.net!weretis.net!feeder4.news.weretis.net!storethat.news.telefonica.de!telefonica.de!news.panservice.it!bofh.it!news.nic.it!robomod
From jakeo@microsoft.com
Newsgroups linux.kernel
Subject [PATCH v10 1/7] drivers:hv: Export a function that maps Linux CPU num onto Hyper-V proc num
Date Thu, 10 Dec 2015 19:00:04 +0100
Message-ID <qEdFy-VS-43@gated-at.bofh.it> (permalink)
References <qEdFw-VS-3@gated-at.bofh.it>
X-Original-To gregkh@linuxfoundation.org, kys@microsoft.com, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com, tglx@linutronix.de, haiyangz@microsoft.com, marc.zyngier@arm.com, bhelgaas@google.com, linux-pci@vger.kernel.org
Dkim-Signature v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:cc:subject:in-reply-to:references; s=smtpapi; bh=FyDgv9jdcSDBLoiiOxXHlzp0AYs=; b=kDsC5fVa3Y3jIKFmKSQ/AAi4U68yG D/EeDdb0Aqza6eNcd+QmoT8mg+qjPD2x9Je4C8zBkCoO/dee/LgHMd3uATgrWNrR nS2zSwriUyLBJv1fHrTTA0tquXta9mhO3Lyp/aArcMqSmB/FUGeQxLxZfmwqdp+9 Su4wO3rZHyiAsQ=
X-Mailer git-send-email 1.9.1
X-Sg-Eid UsLXQ589HNP4HLBydmD9pgHURQozLYm9XliudupI8YsytVPzDS06Xe+zeiZw/sOog7QHC6olP4cZbR To4Gm28vWS1yffbvIHPjBeq45nSacjnd8ZKKN0zfz7iZENQaO939TLW1CdK96E5Xl4nEBQfE5mROnh +KJWrPC2yh4YTRkhPAhnR0Ij96zY/q1+l1e7LgWhUkmLlLssZfKrxcM7CA==
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 62
Organization linux.* mail to news gateway
X-Original-Cc Jake Oshins <jakeo@microsoft.com>
X-Original-Date Thu, 10 Dec 2015 17:52:57 +0000
X-Original-Message-ID <1449769983-12948-2-git-send-email-jakeo@microsoft.com>
X-Original-References <1449769983-12948-1-git-send-email-jakeo@microsoft.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1288758

Show key headers only | View raw


From: Jake Oshins <jakeo@microsoft.com>

This patch exposes the mapping between Linux CPU number and Hyper-V
virtual processor number. This is necessary because the hypervisor needs
to know which virtual processor to target when making a mapping in the
Interrupt Redirection Table in the I/O MMU.

Signed-off-by: Jake Oshins <jakeo@microsoft.com>
---
 drivers/hv/vmbus_drv.c | 17 +++++++++++++++++
 include/linux/hyperv.h |  2 ++
 2 files changed, 19 insertions(+)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index f19b6f7..c89d0e5 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1191,6 +1191,23 @@ int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj,
 }
 EXPORT_SYMBOL_GPL(vmbus_allocate_mmio);
 
+/**
+ * vmbus_cpu_number_to_vp_number() - Map CPU to VP.
+ * @cpu_number: CPU number in Linux terms
+ *
+ * This function returns the mapping between the Linux processor
+ * number and the hypervisor's virtual processor number, useful
+ * in making hypercalls and such that talk about specific
+ * processors.
+ *
+ * Return: Virtual processor number in Hyper-V terms
+ */
+int vmbus_cpu_number_to_vp_number(int cpu_number)
+{
+	return hv_context.vp_index[cpu_number];
+}
+EXPORT_SYMBOL_GPL(vmbus_cpu_number_to_vp_number);
+
 static int vmbus_acpi_add(struct acpi_device *device)
 {
 	acpi_status result;
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 8fdc17b..fddb3e0 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -983,6 +983,8 @@ int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj,
 			resource_size_t size, resource_size_t align,
 			bool fb_overlap_ok);
 
+int vmbus_cpu_number_to_vp_number(int cpu_number);
+
 /**
  * VMBUS_DEVICE - macro used to describe a specific hyperv vmbus device
  *
-- 
1.9.1

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

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v10 0/7] PCI: hv: New paravirtual PCI front-end for Hyper-V VMs jakeo@microsoft.com - 2015-12-10 19:00 +0100
  [PATCH v10 3/7] PCI: Make it possible to implement a PCI MSI IRQ Domain in a module. jakeo@microsoft.com - 2015-12-10 19:00 +0100
    Re: [PATCH v10 3/7] PCI: Make it possible to implement a PCI MSI  IRQ Domain in a module. Marc Zyngier <marc.zyngier@arm.com> - 2015-12-10 19:20 +0100
  [PATCH v10 4/7] PCI: Add fwnode_handle to pci_sysdata jakeo@microsoft.com - 2015-12-10 19:00 +0100
    Re: [PATCH v10 4/7] PCI: Add fwnode_handle to pci_sysdata Marc Zyngier <marc.zyngier@arm.com> - 2015-12-10 19:20 +0100
  [PATCH v10 1/7] drivers:hv: Export a function that maps Linux CPU num onto Hyper-V proc num jakeo@microsoft.com - 2015-12-10 19:00 +0100
  [PATCH v10 5/7] PCI: irqdomain: Look up IRQ domain by fwnode_handle jakeo@microsoft.com - 2015-12-10 19:00 +0100
    Re: [PATCH v10 5/7] PCI: irqdomain: Look up IRQ domain by fwnode_handle Marc Zyngier <marc.zyngier@arm.com> - 2015-12-10 19:20 +0100

csiph-web