Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp2767220pxt; Mon, 9 Aug 2021 08:27:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKjPnpPapPg5Qi4FWoIHdsmDqMl3D9sdLvUgZ5WJJCDts0l24xXHtOr2yyBdVkoVG4GrGL X-Received: by 2002:aa7:d593:: with SMTP id r19mr30193422edq.372.1628522847048; Mon, 09 Aug 2021 08:27:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628522847; cv=none; d=google.com; s=arc-20160816; b=RbDyyGEhSqNZegTGE5Ed1VEt0zO7UBigiAqEb0natb2tNya+2bneV98Qml/VwKBU0a DmxeaBBJuPtWPVl8K1/dGlwwDmmSmIzO4UTF9xsVZOK96wxaxKCiaEqZTQrwt1u1YlPx 7Bwd2qPegOq3coG1Xa8TyMQJd8+B8Lfw/01GXe0pZ1+rhofwLA3c22cZqeiPKkKs8iT1 EZW1twQS4OL0zGSlBz6/mc65n9TI1Clg3nz7azH8kjJsiYLXjo5F3sxf+4TMo+aWop+8 J1OTBApj5IYbQ6jsdd4JG9yjQ9CjoqFg2dbOj4Zb2MCwdTxFuWIPti9k8VoHVry6+vHC FLWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=Io0EDWR3PIis5nkH0gOz1mjrCvg673G9g4IXwa5GIus=; b=aD+j7TNvuDJ1Qt2PoFeXjErOkmRKGQrtRHSj0I3D0MwoqxWb2XnDyJnRhfL/HRH9sM 7dH77zRsuBz3DzvSUvdlPk2L4h/913gzcioiJDsbwuwY0mCMzKsiiYV8nQUVFxvk01u0 7O+4FWGONwpryfzQlx7m9g/6kPAFYJvS8QxDo0V/Hs3cIjVfZ9MPTc+B2f/8bfAPzAVi Ut2rEL69uYxirW36wc7RnPuOuDP9fLNaHN/nPbn6WGb1xRXGqJZFx/bZWpHJh0E1l5ct 7tjCY12hrrN6ZT94pXCYd/P80lgzvMvRtt2ZvvxgRhwBli8k7jyBVsd4+Bo9FgZ8zrkf 4RIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=jfaqF6Wq; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dg3si17354885edb.205.2021.08.09.08.27.03; Mon, 09 Aug 2021 08:27:27 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=jfaqF6Wq; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235563AbhHIPZi (ORCPT + 99 others); Mon, 9 Aug 2021 11:25:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235612AbhHIPZb (ORCPT ); Mon, 9 Aug 2021 11:25:31 -0400 Received: from mail-wr1-x44a.google.com (mail-wr1-x44a.google.com [IPv6:2a00:1450:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7E6CC06179B for ; Mon, 9 Aug 2021 08:25:10 -0700 (PDT) Received: by mail-wr1-x44a.google.com with SMTP id v18-20020adfe2920000b029013bbfb19640so5452262wri.17 for ; Mon, 09 Aug 2021 08:25:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=Io0EDWR3PIis5nkH0gOz1mjrCvg673G9g4IXwa5GIus=; b=jfaqF6Wq0Q9e4kkR+jmQAYTa2BnTkBr9q1lmRTdsQdJw/Lh0h/noCoRqRFHW979Vpn FDKKbqzoWj8dqTthh4xSOmxkqcsPWcuNm+/ndBqE4q2EeOVzZY5mqOV525AiuZvLD4vO sS+vwhpt6tu/ukL509vBuZlbxwKpNeB2AAN77VyY2yLrcUYdbxSOO5/Yxf4wwTvU8W1N AmTljU+kIMZA+bYoLJRjetYMG/tcu4In0+GCs4r0zidT6ZPDR4xX/vsgr9gTLMWH1g8h xAk0qlE1XeZybchFEHU0YlCCJpuW++Vrxa1Y0KQ43VfgFVirxcu6/bwjge3Al4LJOlkE Jf3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=Io0EDWR3PIis5nkH0gOz1mjrCvg673G9g4IXwa5GIus=; b=AHYFclIA2h/9DKLrH0SBONEqgOpXdh6DhY4mWc//5a1xdqt/wVohc43L+WSbEeoaNh tqM7+8WaNDF4ldl0iVxOcZBJ64Ek6fL18qaST2Rm+h2P1Zb38sSpzh2RdX4QEDv0fwl4 qz1uDPkoa/+D71GQB09ROEraSycDggfJ4z5LXbIJP17ZVSckp6I97ly2Jc6C1yWZGRpt p98Nwx2RLawCrhdRfvLtRMI8HLCqH7AOA91ZuDJAhonZlhCz4suSZ6dB6kq20Mx3oVXT OwbZxiwNrZblI8Y4Cab/yJngOVxKJGlNGswlPvcc6WX9iqMM0MWcRi3GtH5dCfbzalHh PnWg== X-Gm-Message-State: AOAM532ZenXeTUB8TtYcKVUrSdrQQSjVXf7CyTC7O7X13t5cxwM6pYP1 OChJWfAmuu0qvd/GF5lFBPueADt2jDUU X-Received: from luke.lon.corp.google.com ([2a00:79e0:d:210:b0e8:d460:758b:a0ae]) (user=qperret job=sendgmr) by 2002:a05:600c:410b:: with SMTP id j11mr34327897wmi.27.1628522709110; Mon, 09 Aug 2021 08:25:09 -0700 (PDT) Date: Mon, 9 Aug 2021 16:24:35 +0100 In-Reply-To: <20210809152448.1810400-1-qperret@google.com> Message-Id: <20210809152448.1810400-9-qperret@google.com> Mime-Version: 1.0 References: <20210809152448.1810400-1-qperret@google.com> X-Mailer: git-send-email 2.32.0.605.g8dce9f2422-goog Subject: [PATCH v4 08/21] KVM: arm64: Don't overwrite software bits with owner id From: Quentin Perret To: maz@kernel.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, ardb@kernel.org, qwandor@google.com, tabba@google.com, dbrazdil@google.com, kernel-team@android.com, qperret@google.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We will soon start annotating page-tables with new flags to track shared pages and such, and we will do so in valid mappings using software bits in the PTEs, as provided by the architecture. However, it is possible that we will need to use those flags to annotate invalid mappings as well in the future, similar to what we do to track page ownership in the host stage-2. In order to facilitate the annotation of invalid mappings with such flags, it would be preferable to re-use the same bits as for valid mappings (bits [58-55]), but these are currently used for ownership encoding. Since we have plenty of bits left to use in invalid mappings, move the ownership bits further down the PTE to avoid the conflict. Reviewed-by: Fuad Tabba Signed-off-by: Quentin Perret --- arch/arm64/kvm/hyp/pgtable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c index 59a394d82de3..1ee1168ac32d 100644 --- a/arch/arm64/kvm/hyp/pgtable.c +++ b/arch/arm64/kvm/hyp/pgtable.c @@ -46,7 +46,7 @@ KVM_PTE_LEAF_ATTR_LO_S2_S2AP_W | \ KVM_PTE_LEAF_ATTR_HI_S2_XN) -#define KVM_INVALID_PTE_OWNER_MASK GENMASK(63, 56) +#define KVM_INVALID_PTE_OWNER_MASK GENMASK(9, 2) #define KVM_MAX_OWNER_ID 1 struct kvm_pgtable_walk_data { -- 2.32.0.605.g8dce9f2422-goog