Message ID | 20230127113932.166089-20-suzuki.poulose@arm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp787673wrn; Fri, 27 Jan 2023 03:45:06 -0800 (PST) X-Google-Smtp-Source: AK7set9kWONbuPUOmo5Mfp1Z/j6dc4FUe5A2xOagJBkHRswjR/3OcgevRWKysuuVhEIScIGiDxWZ X-Received: by 2002:a17:90b:3a8a:b0:22c:4491:cbe4 with SMTP id om10-20020a17090b3a8a00b0022c4491cbe4mr3331001pjb.2.1674819905932; Fri, 27 Jan 2023 03:45:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674819905; cv=none; d=google.com; s=arc-20160816; b=HLU3fgcA+2q3Q4IMxiN+FBxnnEiLOOESHsE2TYI3FWuTgpVuVtxA041SECrXpwSUCq kNbSXdXoRhQD5Q8xGP7Y4zRdkwI9hsbS67zc0bQ3B9kMZ1cpeSUgGV20XTvBTTBbuy/g FMs7epANbixxL4r8HbOzl+axqIWArSRs6IA7nK3Ba0F4dhGVmddWMFtfC3Y2V4AKhWlG QVKCnB8aV11xGke9128GlP173EEz3heuWWZDD/EJg9S7EaSJmZJcY4/0J26TDqlpxYTw Nhr8kWo6/LMbHzNQykB2BXMWUxGd/yCPsG62xb7wzP5hCp8cY3QYiTwX0O5MvJngwI+Y zRHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Di89hcNPdPsHOLsUAMoHYLcLaeMPMiusS1vw2ja12hw=; b=ifjeHr3cNENLlMsNA8OTjY1CDxMl18ZWnsUuaVg3ue+yToESlY9zgRr8G0mjm1G6WB x+oUXFtzDAi5sAz3h3KvW2NEzyRQEoVnsu+8yvI2nPFAIKgeN21kgHGiYvaOUbXlzOmH PuVxp/KPVBWMObLs5L7WLGac434TdFZWWC3K1N3QmYQTmL2vygc9ZeTfSy/j/cx6UqSg 4XQlT3EBNzyJETAUCQJ/wJdHooP7i45fAEPq9GM1fxeDfmFLLpqKD+0Jx/B6HfZ97Qej sOpIxTq/ftsa3cTPf0sCzYg531EimXSRhqMhnrnI+kgRDPhg90vw0fNe0UGzJ4R4ZDsC +0zA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j132-20020a636e8a000000b004ad1e917143si4333577pgc.386.2023.01.27.03.44.53; Fri, 27 Jan 2023 03:45:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233182AbjA0LmJ (ORCPT <rfc822;lekhanya01809@gmail.com> + 99 others); Fri, 27 Jan 2023 06:42:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232155AbjA0Llf (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 27 Jan 2023 06:41:35 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 72D5D78AFC; Fri, 27 Jan 2023 03:41:06 -0800 (PST) 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 EF4CE2B; Fri, 27 Jan 2023 03:41:24 -0800 (PST) Received: from ewhatever.cambridge.arm.com (ewhatever.cambridge.arm.com [10.1.197.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 713E03F64C; Fri, 27 Jan 2023 03:40:40 -0800 (PST) From: Suzuki K Poulose <suzuki.poulose@arm.com> To: kvm@vger.kernel.org, kvmarm@lists.linux.dev Cc: suzuki.poulose@arm.com, Alexandru Elisei <alexandru.elisei@arm.com>, Andrew Jones <andrew.jones@linux.dev>, Christoffer Dall <christoffer.dall@arm.com>, Fuad Tabba <tabba@google.com>, Jean-Philippe Brucker <jean-philippe@linaro.org>, Joey Gouly <Joey.Gouly@arm.com>, Marc Zyngier <maz@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Oliver Upton <oliver.upton@linux.dev>, Paolo Bonzini <pbonzini@redhat.com>, Quentin Perret <qperret@google.com>, Steven Price <steven.price@arm.com>, Thomas Huth <thuth@redhat.com>, Will Deacon <will@kernel.org>, Zenghui Yu <yuzenghui@huawei.com>, linux-coco@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC kvmtool 19/31] arm64: Don't try to set PSTATE for VCPUs belonging to a realm Date: Fri, 27 Jan 2023 11:39:20 +0000 Message-Id: <20230127113932.166089-20-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230127113932.166089-1-suzuki.poulose@arm.com> References: <20230127112248.136810-1-suzuki.poulose@arm.com> <20230127113932.166089-1-suzuki.poulose@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756175957623114748?= X-GMAIL-MSGID: =?utf-8?q?1756175957623114748?= |
Series |
arm64: Support for Arm Confidential Compute Architecture
|
|
Commit Message
Suzuki K Poulose
Jan. 27, 2023, 11:39 a.m. UTC
From: Christoffer Dall <christoffer.dall@arm.com> RME doesn't allow setting the PSTATE but resets it to an architectural value, and KVM also does not allow setting this register from user space, so stop trying to do that. Signed-off-by: Christoffer Dall <christoffer.dall@arm.com> Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> --- arm/aarch64/kvm-cpu.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/arm/aarch64/kvm-cpu.c b/arm/aarch64/kvm-cpu.c index e7649239..37f9aa9d 100644 --- a/arm/aarch64/kvm-cpu.c +++ b/arm/aarch64/kvm-cpu.c @@ -92,11 +92,13 @@ static void reset_vcpu_aarch64(struct kvm_cpu *vcpu) reg.addr = (u64)&data; - /* pstate = all interrupts masked */ - data = PSR_D_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT | PSR_MODE_EL1h; - reg.id = ARM64_CORE_REG(regs.pstate); - if (ioctl(vcpu->vcpu_fd, KVM_SET_ONE_REG, ®) < 0) - die_perror("KVM_SET_ONE_REG failed (spsr[EL1])"); + if (!kvm->cfg.arch.is_realm) { + /* pstate = all interrupts masked */ + data = PSR_D_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT | PSR_MODE_EL1h; + reg.id = ARM64_CORE_REG(regs.pstate); + if (ioctl(vcpu->vcpu_fd, KVM_SET_ONE_REG, ®) < 0) + die_perror("KVM_SET_ONE_REG failed (PSTATE)"); + } /* x1...x3 = 0 */ data = 0;