Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1918841lqp; Tue, 16 Apr 2024 01:31:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVNfObQpzPP2mK4lHDnvSt5/dGcf2fec0aFyQ7G5w/lIjxnOY+TyRKwYTWVtMgUa+nllPIkHGUuDcDclad2rMAA65Y+7wlKTj/8V3KMaA== X-Google-Smtp-Source: AGHT+IGQ4a5xEggVhMiVu3wzDUUXmG4YPKLu+wr0XJprxnFSmRtfa4v+KGokC2MllT4TPUvrwyb+ X-Received: by 2002:a17:902:c40c:b0:1e7:eeb3:e295 with SMTP id k12-20020a170902c40c00b001e7eeb3e295mr170138plk.69.1713256308583; Tue, 16 Apr 2024 01:31:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713256308; cv=pass; d=google.com; s=arc-20160816; b=Or9RgEn8tV8ZqFT1zxEkHDs1roFZe2T+Kd9FhlRwGIZesR5UulEI7DoHCFfqylift0 3xREwMOHBNLXlq9Jbi2ijfYNDDxl+n58PNn/NUN1NfEhlzuubbugOP5a4K/VFfwc5mLd bldTR7hunmXUem3Scc3p2506qcfsOftXtalEWSCD75jcURWwNzy9MHJ5k4N9tJg9hVKd ChV8CWpRub2x2btcAQ6vT+vk4R0ycOu8IeT/3tLjB5MbtT0nU+SlgPqh/4JGV1+0/08/ Xj7ugD9UtFhoZNgi2aI3xwM1VRnfV1sNQRKf+XwrtOnhjxHlH9xFjDnIbTgLtTaeztEU WJuw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=akzntEN6IcfsPIIN3EJ0b1QR4PPdVf92yYRa0+VTDrk=; fh=RRQ3fwtFZENQI9PHcVsnPK5Cqmvv/C6bQrc9skSusF4=; b=cfj5qEtI7iulHRaKtVCnqVXGpfjKjJoy96Sj24BkH8IcvA8ywi6OHJuz1bhLoRcwsG DKbo0wFppQOWpeoIuZ2MQomhA8eUxXhFmLd2ohCEqt8zESH2/+2p6C96p/+SsResmp8u nHj0nVbSqcrtfgvBYNVebznlNPi+GLqRPqRjvVQsTM3l6KQr1HBePIAk2baXBh3B+Do3 6gFaZDJR2xKnUfQDsBDZJFo9ZcjEyw2PrINyju30tIjO5PoN2F4lGGviKR0DVwiXSub1 clEEJc4gnMIRygA6UWtgNA77YJGXrsu7sDiwehUjIWhR4Iy4eeXxAnGcxUv69b60KklU WBvA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="oRSHb/GE"; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-146498-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146498-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 21-20020a170902e9d500b001dd62fbcf75si9219365plk.536.2024.04.16.01.31.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 01:31:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-146498-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="oRSHb/GE"; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-146498-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146498-linux.lists.archive=gmail.com@vger.kernel.org" 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 4004E284E0A for ; Tue, 16 Apr 2024 08:31:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 55EDF83CBA; Tue, 16 Apr 2024 08:31:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="oRSHb/GE" Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) (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 E577C2B9B7 for ; Tue, 16 Apr 2024 08:31:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713256294; cv=none; b=DC79pxsQ8gtnbBIvELAY2ftptkBMVB2q83p5ud6XRNY+O6qPLjaipgmeKpW2UUbhbxNuo9b8FeqA3IEmTvdaT3rvEFuFj509Ur1DTCcNTxjpccF1XoooApLWpYyiyohO6F14fEnh8hzhlTYZ1DvVerLL+u27Kp+GTNQmvTwltxo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713256294; c=relaxed/simple; bh=QJUQ/zdpL5MKogbwTVUpahdJojofb6ggmogXZkHP62Y=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lpDpCd4KQ27+pSTG4uSgMuXPdZ97uzQpAV6P6kyXwHws+O7l6GS9HHH+bnwaqY5w02mvpq91lu4RfjHiRvs8b8nbSKhpC9HqxBUy9cJ/k5/uwSZfTOXdCz58DSxlpPxeOPDpzcZW0ePAHqdac/Lj2YxyXgHMhRYCdRST1i5jdsc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=oRSHb/GE; arc=none smtp.client-ip=209.85.216.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-2a4bdef3d8eso3035677a91.1 for ; Tue, 16 Apr 2024 01:31:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713256291; x=1713861091; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=akzntEN6IcfsPIIN3EJ0b1QR4PPdVf92yYRa0+VTDrk=; b=oRSHb/GE4NTlJUP44a/g5ZX2WwTpYnOxJCRdWcqjvaeKU6h9W3cuQHo6VxdCkLHEw6 c6/qZqC3K8ZHpFcKWH13prM75+sAEWMcoEX9hE8dC0Ynj9UqkMh8qlTaHhI3213ZnZEn xIh4LqVfQiMxBnuGlKEcgUUp6wRiTDIdat6bSNzCOM8NOYXg6JcrNPLBQL5am3Kg189P FENpHXd2RpodMT/R8VXUsYtRNBCK+OjZIMyhP8j2gVAVJtbcbthQgv9Jln5Uvtx/q8OK jb52H5FkbY7vTkn4ui+xwjrPpt4Hl8SU9NQCkfNV3JD6gsaniklTRKQEi7izBVvIbwGN LUqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713256291; x=1713861091; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=akzntEN6IcfsPIIN3EJ0b1QR4PPdVf92yYRa0+VTDrk=; b=vtdx8C7gIy4xU4PLPEjia1gyDpWG9T6ahR1klfWbQTGkJpiLjt+iuPIVjwKbJsIxnk 677blQ4Y6yfTYbmCfpA2Ufwt3B/JB5ZltBSkudPmOKcqvgUsBVJSPrMWvqU879a8t1Ge F06v91Ym1sHr5c/8bz419lDvZ+cPrdx8mWcLWGLjRstgJ39YA7kx9h/wcpmUJYrd8yxj iogkKObPARUnAUlYvIdix0XBsQgre+dINPskxvNMsCVQQp7jZh9ecg206cHsiFAl21/C iZ4vlUGt7IXFzNghCMo3wAOrCJjBLd0Xqqu4U9l96TWWh5pkxFau3sOLfrLs/++mzb0C 1wPQ== X-Gm-Message-State: AOJu0YzyOjv0xbIu1YdMbcJP8EeCKIctVSeS8nmrWQim3lwHeVCWJ45c iBXLHzlvxXDuJXJ5GhdXXLmyD9hSrN0iWjIKEUlGpGUiwXS6n7UxH/xUHdJG4/4= X-Received: by 2002:a17:90a:640a:b0:2a4:752f:b7b7 with SMTP id g10-20020a17090a640a00b002a4752fb7b7mr11498554pjj.26.1713256291117; Tue, 16 Apr 2024 01:31:31 -0700 (PDT) Received: from [172.16.0.33] (c-67-188-2-18.hsd1.ca.comcast.net. [67.188.2.18]) by smtp.gmail.com with ESMTPSA id d24-20020a17090ab31800b002a513cc466esm10012347pjr.45.2024.04.16.01.31.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Apr 2024 01:31:30 -0700 (PDT) Message-ID: <2a63d7da-91b6-496d-9966-e6c0a0aa6c6c@rivosinc.com> Date: Tue, 16 Apr 2024 01:31:27 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 07/24] RISC-V: Use the minor version mask while computing sbi version Content-Language: en-US To: Andrew Jones Cc: linux-kernel@vger.kernel.org, Ajay Kaher , Albert Ou , Alexandre Ghiti , Alexey Makhalov , Anup Patel , Atish Patra , Broadcom internal kernel review list , Conor Dooley , Juergen Gross , kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org, Mark Rutland , Palmer Dabbelt , Paolo Bonzini , Paul Walmsley , Shuah Khan , virtualization@lists.linux.dev, Will Deacon , x86@kernel.org References: <20240411000752.955910-1-atishp@rivosinc.com> <20240411000752.955910-8-atishp@rivosinc.com> <20240415-e229bb33ad53ce43e3534f5a@orel> From: Atish Patra In-Reply-To: <20240415-e229bb33ad53ce43e3534f5a@orel> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/15/24 06:06, Andrew Jones wrote: > On Wed, Apr 10, 2024 at 05:07:35PM -0700, Atish Patra wrote: >> As per the SBI specification, minor version is encoded in the >> lower 24 bits only. Make sure that the SBI version is computed >> with the appropriate mask. >> >> Currently, there is no minor version in use. Thus, it doesn't >> change anything functionality but it is good to be compliant with >> the specification. >> >> Signed-off-by: Atish Patra >> --- >> arch/riscv/include/asm/sbi.h | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h >> index f31650b10899..935b082d6a6c 100644 >> --- a/arch/riscv/include/asm/sbi.h >> +++ b/arch/riscv/include/asm/sbi.h >> @@ -367,8 +367,8 @@ static inline unsigned long sbi_minor_version(void) >> static inline unsigned long sbi_mk_version(unsigned long major, >> unsigned long minor) >> { >> - return ((major & SBI_SPEC_VERSION_MAJOR_MASK) << >> - SBI_SPEC_VERSION_MAJOR_SHIFT) | minor; >> + return ((major & SBI_SPEC_VERSION_MAJOR_MASK) << SBI_SPEC_VERSION_MAJOR_SHIFT >> + | (minor & SBI_SPEC_VERSION_MINOR_MASK)); > > The previous version had ((major & major_mask) << major_shift) | minor > (parentheses around all the major bits before the OR). Now we have > parentheses around everything, which aren't necessary, and no longer We have to use parentheses around | to avoid compiler warnings (-Wparentheses) Are you only concerned about the outer parentheses ? I have removed it. > have them around all the major bits before the OR. We don't need the > parentheses around the major bits, since shift has higher precedence > than OR, but I'd probably keep them. > Is this what you prefer? return ((major & SBI_SPEC_VERSION_MAJOR_MASK) << SBI_SPEC_VERSION_MAJOR_SHIFT) | (minor & SBI_SPEC_VERSION_MINOR_MASK); > Otherwise, > > Reviewed-by: Andrew Jones > >> } >> >> int sbi_err_map_linux_errno(int err); >> -- >> 2.34.1 >> > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv