Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp682165pxb; Tue, 5 Apr 2022 18:35:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZ57Wlm98HxnoyiIXRNJ6896QoJT1x3RdVV0lrgkysRv5zwU+Nh3flwIlE3ZdPnRTc09tt X-Received: by 2002:a17:903:249:b0:153:857c:a1fe with SMTP id j9-20020a170903024900b00153857ca1femr6358238plh.44.1649208853211; Tue, 05 Apr 2022 18:34:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649208853; cv=none; d=google.com; s=arc-20160816; b=M9W2izos9m28QeTLBo9Doe1xMY5XmlguiMCZg5V6r06/HYLx+X5hU0vgxD9B2QtU0L 5ckyGSHbJ7eyr0BGDF6KQVZWyZi4E/+z1gezFt8NZ+yN1aJw8ACJOSHr6Gzsy9q7dLtZ 1CYBsxCt8XIGa7Hz+kQLW580LW1ayPy+W0KNmRsNePf+aYYHYXNJ0i4/wOb0Iz/Gj9vx JYHg1CeYOsPBJTzLOlDNJCnPmfhcs5oyda2CewdjmsF7H+jLBolmmc8u3tiBN/eqrsAC geiAdM4APONy7wKkizOkXvmLeBFXZALIdfXfPSI8WzrDX/Hrg/6/S0d4jIdWl230W5Qg LjGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=j5tZD+8M1iPFQIpWPsYamWZAVUcin+PVrYzA4YmgT9M=; b=AcVByh3d0yccKAeGkNxtrM/M5dYP8IHO8nczrcVB7VDwRLogDUzms3rICT97kKBzvp U8EWOBCUXP8DkzOcgqi/Af7kVtufE0IswP0iVWKarlzAItGj66Vm+j6sRhTPotmLO2h/ 7Xxm7JfVg37N4GNl1sRiQru4V7L6ACjl2JTVF52a692kAnREarZW/Nrha9To61lOuLF1 BYkniYD0x8Yx7WaO8YfUS5jl8zJAI7vRphKtbUgiAfevBeMV5ztsB3YM4D5uKPtvrtgO EcdgJWuhxPHvpXdD0py26KroqDDl12ecYBpkGzE7p3Qdvt3AuezRGB12pgCvivoyjPP4 6QyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b=fwxyiskv; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b123-20020a633481000000b0038251581ab5si14981377pga.291.2022.04.05.18.33.58; Tue, 05 Apr 2022 18:34:13 -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=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b=fwxyiskv; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231807AbiDEHWq (ORCPT + 99 others); Tue, 5 Apr 2022 03:22:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232117AbiDEHVb (ORCPT ); Tue, 5 Apr 2022 03:21:31 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F77F64F7 for ; Tue, 5 Apr 2022 00:18:18 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id k124-20020a1ca182000000b0038c9cf6e2a6so1035569wme.0 for ; Tue, 05 Apr 2022 00:18:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=j5tZD+8M1iPFQIpWPsYamWZAVUcin+PVrYzA4YmgT9M=; b=fwxyiskvlIWhb4yoz+2d8DfK/fDF9kpIsj1v16e5zIvUjuTsRqhCJOFl05KNjnR1dw oonmm9pVay2hFWOiOFAbJ7dn7AHRarZUB51K/rDMrO52UGnRsj0lSzd2lgRxtb+OxIRl IgpXfxAnPI2wpb+5qJeC0MuWD3RZGoIQEZ+ogFkEYpSYTVQw4ABKMBca0ZXnLKFMvEQz QdhofkXfbLPxcHl4i2KJqdCwUeO5sC1D7G1h/tn68KmMvPa0ZOVhXIkAy7QphAYkTazb USrRPCFfrjAaMOaC2mAVwXLODZM++PjK43MI+M9Q3aTBfmuFw1YJzwLkykwbNCFn9o1+ X6WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=j5tZD+8M1iPFQIpWPsYamWZAVUcin+PVrYzA4YmgT9M=; b=0sqhfuK+Pa+FAWRyG22piCTUPPJSbGb5E2AQBDSHFRzeUwLilN45lAgyvhvcOFOG0t onZdAmxiKJpzFXNlaObKdMmUb0PkTOiqyGuTPWAPVvfPN/3lxK1ykgZeBsRNNUuT/ofp 65xlmt68yKaPfPzVWnYaRHAYw6HmytAw1yFjDsVhldZRwn+Lv0h21R/lsl60gb8SB4Jr FoSWfeud6EIwX8u4bNZKU7ZumPbUELCqPRsR5WYJF580VvTOWVIKGGq/D8VvYMc0WMRI bzLk7L+8y6TJ7/NZcJ8RriPDFkWsY3aOhkcur1tE+mZE6RbBbvNy3fncdb3j8+9MnEIu gdZQ== X-Gm-Message-State: AOAM530yF2Y5V/VUzRM/gO2iq6tab+GlTIIsC1jzdK/5V4ysoBF+xiq/ JsiCBfnV3jYEA9MqPfNxvMLHCv5gOs4939I12wFsiw== X-Received: by 2002:a05:600c:3c9b:b0:38e:4c59:68b9 with SMTP id bg27-20020a05600c3c9b00b0038e4c5968b9mr1754749wmb.105.1649143096491; Tue, 05 Apr 2022 00:18:16 -0700 (PDT) MIME-Version: 1.0 References: <20220329072911.1692766-1-apatel@ventanamicro.com> <20220329072911.1692766-2-apatel@ventanamicro.com> In-Reply-To: <20220329072911.1692766-2-apatel@ventanamicro.com> From: Anup Patel Date: Tue, 5 Apr 2022 12:48:03 +0530 Message-ID: Subject: Re: [PATCH 1/3] KVM: selftests: riscv: Set PTE A and D bits in VS-stage page table To: Anup Patel Cc: Paolo Bonzini , Atish Patra , Palmer Dabbelt , Paul Walmsley , Albert Ou , Alistair Francis , KVM General , "open list:KERNEL VIRTUAL MACHINE FOR RISC-V (KVM/riscv)" , linux-riscv , "linux-kernel@vger.kernel.org List" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, 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 On Tue, Mar 29, 2022 at 12:59 PM Anup Patel wrote: > > 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 I have queued this patch for RC fixes. Thanks, Anup > --- > 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.25.1 >