Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp1583017ybj; Fri, 20 Sep 2019 12:52:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzb1Fr8sTtvWSYY8tgTCZr/AMcNrXwhiGjnLaqtw3FyVWdxDO1lt5HK+vJpIxIT8Jv7S8nY X-Received: by 2002:a17:906:8054:: with SMTP id x20mr15745086ejw.65.1569009153922; Fri, 20 Sep 2019 12:52:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569009153; cv=none; d=google.com; s=arc-20160816; b=gt6Lzxw3fvqWRLE4xuvRkIXkXo9YB8HocrFfmq9RCcq+jRvPp21YtrFJ69MZCTHt8G 9rN3UR0iyY1PKJKCPiEFylnqLwQidykBnRu4rOq7ngQ6eJo15d6Caokqi9ol2idYtlpE EmxG/CFTwAwgDNcYbWnGMIaXPOjxel8N5lHI8woiLXxFbCd3bRr6HuCmCurxH+XeTY7k fxmw5MPa9ZTsQ0UpBk18zADExAVLlqqP21YHA/P6AuQEkhW/dk+bBYNOnwdooveJe4w/ W34t5JNX54UWdzJ5hoG0+dvEyqI+V8PmWCcySZduJ8b3GzBKF8WZsXACgLc84OAzhheo 7i1w== 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; bh=CvmD4YNxBRUn/0UjBurEbyET+Nr9/JlVxXl8gG9TzCg=; b=jxCujIObis20YoN/C3Av3EwGXA2AE4RDqt0A5u0Bu+4xTZtw0alEbVHPWIk2SDSL80 Fq3spBvg7y1+7DHVmuf9lqUuapJWj2X5Z40LniHpiOAiJh6iIInz8AVqJTWAih3nBIF6 Re+RDEf6dnGps2ZIUD/GvdCT/bpU3RRI+shKDiZvA5cPxTMR+NX4PsGdfEhiGFppjnDY x9urE4Wbfq08kgZ1eWOVVMJg0JAcIjjBYlr1+6+j8BIy2TIucC0OTT9StqQk5VXla7UR Ylc8LTANKugQSd395gwJe0HpM+++yXdkTVaTceo5T11sgz0BHeVBGa1nOy/omZPDbPg7 0Fqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n6si1601744ejj.232.2019.09.20.12.52.08; Fri, 20 Sep 2019 12:52:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727268AbfITNgz (ORCPT + 99 others); Fri, 20 Sep 2019 09:36:55 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:44329 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727573AbfITNgz (ORCPT ); Fri, 20 Sep 2019 09:36:55 -0400 Received: by mail-qt1-f196.google.com with SMTP id u40so8620596qth.11; Fri, 20 Sep 2019 06:36:54 -0700 (PDT) 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=CvmD4YNxBRUn/0UjBurEbyET+Nr9/JlVxXl8gG9TzCg=; b=VKu/r0POY5GoRKZM4pey3qwQ9U7MrUqYDObvUlXIfmpm006b3nz2KHFjWTfp0067AD 8idVMmNBQYgJIfEJeYHxgkaKVgtQrRThQq9Stxvb08QNV0WFREDgWA/fDOivWLOYZRsI 3tesfcmGYu2DoQIWToto8AR13jqzpR6MPBDdfl3uiZklX6XUmzusQoiBLYWLaH2sy+im 1WkHH8M+hSIoiUITjudNf4474/SXJN1VR8yrQ6mhjpC6+H35JQc//h7x4qgZ404RuaKr 3aGOHUW0a7ZjWaiSAzk2mTSdaTdbxo3gkbLS3f/rDtHNyI6IA3nwoJ8jDp43qI0hMGAh 1A3A== X-Gm-Message-State: APjAAAWGCncYMWRDCg+Jspx61qPH1VAoCs2XvIjOD3+1EMV1uTeHS8u0 Z1rx+14s7kzvl2YyPYTz/DkZLQdwA8DL1Krpu6UOFuku51k= X-Received: by 2002:a0c:e74b:: with SMTP id g11mr12883090qvn.62.1568986613979; Fri, 20 Sep 2019 06:36:53 -0700 (PDT) MIME-Version: 1.0 References: <20190919140650.1289963-2-arnd@arndb.de> <20190919140917.1290556-1-arnd@arndb.de> In-Reply-To: From: Arnd Bergmann Date: Fri, 20 Sep 2019 15:36:37 +0200 Message-ID: Subject: Re: [PATCH 2/2] [v2] crypto: hisilicon - allow compile-testing on x86 To: John Garry Cc: Herbert Xu , "David S. Miller" , Zhou Wang , Jonathan Cameron , Kenneth Lee , Mao Wenan , Hao Fang , Shiju Jose , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , "linux-kernel@vger.kernel.org" , Will Deacon Content-Type: text/plain; charset="UTF-8" Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Fri, Sep 20, 2019 at 3:26 PM Arnd Bergmann wrote: > > On Fri, Sep 20, 2019 at 10:34 AM John Garry wrote: > > > > + if (!IS_ENABLED(CONFIG_ARM64)) { > > > + memcpy_toio(fun_base, src, 16); > > > + wmb(); > > > + return; > > > + } > > > + > > > asm volatile("ldp %0, %1, %3\n" > > > "stp %0, %1, %2\n" > > > "dsb sy\n" > > > > > > > As I understand, this operation needs to be done atomically. So - even > > though your change is just for compile testing - the memcpy_to_io() may > > not do the same thing on other archs, right? > > > > I just wonder if it's right to make that change, or at least warn the > > imaginary user of possible malfunction for !arm64. > > It's probably not necessary here. From what I can tell from the documentation, > this is only safe on ARMv8.4 or higher anyway, earlier ARMv8.x implementations > don't guarantee that an stp arrives on the bus in one piece either. > > Usually, hardware like this has no hard requirement on an atomic store, > it just needs the individual bits to arrive in a particular order, and then > triggers the update on the last bit that gets stored. If that is the case here > as well, it might actually be better to use two writeq_relaxed() and > a barrier. This would also solve the endianess issue. See also https://lkml.org/lkml/2018/1/26/554 for a previous attempt to introduce 128-bit MMIO accessors, this got rejected since they are not atomic even on ARMv8.4. Arnd