Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp1940976ybb; Fri, 29 Mar 2019 14:42:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJAdJ8ovnT7TQFq2IhAOLqssHpOPHB4phrhrJdvORoAE7AsOgiSTyYSRbj5899yiiSzLQT X-Received: by 2002:a63:481:: with SMTP id 123mr48624651pge.167.1553895745214; Fri, 29 Mar 2019 14:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553895745; cv=none; d=google.com; s=arc-20160816; b=WzmV7u5TIFUabfeierOWp9QEd1J+jZpkxOCUg0DObHX9tn0IHURZulqnMNEC2Y6HJ4 33fo1N5n6wyJG8clqTT8Qxd4mKKVOx3UMIcOABsYR+pnzihd9DGDLzyZ9T5Mf+LHsGa4 Gh3PJv0ZV5qK7JK7GNKSjtvSB3vRC1iA9zjAPzb4i6E86RR8ANvViwbattE5BTueRKqW NEmAXRWTRzWcGmjJny4GnHWUf71t1u711iDci+oztukxlS38roDnuttXcgKRavw57AOJ DlUUq+qmANJ04NurnzJ3SO7N1hJoN2nNmeY7P3XrWAqXEONeGoKZH4L7y6LhXBWFn892 TecQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Ntsor/qCmdjkWmlOoyynMkE4TxeGboUKg9xj07HF+bY=; b=kp0PUC71rwHppjDcff529otA163HoCfVQZFBtDS8JoXxpfaCaO+/RUomqpBKGOl0uM +VZLj8xFGQbbbgxSrJOiVQU4eoUQhdlJ+I4AvNYvFW+ExGXEa5CtVJFdHjLU8J8eEbqE 5IT0QsPOuHVXZlh1TsodVhLFC2TdWy7DP+owzI1xcSGFANlu/QaWp2eGa03cNvhCJOFh +RrNUzQKKmHujCapDByb1nVrgChTv5ofixwkFCStF9YDJNe0Qjd3ZNUGQlBL7Rfhjl/s tmPzY3t3zZWYwzUt7tkzf29K5gHKZS7pM1jM0dR/YdsDLxaUeIAlLDl2ZxTu/7nY2vs/ tHow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=mAQET9er; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x20si2616440pfm.282.2019.03.29.14.42.09; Fri, 29 Mar 2019 14:42:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=mAQET9er; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730210AbfC2VlR (ORCPT + 99 others); Fri, 29 Mar 2019 17:41:17 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:42730 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729939AbfC2VlR (ORCPT ); Fri, 29 Mar 2019 17:41:17 -0400 Received: by mail-ot1-f68.google.com with SMTP id 103so3354383otd.9 for ; Fri, 29 Mar 2019 14:41:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Ntsor/qCmdjkWmlOoyynMkE4TxeGboUKg9xj07HF+bY=; b=mAQET9ertk4bfpkPDVy7Rd90XBuMFVYHFHEHIjjTGcYzg4/ZEAmCOSXAOF7P2edmcE mgvrx2lTDVYxfsp9vL8Z3csVu767QmQms2BdqoN2bP+F/zXP91s8BsBfx+P+NJqvXuoj isA9OkdbEGB+6CVQVg66fV++SyDb1uT9X0JTnuekWfh4XEDcQXO+K5FkYkJ/TO4WKOb3 sQW4i643IrU3/756KmObKTfYIdCw8klGe+KxCxux5IQud3IN/fZDugzDf/OjfXZQZuSO yt72cWTi27gtLSoypazdolqvdL0+0dbbaqYHxIaiQZnGDoM3u2E6emll4tMnhxjpmMYf l5AA== 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=Ntsor/qCmdjkWmlOoyynMkE4TxeGboUKg9xj07HF+bY=; b=hGz7GpF8wKHmi2BFv2QaLfk82fdHCU24Zx34s7nYur2EzI7VLSgzJ+OtVYkZBa8PBk x8J/Mmug+PVN6BPpbolhnTUksox35je+hln+72mI2Jwj8ybZp5GYkfe7fiGspmDFkWyI hwnc45c48SvMsbkfKjA5Pnac+17L1wgyg6F6KpfJV2ZQEQViR45ADCSCWdTYbdu4W7ce OSplsXjbYjUreWA1xMxLEbaxJzBcfpSP5DLD3vmbgX/VE+c4Q2wpYKwcxYko3EmyLCBS 0jPCDl4jLLsxIFR8Bwe5O5jMLOFhydiPx6D8rHHWIGul3kKCsPw9v//ikds6DsgdzYti Z6ig== X-Gm-Message-State: APjAAAUGENoqid5NI2K1Vfg0k5UpqOMEj/t9nlQgqOSVY0iX4Kd2+J+y 6/wDcysmZclVseex3L35Nd1pAK1JtkZP3GijSmWhEA== X-Received: by 2002:a05:6830:1216:: with SMTP id r22mr11054399otp.198.1553895676071; Fri, 29 Mar 2019 14:41:16 -0700 (PDT) MIME-Version: 1.0 References: <20190328225925.241998-1-jannh@google.com> <530a0823-5dcd-9006-2057-ae5b9da2389a@codeaurora.org> <3275e86a-5b12-29ff-9b1f-d8eba099ae98@deltatee.com> In-Reply-To: <3275e86a-5b12-29ff-9b1f-d8eba099ae98@deltatee.com> From: Jann Horn Date: Fri, 29 Mar 2019 22:40:50 +0100 Message-ID: Subject: Re: [PATCH] x86/calgary: fix bitcast type warnings To: Logan Gunthorpe Cc: Mukesh Ojha , =?UTF-8?Q?Horia_Geant=C4=83?= , Muli Ben-Yehuda , Jon Mason , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "the arch/x86 maintainers" , iommu@lists.linux-foundation.org, kernel list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 29, 2019 at 10:32 PM Logan Gunthorpe wrote: > On 2019-03-29 3:19 p.m., Jann Horn wrote: > >>> Can the existing api's not be used here like iowrite64be/ioread64be/ or > >>> similar variant in "include/asm-generic/io.h" > >> > >> Oooh! I didn't realize that those exist. I'll change that and send a v2. > Yes, they are very new! It took me a while to get those patches in as it > is a bit more complicated than it seems. > > > Actually, that doesn't work at the moment on x86-64: > > > > include/asm-generic/io.h only defines these things if > > CONFIG_GENERIC_IOMAP isn't defined; and X86 unconditionally defines > > it. With CONFIG_GENERIC_IOMAP set, these functions are provided by > > include/asm-generic/iomap.h. > > For CONFIG_GENERIC_IOMAP, lib/iomap.c provides _lo_hi and _hi_lo > implementations seeing the pio regions must be emulated with 32bit > operations and we have to define the order. > > > The definitions for these are in lib/iomap.c, except that there are no > > definitions for ioread64be() and iowrite64be(); if you try to use > > them, you get linker errors. > > Some platforms implement these but most do not. If I recall correctly > only powerpc does. > > If you want to use 64 bit operations in a portable fashion, you should > include "linux/io-64-nonatomic-hi-lo.h" or > "linux/io-64-nonatomic-lo-hi.h", depending on weather you want the lower > bits or the higher bits to be written or read first in cases where an > atomic operation is not available. So what is the right thing to do in the context of arch/x86/kernel/pci-calgary_64.c? That code wants to perform MMIO with endianness conversion, and these accesses are always performed as MMIO. Using the non-atomic 64-bit I/O helpers for this would be kind of awkward, since the accesses would never actually be split...