Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3229659pxb; Mon, 18 Apr 2022 19:56:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcGYzefDqYjbPxXylUM/XeSIhOE3TDEFCNZf+aMAtgEU8xhs0bLviSQjdEk7innygS52wD X-Received: by 2002:a17:906:7314:b0:6df:839f:af7 with SMTP id di20-20020a170906731400b006df839f0af7mr11326443ejc.65.1650337018975; Mon, 18 Apr 2022 19:56:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650337018; cv=none; d=google.com; s=arc-20160816; b=VNgJX5G5/E2VWvqNlKnFXx8zonDHvFYIBm7SrF+TOkvPhHtjpqoVZSHxgXCOPk1SaR poTw7Xv7fhPRNPziGXg2XdXWkT34NvattjBQeMJcmPZt5DkqW5ssXm+x8GHoSyXxB3rS 81MQxEDCWdksc0+R4fB2o22p4DPdTTGAggBlMEIcMLRCvEqTLVUEmsxNmBEI36f7L43V o+MNU8r/8/56KIJTozWL+IWI02iqnO6SGBMJwP8iomdGR/XIuhayDcy6K/I6ugA2Yh9D SWR6FZ74J+LbvnvVA1KEZQexw0csO9hBtN0ULKV/5PpWOA8MVLrcIHNi81vrmO8eyPKR 3DVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7gR7iqRUZ8LPKHtx6hSKHwdfFoOF0uhokBVpc4IKtH4=; b=XFq0HIK0eaNNi68vWfKvXd66eRYDoS1EJHdmp5OoGFHgJ5diIfnkLkvKx+dVQuxkQD El3I9lLTC5D5vo8sBvaVRo1knSWTL0yNK33tLoypN7wSJFiy1Wp0QNhA7CPaXW+0FHNE Feb5dloEN/yMl60Vbyb4wzEQWvTzLvsskITXYT4iYc4/s9OR16f7EtvyQcaQmwmOj5oF nCN7bVnzPHx+X2CkliNmkRa3E+qRxwFDynBJd4Q0zuPjQ9YK45vu302/4LhUubVR9Qyn AWZJvKtZ1nZLaJQhO0fAmn3gpYoi8aPbWtUCDh2hpqAsCo8PpX/j7veu0USywytg4RTl iOLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ui5J+W08; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u21-20020aa7d555000000b0041d7932031bsi6460238edr.59.2022.04.18.19.56.35; Mon, 18 Apr 2022 19:56:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ui5J+W08; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238626AbiDRMZr (ORCPT + 99 others); Mon, 18 Apr 2022 08:25:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238389AbiDRMY0 (ORCPT ); Mon, 18 Apr 2022 08:24:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 857A81FCC7; Mon, 18 Apr 2022 05:19:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 009CF60F01; Mon, 18 Apr 2022 12:19:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 148EBC385A1; Mon, 18 Apr 2022 12:19:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650284345; bh=B0VnKu5hWY8Nkmb9H9cq2QHkp/C1sAFGmLN4yP3jlG0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ui5J+W08h5H+x6vBj3N1ML549K7BJSIVosPUfsKHCkBCLDZptizZmFf7ogz4zh6yU 5obLlUZ8gnaio/r3C6Uvac/H4SSq0LClk0wt41YSn5dyL5I5BNPGpFEy0muoXSuEiv 2q4om+kzWjWvWJ/kQSN6v8gKHg4Q9h2HkAoXODAM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anup Patel , Mayuresh Chitale , Anup Patel , Sasha Levin Subject: [PATCH 5.17 081/219] KVM: selftests: riscv: Set PTE A and D bits in VS-stage page table Date: Mon, 18 Apr 2022 14:10:50 +0200 Message-Id: <20220418121208.514660383@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121203.462784814@linuxfoundation.org> References: <20220418121203.462784814@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anup Patel [ Upstream commit fac3725364397f9a40a101f089b86ea655a58d06 ] Supporting hardware updates of PTE A and D bits is optional for any RISC-V implementation so current software strategy is to always set these bits in both G-stage (hypervisor) and VS-stage (guest kernel). If PTE A and D bits are not set by software (hypervisor or guest) then RISC-V implementations not supporting hardware updates of these bits will cause traps even for perfectly valid PTEs. Based on above explanation, the VS-stage page table created by various KVM selftest applications is not correct because PTE A and D bits are not set. This patch fixes VS-stage page table programming of PTE A and D bits for KVM selftests. Fixes: 3e06cdf10520 ("KVM: selftests: Add initial support for RISC-V 64-bit") Signed-off-by: Anup Patel Tested-by: Mayuresh Chitale Signed-off-by: Anup Patel Signed-off-by: Sasha Levin --- tools/testing/selftests/kvm/include/riscv/processor.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/include/riscv/processor.h b/tools/testing/selftests/kvm/include/riscv/processor.h index dc284c6bdbc3..eca5c622efd2 100644 --- a/tools/testing/selftests/kvm/include/riscv/processor.h +++ b/tools/testing/selftests/kvm/include/riscv/processor.h @@ -101,7 +101,9 @@ static inline void set_reg(struct kvm_vm *vm, uint32_t vcpuid, uint64_t id, #define PGTBL_PTE_WRITE_SHIFT 2 #define PGTBL_PTE_READ_MASK 0x0000000000000002ULL #define PGTBL_PTE_READ_SHIFT 1 -#define PGTBL_PTE_PERM_MASK (PGTBL_PTE_EXECUTE_MASK | \ +#define PGTBL_PTE_PERM_MASK (PGTBL_PTE_ACCESSED_MASK | \ + PGTBL_PTE_DIRTY_MASK | \ + PGTBL_PTE_EXECUTE_MASK | \ PGTBL_PTE_WRITE_MASK | \ PGTBL_PTE_READ_MASK) #define PGTBL_PTE_VALID_MASK 0x0000000000000001ULL -- 2.35.1