From patchwork Fri Jul 12 08:38:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong-Xuan Wang X-Patchwork-Id: 13731404 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1C258C2BD09 for ; Fri, 12 Jul 2024 08:39:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YlJznBUNy5PRZ7EA80Dc2xXmihHZYUFDcKLe5uDkvV8=; b=frhcGHinFcEw6a bYAUUSuQ9nNxVRlsVGrsi2wk7qL1yHT/W0ViAgvxSIcKetxQ6eltIEVlZg2JfyVDyKr7pxt2aMxm0 0LkzNQU9slIevWZhdBL4egGh/d60Bu8dIXGzBn5p5uwqUxQFHsBBPp6M6thtsYlEMRs4xQUYAaHii 1FElDhL99zerCeZJZaRLs/cGulgsEsBt4hGlBjlGaJb69SQtwB/mz7TKMGf6n7i0crMBcHdRka1dh I3OxqAzs8srC2QxtnJg01uciGcMZhnaRdZ+cziaf0eKq104U5c/v8/Yhj+9k5WkKrhtKUjzKr/I4Y R8l97sZx2vxhZafqro7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSBo9-0000000GvhO-3Ojp; Fri, 12 Jul 2024 08:39:13 +0000 Received: from mail-oi1-x22c.google.com ([2607:f8b0:4864:20::22c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSBo5-0000000GvdR-1zzE for linux-riscv@lists.infradead.org; Fri, 12 Jul 2024 08:39:10 +0000 Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-3d9e13ef8edso1041105b6e.2 for ; Fri, 12 Jul 2024 01:39:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1720773548; x=1721378348; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=NoYP43ZgdyLcgRKntnfdP6muemOL2yUyMByTZlsLQGs=; b=hFWz8iYmNVqn3mMnQ4PsAdXC4TpZl4ev+0+METCI+v7Vg5cFlmu/q9vul5fgJ3u/7I yxwSqdynrOjExmhFdCgWpWAmHXznv6wn/ycFvMh6S3KctYJlLXgUiR8ojLNR7fpu7z8e nr8oMXZJJ6WrVYwh3aAqorck26M5xFFANzgA8zZVIs9eVgZ3jFF+4QvOeAK3xWa6Z26U u0fmVUrLkVK6cqFIffPKsc/1VvJcPXtH+n/8xneM7P7QdNhcMwbGtGCfGAkDEXVwTcCy V6+ccRTv+W9L/x7bgtP8jPMATdfh1yD34Wqg9YAxRERdX7tseabBMJ7CN2hSGom9VZMG 77lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720773548; x=1721378348; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NoYP43ZgdyLcgRKntnfdP6muemOL2yUyMByTZlsLQGs=; b=CiEzGXaDar6gIr3clyuEHgU5vE75UuaNYj4cIDJ+oLA7ulzr6NlAmkKe2kv2kHwIIZ AvlKipswXyLBHiPtRVAcY8IMBXleDQOemWYuo8HIe/DFP8BU+bC8Cv0T07pyJ1q2uBlA lwwNobmw+opNeEtq1lLzIeLd85KfYXqvZVI4rnwBgwqn3M61XMFe+NuP1hh7fbd5c5iV 7Gjhz3dqKa7DW80wecKdadIk3c4DjOZNzYoXdLdj7IMA5pbPbrSEdAle3OhVNxvugtr9 oANIgULf0Abp9fwEf6jnkk/rCJm+d9eUaoa/AZacux4BIgmTxtGpOMymOX98e/C/xxA3 J2Fw== X-Forwarded-Encrypted: i=1; AJvYcCVbvtlb9u2LPhAFoIK46H7IvZrxlCT8U7A02eQ2Y3CXMBKK0nL1MeCOyTiiwljOMpIU3WT7ohEj76IqjIV5GV9IUTJK6Rt86snIQPlo4YKw X-Gm-Message-State: AOJu0YxUUbxU3NcpT00diX97JJRxsqGsrUQeMxUBV0bVpX7K2hzzsBWO cN2CQ8nJtXA3W/kWm1MmIEYGzUKa6cKtS72t32douOp90dQNoaApaRkOZhQQRNc= X-Google-Smtp-Source: AGHT+IFvHBbmqbAuR3HIaTkO4x6lvhZ0ISwrkTRlVQ6l2auVT/ORD0WyzAIWLSQFoMZSchMNJnl+UQ== X-Received: by 2002:a05:6808:309b:b0:3da:ae17:50c0 with SMTP id 5614622812f47-3daae17540emr713772b6e.1.1720773548053; Fri, 12 Jul 2024 01:39:08 -0700 (PDT) Received: from hsinchu26.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b438c7099sm6894194b3a.84.2024.07.12.01.39.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jul 2024 01:39:07 -0700 (PDT) From: Yong-Xuan Wang To: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, kvm-riscv@lists.infradead.org, kvm@vger.kernel.org Cc: greentime.hu@sifive.com, vincent.chen@sifive.com, Yong-Xuan Wang , Jinyu Tang , Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrew Jones , Anup Patel , Conor Dooley , Mayuresh Chitale , Atish Patra , Samuel Ortiz , Daniel Henrique Barboza , Samuel Holland , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Evan Green , Xiao Wang , Alexandre Ghiti , Andrew Morton , Kemeng Shi , "Mike Rapoport (IBM)" , Leonardo Bras , Charlie Jenkins , "Matthew Wilcox (Oracle)" , Jisheng Zhang Subject: [PATCH v7 1/4] RISC-V: Add Svade and Svadu Extensions Support Date: Fri, 12 Jul 2024 16:38:45 +0800 Message-Id: <20240712083850.4242-2-yongxuan.wang@sifive.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240712083850.4242-1-yongxuan.wang@sifive.com> References: <20240712083850.4242-1-yongxuan.wang@sifive.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240712_013909_549139_04DCA324 X-CRM114-Status: GOOD ( 18.51 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Svade and Svadu extensions represent two schemes for managing the PTE A/D bits. When the PTE A/D bits need to be set, Svade extension intdicates that a related page fault will be raised. In contrast, the Svadu extension supports hardware updating of PTE A/D bits. Since the Svade extension is mandatory and the Svadu extension is optional in RVA23 profile, by default the M-mode firmware will enable the Svadu extension in the menvcfg CSR when only Svadu is present in DT. This patch detects Svade and Svadu extensions from DT and adds arch_has_hw_pte_young() to enable optimization in MGLRU and __wp_page_copy_user() when we have the PTE A/D bits hardware updating support. Co-developed-by: Jinyu Tang Signed-off-by: Jinyu Tang Signed-off-by: Yong-Xuan Wang Reviewed-by: Andrew Jones Reviewed-by: Alexandre Ghiti --- arch/riscv/Kconfig | 1 + arch/riscv/include/asm/csr.h | 1 + arch/riscv/include/asm/hwcap.h | 2 ++ arch/riscv/include/asm/pgtable.h | 13 ++++++++++++- arch/riscv/kernel/cpufeature.c | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 48 insertions(+), 1 deletion(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 0525ee2d63c7..3d705e28ff85 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -36,6 +36,7 @@ config RISCV select ARCH_HAS_PMEM_API select ARCH_HAS_PREPARE_SYNC_CORE_CMD select ARCH_HAS_PTE_SPECIAL + select ARCH_HAS_HW_PTE_YOUNG select ARCH_HAS_SET_DIRECT_MAP if MMU select ARCH_HAS_SET_MEMORY if MMU select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL diff --git a/arch/riscv/include/asm/csr.h b/arch/riscv/include/asm/csr.h index 25966995da04..524cd4131c71 100644 --- a/arch/riscv/include/asm/csr.h +++ b/arch/riscv/include/asm/csr.h @@ -195,6 +195,7 @@ /* xENVCFG flags */ #define ENVCFG_STCE (_AC(1, ULL) << 63) #define ENVCFG_PBMTE (_AC(1, ULL) << 62) +#define ENVCFG_ADUE (_AC(1, ULL) << 61) #define ENVCFG_CBZE (_AC(1, UL) << 7) #define ENVCFG_CBCFE (_AC(1, UL) << 6) #define ENVCFG_CBIE_SHIFT 4 diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index e17d0078a651..35d7aa49785d 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -81,6 +81,8 @@ #define RISCV_ISA_EXT_ZTSO 72 #define RISCV_ISA_EXT_ZACAS 73 #define RISCV_ISA_EXT_XANDESPMU 74 +#define RISCV_ISA_EXT_SVADE 75 +#define RISCV_ISA_EXT_SVADU 76 #define RISCV_ISA_EXT_XLINUXENVCFG 127 diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index aad8b8ca51f1..ec0cdacd7da0 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -120,6 +120,7 @@ #include #include #include +#include #define __page_val_to_pfn(_val) (((_val) & _PAGE_PFN_MASK) >> _PAGE_PFN_SHIFT) @@ -288,7 +289,6 @@ static inline pte_t pud_pte(pud_t pud) } #ifdef CONFIG_RISCV_ISA_SVNAPOT -#include static __always_inline bool has_svnapot(void) { @@ -624,6 +624,17 @@ static inline pgprot_t pgprot_writecombine(pgprot_t _prot) return __pgprot(prot); } +/* + * Both Svade and Svadu control the hardware behavior when the PTE A/D bits need to be set. By + * default the M-mode firmware enables the hardware updating scheme when only Svadu is present in + * DT. + */ +#define arch_has_hw_pte_young arch_has_hw_pte_young +static inline bool arch_has_hw_pte_young(void) +{ + return riscv_has_extension_unlikely(RISCV_ISA_EXT_SVADU); +} + /* * THP functions */ diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 5ef48cb20ee1..b2c3fe945e89 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -301,6 +301,8 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(ssaia, RISCV_ISA_EXT_SSAIA), __RISCV_ISA_EXT_DATA(sscofpmf, RISCV_ISA_EXT_SSCOFPMF), __RISCV_ISA_EXT_DATA(sstc, RISCV_ISA_EXT_SSTC), + __RISCV_ISA_EXT_DATA(svade, RISCV_ISA_EXT_SVADE), + __RISCV_ISA_EXT_DATA(svadu, RISCV_ISA_EXT_SVADU), __RISCV_ISA_EXT_DATA(svinval, RISCV_ISA_EXT_SVINVAL), __RISCV_ISA_EXT_DATA(svnapot, RISCV_ISA_EXT_SVNAPOT), __RISCV_ISA_EXT_DATA(svpbmt, RISCV_ISA_EXT_SVPBMT), @@ -554,6 +556,21 @@ static void __init riscv_fill_hwcap_from_isa_string(unsigned long *isa2hwcap) clear_bit(RISCV_ISA_EXT_v, isainfo->isa); } + /* + * When neither Svade nor Svadu present in DT, it is technically + * unknown whether the platform uses Svade or Svadu. Supervisor may + * assume Svade to be present and enabled or it can discover based + * on mvendorid, marchid, and mimpid. When both Svade and Svadu present + * in DT, supervisor must assume Svadu turned-off at boot time. To use + * Svadu, supervisor must explicitly enable it using the SBI FWFT extension. + */ + if (!test_bit(RISCV_ISA_EXT_SVADE, isainfo->isa) && + !test_bit(RISCV_ISA_EXT_SVADU, isainfo->isa)) + set_bit(RISCV_ISA_EXT_SVADE, isainfo->isa); + else if (test_bit(RISCV_ISA_EXT_SVADE, isainfo->isa) && + test_bit(RISCV_ISA_EXT_SVADU, isainfo->isa)) + clear_bit(RISCV_ISA_EXT_SVADU, isainfo->isa); + /* * All "okay" hart should have same isa. Set HWCAP based on * common capabilities of every "okay" hart, in case they don't @@ -619,6 +636,21 @@ static int __init riscv_fill_hwcap_from_ext_list(unsigned long *isa2hwcap) of_node_put(cpu_node); + /* + * When neither Svade nor Svadu present in DT, it is technically + * unknown whether the platform uses Svade or Svadu. Supervisor may + * assume Svade to be present and enabled or it can discover based + * on mvendorid, marchid, and mimpid. When both Svade and Svadu present + * in DT, supervisor must assume Svadu turned-off at boot time. To use + * Svadu, supervisor must explicitly enable it using the SBI FWFT extension. + */ + if (!test_bit(RISCV_ISA_EXT_SVADE, isainfo->isa) && + !test_bit(RISCV_ISA_EXT_SVADU, isainfo->isa)) + set_bit(RISCV_ISA_EXT_SVADE, isainfo->isa); + else if (test_bit(RISCV_ISA_EXT_SVADE, isainfo->isa) && + test_bit(RISCV_ISA_EXT_SVADU, isainfo->isa)) + clear_bit(RISCV_ISA_EXT_SVADU, isainfo->isa); + /* * All "okay" harts should have same isa. Set HWCAP based on * common capabilities of every "okay" hart, in case they don't. From patchwork Fri Jul 12 08:38:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong-Xuan Wang X-Patchwork-Id: 13731405 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7D6ADC3DA4A for ; Fri, 12 Jul 2024 08:39:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zBBNZvgKALnJl/ZvG0kgpt/mozOcYh1QQeRiJM/1nzw=; b=TROu8GbxS/QbxL wYJKdGbIrxjaoIHFXVNUvLc/Zml2GbFzpE+TZ8o2K6qErmnqlMNc58trLdqHBYEtH8F6n2EO6ufdQ H9S8KssmLJ5+2GMKc8lzXMaaayhPz7Vr9/4v1lL7AOU4xmUD6lIaP0QZ8f74Jz4MRqbg1AmUDs/kw R8TrAC/cee5yQHft4mkrs6jXTgDcJKehT0No8D2gc48bSOljSnbFluh4RzcZINYgjz3+Zp+OdzTIG 0yaYNpcRxq02PMsTsVC9T2VNKWV5L45W5yA5z3N8udSVXOsWodru9Kk6bkWcJP5s1gnslYfUT58l+ cVJAlwyQwPUghrQp794A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSBoE-0000000GvlG-1t7J; Fri, 12 Jul 2024 08:39:18 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSBo9-0000000GvgL-2CIk for linux-riscv@lists.infradead.org; Fri, 12 Jul 2024 08:39:16 +0000 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-70af5fbf0d5so1189702b3a.1 for ; Fri, 12 Jul 2024 01:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1720773552; x=1721378352; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=s8FxVWkBbUSRwzKSDXaD3IouygOhaOZodT8e7MKio/0=; b=BMEz1uYkmhwFrzR4z94L+uPm2uo8dqqlUas6a0SiXSTkhYrhMh/IfrkE+WFCXfWGrE BBnApAqt2T2IJWJ+rKjF4yoKucx84LI+7cMnCaLfzfSpTfxfJYedNoZ/sx1JkDJt9kba fmpgdSPzgjAYP9UYn//RxWWz9pexdgoTxJvvxub14sNIMT8rz7uupIaMyomIv65J61wY 3SwYs6g4iEAXgl2X17wc+J1OsnlupWssACK8hz06Q7gakCiEId8vpbN7C306BzpOpynH eQ/5TgIqINFwtGde+a8OSaallnlJEb6givrOmIzz8j9DfZdRQqSrVnr/e7ckmKdxuILT Uoyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720773552; x=1721378352; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=s8FxVWkBbUSRwzKSDXaD3IouygOhaOZodT8e7MKio/0=; b=KpPrQ3H/RnXsMtlMOHDKHsbqfukuOHmEVGCMpsBZvA1exE3ffcCQq8d6y3+59mgbNP jVIhTsSMSm01GJUo6GqlyuQCJKK9bQKEi0ihYYl99GmyZM8XAxVX06qzkHdLF/Y4vFOs RNo3w8TKga3/yPTg1nDB+ASR7lPwqSiDq4M8NMSNDKhID/kGdNflPzCrQAnmYl3T1miM GAKAX07zV8ynEjblpRRlc6xJ1gpAZ2Hkge5u3MXAhkuCJMJ3ezGefVL79PzCLWrep0dU uQ3ldP2BH4Qv/F3eWxfE/iCS1UMkztBcntGQaioOUgLdt62dxoLtOvui07Oe/BwoWLE8 giIA== X-Forwarded-Encrypted: i=1; AJvYcCUQxBDq/tG+dGgn8XxdaMdAhwdgTDurH/EjqFUnapwixwYvkbaaM1r8k7nY8BQmXYQCHI2Q1YgyeZfBAzQuhcq7fzmx9Dr15VHP8XqTjkeV X-Gm-Message-State: AOJu0YwlXTYptKSsPb354tMkf6c1H4cda4izSKkZKGh1sZXTkLAkxnH/ 991xB0aJSmHkDsbVcIYUzdvDawiE/UdLN24Fb2wFZU6kiz5oO+ohov8gg6RlovQ= X-Google-Smtp-Source: AGHT+IGFZpUIicB4zZC9hrvnR3WIEBPWN8+7c0RwydpX4SwJwlx7pWYViWf5LIEdN2ZgdD/fy0d2ww== X-Received: by 2002:a05:6a00:8d95:b0:70a:f521:52da with SMTP id d2e1a72fcca58-70b6c976927mr2334016b3a.16.1720773552263; Fri, 12 Jul 2024 01:39:12 -0700 (PDT) Received: from hsinchu26.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b438c7099sm6894194b3a.84.2024.07.12.01.39.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jul 2024 01:39:12 -0700 (PDT) From: Yong-Xuan Wang To: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, kvm-riscv@lists.infradead.org, kvm@vger.kernel.org Cc: greentime.hu@sifive.com, vincent.chen@sifive.com, Yong-Xuan Wang , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Paul Walmsley , Palmer Dabbelt , Albert Ou , devicetree@vger.kernel.org Subject: [PATCH v7 2/4] dt-bindings: riscv: Add Svade and Svadu Entries Date: Fri, 12 Jul 2024 16:38:46 +0800 Message-Id: <20240712083850.4242-3-yongxuan.wang@sifive.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240712083850.4242-1-yongxuan.wang@sifive.com> References: <20240712083850.4242-1-yongxuan.wang@sifive.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240712_013913_650393_9B66F9F0 X-CRM114-Status: GOOD ( 11.44 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add entries for the Svade and Svadu extensions to the riscv,isa-extensions property. Signed-off-by: Yong-Xuan Wang Acked-by: Conor Dooley Reviewed-by: Alexandre Ghiti Reviewed-by: Samuel Holland --- .../devicetree/bindings/riscv/extensions.yaml | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml index 468c646247aa..e91a6f4ede38 100644 --- a/Documentation/devicetree/bindings/riscv/extensions.yaml +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml @@ -153,6 +153,34 @@ properties: ratified at commit 3f9ed34 ("Add ability to manually trigger workflow. (#2)") of riscv-time-compare. + - const: svade + description: | + The standard Svade supervisor-level extension for SW-managed PTE A/D + bit updates as ratified in the 20240213 version of the privileged + ISA specification. + + Both Svade and Svadu extensions control the hardware behavior when + the PTE A/D bits need to be set. The default behavior for the four + possible combinations of these extensions in the device tree are: + 1) Neither Svade nor Svadu present in DT => It is technically + unknown whether the platform uses Svade or Svadu. Supervisor + software should be prepared to handle either hardware updating + of the PTE A/D bits or page faults when they need updated. + 2) Only Svade present in DT => Supervisor must assume Svade to be + always enabled. + 3) Only Svadu present in DT => Supervisor must assume Svadu to be + always enabled. + 4) Both Svade and Svadu present in DT => Supervisor must assume + Svadu turned-off at boot time. To use Svadu, supervisor must + explicitly enable it using the SBI FWFT extension. + + - const: svadu + description: | + The standard Svadu supervisor-level extension for hardware updating + of PTE A/D bits as ratified at commit c1abccf ("Merge pull request + #25 from ved-rivos/ratified") of riscv-svadu. Please refer to Svade + dt-binding description for more details. + - const: svinval description: The standard Svinval supervisor-level extension for fine-grained From patchwork Fri Jul 12 08:38:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong-Xuan Wang X-Patchwork-Id: 13731406 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1F2AEC2BD09 for ; Fri, 12 Jul 2024 08:39:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5F8yo5RWJIc3EcbokBdeExzzrVTbmfOyJHk30QwXkqU=; b=wyGgDmL4WwUj0h c4wxjNKCHeXiERisdKzqYUCBHO3zaAo0eBLhdPdrGfVPgbD4ay1ouGfy6MIZoRNeJMLGlCiObu5v+ sr+NT6FWEcuJAawTPlrozSKz58KBrq3ICedBTtxNfdO/2NgTUPSxfJNl27KSgHnHIrWmdR6qE2HeA 1y6thlueGM8O/b5lNv6N0JB7D3xSRrG4IIFeqxzfROaSvuTk92tL+GBI2dFn9T174h4U1taoQSQSb iw0XvE5+cKWu5B9BgEc2ay4iF2Wk6ypEx9psF2tF+e8e+nyFMLpUY9UU9q8AFjo5dOoE2c2PeHkwP bFwVqpgxN3l8NV7HKmSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSBoH-0000000Gvnm-0q6G; Fri, 12 Jul 2024 08:39:21 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSBoD-0000000GvkP-1S4q for linux-riscv@lists.infradead.org; Fri, 12 Jul 2024 08:39:20 +0000 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-70af2b1a35aso1430823b3a.1 for ; Fri, 12 Jul 2024 01:39:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1720773556; x=1721378356; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=qOZOdNqYBv8WGomeUEUfCET+0Nz9/2nmPAIIjSAFF/o=; b=UAQrLHQ6BhDVDO1GC49Y+uI/6mHvVTg3sKpYNtiWnuUTalj1ma4EvAzlvnm5GbLFgO BfKVnL/rhNadDCm77XAUEewDltgHFtpoU6kAgOWISWrEIrIgEUL29uBS/40YjVyjq8WS tVXdF6tpFz9S6dMaGtIUYvbiAvtJkX6YtP7mpBPvQganLYSFQSywLnPUKPMgN6WQiQqX 8v6SFJ0pwl2Ii8cbi2bgxkg6trdp+tEbRVgv2vO8Q7J8trXOmacIFElIGx0Q6otL7J0J WYnb8h0kmiHfcltU0MqWy+LglVBje2jCzEq99VipvLUNE/YMeCpSUh6IP+XX3tvZV/xg M7vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720773556; x=1721378356; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qOZOdNqYBv8WGomeUEUfCET+0Nz9/2nmPAIIjSAFF/o=; b=L+m9RBxbXHX1dWoxDeac6yT3y6dukIhYu4DB2ZORm+Z0NN+Cax9iCCa1wO+XTF2ytg SUMYwnKfDa8pB76vZZiM4r2l9KABFAOKOfGBIcmq7xfI5ktmNfoHM62+LKZUpvFKEnyA WHehA4siJL9D3UowDXpNtjhWBZMH5jA70E9sZ1YHrGLEtgSyT3jt6mvvyx8yNK1xukb/ gibGDKjwhAPBnIGpy2Em67AOVPBVTWHtidhbDYBxSTo5FytwhgtEqx05SbUQul3P99i3 /0okUWSIB0OtDOt9dnPj6M5dFYbfWqc+xqReVBi+CXGPBKO2Y5+mf/arGdT8quiAXCFI fPbQ== X-Forwarded-Encrypted: i=1; AJvYcCXzgzAmvIgJaA+LUckl4rmG4g+26IcCmqviXOqenL7KVyZ0ujYV3XUOsOx1iMhIkt29LKizQ7Cp0Pb6BnDV75eg89k72i01CwAo4ja1pqK0 X-Gm-Message-State: AOJu0Yxgy5IyGj6Pb44Hd16y+RhJZ1764Z5EYwL8A1A0H16VgDIObii7 8Bvbwp/EM7yDXaewMXVNA+wNLAi1R6DFVFYOLZI6zMJ5//TsZBSfUNsYgzjYPFM= X-Google-Smtp-Source: AGHT+IFUgJGXqGz1rR6VQacB/sQPEJI/kBTqgZjcalyfvrrbdgNBckvS4WIfC6u8yM9C/ItjyrZEtw== X-Received: by 2002:a05:6a00:3392:b0:706:348a:528a with SMTP id d2e1a72fcca58-70b4355854fmr11327085b3a.10.1720773556295; Fri, 12 Jul 2024 01:39:16 -0700 (PDT) Received: from hsinchu26.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b438c7099sm6894194b3a.84.2024.07.12.01.39.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jul 2024 01:39:16 -0700 (PDT) From: Yong-Xuan Wang To: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, kvm-riscv@lists.infradead.org, kvm@vger.kernel.org Cc: greentime.hu@sifive.com, vincent.chen@sifive.com, Yong-Xuan Wang , Anup Patel , Atish Patra , Paul Walmsley , Palmer Dabbelt , Albert Ou Subject: [PATCH v7 3/4] RISC-V: KVM: Add Svade and Svadu Extensions Support for Guest/VM Date: Fri, 12 Jul 2024 16:38:47 +0800 Message-Id: <20240712083850.4242-4-yongxuan.wang@sifive.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240712083850.4242-1-yongxuan.wang@sifive.com> References: <20240712083850.4242-1-yongxuan.wang@sifive.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240712_013917_597358_4015F015 X-CRM114-Status: GOOD ( 12.41 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org We extend the KVM ISA extension ONE_REG interface to allow VMM tools to detect and enable Svade and Svadu extensions for Guest/VM. Since the henvcfg.ADUE is read-only zero if the menvcfg.ADUE is zero, the Svadu extension is available for Guest/VM and the Svade extension is allowed to disabledonly when arch_has_hw_pte_young() is true. Signed-off-by: Yong-Xuan Wang Reviewed-by: Andrew Jones Reviewed-by: Samuel Holland --- arch/riscv/include/uapi/asm/kvm.h | 2 ++ arch/riscv/kvm/vcpu.c | 3 +++ arch/riscv/kvm/vcpu_onereg.c | 15 +++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/arch/riscv/include/uapi/asm/kvm.h b/arch/riscv/include/uapi/asm/kvm.h index e878e7cc3978..a5e0c35d7e9a 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -168,6 +168,8 @@ enum KVM_RISCV_ISA_EXT_ID { KVM_RISCV_ISA_EXT_ZTSO, KVM_RISCV_ISA_EXT_ZACAS, KVM_RISCV_ISA_EXT_SSCOFPMF, + KVM_RISCV_ISA_EXT_SVADE, + KVM_RISCV_ISA_EXT_SVADU, KVM_RISCV_ISA_EXT_MAX, }; diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c index 17e21df36cc1..64a15af459e0 100644 --- a/arch/riscv/kvm/vcpu.c +++ b/arch/riscv/kvm/vcpu.c @@ -540,6 +540,9 @@ static void kvm_riscv_vcpu_setup_config(struct kvm_vcpu *vcpu) if (riscv_isa_extension_available(isa, ZICBOZ)) cfg->henvcfg |= ENVCFG_CBZE; + if (riscv_isa_extension_available(isa, SVADU)) + cfg->henvcfg |= ENVCFG_ADUE; + if (riscv_has_extension_unlikely(RISCV_ISA_EXT_SMSTATEEN)) { cfg->hstateen0 |= SMSTATEEN0_HSENVCFG; if (riscv_isa_extension_available(isa, SSAIA)) diff --git a/arch/riscv/kvm/vcpu_onereg.c b/arch/riscv/kvm/vcpu_onereg.c index 62874fbca29f..474fdeafe9fe 100644 --- a/arch/riscv/kvm/vcpu_onereg.c +++ b/arch/riscv/kvm/vcpu_onereg.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #define KVM_RISCV_BASE_ISA_MASK GENMASK(25, 0) @@ -38,6 +39,8 @@ static const unsigned long kvm_isa_ext_arr[] = { KVM_ISA_EXT_ARR(SSAIA), KVM_ISA_EXT_ARR(SSCOFPMF), KVM_ISA_EXT_ARR(SSTC), + KVM_ISA_EXT_ARR(SVADE), + KVM_ISA_EXT_ARR(SVADU), KVM_ISA_EXT_ARR(SVINVAL), KVM_ISA_EXT_ARR(SVNAPOT), KVM_ISA_EXT_ARR(SVPBMT), @@ -105,6 +108,12 @@ static bool kvm_riscv_vcpu_isa_enable_allowed(unsigned long ext) return __riscv_isa_extension_available(NULL, RISCV_ISA_EXT_SSAIA); case KVM_RISCV_ISA_EXT_V: return riscv_v_vstate_ctrl_user_allowed(); + case KVM_RISCV_ISA_EXT_SVADU: + /* + * The henvcfg.ADUE is read-only zero if menvcfg.ADUE is zero. + * Guest OS can use Svadu only when host os enable Svadu. + */ + return arch_has_hw_pte_young(); default: break; } @@ -167,6 +176,12 @@ static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext) /* Extensions which can be disabled using Smstateen */ case KVM_RISCV_ISA_EXT_SSAIA: return riscv_has_extension_unlikely(RISCV_ISA_EXT_SMSTATEEN); + case KVM_RISCV_ISA_EXT_SVADE: + /* + * The henvcfg.ADUE is read-only zero if menvcfg.ADUE is zero. + * Svade is not allowed to disable when the platform use Svade. + */ + return arch_has_hw_pte_young(); default: break; } From patchwork Fri Jul 12 08:38:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong-Xuan Wang X-Patchwork-Id: 13731413 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E0936C3DA4A for ; Fri, 12 Jul 2024 08:39:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3YanSgV4tAc4FW6GqzY5egKo6656djGFHYueCZsgkKo=; b=E06fatFJKckr2x ygqOykeyYGvkL6OZtQgiLtps1QBcKgNtUFTdvpjma4sa/6/gGXuj6PeBWTFulbAJYuBa/0IwXHJ8Q wjIVHdODs2GBbbuKtWxyumANFyzQDWa0Tig26azh9ltXLZ0Z2XUxtZsgMj7UPwMhuz75h6DIhzhsa etHfjxO4W02tRDnTa7y+B3aRCFgTJAjMnQRWxBjrewst61yp1svnkyRbUgWurqvb0ybikn514nsB5 pkAmG4H/0bF5qQsi+Gox/nA+qZrXGVcpL7t01Nh5nD0RY6YqE9fsH6PCzSQkPFUnd1l2I97N1pQ31 LvEz23jve/YuVh1XPgBA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSBoM-0000000GvsD-1mjW; Fri, 12 Jul 2024 08:39:26 +0000 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSBoH-0000000GvnW-3HiR for linux-riscv@lists.infradead.org; Fri, 12 Jul 2024 08:39:24 +0000 Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-3d9e13ef9aaso1068378b6e.1 for ; Fri, 12 Jul 2024 01:39:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1720773560; x=1721378360; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=PpDCA7CnSWtIO6seFJ4J0hDKtH06inwXMPU5CaySLhw=; b=dhzegVHPG3GEvFFoZX/I3A+WBLxXf3THzodUV6bO1JZ6CSsQr+3HZP+20f0oF1XGx6 wSZ3DkSUyQRO76BkFixCs3deIQetixFCElf9eMT8DLzG1DCu67jr5aFMn2ntamKQWm/t kDc6AqSLOHar1zJDGUTJf8laDTxqOdlSB+tbXUj3LTiUnVakBGtkxQ5VKQG851Rm1cAM eTPYPLHaVHwn4TTRXUwleWqk4q0fweWtcn0ShCnUIWROI6IgfX+cKRXSwm18l931jkzu mv6xUEwGT9DZtGcsNt6f2PX60i8lqny51F0P0CjPlRacU2Fz2fsY/3jeMb4U5RhskjeD 32Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720773560; x=1721378360; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PpDCA7CnSWtIO6seFJ4J0hDKtH06inwXMPU5CaySLhw=; b=eqliGruLTpljvM5/ORnK3hL4EXSj8V69F0YSrS3Jn172lmaHF+3Zr8959oHV4NCy6y /pvedlgtBk/2Sdm5mKnR3bJ0rds2DZAZlZP5reiGpJmtPYJzAqszzoz9FhiIVz+94D6s 5j6fsnAB4gjCKPPELbiKcho9/pLfr2iF7RripXLgajTV/zAt7P2Czqe5tty4x5x2HXRy +QbBo/FiisVl/nvFVggz/7/L7y3LP8ijv+nFqpNmLe7dL0M608Ewr3Uh/rwakQK853ds 5q4ibcZ/9QtiDRjAccA+T19PmWuM5YEi4JnhTqnntBmsf5Ld6uNUlJOqu5DjHK8eptBc uRsw== X-Forwarded-Encrypted: i=1; AJvYcCWTiqcKqqC5PHZJwXnkTsG3AS2O3ZDxjTSHP3+/MKiGSxVreli4OFhgfp4hSYsMDV1KzaF8u5DYRaAYe52p4+v9KAfknFdMw26NwAcnUkBA X-Gm-Message-State: AOJu0YyxAilNdQzSlrrP3JLpF8Cp411KrmnoL9N/DW1gzUy4qiY9KeY6 sYwgzF9iMP+ooVf7Cvda7QVvU+EzI//KaSNGd3JVckr7c3Jn1Y9V9LuLXvOLZ54= X-Google-Smtp-Source: AGHT+IHmBxrEAG3WPd6oj+/586lglgYzxY+9BouYb6jIFT5EHBZDlB4+cb5Y4B3ynyNiUyxupNCiwQ== X-Received: by 2002:a05:6808:1982:b0:3da:a6ce:f017 with SMTP id 5614622812f47-3daa6cef5a9mr3909532b6e.46.1720773560484; Fri, 12 Jul 2024 01:39:20 -0700 (PDT) Received: from hsinchu26.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b438c7099sm6894194b3a.84.2024.07.12.01.39.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jul 2024 01:39:20 -0700 (PDT) From: Yong-Xuan Wang To: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, kvm-riscv@lists.infradead.org, kvm@vger.kernel.org Cc: greentime.hu@sifive.com, vincent.chen@sifive.com, Yong-Xuan Wang , Anup Patel , Atish Patra , Paolo Bonzini , Shuah Khan , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-kselftest@vger.kernel.org Subject: [PATCH v7 4/4] KVM: riscv: selftests: Add Svade and Svadu Extension to get-reg-list test Date: Fri, 12 Jul 2024 16:38:48 +0800 Message-Id: <20240712083850.4242-5-yongxuan.wang@sifive.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240712083850.4242-1-yongxuan.wang@sifive.com> References: <20240712083850.4242-1-yongxuan.wang@sifive.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240712_013922_122059_20BF2E93 X-CRM114-Status: UNSURE ( 8.27 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Update the get-reg-list test to test the Svade and Svadu Extensions are available for guest OS. Signed-off-by: Yong-Xuan Wang Reviewed-by: Andrew Jones --- tools/testing/selftests/kvm/riscv/get-reg-list.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/testing/selftests/kvm/riscv/get-reg-list.c b/tools/testing/selftests/kvm/riscv/get-reg-list.c index 222198dd6d04..1d32351ad55e 100644 --- a/tools/testing/selftests/kvm/riscv/get-reg-list.c +++ b/tools/testing/selftests/kvm/riscv/get-reg-list.c @@ -45,6 +45,8 @@ bool filter_reg(__u64 reg) case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_SSAIA: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_SSCOFPMF: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_SSTC: + case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_SVADE: + case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_SVADU: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_SVINVAL: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_SVNAPOT: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_SVPBMT: @@ -411,6 +413,8 @@ static const char *isa_ext_single_id_to_str(__u64 reg_off) KVM_ISA_EXT_ARR(SSAIA), KVM_ISA_EXT_ARR(SSCOFPMF), KVM_ISA_EXT_ARR(SSTC), + KVM_ISA_EXT_ARR(SVADE), + KVM_ISA_EXT_ARR(SVADU), KVM_ISA_EXT_ARR(SVINVAL), KVM_ISA_EXT_ARR(SVNAPOT), KVM_ISA_EXT_ARR(SVPBMT), @@ -935,6 +939,8 @@ KVM_ISA_EXT_SIMPLE_CONFIG(h, H); KVM_ISA_EXT_SUBLIST_CONFIG(smstateen, SMSTATEEN); KVM_ISA_EXT_SIMPLE_CONFIG(sscofpmf, SSCOFPMF); KVM_ISA_EXT_SIMPLE_CONFIG(sstc, SSTC); +KVM_ISA_EXT_SIMPLE_CONFIG(svade, SVADE); +KVM_ISA_EXT_SIMPLE_CONFIG(svadu, SVADU); KVM_ISA_EXT_SIMPLE_CONFIG(svinval, SVINVAL); KVM_ISA_EXT_SIMPLE_CONFIG(svnapot, SVNAPOT); KVM_ISA_EXT_SIMPLE_CONFIG(svpbmt, SVPBMT); @@ -991,6 +997,8 @@ struct vcpu_reg_list *vcpu_configs[] = { &config_smstateen, &config_sscofpmf, &config_sstc, + &config_svade, + &config_svadu, &config_svinval, &config_svnapot, &config_svpbmt,