Message ID | 20230127113932.166089-11-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 s9csp787494wrn; Fri, 27 Jan 2023 03:44:39 -0800 (PST) X-Google-Smtp-Source: AK7set+SxpGgy/Tv7E1YprH0fMVD0yi2oP1mEYq5x7TkbTGHB4037nYT6jPR5XMf3mQLcnY2M7kI X-Received: by 2002:a17:902:d509:b0:196:4ed2:ec6a with SMTP id b9-20020a170902d50900b001964ed2ec6amr3256969plg.61.1674819879327; Fri, 27 Jan 2023 03:44:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674819879; cv=none; d=google.com; s=arc-20160816; b=rVR2/3PnvzFqbBISzzz8D3x54XySLw63aWw0RFGkjWt0gO9HHao/scQD3zOPfW4gQG AfAToPEF4Fsu9HdDLufQN3mVKTHlETbcfN0WhZSKRPIcMK65oo/8V36w8nAl4GvJCVYy bT1ellT/BKU0CWB2bv4q4Do3WdlfpbzrM7jgXIPEMMdwn54TlX0LMQ3f7rSAT9HOPUNd D0wDk0ndUYh6m331gaYuVPjKESPH1Z2vO8naHjp8m4qgheC/mEnOKgKGmdupbQiFbGvU YrMbPY6t6x1IwBRByD5WKgr+20Q/Nw5RqcYNwxFEBNd3b3V6XaZZv4cob4mGfeN7TDSR nN8A== 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=rurA/eoZc2HF7wVVhzXYfUUSCv6D3Kn0qhAs34AfqVo=; b=Cxq/S4j5YbjI07y+TOHB2K9DUGBrT+gx0wWwOooUdfQIsm74b/Yd3nYMY8qDDbJipJ LgliQ9qIBSndPPjy5IL4r+yzv/qbiqvgOlmjIIr2CJtynJm7URTF77970PtsYgIfHyUf KBLZ3VePTQwjIQzHw3sQ15j48z4S4YU19h9fcZ4Wu38U2f1YBmbg9g18fRJW6SC4gHRh mbRon56+GtYePjKKw6JAzktUWU/f9HG2lBq7z1XbfnvJwZuKibW5tFQQko35kY5l7Blp mdDFXjtOoM1MW/RONlruZjOqCEne/s+SLjU5zoA9T9VPOGFpa+kEwpG/uk5+qOlZgmp7 AJMA== 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 jg20-20020a17090326d400b0017486813f81si4234767plb.528.2023.01.27.03.44.27; Fri, 27 Jan 2023 03:44:39 -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 S232494AbjA0Lle (ORCPT <rfc822;lekhanya01809@gmail.com> + 99 others); Fri, 27 Jan 2023 06:41:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233865AbjA0LlK (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 27 Jan 2023 06:41:10 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 19C1C20D28; Fri, 27 Jan 2023 03:40:43 -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 62808169E; Fri, 27 Jan 2023 03:40:59 -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 D96673F64C; Fri, 27 Jan 2023 03:40:14 -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 10/31] arm64: Create a realm virtual machine Date: Fri, 27 Jan 2023 11:39:11 +0000 Message-Id: <20230127113932.166089-11-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?1756175929353532381?= X-GMAIL-MSGID: =?utf-8?q?1756175929353532381?= |
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> Set the machine type to realm when creating a VM via the KVM_CREATE_VM ioctl. Signed-off-by: Christoffer Dall <christoffer.dall@arm.com> [ Alex E: Reworked patch, split the command line option into a different patch ] Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> --- arm/aarch64/kvm.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/arm/aarch64/kvm.c b/arm/aarch64/kvm.c index 25be2f2d..5db4c572 100644 --- a/arm/aarch64/kvm.c +++ b/arm/aarch64/kvm.c @@ -131,12 +131,15 @@ int kvm__arch_get_ipa_limit(struct kvm *kvm) int kvm__get_vm_type(struct kvm *kvm) { unsigned int ipa_bits, max_ipa_bits; - unsigned long max_ipa; + unsigned long max_ipa, vm_type; - /* If we're running on an old kernel, use 0 as the VM type */ + vm_type = kvm->cfg.arch.is_realm ? \ + KVM_VM_TYPE_ARM_REALM : KVM_VM_TYPE_ARM_NORMAL; + + /* If we're running on an old kernel, use 0 as the IPA bits */ max_ipa_bits = kvm__arch_get_ipa_limit(kvm); if (!max_ipa_bits) - return 0; + return vm_type; /* Otherwise, compute the minimal required IPA size */ max_ipa = kvm->cfg.ram_addr + kvm->cfg.ram_size - 1; @@ -147,7 +150,8 @@ int kvm__get_vm_type(struct kvm *kvm) if (ipa_bits > max_ipa_bits) die("Memory too large for this system (needs %d bits, %d available)", ipa_bits, max_ipa_bits); - return KVM_VM_TYPE_ARM_IPA_SIZE(ipa_bits); + vm_type |= KVM_VM_TYPE_ARM_IPA_SIZE(ipa_bits); + return vm_type; } void kvm__arch_enable_mte(struct kvm *kvm)