From mboxrd@z Thu Jan 1 00:00:00 1970 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 AEA6BC88CB2 for ; Tue, 13 Jun 2023 08:21:36 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:To:Subject:MIME-Version: Date:Message-ID:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=DSHg+M2iRfoV703DdjEMM/8lrGws8WB43iQo2QNAJjg=; b=Q/RZnNSA/IhqW/Q4F7C3gHHJ0L 1Is8uFcNBiYiOl/i3Kupew0WbXjsV6wuTBmxrbaKxg2qTFFa+ZsXk7UH5oZdImub4xq6P2RowjZ3w 1/vsPLyQ0Vm5zJcNNgYS2Rh7i8j7wNGNSd2skmOIhLe+swpvLX71HMLYyX7EMVahSvURQNxRm/5yO HDbJF9a4NFGiJqKIbiXPYm48hKoWoVZgmXIBVNfjG+jTTNWAjtqeZKf9E+vRiysmno6huZ20ya5qU rvfvNp1EufyXk5jwbL+wJWg6rUXZ5VFgHSh5NC2uIEMt5atZQErzXOxJ3Onf3BPIpfCBxSwhiAZg+ RehJcLCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q8zH6-007M3c-0B; Tue, 13 Jun 2023 08:21:12 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q8zH3-007M2r-0F for linux-arm-kernel@lists.infradead.org; Tue, 13 Jun 2023 08:21:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686644467; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=talGzw76+6p1o8joDaAnHX8pHcAIb2budWcm0KVV2cA=; b=E7aF8f8g8JBaemUQd/kgKKuqvhpOzHa9U1o4kbCixNo6uC4z177oMuHDoz806hSacjkb1Z SR7DxFaurxqbr0HW6UPv9BER9Z09XEnR6G+jBnvbA4PGxGD7n4ckFFOdeVRC+8QidgxG7W /rELpYKntp8fTkOl8lU39Fj7i14RWTk= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-593-qSOrqFhnPCyzSarXFECbdQ-1; Tue, 13 Jun 2023 04:21:05 -0400 X-MC-Unique: qSOrqFhnPCyzSarXFECbdQ-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3f7f3333b2bso7926865e9.0 for ; Tue, 13 Jun 2023 01:21:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686644464; x=1689236464; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=talGzw76+6p1o8joDaAnHX8pHcAIb2budWcm0KVV2cA=; b=XCRbuvDdC8t0c635VJ40ibLM6hgXZCegZsTxa03bQrgA5admQBo62SNWb17Sf5m/nL hhmSQCeM0UdlVkM7/WzeFYDv65knZWD8zndeaZkus0P7ifUHM9QioGIBHD+A9PRnpCAA Ahun8xGHZCmCiMvuxiqOLuImkCkvbwS40BvP6X7KXKong4IJcG+6PBBwzBQywrP7hEsh ndojeOR3HKbFeOHlZBNOzI+0Lq+Pnh9/CXpWWUCYaXHg8aqJr7PKKuyWEBEUyO+5pSDm dW2PGcHODgF0cA85mQoQuAXZ49xOSXk56DDRZgKHuqpOVX2ewTAJakRBC52gVLHRgbzl I8kw== X-Gm-Message-State: AC+VfDwvbKwSf/HPDtmF3nX759mmYfK+73Y8fUMItjYyIRu+ks1IpxAS +ZPgFK94wyGRI4g3xWiuuK47x8fp2IXwh6QzM19tDasAsAoZJ7Tt3oGWYOE6WlqeNOa3lc8bbGr HE+eoq1A6cofEddQ+pq7yPo3mZsnwGUPkq7vhi5sxf9JnrcW/im/NXQLi9i1Gp0RHYeFrBduWX3 HSsVAARcBCZDPy0nqxCCDoWw== X-Received: by 2002:a05:600c:3501:b0:3f5:f543:d81f with SMTP id h1-20020a05600c350100b003f5f543d81fmr9624888wmq.3.1686644464251; Tue, 13 Jun 2023 01:21:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ma9y7r54ryIetYu7jq98Z/DZ6PmVCsgQnI9/uFGo+O+xe3tShBHMIOpGOc2Og5ifkyMkk5Q== X-Received: by 2002:a05:600c:3501:b0:3f5:f543:d81f with SMTP id h1-20020a05600c350100b003f5f543d81fmr9624863wmq.3.1686644463835; Tue, 13 Jun 2023 01:21:03 -0700 (PDT) Received: from [10.66.61.39] ([43.228.180.230]) by smtp.gmail.com with ESMTPSA id 10-20020a05600c22ca00b003f427687ba7sm13574417wmg.41.2023.06.13.01.21.02 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Jun 2023 01:21:03 -0700 (PDT) Message-ID: <5b5157fd-7d3a-7b51-ac95-97f96858fb29@redhat.com> Date: Tue, 13 Jun 2023 16:20:59 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v3 01/17] KVM: arm64: Drop is_kernel_in_hyp_mode() from __invalidate_icache_guest_page() To: linux-arm-kernel@lists.infradead.org References: <20230609162200.2024064-1-maz@kernel.org> <20230609162200.2024064-2-maz@kernel.org> From: Shaoqin Huang In-Reply-To: <20230609162200.2024064-2-maz@kernel.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230613_012109_183123_04C6B58F X-CRM114-Status: GOOD ( 22.58 ) 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: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 6/10/23 00:21, Marc Zyngier wrote: > It is pretty obvious that is_kernel_in_hyp_mode() doesn't make much > sense in the hypervisor part of KVM, and should be reserved to the > kernel side. > > However, mem_protect.c::invalidate_icache_guest_page() calls into > __invalidate_icache_guest_page(), which uses is_kernel_in_hyp_mode(). > Given that this is part of the pKVM side of the hypervisor, this > helper can only return true. > > Nothing goes really bad, but __invalidate_icache_guest_page() could > spell out what the actual check is: we cannot invalidate the cache > if the i-cache is VPIPT and we're running at EL1. > > Drop the is_kernel_in_hyp_mode() check for an explicit check against > CurrentEL being EL1 or not. > > Signed-off-by: Marc Zyngier Reviewed-by: Shaoqin Huang > --- > arch/arm64/include/asm/kvm_mmu.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h > index 27e63c111f78..c8113b931263 100644 > --- a/arch/arm64/include/asm/kvm_mmu.h > +++ b/arch/arm64/include/asm/kvm_mmu.h > @@ -227,7 +227,8 @@ static inline void __invalidate_icache_guest_page(void *va, size_t size) > if (icache_is_aliasing()) { > /* any kind of VIPT cache */ > icache_inval_all_pou(); > - } else if (is_kernel_in_hyp_mode() || !icache_is_vpipt()) { > + } else if (read_sysreg(CurrentEL) != CurrentEL_EL1 || > + !icache_is_vpipt()) { > /* PIPT or VPIPT at EL2 (see comment in __kvm_tlb_flush_vmid_ipa) */ > icache_inval_pou((unsigned long)va, (unsigned long)va + size); > } -- Shaoqin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel