From owner-svn-src-all@freebsd.org Sun Nov 18 22:16:08 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 66C251126243; Sun, 18 Nov 2018 22:16:08 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from mail-it1-x144.google.com (mail-it1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ACD1F73C59; Sun, 18 Nov 2018 22:16:07 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by mail-it1-x144.google.com with SMTP id x124so5832233itd.1; Sun, 18 Nov 2018 14:16:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QoAKkEiCKm0EyvXUUGf9QoED9EeLIeyx9izfQ6rDkAE=; b=OHxU2odQaKive24Eb2B5jq7tSyEHyERgX6+JioQMGTPjyiHPYwSe46Yi29SdFgV4z8 WTvCYpMW4jnB1X3wScmHrQtYU6U8Wvmy3GOTjWuqFzb0xoFhYYCYeqwd4hJTXnx77u6v 17IqT5/+lcBV6ciZe9gKUycBYsqdNRbtgWpvZwYQMkzbrvFBLuYpr0K5ITTVzEkWwPRm mGAH5BHfynDMwrmB0cF7o9Q1PFD19z/8XQLEJO1QoF8ijXtNDkGhaQUpzYHV1iPEKyL1 amwT/NergljX3yrf4vdYG6MTJlZDTqWQBW3aTryuKYQ8QIWZV85d059eqaNucqFX2a2z IhhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QoAKkEiCKm0EyvXUUGf9QoED9EeLIeyx9izfQ6rDkAE=; b=VXAzZ/5fyRoEKhVVNvGZmN211vxv9QU+Qhtpi5ujEJ3seZsfS2/lBiEYa/gjoIBjlt TwHkn8h5aE6/FdW/lpUsMGgb+p876pVm9oDIzLGa+She45ctLZi1zKiNI7NFVrWjhkWW GuoxtilqUGXWBDwtgBmT7Yl2h5J7JQHo4NadPdZYQXjvUC1nCKP42r5G3ABUkVP9V8sN swzHZpypxS8QMNSxr7od72fV2qNCuv9dOr9X/C2M9kAIp9ojCQNc0Sp1n1Ec2YrrAnwM vGl7aHNzAaloj+MDfHbZLGEqvHJ+xTcT1UiPXw3KY0/Lhta54kdBn5FFm9Lu32Erlkxs OVzQ== X-Gm-Message-State: AA+aEWbO2+gijXa3H3D0YHVoN/BF/8KtWH/x6dFVMXC/f27jeH8hvFEs MFmlNJxuX7TOeILBaUA0XLSzcBlRXTWef7PSWvoh1w== X-Google-Smtp-Source: AFSGD/VxyclcOWFmDpcokJioL5Afk8oPpug37yWSHdyK71iwUHtf38+WzpLKd4ON7dNmMqLKCH+oLALRVwSmfihzDOo= X-Received: by 2002:a24:9005:: with SMTP id x5mr5949774itd.102.1542579366919; Sun, 18 Nov 2018 14:16:06 -0800 (PST) MIME-Version: 1.0 References: <201810222055.w9MKtZPt013627@repo.freebsd.org> <20181118114538.546a4fab@kalimero.tijl.coosemans.org> <20181118220842.4c995b5a@kalimero.tijl.coosemans.org> In-Reply-To: <20181118220842.4c995b5a@kalimero.tijl.coosemans.org> From: Matthew Macy Date: Sun, 18 Nov 2018 14:15:56 -0800 Message-ID: Subject: Re: svn commit: r339618 - head/sys/compat/linuxkpi/common/include/linux To: =?UTF-8?Q?T=C4=B3l_Coosemans?= Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: ACD1F73C59 X-Spamd-Result: default: False [-3.26 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.98)[-0.980,0]; R_DKIM_ALLOW(-0.20)[gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_SOME(0.00)[]; IP_SCORE(-0.47)[ip: (2.05), ipnet: 2607:f8b0::/32(-2.56), asn: 15169(-1.73), country: US(-0.09)]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_IN_DNSWL_NONE(0.00)[4.4.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.81)[-0.806,0]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Server: mx1.freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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 22:16:08 -0000 Correct. This is just the generic case. We just need to define the __io macros as __compiler_membar in x86/io.h Cheers. -M On Sun, Nov 18, 2018 at 13:08 T=C4=B3l Coosemans wrote: > On Sun, 18 Nov 2018 12:10:25 -0800 Matthew Macy > wrote: > >> Note that these functions are normally used on uncacheable memory whic= h > >> 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 =3D=3D host endian. The Linux generic accessors will do use endi= an > > 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 define= s > functions to access big-endian registers, but we probably don't need thos= e. > > > The following change fixes radeon attach issues: > > > https://github.com/POWER9BSD/freebsd/commit/be6c98f5c2e2ed9a4935ac5b67c46= 8b75f3b4457 > > +/* 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 =3D *(const volatile uint16_t *)addr; > - __compiler_membar(); > + __io_br(); > + v =3D 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. >