From owner-svn-src-all@freebsd.org Sun Nov 18 21:09:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DCA9B1122B05; Sun, 18 Nov 2018 21:09:55 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay115.isp.belgacom.be (mailrelay115.isp.belgacom.be [195.238.20.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "relay.skynet.be", Issuer "GlobalSign Organization Validation CA - SHA256 - G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0DA5B71087; Sun, 18 Nov 2018 21:09:54 +0000 (UTC) (envelope-from tijl@freebsd.org) X-Belgacom-Dynamic: yes IronPort-PHdr: =?us-ascii?q?9a23=3AkAG+MBWcc3B02DK0w7Ecx/1I4KfV8LGtZVwlr6?= =?us-ascii?q?E/grcLSJyIuqrYYx2At8tkgFKBZ4jH8fUM07OQ7/iwHzRYqb+681k6OKRWUB?= =?us-ascii?q?EEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAA?= =?us-ascii?q?jwOhRoLerpBIHSk9631+ev8JHPfglEnjWwba9xIRmssQndqtQdjJd/JKo21h?= =?us-ascii?q?bHuGZDdf5MxWNvK1KTnhL86dm18ZV+7SleuO8v+tBZX6nicKs2UbJXDDI9M2?= =?us-ascii?q?Ao/8LrrgXMTRGO5nQHTGoblAdDDhXf4xH7WpfxtTb6tvZ41SKHM8D6Uaw4VD?= =?us-ascii?q?K/5KpwVhTmlDkIOCI48GHPi8x/kqRboA66pxdix4LYeZyZOOZicq/Ye94RWG?= =?us-ascii?q?hPUdtLVyFZDI2yb5UBAfcCM+laoYnyqEcBoxSlCAmwBu7j1iNEimPq0aEk1e?= =?us-ascii?q?kqDAHI3BYnH9ILqHnastD3NKMPWu2ry6nIyi7DYO1T2Tjn7ojIaQ0qrPaQXb?= =?us-ascii?q?Jxc8rRzVIiGQPfjlqOt4PoIi6b2OoXv2ic9epgWvuihmg6oA9/pTivw90jio?= =?us-ascii?q?jPho8NxVDE9Dl5wIYoJdKjUkJ0fdmkEJ5WuiqHNIV2WtsvTmJqtSogy7ALto?= =?us-ascii?q?S3cDUOxZko3RLTdeGLfoeO7xn+TuieOy14i2hgeL+nghay9lWvxfPkW8mv1V?= =?us-ascii?q?ZKsjJFkt7RtnARzxDT6taISv96/kq52jaAzQTT6uBBIU8qj6rbLIQtwqIxlp?= =?us-ascii?q?oRtUTPBDP5mELxjK+NaEok//Kn6+L8Yrn8oZ+cLYB0hhn/MqQohMO/Hfw1Pw?= =?us-ascii?q?sMUmSB+Omx26fv8VD9TbhFlPE6jLTVvZ/CKcQevKG5AgtV0og56xa4CjeryM?= =?us-ascii?q?gYnXgFLFJBYx+HgZLpNE/QL//jFvewnk6gkDBxx/DJJrHhGInCLmDfkLf9er?= =?us-ascii?q?Zw80tcxxAvzdxF4pJbEK0OIfLoV0/+sdzXFB45Mwiuz+n7D9V909BWZWXaJ6?= =?us-ascii?q?aFLKPfrhet7+k+a72JbZNTvT/2OtAq4vfviTkynlpLLoez2p5CVJe8Vt9hJF?= =?us-ascii?q?6UZHPqmZ9VDWYIuiIQVuHnomauFzlJaCDhDOoH+jgnBdf+Xs/4TYe3jenEhX?= =?us-ascii?q?/jEw=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2AMAAD20/Fb/9bCQFdiGQEBAQEBAQE?= =?us-ascii?q?BAQEBAQcBAQEBAQGBUwIBAQEBAQsBAYICZoECJ4xvixsBAYIMNQGIUXaNOYF?= =?us-ascii?q?6MoQBRgKDUyM2Bw0BAwEBAgEBAgFsHAxCAQ4BgWQkAYJhAQEBAQIBOhwjBQs?= =?us-ascii?q?LDgoJJQ8SGB4GE4MigWkDDQwLp2SELQGDRQ2BC4EJBYwcgX+EI4JWRQKHPAK?= =?us-ascii?q?PUo9vLgmGeocCgyAjgViIK4Z6jTmBCIsiCyaBVU0wCIMngicXg0qKUz4DMAq?= =?us-ascii?q?DRYocAQE?= X-IPAS-Result: =?us-ascii?q?A2AMAAD20/Fb/9bCQFdiGQEBAQEBAQEBAQEBAQcBAQEBA?= =?us-ascii?q?QGBUwIBAQEBAQsBAYICZoECJ4xvixsBAYIMNQGIUXaNOYF6MoQBRgKDUyM2B?= =?us-ascii?q?w0BAwEBAgEBAgFsHAxCAQ4BgWQkAYJhAQEBAQIBOhwjBQsLDgoJJQ8SGB4GE?= =?us-ascii?q?4MigWkDDQwLp2SELQGDRQ2BC4EJBYwcgX+EI4JWRQKHPAKPUo9vLgmGeocCg?= =?us-ascii?q?yAjgViIK4Z6jTmBCIsiCyaBVU0wCIMngicXg0qKUz4DMAqDRYocAQE?= Received: from 214.194-64-87.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([87.64.194.214]) by relay.skynet.be with ESMTP; 18 Nov 2018 22:08:44 +0100 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.15.2/8.15.2) with ESMTP id wAIL8hgV002342; Sun, 18 Nov 2018 22:08:43 +0100 (CET) (envelope-from tijl@FreeBSD.org) Date: Sun, 18 Nov 2018 22:08:42 +0100 From: =?UTF-8?B?VMSzbA==?= Coosemans To: Matthew Macy Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r339618 - head/sys/compat/linuxkpi/common/include/linux Message-ID: <20181118220842.4c995b5a@kalimero.tijl.coosemans.org> In-Reply-To: References: <201810222055.w9MKtZPt013627@repo.freebsd.org> <20181118114538.546a4fab@kalimero.tijl.coosemans.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 0DA5B71087 X-Spamd-Result: default: False [-0.24 / 15.00]; TAGGED_RCPT(0.00)[]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_SHORT(-0.21)[-0.205,0]; NEURAL_HAM_MEDIUM(-0.03)[-0.033,0]; ASN(0.00)[asn:5432, ipnet:195.238.0.0/19, country:BE] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Nov 2018 21:09:56 -0000 On Sun, 18 Nov 2018 12:10:25 -0800 Matthew Macy wrote: >> Note that these functions are normally used on uncacheable memory which >> is strongly ordered on x86. There should be no reordering at all. On >> PowerPC barrier instructions are needed to prevent reordering. > > Correct. The current lkpi implementation also assumes that device > endian == host endian. The Linux generic accessors will do use endian > macros to byte swap where necessary. Yes, these functions are used to access little-endian registers so byte swapping is needed on big-endian machines. For PowerPC Linux also defines functions to access big-endian registers, but we probably don't need those. > The following change fixes radeon attach issues: > https://github.com/POWER9BSD/freebsd/commit/be6c98f5c2e2ed9a4935ac5b67c468b75f3b4457 +/* prevent prefetching of coherent DMA data ahead of a dma-complete */ +#ifndef __io_ar +#ifdef rmb +#define __io_ar() rmb() +#else +#define __io_ar() __compiler_membar(); +#endif +#endif + +/* flush writes to coherent DMA data before possibly triggering a DMA read */ +#ifndef __io_bw +#ifdef wmb +#define __io_bw() wmb() +#else +#define __io_bw() __compiler_membar(); +#endif +#endif ... static inline uint16_t readw(const volatile void *addr) { uint16_t v; - __compiler_membar(); - v = *(const volatile uint16_t *)addr; - __compiler_membar(); + __io_br(); + v = le16toh(__raw_readw(addr)); + __io_ar(); return (v); } For x86 rmb and wmb are defined as lfence and sfence instructions which shouldn't be necessary here.