From patchwork Mon Nov 25 19:56:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 845363 Delivered-To: patch@linaro.org Received: by 2002:a5d:688e:0:b0:382:43a8:7b94 with SMTP id h14csp1396466wru; Mon, 25 Nov 2024 12:00:55 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUTS5jdFqGGe00CyQ019IRuspCR3VaO2ENvnwPbWH1L6sN6n9fpu/e1KQSU3csAiG1Bb0lRhg==@linaro.org X-Google-Smtp-Source: AGHT+IFvCPWDTwTa1JAP6gECXKqzScVXb8reIvmh57GrN7ZUaipHEljFWEjaO/94EPLHAPzqCFuJ X-Received: by 2002:a05:6214:5194:b0:6cc:2ba7:7f7b with SMTP id 6a1803df08f44-6d450eed83fmr260274466d6.28.1732564854696; Mon, 25 Nov 2024 12:00:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732564854; cv=none; d=google.com; s=arc-20240605; b=SVQGWb4EjbxAtKJZF+jB2CeAagnkC85X3ts1DWH/r1hncj9bLh0ewqrqkfM/cXIDCl YcKyCBnRbs6xKJ2f1/cZ2MJ7Hb3nhuFmwbdWwgVcwEFj5Q0sxi01ZfIVWj8X0I1N3WYM qmg59jDYSGRljq/qzt+yY8h08QK5jDc3BlX+uOP7HVJTbplObFLClDqp4VK0vMGEfz85 w6cm6R9ME2rcHmqQavCQKRWAPJrhWDE7G8WJMCfBHTN/TDXTSw9DkpezdLezwwJxUFLq 4YPB9uLXXy6yoacqg8q99pLT8FFspGKsKXvMp4MejmLaVrVP1Kj5Zkddx9sp4fUVgCMM b9kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=yDanRZ41COf9qTLckEjQq0Cl2uY26nz9MVJ4DyeUoVM=; fh=2Hwj30IavQYerIc4V7CULN9ouvlJ7ncz+UVetdwShGU=; b=Ps3mzwx0kvP0VW2C/FHSRTfOwZWZeOpsr1e/ikv4Qzie5ZZEiNSio1gn98FAmUWc7B FJlw9vepHnTNrb46O11X+iNynqBMZrgSpfu4G6FK5b+fuPn74O8r/+xm+D5JLxNurybu oSCQHXxbLw0t7xl4g82nCY8VMcKlzc9sz/JwXN2/YkxssXUXfoHLfQofQ56WU0lh3ATk IzX07qns+foM2ziCjBcq0dtfc1E29X0srthJxhc037ETrNmfDpI9PO2uiNibiI3wqo2A UzJoU9KlJATrTFRv8vYgPg3oPBFRHI8XapQm/sCSecCL82pHMYhcQdsOCdum2o7YQ6Y9 jWhA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VJHX0HGJ; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d453ac0711si92764786d6.55.2024.11.25.12.00.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Nov 2024 12:00:53 -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=VJHX0HGJ; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tFfFB-00054K-9o; Mon, 25 Nov 2024 14:59:37 -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 1tFfF9-00052p-Sb for qemu-devel@nongnu.org; Mon, 25 Nov 2024 14:59:35 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tFfF1-0004l5-9E for qemu-devel@nongnu.org; Mon, 25 Nov 2024 14:59:35 -0500 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-3823eb7ba72so3268774f8f.0 for ; Mon, 25 Nov 2024 11:59:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732564766; x=1733169566; darn=nongnu.org; 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=yDanRZ41COf9qTLckEjQq0Cl2uY26nz9MVJ4DyeUoVM=; b=VJHX0HGJZjNb/XMsFd5ekMy9rTvVVkt916sSD+zMBip8zyplIi6chAxbbfWv6uWbS1 0mang6Q9Yw3iBpZxiqnYjVIfl7OMZd0R+yHAbLM6TIERvaQXMfTPA2h5982rqyOxKFFf GY2BQwICkHiLwkMroRZtkqcdw97qLHKRaek/bkD53IT8YhT/gA04uwTWd38/VXWMVpwM JMV+oBx690NK32jXVZkPdSRFa5unx5pJOu6hDd2DtnVXWo0O7iit68v4fkaSA1rT1GUW qPNRX5+uDCfZS06F0r9NcfJbCDPbfq3srzq8fiJqMysu2EZ760voE+NMFaRUngRJWTVD FqZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732564766; x=1733169566; 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=yDanRZ41COf9qTLckEjQq0Cl2uY26nz9MVJ4DyeUoVM=; b=Cg5UIzeezoE6ZS43LgUW4i2z8DQq8xZYEnIviKCNSVEmMWkTkYQz0JtE5fBlxpE82B flIR9PuMGDl4Tjo3DJtlTDI3iVG31/zvgyHy34V8f9V6w6iZigCE77+gc3tIvruEk83Y Sv7QzdgLqwZ0kDGObqnIYYpgWQFiJ65qXDWGc85OoVExU0xOiBvNvWFrf0o5IVIxzBFq zd/+F4k6L4N/OBRewX2YMgV8AVq6qv8zn2ES63eF86UR1iH79BZt4u2PFIRYU0+/2R2p UZWFjr+nETrTe5+gwy7H3n0e72ILtUn+gENg2cGB5UZMx2FvHcEbpykswOwTAl57QMLK zeLQ== X-Forwarded-Encrypted: i=1; AJvYcCVbZeZS3G6HDgB65j43YMfK4Q9cieLQ2w5TKi8DyTFpkifUCs+I16+G8YEa4mxMRf2MfedCPgg//6tI@nongnu.org X-Gm-Message-State: AOJu0Yx8XYiolIjRDaQN80PEyzvynPFwpuBfBgaXvNZnAPkI5J+MFvT0 X2UuP+5pRNLB3/IFg3Pe6GeeaMTdPRogalUJtoauhUFxuyM/onUPb8KiLqkIfBk= X-Gm-Gg: ASbGnct7YCDEi/cfGbn2ejSCTu4B4R1CqFQjKpOFuXxDkzNhs657UkKDn9Z+15FInyd 04wJYeQq19OSPu3VhHFargHNmKD+DnTTCW/M99C0xygYsCC36HkN6RiM1QF4XgMNBz5uN8ZsOwo gy0hiq6CLZ20LXXnuTE5v6R9RC+c28s9uR8TTDyg0MR/picpZKggjs3bEEsXlK2EaqIxhFm4bBV SmyhF9HRhLOWPB95tSzM97tdU+Si5qOEkouyYMbU7fynjJgAZbPlzR/QlX5OEYzrrOL X-Received: by 2002:a05:6000:2d08:b0:382:50d9:bc7c with SMTP id ffacd0b85a97d-38260be6bfamr7331620f8f.58.1732564765799; Mon, 25 Nov 2024 11:59:25 -0800 (PST) Received: from localhost.localdomain ([2.221.137.100]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3825fd0fbdcsm11237971f8f.109.2024.11.25.11.59.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Nov 2024 11:59:25 -0800 (PST) From: Jean-Philippe Brucker To: peter.maydell@linaro.org Cc: richard.henderson@linaro.org, philmd@linaro.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org, alex.bennee@linaro.org, Jean-Philippe Brucker , Eric Blake , Markus Armbruster , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost Subject: [PATCH v3 02/26] target/arm: Add confidential guest support Date: Mon, 25 Nov 2024 19:56:01 +0000 Message-ID: <20241125195626.856992-4-jean-philippe@linaro.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241125195626.856992-2-jean-philippe@linaro.org> References: <20241125195626.856992-2-jean-philippe@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=jean-philippe@linaro.org; helo=mail-wr1-x430.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=unavailable 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 rme-guest,id=[,options...] This is only the skeleton. Support will be added in following patches. Cc: Eric Blake Cc: Markus Armbruster Cc: Daniel P. Berrangé Cc: Eduardo Habkost Acked-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Jean-Philippe Brucker --- v2->v3: remove some boilerplate with OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES --- docs/system/confidential-guest-support.rst | 1 + target/arm/kvm-rme.c | 40 ++++++++++++++++++++++ target/arm/meson.build | 7 +++- 3 files changed, 47 insertions(+), 1 deletion(-) 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/target/arm/kvm-rme.c b/target/arm/kvm-rme.c new file mode 100644 index 0000000000..67909349c1 --- /dev/null +++ b/target/arm/kvm-rme.c @@ -0,0 +1,40 @@ +/* + * QEMU Arm RME support + * + * Copyright Linaro 2024 + */ + +#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) + +struct RmeGuest { + ConfidentialGuestSupport parent_obj; +}; + +OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES(RmeGuest, rme_guest, RME_GUEST, + CONFIDENTIAL_GUEST_SUPPORT, + { TYPE_USER_CREATABLE }, { }) + +static void rme_guest_class_init(ObjectClass *oc, void *data) +{ +} + +static void rme_guest_init(Object *obj) +{ +} + +static void rme_guest_finalize(Object *obj) +{ +} diff --git a/target/arm/meson.build b/target/arm/meson.build index 2e10464dbb..c610c078f7 100644 --- a/target/arm/meson.build +++ b/target/arm/meson.build @@ -8,7 +8,12 @@ arm_ss.add(files( )) arm_ss.add(zlib) -arm_ss.add(when: 'CONFIG_KVM', if_true: files('hyp_gdbstub.c', 'kvm.c'), if_false: files('kvm-stub.c')) +arm_ss.add(when: 'CONFIG_KVM', + if_true: files( + 'hyp_gdbstub.c', + 'kvm.c', + 'kvm-rme.c'), + if_false: files('kvm-stub.c')) arm_ss.add(when: 'CONFIG_HVF', if_true: files('hyp_gdbstub.c')) arm_ss.add(when: 'TARGET_AARCH64', if_true: files(