Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6098415pxv; Thu, 29 Jul 2021 06:30:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxD5SM/fSdp00fzb2FG04+q9qd8EsgN7F8t8eBykKxBAdDv/eEyMpeQLO4Fqbh3+TDJxZF X-Received: by 2002:a5d:88c4:: with SMTP id i4mr4294526iol.210.1627565422792; Thu, 29 Jul 2021 06:30:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627565422; cv=none; d=google.com; s=arc-20160816; b=RTiynKPmtoiduMlg/3EXcY4SKS9+ZrBFM5/l+pJSgnmflVzOqHttRw9F/vrjTzSyOS BuUNw48aKaO7ThEl8q5/gfJlZvTr90ihOQa4zU79aapghFvwHqGZqzGGSGzo03R5/LGM Zw7Fpzolz8qsNE93fXOlY69Kk93mvH9/xRtYjfT3XTNmUicbhHuJpsOzWvNekt/nXBEq UWnEPdEauWEZ7K1MMb+PWU5kpDyOj3oAseBB3/nrKWh0iTj3+Q/4lqUKODD+ya9xzJFn gkzQ8G5o/YpmU38uMHdpQck+Q9f9e1rptYKmVBTbp+/2wrK7R92W1EuoVmoxgyB3g8tH VvLw== 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=sBorrifANrV+vpyuatLE9LgyQ9DNiLt3tvLMqd3Pt6A=; b=Lt1zHxAnHf+eRz73S1oZ/x8AlEaAI0bOrwbRNcsz3d8YZu7AiNdiHpfXCaQmpunKnk YCi6PKOcPSKW8J5l1LGZfSdHIF3ghly8P6yGk/mpDXxtP392MtIF0mFPPH/ncgwgiCPw cXs9jVlurckXCfKzW9TIHVuNa4fPE4Ag6b70HPyx12hr6Vo0ia0nZ8uxKhFlfY+VaFcf 0EOKSiiPzUp5GopU7tmO+tVH1nr5jihntviOYhyCuMMdT/0SdPDQS0SDuve2sSVV8s8l dDGZCpLTIpdBRkff+yunjibmxZGz3TDX6bvtsXIujYrKjmPLNvdbVAVtVL++ERUGFq8A ryzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Ut7XM1RB; 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 r23si3520827iot.18.2021.07.29.06.30.10; Thu, 29 Jul 2021 06:30:22 -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=Ut7XM1RB; 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 S237686AbhG2N2z (ORCPT + 99 others); Thu, 29 Jul 2021 09:28:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237640AbhG2N2r (ORCPT ); Thu, 29 Jul 2021 09:28:47 -0400 Received: from mail-wm1-x349.google.com (mail-wm1-x349.google.com [IPv6:2a00:1450:4864:20::349]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDA88C0613C1 for ; Thu, 29 Jul 2021 06:28:42 -0700 (PDT) Received: by mail-wm1-x349.google.com with SMTP id q188-20020a1ca7c50000b0290241f054d92aso818795wme.5 for ; Thu, 29 Jul 2021 06:28:42 -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=sBorrifANrV+vpyuatLE9LgyQ9DNiLt3tvLMqd3Pt6A=; b=Ut7XM1RBkTI6hICybPUi8KmJxYV9LDmJ+BO6n904mN06Lz6fMB/V/BtKm6hhsuLfZP ivNztgGio4ESMLW5q3gVJgBLVveqCae0u3Cf+OKFjx6mnhwTYrhUTBdFbeTTJYOH2Oro egeF+yk4HTHuh6YDWWxQ/DlmPg6CLxqWIwkzudNjJzvZNRClSc0OkY+jbq0xqXUU/AJb ej+MxueBK07NIyaNgEDhpAQ0F2nwLtPwY0F0IGWM8mD7iwJf9+lNClSNk/EMPe/lAOyx FXnhesCTlFKoKTNCnkpafZ7MinyOF/hCThP8HikLHozvU5iFs+Dhw8yEZKqnOzO+cPPS ViCQ== 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=sBorrifANrV+vpyuatLE9LgyQ9DNiLt3tvLMqd3Pt6A=; b=VF9cR2vX5XSPlq+/OkRUjVyiCpQFh9tbxmletmgOz2TC7RCzKEJ/FKDPAXdtLf4Tjj aaoxwXpqTj1cS6GkeS3frp7xYFIqePD4DkEAj0vYCbrwUMokSbgeQI1AGH49cphsOpQc NMvmScg/tN1EAuQnjA4l4cOuJ80WDTT8Ttlj3QoHgoEShADSUtdcQMqEnz773t9lXQJU 7PuDhZqlFbyjcFMFjBbNc3+xdG4v+LUTShsZWfJLebuyPzwYxh8WqVK7korW/Ny+Tw7j 7aS0InIsVub4/AzHaN4Q6zPS3ViYlgjwf1/eg8Jh2By/6i9hLYnGBjnYWFj/Aa4t5QLS EQ7A== X-Gm-Message-State: AOAM531lJFkYU74WQ6o/FJA39qYcIUjxgHjDMz02t1JpnVNbO5zaC7wI ozZT04tnmrHMmMrIShQdP17E4YdK7TY5 X-Received: from luke.lon.corp.google.com ([2a00:79e0:d:210:293a:bc89:7514:5218]) (user=qperret job=sendgmr) by 2002:a1c:980e:: with SMTP id a14mr4764799wme.123.1627565321434; Thu, 29 Jul 2021 06:28:41 -0700 (PDT) Date: Thu, 29 Jul 2021 14:28:05 +0100 In-Reply-To: <20210729132818.4091769-1-qperret@google.com> Message-Id: <20210729132818.4091769-9-qperret@google.com> Mime-Version: 1.0 References: <20210729132818.4091769-1-qperret@google.com> X-Mailer: git-send-email 2.32.0.432.gabb21c7263-goog Subject: [PATCH v3 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, Quentin Perret 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. 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.432.gabb21c7263-goog