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 mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEB49C433F5 for ; Mon, 16 May 2022 10:42:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 4D2EE4B1F8; Mon, 16 May 2022 06:42:07 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xN8BWhE5qsua; Mon, 16 May 2022 06:42:06 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 27F7F4B11A; Mon, 16 May 2022 06:42:06 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id C22B14B0DF for ; Mon, 16 May 2022 06:42:04 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UXSB+S5Odlwv for ; Mon, 16 May 2022 06:42:03 -0400 (EDT) Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 3E31D49F5D for ; Mon, 16 May 2022 06:42:03 -0400 (EDT) Received: by mail-ed1-f50.google.com with SMTP id p26so1491142eds.5 for ; Mon, 16 May 2022 03:42:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=erbXfCmeHocQjfL+rgDZPz13+JsufODTkqH4MW8FPkU=; b=P77DC0Il8yTtkstHIFJR8Nqlq8byFBHMvwFcvt4Nt22CzyvC/Fv+KdNgonw4S3OD3K 2LvZ1t/0q7xkgaqJ5UbQef9PLfEU7ibZjarM7y30f4syi3XrIkk66bNTygONFoWTGBsW T0zLbcuIOAC9Pea0Sj+b22Ih6ju5PVW+bGFZBfbQIQwsZ2smRedVpMeslKaL1/f8c8ws cpfStIYgXZGpFXthRtvUGpT3DV00iZ9sg3V6xgZDESod1iRqB5UonePNMTjP7uGf8dB4 IBqMuAHh6o186Vqyr9HRq/GyB3509vT7hUFGMlFByEIaa6lwVHd0K6KyZqrr3pKGyAHv dkfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=erbXfCmeHocQjfL+rgDZPz13+JsufODTkqH4MW8FPkU=; b=pCgWJoSDy5cxP5f7LNwEDRflWy/Dl/ELbje0/1KZlaIcM8sLmE+zXBZNYw2hQncSQD uk9cZRakzWritpOlaS0ZA3LCIY0ycWp1DBwZqxmbJ9xFywG9zPhL3/3kR1Wcl+rPnHz6 9S/TV+GpBepXiEXSnGNPg16Ve/ZzY/GlLSDKjeUAjfBhNNztffkbwvrkv0lt/GLrLOIP nfgTanG9BkarDY6mK+GoH8cjA+KU0B+JEWj2WmtGcY2RsCKvoaSl7pPJYQ6M22uO8uwv k6xaTuX5HUdx/OGnFf+ygz6u03tWlWNlgmGTv2/MkULx/J9QZeMAn9X/ZPCiIXLV4PNq wDVg== X-Gm-Message-State: AOAM532i8x9xEzM7v7h9nkn5v569O8YC8BJvQakGXZxaeNTbvirHWrw7 +d/g4f7ICCWaDnxlcIjJtUXzrg== X-Google-Smtp-Source: ABdhPJwCmZ7TsADf4yBSO70bp+4Cv2yZYtgdUiE6w+q/M7boOVpmbsE2ZQrGrh1nN3VKR0CPmxFF2w== X-Received: by 2002:a05:6402:2710:b0:427:d087:b with SMTP id y16-20020a056402271000b00427d087000bmr12509532edd.11.1652697721952; Mon, 16 May 2022 03:42:01 -0700 (PDT) Received: from google.com (30.171.91.34.bc.googleusercontent.com. [34.91.171.30]) by smtp.gmail.com with ESMTPSA id ec33-20020a0564020d6100b0042ab48ea729sm1151662edb.88.2022.05.16.03.42.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 03:42:01 -0700 (PDT) Date: Mon, 16 May 2022 10:41:58 +0000 From: Quentin Perret To: Marc Zyngier Subject: Re: [PATCH] KVM: arm64: Don't hypercall before EL2 init Message-ID: References: <20220513092607.35233-1-qperret@google.com> <87sfpb59wj.wl-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87sfpb59wj.wl-maz@kernel.org> Cc: kernel-team@android.com, Will Deacon , Catalin Marinas , linux-kernel@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Sunday 15 May 2022 at 12:10:20 (+0100), Marc Zyngier wrote: > Can we simplify the condition? ARM64_SPECTRE_V3A is only set when > !VHE, and we already bail in kvm_patch_vector_branch() if we see > VHE+V3A, because the combination makes no sense at all. I think this > can be rewritten as: > > if (kvm_system_needs_idmapped_vectors() && > !is_protected_lvm_enabled()) > > Thoughts? Yup I think this works as both CPUs that are vulnerable to V3A aren't VHE-capable. But if we ever get a VHE-capable CPU that's vulnerable I think the next call to create_hyp_exec_mappings() will BUG(). Perhaps the alternative would be to have has_spectre_v3a() say no in VHE to be on the safe side? That is, prevent the cap from being set to begin with. Cheers, Quentin _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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 86BFAC433EF for ; Mon, 16 May 2022 10:43:22 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sEp+o9uuw+7fvNAnPHSWSIVWRs0SOAV0F71AG5zhO2s=; b=bpWGL7vE0VBJyP soT7hxeDhCliiItzThnfdtyz/R830lr9o4Rxyyo7xeQ6QloyWCdM0aCqzt+ntdGjdeYkinXZ2KO6v xOtusdgZXzbn5g8uOh7S42Lcw78cWDOwnVRTInzWS2o6uuYtEXMi/3RDc+k+p+UW/ZH86boGfV2Hi +qiQWL2H6VGNK4sjdqs9fPLl/hk6ZSFGCqh2r1XJiu9/eRPRsXcqEKyVWL7iG/kYccec1/IRhpEio MgpPuoWaqu4BaTEcxMhPWWkzTMZI+h5zhoqMHduaXoZo81P97TCuUvG3rV3kKVm8CChDm+22EUPx9 1EEDLS/s0BMabQxVJD4w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nqYB1-0079dA-Fi; Mon, 16 May 2022 10:42:11 +0000 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nqYAx-0079be-UG for linux-arm-kernel@lists.infradead.org; Mon, 16 May 2022 10:42:09 +0000 Received: by mail-ed1-x52d.google.com with SMTP id i40so2699309eda.7 for ; Mon, 16 May 2022 03:42:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=erbXfCmeHocQjfL+rgDZPz13+JsufODTkqH4MW8FPkU=; b=P77DC0Il8yTtkstHIFJR8Nqlq8byFBHMvwFcvt4Nt22CzyvC/Fv+KdNgonw4S3OD3K 2LvZ1t/0q7xkgaqJ5UbQef9PLfEU7ibZjarM7y30f4syi3XrIkk66bNTygONFoWTGBsW T0zLbcuIOAC9Pea0Sj+b22Ih6ju5PVW+bGFZBfbQIQwsZ2smRedVpMeslKaL1/f8c8ws cpfStIYgXZGpFXthRtvUGpT3DV00iZ9sg3V6xgZDESod1iRqB5UonePNMTjP7uGf8dB4 IBqMuAHh6o186Vqyr9HRq/GyB3509vT7hUFGMlFByEIaa6lwVHd0K6KyZqrr3pKGyAHv dkfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=erbXfCmeHocQjfL+rgDZPz13+JsufODTkqH4MW8FPkU=; b=0O5ZMrqZEePpZckOdvDpjSEkJIvfeJY0siMynMu+oLdCIcoXp+nJWsvIXVGPZDsP0x QmWAKSMVanq2ur3LKVXJ8dV9kzFbkTmd8AQ7fprtjjZ35vhYBrSPWMtvxMDgxdp19/z9 nj4GkciiYHGjHIkkEmId4CL86gTEa/3g4JngzFgeMI3AvKt+FCxcj3RwE7yrvtr1G9QA 3ETMcgIZZgSE8pAF9cvuY/8sStuvSdv2JK5ovREOpSP5nWGKOvz+5I6gPrxOh0sJWhDj MnKNmO7C2brluRqkfn7mYZC/4sgbnUvFKYurnt5laI6P5DhvkUAynkLr0A0eYWP4CHtl bWxA== X-Gm-Message-State: AOAM532DlxwZCQkjR5RmUg6zxcQubOxAf/i6eDMyN6gMwKZFL+3xyFr+ hMj0bWvUdHJhwVXq2YqMmfPDAg== X-Google-Smtp-Source: ABdhPJwCmZ7TsADf4yBSO70bp+4Cv2yZYtgdUiE6w+q/M7boOVpmbsE2ZQrGrh1nN3VKR0CPmxFF2w== X-Received: by 2002:a05:6402:2710:b0:427:d087:b with SMTP id y16-20020a056402271000b00427d087000bmr12509532edd.11.1652697721952; Mon, 16 May 2022 03:42:01 -0700 (PDT) Received: from google.com (30.171.91.34.bc.googleusercontent.com. [34.91.171.30]) by smtp.gmail.com with ESMTPSA id ec33-20020a0564020d6100b0042ab48ea729sm1151662edb.88.2022.05.16.03.42.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 03:42:01 -0700 (PDT) Date: Mon, 16 May 2022 10:41:58 +0000 From: Quentin Perret To: Marc Zyngier Cc: James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH] KVM: arm64: Don't hypercall before EL2 init Message-ID: References: <20220513092607.35233-1-qperret@google.com> <87sfpb59wj.wl-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87sfpb59wj.wl-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220516_034208_034133_5D82968F X-CRM114-Status: GOOD ( 13.24 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sunday 15 May 2022 at 12:10:20 (+0100), Marc Zyngier wrote: > Can we simplify the condition? ARM64_SPECTRE_V3A is only set when > !VHE, and we already bail in kvm_patch_vector_branch() if we see > VHE+V3A, because the combination makes no sense at all. I think this > can be rewritten as: > > if (kvm_system_needs_idmapped_vectors() && > !is_protected_lvm_enabled()) > > Thoughts? Yup I think this works as both CPUs that are vulnerable to V3A aren't VHE-capable. But if we ever get a VHE-capable CPU that's vulnerable I think the next call to create_hyp_exec_mappings() will BUG(). Perhaps the alternative would be to have has_spectre_v3a() say no in VHE to be on the safe side? That is, prevent the cap from being set to begin with. Cheers, Quentin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C04FCC433EF for ; Mon, 16 May 2022 10:42:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242750AbiEPKm6 (ORCPT ); Mon, 16 May 2022 06:42:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236543AbiEPKmF (ORCPT ); Mon, 16 May 2022 06:42:05 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A653B28 for ; Mon, 16 May 2022 03:42:03 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id c12so3947004eds.10 for ; Mon, 16 May 2022 03:42:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=erbXfCmeHocQjfL+rgDZPz13+JsufODTkqH4MW8FPkU=; b=P77DC0Il8yTtkstHIFJR8Nqlq8byFBHMvwFcvt4Nt22CzyvC/Fv+KdNgonw4S3OD3K 2LvZ1t/0q7xkgaqJ5UbQef9PLfEU7ibZjarM7y30f4syi3XrIkk66bNTygONFoWTGBsW T0zLbcuIOAC9Pea0Sj+b22Ih6ju5PVW+bGFZBfbQIQwsZ2smRedVpMeslKaL1/f8c8ws cpfStIYgXZGpFXthRtvUGpT3DV00iZ9sg3V6xgZDESod1iRqB5UonePNMTjP7uGf8dB4 IBqMuAHh6o186Vqyr9HRq/GyB3509vT7hUFGMlFByEIaa6lwVHd0K6KyZqrr3pKGyAHv dkfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=erbXfCmeHocQjfL+rgDZPz13+JsufODTkqH4MW8FPkU=; b=VsZTZpEMYq7vnAwPfc99al06uv2EMD5QBrt86F+bOB58eM2Duc0cfPS6dA5kVs+roG iLRo6tsvDbOZd9sKdDbrJxc9Mq6OJMuWXX2kdr0Emo7BJNzXBZccUTnyBXz6Dx3OX6Fy cUJ9JDe8Fj7V40ItImVUGJFvmfxGQ/jPKGHbHHK+XAtwi3Xs9O4Vi2d7zHkslBDempL7 vx5Fjc2QYJIb+ld06i7NDowiv+Gu6HrgXBEXGxgmJGmpMBOgTeYqPHqRR1hL6eBppxnv enYadsXR7l2xdGQBVjgxuGKRQiIxO99V7jIga04jhTMwHrPLuypYBhqD1HuAsUYrGSsy Oy8w== X-Gm-Message-State: AOAM531RIkU8lXScZhbE3SVCFVyLdUMwsvkxpxV3KL25xtNxE1z5XKVX DIvefRN61Qmaq5+7yUXtHjIQ+A== X-Google-Smtp-Source: ABdhPJwCmZ7TsADf4yBSO70bp+4Cv2yZYtgdUiE6w+q/M7boOVpmbsE2ZQrGrh1nN3VKR0CPmxFF2w== X-Received: by 2002:a05:6402:2710:b0:427:d087:b with SMTP id y16-20020a056402271000b00427d087000bmr12509532edd.11.1652697721952; Mon, 16 May 2022 03:42:01 -0700 (PDT) Received: from google.com (30.171.91.34.bc.googleusercontent.com. [34.91.171.30]) by smtp.gmail.com with ESMTPSA id ec33-20020a0564020d6100b0042ab48ea729sm1151662edb.88.2022.05.16.03.42.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 03:42:01 -0700 (PDT) Date: Mon, 16 May 2022 10:41:58 +0000 From: Quentin Perret To: Marc Zyngier Cc: James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH] KVM: arm64: Don't hypercall before EL2 init Message-ID: References: <20220513092607.35233-1-qperret@google.com> <87sfpb59wj.wl-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87sfpb59wj.wl-maz@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sunday 15 May 2022 at 12:10:20 (+0100), Marc Zyngier wrote: > Can we simplify the condition? ARM64_SPECTRE_V3A is only set when > !VHE, and we already bail in kvm_patch_vector_branch() if we see > VHE+V3A, because the combination makes no sense at all. I think this > can be rewritten as: > > if (kvm_system_needs_idmapped_vectors() && > !is_protected_lvm_enabled()) > > Thoughts? Yup I think this works as both CPUs that are vulnerable to V3A aren't VHE-capable. But if we ever get a VHE-capable CPU that's vulnerable I think the next call to create_hyp_exec_mappings() will BUG(). Perhaps the alternative would be to have has_spectre_v3a() say no in VHE to be on the safe side? That is, prevent the cap from being set to begin with. Cheers, Quentin