Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp656415imj; Wed, 13 Feb 2019 15:06:49 -0800 (PST) X-Google-Smtp-Source: AHgI3IbbevOv6vGDxvkDy/f7ITUmVTF7NgX6UOKkMi5ybbhKse2oslUNa5Of1mMKo3YIZ2m04cyU X-Received: by 2002:a65:46cf:: with SMTP id n15mr605453pgr.187.1550099209656; Wed, 13 Feb 2019 15:06:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550099209; cv=none; d=google.com; s=arc-20160816; b=YNDleqalP+9sA62OGFpK0ofWc3RnUWxPqcNZy7+ymqIXXV2d4mlO3mwdRdkWM0fQV3 pY6vQ36VsTKQzmM4C5TlOu8OirKJQ/yMEsN1Rkq6oq6zIoKGCdU2qKiKBm/ylqZHoAgO /lKLTmJdNrviA8nV8L06dIlYLUhog9qYtf9iKlsdzUQGFGCJ9SkHg5RR/kPFLCPZVqpw 6lREjjHypHUIsCS4XBBRkCSxSFmD9aAyvEzpDq/6M1/wm6Hwa/uXP6U6lLVwNzefJveW bvX7aEbylKZ6l0pCFukB6V1dhLPL8BdgW91aSu0cela+17ZSKHGJkPcrTQiZefBM4C7C 8I4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:subject:from; bh=P/UaJ6gnyjtzdqSrcGthApImdznFRKmhB/4OZoYk4x4=; b=WifA9mjRuxFrOU0mIbl5M80WFe81xZwtCAqKyHhjafONqV1qPAI8vSzpFmY7FYUkTp vALZXSH0XcciUY4CdvusfqsJVPgyVsSMtiCuKDVCqYiI9dOWBjhevSzCQkhkwS/Fj7iO sN2zvvOXRVPt8r5IghZO3tFy7fNuAJnClV9lqzoIMNImbzTQInjKAJ0bu8Z/GD03k8ED LQSY7G4UmyDO67U/y8VSo+ppagIf0IVWWQG4OXSUN8FZn46QPkdAk7Q4IkIVzwovXxF9 AuKcVu109nm3pauO0pWyJ01kFCnXKmUwF5ckNWVQnaL9S08ccO94E1xmWbmOp4XhDP9+ AOeQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w13si598808pll.126.2019.02.13.15.06.33; Wed, 13 Feb 2019 15:06:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389581AbfBMReX (ORCPT + 99 others); Wed, 13 Feb 2019 12:34:23 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57850 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732687AbfBMReW (ORCPT ); Wed, 13 Feb 2019 12:34:22 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1B12FA78; Wed, 13 Feb 2019 09:34:22 -0800 (PST) Received: from [10.1.197.21] (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 05D403F675; Wed, 13 Feb 2019 09:34:19 -0800 (PST) From: Kristina Martsenko Subject: Re: [PATCH v5 2/5] arm64/kvm: preserve host HCR_EL2/MDCR_EL2 value To: Amit Daniel Kachhap , linux-arm-kernel@lists.infradead.org Cc: Christoffer Dall , Marc Zyngier , Catalin Marinas , Will Deacon , Andrew Jones , Dave Martin , Ramana Radhakrishnan , kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, Mark Rutland References: <1548658727-14271-1-git-send-email-amit.kachhap@arm.com> <1548658727-14271-3-git-send-email-amit.kachhap@arm.com> Message-ID: <8de32a89-4aa1-bffb-78dd-45feddc9216e@arm.com> Date: Wed, 13 Feb 2019 17:34:18 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <1548658727-14271-3-git-send-email-amit.kachhap@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28/01/2019 06:58, Amit Daniel Kachhap wrote: > When restoring HCR_EL2 for the host, KVM uses HCR_HOST_VHE_FLAGS, which > is a constant value. This works today, as the host HCR_EL2 value is > always the same, but this will get in the way of supporting extensions > that require HCR_EL2 bits to be set conditionally for the host. > > To allow such features to work without KVM having to explicitly handle > every possible host feature combination, this patch has KVM save/restore > the host HCR when switching to/from a guest HCR. The saving of the > register is done once during cpu hypervisor initialization state and is > just restored after switch from guest. Why is this patch needed? I couldn't find anything in this series that sets HCR_EL2 conditionally for the host. It seems like the kernel still always sets it to HCR_HOST_VHE_FLAGS/HCR_HOST_NVHE_FLAGS. Looking back at v2 of the userspace pointer auth series, it seems that the API/APK bits were set conditionally [1], so this patch would have been needed to preserve HCR_EL2. But as of v3 of that series, the bits have been set unconditionally through HCR_HOST_NVHE_FLAGS [2]. Is there something else I've missed? Thanks, Kristina [1] https://lore.kernel.org/linux-arm-kernel/20171127163806.31435-6-mark.rutland@arm.com/ [2] https://lore.kernel.org/linux-arm-kernel/20180417183735.56985-5-mark.rutland@arm.com/