From patchwork Fri Jan 27 15:07:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 647506 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp876185pvb; Fri, 27 Jan 2023 07:18:19 -0800 (PST) X-Google-Smtp-Source: AK7set9vHODgy7EKZqxE0A/D0qnSEMcEr7C8KGb0akcgwLE+ESukdW8zuO19yP8ik3K9HzJJ98xk X-Received: by 2002:a05:6214:190f:b0:537:7c16:1775 with SMTP id er15-20020a056214190f00b005377c161775mr9560381qvb.44.1674832698866; Fri, 27 Jan 2023 07:18:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674832698; cv=none; d=google.com; s=arc-20160816; b=dxgrfKSEb+tg8gyxpOpXFyy0mtqf0YCslWuN+P4hmwvAn5abEjsVLHKha3Aic5009A 4o5WNKUPtN+cBCmAsZgTH/bfaESI4E5TfV/WR4CkLrng0964Aqq50hV1yIN/f5+c15On cLhuNI+LeZ3OltS7bEltjKXZIk3Olh1l53kkkF4UeqbEuEdzHc+623RP4SQ23+9VC9+X 9sF4yTkgOGk9hPS5SfdsjV48oPVUG6wryrlY7Ez/0UQTGmudK+ne+cD9bwkkp6/a0J6D uaFfQ6cyvvPfcGEdofNer9yRMkw67T2udBCQFzrV+AaGfNHfa10XF9P4dgjlJ0yaXQ2Z vgzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JRh6Zd7yURln8ss/3uCQjhMmHZdDScQS9IWz9tbNtyA=; b=I7B74RJRLAlO/rc9yQfpEKs3d9VkLbZbGwEAeW2oMlQQPwkHqj206+cS1Np7e8ZOsa t5OTPF13vhZf9pAakYVvwOgwRdmF0ZL+4ngT4NaIqq1WlIqlrjim7Pi00bRVoHg1X+JG 1tPsOVKyI7e8cSjt681o6foApITMDz4ekuHVQsOuMQ39ue2x9wfYpHN6qj4rX5+x4TR8 9dWqYqdDT5KVejJ3t/MriuVIwpqVqz0Fc5JoVbbkDOlO3Q50GGkrejQkQqaaVCHVDvmR xg4yX/c4oejR8qC8UnzNDET4xMp6S2BtFiJe+AjkwOYvJuXjpQoYzOc4yE0zKNlHYbgI 68lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i+rwphML; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id if15-20020a0562141c4f00b005355edfe2d4si3070527qvb.1.2023.01.27.07.18.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Jan 2023 07:18:18 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i+rwphML; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pLQSX-0006ML-UL; Fri, 27 Jan 2023 10:16:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pLQSQ-0006IO-Ap for qemu-devel@nongnu.org; Fri, 27 Jan 2023 10:16:02 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pLQSN-0007fg-JO for qemu-devel@nongnu.org; Fri, 27 Jan 2023 10:16:01 -0500 Received: by mail-wm1-x32d.google.com with SMTP id f19-20020a1c6a13000000b003db0ef4dedcso5621975wmc.4 for ; Fri, 27 Jan 2023 07:15:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JRh6Zd7yURln8ss/3uCQjhMmHZdDScQS9IWz9tbNtyA=; b=i+rwphMLjmk6oKkA4//+2PYmZu1Mp4iB0X/UeXL+mO1j7ppvC3/N5OleZvXaCFpb8Y 6V+6LplTd7bCbrbbn+Hs7672wVVfFYSVf174UQvJVI1DX/xwPHgT2zCYb9iORRpojyT9 p1uZ17Sk4wxcROQGWVYiTgYx/sflyph7lrtbT/16n/Df77V4gisFaQpUGpTConkVJbA4 diFewgZcJ7SWNO3vmT7+xJxcijmqU9SI85lHvzCpO44w4OvSTlUPJSb+KJ0MjSEx4mGx 9dLzvo706MpLNLZlyO+C/H3Sp1ZxSWl4VnqcS4mtkSxbABfuoYyRHZSzlbH5rR6SGaDw GxNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JRh6Zd7yURln8ss/3uCQjhMmHZdDScQS9IWz9tbNtyA=; b=YxcGjTQwusUXCRb+fJ3BsjZzXMrH/bFNEeyBbe+saRc4OtXNzoiz5TypEOIrHlVeAr i36QACKc3mNL1U95j9F5EbFVqHsyqn3UeluuL7a72qY9rbOq2yyLi3gxjYK2ebd6mKVO er00z0FXEqNihCdtnhj+I0DHPLgEByLCSd9kqJWs2zuH3Dhy9jN0z6oqC91QTNrJir34 aYwBw6LiW48RZ7+/hej6XMQPgd4Wx42szhzyjlsop6Wrv0wEklwNJtfBouTJkdeoelzP aPsqaMY0LkS+jw3r01Li/r6DQPMnEnGf0Njlfhs+O/1GpVRu1cXJDp7ZGEnfnEtZDJH9 6gGA== X-Gm-Message-State: AO0yUKVsVBF4CFYAfzYzOoKHbr3D8/P3SJN7edIUKzw+I3XG7iyetaAR rnzXZ2u/AYtmi9xNVdHu5jcqAA== X-Received: by 2002:a05:600c:3b82:b0:3dc:37bf:c634 with SMTP id n2-20020a05600c3b8200b003dc37bfc634mr2745999wms.15.1674832557876; Fri, 27 Jan 2023 07:15:57 -0800 (PST) Received: from localhost.localdomain (054592b0.skybroadband.com. [5.69.146.176]) by smtp.gmail.com with ESMTPSA id l7-20020a05600c47c700b003dc3bbdf518sm1656628wmo.21.2023.01.27.07.15.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jan 2023 07:15:57 -0800 (PST) From: Jean-Philippe Brucker To: peter.maydell@linaro.org Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org, pbonzini@redhat.com, eblake@redhat.com, armbru@redhat.com, berrange@redhat.com, eduardo@habkost.net, alex.bennee@linaro.org, richard.henderson@linaro.org, Jean-Philippe Brucker Subject: [RFC PATCH 02/16] target/arm: Add confidential guest support Date: Fri, 27 Jan 2023 15:07:15 +0000 Message-Id: <20230127150727.612594-3-jean-philippe@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230127150727.612594-1-jean-philippe@linaro.org> References: <20230127150727.612594-1-jean-philippe@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=jean-philippe@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Add a new RmeGuest object, inheriting from ConfidentialGuestSupport, to support the Arm Realm Management Extension (RME). It is instantiated by passing on the command-line: -M virt,confidential-guest-support= -object guest-rme,id=[,options...] This is only the skeleton. Support will be added in following patches. Signed-off-by: Jean-Philippe Brucker Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- docs/system/confidential-guest-support.rst | 1 + qapi/qom.json | 3 +- target/arm/kvm-rme.c | 48 ++++++++++++++++++++++ target/arm/meson.build | 7 +++- 4 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 target/arm/kvm-rme.c diff --git a/docs/system/confidential-guest-support.rst b/docs/system/confidential-guest-support.rst index 0c490dbda2..acf46d8856 100644 --- a/docs/system/confidential-guest-support.rst +++ b/docs/system/confidential-guest-support.rst @@ -40,5 +40,6 @@ Currently supported confidential guest mechanisms are: * AMD Secure Encrypted Virtualization (SEV) (see :doc:`i386/amd-memory-encryption`) * POWER Protected Execution Facility (PEF) (see :ref:`power-papr-protected-execution-facility-pef`) * s390x Protected Virtualization (PV) (see :doc:`s390x/protvirt`) +* Arm Realm Management Extension (RME) Other mechanisms may be supported in future. diff --git a/qapi/qom.json b/qapi/qom.json index 30e76653ad..7ca27bb86c 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -917,7 +917,8 @@ 'tls-creds-x509', 'tls-cipher-suites', { 'name': 'x-remote-object', 'features': [ 'unstable' ] }, - { 'name': 'x-vfio-user-server', 'features': [ 'unstable' ] } + { 'name': 'x-vfio-user-server', 'features': [ 'unstable' ] }, + 'rme-guest' ] } ## diff --git a/target/arm/kvm-rme.c b/target/arm/kvm-rme.c new file mode 100644 index 0000000000..22aa3dc712 --- /dev/null +++ b/target/arm/kvm-rme.c @@ -0,0 +1,48 @@ +/* + * QEMU Arm RME support + * + * Copyright Linaro 2022 + */ + +#include "qemu/osdep.h" + +#include "exec/confidential-guest-support.h" +#include "hw/boards.h" +#include "hw/core/cpu.h" +#include "kvm_arm.h" +#include "migration/blocker.h" +#include "qapi/error.h" +#include "qom/object_interfaces.h" +#include "sysemu/kvm.h" +#include "sysemu/runstate.h" + +#define TYPE_RME_GUEST "rme-guest" +OBJECT_DECLARE_SIMPLE_TYPE(RmeGuest, RME_GUEST) + +typedef struct RmeGuest RmeGuest; + +struct RmeGuest { + ConfidentialGuestSupport parent_obj; +}; + +static void rme_guest_class_init(ObjectClass *oc, void *data) +{ +} + +static const TypeInfo rme_guest_info = { + .parent = TYPE_CONFIDENTIAL_GUEST_SUPPORT, + .name = TYPE_RME_GUEST, + .instance_size = sizeof(struct RmeGuest), + .class_init = rme_guest_class_init, + .interfaces = (InterfaceInfo[]) { + { TYPE_USER_CREATABLE }, + { } + } +}; + +static void rme_register_types(void) +{ + type_register_static(&rme_guest_info); +} + +type_init(rme_register_types); diff --git a/target/arm/meson.build b/target/arm/meson.build index 87e911b27f..a2224c0d23 100644 --- a/target/arm/meson.build +++ b/target/arm/meson.build @@ -40,7 +40,12 @@ arm_ss.add(files( )) arm_ss.add(zlib) -arm_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c', 'kvm64.c'), if_false: files('kvm-stub.c')) +arm_ss.add(when: 'CONFIG_KVM', + if_true: files( + 'kvm.c', + 'kvm64.c', + 'kvm-rme.c'), + if_false: files('kvm-stub.c')) arm_ss.add(when: 'TARGET_AARCH64', if_true: files( 'cpu64.c',