Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp239067pxj; Thu, 3 Jun 2021 05:38:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvYmyp5dYqsJsRERek3UDXo88LfdXAo4Pr6gQhSSyRWw2XP3mcqD5/WkJvrTcmttOsRZfA X-Received: by 2002:a17:906:25db:: with SMTP id n27mr1282924ejb.170.1622723886252; Thu, 03 Jun 2021 05:38:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622723886; cv=none; d=google.com; s=arc-20160816; b=mc+zXkM+FvFrs0nUMcehfo0ZpQX3ZjXGE7UldMHTOCiCS4Rifp1S0F/06xkgkTtWU9 A8hpWZBLfsbnGE08WcdP5YjulF31UHkvTyfRRH0n1tFxqnbUQhw75l5ds+vs6pKAGiUc mrMBcfuA4IgtQjDCdALmslBHCC9I15BAf8rO5TgiOVSNDk08RyPqmQ8PxOT2g933CdBh qqqKl4UnNWsISWpCG78VPBkhF8q6BktTHUDDZ7T7SIbvlIHbWcHiMr8tmmX6Ozna0NYa hwdlE+a7YNXf6T5O+iPgvGmLD584lfmVG5u3G5vZCNAhUrj9TocmbfUUG1e20K+ivlvC UYpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=LNV3unuIgHoCiJVgXy13y119JnWbXFOmfGYM0wvZ0OQ=; b=Wobjt6lm09I0XLMrwKDkKD3Vd0ock1zOmv00QWIT409/eEP4UXcJUAnCcVwSNoL9mH qHH0emT669qHjGDJQSvwvF2AVLOYAzjLAQhx1zrhznnQ8Nv0b0w5bUzB1GglbkTEINIK JAPk0IAuiQiGczUqoJR4EoK4i/AXrXU4eZxJE923Hm+llo93qLWGxfr4NYuIiuxDu10r vP9Mvy4YJIcSudUVvJlmsxx6aKd7UcphUabk0yBpvXZRW6/FKGFZHmovUudIkcs6mDsL bn3KbuyY7QMprHUVfD+nJ53UiBmpNzYcyfMw33gXohE+qQlfcIihZ+iVG3jtDI+O+BO2 3FaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n17si2166732ejl.429.2021.06.03.05.37.43; Thu, 03 Jun 2021 05:38:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230175AbhFCMhx (ORCPT + 99 others); Thu, 3 Jun 2021 08:37:53 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:7093 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229966AbhFCMhw (ORCPT ); Thu, 3 Jun 2021 08:37:52 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Fwlg32jSmzYqSD; Thu, 3 Jun 2021 20:33:19 +0800 (CST) Received: from dggpemm500023.china.huawei.com (7.185.36.83) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 3 Jun 2021 20:36:04 +0800 Received: from [10.174.187.128] (10.174.187.128) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Thu, 3 Jun 2021 20:36:02 +0800 Subject: Re: [PATCH v5 1/6] KVM: arm64: Introduce KVM_PGTABLE_S2_GUEST stage-2 flag To: Quentin Perret CC: Marc Zyngier , Will Deacon , "Alexandru Elisei" , , , , , Catalin Marinas , James Morse , Julien Thierry , Suzuki K Poulose , Gavin Shan , , , References: <20210415115032.35760-1-wangyanan55@huawei.com> <20210415115032.35760-2-wangyanan55@huawei.com> From: "wangyanan (Y)" Message-ID: <2d5ed3b0-5e8f-572e-cee9-84d6c9d2410c@huawei.com> Date: Thu, 3 Jun 2021 20:36:02 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.174.187.128] X-ClientProxiedBy: dggeme712-chm.china.huawei.com (10.1.199.108) To dggpemm500023.china.huawei.com (7.185.36.83) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Quentin, On 2021/6/2 18:43, Quentin Perret wrote: > Hi Yanan, > > On Thursday 15 Apr 2021 at 19:50:27 (+0800), Yanan Wang wrote: >> diff --git a/arch/arm64/include/asm/kvm_pgtable.h b/arch/arm64/include/asm/kvm_pgtable.h >> index c3674c47d48c..a43cbe697b37 100644 >> --- a/arch/arm64/include/asm/kvm_pgtable.h >> +++ b/arch/arm64/include/asm/kvm_pgtable.h >> @@ -61,10 +61,12 @@ struct kvm_pgtable_mm_ops { >> * @KVM_PGTABLE_S2_NOFWB: Don't enforce Normal-WB even if the CPUs have >> * ARM64_HAS_STAGE2_FWB. >> * @KVM_PGTABLE_S2_IDMAP: Only use identity mappings. >> + * @KVM_PGTABLE_S2_GUEST: Whether the page-tables are guest stage-2. >> */ >> enum kvm_pgtable_stage2_flags { >> KVM_PGTABLE_S2_NOFWB = BIT(0), >> KVM_PGTABLE_S2_IDMAP = BIT(1), >> + KVM_PGTABLE_S2_GUEST = BIT(2), > Assuming that we need this flag (maybe not given Marc's suggestion on > another patch), I'd recommend re-naming it to explain _what_ it does, > rather than _who_ is using it. I agree with this. > That's the principle we followed for e.g. KVM_PGTABLE_S2_IDMAP, so we > should be consistent here as well. But I think maybe we don't need the new flag anymore with Marc's suggestion. Currently the CMOs right before installation or update of a PTE are guest-specific. So if we also take the new optional callbacks as guest specific, then a new flag is not necessary because we can check whether the callbacks have been initialized to determine if we are managing a guest S2 PTE. Thanks, Yanan > Thanks, > Quentin > .