Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp275415lqr; Wed, 5 Jun 2024 06:00:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUbfpOgiQW8XLDPa0LDjPNwfXWTi9olYIy0/AkbkbdnfFb0fAoZ6xs9D+EA+BfOk3CkBQhJ4gWNW2tj0Wb3WbEOa3jhw0czR11vijEEVQ== X-Google-Smtp-Source: AGHT+IH4AAn9WGKDVCyGqblfLUKpoMJkzHvjaqgmnJoLZO1IuV9zXdQjP8LOMMTbs0LFcqDbxkv9 X-Received: by 2002:a05:622a:10d:b0:43a:4882:861f with SMTP id d75a77b69052e-4402b5f7424mr22945371cf.3.1717592422073; Wed, 05 Jun 2024 06:00:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717592422; cv=pass; d=google.com; s=arc-20160816; b=LwMZTf+oVCE/kaKT+gt4p80UxZOiQE2ajsudAJHjqMsUKnrja41qwt74xHSqlzfDxI V/stUsdealiC7gxHg7+FqKCjq/lGuHeC+tGN3KcBj8swVrO3nXY7d2nC2bwc7Z6TEwxQ r01oYdNrghMOYC42K3sGsl+XVuDy+RC1UHTXHbMZcFQ9/heoIbPSbr4Aixl4Idl1AocR VNDFUzjZI9XM3sFo8RM2UJYAsZpC7yrpfDXcMhWE5Ye90B91r3uTbXYPuhRTciUd2pXI aU5u3Td1wVsncPc5LUY0/HScrUmrb5bA/kZw2xHkGAwk1TWfIlqf8gmv43wdUObC26pv OghA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from:dkim-signature; bh=5DXKLGOuzK7Mq9/TKsjijP76CNhcAYfch9wR/ZqBgRU=; fh=iEelmZSZuWC2mSspsjvXHtS7Fa5HL03Wu+NRUJqFiLA=; b=coPpvP/6ReaetK/a6Inv+2Q75UkzhkWFdLZ7Dij/dS6OkniZO15M1/+2b9nM+DX63O injoh5YHxYV9zmX25VutIKx1UE6LZMxGAl3ApRrBgVipttwRiTngv0PPrExjNtcO703g sgfhjNC3ZzuF2erUeILyVR0K9y5qkLnMvci2mZBQJXKsLbm2QBBLoqJKf6GZXbuZeNhu j7misUCgkgvNOfZgTL8HrOPdlOF1+uZYY4Fh/BvAZY7ix6M7rgXATBo/MV/L56Nn++n2 Z2Uh7nHzw+c4FyaDIhsl8RQlcqv/y9CFr1hfIdSOVMR9wvfrWY9LWDUqvW5X3idNghYU mtjw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=dknwMVeg; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-202566-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202566-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-44031a4f113si2064771cf.41.2024.06.05.06.00.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 06:00:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202566-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=dknwMVeg; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-202566-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202566-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 7DC321C24185 for ; Wed, 5 Jun 2024 13:00:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8DC8F1B013F; Wed, 5 Jun 2024 12:15:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="dknwMVeg" Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (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 36B30197518 for ; Wed, 5 Jun 2024 12:15:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717589720; cv=none; b=Bp4wrJdpTImpQMHOStTprP+Gpp25rYsV3VasF7M1nde0sBoXkaCJkd5ZUQm2j2z1+DScFzvsn/Y97n5szhmrbeuZErbxDvTsAxIzggnvF/OodBAFnsMBXu4eYDRXlaTqxQ/IJRr0WnFf9QO4AjgXlky0Pz8aiIVatxylHjhgFFk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717589720; c=relaxed/simple; bh=x0ytsCbviekBEjjLge1IWFvc2zY+68XMN37JrAm8Nrs=; h=From:To:Cc:Subject:Date:Message-Id; b=ZwvPZ9ZTurVbmciQDUZeJKtfFRlnYqFNIcR8SLjYmMVIafdWrhoTd+qBA9DUxlBszL+cRQDk5JN/cSr6TpcnqSPVMno9m4KxIXqxCzWkXzt49keE75vGH73yWceYaa/c1zCFU50WbLVIVfZ2sqn+fUUnagpKWS1oKejAsOLJgRE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com; spf=pass smtp.mailfrom=sifive.com; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b=dknwMVeg; arc=none smtp.client-ip=209.85.210.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-7025ca8bebcso3353747b3a.3 for ; Wed, 05 Jun 2024 05:15:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1717589718; x=1718194518; darn=vger.kernel.org; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5DXKLGOuzK7Mq9/TKsjijP76CNhcAYfch9wR/ZqBgRU=; b=dknwMVegqLrP6LEpTNCXP/amPBCTjdzD6ltz8cEhEoJIceRrRpac9YBlDVzspZn/vN 08LeKVlokWY62yKSv6U7MxsJTCR38FDX0gWPNAv0XxFgX91i4veRM5JbT2Ezef1Pqg23 mbeJMX8XNZqopZhABVGAuyK9hhbDg+T5kGRDWtQDktPxgrZq4TEH0W4p1W06cqRXQygR phDFuVRK0an9X7iwwzWzRNCrgPtrFqjeEqS9GPIS+xQ6veUTnVDdz583mDBbrCHDbkMj UKqEfwLZXGTuZ+0ceVBVSGnz6ARmxfacwDOgRrY9dUMNL22dc5NIS+Df9v0cD6NFji6B KPDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717589718; x=1718194518; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5DXKLGOuzK7Mq9/TKsjijP76CNhcAYfch9wR/ZqBgRU=; b=RhNCgZOJBnPL45OfhLAfO4zAXw4x6wWRI3KAh+EMBwqBmhGA/SpI5WXZnvhShVtXhB NYXhqFvK0HsujBLI/jqaIvY1OBAa/uWosRDgQ6yV90KtWfNw9U2pXwmLBh2OjXP7rJae 1r/rdpEmr+AC8SE4F1AbR+c447QmZXVqPhzYzlm6hEjOg+iDEvDYsrBpjF07FzxlwePl vjt+ZSh7PilKhlixzqskLhyeGX2UxDJ2YyvZ0yuW8nAQEbdWWdTYLfSeXQ5meDbxhebK UStFWZoNIfvHSf4uCG/8OTIj8wuPviCPqg7gklxA/vbJQX2DDKjF+aMFkPZftn8fYthy 0K6w== X-Gm-Message-State: AOJu0YylWKbfOHDozJWFm37KPV6obKvCCQJkxCtXZYdHsoCUikMDDr72 iMY7otv13DYVC6bkFV1mkwPJCVSXJHjRAVnYoeGAGJZpqqcuBrby1/ztKZM9m12hHnTPsaXvFsu 2utr1GMj2yAHH5s/qjR1k3GMdE4p0Ru16CJYc+stEU/+LRJ+p2ZDpNoa3sBGGWc5rgfqD4ZHWKU A/XZlcn6Z+kn74zzVuFPbhIhf0wJ7gQf9of/KtXRmaUd83pm3pbMiZUw== X-Received: by 2002:a05:6a00:2e1b:b0:6eb:6:6b72 with SMTP id d2e1a72fcca58-703e5a7c2e5mr2473376b3a.25.1717589718025; Wed, 05 Jun 2024 05:15:18 -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-703ee672fb3sm885379b3a.216.2024.06.05.05.15.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 05:15:17 -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: apatel@ventanamicro.com, alex@ghiti.fr, ajones@ventanamicro.com, greentime.hu@sifive.com, vincent.chen@sifive.com, Yong-Xuan Wang , Paul Walmsley , Palmer Dabbelt , Albert Ou Subject: [PATCH v5 0/4] Add Svade and Svadu Extensions Support Date: Wed, 5 Jun 2024 20:15:06 +0800 Message-Id: <20240605121512.32083-1-yongxuan.wang@sifive.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Svade and Svadu extensions represent two schemes for managing the PTE A/D bit. 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. This series enables Svade and Svadu extensions for both host and guest OS. Regrading the mailing thread[1], we have 4 possible combinations of these extensions in the device tree, the default hardware behavior for these possibilities are: 1. Neither svade nor svadu in DT: default to svade. 2. Only svade in DT: use svade. 3. Only svadu in DT: use svadu. 4. Both svade and svadu in DT: default to svade. The Svade extension is mandatory and the Svadu extension is optional in RVA23 profile. Platforms want to take the advantage of Svadu can choose 3. Those are aware of the profile can choose 4, and Linux won't get the benefit of svadu until the SBI FWFT extension is available. [1] https://lore.kernel.org/linux-kernel/20240527-e9845c06619bca5cd285098c@orel/T/#m29644eb88e241ec282df4ccd5199514e913b06ee --- v5: - remove all Acked-by and Reviewed-by (Conor, Andrew) - add Svade support - update the arch_has_hw_pte_young() in PATCH1 - update the dtbinding in PATCH2 (Alexandre, Andrew) - check the availibility of Svadu for Guest/VM based on arch_has_hw_pte_young() in PATCH3 v4: - fix 32bit kernel build error in PATCH1 (Conor) - update the status of Svadu extension to ratified in PATCH2 - add the PATCH4 to suporrt SBI_FWFT_PTE_AD_HW_UPDATING for guest OS - update the PATCH1 and PATCH3 to integrate with FWFT extension - rebase PATCH5 on the lastest get-reg-list test (Andrew) v3: - fix the control bit name to ADUE in PATCH1 and PATCH3 - update get-reg-list in PATCH4 v2: - add Co-developed-by: in PATCH1 - use riscv_has_extension_unlikely() to runtime patch the branch in PATCH1 - update dt-binding Yong-Xuan Wang (4): RISC-V: Add Svade and Svadu Extensions Support dt-bindings: riscv: Add Svade and Svadu Entries RISC-V: KVM: Add Svade and Svadu Extensions Support for Guest/VM KVM: riscv: selftests: Add Svade and Svadu Extension to get-reg-list test .../devicetree/bindings/riscv/extensions.yaml | 30 +++++++++++++++++++ arch/riscv/Kconfig | 1 + arch/riscv/include/asm/csr.h | 1 + arch/riscv/include/asm/hwcap.h | 2 ++ arch/riscv/include/asm/pgtable.h | 14 ++++++++- arch/riscv/include/uapi/asm/kvm.h | 2 ++ arch/riscv/kernel/cpufeature.c | 2 ++ arch/riscv/kvm/vcpu.c | 6 ++++ arch/riscv/kvm/vcpu_onereg.c | 6 ++++ .../selftests/kvm/riscv/get-reg-list.c | 8 +++++ 10 files changed, 71 insertions(+), 1 deletion(-) -- 2.17.1