Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935738AbcLTQml (ORCPT ); Tue, 20 Dec 2016 11:42:41 -0500 Received: from mail-db5eur01on0095.outbound.protection.outlook.com ([104.47.2.95]:63121 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753177AbcLTQmL (ORCPT ); Tue, 20 Dec 2016 11:42:11 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; From: Roman Kagan To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , "K. Y. Srinivasan" , Vitaly Kuznetsov CC: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , , Haiyang Zhang , , , , "Denis V . Lunev" , Roman Kagan Subject: [PATCH 13/15] hyperv: move function close to its only callsite Date: Tue, 20 Dec 2016 18:56:00 +0300 Message-ID: <20161220155602.6298-14-rkagan@virtuozzo.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161220155602.6298-1-rkagan@virtuozzo.com> References: <20161220155602.6298-1-rkagan@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [195.214.232.10] X-ClientProxiedBy: AM4PR01CA0030.eurprd01.prod.exchangelabs.com (10.164.74.168) To VI1PR0802MB2478.eurprd08.prod.outlook.com (10.175.26.21) X-MS-Office365-Filtering-Correlation-Id: 26a2c5f4-cda2-44fb-160a-08d428f0d3f3 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:VI1PR0802MB2478; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0802MB2478;3:fTj/uPL8RQ9X2JUoqvCJPr5fZWHQjxQyLidT9QHckERX940jp8nhrZBOqDN+NpjoocO/FEuVFK1RLZ+l0UBAKf9ST82BXnq2+VN58uil8xDcZ2+gu0KRxaEAujLDQFrCgimDJmC3vL9FJfkDJClI0uNFnzkOMlclOlY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96p9kODOGin7NhCjL1TlMxs9R19vgSojZKonKn3EreoH/CX2qpNt9bAuIUOiX6gLF X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(176295241369792); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123564025)(20161123555025)(20161123560025)(20161123558021)(20161123562025)(6072148);SRVR:VI1PR0802MB2478;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0802MB2478; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0802MB2478;4:Daf3b1MWTxR3A83LGmTA+8RFmfyjcELaCHhFb6yqEcSMdejDZf8iSqMk6gohruY/+oN78KahTpnU9O7ljXfzS0kudkJUN5scqfZwUN8rRt+KM5FqGtiX/yZ1eH+q3vP8IEVippQTCpHFCLTX/M5WpFMzquKpeJbYN2MlNKfwG71GmjlWi3n8p9vGIEEshsunF/Ihc6NAZlvunfjH2n0B79DZNS4fPc/j7xqcfOiin7oE9u1O/nWLi90sMkm7aH9kvVH3Ee9ET6MxSNDxdx9VsTWrViu5VGqJI71N85welOr1K8gl+J4VFXCSzKJVaG9sYCBJtsHHKWGtxc1QGtOplIMJNbeAdV7w2fPJ2cL3fk23rJQyJyWRjgyevU2IWH5GJ5Rz68ZPmCN9vAgQfaa5ugnfM6Db7WzM3WobLWcvQUctSzcLUs2L+KTE7Rvg0lt4WTs1kacbexOIwHTR24u1dBOHin0cpz01yPeOiCRiCg6s3GUYUgVwYyNkn7LGTKg6xoIqB3wiZNMqFp639ga6U8h5ipNL2fpmGZSDuygghjwch7rEHznfAOzduAJ7FrA4l0XoVyTpI6vTQ/jDahtiKERpAZdN6uYN13/b5SJz11TcoNaK8SejYqbazfFVqAdd9Ofs4myekYBBMkSg3JTDeQ== X-Forefront-PRVS: 0162ACCC24 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(7916002)(39450400003)(199003)(3905003)(189002)(6666003)(97736004)(189998001)(101416001)(5001770100001)(4001430100002)(5003940100001)(36756003)(81166006)(47776003)(50986999)(66066001)(1511001)(2950100002)(50466002)(76176999)(5660300001)(81156014)(2906002)(8666005)(305945005)(69596002)(48376002)(7736002)(92566002)(7416002)(106356001)(53416004)(25786008)(6116002)(105586002)(6486002)(2421001)(6506006)(1076002)(3846002)(575784001)(86362001)(4326007)(68736007)(8676002)(50226002)(42186005)(107886002)(2561002)(38730400001)(6512006)(33646002);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR0802MB2478;H:rkaganb.sw.ru;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;VI1PR0802MB2478;23:nfoPrjm2/TcofO3bqepkJCxmE8Ln5jx1mt+fUxw?= =?us-ascii?Q?NTaYM6SEMB9a9miLlmP+L+uuZRPT+A6Xf1DRAKqTzqp/lddrCw41vbmDezDF?= =?us-ascii?Q?bUVYyL43APNhajdmw862zOViNn7FkvhGabIM9YdBc5TsMHk6tZ542gIh8hch?= =?us-ascii?Q?YQGApTAH79jGKUSJpor7WME7h2cPb0phsiE2e2nt9nsESDILv90UB7bMcPnu?= =?us-ascii?Q?hMuZ7ooElF7KsG0mgp9n46PFK7GxxReUI3xGZE860yw0HsUzrYWEoUI529Ar?= =?us-ascii?Q?9TJC7TPn9Z6YBf/e/sYSzXYEG+XpiiGSy8IhS93SakdwRCUAiaHeuwJb8xYu?= =?us-ascii?Q?VQXJt5mgADY9SbZFR0XMaL1T4RlVXq3HOexqr/NKsbdzaVb29+ImAukLQypu?= =?us-ascii?Q?J2a/cWQDSAOo7VbDnG5iXh5oZ2XQkNnhUNVl5TUImYLhb0kNR5oSw2cnf+Me?= =?us-ascii?Q?s9wKH/kATG4JTxkduFjagXXJkmot7p+pERowhilf9FT3IzSDyaZqcaAlt/IG?= =?us-ascii?Q?Ybl0Hx3k/JKXstv5I2by1MM2Cuu47aJPKMec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bqf3pS4zDh6sjsUMtJzUzsfeYkv7r+ZHC/QaOaxXER3G/3tF6W5XF//PmGGG4crS8UBp/LvoTDKMw5sCQjE8DVD3NL5J+8VzrQ==;20:Kz2CAQZZgzRrGYTlPOW4GIfu0yaurPnaEuqTSPDyME7A7hFJmNLv4x0pb7iH2OlImelC21FGYNymSSLXwJzfKl9ox7FM1Q2owTUrDJygNNPw2K7sY09fotTn31wheKjVrCytmQxh5opA6IVr/DFm7Kwr4nXNwlrYr4z14LHSn34= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2016 15:56:56.9069 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2478 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3424 Lines: 113 Signed-off-by: Roman Kagan --- drivers/hv/hyperv_vmbus.h | 44 -------------------------------------------- drivers/hv/hv.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 44 deletions(-) diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h index c0a65f7..fcb5d91 100644 --- a/drivers/hv/hyperv_vmbus.h +++ b/drivers/hv/hyperv_vmbus.h @@ -118,50 +118,6 @@ enum hv_guest_os_microsoft_ids { #define HV_PRESENT_BIT 0x80000000 -/* - * The guest OS needs to register the guest ID with the hypervisor. - * The guest ID is a 64 bit entity and the structure of this ID is - * specified in the Hyper-V specification: - * - * http://msdn.microsoft.com/en-us/library/windows/hardware/ff542653%28v=vs.85%29.aspx - * - * While the current guideline does not specify how Linux guest ID(s) - * need to be generated, our plan is to publish the guidelines for - * Linux and other guest operating systems that currently are hosted - * on Hyper-V. The implementation here conforms to this yet - * unpublished guidelines. - * - * - * Bit(s) - * 63 - Indicates if the OS is Open Source or not; 1 is Open Source - * 62:56 - Os Type; Linux is 0x100 - * 55:48 - Distro specific identification - * 47:16 - Linux kernel version number - * 15:0 - Distro specific identification - * - * - */ - -#define HV_LINUX_VENDOR_ID 0x8100 - -/* - * Generate the guest ID based on the guideline described above. - */ - -static inline __u64 generate_guest_id(__u8 d_info1, __u32 kernel_version, - __u16 d_info2) -{ - __u64 guest_id = 0; - - guest_id = (((__u64)HV_LINUX_VENDOR_ID) << 48); - guest_id |= (((__u64)(d_info1)) << 48); - guest_id |= (((__u64)(kernel_version)) << 16); - guest_id |= ((__u64)(d_info2)); - - return guest_id; -} - - #define HV_CPU_POWER_MANAGEMENT (1 << 0) #define HV_RECOMMENDATIONS_MAX 4 diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c index b9f50de..3598090 100644 --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c @@ -45,6 +45,45 @@ struct hv_context hv_context = { #define HV_MIN_DELTA_TICKS 1 /* + * The guest OS needs to register the guest ID with the hypervisor. + * The guest ID is a 64 bit entity and the structure of this ID is + * specified in the Hyper-V specification: + * + * http://msdn.microsoft.com/en-us/library/windows/hardware/ff542653%28v=vs.85%29.aspx + * + * While the current guideline does not specify how Linux guest ID(s) + * need to be generated, our plan is to publish the guidelines for + * Linux and other guest operating systems that currently are hosted + * on Hyper-V. The implementation here conforms to this yet + * unpublished guidelines. + * + * Bit(s) + * 63 - Indicates if the OS is Open Source or not; 1 is Open Source + * 62:56 - Os Type; Linux is 0x100 + * 55:48 - Distro specific identification + * 47:16 - Linux kernel version number + * 15:0 - Distro specific identification + */ + +#define HV_LINUX_VENDOR_ID 0x8100 + +/* + * Generate the guest ID based on the guideline described above. + */ + +static u64 generate_guest_id(u8 d_info1, u32 kernel_version, u16 d_info2) +{ + u64 guest_id; + + guest_id = ((u64)HV_LINUX_VENDOR_ID) << 48; + guest_id |= ((u64)d_info1) << 48; + guest_id |= ((u64)kernel_version) << 16; + guest_id |= (u64)d_info2; + + return guest_id; +} + +/* * query_hypervisor_info - Get version info of the windows hypervisor */ unsigned int host_info_eax; -- 2.9.3