From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934093AbdDGTiP (ORCPT ); Fri, 7 Apr 2017 15:38:15 -0400 Received: from mail-dm3nam03on0112.outbound.protection.outlook.com ([104.47.41.112]:35729 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933427AbdDGTiH (ORCPT ); Fri, 7 Apr 2017 15:38:07 -0400 From: Jork Loeser To: Vitaly Kuznetsov , "devel@linuxdriverproject.org" , "x86@kernel.org" CC: "linux-kernel@vger.kernel.org" , "KY Srinivasan" , Haiyang Zhang , Stephen Hemminger , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Steven Rostedt Subject: RE: [PATCH 1/7] x86/hyperv: make hv_do_hypercall() inline Thread-Topic: [PATCH 1/7] x86/hyperv: make hv_do_hypercall() inline Thread-Index: AQHSr5Hn2qhR/z58M065PZIGsBH4faG6S5sw Date: Fri, 7 Apr 2017 19:38:03 +0000 Message-ID: References: <20170407112701.17157-1-vkuznets@redhat.com> <20170407112701.17157-2-vkuznets@redhat.com> In-Reply-To: <20170407112701.17157-2-vkuznets@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=microsoft.com; x-originating-ip: [2001:4898:80e8:4::1f] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MWHPR21MB0637;7:JIidcZKlIGg/lFa5tWH8ar/90BAF46ChHArhcP+/g1waK4aolM8iCvPh24l9kZOTyuxfgAsyPbq7tgvEZAWS3iTxBhLTGzzDEkOedLent+f5PyoPgp6XV7DK85brhvAGtGDZ20fiPQMq4JmW/PiK5lHLN2cAfLC24oKvm0H6hWaM/65fPuZtB9eI/nJm3alpdiZWllF5hFkS6vNHyGZK7dKKv9SmBwcP6Sw8TSZ9Ahbin+R4h0CDJ32QxN/9lyvc57uCtlkkus4tHjNjlf2pueE0GOUT0Q0TOfmaULiNYw8Qyo2wchfJM8Z4xUinjqDA/7T2SQcViAO/sc06gP+Esxjl8BUlGC8S9oxkUgjd44U= x-ms-office365-filtering-correlation-id: 087b629c-3a2e-4404-d9b0-08d47ded9bd8 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081);SRVR:MWHPR21MB0637; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(9452136761055); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(6055026)(61426038)(61427038)(6041248)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(6072148);SRVR:MWHPR21MB0637;BCL:0;PCL:0;RULEID:;SRVR:MWHPR21MB0637; x-forefront-prvs: 0270ED2845 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39400400002)(39850400002)(39840400002)(39410400002)(39860400002)(39450400003)(13464003)(2906002)(33656002)(3660700001)(3280700002)(7696004)(2950100002)(305945005)(7736002)(86612001)(74316002)(53546009)(25786009)(8936002)(4326008)(6246003)(8676002)(81166006)(38730400002)(5005710100001)(10290500002)(10090500001)(53936002)(55016002)(54906002)(9686003)(99286003)(189998001)(6436002)(5660300001)(86362001)(2201001)(77096006)(6506006)(2501003)(76176999)(54356999)(122556002)(102836003)(50986999)(6116002);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR21MB0637;H:MWHPR21MB0639.namprd21.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Apr 2017 19:38:03.9261 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR21MB0637 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v37JcQpN015283 > -----Original Message----- > From: Vitaly Kuznetsov [mailto:vkuznets@redhat.com] > Sent: Friday, April 7, 2017 04:27 > To: devel@linuxdriverproject.org; x86@kernel.org > Cc: linux-kernel@vger.kernel.org; KY Srinivasan ; > Haiyang Zhang ; Stephen Hemminger > ; Thomas Gleixner ; Ingo > Molnar ; H. Peter Anvin ; Steven > Rostedt ; Jork Loeser > Subject: [PATCH 1/7] x86/hyperv: make hv_do_hypercall() inline > diff --git a/arch/x86/include/asm/mshyperv.h > b/arch/x86/include/asm/mshyperv.h index 7c9c895..331e834 100644 > --- a/arch/x86/include/asm/mshyperv.h > +++ b/arch/x86/include/asm/mshyperv.h > @@ -170,6 +170,51 @@ void hv_remove_crash_handler(void); > > #if IS_ENABLED(CONFIG_HYPERV) > extern struct clocksource *hyperv_cs; > +extern void *hv_hypercall_pg; > + > +static inline u64 hv_do_hypercall(u64 control, void *input, void > +*output) { > + u64 input_address = (input) ? virt_to_phys(input) : 0; > + u64 output_address = (output) ? virt_to_phys(output) : 0; #ifdef > +CONFIG_X86_64 > + u64 hv_status; > + > + if (!hv_hypercall_pg) > + return (u64)ULLONG_MAX; > + > + __asm__ __volatile__("mov %3, %%r8\n" > + "call *%4" > + : "=a" (hv_status) > + : "c" (control), "d" (input_address), > + "r" (output_address), "m" (hv_hypercall_pg) > + : "cc", "r8", "%r9", "%r10", "%r11"); Is clobbering memory required here? > + > + return hv_status; > + > +#else > + u32 control_hi = control >> 32; > + u32 control_lo = control & 0xFFFFFFFF; > + u32 hv_status_hi; > + u32 hv_status_lo; > + u32 input_address_hi = input_address >> 32; > + u32 input_address_lo = input_address & 0xFFFFFFFF; > + u32 output_address_hi = output_address >> 32; > + u32 output_address_lo = output_address & 0xFFFFFFFF; > + > + if (!hv_hypercall_pg) > + return (u64)ULLONG_MAX; > + > + __asm__ __volatile__ ("call *%8" > + : "=d"(hv_status_hi), "=a"(hv_status_lo) > + : "d" (control_hi), "a" (control_lo), > + "b" (input_address_hi), "c" > (input_address_lo), > + "D"(output_address_hi), > "S"(output_address_lo), > + "m" (hv_hypercall_pg) > + : "cc"); Please clobber ecx register for x86 path as well, e.g. by passing as output w/ "+". Please also clobber memory.