Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1925479lqp; Tue, 16 Apr 2024 01:50:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWgx8d/IeKh9vJ5KSAdx2q7ONa9QUCJVs+uvtB9urlf1BvUdU1nVsmbTUU+RQvoDOaphPrzQADgKDKVtF4u/PKtpx6Vitv/0nkWOM6atg== X-Google-Smtp-Source: AGHT+IF3mzxCGTtSUpE3zvijRxLY0SNx+UR2w8F0mqgQfU4j57T/eVfJTpdb23ejqqMktmTrGwKD X-Received: by 2002:a17:907:5c5:b0:a46:d041:28e0 with SMTP id wg5-20020a17090705c500b00a46d04128e0mr9340229ejb.59.1713257418149; Tue, 16 Apr 2024 01:50:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713257418; cv=pass; d=google.com; s=arc-20160816; b=qxr4B8JtI8nG9kbfsHsH3q5RzU/OQaCPB5Y4MNkinOSXX+0Ia1u7gVCAU3/TYirm5n JsiwN/vOyDwRNiug4T0jnhzI0FPdAqu6Y4AJqLZW/S5PoWV1CzeK1+6W7ZGEQ214Bd2s gy2NIbEQTBu/WRpOOEtOfSzH+ZgYWnBaWGlO1wHxlFwapY/JFmk37NNZmIUEyFs/JxK0 zHs7eIzTOCNE2chpUPlom6geVQeilJMysuFYYWbV4g84Z19a6EumRUFu21KcGXCifKY0 wZygJDjAq+FM3r+Zpt/4ifG0CVcBvx8xDRVoYDIyGEfWRk9plLNdltlI+PtWHRnIb+wM JTeA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=mvwae8C2beujv4aHEun0iITe/+EHhljfurmTw9uDoMY=; fh=/M/ZV+lOaIZjrcAedtsSQkBBHyX9xSYSdwu3dpz0xC0=; b=vYyb8NqdIG6irFh+TM9OFeKFnJrnrxhN2prTeSyyblhlPPdopk04JAEG6QJMX3TkKE WW0Y6lUalETAJ28ua/9WQZuy7oVeHPSUwYY5/0dnrseInzwwzmEN4pNpfZrYZiwqFtZt eGIdURR90xo1FR9Uz4OL0WbvpkqHZTuVGDLwTEyVVmcIO0iSYY21wC+mkl4L6z73RgZj L7gWBW9/bOA0NaJBZDnrXyHCMXPZhLkE1ZpQTVOCf3eFuOXelJRfG4qjAtiBW0HRGgbL 04NhRI0Li9cEpY1sPN1AtudKkPPKwmYxI24haEqGR/P3l4BtqXOTUwxT5/jQPgMRAMx5 aMtg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=ZTe5AX4x; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-146516-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146516-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h6-20020a170906584600b00a4e28b1068bsi5463173ejs.780.2024.04.16.01.50.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 01:50:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-146516-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=ZTe5AX4x; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-146516-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146516-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 am.mirrors.kernel.org (Postfix) with ESMTPS id B49D91F21F58 for ; Tue, 16 Apr 2024 08:50:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 43F1586250; Tue, 16 Apr 2024 08:49:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="ZTe5AX4x" Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 C717B84DE4 for ; Tue, 16 Apr 2024 08:49:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713257365; cv=none; b=O9RJxbZVZhCyrBK7hVaAoV21wLsfu/kVoqaYh4TAfLE/ZNnmjOMh5w9wFSUVA9Z0FzdYRCyFM27DYajKXQlEQji7GWI5knVCBS88ZtjooZcvs8uHcT8WlDwV4aw/v4P3uPH0NFoTdGp//RiTnu/QEEAnbIFrrWKOF5622DeOGPM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713257365; c=relaxed/simple; bh=9xIdHRnzV2O632j4RhG1uswWHNVqgDuU4PlluAj30g8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gsBEIcdFgXxlCydRckA2s+nEIRmL63FGbb2vv8BPqMSc6q5CWPe6XF4vGtnlOXAFqp6e6Q8UM5FJnRfYViUExo8b0Izyl5MbciHHcuR/k6uiw/G3SHNFNDcMOdoBFjL5bqhRp5LmNxlw26JmzP7lhpcerccrdKkzk6BSt+5yOGE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=ZTe5AX4x; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4185e80adfbso9820645e9.1 for ; Tue, 16 Apr 2024 01:49:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1713257362; x=1713862162; darn=vger.kernel.org; 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=mvwae8C2beujv4aHEun0iITe/+EHhljfurmTw9uDoMY=; b=ZTe5AX4xwmAR8IG3HCcGKiIqwQqB7rbG7WDYiHrMBLtv+a0L8FGslnmtISDyP2uOQI oSlg0k+HcvlOxURWAlKkN78vqGHfgM9d+SRJ+LjOeQ2X2XUkvvDTUT91OBm09TB/La21 0GZuUX/9HsSKkIMsjUtkEgsVw5nGKWlygd/DiZZj7Ba4k1FQ2WyBw3vXlOqyZMmXM5G+ OlRZDR4kIHJCA53j06nFShBD1adRN/9TBfUCiAE2wEPROUzphpSceRdgWVvC3ldq3Eu0 IhD0iX8MjHU1oCZpcJIWQ9zY1irel5pyu0ckVMAjdqlX2Hxi84DHbRu2ZUIKr4YBYhxu hLuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713257362; x=1713862162; 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=mvwae8C2beujv4aHEun0iITe/+EHhljfurmTw9uDoMY=; b=g+TnLMxRr+KRXaal4L1bfJ9nIN7eg77Mt0VNespAKmUkpRfg6Sgdse8g/+i1L0gn47 jgVV3emIrAnxTQzlHSqpvqRcJC/Mo/rbICxXU7O80/xIwHcmVAaQ+bsa15scnPJjUi4v 2Bm131VcrbIYSmCu8wmtF99UgLksCKVviP4ybqQWu2YXZj/aU/2kFdy6VQC/fUGPgv8M H1WvqcTWcgfeDtKHZSSYgkxHPtA5Hhf0NGYjP24x8zfVnJEuoIExKFEsJqSoMpCESxlu Fem4AH0AcEGD0IiOBtW7YSfSCryF/oHn7zw0/eH6bLV477Q/4VANLC5vzpIJ41V1kY53 00sQ== X-Gm-Message-State: AOJu0YwWk3+rh9m93C2nwmwkfS5tYCjwuKVot2RoDTUBz6uTXcGNjJHS kFwx8DWetkI8uf/1jCwiwJqWC9pFyT1I759+sQgu4rbsSTyyjRvNpidkE4Y58K4= X-Received: by 2002:a05:600c:45d0:b0:416:3317:5951 with SMTP id s16-20020a05600c45d000b0041633175951mr8879758wmo.6.1713257362109; Tue, 16 Apr 2024 01:49:22 -0700 (PDT) Received: from localhost (2001-1ae9-1c2-4c00-20f-c6b4-1e57-7965.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:20f:c6b4:1e57:7965]) by smtp.gmail.com with ESMTPSA id l16-20020a05600c4f1000b00418729383a4sm5208029wmq.46.2024.04.16.01.49.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 01:49:21 -0700 (PDT) Date: Tue, 16 Apr 2024 10:49:20 +0200 From: Andrew Jones To: Atish Patra 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 Subject: Re: [PATCH v6 07/24] RISC-V: Use the minor version mask while computing sbi version Message-ID: <20240416-1a9f7ea9700c4c6c3e52a1b1@orel> References: <20240411000752.955910-1-atishp@rivosinc.com> <20240411000752.955910-8-atishp@rivosinc.com> <20240415-e229bb33ad53ce43e3534f5a@orel> <2a63d7da-91b6-496d-9966-e6c0a0aa6c6c@rivosinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2a63d7da-91b6-496d-9966-e6c0a0aa6c6c@rivosinc.com> On Tue, Apr 16, 2024 at 01:31:27AM -0700, Atish Patra wrote: > 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); Yup Thanks, drew > > > > > > 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 >