From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE04D1BC08F for ; Wed, 31 Jul 2024 16:27:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722443241; cv=none; b=pXvg7n7R77R3po4sgwilLxj9nL1DXuHno1cKr4J7kli9AWQPgSkS+VpE5Q1Du7a1KlVtbKapD/l8Ce/rjfmXUf/x6m5JWPaWckOM4irl1r4wsNdXH3zQ+zk/5nMrYfh2wmJn0RjqVcWZqWj0r1Nwy9iWEvmf7M+zKQMZ4J6UJQY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722443241; c=relaxed/simple; bh=6MTBTOFgscLG+ns0zexJUodY6X3jKNyieaQSLz2kb/8=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=GiG9/u99Xs97lFvmc21/ZqBmyoMBWvSmtYlCTmu+5RW5IeXfxduPU9ClwFqlVgo8pQwEPcauuNfXWbYcXRRLKX/YecFHa6zOEXt7bmsX+P3iFCORIda0fxkHrGkfMHeQhGN1WPJz5oF+4QIZyFt7gIcoR3x7O6stoVkBUGJIVbw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=E6cSSyLb; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="E6cSSyLb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722443238; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h0mBAGnXHl/olCTlGA2xTK5HrQdrCWUfp+Vx9tKZMRQ=; b=E6cSSyLb+tnDyLrzZntYFjmsyshFeX6aaRFrXNwCdY2KdUoTSZTJaLd7B/Fy3rAQQcO5rA CiWJ9TR36E2uWMcBV7ypcSimsD5UMSLxvK9vEkswGMsXuh5G89TUFZhPcUyGCp2RsxJiWi zpS/xvtq9ABkoGca+WtkRxGJn3Wz+Fo= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-662-3xhpCYXtOg6IUOXmFk_Yng-1; Wed, 31 Jul 2024 12:27:12 -0400 X-MC-Unique: 3xhpCYXtOg6IUOXmFk_Yng-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C684B19560A1; Wed, 31 Jul 2024 16:27:08 +0000 (UTC) Received: from [10.2.16.69] (unknown [10.2.16.69]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DE8973000198; Wed, 31 Jul 2024 16:27:03 +0000 (UTC) Message-ID: Date: Wed, 31 Jul 2024 12:27:02 -0400 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 02/13] riscv: Do not fail to build on byte/halfword operations with Zawrs To: Alexandre Ghiti , Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Andrea Parri , Nathan Chancellor , Peter Zijlstra , Ingo Molnar , Will Deacon , Boqun Feng , Arnd Bergmann , Leonardo Bras , Guo Ren , linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org References: <20240731072405.197046-1-alexghiti@rivosinc.com> <20240731072405.197046-3-alexghiti@rivosinc.com> Content-Language: en-US From: Waiman Long In-Reply-To: <20240731072405.197046-3-alexghiti@rivosinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 On 7/31/24 03:23, Alexandre Ghiti wrote: > riscv does not have lr instructions on byte and halfword but the > qspinlock implementation actually uses such atomics provided by the > Zabha extension, so those sizes are legitimate. Note that the native qspinlock code only need halfword atomic cmpxchg operation. However, if you also plan to use paravirtual qspinlock, you need to have byte-level atomic cmpxchg(). Cheers, Longman > > Then instead of failing to build, just fallback to the !Zawrs path. > > Signed-off-by: Alexandre Ghiti > --- > arch/riscv/include/asm/cmpxchg.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/riscv/include/asm/cmpxchg.h b/arch/riscv/include/asm/cmpxchg.h > index ebbce134917c..9ba497ea18a5 100644 > --- a/arch/riscv/include/asm/cmpxchg.h > +++ b/arch/riscv/include/asm/cmpxchg.h > @@ -268,7 +268,8 @@ static __always_inline void __cmpwait(volatile void *ptr, > break; > #endif > default: > - BUILD_BUG(); > + /* RISC-V doesn't have lr instructions on byte and half-word. */ > + goto no_zawrs; > } > > return;