From patchwork Mon Mar 18 11:16:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Ott X-Patchwork-Id: 13595281 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 1E78DC54E58 for ; Mon, 18 Mar 2024 11:19:37 +0000 (UTC) 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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6M6nzmU52tTbWYpy8HmwHCPHLPPWDyW0MONWEPfk7bE=; b=vhvkf1NaZUFNG3 5E4fxrOq+xuBqEK5nCvioKNMYNGQUi8ecE5ZtPKLflvFlMwUSBtXunM58igJtiOp+Qyx0ZvDvKzsI hUL0944HPzWejBIVFhyvcr+8Yj2iFSjIoOsAXp3RHqCk5isl8Le+cDh4rdqK3z22lJdKxWd0HL38l uih2jHbYzZdT5ry/FOYqBAGcKrRr1tOTO+67/wn5il5aJfd8ldlZ6QtfK1AX8sLCclvzpNcdli4UO 3xqOoguBN6V8v1ELFJtPsdo1ujkMh5uWYTCDvr72JOS0keoVktNehZopvh2blKcmDDov5h9ribC24 /x2v9tqzZIPRmdbC8RZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmB1W-00000008KLe-48hg; Mon, 18 Mar 2024 11:19:23 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmB0q-00000008K2j-3g1I for linux-arm-kernel@lists.infradead.org; Mon, 18 Mar 2024 11:18:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710760720; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UEAmrGK5xcs3PsJuJDxhgvyZA/hBUPjYuKHkTiO8m3Q=; b=aT3XmoNtkvVu8Gmo9NOJ+QZ+FW3TgOELKFUVAp40YJ4JiFKtKBjqEm7Id117js5/Uh/t9c msjAXf2aeuGiypb9JTBXoxcJ1vDfYmuhKGQIrRBNYq6AfXRG7qwG5AebzxTmTI7Wslytf7 yx+rMdbQKBPP7aSx2QYL4OnqPSE6zdg= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-34-eOB4jKntOi6xyAXDRY6fng-1; Mon, 18 Mar 2024 07:16:46 -0400 X-MC-Unique: eOB4jKntOi6xyAXDRY6fng-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-789dfca78f8so493018885a.1 for ; Mon, 18 Mar 2024 04:16:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710760605; x=1711365405; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UEAmrGK5xcs3PsJuJDxhgvyZA/hBUPjYuKHkTiO8m3Q=; b=woOkWDZ4p9W4MlJguGdlBvvVay7FZldKv67MwI+lSqZik4Y9nh0CKj4rUAoATRmIUk /ug1lS63Aqnu+IL6bKM9++3xtQTsLqoIhKwh6CjpOLsbpBzLNhp4JiDDXLkUgQh3JiVi 4Tx6/s0IjtRiSlddZfzMcOfV/3CTZoUmc5rhwFkTThi4TuAc0xTOThusHbXEIbEAuem2 QrSdYqaMH2Z4Q1Ijhpypb3b8Ue65LbOlHFOeie3Td7W6lRuqDGNRM9r2079LKOaHcUZW wkN7X4gDKz87Z0pXYHSn5xOIFAU+rQ0QV9LzK9D6ygSKWmIs9XSWvCWTYaR60Lsu++Vw dZwg== X-Gm-Message-State: AOJu0YyijQY7Wme7IvuZGqJl1rAF0XQKcYYnJpitEtQVx7djRJtcudNF nYtIaLbFWGvB4X2xBFEWeIxaZy8OUGSiuyCqpLoA63oNNG/9Ob5ei6ofqMu1h0vnocYzraDDADm o6PuqlfKrNIJVEJkVXrJXl0RXpkkYrNV7oUQbMtMf8w13AheY0koqFL09hjLskZzSjKnWFT8YiM cG4UcPF1mAylbJcTRCDcsZWY+jRXp6UKx7WID7MMxdeFkCemBy/mg63Q== X-Received: by 2002:ac8:7f8e:0:b0:430:9754:aece with SMTP id z14-20020ac87f8e000000b004309754aecemr16426754qtj.42.1710760604767; Mon, 18 Mar 2024 04:16:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEePY6E4i48vRnp4qJS0SWsccDtOOIpqYCkN8e1Hh5NON44N1Ov4Cm+88Xi1ysE5i5ou3vfIw== X-Received: by 2002:ac8:7f8e:0:b0:430:9754:aece with SMTP id z14-20020ac87f8e000000b004309754aecemr16426733qtj.42.1710760604433; Mon, 18 Mar 2024 04:16:44 -0700 (PDT) Received: from rh.redhat.com (p200300c93f079e00cac8703672d98936.dip0.t-ipconnect.de. [2003:c9:3f07:9e00:cac8:7036:72d9:8936]) by smtp.gmail.com with ESMTPSA id ew5-20020a05622a514500b00430c8b87b46sm1832001qtb.6.2024.03.18.04.16.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 04:16:44 -0700 (PDT) From: Sebastian Ott To: linux-arm-kernel@lists.infradead.org Cc: Marc Zyngier , Oliver Upton Subject: [PATCH 2/4] KVM: arm64: ensure guest access to CTR_EL0 is trapped Date: Mon, 18 Mar 2024 12:16:34 +0100 Message-ID: <20240318111636.10613-3-sebott@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240318111636.10613-1-sebott@redhat.com> References: <20240318111636.10613-1-sebott@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240318_041841_028824_62CBD3C5 X-CRM114-Status: GOOD ( 10.07 ) 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 Ensure that guest access to the CTR_EL0 register is trapped independent of cpu errata. Signed-off-by: Sebastian Ott --- arch/arm64/include/asm/kvm_emulate.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h index b804fe832184..daaaf7664219 100644 --- a/arch/arm64/include/asm/kvm_emulate.h +++ b/arch/arm64/include/asm/kvm_emulate.h @@ -91,12 +91,7 @@ static inline void vcpu_reset_hcr(struct kvm_vcpu *vcpu) vcpu->arch.hcr_el2 |= HCR_TVM; } - if (cpus_have_final_cap(ARM64_HAS_EVT) && - !cpus_have_final_cap(ARM64_MISMATCHED_CACHE_TYPE)) - vcpu->arch.hcr_el2 |= HCR_TID4; - else - vcpu->arch.hcr_el2 |= HCR_TID2; - + vcpu->arch.hcr_el2 |= HCR_TID2; if (vcpu_el1_is_32bit(vcpu)) vcpu->arch.hcr_el2 &= ~HCR_RW;