Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp1580400ybj; Fri, 20 Sep 2019 12:49:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7ntUwFnqJyOpCFbRLaOvx5SKw+dOZsgxqE3sgV4ymGJKzjURexs+Z2GYFP7dFwtWHKyf3 X-Received: by 2002:a17:906:cc9b:: with SMTP id oq27mr19619971ejb.125.1569008977546; Fri, 20 Sep 2019 12:49:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569008977; cv=none; d=google.com; s=arc-20160816; b=GPrRep/Lv3u9i5CcsHyL9tKS5bdZo+IlxZA74R5phqcczwsYUYZkegkC5p0JZCLtSM gwgru2Thkt4vK2YkaHi1Hby0CKnt+FzEJKSlne3vtHELufNC1wGL2iBw4Ue2bvJPFBEF 09XJrPpbgjJjp7m36DSh4p6vXyNOH5gIv0MxjKzvWN4cDL1eJ5OevHozDd0ykSv7luzo DlCpa3KOjJBmZoEUo0OwFJv/g8rolX2uY/smf5wLFeb2R2F7ysOgMAZ5+hCJhVz0Sga6 9LIb6CAF+OGZ193Izr62wZzQtpj18WkCShrNjoSU+ziKSoG3BQsm/prgEed3qpGjqRLI dP4A== 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=4Yu0bebIccH+12tZYtfI1e/8Z8n4TfOTtSvrlww5Bbo=; b=vei0uN8pAuud3+2mzhdRey8eNzzAidezgD3GSXxubfTgHs98XuG7BLz/SF2+iXV/E1 1EZY6Rk+kIzzRXVDvHfihypLbDHHh6iG8N5568/HS2ckMMyK20hKfjQ9QOgmGIVD/BwQ yKDcUsH+m+8FsWMS8jAihNCscrLty0VXWLjYErnB30q7IXn9ZS/U2ll6WZ8HHrDENuf+ iGXwZp0UYl1kbjoAYA/AxleYX/ty7g26e4lTFx9g3ZfYDsdYvNXDB+itQIDXBVdbYhPn XpigIguTptqHnsCKLf+U7fbkyb+iAJtfAp+nX9HTlsS7Mu1sRbczfkbe+g6wdCiO6CQQ RFMg== 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 a38si2141803edf.260.2019.09.20.12.49.12; Fri, 20 Sep 2019 12:49:37 -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 S1727637AbfITN1K (ORCPT + 99 others); Fri, 20 Sep 2019 09:27:10 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:32778 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727563AbfITN1K (ORCPT ); Fri, 20 Sep 2019 09:27:10 -0400 Received: by mail-qt1-f195.google.com with SMTP id r5so8666884qtd.0; Fri, 20 Sep 2019 06:27:09 -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=4Yu0bebIccH+12tZYtfI1e/8Z8n4TfOTtSvrlww5Bbo=; b=ZVgniuPoXwOlgH3C4DwNsS0ondEh2J5yRbSVamOYukONyu8SAoCtoX/T/yceUr7zBF 3kzlwt0Zflcc7XDMO5sBTnC2ym2qfgZvPi52BQyojW2Jv4tiSU9kinX2MQabmBCUy3LB 49Hyzzh9kpSuRS6ieYXrOzolgkEcAOqaT99rMnWhwi+YQdLvKPzAhD7VkqNFCbh5wnMk hALQruqOhPVTlApXGk18TSKc+Ms+hKql0iyp6AiZNSH8uvflXPKfM0b2qLAmpy5Tsgqx 98AFhKa6/ekBcjoRtusZ5kNPu109Z8MKDoy4o/XwesZEZEzwiabvlCvOjFLvLmduof/V PhQg== X-Gm-Message-State: APjAAAWKpd8ptyMJqQ0aaMj8G3yomONqu1SglNZfgOPC8qQQoqOkAC8c SlrlKxqK2+orBjpZgHF2KKycq9V759IZZkbl1Fb55x0T X-Received: by 2002:aed:2842:: with SMTP id r60mr3277241qtd.142.1568986028586; Fri, 20 Sep 2019 06:27:08 -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:26:52 +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" 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 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. Arnd