From owner-svn-src-all@freebsd.org Sun Nov 18 22:17:49 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 0EC6E1126472; Sun, 18 Nov 2018 22:17:49 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) (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 57EC173EF1; Sun, 18 Nov 2018 22:17:48 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by mail-io1-xd35.google.com with SMTP id f12-v6so20924780iog.0; Sun, 18 Nov 2018 14:17:48 -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=k/EyIZwcc1HVGNDnFOFIrm52qmKvs/wwaZZPH4TmwIg=; b=Y8ML4B+H7Z+y6ZXNXKx9MoYhzM0JeCICPNnuaKRtB5TxYqtI9eL53QO99ngTPawtYg j3KvYnvB+Rntt5yvjh7aUFvzMS1eYdMEsIIphExy8ZqI6or+4VndZL1A4ldEg/a8i4D8 4IKYR2mS0TMClfg6gdj7TPTay0LvA9oqKAsGu3h4LWbyH9Whox639elDpxVxP7PPNK2w bkIxrEkb8uuLfHcUI+3KOmjit05Vm2AXNd+/cINidKZ4VP+djMxBHIljLfbLuGfn2luK fMHpdAZ91nRicpjBuwhEFXcX+N3IBn6u/qJO8zg7z9OLkvDYrUZMNTLvFVCoRRGRpF3U 1x3w== 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=k/EyIZwcc1HVGNDnFOFIrm52qmKvs/wwaZZPH4TmwIg=; b=QBTptKeTA2vZfop3Niy9R5AV6zBVFdBSijIflcYtDsTn4sDBccKvWqp1eaw9TqLYn3 pfdWNf/KnJxZooIbtG4MFdthbBL0NUIglzrC0XuCl2iJP12Fb/biwzS3IaN0d4qqG+3+ fyaYzHmqvydBYmeyqCPsfe2Uy36/iyhYE+LEXzqxtWgXKqETw7d4aw2W+xn1TT0ao4Od c7BJCHDSk8x4a7l11246x4l9sJEkBFbkQKRsCuzMKWTUfW+uE/wJRJAq1IoccySiX8Lh sHhFwwR6NjSoB+CuwSKMdQ3odYTe3/UWb1gbTsHIt4fUKnwv6MOTesPhSiG7h/AGS2AE b7KA== X-Gm-Message-State: AGRZ1gL8wRcHRO5+FGlmlLy3JWXtBpvTZmntNGmHJGFfYcrFE2X/IJbD quOamI/YRey+3uVvxMCa00sko/Hjb79lSVtUzijbvA== X-Google-Smtp-Source: AJdET5eh49wfEq65xBpkCEWlox+retlnoPQGsOLfCeGpPBoyLiZJ0SBTfxsGBaLLAiEmCA4YDlij36gVO9qvtLozZDw= X-Received: by 2002:a5e:dc0b:: with SMTP id b11mr14968087iok.237.1542579467309; Sun, 18 Nov 2018 14:17:47 -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:17:36 -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: 57EC173EF1 X-Spamd-Result: default: False [-3.83 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.995,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.88)[ipnet: 2607:f8b0::/32(-2.57), asn: 15169(-1.73), country: US(-0.09)]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[5.3.d.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]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; 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:17:49 -0000 > > > > 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. > None of our currently supported drivers use those macros (most devices are LE) so I=E2=80=99ve omitted them. -M > > 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. >