From patchwork Tue Jul 2 08:50:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 13719130 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 480B5C3064D for ; Tue, 2 Jul 2024 08:52:03 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=wW/2u/vi1HGBOQe8Z35G7x3WJyEKzkppAZLXJ1jN9t8=; b=eG8kXKtzOaFA7S JOXJrZM+BBIWVQGF9Vc3m6R2XAIEV6JcFXeuw1xlsAKnT7RU1HdF+Z5PPOHxH3Y1xdj3rgEZIRte2 UdEdTZd4+IvBrkoi/sNahS+qgh626X1lix3A8e1YDOYvelrrpgws4ByzrwI1hp4G6VT7C22s3YwkF IhcKNPtds9jFxyhraCTbijoQYU2GZc951iKnvHgElPPKbXf2ImwtsmnQrX+r2qTt2TKHgB/EaaT+k yaeDLYz37JbpK8MRKPKWGmMsreXAOJXckLdaM8RK4WO4KKH15jaGwjj8grG4nsUBNfjRx8scnfU2D i8sajDEY/hdQ3qyroEZg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOZF1-0000000629m-3wv8; Tue, 02 Jul 2024 08:51:59 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOZEz-00000006292-1ghH for linux-riscv@lists.infradead.org; Tue, 02 Jul 2024 08:51:58 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4255fa23f7bso27455075e9.2 for ; Tue, 02 Jul 2024 01:51:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1719910316; x=1720515116; darn=lists.infradead.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=WccEx9NvT13PoluUayFyEXUnGwkOt/S9EsiCAQXUb8Q=; b=FqiEH8+VG9hQNEPIWqg9L//5WKofqNlSDfO2J4g4LNaZj32xGA1+Tiud7aoL3Ic4oW t+w7MhFz+SsF1NZlQB4sCKSE6B58nwVOF5eMz8L2oalVubdgyEMIc6FuBptGgm1m7GHx 93i+Gj6PAAG+zQgJcufUWyLwi63pCEcd6dh9U63Cc2zPLLSzSioOhXqGLRKJE5TGHrCp pU9yf2AIOhAnnBj9Ndn5COAezW6siTw1b1ETS/I8bG+NnakezQR2cGOwACAfKqEclcRy hr/Mihhp5YgFaYN1DfkGbscbfhVM9NpMYOmZPOy4/ORslwbcBYkSmpyzRsKJkOCF8PrP k4Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719910316; x=1720515116; h=content-transfer-encoding:mime-version: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=WccEx9NvT13PoluUayFyEXUnGwkOt/S9EsiCAQXUb8Q=; b=KpwNafGQbvnP52Z6Uw7K/N5dv8uExlRbeoWl25CGKlSGsxPQvOacFqiaLzJIpMzDT/ 8m52TDLhBB8xJaBN+Vp1lO0CI/ZFVyOUicA/ftAhRUmi+c8ar2q5bCuKaprKO0h57n+y tEEM5lrmj8K4Vlt6J0Zr5Uhds1n1fMUjdoXJA6Rh0RPX5AQR4ctniPW+euhfFN5+GDTm TQetEOLfRiyLAmSnSIRzOj/8u4Kd6gXL/hu50mpsxLJ98WD8OqHl35KqrSBsoigqKv3F nVX0w82LX/lkOTz/JPqwk9icmRpggiHmYzy0Eg4zzaC8KZaxJLU+h3KpUrDF3ANIJk/F Iidg== X-Forwarded-Encrypted: i=1; AJvYcCX3ONnhpgtFNPlbce8Hz5PzCwSaO/IUKMMwMCmwfZ4piwUcUIXy0cut7naquoRz2mP6ginaF74qpAajR7nGtPIQCUSXP0ZYcBG+jKamVQqY X-Gm-Message-State: AOJu0Yzixchu3xaOwv7zg6Tp473g0PG3VdaSHFiCBtrZdiF8uYwFVy5X 09lwWQyJFCSkiM+vfJjsmNITx7Wq9NsYXR+3+bnkUUtIy0A0XIN9x9aWb94ePl8= X-Google-Smtp-Source: AGHT+IGZdzo6PfO/YolAKKEnDj53HZfW2Z0PUTp4sefGD+K9Hrlj3OMHAw8JbSHy8BPMS8+pXPqrkQ== X-Received: by 2002:a05:600c:19cb:b0:425:6f96:8bcd with SMTP id 5b1f17b1804b1-42579fd0d25mr65418135e9.0.1719910315708; Tue, 02 Jul 2024 01:51:55 -0700 (PDT) Received: from alex-rivos.ba.rivosinc.com (amontpellier-656-1-456-62.w92-145.abo.wanadoo.fr. [92.145.124.62]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0e16b3sm12491191f8f.61.2024.07.02.01.51.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 01:51:55 -0700 (PDT) From: Alexandre Ghiti To: Conor Dooley , Rob Herring , Krzysztof Kozlowski , Paul Walmsley , Palmer Dabbelt , Albert Ou , Ved Shanbhogue , Matt Evans , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org Cc: Alexandre Ghiti Subject: [PATCH v3 1/4] riscv: Add ISA extension parsing for Svvptc Date: Tue, 2 Jul 2024 10:50:31 +0200 Message-Id: <20240702085034.48395-2-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240702085034.48395-1-alexghiti@rivosinc.com> References: <20240702085034.48395-1-alexghiti@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240702_015157_461089_FCB859FE X-CRM114-Status: GOOD ( 10.09 ) 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: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add support to parse the Svvptc string in the riscv,isa string. Signed-off-by: Alexandre Ghiti Reviewed-by: Conor Dooley --- arch/riscv/include/asm/hwcap.h | 1 + arch/riscv/kernel/cpufeature.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index e17d0078a651..6dd0dd8beb30 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -81,6 +81,7 @@ #define RISCV_ISA_EXT_ZTSO 72 #define RISCV_ISA_EXT_ZACAS 73 #define RISCV_ISA_EXT_XANDESPMU 74 +#define RISCV_ISA_EXT_SVVPTC 75 #define RISCV_ISA_EXT_XLINUXENVCFG 127 diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 5ef48cb20ee1..60780d246743 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -305,6 +305,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(svnapot, RISCV_ISA_EXT_SVNAPOT), __RISCV_ISA_EXT_DATA(svpbmt, RISCV_ISA_EXT_SVPBMT), __RISCV_ISA_EXT_DATA(xandespmu, RISCV_ISA_EXT_XANDESPMU), + __RISCV_ISA_EXT_DATA(svvptc, RISCV_ISA_EXT_SVVPTC), }; const size_t riscv_isa_ext_count = ARRAY_SIZE(riscv_isa_ext); From patchwork Tue Jul 2 08:50:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 13719132 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 10058C3064D for ; Tue, 2 Jul 2024 08:53:04 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=EGz095p4GyPw83QhOUBrgYdUay/E/rj9YScwUOu5O7E=; b=DS4ccD5iFBEc7c QJG1HU1PKRY2fYPGZ2JQNmYAbHdLx+GzhsDmajvFINqO6/jnpTAAWSel9ar0wU0kl7FPI5+MgXSED S9eb/zZJEmBWHdt06IlQbY4Dc45E2tKgqupoUboWkUyYoY6oJVcJePUz9wseykdrj25qShe93yQgn 00Dm+zL25/pAU9uTUt530OSMcdWSxmQ8CIItqctRUxF3DBcG7rtB1R2rCirjrr80dw6/RFuT2XmPo dwxQsRg743y4naL2/1Gfd5o+ce1j8mnkI6dx35DHNxbOuMkt6RGxvzLQ+R/uX59B8NEBXk/8wg5Dj f2lqzih9i0FK7MQ4hKkQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOZG1-000000062Vn-0S5o; Tue, 02 Jul 2024 08:53:01 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOZFy-000000062UI-2cMn for linux-riscv@lists.infradead.org; Tue, 02 Jul 2024 08:53:00 +0000 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-36743a79dceso2847158f8f.0 for ; Tue, 02 Jul 2024 01:52:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1719910377; x=1720515177; darn=lists.infradead.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=nBblSarVHgMFr1VSeSy1dk9YozNFS90bm9c7S+clMb8=; b=dugsokg8xB7rNAuPekuDrx7S5HeTDTQXgKvxbodXP89JyYDkx8b4K3zTk/ZIBC34rE GdertAjUYdXFyI1KoWLH/qpg50CoaCAndkDFRa3Gbz6+kAfMI5YASnncegxggQHK4fPJ EeikK204apQzwB70pN7ovQU6bXFTt3z+iIbD4glVGRy1HZB74ttdrjYozF9mK5BpOEUf 14e34agmSZOuS3qOOmGDlnjCyG5a6cZodrYROdqODWRrKPosfuChaGB2p/3m4/K/CDED cyPBP223uT7Qa72oKKrnUqrjTU0IwP7Uk9T/EOl5x37BjkqS/ZsxWkA2VlMqBdKmPDxJ khZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719910377; x=1720515177; h=content-transfer-encoding:mime-version: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=nBblSarVHgMFr1VSeSy1dk9YozNFS90bm9c7S+clMb8=; b=dvEBV6iapcQDAVKfdNEFw3F4OOephgyG2s9cNKEwdf7VdjFHIBi+N7HBSyg/fXxbwr 5IFAfFFIHjY/ZoQQG+iRKtfCOxEB/giLCpfZp81nn0tm5JadJkMrlXxm/CvI06VaJrmk 8rToJqsmPPnmJGl5r6aHt0LCyLW8BgwbDZ9ngNtgUuVsWhMBvSvxC7KA9PiyXz/NTlW4 fI90Ss0CExteZX7sePnICNph1s2Npd5JC5X1ZvIsDYCeVbW4/1nuf87dZ7mzTqSw7Dxg X6eKXKvPHHVSOUSWYkTFgGbZxXljD72xM/YqxnEzBnqtYQ2ZHL/ZXjl40H3YLi+16B3g AQuQ== X-Forwarded-Encrypted: i=1; AJvYcCUnIrEzeutBb0oostBlBrXcHKRHNYP16kvO25L+8NlW5vVjRgRkk2H/eLWQSIuCdb2lWv0Ua1+9m0FHrdscdk5+x3LUkZSDmvxw9Hvg2vSn X-Gm-Message-State: AOJu0Yycylqqc/IClILR5XHqptxX3dZA3lHTYuS2+3MKxNHwzSbP/eU5 VjvPGvVQO/YrWK11n9JXgFNX2L9F1jO0kQZzdnpxNkdAsQIAjYB4IPJdiLS2JEw5DQQRIDo2EYD 6 X-Google-Smtp-Source: AGHT+IFhEaBGka3Ti+hlZOEC6CfbyAu8S9sImqvjdSOCqz/0wRb9B50fIT/vKC7eV3aR2yOVb8VmLg== X-Received: by 2002:a05:6000:2a7:b0:361:94d9:1e9f with SMTP id ffacd0b85a97d-36760a62e0dmr10948760f8f.7.1719910376818; Tue, 02 Jul 2024 01:52:56 -0700 (PDT) Received: from alex-rivos.ba.rivosinc.com (amontpellier-656-1-456-62.w92-145.abo.wanadoo.fr. [92.145.124.62]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b09a828sm190852585e9.37.2024.07.02.01.52.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 01:52:56 -0700 (PDT) From: Alexandre Ghiti To: Conor Dooley , Rob Herring , Krzysztof Kozlowski , Paul Walmsley , Palmer Dabbelt , Albert Ou , Ved Shanbhogue , Matt Evans , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org Cc: Alexandre Ghiti Subject: [PATCH v3 2/4] dt-bindings: riscv: Add Svvptc ISA extension description Date: Tue, 2 Jul 2024 10:50:32 +0200 Message-Id: <20240702085034.48395-3-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240702085034.48395-1-alexghiti@rivosinc.com> References: <20240702085034.48395-1-alexghiti@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240702_015258_686612_EDD92351 X-CRM114-Status: UNSURE ( 8.42 ) 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: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add description for the Svvptc ISA extension which was ratified recently. Signed-off-by: Alexandre Ghiti Acked-by: Conor Dooley --- Documentation/devicetree/bindings/riscv/extensions.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml index 468c646247aa..b52375bea512 100644 --- a/Documentation/devicetree/bindings/riscv/extensions.yaml +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml @@ -171,6 +171,13 @@ properties: memory types as ratified in the 20191213 version of the privileged ISA specification. + - const: svvptc + description: + The standard Svvptc supervisor-level extension for + address-translation cache behaviour with respect to invalid entries + as ratified at commit 4a69197e5617 ("Update to ratified state") of + riscv-svvptc. + - const: zacas description: | The Zacas extension for Atomic Compare-and-Swap (CAS) instructions From patchwork Tue Jul 2 08:50:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 13719133 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 1480DC30658 for ; Tue, 2 Jul 2024 08:54:07 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=HjQhbxuhVO/DNQ1GKhJnvqw8/jw8Ep0nZAJXzoNWeaU=; b=TIF2TyWGR5IZcO HtvXLWwBsD6Q7NYBu6B6YlBiavXXJGSOm62xRZixHyPlGcm+sPK4rTpZSgd8o6lZoWu4fklhnJJWm XEDBtgBg10BrNC5qLT6n3kfLmBoDZvV1rCPpGf1SPVn2fIx7T0ObOOMb0n0Tiin7A5qEQ/tdmnQwy M8y3n7hRouMbP10YYrSL3HLV9PN4tXqQOYYbgTKAncRr3D9Azv6FSFKDJGTjtD7bZ4L2Rl3p2F9GZ ppWIyRw6aYB/Z9XYhumNHFY9t/dmmlTjFW3EVk2D8tpiiOwJDk+X/LXA8pTZYxs2MyOefIFCJBVjR nJQ0kUkSqmzrVMXtaphQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOZH1-000000062kA-3frM; Tue, 02 Jul 2024 08:54:03 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOZGy-000000062jS-01q8 for linux-riscv@lists.infradead.org; Tue, 02 Jul 2024 08:54:01 +0000 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-52cd717ec07so4953165e87.0 for ; Tue, 02 Jul 2024 01:53:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1719910438; x=1720515238; darn=lists.infradead.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=qWzpfXbjHTEv/qVD1sp5NKs48EnXRR4pt9tF+RZkbF0=; b=3d8jqFww/IuPxN13q1zCK6TH7bORRD/FWFFrPDIUI5UYdWxlU7ETJA1FRhxOlZruXK Nrrrm4eAWcFcEDh3q+rXV++qmf5xZi3GR4Rb+P91PBjouGtYx69FlGUEToivR8POm8Vx EcPKjWvWnS5OBbqHWazEtfhzcRW6K+CiAertB5ID3GhdTkpOgysMtqGJLxJL+yZtXhXi UWkKsLfAFw5m/DO/wf9XOycQ8gbFb6pugWLR1zZvjlxgUsAVQGNQWVnMRKpqC06YGiA2 3HxM6UMCvxXjL/RCClZa58apCgSx4nbS2LpSBu/cHfRPZBdxm6hSgvLkUo7H2cWWKInT 4SuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719910438; x=1720515238; h=content-transfer-encoding:mime-version: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=qWzpfXbjHTEv/qVD1sp5NKs48EnXRR4pt9tF+RZkbF0=; b=tXt+aF+RwpvgW8I6hmw15cG+Yc8H46hQqXPR9ZBlWODEfkBMipFznMlq/0lEOeyxh9 EszhCZZ/kSFLJTIec7yS+YYz5WT2XGVGsWg3gRxVJPW6doS9qoEwIggzPX53OIqxv6pP 77GQ50NvRsksMug8pHz9xddmHEJFQR9dF/x1eYxoQiuZ2L930w1wpImwLcvyh+c26sBu +b59YTcdbxZWUBspTF7jbvKZ7DLUqmQz1aUAT82JA7Fk4BfP5mplMc6IcG3vPIi7o0/p P0z0jbT879mYCYRbCHgpVaUvpJHRKF8PeXVRwtir13wkhq3fTcj5HUXlsnVwFsNnmKo1 dbGw== X-Forwarded-Encrypted: i=1; AJvYcCUYB2VUU5bdouIbFu1KwxjH1jouWyFOWF93RJQ5XAihlVHwZEdFVeWrVhNpZ0kiJEpiU2QAO580iRi/HNyOw5V6NmFGmEiYcsZIGGuW5KV4 X-Gm-Message-State: AOJu0YwME1opRldmICriYvzIW6Atmnb0Yrk1OV4fdaCckO0MsacD81sb 2bgFr7ahM69QjVsJxzcMbAZDg3Mbf/gV2j/71ZFvYeX92S7powvxv/DjzqeYEyM= X-Google-Smtp-Source: AGHT+IHoy9x/P0ESD1Ko6db8AW/GSdVra0tvpOtwPEzNBLiXt/55nzgCXAA/x4jgwswNzWcgNtid8A== X-Received: by 2002:a19:434e:0:b0:52c:fd43:d2f7 with SMTP id 2adb3069b0e04-52e82692e4bmr4322494e87.37.1719910437924; Tue, 02 Jul 2024 01:53:57 -0700 (PDT) Received: from alex-rivos.ba.rivosinc.com (amontpellier-656-1-456-62.w92-145.abo.wanadoo.fr. [92.145.124.62]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256b097b77sm185892835e9.33.2024.07.02.01.53.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 01:53:57 -0700 (PDT) From: Alexandre Ghiti To: Conor Dooley , Rob Herring , Krzysztof Kozlowski , Paul Walmsley , Palmer Dabbelt , Albert Ou , Ved Shanbhogue , Matt Evans , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org Cc: Alexandre Ghiti Subject: [PATCH v3 3/4] riscv: Stop emitting preventive sfence.vma for new vmalloc mappings Date: Tue, 2 Jul 2024 10:50:33 +0200 Message-Id: <20240702085034.48395-4-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240702085034.48395-1-alexghiti@rivosinc.com> References: <20240702085034.48395-1-alexghiti@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240702_015400_072808_4A55DF7D X-CRM114-Status: GOOD ( 24.27 ) 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: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org In 6.5, we removed the vmalloc fault path because that can't work (see [1] [2]). Then in order to make sure that new page table entries were seen by the page table walker, we had to preventively emit a sfence.vma on all harts [3] but this solution is very costly since it relies on IPI. And even there, we could end up in a loop of vmalloc faults if a vmalloc allocation is done in the IPI path (for example if it is traced, see [4]), which could result in a kernel stack overflow. Those preventive sfence.vma needed to be emitted because: - if the uarch caches invalid entries, the new mapping may not be observed by the page table walker and an invalidation may be needed. - if the uarch does not cache invalid entries, a reordered access could "miss" the new mapping and traps: in that case, we would actually only need to retry the access, no sfence.vma is required. So this patch removes those preventive sfence.vma and actually handles the possible (and unlikely) exceptions. And since the kernel stacks mappings lie in the vmalloc area, this handling must be done very early when the trap is taken, at the very beginning of handle_exception: this also rules out the vmalloc allocations in the fault path. Link: https://lore.kernel.org/linux-riscv/20230531093817.665799-1-bjorn@kernel.org/ [1] Link: https://lore.kernel.org/linux-riscv/20230801090927.2018653-1-dylan@andestech.com [2] Link: https://lore.kernel.org/linux-riscv/20230725132246.817726-1-alexghiti@rivosinc.com/ [3] Link: https://lore.kernel.org/lkml/20200508144043.13893-1-joro@8bytes.org/ [4] Signed-off-by: Alexandre Ghiti --- arch/riscv/include/asm/cacheflush.h | 18 +++++- arch/riscv/include/asm/thread_info.h | 5 ++ arch/riscv/kernel/asm-offsets.c | 5 ++ arch/riscv/kernel/entry.S | 84 ++++++++++++++++++++++++++++ arch/riscv/mm/init.c | 2 + 5 files changed, 113 insertions(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/cacheflush.h b/arch/riscv/include/asm/cacheflush.h index ce79c558a4c8..8de73f91bfa3 100644 --- a/arch/riscv/include/asm/cacheflush.h +++ b/arch/riscv/include/asm/cacheflush.h @@ -46,7 +46,23 @@ do { \ } while (0) #ifdef CONFIG_64BIT -#define flush_cache_vmap(start, end) flush_tlb_kernel_range(start, end) +extern u64 new_vmalloc[NR_CPUS / sizeof(u64) + 1]; +extern char _end[]; +#define flush_cache_vmap flush_cache_vmap +static inline void flush_cache_vmap(unsigned long start, unsigned long end) +{ + if (is_vmalloc_or_module_addr((void *)start)) { + int i; + + /* + * We don't care if concurrently a cpu resets this value since + * the only place this can happen is in handle_exception() where + * an sfence.vma is emitted. + */ + for (i = 0; i < ARRAY_SIZE(new_vmalloc); ++i) + new_vmalloc[i] = -1ULL; + } +} #define flush_cache_vmap_early(start, end) local_flush_tlb_kernel_range(start, end) #endif diff --git a/arch/riscv/include/asm/thread_info.h b/arch/riscv/include/asm/thread_info.h index 5d473343634b..32631acdcdd4 100644 --- a/arch/riscv/include/asm/thread_info.h +++ b/arch/riscv/include/asm/thread_info.h @@ -60,6 +60,11 @@ struct thread_info { void *scs_base; void *scs_sp; #endif + /* + * Used in handle_exception() to save a0, a1 and a2 before knowing if we + * can access the kernel stack. + */ + unsigned long a0, a1, a2; }; #ifdef CONFIG_SHADOW_CALL_STACK diff --git a/arch/riscv/kernel/asm-offsets.c b/arch/riscv/kernel/asm-offsets.c index b09ca5f944f7..29c0734f2972 100644 --- a/arch/riscv/kernel/asm-offsets.c +++ b/arch/riscv/kernel/asm-offsets.c @@ -36,6 +36,8 @@ void asm_offsets(void) OFFSET(TASK_THREAD_S9, task_struct, thread.s[9]); OFFSET(TASK_THREAD_S10, task_struct, thread.s[10]); OFFSET(TASK_THREAD_S11, task_struct, thread.s[11]); + + OFFSET(TASK_TI_CPU, task_struct, thread_info.cpu); OFFSET(TASK_TI_FLAGS, task_struct, thread_info.flags); OFFSET(TASK_TI_PREEMPT_COUNT, task_struct, thread_info.preempt_count); OFFSET(TASK_TI_KERNEL_SP, task_struct, thread_info.kernel_sp); @@ -43,6 +45,9 @@ void asm_offsets(void) #ifdef CONFIG_SHADOW_CALL_STACK OFFSET(TASK_TI_SCS_SP, task_struct, thread_info.scs_sp); #endif + OFFSET(TASK_TI_A0, task_struct, thread_info.a0); + OFFSET(TASK_TI_A1, task_struct, thread_info.a1); + OFFSET(TASK_TI_A2, task_struct, thread_info.a2); OFFSET(TASK_TI_CPU_NUM, task_struct, thread_info.cpu); OFFSET(TASK_THREAD_F0, task_struct, thread.fstate.f[0]); diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S index 68a24cf9481a..822311266a12 100644 --- a/arch/riscv/kernel/entry.S +++ b/arch/riscv/kernel/entry.S @@ -19,6 +19,78 @@ .section .irqentry.text, "ax" +.macro new_vmalloc_check + REG_S a0, TASK_TI_A0(tp) + REG_S a1, TASK_TI_A1(tp) + REG_S a2, TASK_TI_A2(tp) + + csrr a0, CSR_CAUSE + /* Exclude IRQs */ + blt a0, zero, _new_vmalloc_restore_context + /* Only check new_vmalloc if we are in page/protection fault */ + li a1, EXC_LOAD_PAGE_FAULT + beq a0, a1, _new_vmalloc_kernel_address + li a1, EXC_STORE_PAGE_FAULT + beq a0, a1, _new_vmalloc_kernel_address + li a1, EXC_INST_PAGE_FAULT + bne a0, a1, _new_vmalloc_restore_context + +_new_vmalloc_kernel_address: + /* Is it a kernel address? */ + csrr a0, CSR_TVAL + bge a0, zero, _new_vmalloc_restore_context + + /* Check if a new vmalloc mapping appeared that could explain the trap */ + + /* + * Computes: + * a0 = &new_vmalloc[BIT_WORD(cpu)] + * a1 = BIT_MASK(cpu) + */ + REG_L a2, TASK_TI_CPU(tp) + /* + * Compute the new_vmalloc element position: + * (cpu / 64) * 8 = (cpu >> 6) << 3 + */ + srli a1, a2, 6 + slli a1, a1, 3 + la a0, new_vmalloc + add a0, a0, a1 + /* + * Compute the bit position in the new_vmalloc element: + * bit_pos = cpu % 64 = cpu - (cpu / 64) * 64 = cpu - (cpu >> 6) << 6 + * = cpu - ((cpu >> 6) << 3) << 3 + */ + slli a1, a1, 3 + sub a1, a2, a1 + /* Compute the "get mask": 1 << bit_pos */ + li a2, 1 + sll a1, a2, a1 + + /* Check the value of new_vmalloc for this cpu */ + REG_L a2, 0(a0) + and a2, a2, a1 + beq a2, zero, _new_vmalloc_restore_context + + /* Atomically reset the current cpu bit in new_vmalloc */ + amoxor.w a0, a1, (a0) + + /* Only emit a sfence.vma if the uarch caches invalid entries */ + ALTERNATIVE("sfence.vma", "nop", 0, RISCV_ISA_EXT_SVVPTC, 1) + + REG_L a0, TASK_TI_A0(tp) + REG_L a1, TASK_TI_A1(tp) + REG_L a2, TASK_TI_A2(tp) + csrw CSR_SCRATCH, x0 + sret + +_new_vmalloc_restore_context: + REG_L a0, TASK_TI_A0(tp) + REG_L a1, TASK_TI_A1(tp) + REG_L a2, TASK_TI_A2(tp) +.endm + + SYM_CODE_START(handle_exception) /* * If coming from userspace, preserve the user thread pointer and load @@ -30,6 +102,18 @@ SYM_CODE_START(handle_exception) .Lrestore_kernel_tpsp: csrr tp, CSR_SCRATCH + + /* + * The RISC-V kernel does not eagerly emit a sfence.vma after each + * new vmalloc mapping, which may result in exceptions: + * - if the uarch caches invalid entries, the new mapping would not be + * observed by the page table walker and an invalidation is needed. + * - if the uarch does not cache invalid entries, a reordered access + * could "miss" the new mapping and traps: in that case, we only need + * to retry the access, no sfence.vma is required. + */ + new_vmalloc_check + REG_S sp, TASK_TI_KERNEL_SP(tp) #ifdef CONFIG_VMAP_STACK diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index e3405e4b99af..2367a156c33b 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -36,6 +36,8 @@ #include "../kernel/head.h" +u64 new_vmalloc[NR_CPUS / sizeof(u64) + 1]; + struct kernel_mapping kernel_map __ro_after_init; EXPORT_SYMBOL(kernel_map); #ifdef CONFIG_XIP_KERNEL From patchwork Tue Jul 2 08:50:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 13719134 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 52EA0C3064D for ; Tue, 2 Jul 2024 08:55:05 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=vYh0Fk2e0DnJo1ZW+ByNuGSm3rO1VD0jFiAt9w2Sfow=; b=gHqcYy7kzZZ6Xo qzIf0RikkRyzWZ/Phy5vSZ/KYTjZN1RW59CblPGvPCrVmvutv6wAwX76szZupqTvLtRGkGi90KZlK T2gBYvvl6DF+DbFD+l52WLc8BHp8OuKC7ocmrpRaYLCa1VxjK5WzO2adLQX1hDG/WE8sfqiTk6sdk A7Vyc6zXAEQ1o1jxBMmL0PbiOfBsf8Ot8BqSQ4o2cAwGIxSB+LtlPhYtmN8gAxOKo4xvYUSnb1LMD 5G+xhXlcbZLAIJYDYtfGH94vvls22XCUSWUuXgynorLFHhJB8sCe4AkcLc8ZMh2UeJef31avGadq3 Cl4fuP1bDByVQfcXlwLg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOZHy-000000062xq-47Rs; Tue, 02 Jul 2024 08:55:02 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOZHw-000000062wS-3cFC for linux-riscv@lists.infradead.org; Tue, 02 Jul 2024 08:55:02 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-42574064b16so24191845e9.2 for ; Tue, 02 Jul 2024 01:55:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1719910499; x=1720515299; darn=lists.infradead.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=YIThDSMu0YHhK3Il5EBAYEpaIGUwsTH7rJyBDsaK5V0=; b=KAVT4N83RCzgECkWbdq3NB8PmC+g2ZGg3SEn9XyND//atThgzxsvbA3G5UfmLMcuby KLP4pdwPE35VYbwK1IDB5jim+MR+4nMIr1TeOpKdMbdVe+/08K7BUWHKDSgyq5REsCc2 mhrVFaSYkipF6gm9oTKD8tWVHlZ3vZHJ/Q1UXM9V3fKomybq/gUJ4vzZkH6P4wGx8D2i LjAqjxOP9nVfLvUDIAMfuaY3ySm6p4AYxaxWQrTzg3rAUXi65zjoOGfQ08EflPOdCpw6 pua/SbiHi3tuTdjAwdrsdgcqVftC4gMnfa6RKzW9T7zQiB67dANx8X7B8SdOu9zRz40a pn2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719910499; x=1720515299; h=content-transfer-encoding:mime-version: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=YIThDSMu0YHhK3Il5EBAYEpaIGUwsTH7rJyBDsaK5V0=; b=obroLOVMuGHLf31VuliKiA4SI9Ix114759LV/VmSBOr2V1HHLEm60e66emGT4XdR7s vrOdaHm79aEriz5hu+cvjwYgfqooN4E36db48RRXW+ZxbVht91n96X7q10CHYwcP5a2z RUlNBcFym4epPI/HuyinQVRDNN5snJQbjLunHJqefJ8Dr+N9XzPOs+0UWXxY44a3aVVZ Ye7og1PBVxpKL/o7Tn+XBDMcmoPg49HQFIfIEn0936mAgB/igUYLgxKkic4lrytH4XX/ 7KSHyAgS2sgzuzKamOOnU9Id337Df4sIpEy4YTYQdXtxUdtw9IC6CSKVnb+9FbztYfrD qCYA== X-Forwarded-Encrypted: i=1; AJvYcCX+jf6wn9gCzOKSCMTkJ47o7aoaKsicEU7t2FUTvaVdqFGVB9FhnFQUSfKa+JLq8PajISXXAyxwNrO5QK2Lm1DSG55Xm6kRiSLAQafW7OwP X-Gm-Message-State: AOJu0Yz+QmZE2v8YdAD7+g+lCeSrpfX99uiL2giXlJtk6hxq2sP5d7+j WMQEU30tmIglk/jbxp04IPWTaeJg3SkQSPLBxgqAg83IGA1uwkHex24RmQpNRHE= X-Google-Smtp-Source: AGHT+IEDGO5lSYXzrNCtUPjdOzG/kBq6PyIV7c530qUlaMBb/cLWp/uOV4WEq8k/ROEiTkODEzbQXA== X-Received: by 2002:a05:600c:2147:b0:425:6b8a:7013 with SMTP id 5b1f17b1804b1-4257a074a93mr50887735e9.35.1719910499045; Tue, 02 Jul 2024 01:54:59 -0700 (PDT) Received: from alex-rivos.ba.rivosinc.com (amontpellier-656-1-456-62.w92-145.abo.wanadoo.fr. [92.145.124.62]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af552bbsm189623875e9.13.2024.07.02.01.54.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jul 2024 01:54:58 -0700 (PDT) From: Alexandre Ghiti To: Conor Dooley , Rob Herring , Krzysztof Kozlowski , Paul Walmsley , Palmer Dabbelt , Albert Ou , Ved Shanbhogue , Matt Evans , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org Cc: Alexandre Ghiti Subject: [PATCH v3 4/4] riscv: Stop emitting preventive sfence.vma for new userspace mappings with Svvptc Date: Tue, 2 Jul 2024 10:50:34 +0200 Message-Id: <20240702085034.48395-5-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240702085034.48395-1-alexghiti@rivosinc.com> References: <20240702085034.48395-1-alexghiti@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240702_015500_927884_75A04DD3 X-CRM114-Status: GOOD ( 15.65 ) 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: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The preventive sfence.vma were emitted because new mappings must be made visible to the page table walker but Svvptc guarantees that it will happen within a bounded timeframe, so no need to sfence.vma for the uarchs that implement this extension, we will then take gratuitous (but very unlikely) page faults, similarly to x86 and arm64. This allows to drastically reduce the number of sfence.vma emitted: * Ubuntu boot to login: Before: ~630k sfence.vma After: ~200k sfence.vma * ltp - mmapstress01 Before: ~45k After: ~6.3k * lmbench - lat_pagefault Before: ~665k After: 832 (!) * lmbench - lat_mmap Before: ~546k After: 718 (!) Signed-off-by: Alexandre Ghiti --- arch/riscv/include/asm/pgtable.h | 16 +++++++++++++++- arch/riscv/mm/pgtable.c | 13 +++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index aad8b8ca51f1..816147e25ca9 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -476,6 +476,9 @@ static inline void update_mmu_cache_range(struct vm_fault *vmf, struct vm_area_struct *vma, unsigned long address, pte_t *ptep, unsigned int nr) { + asm goto(ALTERNATIVE("nop", "j %l[svvptc]", 0, RISCV_ISA_EXT_SVVPTC, 1) + : : : : svvptc); + /* * The kernel assumes that TLBs don't cache invalid entries, but * in RISC-V, SFENCE.VMA specifies an ordering constraint, not a @@ -485,12 +488,23 @@ static inline void update_mmu_cache_range(struct vm_fault *vmf, */ while (nr--) local_flush_tlb_page(address + nr * PAGE_SIZE); + +svvptc: + /* + * Svvptc guarantees that the new valid pte will be visible within + * a bounded timeframe, so when the uarch does not cache invalid + * entries, we don't have to do anything. + */ } #define update_mmu_cache(vma, addr, ptep) \ update_mmu_cache_range(NULL, vma, addr, ptep, 1) #define __HAVE_ARCH_UPDATE_MMU_TLB -#define update_mmu_tlb update_mmu_cache +static inline void update_mmu_tlb(struct vm_area_struct *vma, + unsigned long address, pte_t *ptep) +{ + flush_tlb_range(vma, address, address + PAGE_SIZE); +} static inline void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long address, pmd_t *pmdp) diff --git a/arch/riscv/mm/pgtable.c b/arch/riscv/mm/pgtable.c index 533ec9055fa0..4ae67324f992 100644 --- a/arch/riscv/mm/pgtable.c +++ b/arch/riscv/mm/pgtable.c @@ -9,6 +9,9 @@ int ptep_set_access_flags(struct vm_area_struct *vma, unsigned long address, pte_t *ptep, pte_t entry, int dirty) { + asm goto(ALTERNATIVE("nop", "j %l[svvptc]", 0, RISCV_ISA_EXT_SVVPTC, 1) + : : : : svvptc); + if (!pte_same(ptep_get(ptep), entry)) __set_pte_at(vma->vm_mm, ptep, entry); /* @@ -16,6 +19,16 @@ int ptep_set_access_flags(struct vm_area_struct *vma, * the case that the PTE changed and the spurious fault case. */ return true; + +svvptc: + if (!pte_same(ptep_get(ptep), entry)) { + __set_pte_at(vma->vm_mm, ptep, entry); + /* Here only not svadu is impacted */ + flush_tlb_page(vma, address); + return true; + } + + return false; } int ptep_test_and_clear_young(struct vm_area_struct *vma,