Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2922728lqo; Tue, 21 May 2024 00:59:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWIp7RWSr3Hnfgah2S5OFbr0w8aStryA5u6DT6LAaQSHHXLsLk5I09GYcgvCVjBUbWrVJSnt815i3DyBQAPmKhvlwYhJrNj6fiqk9SPVQ== X-Google-Smtp-Source: AGHT+IH+yulZ90H0EQVInP8dkfofSfG1L2CLY0AM/ABNdae2YY9dGUi35pqv4HMDYYxZunVm2jBn X-Received: by 2002:a05:6870:5246:b0:23b:b0fd:47f4 with SMTP id 586e51a60fabf-24172a8b902mr35951140fac.18.1716278345695; Tue, 21 May 2024 00:59:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716278345; cv=pass; d=google.com; s=arc-20160816; b=bA3nEShN6odyt/wZF7xo4HyuKLtWFKEMDZCUy5LNi3eGwnmevx18/tIkazVpKqTxoB glDftLg81FtPNqrA8gYSIFtE0OWsyiRemYfjCGeHiQRleuldLLNuRjd4cSwTS6vGO35O U+69k5aMfoPyZdZlXbgv51kvAurezV549xpiJg8PSnD7H2m+SLuXs6QRjhf+mi5n90yL bL7LExX3V8vw3bYDd2xGbDq/41FtEmsJcZepEUlipweByHG8Fgji1hYCHKgm/oc8BQjJ WMu8jgB5FRVOsUQe/sXWduNA1imRjzzzwlpIBMGmtvWxu4s4dSBDT63qNKNNtGvfI5C5 JNMg== 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:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=GBb6iShuxHaV7v6bJv2LipIX1/0KjJPEPWALv2DbLcM=; fh=FDEXmeAaQSQmtkhCyqNxEYnFeXmgFER4FYwyHU5J89c=; b=k9HZ72A97dXGN+m1wN00ybHWfFUW/SDJb9itHnblXlvZ1jGPZzXivbvqJ/lHveyRWd 3w1n1HdJqXhQOA+sawKgvkI0GlsoAqDo4jErUdhe7Lh+UmX/6iTKVT9+VNpIqwnIGHfg ut1kJ2QKp2s8sGwq+febudi1oB//7teSVcLMLgRI6ksBwnbum8KnjruwAP0sPLYJjXp6 Z53Goj8EQAK3scZCSlp+qxz8rk35IBH9dmCIHkS0p+QGZ6XoNGijvzahWpXSMf3IIAjJ TllottxVZ6v77rsC7sWDp3E7wOh7/hFOyPsgebVrIgQ0wUTpSTxBlVhFJZmsZ7Q5fYJN PmFg==; 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=tRSIHZVI; 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-184603-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184603-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 41be03b00d2f7-65ae39c2f30si4499703a12.543.2024.05.21.00.59.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 00:59:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-184603-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=tRSIHZVI; 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-184603-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184603-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 509942829FE for ; Tue, 21 May 2024 07:59:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0A2E255E74; Tue, 21 May 2024 07:58:32 +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="tRSIHZVI" Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 4DDA255C29 for ; Tue, 21 May 2024 07:58:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716278311; cv=none; b=igA0Rjvi6ZObCMIF8OjOY7H1rNWfJrKXr1nfZUjFpWP88gNuab57TvsKFCmrVRkUTKFuVXYQ8tXcuW2hu6y6TSw/E/jjPAl8VPjAGTv9J8126W9sB4mqvU7/U49TQVon7DCQRoCiCOElDiB11PviukXnl7aiJQqccnZCFYXZNEg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716278311; c=relaxed/simple; bh=YbW/ijAGccFQlQTqAfJm9lN3VLgscw+sw3OGEMReWk8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=JIHMETmBrAWXp1d98i5nuzJtBkrwq7PcxnhXSXLynwjwyeTP4lEX/a2J+MlYmidyEAiDfMKKaxzyJICr4Y1cXYEl5iQx6bsNCU98jtNV6wxNiApLGPFLM6xKP1Pik7EhnjkXT3S1M2jfZ34O7dbPEuGbCibqK58r1vJiNWQi4is= 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=tRSIHZVI; arc=none smtp.client-ip=209.85.221.47 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-wr1-f47.google.com with SMTP id ffacd0b85a97d-354c28d4e2aso53290f8f.0 for ; Tue, 21 May 2024 00:58:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1716278307; x=1716883107; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=GBb6iShuxHaV7v6bJv2LipIX1/0KjJPEPWALv2DbLcM=; b=tRSIHZVIGlH4zuEM4xjxevPKjIjyEAC7TRQMEzuN/x7oZnnoRXErQdwagNObslHH9Q 4o/O20kCD3/rOzIDpSRuQBNHLC6F0eKPsWpJ+j2bkiBL5mY5DtjNMGfrbxOWWUN9J2f9 SiK0EvVLTRBDnq8+NF3PKD/iE9F0ztId7AlHJc/k8DbgtdSeAPcYAWvCBR+N4vQirYg9 3bQ4Aj19SyPzZo9Rh5lhxH4VhCsCEpv9kCyh985X/wmyy4hXj/tpiBZyu0pQIJShKUQf D2bj4QGrUQzjNCBXlVGxfM7OHMnIIyfaUW9MNRMpvgFuDHLRDQ+eJTqTJAuMS0A2v+Mh /Jrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716278307; x=1716883107; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=GBb6iShuxHaV7v6bJv2LipIX1/0KjJPEPWALv2DbLcM=; b=LAW4Wv4NdgvLzrf5QDcWiTg6B69G4p+dWOa/8gyfvmNdSU1U7CPiCF9BnMYMmHCaCU E4ASUOA7Rh6gDPF067FGdYXKnuvpuJyqu0v/9mtOD85lQOIi+vH3C/GAOzjrAx+C6xwR tRrymdlW28iLe1ZJGEGSmMkhDwwn7McOu+kOYlGQrTNv4kz+M98Q56m3FY7hXjetoAkv +z/rAv0OV+H3Ss27vatkLlwuYYEHVwZ4i5ZCYaqodzDxtRSEoG53KhXtjCxr9U3ojJJr rume8c4moIhbZWz4Yg2MSeWY9D5BRa3TIZG79fUjyVgzHiU4kX6bvJlguCsBUzMPHEZQ YVKQ== X-Forwarded-Encrypted: i=1; AJvYcCXDGUMXtLgzq4tzAEesn1jZ76FPcYhB/xXTfI3l+4eQ1F9kLYw7YrVNlmtjJK/c7VRzyFEQxZpEJjRFK/W0HOasY3IlSq8uPZTZHGC+ X-Gm-Message-State: AOJu0YyPR2+BddhKnQqGm2cZY8Vt5e6+AbaECkm1RAGX17YhnzdA5cwk hX0T8BsE2M1x99TP/38FegkSOYqt+ZHMFmDGuwUcydWyf+/TpNGWLWB3tpYLquY= X-Received: by 2002:adf:eed1:0:b0:34d:7201:460a with SMTP id ffacd0b85a97d-3504a10f308mr21256806f8f.0.1716278307420; Tue, 21 May 2024 00:58:27 -0700 (PDT) Received: from ?IPV6:2a01:e0a:999:a3a0:813a:5863:97f7:aca7? ([2a01:e0a:999:a3a0:813a:5863:97f7:aca7]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbefdsm31017829f8f.94.2024.05.21.00.58.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 May 2024 00:58:26 -0700 (PDT) Message-ID: <6d2eb1ec-010d-4390-a25e-afd2fca0311d@rivosinc.com> Date: Tue, 21 May 2024 09:58:25 +0200 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 v5 07/16] riscv: add ISA extensions validation callback To: Conor Dooley Cc: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan , Atish Patra , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org References: <20240517145302.971019-1-cleger@rivosinc.com> <20240517145302.971019-8-cleger@rivosinc.com> <20240517-scrunch-palace-2f83aa8cc3ce@spud> Content-Language: en-US From: =?UTF-8?B?Q2zDqW1lbnQgTMOpZ2Vy?= In-Reply-To: <20240517-scrunch-palace-2f83aa8cc3ce@spud> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 17/05/2024 18:44, Conor Dooley wrote: > On Fri, May 17, 2024 at 04:52:47PM +0200, Clément Léger wrote: >> Since a few extensions (Zicbom/Zicboz) already needs validation and >> future ones will need it as well (Zc*) add a validate() callback to >> struct riscv_isa_ext_data. This require to rework the way extensions are >> parsed and split it in two phases. First phase is isa string or isa >> extension list parsing and consists in enabling all the extensions in a >> temporary bitmask (source isa) without any validation. The second step >> "resolves" the final isa bitmap, handling potential missing dependencies. >> The mechanism is quite simple and simply validate each extension >> described in the source bitmap before enabling it in the resolved isa >> bitmap. validate() callbacks can return either 0 for success, >> -EPROBEDEFER if extension needs to be validated again at next loop. A >> previous ISA bitmap is kept to avoid looping multiple times if an >> extension dependencies are never satisfied until we reach a stable >> state. In order to avoid any potential infinite looping, allow looping >> a maximum of the number of extension we handle. Zicboz and Zicbom >> extensions are modified to use this validation mechanism. > > I wish we weren't doin' it at all, but since we have to, I think what > you've got here is good. Yup, this is what you got with a fast evolving architecture I guess ;) > Reviewed-by: Conor Dooley > > Do you want me to send some patches for the F/V stuff we discussed > previously? Sure go ahead, I did not have anything written yet. Thanks, Clément > > Cheers, > Conor.