From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8B9091E8320 for ; Tue, 9 Dec 2025 15:32:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765294327; cv=none; b=M9bQqBzq4goBDnrQUYCMe1Qgx+IGmY1/MabSdfh5ii/Zd1mqeKPAxrQ4+7TJ06GWAsxB4WSn+LnGflbcjoB8lHhdYk84gISE6dv7fqvszQf7xfNG1tpwUc742twXncYBsg9j8tXw94FjYnjr+RujTf3ZKlNyG8bCarZR0M9zWo0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765294327; c=relaxed/simple; bh=PkVK9JPE96e881uwc49jY7xEnL7URSZo9zAVyQRK5VA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ihSti//eEWKN9dvPIJC9SyDCGU/JGXjbqNdGSgU6rIBSkqxbfofytm2QRPD9TTVauq/Nd/79diTytuuwZ7RouggjwJgw1Q7Fv3/TO0qfCtVtD6PNlkMsqPiLZt45LxCV1NKxwF1xor/vDhfz+apjJ0mylJ7w68JWzcIeSa7n0Cc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 71AF7175D; Tue, 9 Dec 2025 07:31:57 -0800 (PST) Received: from [10.1.196.46] (e134344.arm.com [10.1.196.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 66D443F762; Tue, 9 Dec 2025 07:32:01 -0800 (PST) Message-ID: Date: Tue, 9 Dec 2025 15:32:00 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 06/38] KVM: arm64: Force guest EL1 to use user-space's partid configuration To: James Morse , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: D Scott Phillips OS , carl@os.amperecomputing.com, lcherian@marvell.com, bobo.shaobowang@huawei.com, tan.shaopeng@fujitsu.com, baolin.wang@linux.alibaba.com, Jamie Iles , Xin Hao , peternewman@google.com, dfustini@baylibre.com, amitsinght@marvell.com, David Hildenbrand , Dave Martin , Koba Ko , Shanker Donthineni , fenghuay@nvidia.com, baisheng.gao@unisoc.com, Jonathan Cameron , Gavin Shan , rohit.mathew@arm.com, reinette.chatre@intel.com, Punit Agrawal References: <20251205215901.17772-1-james.morse@arm.com> <20251205215901.17772-7-james.morse@arm.com> From: Ben Horgan Content-Language: en-US In-Reply-To: <20251205215901.17772-7-james.morse@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi James, On 12/5/25 21:58, James Morse wrote: > While we trap the guest's attempts to read/write the MPAM control > registers, the hardware continues to use them. Guest-EL0 uses KVM's > user-space's configuration, as the value is left in the register, and > guest-EL1 uses either the host kernel's configuration, or in the case of > VHE, the UNKNOWN reset value of MPAM1_EL1. > > On nVHE systems, EL2 continues to use partid-0 for world-switch, even > when the host may have configured its kernel threads to use a different > partid. 0 may have been assigned to another task. > > We want to force the guest-EL1 to use KVM's user-space's MPAM > configuration, and EL2s to match the host's EL1 config. > > On a nVHE system, copy the EL1 MPAM register to EL2. This ensures > world-switch uses the same partid as the kernel thread does on the host. > > When loading the guest's EL1 registers, copy the VMM's EL0 partid to > the EL1 register. > > For VHE systems, we can skip restoring the EL1 register for the host, > as it is out-of-context once HCR_EL2.TGE is set. > > This is done outside the usual sysreg save/restore as the values can > change behind KVMs back, so should not be stored in the guest context. > > Signed-off-by: James Morse One thing that is needed in kvm now that we are changing MPAM for EL1 is an update to the __*activate_traps_mpam() to not assume partids and pmgs are 0. I have an existing patch to deal with this. Thanks, Ben