Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp492027rwl; Wed, 5 Apr 2023 03:54:00 -0700 (PDT) X-Google-Smtp-Source: AKy350bNAv7ISm3N9rOWLTY5JsBN+LCzcz3w22BPqtJtehxPPZrvyBA6Z8YRgxvq7WUmoqGHu5kg X-Received: by 2002:a05:6402:4413:b0:502:1f7b:f0a6 with SMTP id y19-20020a056402441300b005021f7bf0a6mr1664466eda.0.1680692040588; Wed, 05 Apr 2023 03:54:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680692040; cv=none; d=google.com; s=arc-20160816; b=vher6fEs8lulzca2seEJL0JKDaXnz1RNJDn53b9scdJsVctd24iHcvugQVfVWrffF0 StahQKo/v9fnSy8j9KLvVz9FJHliLeREpwOCrO0oQNROvh5l6vpqdAqVlQEePZpyo9OL gzhuh0qyLOpjxyWLSctaHkfN83vBaIrvQMCz8kqCyks/9+3wsjkF2xzOfWRI+y5WluEU Ju1Lk7P8+5KJl1RtONXU5R+Q29QncO5UOUqg8inRBUlBIW5Q/uXrkR3icAztMikbhKnU kn1YuW37qfbYj7v25urC0iAXaPcmH9ikr4jKAvrWj58OQodAjTljuwsFAwaz9v0dCmPN O10A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=otykqullkWmg0A8KD35JF+HvspAaLoRDA6Fr6QFOB1A=; b=Mo9WFCSEU70fJuV0bt+JbjHvnsUuCxgcK2R222nKarwP+DQCvPX2rsDVQ00l1vjjSb EkbzYMlHGUtvo8pQA6639kZaHFVBx+01/i5GGLCS+q8vUrT28LNUHzvZT2Q1JqmLiU+p NRwZkwwOlATTnKgQbnqvHjWFO0QuquGc6unviK4RgLFLeWFJ/c+b7NwVzE/uRoKnvhtg OTrLt5EFZbW9T1pQpIIKPG1F1gmYTOeES2jth9YGq3j7B+YYMlYqW3ogv3fO+i+a47Cs jHgRy8B46ExoWcNZ1WHJeUSV8+8jeZRzdN0R+v9tHPBYuIEy4KTceAvpNA47deJD1nhF 4PSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=UQ0uumG4; 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 x12-20020aa7d6cc000000b004f0f1978619si488697edr.151.2023.04.05.03.53.33; Wed, 05 Apr 2023 03:54:00 -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=UQ0uumG4; 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 S237812AbjDEKqo (ORCPT + 99 others); Wed, 5 Apr 2023 06:46:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237250AbjDEKqn (ORCPT ); Wed, 5 Apr 2023 06:46:43 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CAFF19B2 for ; Wed, 5 Apr 2023 03:46:42 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id c18so34006432ple.11 for ; Wed, 05 Apr 2023 03:46:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1680691602; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=otykqullkWmg0A8KD35JF+HvspAaLoRDA6Fr6QFOB1A=; b=UQ0uumG4XH81lWfK6pVQa6G5b2bhg0H+jTMz7NTZVbIIyh41o0CBkytB6xZpFe/MDh Yffh5qenGWrU9TxMdihhNju6UMyitiMEbH/S8wc2qQG1KulmNjPVmxbe+5lvAhEFomTo UVZm4lhSh/J0/m6bMtf8ttgxYxkKl7fMCt60yIF06Ptxf/mvXyFUkNGGUYB2n0DaTbEg azqFX9oSbODaFFg4PbBU08adA+7I25vr0zw2LIqhUF9vuMMdUc7mKurF6cxQ3IPMwZvq T3aNBPO0bWfwSYeSYziw6ebXlP1MKTFYUr1w/FPVCAfBHvf9/tdCNmCXNug8DyFs3WjS 4MCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680691602; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=otykqullkWmg0A8KD35JF+HvspAaLoRDA6Fr6QFOB1A=; b=n0MfGh+F/7zjAiLuOa7lH2w7MttUecZztczQV3x+q9HEgS+weO7+vnFACe/ALENuEe UElpk/IN3IhJc8u647RdM/ruVTfipiNoZd834uwebirMUONEucssBTZaH/UH5KJA6XUA rXSRYx7d2joSJM1He7DRpTlE89qfSDYOnCSis36AjzlvuXnuH1w+D48os/UbSVNKSIEl eDHOaSzo//l+oQ5h7e4dhzRmWGqXhsiKNkyzDqWBNn70DjGkGkX4IoRzcb/9M31OSZUp ytIKzHhkZbossgEcl/gBb2C3iR7YyyD92kD+VxrvM0Q4WPeBt6sQQV0ifAgvIh4t6F6a 9wyA== X-Gm-Message-State: AAQBX9edBAFILJNqWqqCnPFZBrSyU/MjeXUneQYrHaUnMf4gMXlI57mL dYr1MLQEk6GR43wfWTEv/SJVzmvrO5GNpGxmpRg= X-Received: by 2002:a17:902:e294:b0:1a1:8edc:c5f8 with SMTP id o20-20020a170902e29400b001a18edcc5f8mr4558701plc.56.1680691601853; Wed, 05 Apr 2023 03:46:41 -0700 (PDT) Received: from sunil-laptop ([106.51.184.50]) by smtp.gmail.com with ESMTPSA id g20-20020a62e314000000b0062b5a55835dsm10319322pfh.213.2023.04.05.03.46.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 03:46:41 -0700 (PDT) Date: Wed, 5 Apr 2023 16:16:28 +0530 From: Sunil V L To: Conor Dooley Cc: 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, Weili Qian , Albert Ou , Herbert Xu , Tom Rix , Jonathan Corbet , Marc Zyngier , Daniel Lezcano , Nick Desaulniers , Mark Gross , Hans de Goede , Zhou Wang , Palmer Dabbelt , Paul Walmsley , "Rafael J . Wysocki" , Nathan Chancellor , Thomas Gleixner , Maximilian Luz , "David S . Miller" , Len Brown Subject: Re: [PATCH V4 23/23] crypto: hisilicon/qm: Workaround to enable build with RISC-V clang Message-ID: References: <20230404182037.863533-1-sunilvl@ventanamicro.com> <20230404182037.863533-24-sunilvl@ventanamicro.com> <20230404-viewpoint-shank-674a8940809a@spud> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230404-viewpoint-shank-674a8940809a@spud> 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 Hi Conor, On Tue, Apr 04, 2023 at 10:59:41PM +0100, Conor Dooley wrote: > Hey Sunil, > > This one made me scratch my head for a bit.. > > On Tue, Apr 04, 2023 at 11:50:37PM +0530, Sunil V L wrote: > > 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. > > There's actually nothing RISC-V specific about that behaviour, that's > just how clang works. Quoting Nathan: > "Clang performs semantic analysis (i.e., validates assembly) before > dead code elimination, so IS_ENABLED() is not sufficient for avoiding > that error." > Huh, It never occurred to me that this issue could be known already since I always thought we are hitting this first time since ACPI is enabled only now for RISC-V. Thank you very much!. > > 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. > > So I think this statement is just not true, it can remove dead code, but > only after it has done the semantic analysis. > Yes, with more details now, let me update the commit message. > The reason that this has not been seen before, again quoting Nathan, is: > "arm64 and x86_64 both support the Q constraint, we cannot build > LoongArch yet (although it does not have support for Q either so same > boat as RISC-V), and ia64 is dead/unsupported in LLVM. Those are the > only architectures that support ACPI, so I guess that explains why we > have seen no issues aside from RISC-V so far." > > > As a workaround, move this check to preprocessing stage which works > > with the RISC-V clang tool chain. > > I don't think there's much else you can do! > Reviewed-by: Conor Dooley > > Perhaps it is also worth adding: > Link: https://github.com/ClangBuiltLinux/linux/issues/999 > Sure, Thank you very much for digging this! Thanks, Sunil