From patchwork Thu Jun 11 16:22:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jake Oshins X-Patchwork-Id: 6589751 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0B89DC0020 for ; Thu, 11 Jun 2015 16:31:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1496120631 for ; Thu, 11 Jun 2015 16:31:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 25DF12062A for ; Thu, 11 Jun 2015 16:31:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755145AbbFKQbp (ORCPT ); Thu, 11 Jun 2015 12:31:45 -0400 Received: from o1.f.az.sendgrid.net ([208.117.55.132]:17939 "EHLO o1.f.az.sendgrid.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754967AbbFKQa5 (ORCPT ); Thu, 11 Jun 2015 12:30:57 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:cc:subject:in-reply-to:references; s=smtpapi; bh=RTxYCTKwStZVPaS/VjguBoWY23o=; b=xlVxOSGh4OVkv44bJyaGlqPYVuEYj +xaN20ALjbyLzhe0w+9YooAIhrItMv56iyj3kS+P+Bso9ofcmweTrNrZVgtCW4H3 8HKbe+cnhoXORGBE8m4lrBrbHEfIznYK6ZeTfq1RluCL7NBv8TQ73YCWnKwwBF5k FO6xvWCYDqxTew= Received: by filter-476.sjc1.sendgrid.net with SMTP id filter-476.9052.5579B61B9 2015-06-11 16:23:55.249441109 +0000 UTC Received: from jakeoshinsu2.jakeoshinsu2.d1.internal.cloudapp.net (unknown [104.210.40.47]) by ismtpd-049 (SG) with ESMTP id 14de36f5a26.4707.56f59 Thu, 11 Jun 2015 16:23:55 +0000 (UTC) From: jakeo@microsoft.com To: gregkh@linuxfoundation.org, kys@microsoft.com, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com, linux-pci@vger.kernel.org, bhelgaas@google.com, mebersol@microsoft.com, haiyangz@microsoft.com Cc: Jake Oshins Subject: [PATCH 4/6] drivers:hv: Export a function that maps Linux proc num onto Hyper-V proc num Date: Thu, 11 Jun 2015 16:22:25 +0000 Message-Id: <1434039747-44535-5-git-send-email-jakeo@microsoft.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1434039747-44535-1-git-send-email-jakeo@microsoft.com> References: <1434039747-44535-1-git-send-email-jakeo@microsoft.com> X-SG-EID: lfnueJVzSjg1mfuVqqukVH7tZvRy9mfCIcBnfbfzaMNLVSAQx+U2XNA0W2Qy3CvXfd+hLvQQL9lYF9 WYjHJ+IfUI8Zrt3ePY7d46VFlB/LeUI/4Qj3Fxi9PNhFaI937gZZWxm+mPUf7XLKroN2up7KOvXFP7 kbNDfC6sQU30+l8= Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY, URIBL_GREY autolearn=ham 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 From: Jake Oshins Signed-off-by: Jake Oshins --- drivers/hv/vmbus_drv.c | 16 ++++++++++++++++ include/linux/hyperv.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 067a469..65e4eb6 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -1158,6 +1158,22 @@ int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj, } EXPORT_SYMBOL_GPL(vmbus_allocate_mmio); +/** + * 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. + * + * @param procnum - in Linux terms + * + * @return int - in Hyper-V terms + */ +int vmbus_procnum_to_vpnum(int procnum) +{ + return hv_context.vp_index[procnum]; +} +EXPORT_SYMBOL_GPL(vmbus_procnum_to_vpnum); + 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 ffd98d7..6fec42d 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -987,6 +987,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_procnum_to_vpnum(int procnum); + /** * VMBUS_DEVICE - macro used to describe a specific hyperv vmbus device *