Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932145AbbLAWtZ (ORCPT ); Tue, 1 Dec 2015 17:49:25 -0500 Received: from terminus.zytor.com ([198.137.202.10]:51360 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932092AbbLAWtY (ORCPT ); Tue, 1 Dec 2015 17:49:24 -0500 Subject: Re: [PATCH 1/6] x86: Add VMWare Host Communication Macros To: Sinclair Yeh , x86@kernel.org References: <1449008047-8252-1-git-send-email-syeh@vmware.com> <1449008332-9394-1-git-send-email-syeh@vmware.com> Cc: Thomas Gleixner , Ingo Molnar , Alok Kataria , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Xavier Deguillard From: "H. Peter Anvin" X-Enigmail-Draft-Status: N1110 Message-ID: <565E23E7.5090800@zytor.com> Date: Tue, 1 Dec 2015 14:49:11 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1449008332-9394-1-git-send-email-syeh@vmware.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1803 Lines: 50 On 12/01/15 14:18, Sinclair Yeh wrote: > These macros will be used by multiple VMWare modules for handling > host communication. > + __asm__ __volatile__ ("inl %%dx" : \ This is odd at best; the standard assembly form of this instruction is: inl (%dx),%eax Also, we don't need the underscored forms of asm and volatile for kernel code. > + __asm__ __volatile__ ("movq %13, %%rbp;" \ > + "cld; rep outsb; " \ > + "movq %%rbp, %6" : \ cld shouldn't be necessary here, DF=0 is part of the normal ABI environment. You also don't save/restore %rbp here, but you do below? Seems very odd. It might be better do so something like: +#define VMW_PORT_HB_OUT(in1, in2, port_num, magic, \ + eax, ebx, ecx, edx, si, di, bp) \ +({ \ + __asm__ __volatile__ ("xchgq %6, %%rbp;" \ + "cld; rep outsb; " \ + "xchgq %%rbp, %6" : \ + "=a"(eax), \ + "=b"(ebx), \ + "=c"(ecx), \ + "=d"(edx), \ + "+S"(si), \ + "+D"(di), \ + "+r"(bp) : \ + "a"(magic), \ + "b"(in1), \ + "c"(in2), \ + "d"(port_num) : \ + "memory", "cc"); \ +}) -- 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/