Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1291231rwb; Tue, 29 Nov 2022 11:25:09 -0800 (PST) X-Google-Smtp-Source: AA0mqf4/njVLNIUI2x5FffYhFla981MInIrafSPyQEjtvU8+nepfGgbQZ5IQdgzU+OaAyyd1WqT/ X-Received: by 2002:a17:907:d412:b0:7bc:68cc:7913 with SMTP id vi18-20020a170907d41200b007bc68cc7913mr20843433ejc.589.1669749909123; Tue, 29 Nov 2022 11:25:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669749909; cv=none; d=google.com; s=arc-20160816; b=Gbtf9qINwSLEdXmsfdVl59XInh3Z3fMowXMRZ7jCJqfuyzIm0Uh+UbgT2CnI/0xgGD P33qXYH1Zr773epp3a8C4NzbNpbcWDX6dLTsZxPwDnX4shQLXzmDd2UqW6nNpj0icnJe qJfi6kOoCmkc9VN5fbSCb6L2Pbs0NJc6es61VovhRYgXnNH5MGnB+cygfMQwZBAeT8kE kgt9h4hGJ2z8GsX2qhz2cxOaBDVuMMpjtX7zdIGt6uhl6Xk9ES6+YGtVXqeX5FKJhbaq 4xhZIGvRQcx9+2+gSrLD4Iud/RJUwNp7sbzyaPffXVYU2CeG/oFM9oNKGK7oEZmNKNZQ DIlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=laDyv7YUrXbfqGAwMagZdnkFS+VaAukLw7cc05haSWA=; b=CqOyFQH+/U1/3+UAIDU0I38mtW8VpJPAPQH65ufrZmWbMddqMO6IfE1RdZJlbObtJG z6W4XYAv1GqaL1+fSvMIG9fXrR+jH4ssbC208N+UY1UdtatUiZGj5GVeOZ42WWS/wsaZ JqsuclZi6N5MTA3cNpmWnHkyzs5G3ChKPiDNKdOjZBKRg+0o7G7gWN8JmvomZUJdelfA biQZdVP1DFFD5IGDEFd0Tu0rOJGM0YrHW0FWGSLxPP27ldyXQ40yQlpHEblv0EuC/CVH 4D240utRd0LoKkOkbUNpvgfPgoWHARVQryWygGyibuZ1ea7YWXBmQBdUTfHCKlJ4XDok q4rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=UdwE2yD+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bc2-20020a056402204200b0045c7611d8ddsi11634933edb.179.2022.11.29.11.24.48; Tue, 29 Nov 2022 11:25:09 -0800 (PST) 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=@linux.dev header.s=key1 header.b=UdwE2yD+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236801AbiK2TVk (ORCPT + 84 others); Tue, 29 Nov 2022 14:21:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236865AbiK2TU4 (ORCPT ); Tue, 29 Nov 2022 14:20:56 -0500 Received: from out2.migadu.com (out2.migadu.com [IPv6:2001:41d0:2:aacc::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE0756E544; Tue, 29 Nov 2022 11:20:06 -0800 (PST) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1669749605; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=laDyv7YUrXbfqGAwMagZdnkFS+VaAukLw7cc05haSWA=; b=UdwE2yD+Xreg9YPfNtiPciJasEmnad33G1DHyWSBDA7LwaT7n3KiwnnNO9bOgfsuBoI54F tbwcE9gGmZR/9cDmZ4YCQnOunSbgBloPF44HFlAEaw3Wbv927EOOsrVHVQZJ6abGcSkfq1 IGTSDogzwposXRkOGXjkbNu+97c6p1U= From: Oliver Upton To: Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Oliver Upton , Catalin Marinas , Will Deacon Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] KVM: arm64: Condition HW AF updates on config option Date: Tue, 29 Nov 2022 19:19:46 +0000 Message-Id: <20221129191946.1735662-5-oliver.upton@linux.dev> In-Reply-To: <20221129191946.1735662-1-oliver.upton@linux.dev> References: <20221129191946.1735662-1-oliver.upton@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS 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 As it currently stands, KVM makes use of FEAT_HAFDBS unconditionally. Use of the feature in the rest of the kernel is guarded by an associated Kconfig option. Align KVM with the rest of the kernel and only enable VTCR_HA when ARM64_HW_AFDBM is enabled. This can be helpful for testing changes to the stage-2 access fault path on Armv8.1+ implementations. Signed-off-by: Oliver Upton --- arch/arm64/kvm/hyp/pgtable.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c index 1a3dd9774707..9c651b6d4092 100644 --- a/arch/arm64/kvm/hyp/pgtable.c +++ b/arch/arm64/kvm/hyp/pgtable.c @@ -584,12 +584,14 @@ u64 kvm_get_vtcr(u64 mmfr0, u64 mmfr1, u32 phys_shift) lvls = 2; vtcr |= VTCR_EL2_LVLS_TO_SL0(lvls); +#ifdef CONFIG_ARM64_HW_AFDBM /* * Enable the Hardware Access Flag management, unconditionally * on all CPUs. The features is RES0 on CPUs without the support * and must be ignored by the CPUs. */ vtcr |= VTCR_EL2_HA; +#endif /* CONFIG_ARM64_HW_AFDBM */ /* Set the vmid bits */ vtcr |= (get_vmid_bits(mmfr1) == 16) ? -- 2.38.1.584.g0f3c55d4c2-goog