From nobody Mon Feb 9 08:55:54 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 5336721C173 for ; Fri, 6 Feb 2026 00:24:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770337440; cv=none; b=NgxxoMljwD1ZbQ85+Fh0EoZ+ev8WT5JA4JRyJmhYQeMxxGv79v0ufu1Ya2wFC+kh5jN/Fcv3wHYpH1suprr/ecZ8lkwC+HsHXmVyQTK4fxx37owtjfaV5qslURhEiff2mowb2LB9AN11iFu/+jXIVFLdzC2c3nrHZJr+A4vnmBs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770337440; c=relaxed/simple; bh=dPtHMZtItU8ky/lmYL/NINHGosbIfQ/mqs1ss7sr+/Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=p+YSHP/XqcQH2ncaDrxGjeAKcpzcQbINa6BpwvxAQdQxUzJY2gtRVYIR4yEWWaFoPQ1ANGIkuraKv1N/5QHAKooEDJUmFpURVVw1P7UPZoeVgMCyZgkTVZlhu9IUqb7tlMHyE7v0GU/8K3+ZGS+gJN/dn09kpVcBCDL7DnOigs8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=UXfO1Oek; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=WV30nTp2; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="UXfO1Oek"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="WV30nTp2" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 615MXDbL378702 for ; Fri, 6 Feb 2026 00:23:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=eB/6w0ERhDm CdUQSC3GPLAZVEVNgV/kTjr9oJ/xDm9w=; b=UXfO1OekYBdZsbCJ/HPiXEPnMUN x47LIy9Yc8AZhhlvUb6XL0put1eIhF2ZTAyx8fUMyDahCV9N6w6M03mxIXxgdsgh y0i1JGsCpu6lGCanx0swkzesmBr3dSwnt2QQpzm8Bnm/9OOxx1wWbtie+2hF4hGc vkf21JqqmRaX3FrusXMWqPo/VbguMbBD//tQej2on1Q+ad7XJbjeFeMb6MQpLCKR RUmilkZoYjFEn2/4JZmapCdE1sTucPRzSMX+Z7CsPF/EsBX5hg59iaAwY26Z3Dl4 b/xkhpjoX7q40cqNyGKx5itHWsHdpQG2SZOyrLvJSXUqGVbSnll77OBpOXA== Received: from mail-dy1-f199.google.com (mail-dy1-f199.google.com [74.125.82.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4c4t0t2dpq-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 06 Feb 2026 00:23:59 +0000 (GMT) Received: by mail-dy1-f199.google.com with SMTP id 5a478bee46e88-2b7eddde359so235308eec.0 for ; Thu, 05 Feb 2026 16:23:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770337438; x=1770942238; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eB/6w0ERhDmCdUQSC3GPLAZVEVNgV/kTjr9oJ/xDm9w=; b=WV30nTp2zFW6/SroxEVKDH9rq/jL4u86Q3pNymzIoImTtdh8W8PN5FS4ZqJoMY+gzh mpPIMFrlu2qGe8Rw9NWHvpjeRgDMdNZGbA+Ja8LkqqCrdPF63lamqaCY/Wm1rwQrdtYc EHqnzxv4T7YegBonivKm1OqD2vQHdH6ZWCZPTi0ZTBSXWSBC5PFr/8Ag+R/CBy7WLkj4 eX72vbTcnhJ59z6mDhYM3ZHXF+piR+D6PvvWC7246l+aUl4wiKwc/Lj8n6LuVgkmAr/6 YqnsIJTkR45tlO7QfRyN6aIxlfjBDlPsgGOfqcQ55xKu9j1iQMNmExpJ9DaDy3EBhbSO 7OMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770337438; x=1770942238; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=eB/6w0ERhDmCdUQSC3GPLAZVEVNgV/kTjr9oJ/xDm9w=; b=rPjRxZkKbFQUmL2zMlLrd13VoM7Q7LyBzza4g0m5S9apMOLXPE3EEuTeXefkcGhECZ 2ZZdmMicktNUdwKNa/HyCAdulckfeqPIovmxWz+dXBg/zfFI8spPWpkHDhSHqdAcbzR3 isCv/O42hPZ7+cDS8P94Yus971dqiaSYEkDAKs/5qSiRSrgcJgsKZNTsOinnuv6Zev57 VGhVzbUqGHsBJUxIGBG2Vz/ID6RygpE1vR5b7S1xfm1T97M5LoMBrmgIrrkQ1AylgDpG gi9tpOqv2SbdhpAu/dNJxIOfCXE9jEKR1cJNUhHBeLWQjRE4fCH4sFYuFk5QukdDXXHF t5eA== X-Gm-Message-State: AOJu0YzNGwb6rdiToQzqRt3G024m0X1txihWYpGCqJ0HwGCylSMhFtnu cacjrLeLs9zKO0kbYWWsvJ+k2eLOzkbm76WsKUsEAxGVUYZPG68UAkrTWUKFsGoq3S/Dy/S1/1J ajVc4bFhJAxHh6EWKOOjqTlJRJ+e1NsRm1j5G7JbbWUsHpAMNpqKHCQj7IVA+lLD0GZ56j+7IiP 4= X-Gm-Gg: AZuq6aIS88IvxSDcDIw9+fqDv9WQlDbGNE7TzpOAfTVcY7iCypnma+q/2D+LhPP6/A2 e2LKCA+ViOyXKtjZwxPDbXxhYxPWrMrX8jHKy9WkgnLYCPMtVoCjmI6uVwAQptvywrz+bvMuGcc L2kDZIgtITVkZVeBTawAerokB9iqFD/5sI4RvNCmX51mlod/MjJVi0tu0bIOUrD/bZTZDlgfADI CVtyUgnWcXnNFbc1zBjc4ai8LkekBlH84LIHZ2ZZPWvVYytxswRCfOh/4AQ7ovtfgakbfT0IxPJ Kpkb7ZWOdTSogeggDG84F1uKQuX5+1wKCw70LerZXdyf5YTHeY9txsiGPz28NElZyBPefkUSq+b 3OAhcowxYhY5aH0r7Cqo= X-Received: by 2002:a05:7300:f602:b0:2b6:af85:dd2d with SMTP id 5a478bee46e88-2b856833be8mr444958eec.32.1770337438023; Thu, 05 Feb 2026 16:23:58 -0800 (PST) X-Received: by 2002:a05:7300:f602:b0:2b6:af85:dd2d with SMTP id 5a478bee46e88-2b856833be8mr444946eec.32.1770337437409; Thu, 05 Feb 2026 16:23:57 -0800 (PST) Received: from localhost ([140.82.166.162]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2b855c3daf7sm646541eec.20.2026.02.05.16.23.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Feb 2026 16:23:56 -0800 (PST) From: Andrew Jones To: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, kvm-riscv@lists.infradead.org Cc: Paul Walmsley , Palmer Dabbelt , Anup Patel , =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Conor Dooley , Guodong Xu , Charlie Jenkins , Charlie Jenkins , Samuel Holland Subject: [RFC PATCH v1 03/11] riscv: Standardize extension capitilization Date: Thu, 5 Feb 2026 18:23:41 -0600 Message-ID: <20260206002349.96740-4-andrew.jones@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260206002349.96740-1-andrew.jones@oss.qualcomm.com> References: <20260206002349.96740-1-andrew.jones@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Analysis: v=2.4 cv=WZMBqkhX c=1 sm=1 tr=0 ts=6985349f cx=c_pps a=cFYjgdjTJScbgFmBucgdfQ==:117 a=cvcws7F5//HeuvjG1O1erQ==:17 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=h0uksLzaAAAA:8 a=pGLkceISAAAA:8 a=EUspDBNiAAAA:8 a=_LueOzecWKeZO_VxXI8A:9 a=scEy_gLbYbu1JhEsrz4S:22 a=MSi_79tMYmZZG2gvAgS0:22 X-Proofpoint-GUID: iOHyEDXRLGUaqiJ6zAQbYsP_W89SBNK0 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA2MDAwMSBTYWx0ZWRfX7Rn/jwDYT37c FvfmViqYL18o3VtpHlM37VFAruoZ8vSVlruNaEPttUV52DU4fNQpTMnYI+M9TKR+yhkwRXS171G x2VIo2KOT/iPKE19oje3VlzWn5EVN++1FsZpKh4MaOxozvVzGvAqr0znzaPFB+IOoClksIeUFaD Stj2SQkF6YkmcvCYOj9FcI+BB9WFO7zWMRyDZIUkeofQkk1TIfTxGwQHpJgeESlnyRQ0M8EIIQ3 E8+Hs7iSwzvbBm0+1BhvrC9EwoRQsDwDOjaocjj7/yWJajEkGh486uVUVObwLydk4hSCV9zsyxG /Q7i2UBayA1pXkocElPKN2Tc7UcUMZgFFVEvZRrYV1/bOlSqkS7qLEPVsSXfSkN6Pc8Xtt/tR+J EraxicYzg8mGspPvqXWx0U/g9tVM6RJdU4jxPPlE4r39N3ITZBt+YXdjSy5M1YgXNmI8o37P8wS 4NNWSFQ99L2bZGZE6zw== X-Proofpoint-ORIG-GUID: iOHyEDXRLGUaqiJ6zAQbYsP_W89SBNK0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_06,2026-02-05_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 bulkscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602060001 Content-Type: text/plain; charset="utf-8" From: Charlie Jenkins The base extensions are often lowercase and were written as lowercase in hwcap, but other references to these extensions in the kernel are uppercase. Standardize the case to make it easier to handle macro expansion. Signed-off-by: Charlie Jenkins [Apply KVM_ISA_EXT_ARR(), fixup all KVM use.] Signed-off-by: Andrew Jones --- arch/riscv/include/asm/hwcap.h | 18 ++++++++--------- arch/riscv/include/asm/switch_to.h | 4 ++-- arch/riscv/kernel/cpufeature.c | 32 +++++++++++++++--------------- arch/riscv/kernel/sys_hwprobe.c | 4 ++-- arch/riscv/kvm/main.c | 2 +- arch/riscv/kvm/vcpu_fp.c | 28 +++++++++++++------------- arch/riscv/kvm/vcpu_onereg.c | 22 ++++++++++---------- arch/riscv/kvm/vcpu_vector.c | 14 ++++++------- 8 files changed, 62 insertions(+), 62 deletions(-) diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index 496694d3e182..03acd22bbbaa 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -10,15 +10,15 @@ =20 #include =20 -#define RISCV_ISA_EXT_a ('a' - 'a') -#define RISCV_ISA_EXT_c ('c' - 'a') -#define RISCV_ISA_EXT_d ('d' - 'a') -#define RISCV_ISA_EXT_f ('f' - 'a') -#define RISCV_ISA_EXT_h ('h' - 'a') -#define RISCV_ISA_EXT_i ('i' - 'a') -#define RISCV_ISA_EXT_m ('m' - 'a') -#define RISCV_ISA_EXT_q ('q' - 'a') -#define RISCV_ISA_EXT_v ('v' - 'a') +#define RISCV_ISA_EXT_A ('a' - 'a') +#define RISCV_ISA_EXT_C ('c' - 'a') +#define RISCV_ISA_EXT_D ('d' - 'a') +#define RISCV_ISA_EXT_F ('f' - 'a') +#define RISCV_ISA_EXT_H ('h' - 'a') +#define RISCV_ISA_EXT_I ('i' - 'a') +#define RISCV_ISA_EXT_M ('m' - 'a') +#define RISCV_ISA_EXT_Q ('q' - 'a') +#define RISCV_ISA_EXT_V ('v' - 'a') =20 /* * These macros represent the logical IDs of each multi-letter RISC-V ISA diff --git a/arch/riscv/include/asm/switch_to.h b/arch/riscv/include/asm/sw= itch_to.h index 0e71eb82f920..ff35a4d04f85 100644 --- a/arch/riscv/include/asm/switch_to.h +++ b/arch/riscv/include/asm/switch_to.h @@ -60,8 +60,8 @@ static inline void __switch_to_fpu(struct task_struct *pr= ev, =20 static __always_inline bool has_fpu(void) { - return riscv_has_extension_likely(RISCV_ISA_EXT_f) || - riscv_has_extension_likely(RISCV_ISA_EXT_d); + return riscv_has_extension_likely(RISCV_ISA_EXT_F) || + riscv_has_extension_likely(RISCV_ISA_EXT_D); } #else static __always_inline bool has_fpu(void) { return false; } diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index cf27b7a2547f..25ed1d6958d7 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -83,7 +83,7 @@ EXPORT_SYMBOL_GPL(__riscv_isa_extension_available); static int riscv_ext_f_depends(const struct riscv_isa_ext_data *data, const unsigned long *isa_bitmap) { - if (__riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_f)) + if (__riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_F)) return 0; =20 return -EPROBE_DEFER; @@ -145,7 +145,7 @@ static int riscv_ext_f_validate(const struct riscv_isa_= ext_data *data, * Due to extension ordering, d is checked before f, so no deferral * is required. */ - if (!__riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_d)) { + if (!__riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_D)) { pr_warn_once("This kernel does not support systems with F but not D\n"); return -EINVAL; } @@ -188,7 +188,7 @@ static int riscv_ext_vector_float_validate(const struct= riscv_isa_ext_data *data * Since this function validates vector only, and v/Zve* are probed * after f/d, there's no need for a deferral here. */ - if (!__riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_d)) + if (!__riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_D)) return -EINVAL; =20 return 0; @@ -223,7 +223,7 @@ static int riscv_ext_zcd_validate(const struct riscv_is= a_ext_data *data, const unsigned long *isa_bitmap) { if (__riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_ZCA) && - __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_d)) + __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_D)) return 0; =20 return -EPROBE_DEFER; @@ -236,7 +236,7 @@ static int riscv_ext_zcf_validate(const struct riscv_is= a_ext_data *data, return -EINVAL; =20 if (__riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_ZCA) && - __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_f)) + __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_F)) return 0; =20 return -EPROBE_DEFER; @@ -469,15 +469,15 @@ static const unsigned int riscv_c_exts[] =3D { * New entries to this struct should follow the ordering rules described a= bove. */ const struct riscv_isa_ext_data riscv_isa_ext[] =3D { - __RISCV_ISA_EXT_DATA(i, RISCV_ISA_EXT_i), - __RISCV_ISA_EXT_DATA(m, RISCV_ISA_EXT_m), - __RISCV_ISA_EXT_SUPERSET(a, RISCV_ISA_EXT_a, riscv_a_exts), - __RISCV_ISA_EXT_DATA_VALIDATE(f, RISCV_ISA_EXT_f, riscv_ext_f_validate), - __RISCV_ISA_EXT_DATA_VALIDATE(d, RISCV_ISA_EXT_d, riscv_ext_d_validate), - __RISCV_ISA_EXT_DATA(q, RISCV_ISA_EXT_q), - __RISCV_ISA_EXT_SUPERSET(c, RISCV_ISA_EXT_c, riscv_c_exts), - __RISCV_ISA_EXT_SUPERSET_VALIDATE(v, RISCV_ISA_EXT_v, riscv_v_exts, riscv= _ext_vector_float_validate), - __RISCV_ISA_EXT_DATA(h, RISCV_ISA_EXT_h), + __RISCV_ISA_EXT_DATA(i, RISCV_ISA_EXT_I), + __RISCV_ISA_EXT_DATA(m, RISCV_ISA_EXT_M), + __RISCV_ISA_EXT_SUPERSET(a, RISCV_ISA_EXT_A, riscv_a_exts), + __RISCV_ISA_EXT_DATA_VALIDATE(f, RISCV_ISA_EXT_F, riscv_ext_f_validate), + __RISCV_ISA_EXT_DATA_VALIDATE(d, RISCV_ISA_EXT_D, riscv_ext_d_validate), + __RISCV_ISA_EXT_DATA(q, RISCV_ISA_EXT_Q), + __RISCV_ISA_EXT_SUPERSET(c, RISCV_ISA_EXT_C, riscv_c_exts), + __RISCV_ISA_EXT_SUPERSET_VALIDATE(v, RISCV_ISA_EXT_V, riscv_v_exts, riscv= _ext_vector_float_validate), + __RISCV_ISA_EXT_DATA(h, RISCV_ISA_EXT_H), __RISCV_ISA_EXT_SUPERSET_VALIDATE(zicbom, RISCV_ISA_EXT_ZICBOM, riscv_xli= nuxenvcfg_exts, riscv_ext_zicbom_validate), __RISCV_ISA_EXT_DATA_VALIDATE(zicbop, RISCV_ISA_EXT_ZICBOP, riscv_ext_zic= bop_validate), __RISCV_ISA_EXT_SUPERSET_VALIDATE(zicboz, RISCV_ISA_EXT_ZICBOZ, riscv_xli= nuxenvcfg_exts, riscv_ext_zicboz_validate), @@ -873,8 +873,8 @@ static void __init riscv_fill_hwcap_from_isa_string(uns= igned long *isa2hwcap) * marchid. */ if (acpi_disabled && boot_vendorid =3D=3D THEAD_VENDOR_ID && boot_archid= =3D=3D 0x0) { - this_hwcap &=3D ~isa2hwcap[RISCV_ISA_EXT_v]; - clear_bit(RISCV_ISA_EXT_v, source_isa); + this_hwcap &=3D ~isa2hwcap[RISCV_ISA_EXT_V]; + clear_bit(RISCV_ISA_EXT_V, source_isa); } =20 riscv_resolve_isa(source_isa, isainfo->isa, &this_hwcap, isa2hwcap); diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwprob= e.c index 1423b447fe9a..76e673ab42a5 100644 --- a/arch/riscv/kernel/sys_hwprobe.c +++ b/arch/riscv/kernel/sys_hwprobe.c @@ -88,10 +88,10 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, if (has_fpu()) pair->value |=3D RISCV_HWPROBE_IMA_FD; =20 - if (riscv_isa_extension_available(NULL, c)) + if (riscv_isa_extension_available(NULL, C)) pair->value |=3D RISCV_HWPROBE_IMA_C; =20 - if (has_vector() && riscv_isa_extension_available(NULL, v)) + if (has_vector() && riscv_isa_extension_available(NULL, V)) pair->value |=3D RISCV_HWPROBE_IMA_V; =20 /* diff --git a/arch/riscv/kvm/main.c b/arch/riscv/kvm/main.c index 45536af521f0..4d8c6e04aa7e 100644 --- a/arch/riscv/kvm/main.c +++ b/arch/riscv/kvm/main.c @@ -85,7 +85,7 @@ static int __init riscv_kvm_init(void) char slist[64]; const char *str; =20 - if (!riscv_isa_extension_available(NULL, h)) { + if (!riscv_isa_extension_available(NULL, H)) { kvm_info("hypervisor extension not available\n"); return -ENODEV; } diff --git a/arch/riscv/kvm/vcpu_fp.c b/arch/riscv/kvm/vcpu_fp.c index 030904d82b58..5cb6b04f6f96 100644 --- a/arch/riscv/kvm/vcpu_fp.c +++ b/arch/riscv/kvm/vcpu_fp.c @@ -19,8 +19,8 @@ void kvm_riscv_vcpu_fp_reset(struct kvm_vcpu *vcpu) struct kvm_cpu_context *cntx =3D &vcpu->arch.guest_context; =20 cntx->sstatus &=3D ~SR_FS; - if (riscv_isa_extension_available(vcpu->arch.isa, f) || - riscv_isa_extension_available(vcpu->arch.isa, d)) + if (riscv_isa_extension_available(vcpu->arch.isa, F) || + riscv_isa_extension_available(vcpu->arch.isa, D)) cntx->sstatus |=3D SR_FS_INITIAL; else cntx->sstatus |=3D SR_FS_OFF; @@ -36,9 +36,9 @@ void kvm_riscv_vcpu_guest_fp_save(struct kvm_cpu_context = *cntx, const unsigned long *isa) { if ((cntx->sstatus & SR_FS) =3D=3D SR_FS_DIRTY) { - if (riscv_isa_extension_available(isa, d)) + if (riscv_isa_extension_available(isa, D)) __kvm_riscv_fp_d_save(cntx); - else if (riscv_isa_extension_available(isa, f)) + else if (riscv_isa_extension_available(isa, F)) __kvm_riscv_fp_f_save(cntx); kvm_riscv_vcpu_fp_clean(cntx); } @@ -48,9 +48,9 @@ void kvm_riscv_vcpu_guest_fp_restore(struct kvm_cpu_conte= xt *cntx, const unsigned long *isa) { if ((cntx->sstatus & SR_FS) !=3D SR_FS_OFF) { - if (riscv_isa_extension_available(isa, d)) + if (riscv_isa_extension_available(isa, D)) __kvm_riscv_fp_d_restore(cntx); - else if (riscv_isa_extension_available(isa, f)) + else if (riscv_isa_extension_available(isa, F)) __kvm_riscv_fp_f_restore(cntx); kvm_riscv_vcpu_fp_clean(cntx); } @@ -59,17 +59,17 @@ void kvm_riscv_vcpu_guest_fp_restore(struct kvm_cpu_con= text *cntx, void kvm_riscv_vcpu_host_fp_save(struct kvm_cpu_context *cntx) { /* No need to check host sstatus as it can be modified outside */ - if (riscv_isa_extension_available(NULL, d)) + if (riscv_isa_extension_available(NULL, D)) __kvm_riscv_fp_d_save(cntx); - else if (riscv_isa_extension_available(NULL, f)) + else if (riscv_isa_extension_available(NULL, F)) __kvm_riscv_fp_f_save(cntx); } =20 void kvm_riscv_vcpu_host_fp_restore(struct kvm_cpu_context *cntx) { - if (riscv_isa_extension_available(NULL, d)) + if (riscv_isa_extension_available(NULL, D)) __kvm_riscv_fp_d_restore(cntx); - else if (riscv_isa_extension_available(NULL, f)) + else if (riscv_isa_extension_available(NULL, F)) __kvm_riscv_fp_f_restore(cntx); } #endif @@ -87,7 +87,7 @@ int kvm_riscv_vcpu_get_reg_fp(struct kvm_vcpu *vcpu, void *reg_val; =20 if ((rtype =3D=3D KVM_REG_RISCV_FP_F) && - riscv_isa_extension_available(vcpu->arch.isa, f)) { + riscv_isa_extension_available(vcpu->arch.isa, F)) { if (KVM_REG_SIZE(reg->id) !=3D sizeof(u32)) return -EINVAL; if (reg_num =3D=3D KVM_REG_RISCV_FP_F_REG(fcsr)) @@ -98,7 +98,7 @@ int kvm_riscv_vcpu_get_reg_fp(struct kvm_vcpu *vcpu, else return -ENOENT; } else if ((rtype =3D=3D KVM_REG_RISCV_FP_D) && - riscv_isa_extension_available(vcpu->arch.isa, d)) { + riscv_isa_extension_available(vcpu->arch.isa, D)) { if (reg_num =3D=3D KVM_REG_RISCV_FP_D_REG(fcsr)) { if (KVM_REG_SIZE(reg->id) !=3D sizeof(u32)) return -EINVAL; @@ -132,7 +132,7 @@ int kvm_riscv_vcpu_set_reg_fp(struct kvm_vcpu *vcpu, void *reg_val; =20 if ((rtype =3D=3D KVM_REG_RISCV_FP_F) && - riscv_isa_extension_available(vcpu->arch.isa, f)) { + riscv_isa_extension_available(vcpu->arch.isa, F)) { if (KVM_REG_SIZE(reg->id) !=3D sizeof(u32)) return -EINVAL; if (reg_num =3D=3D KVM_REG_RISCV_FP_F_REG(fcsr)) @@ -143,7 +143,7 @@ int kvm_riscv_vcpu_set_reg_fp(struct kvm_vcpu *vcpu, else return -ENOENT; } else if ((rtype =3D=3D KVM_REG_RISCV_FP_D) && - riscv_isa_extension_available(vcpu->arch.isa, d)) { + riscv_isa_extension_available(vcpu->arch.isa, D)) { if (reg_num =3D=3D KVM_REG_RISCV_FP_D_REG(fcsr)) { if (KVM_REG_SIZE(reg->id) !=3D sizeof(u32)) return -EINVAL; diff --git a/arch/riscv/kvm/vcpu_onereg.c b/arch/riscv/kvm/vcpu_onereg.c index 865dae903aa0..901dca0edcb9 100644 --- a/arch/riscv/kvm/vcpu_onereg.c +++ b/arch/riscv/kvm/vcpu_onereg.c @@ -26,14 +26,14 @@ /* Mapping between KVM ISA Extension ID & guest ISA extension ID */ static const unsigned long kvm_isa_ext_arr[] =3D { /* Single letter extensions (alphabetically sorted) */ - [KVM_RISCV_ISA_EXT_A] =3D RISCV_ISA_EXT_a, - [KVM_RISCV_ISA_EXT_C] =3D RISCV_ISA_EXT_c, - [KVM_RISCV_ISA_EXT_D] =3D RISCV_ISA_EXT_d, - [KVM_RISCV_ISA_EXT_F] =3D RISCV_ISA_EXT_f, - [KVM_RISCV_ISA_EXT_H] =3D RISCV_ISA_EXT_h, - [KVM_RISCV_ISA_EXT_I] =3D RISCV_ISA_EXT_i, - [KVM_RISCV_ISA_EXT_M] =3D RISCV_ISA_EXT_m, - [KVM_RISCV_ISA_EXT_V] =3D RISCV_ISA_EXT_v, + KVM_ISA_EXT_ARR(A), + KVM_ISA_EXT_ARR(C), + KVM_ISA_EXT_ARR(D), + KVM_ISA_EXT_ARR(F), + KVM_ISA_EXT_ARR(H), + KVM_ISA_EXT_ARR(I), + KVM_ISA_EXT_ARR(M), + KVM_ISA_EXT_ARR(V), /* Multi letter extensions (alphabetically sorted) */ KVM_ISA_EXT_ARR(SMNPM), KVM_ISA_EXT_ARR(SMSTATEEN), @@ -986,7 +986,7 @@ static inline unsigned long num_fp_f_regs(const struct = kvm_vcpu *vcpu) { const struct kvm_cpu_context *cntx =3D &vcpu->arch.guest_context; =20 - if (riscv_isa_extension_available(vcpu->arch.isa, f)) + if (riscv_isa_extension_available(vcpu->arch.isa, F)) return sizeof(cntx->fp.f) / sizeof(u32); else return 0; @@ -1015,7 +1015,7 @@ static inline unsigned long num_fp_d_regs(const struc= t kvm_vcpu *vcpu) { const struct kvm_cpu_context *cntx =3D &vcpu->arch.guest_context; =20 - if (riscv_isa_extension_available(vcpu->arch.isa, d)) + if (riscv_isa_extension_available(vcpu->arch.isa, D)) return sizeof(cntx->fp.d.f) / sizeof(u64) + 1; else return 0; @@ -1094,7 +1094,7 @@ static inline unsigned long num_sbi_regs(struct kvm_v= cpu *vcpu) =20 static inline unsigned long num_vector_regs(const struct kvm_vcpu *vcpu) { - if (!riscv_isa_extension_available(vcpu->arch.isa, v)) + if (!riscv_isa_extension_available(vcpu->arch.isa, V)) return 0; =20 /* vstart, vl, vtype, vcsr, vlenb and 32 vector regs */ diff --git a/arch/riscv/kvm/vcpu_vector.c b/arch/riscv/kvm/vcpu_vector.c index 05f3cc2d8e31..8bc85593e1d4 100644 --- a/arch/riscv/kvm/vcpu_vector.c +++ b/arch/riscv/kvm/vcpu_vector.c @@ -25,7 +25,7 @@ void kvm_riscv_vcpu_vector_reset(struct kvm_vcpu *vcpu) =20 cntx->vector.vlenb =3D riscv_v_vsize / 32; =20 - if (riscv_isa_extension_available(isa, v)) { + if (riscv_isa_extension_available(isa, V)) { cntx->sstatus |=3D SR_VS_INITIAL; WARN_ON(!cntx->vector.datap); memset(cntx->vector.datap, 0, riscv_v_vsize); @@ -44,7 +44,7 @@ void kvm_riscv_vcpu_guest_vector_save(struct kvm_cpu_cont= ext *cntx, unsigned long *isa) { if ((cntx->sstatus & SR_VS) =3D=3D SR_VS_DIRTY) { - if (riscv_isa_extension_available(isa, v)) + if (riscv_isa_extension_available(isa, V)) __kvm_riscv_vector_save(cntx); kvm_riscv_vcpu_vector_clean(cntx); } @@ -54,7 +54,7 @@ void kvm_riscv_vcpu_guest_vector_restore(struct kvm_cpu_c= ontext *cntx, unsigned long *isa) { if ((cntx->sstatus & SR_VS) !=3D SR_VS_OFF) { - if (riscv_isa_extension_available(isa, v)) + if (riscv_isa_extension_available(isa, V)) __kvm_riscv_vector_restore(cntx); kvm_riscv_vcpu_vector_clean(cntx); } @@ -63,13 +63,13 @@ void kvm_riscv_vcpu_guest_vector_restore(struct kvm_cpu= _context *cntx, void kvm_riscv_vcpu_host_vector_save(struct kvm_cpu_context *cntx) { /* No need to check host sstatus as it can be modified outside */ - if (riscv_isa_extension_available(NULL, v)) + if (riscv_isa_extension_available(NULL, V)) __kvm_riscv_vector_save(cntx); } =20 void kvm_riscv_vcpu_host_vector_restore(struct kvm_cpu_context *cntx) { - if (riscv_isa_extension_available(NULL, v)) + if (riscv_isa_extension_available(NULL, V)) __kvm_riscv_vector_restore(cntx); } =20 @@ -149,7 +149,7 @@ int kvm_riscv_vcpu_get_reg_vector(struct kvm_vcpu *vcpu, void *reg_addr; int rc; =20 - if (!riscv_isa_extension_available(isa, v)) + if (!riscv_isa_extension_available(isa, V)) return -ENOENT; =20 rc =3D kvm_riscv_vcpu_vreg_addr(vcpu, reg_num, reg_size, ®_addr); @@ -175,7 +175,7 @@ int kvm_riscv_vcpu_set_reg_vector(struct kvm_vcpu *vcpu, void *reg_addr; int rc; =20 - if (!riscv_isa_extension_available(isa, v)) + if (!riscv_isa_extension_available(isa, V)) return -ENOENT; =20 if (reg_num =3D=3D KVM_REG_RISCV_VECTOR_CSR_REG(vlenb)) { --=20 2.43.0