Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6364832rwl; Tue, 4 Apr 2023 11:27:49 -0700 (PDT) X-Google-Smtp-Source: AKy350ZZhlTg4eCQotHAROv0ZMFeNzFTpd0DDTdQZgAbQN5uo2A3hZfgNw8tCR7sNJaE/9KgXLRH X-Received: by 2002:a17:906:c9:b0:933:fa42:7e36 with SMTP id 9-20020a17090600c900b00933fa427e36mr569582eji.5.1680632869216; Tue, 04 Apr 2023 11:27:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680632869; cv=none; d=google.com; s=arc-20160816; b=xxZTNsR/fVYNbpbhLgzv6xmr8FOVbeZnhBSm+sNOQJO2hSxWWJBGX+rHX0vQ83TKCI irmDklkbd0JL0LojTsY0AB1+D3w28QezkbnA4cWxiLJfPQ94I1J5qNZPhpkFgtV1GleN J/LiE/LCC2pIb0S6L7TevKOD793n4w2Kanq0xqV7F2qlptbkD1UgbkNlITLZjgCX8swE wDYd7KETJOSb7nGBx7ONGQdTPHOXtyQSWoO3kf537y1ChkgHhMjo/8RXzoYcvVrYfljz ZkQZeVdFZxgsjt+clAsHYI0+cXKGum3JdwPXmeUdVR0bLlV/CgoCVE3N+/PAUJ2QcL2A 9C6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Gqxa4spepTnsUwVbNTwSWIuFxwC658E+AuuPxXktYUk=; b=ToKyqvGX9dT/uFiAp0fTFcHEysu0g7UVc65teWNv1fdOBSot3UhCvEqb/aI2+MyC06 xF2E3TDqokzekRvkzLn0kk/fUYcuEueu/lZmHJuah6O8yjLY/egkVSp+cVyNPrc4ROWy Jgk2n/3y3rOEwEc2DzZU0NSpOB+Qku7PETbhlKIu6v2Ct3Bb7j8RICkEs8FQbAvyaSn0 EVlmpTkfOe4x/OY8T8ggIGblmhhFuPbvxHJdg/Vv6EjoH4Jh5OtcDaOxyJKAEEzt6Kdn +d3sM6jVpr/9F5tKZpkODXo5rk806NQ+pWa+SCQeceqTg7ZlIAjWCQUVSLT46iKEHSGE qTag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=kAvoNYqd; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ca24-20020a170906a3d800b0094762fa0f07si146384ejb.720.2023.04.04.11.27.24; Tue, 04 Apr 2023 11:27:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=kAvoNYqd; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236445AbjDDS0j (ORCPT + 99 others); Tue, 4 Apr 2023 14:26:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236449AbjDDS0L (ORCPT ); Tue, 4 Apr 2023 14:26:11 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E3B772A0 for ; Tue, 4 Apr 2023 11:23:37 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id q102so31475865pjq.3 for ; Tue, 04 Apr 2023 11:23:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1680632608; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Gqxa4spepTnsUwVbNTwSWIuFxwC658E+AuuPxXktYUk=; b=kAvoNYqdv/gD8yskD/3UsIZZx/i7x6fcbhJrbItIXOVXMaf2J/ZphfqXiq9a0kB1u6 PmIxtinJIL/VK4LPrFwgURCxv3uMUJaXR8WupowGpRdbZYxe85vGf7ADA3kpdGLGAjbw doyBX/v48bQyNdsiTbpiqy+9xqhSQ/wjueeo3mWjHXI7j5kcoXr3GBMPSRO6QBlcfYJL R/rE84Q8SYe+o93Fsj2ITB9DYOXg1jXgXV57Lpo/XLRh+NBFQ/p1nNn9hZqy4KxK2o/2 A9STBeEYXkETh3CnhrVKqaS3widasWrESAX5SSaNCUkVwZAhEOTn5+5CcS1XD6b614hV WsTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680632608; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Gqxa4spepTnsUwVbNTwSWIuFxwC658E+AuuPxXktYUk=; b=Gvnh7ObPJX6Hr159d5/rAHXSUpTOgFJ2HIn2JkUMOKL7QabJRxz8NZQ/kz5MspyNf9 h6P9zxsX7NiPnRsytpFXorE2fLX5z8fyGMUfPEAgfZBrUEnlED70e44gaj4Bk418G3Vu HtugV33jjCXs6+se9UdFNV/jpA5XwDQNjGb1OCwXAPwletVZuXNAUltZlxDZqkB7KAJV oh5uKyJarSGXshTp/AEqNS5nXJsiQjKrMFRQPtkC8+YnKUfz1XTAg9MJQSl0n+GgZfpb 31rRx8PLAXLTfmnOir+SYSA+XHXF6itQqo+Oz09rK1rvpMbggJjDHdw0fflbt/SqmLYU chLg== X-Gm-Message-State: AAQBX9fenKYyyvim6hH3IT50efql4rckUmqXJFZYkbXWs1ZAsdFv9LH0 hknNfyhb4UvZCKnOJMNQeIj3XQ== X-Received: by 2002:a05:6a20:6687:b0:db:6a5a:3ce7 with SMTP id o7-20020a056a20668700b000db6a5a3ce7mr2798195pzh.12.1680632608339; Tue, 04 Apr 2023 11:23:28 -0700 (PDT) Received: from localhost.localdomain ([106.51.184.50]) by smtp.gmail.com with ESMTPSA id o12-20020a056a001bcc00b0062dcf5c01f9sm9018524pfw.36.2023.04.04.11.23.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Apr 2023 11:23:28 -0700 (PDT) From: Sunil V L To: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-acpi@vger.kernel.org, linux-crypto@vger.kernel.org, platform-driver-x86@vger.kernel.org, llvm@lists.linux.dev Cc: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Len Brown , Daniel Lezcano , Thomas Gleixner , Weili Qian , Zhou Wang , Herbert Xu , Marc Zyngier , Maximilian Luz , Hans de Goede , Mark Gross , Nathan Chancellor , Nick Desaulniers , Tom Rix , "Rafael J . Wysocki" , "David S . Miller" , Sunil V L Subject: [PATCH V4 23/23] crypto: hisilicon/qm: Workaround to enable build with RISC-V clang Date: Tue, 4 Apr 2023 23:50:37 +0530 Message-Id: <20230404182037.863533-24-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230404182037.863533-1-sunilvl@ventanamicro.com> References: <20230404182037.863533-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org With CONFIG_ACPI enabled for RISC-V, this driver gets enabled in allmodconfig build. The gcc tool chain builds this driver removing the inline arm64 assembly code. However, clang for RISC-V tries to build the arm64 assembly and below error is seen. drivers/crypto/hisilicon/qm.c:627:10: error: invalid output constraint '+Q' in asm "+Q" (*((char __iomem *)fun_base)) ^ It appears that RISC-V clang is not smart enough to detect IS_ENABLED(CONFIG_ARM64) and remove the dead code. As a workaround, move this check to preprocessing stage which works with the RISC-V clang tool chain. Signed-off-by: Sunil V L --- drivers/crypto/hisilicon/qm.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index e4c84433a88a..a5f521529ab2 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -611,13 +611,9 @@ EXPORT_SYMBOL_GPL(hisi_qm_wait_mb_ready); static void qm_mb_write(struct hisi_qm *qm, const void *src) { void __iomem *fun_base = qm->io_base + QM_MB_CMD_SEND_BASE; - unsigned long tmp0 = 0, tmp1 = 0; - if (!IS_ENABLED(CONFIG_ARM64)) { - memcpy_toio(fun_base, src, 16); - dma_wmb(); - return; - } +#if IS_ENABLED(CONFIG_ARM64) + unsigned long tmp0 = 0, tmp1 = 0; asm volatile("ldp %0, %1, %3\n" "stp %0, %1, %2\n" @@ -627,6 +623,11 @@ static void qm_mb_write(struct hisi_qm *qm, const void *src) "+Q" (*((char __iomem *)fun_base)) : "Q" (*((char *)src)) : "memory"); +#else + memcpy_toio(fun_base, src, 16); + dma_wmb(); +#endif + } static int qm_mb_nolock(struct hisi_qm *qm, struct qm_mailbox *mailbox) -- 2.34.1