From patchwork Mon Aug 9 15:24:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 12426811 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E25CFC4338F for ; Mon, 9 Aug 2021 15:30:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A76446101D for ; Mon, 9 Aug 2021 15:30:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A76446101D Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=IJDUrtuUs5yUS0UYiOGM5qcSIWiMZyL23HWmSZDiHJc=; b=zl0qZ458McmnuVPW2Se5zehsfA nBqOAUukmrlEqHSpwI2U2B9VX395wUWUYlBiAw9nPXJhhfeAdk10pqYZ77TZ41oWL0N2Wh+t/Ezoe 88wwNUPz3UWQ7wxkEIvLBSGF1MLUcsYZaSQvBofjy/BAOAVrdUJzou8nK9R/oZOZi2GGLlJNO0rqg dxPbNWXGLSDmovDocVBQ4OuL3TNSUGl5ZsF8QilROIrkuyHASq1Uppt/03lK//kczUbVC2vUrkSXq rUSGSfeBA90h2CEq53+T95vnw3MDlNV/7coOocgPEWKYQpBXRyAu8rgB5OGsFW907F4vR3ZJs1MRO Mv4RGRfA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mD7CH-0019NO-QG; Mon, 09 Aug 2021 15:28:14 +0000 Received: from mail-wm1-x34a.google.com ([2a00:1450:4864:20::34a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mD79L-0017ub-Uj for linux-arm-kernel@lists.infradead.org; Mon, 09 Aug 2021 15:25:13 +0000 Received: by mail-wm1-x34a.google.com with SMTP id k5-20020a7bc3050000b02901e081f69d80so4136580wmj.8 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=K1bLntCE8QPsVW+2zNQD/A/PpHwB+ptrm5cwr5BRIOgTDXvMXHn1nBX/ykXHe5iv1E s+MAXTkkweJHjbfkLH/hfxz6XsyWV87WpjOwUiuRfYITDtZZW6rPreZRVDSnmIXAjqMb IANVv41CJ9rFdl57U2lbAbuC94vAY4xuG9jfwSYMl7iBrM9dnIcVxPb/VQL2KgkBKkES 0S7AeU10FqC00um1zLwYQ5yhdk7XyG4OKNQ5oIH0T3azYN3DG8xuwVQPW4RL2HUJqmGW K1a7pmt9xmHmE1gG6Gg7UnwUuONhF0Clxsx5YlUjh3x1IysxyOx9ybyEDUFdF9WIp9WU CfVQ== X-Gm-Message-State: AOAM53383dULgcEmWJuk9CzxNqK8WXoeI7EII7L5DJ5KHOKXXq0k6MON QqPpfvVMZm38T21nbgPBJ/7Y1Mgchc7Y X-Google-Smtp-Source: ABdhPJz9dh/8xSQuBObFyZiVhTM2lFEjdAUdZfHfPEw63Mx6TEFaOYVnO3fFNdHkbUVeYnSFomkPJvPUytlF 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210809_082512_025767_8D021026 X-CRM114-Status: GOOD ( 14.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 {