Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751472AbdGZTZB (ORCPT ); Wed, 26 Jul 2017 15:25:01 -0400 Received: from mail-co1nam03on0045.outbound.protection.outlook.com ([104.47.40.45]:27680 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750867AbdGZTY4 (ORCPT ); Wed, 26 Jul 2017 15:24:56 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Cc: brijesh.singh@amd.com, "linux-kernel@vger.kernel.org" , "x86@kernel.org" , "linux-efi@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "kvm@vger.kernel.org" , Fenghua Yu , Matt Fleming , David Howells , Paul Mackerras , "H . Peter Anvin" , Christoph Lameter , Jonathan Corbet , =?UTF-8?Q?Radim_Krcm=c3=a1r?= , Piotr Luc , Ingo Molnar , Dave Airlie , Borislav Petkov , Tom Lendacky , Kees Cook , Konrad Rzeszutek Wilk , Reza Arbab , Andy Lutomirski , Thomas Gleixner , Laura Abbott , Tony Luck , Ard Biesheuvel , Eric Biederman , Tejun Heo , Paolo Bonzini , Andrew Morton , "Kirill A . Shutemov" , Lu Baolu Subject: Re: [RFC Part1 PATCH v3 13/17] x86/io: Unroll string I/O when SEV is active To: Arnd Bergmann , David Laight References: <20170724190757.11278-1-brijesh.singh@amd.com> <20170724190757.11278-14-brijesh.singh@amd.com> <063D6719AE5E284EB5DD2968C1650D6DD003FB85@AcuExch.aculab.com> From: Brijesh Singh Message-ID: Date: Wed, 26 Jul 2017 14:24:45 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: CO2PR05CA0066.namprd05.prod.outlook.com (2603:10b6:102:2::34) To DM2PR12MB0154.namprd12.prod.outlook.com (2a01:111:e400:50ce::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a7262e0b-e4cd-4055-cba0-08d4d45bfe86 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:DM2PR12MB0154; X-Microsoft-Exchange-Diagnostics: 1;DM2PR12MB0154;3:lTZE+ps267qF7aXDxeeUoHKS+fgDgfL8emJjNOUsrgydI3iroZ+zqcFiIHvdxuXiHBB6CC7VBOT3QaRxRfdwiIPPc7Sq5UeVaKVTP2jnOIrV6qtEjYtMo6JXAl7zMe7r+AqpEnLgW/zzIbC2QyHLbGHgzSjrL4AYqKvO1SPaIVyv7DLZ9qzUgQGLgZ1EJMEV8Wk2WDEbDbtkVaAVs/pt15eiZdPS/RzHA8Ijey3Xvpqlv25UMmy7GHOCt16hULxuU5FxmZZK4YiLGqkR6XRhsRVcQ4APhsFwINP5Lwmjgsza1A2oMv7DVKS0WVKIxpzfZN+oVMvnmmaHKsFvjNpgoBl38GhqFViE06XanzuTjHEnVU7s3mA+vinpusroOp9zzmb6kioVlBTYd96crUC/JjzGl8YEFaqv7UrZXgc+FLysOUtUZDemcwujGp0eBMDEzFfKELEbuaxRBnQgkAf/6g5o3Dd4S67lEVBe+p9LBxEB9gDRNHeGsy1BfzrqIrCprPlXoofdxfhBXLa95ugHPszx/HPVmaQgES9W2ytaSBOW1Agd4Y0OWDKHKTJUEVR9KVHgtIZNqHRjgiNrVojEJ23qOXZg2kGL7osmkpwhEPAvES/bjV1AgDlfOqbB8VnO9o77QOJ1wrXS43CgVl+NQbx/jRLuUu1VDpzVYBs1lNTMGrYEuJdo2L4ReOprq3l3URpdeX38I9X744ar1dwoX3qv2pY3wWj87CqnE7+MZ6A/me0YofEUvB0mcLFlnVaVQF81+2lhDuT+T6gYQU89Rw== X-MS-TrafficTypeDiagnostic: DM2PR12MB0154: X-Microsoft-Exchange-Diagnostics: 1;DM2PR12MB0154;25:vp2wk3AR2oNEOQUqaMITaNblsWUhYg4943SctxqWk9vM9lr2MsQzjNzDeMpwvNtHhkFcKAphNyj2TNfW1yi+ztFlkw8svtbCYe+nK9buOvqYuT4g51qWQwWHQhIi3atAnDIngm+YQwau5FmWqvOVCwVszYQd99BG4nBGRANM2HBVP5yLdYrTCL3/gfcqENZPEMREGSFOwLKef9t1eJiiuOUq/+PNniv01krHuEOHZUvV+6g7vmz1jUiDkV35jNYiWaTbBJC8KP9j8+XytUQCD/SPm96TxCwmRoq1G79M2BHe3icf4YWCUh4ufSIr9fX/Z659nIsiqLrP7eN1HuDKonX2LMXsDhCPkvItc8o9sK9oVuMedDKa7Uhhhav8voHEV3532xngP++2lzT3lEEgqt9i5Os7simwTHufZvnR0zlHoPr3s8humruDcmysv4aYQ/oPefF69knr1csTpT1sFFFAlDAfQLBc+qXryfkLB0Q/I+qXyqvPd+TAriqZKYunosPP0JilZ715T0qS1x3kGTnOAjLgi/ezeIXGQbZReXWwrNOMFvQFkr7De8FMfQt0N5lMefZ1YCjiBOUrX+gnpEDXrL7PTMG/oDplM/rde5NWi5cHFQtSFhcoxJzGWIyQMJjsIvLJIPGgzJuwlesz5oMtNjibOQdYpsjqNVF9QJQN3h2cAhtLrRd2ikVCG1nWMXsGpLMJXZ8BVskDygKfpyF8vNjmE8xfQhJ8Ay/RaBI1/tUzNgWmeInQi7oGiEyhRSEn2IjXXBeLKcYaAOR0Q5ed/zbOWh7saRyYqaurGk7FxR9iFV1ENTb8AacwJY7ija5MjEboTc6JhO1kKIAcRsT2ruUhb64YAnFXMEU4LqJ25APcaqSnpuoQzSWWWXDFjKkKVeA4cQaWJ0M5A2taP8vOORb7206vjiEmSQu2JXY= X-Microsoft-Exch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4F6ufIoy4n2kQVX/lN8o77f6Cqf76JfMVCVhQlao/C/akQYKBHt8ECMH7RAq0p6bYNwEWXqYWqXeDlVSpOIrLQ9sWLO6sq0WU69W5kRlCrdmgoHDGs1rltSz8RwjiaWT8tPO4ZrrjX0q+jeiIrV8VY5KxqRcIdrp+rbj1j X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(17755550239193); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(93006095)(93001095)(3002001)(10201501046)(6055026)(6041248)(20161123555025)(20161123564025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DM2PR12MB0154;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DM2PR12MB0154; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTJQUjEyTUIwMTU0OzQ6bE4zT3ZPM293blpIYjRnV1IzdFhhS1lubGJw?= =?utf-8?B?VDlDeFNqQlNYc3dhMzV5ZVQ4YmYvUE5Vc2VEbjIrVFFJbmdzTzRyZng5ckZ2?= =?utf-8?B?cHNxVXFRbGpzT2sxMkx0dE9aTWZYWDJxV3BOQkFvMUY3TkgvQ0ZMWUU0OTRU?= =?utf-8?B?OXBSQW9CQnB4VzlCU3dad1pUdzhucjJWVkVERC84YnEzZ1pDY05jb0FDVkxZ?= =?utf-8?B?TTdNK1gyemxQM2pWQU5VRGhPYnpvWU53MGN6Q2xRWVUrSy9ld2NhRGFpK3oy?= =?utf-8?B?M0p0dUU4SStmZ0thQmR1MHBTSDJYYzRaL3ZiT0xLQjVXS1NQYW9BLzhKRjdp?= =?utf-8?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HRsQlpt?= =?utf-8?B?eFgvWFhsaWJuVktIYlBrejlTeXIvajlQL0R1VUdqSkw3YXpTem15QmJNRXVG?= =?utf-8?B?UFhtaVBoK010MWRBU3RzWmVndTl6U0ZVaWRIa2hBWUhUUGRHQkl4anVBbFRD?= =?utf-8?B?cFlYTlFIcmRxZjBGYUdBSy8rMGFyWlNvR1BuMitaOUxHL2lFTTlJc0xFRXlB?= =?utf-8?B?VnlUQ0tBY2pQSDFQQjlkRjdnUG9DNVhyQ010Z3MxbFh3YVN5VXlZankySHBw?= =?utf-8?B?NzFsNUNwRWxZWmF3ODFEcE9tbXh3N1ZHRjloYm8yNnREV2dvamlDN3NxejZS?= =?utf-8?B?N3N0c3dkc3pQb05DbEd2SVg3c3czUFBOZ0JLQm04cFMyMHQzMlBDamYvRGJY?= =?utf-8?B?MUtycGZIbm01aFJLVTVWTnovNFFBcGxzLzNKVmp4QkF6bkl0NnQxR0M4cVBz?= =?utf-8?Q?YpFG4255fj2YIvhxw=3D?= X-Forefront-PRVS: 038002787A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(7370300001)(4630300001)(6009001)(6049001)(39860400002)(39400400002)(39450400003)(39840400002)(39410400002)(39850400002)(199003)(377454003)(24454002)(189002)(6246003)(2906002)(53936002)(76176999)(38730400002)(31686004)(50986999)(66066001)(47776003)(101416001)(6306002)(65956001)(966005)(65806001)(68736007)(54906002)(23676002)(81156014)(105586002)(8676002)(3846002)(6116002)(36756003)(54356999)(106356001)(4326008)(81166006)(25786009)(33646002)(230700001)(189998001)(42186005)(64126003)(4001350100001)(7736002)(305945005)(65826007)(93886004)(478600001)(83506001)(31696002)(6666003)(229853002)(2950100002)(53546010)(7416002)(97736004)(77096006)(5660300001)(50466002)(6486002)(7350300001)(86362001)(7406005);DIR:OUT;SFP:1101;SCL:1;SRVR:DM2PR12MB0154;H:[10.236.136.62];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: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utf-8?B?UmJvakROTWcwOW82NC95cWRCNTgvMmcrSzZPVmF2ZGxjODBEREMrdXdQOU9F?= =?utf-8?Q?ZIpghLK?= X-Microsoft-Exchange-Diagnostics: 1;DM2PR12MB0154;5:GdT6t/8Ejr8YhSkceDknjzH0yFFDklxg3LzrP2GCIoWM1lvlpQAcKGf2m3jq4sIbItyGj31DANv9dajOWdnbdhpgNHGuKzzy1wCVtxsp5FEM1Sy5IGYWndWvCYbV1K6zgm3gUwHlvuEQgWr+VpRPXsXwJ6M06lD1L58RhDWvttFIa2Vl5qbS/QbGqcrJfbLbeqv5IBNb0rCw2ZxwNC4wAKi/2DCqc2yBl9gCghp+Nv8uLbs189m0gWhXNmXxpMt9vC9rjqhRkgPZhrC5+iIVZa+cqvOTqGMhZUOXri1OyCvZ0+pT4qv3G5NZDSYru1AGrpQsGE3tPr1ewjiI/u1mqQSE+bvgIe1dH/I+oygfyDamjtgDJTqF/WkULkcRQKer/0dNatNOtnLWqOkKR1fxVAn8up0X/OF6PviibniBvbcX6MqAOMByceF02mV3KQODSbjxjia0tiRYQ9g60+BOKzWjipD0LkUp4btcAemQiTUgySZPNTE1sE5XpyhKSTwY;24:0uBm+Ug+saPaDvRICdsF+JbDvqFeL34W61rLCTMbbS4Vlax4n/e+GiNKZ61W5TCzVOLxA6T2114+3dXDvBY0zCVsr9krdzpqMC70GOjSLJM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DM2PR12MB0154;7:e1FkjVRiCCfmufFO8/Ttnpod5y8DFyhYku7MX0IjJO4bQDGiuZ+ex4qEgDedrAab2iaUDt7UNoe9dDoyuiu2ee6sAEVveXg6yyCrKTlJWA4exljBNZRyKqEOFL4Ao7pjr0Li0pynHynJnmC6nNIUX63h0b8DjP78SgdKfmGUcqjVz8TM2zB/yWoVvk1Loht/l4FbIxSbEAsSqrpl0mVMz5+0ZD5EQ/ThdoGmQAEPNes5LOBkfC5QJTE5x94yQ9nfqAmIb3I34QskwsHzP+rYDtHSaURYK8MafUW+68kuEwSbh+uOHCp3UQ6o5aE1UeMgqU4oD18N23aqraZ7actV2fkU1grAGiOmDHkWZdJMlnbtiVHgqXyc/Zf5xkU3IeFKDxqjrVbZMjNk01ybmlZbyOodKdJ3jcoi+OQfTu3JhTo1Njh6TVvYpW9axBoqMg9WAw+bsXCU7cdHHz5zkHXAynR2y3YDjV+YxolPBuq/38D78HdBJIY9vRFIFwgiAIbIg/zsEDRDMiMg/1Ft4686DEnW8s7Fsc5x41m4sEEEQ5rmODFiepKHbhP2oJ4ktbcXCuBRX7Mz9Sbge+RmLvYNKXEk1TfboaCDTtZMwHjMlpCy/cjuDPY3a/uk9ya18VAfnQ5LZbzXXaTzRw44ve/IrZMMjhJ9yE+cf2Q/8mbeRF7hFdJSi2Vr6tD5va0jIVwVmdJW05Iq0RsWfXF6Pr94iYflG824AZkNt1YyXRkdNqV3rk1GvAe5J7vJQtT53ywnvMOCVmv0qNAdoZ4GsJ1Ofclwp0pxtS/x6LOjQzcjCQI= X-Microsoft-Exchange-Diagnostics: 1;DM2PR12MB0154;20:7uysEm2bt5u08lR7lj6qn8mdCMXvgg9rTKGL7uTuZeHeKx1jJBBmYJ/jbuX9Ia444ftTXnu+oyxGxrbHIn8mAO8bEu56ER36TZZ/OKc0iGba45FM1jZL6lK9CQ/lyFf7OVA307lWrEkTENYyEzTg+jSNvE2AF9XshNXmQQ7pFEQmBaa9WXqJ59iR4cojBj12h7tKd4JuriemI56xIUK8phCZDus8fBrArCRk1l+1SRG/KeVQl3l608mCItVTmCrg X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jul 2017 19:24:50.6802 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0154 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 8355 Lines: 216 Hi Arnd and David, On 07/26/2017 05:45 AM, Arnd Bergmann wrote: > On Tue, Jul 25, 2017 at 11:51 AM, David Laight wrote: >> From: Brijesh Singh >>> Sent: 24 July 2017 20:08 >>> From: Tom Lendacky >>> >>> Secure Encrypted Virtualization (SEV) does not support string I/O, so >>> unroll the string I/O operation into a loop operating on one element at >>> a time. >>> >>> Signed-off-by: Tom Lendacky >>> Signed-off-by: Brijesh Singh >>> --- >>> arch/x86/include/asm/io.h | 26 ++++++++++++++++++++++---- >>> 1 file changed, 22 insertions(+), 4 deletions(-) >>> >>> diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h >>> index e080a39..2f3c002 100644 >>> --- a/arch/x86/include/asm/io.h >>> +++ b/arch/x86/include/asm/io.h >>> @@ -327,14 +327,32 @@ static inline unsigned type in##bwl##_p(int port) \ >>> \ >>> static inline void outs##bwl(int port, const void *addr, unsigned long count) \ >>> { > > This will clash with a fix I did to add a "memory" clobber > for the traditional implementation, see > https://patchwork.kernel.org/patch/9854573/ > >> Is it even worth leaving these as inline functions? >> Given the speed of IO cycles it is unlikely that the cost of calling a real >> function will be significant. >> The code bloat reduction will be significant. > > I think the smallest code would be the original "rep insb" etc, which > should be smaller than a function call, unlike the loop. Then again, > there is a rather small number of affected device drivers, almost all > of them for ancient hardware that you won't even build in a 64-bit > x86 kernel, see the list below. The only user I found that is actually > still relevant is drivers/tty/hvc/hvc_xen.c, which uses it for the early > console. There are some indirect user of string I/O functions. The following functions defined in lib/iomap.c calls rep version of ins and outs. - ioread8_rep, ioread16_rep, ioread32_rep - iowrite8_rep, iowrite16_rep, iowrite32_rep I found that several drivers use above functions. Here is one approach to convert it into non-inline functions. In this approach, I have added a new file arch/x86/kernel/io.c which provides non rep version of string I/O routines. The file gets built and used only when AMD_MEM_ENCRYPT is enabled. On positive side, if we don't build kernel with AMD_MEM_ENCRYPT support then we use inline routines, when AMD_MEM_ENCRYPT is built then we make a function call. Inside the function we unroll only when SEV is active. Do you see any issue with this approach ? thanks diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index e080a39..104927d 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -323,8 +323,9 @@ static inline unsigned type in##bwl##_p(int port) \ unsigned type value = in##bwl(port); \ slow_down_io(); \ return value; \ -} \ - \ +} + +#define BUILDIO_REP(bwl, bw, type) \ static inline void outs##bwl(int port, const void *addr, unsigned long count) \ { \ asm volatile("rep; outs" #bwl \ @@ -335,12 +336,31 @@ static inline void ins##bwl(int port, void *addr, unsigned long count) \ { \ asm volatile("rep; ins" #bwl \ : "+D"(addr), "+c"(count) : "d"(port)); \ -} +} \ BUILDIO(b, b, char) BUILDIO(w, w, short) BUILDIO(l, , int) +#ifdef CONFIG_AMD_MEM_ENCRYPT +extern void outsb_try_rep(int port, const void *addr, unsigned long count); +extern void insb_try_rep(int port, void *addr, unsigned long count); +extern void outsw_try_rep(int port, const void *addr, unsigned long count); +extern void insw_try_rep(int port, void *addr, unsigned long count); +extern void outsl_try_rep(int port, const void *addr, unsigned long count); +extern void insl_try_rep(int port, void *addr, unsigned long count); +#define outsb outsb_try_rep +#define insb insb_try_rep +#define outsw outsw_try_rep +#define insw insw_try_rep +#define outsl outsl_try_rep +#define insl insl_try_rep +#else +BUILDIO_REP(b, b, char) +BUILDIO_REP(w, w, short) +BUILDIO_REP(l, , int) +#endif + extern void *xlate_dev_mem_ptr(phys_addr_t phys); extern void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr); diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index a01892b..3b6e2a3 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile @@ -42,6 +42,7 @@ CFLAGS_irq.o := -I$(src)/../include/asm/trace obj-y := process_$(BITS).o signal.o obj-$(CONFIG_COMPAT) += signal_compat.o +obj-$(CONFIG_AMD_MEM_ENCRYPT) += io.o obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o obj-y += time.o ioport.o dumpstack.o nmi.o obj-$(CONFIG_MODIFY_LDT_SYSCALL) += ldt.o diff --git a/arch/x86/kernel/io.c b/arch/x86/kernel/io.c new file mode 100644 index 0000000..f58afa9 --- /dev/null +++ b/arch/x86/kernel/io.c @@ -0,0 +1,87 @@ +#include +#include +#include + +void outsb_try_rep(int port, const void *addr, unsigned long count) +{ + if (sev_active()) { + unsigned char *value = (unsigned char *)addr; + while (count) { + outb(*value, port); + value++; + count--; + } + } else { + asm volatile("rep; outsb" : "+S"(addr), "+c"(count) : "d"(port)); + } +} + +void insb_try_rep(int port, void *addr, unsigned long count) +{ + if (sev_active()) { + unsigned char *value = (unsigned char *)addr; + while (count) { + *value = inb(port); + value++; + count--; + } + } else { + asm volatile("rep; insb" : "+D"(addr), "+c"(count) : "d"(port)); + } +} + +void outsw_try_rep(int port, const void *addr, unsigned long count) +{ + if (sev_active()) { + unsigned short *value = (unsigned short *)addr; + while (count) { + outw(*value, port); + value++; + count--; + } + } else { + asm volatile("rep; outsw" : "+S"(addr), "+c"(count) : "d"(port)); + } +} +void insw_try_rep(int port, void *addr, unsigned long count) +{ + if (sev_active()) { + unsigned short *value = (unsigned short *)addr; + while (count) { + *value = inw(port); + value++; + count--; + } + } else { + asm volatile("rep; insw" : "+D"(addr), "+c"(count) : "d"(port)); + } +} + +void outsl_try_rep(int port, const void *addr, unsigned long count) +{ + if (sev_active()) { + unsigned int *value = (unsigned int *)addr; + while (count) { + outl(*value, port); + value++; + count--; + } + } else { + asm volatile("rep; outsl" : "+S"(addr), "+c"(count) : "d"(port)); + } +} + +void insl_try_rep(int port, void *addr, unsigned long count) +{ + if (sev_active()) { + unsigned int *value = (unsigned int *)addr; + while (count) { + *value = inl(port); + value++; + count--; + } + } else { + asm volatile("rep; insl" : "+D"(addr), "+c"(count) : "d"(port)); + } +}