From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752806AbZDVA0L (ORCPT ); Tue, 21 Apr 2009 20:26:11 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751710AbZDVAZ4 (ORCPT ); Tue, 21 Apr 2009 20:25:56 -0400 Received: from 74-93-104-97-Washington.hfc.comcastbusiness.net ([74.93.104.97]:56997 "EHLO sunset.davemloft.net" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751352AbZDVAZz (ORCPT ); Tue, 21 Apr 2009 20:25:55 -0400 Date: Tue, 21 Apr 2009 17:25:47 -0700 (PDT) Message-Id: <20090421.172547.85702227.davem@davemloft.net> To: rdreier@cisco.com Cc: hpa@zytor.com, h.mitake@gmail.com, mingo@elte.hu, tglx@linutronix.de, rpjday@crashcourse.ca, linux-kernel@vger.kernel.org Subject: Re: arch/x86/Kconfig selects invalid HAVE_READQ, HAVE_WRITEQ vars From: David Miller In-Reply-To: References: <49EDE9E9.8090905@zytor.com> X-Mailer: Mew version 6.2.51 on Emacs 22.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Roland Dreier Date: Tue, 21 Apr 2009 10:07:50 -0700 > This only makes sense if we define a 32-bit fallback for > readq()/writeq() for all 32-bit architectures -- in fact it would be > good to do it in asm-generic so that there can be a single > implementation that guarantees that non-atomic versions always do, say, > low 32 bits then high 32 bits. (So eg niu can use the generic version) > And then drivers like drivers/infiniband/hw/mthca can be switched to > "#ifndef writeq_atomic <...hardware specific fallback...>" I think if you want to do this right you have to provide two versions of the 32-bit implementations, when the cpu cannot generate full 64-bit transactions. Especially for readq(). Some devices clear the status bits of a 64-bit register when read, so it might matter deeply whether the top-half or the bottom-half 32-bits are read first. The following are ugly names, but something like "readq_hifirst()" and "readq_lofirst()" and they just get defined to play "readq()" in situations where a full 64-bit transaction can be generated by the cpu. The driver author has to figure out which is appropriate. And I'm pretty sure similar high-first/low-first issues can exist for writeq() as well.