From patchwork Wed Jan 17 08:25:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yunhui cui X-Patchwork-Id: 188716 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp768110dye; Wed, 17 Jan 2024 00:26:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IGW0UTrY9gLWAoFDOYtAyYR8kxfj9kMCyZyDI2bvSNNyRZZpgiM6edvkXbSlTvWSJk/FozN X-Received: by 2002:a17:902:eacc:b0:1d6:f480:3c6a with SMTP id p12-20020a170902eacc00b001d6f4803c6amr162511pld.6.1705479965543; Wed, 17 Jan 2024 00:26:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705479965; cv=pass; d=google.com; s=arc-20160816; b=WR6tOpl7rVjpySgIwNiULBtKAQk3XJmLZ0Qxpvf++8Wv1yBuwHfaWc6fNQ6E4f8C6q idrrXYiezPhtbTS/H0JbRyIen8/R+e4IP1Ld6um1ue1WO4RNyxDANHMz3G51GkuZp1SA kQrU8gQAc2e+zi6rX20pUDp09I/fyfvKn5lXBFLbkSVzIdET7rTAPD3GtuQAbQOpeb4s FQSMNY6uE3q5rDbhKDlswdzMEwHfeR3vU5J48wHsc44mQUOnrNc6LTLOIF3s1UMCrP8k xkzosvFIBt58J5+3IO+rUAhDPRZuqpuZHiw5TdHHRdAtm7EyyZbydYo362y/cDkx7N+T jj6w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:to:from :dkim-signature; bh=BLAj/2p6EWO6CuOFTo5201/UFs9ytEaathr/jXBe1ac=; fh=fsPBqcPJNLaPzHWVnCzB7O0tlxq4gy1Cf198EN0D3bw=; b=Fg+no7vJTUUAodE0BcKKz5/Rxsl4tRBlr1KAI/WxO2BmiUX0Oop0G4GeYV/7CAxcMM hKgjj9uFz5w+HkGhRl9WMpYeWidSAJbS66wwOhplHZUmXg8Era6Q0h1lzh3piJPA+pLD WZdfxXVWJxz17FtAfkTp5ai7CVYl+Og3djMyWlLxe4lei13uKVhbBqSXEgE6Sz/KcDgt vw+LfUp8U+4nMqCHGygNVuuCGJ9qvB1QM5hvRQArrMI4cDbUQmdXpJWKH+M7907/beJa QPpYqIRMrDq1jtLofroD/hmfOcXzSS20tkxNhD54Rc+LVcdTVTCNLa+yCEglhk0s3D7z a9pQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=cbUlO8+f; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-28641-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28641-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id lb16-20020a170902fa5000b001d3c228953fsi12716485plb.392.2024.01.17.00.26.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 00:26:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28641-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=cbUlO8+f; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-28641-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28641-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C8722282061 for ; Wed, 17 Jan 2024 08:25:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0982E1173E; Wed, 17 Jan 2024 08:25:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="cbUlO8+f" Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89462D2FF for ; Wed, 17 Jan 2024 08:25:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705479924; cv=none; b=C16sbgdmZz4ao9MYOlzcy4ynP2MIyA4hrwuv6tPGOCwSV3iFhXugdXVhy2lVymJAk6aPrafM6nnkiYZgbz+oGWuMi3k5pJDBE4DY8BPixb1O3cR8sqgCSTni0vvuzFLhyRaLrt+k4/GifL8skYS2/bNKSQUs7MoTVrHRPCVSXt8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705479924; c=relaxed/simple; bh=KYU+/R9/w0I7hKX9NysG82L25bCespxuVs1S32IvAgI=; h=Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Google-Smtp-Source:X-Received:Received:From: To:Subject:Date:Message-Id:X-Mailer:MIME-Version: Content-Transfer-Encoding; b=cR/YxH/D83VgV6blAQL/ihEBA7nQIzGglSh815OGpJ73YR4EVE4fxzKcz8I7Adyjha/Hhr4oLrdAzB10I5KCR6F3OEuG9BR39spkfcFalzOuR5pbGyfZjvaP85U1382Btv1tRTQfqu4kg2PDPlkRR43617oVV4iSWLfCfqxKI/c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=cbUlO8+f; arc=none smtp.client-ip=209.85.210.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-6daf694b439so5822159b3a.1 for ; Wed, 17 Jan 2024 00:25:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1705479922; x=1706084722; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=BLAj/2p6EWO6CuOFTo5201/UFs9ytEaathr/jXBe1ac=; b=cbUlO8+fCuXiGCm0xFTJFFlQZBTWlVQdnWNbTDZdJK3CBVZuL44atd8Gl2BlPkfrLw 8zuZJ0kqPBg3LOnYmlPgBhXhGWuSTqQ6m2LltBM4DRhe9+h+IvstT+bScqCp5Ekq25ka Fzp1wmFLzGj2OF2P0v844Ue0O/ptWKarOp0ifpeGqlRk76K3wL9M9cTML0l3eARurp0w m4qw3NiF2tpNze/myXj65gL2hm5sNanvmbnYitLn/bsocxOMJECrin6hdLjc8P3jPO1k 0eJMdbN+d+M/LEoiJAVpxlK8z31JMpNzTy4gvE2yDGvcBOPMkfmqDYJ8lZ11vJcpN++X 6Y1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705479922; x=1706084722; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BLAj/2p6EWO6CuOFTo5201/UFs9ytEaathr/jXBe1ac=; b=bJeNVaxHRO67DW7c7WXYJVES+JK6KHH90SMTrqREhtSbBDnSpKLJ3E2n74H6A7zq8T qONunF7Cr7Lgmzu7ZtFvOLWMzs2GHniUKQDcXxV7ZY7IK0gZJ0eFvxoWV2ln70/Ur6Q/ Vqp+7p5ef1RyyYy9paPDtiIyGyCrcSAqvZ0iZFJ1k0fBkVzSLNNPYVj/TdzG78mnuofm 2MvADgKb59h6S26dIb9JLRNpCPkoPkxcicS2KO7reMyfjUWomQ8kuYK9o2R3AnlVZR2/ D4f/k7QcP5D2SkBx3eF9rO5eJHBx9xtenc8MZNsBh3qQu6ofDatJYB5UsYlwD9ueyUwD cX0A== X-Gm-Message-State: AOJu0Yxp/QuchedS7rjKtOhVJwGXOfWHX7orR+7qoqeSDbkGX+2Ngwju /dKeMpFuQd/aLaLZZFCy6Qv+s50jptfwow== X-Received: by 2002:a05:6a21:338f:b0:19b:7e2c:d5db with SMTP id yy15-20020a056a21338f00b0019b7e2cd5dbmr42515pzb.38.1705479921914; Wed, 17 Jan 2024 00:25:21 -0800 (PST) Received: from L6YN4KR4K9.bytedance.net ([61.213.176.6]) by smtp.gmail.com with ESMTPSA id jg20-20020a17090326d400b001d060c61da5sm10426802plb.134.2024.01.17.00.25.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 17 Jan 2024 00:25:21 -0800 (PST) From: Yunhui Cui To: shuah@kernel.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, cuiyunhui@bytedance.com, ajones@ventanamicro.com, xiao.w.wang@intel.com, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, xuzhipeng.1973@bytedance.com Subject: [PATCH] RISC-V: selftests: fix cbo.c compilation error Date: Wed, 17 Jan 2024 16:25:14 +0800 Message-Id: <20240117082514.42967-1-cuiyunhui@bytedance.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788325360126491328 X-GMAIL-MSGID: 1788325360126491328 When compiling with -O0, the following error will occur: cbo.c: In function 'cbo_insn': cbo.c:43:9: warning: 'asm' operand 1 probably does not match constraints 43 | asm volatile( | ^~~ cbo.c:43:9: warning: 'asm' operand 2 probably does not match constraints cbo.c:43:9: error: impossible constraint in 'asm' Add __attribute__((optimize("O"))) to fix. Fixes: a29e2a48afe3 ("RISC-V: selftests: Add CBO tests") Signed-off-by: Yunhui Cui Suggested-by: Zhipeng Xu --- tools/testing/selftests/riscv/hwprobe/cbo.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/riscv/hwprobe/cbo.c b/tools/testing/selftests/riscv/hwprobe/cbo.c index 50a2cc8aef38..ff1d8e843d70 100644 --- a/tools/testing/selftests/riscv/hwprobe/cbo.c +++ b/tools/testing/selftests/riscv/hwprobe/cbo.c @@ -36,7 +36,7 @@ static void sigill_handler(int sig, siginfo_t *info, void *context) regs[0] += 4; } -static void cbo_insn(char *base, int fn) +static __always_inline void cbo_insn(char *base, int fn) { uint32_t insn = MK_CBO(fn); @@ -47,10 +47,11 @@ static void cbo_insn(char *base, int fn) : : "r" (base), "i" (fn), "i" (insn) : "a0", "a1", "memory"); } -static void cbo_inval(char *base) { cbo_insn(base, 0); } -static void cbo_clean(char *base) { cbo_insn(base, 1); } -static void cbo_flush(char *base) { cbo_insn(base, 2); } -static void cbo_zero(char *base) { cbo_insn(base, 4); } +#define OPTIMIZE __attribute__((optimize("O"))) +OPTIMIZE static void cbo_inval(char *base) { cbo_insn(base, 0); } +OPTIMIZE static void cbo_clean(char *base) { cbo_insn(base, 1); } +OPTIMIZE static void cbo_flush(char *base) { cbo_insn(base, 2); } +OPTIMIZE static void cbo_zero(char *base) { cbo_insn(base, 4); } static void test_no_zicbom(void *arg) {