From patchwork Fri Jan 27 15:07:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 647501 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp875769pvb; Fri, 27 Jan 2023 07:17:42 -0800 (PST) X-Google-Smtp-Source: AMrXdXtmM3td3I55mr05eovhvWlUWlE5hEA4+zTKjd4MvC3FXtKXRQtszk+lpPjK+LLrNKJ/hBVa X-Received: by 2002:ac8:468c:0:b0:3b6:9d45:941b with SMTP id g12-20020ac8468c000000b003b69d45941bmr35436503qto.59.1674832662339; Fri, 27 Jan 2023 07:17:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674832662; cv=none; d=google.com; s=arc-20160816; b=W21jOWKPRScswxD5AzFgL2EmujyHacRT4BnXSuLpiVGNRhgJBway0S879r0HgfgK9O 46FoOrXVFaA0OjosWVBkBpc+X8/L69GXv49utH06Da3OihZLVqbWGQpqQmrE+zTxuNTm sRuqnpbyo+rFyqdeQQlOFkvbrrLU7tkI0lFr9GEyC/nefZ5gRKMw8x+9HVXAOxx5uhut RF2w5zLaK9pxhaVRSwM7QVGqW12Twfa/rLmVKeTetMYXdpHk+PG09w/R9phK20oq2cjx I17NU6Lc/M9tvgnVlcUpe2JrS/RuoBkfzvTJkkPedKn07O3jY8QqfFPDzOL0JVKeBtH0 +jbQ== 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=iUGz5LpQ3EDL/VJ3l1j+YJ+y/POf2GoDlmEHrO+uK2A=; b=S9DyMwYV3CbV9dWSTMosCfrHi96g3ODW+ZKFcHaaq8nNtlD+F2osZ1DjQ/EtkRIEZZ vgWC6xgeEsX1fFqYNPjvrMvMqIMoIc5EY5tOHrSzU6q4IvIl1MEdrV/4YlRVtkZ22fIh cGK9pfp1iDM65EsZfXQusVzefJUWMSZ7hLPE+ErW23/yeEizXFQyc2sy5Dw43uIqcPPc +W5AqK2V595L7lybVhZZJr8SB/zmhk7mMUuOyCgYPGSrLGZXrv7kT4/2VclkT7lLca4H lElDGv6PEnnk08LenF/3PMEhJiPx7DpFNCniy2f3AXl7S7tBnBxMNq5AxonXRIDhqQ5z C2tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wXyJZGPR; 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 13-20020ac84e8d000000b003aff7f4f8e2si2600519qtp.235.2023.01.27.07.17.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Jan 2023 07:17:42 -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=wXyJZGPR; 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 1pLQSo-0006ao-7Y; Fri, 27 Jan 2023 10:16:28 -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 1pLQSb-0006Qt-Fg for qemu-devel@nongnu.org; Fri, 27 Jan 2023 10:16:13 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pLQSX-0007lL-3f for qemu-devel@nongnu.org; Fri, 27 Jan 2023 10:16:13 -0500 Received: by mail-wm1-x333.google.com with SMTP id j36-20020a05600c1c2400b003dc39cb9c33so1342911wms.1 for ; Fri, 27 Jan 2023 07:16:08 -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=iUGz5LpQ3EDL/VJ3l1j+YJ+y/POf2GoDlmEHrO+uK2A=; b=wXyJZGPRtmBDbVtTRWtQpdOWsoVhXY8Xn/2X3IF+mR+L8+eJcOAYqOy6PKvxnuh9hk SxHS1tLb37F0Neh5H+FgpqZ65Yhgxf8rpEwVVY6SrVhyhdBmq8hP1ptHr9+BhGB+Br1J /5sitb2htqalTdGWN06JCHHi5gSusbW3f+kMP30VIYea0vk8Nqo/nGBt+LKDW+sEBekB VF4Fy6oK1OEbWiW3hz/59KN78yVAVtg45HuttMnOhGVOkwWDfx0v1TBs0W5ULmIjyRhq QDJ1J8nEe1bCqoN8pN9uaYbG0pWFOQtuvrneRYL51xiad/t+yNWFxCSycrLCWTXBfF7Z QVDQ== 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=iUGz5LpQ3EDL/VJ3l1j+YJ+y/POf2GoDlmEHrO+uK2A=; b=Umeu4SiLgZrUNj9pJgm0BC3JjdW4o9KyjQxnelmk28vOo8ZQzwDTNihI9bEH8Zjpx0 NW4JZO7zs11XbufzKaQGGAyJy0f+D4xDVWhvCxXQmvU6WcO47WjUwv+/GbH10mfVcR0l Vd7ye9Q9dorrfIiNle+kyDzc8+PLi4k3puJ+lJgX+j1CHX5DZO6ddbla7G5iFAqp8LhB ERvrVL1GXiwOMBqMbsnZvWtc8fH67vErNVMKy1crZxKd7JXF2yXxLZHO0S1zzwmamWoe qYieYuQsn9SS16keQkEBKzq3ia82E8OtY8T/N/ox04gCfigJ+eNUIGrlu9RucLOE9Hoi 12hQ== X-Gm-Message-State: AO0yUKUYloGe+Z48Cnxg01n4rZpDB0LGs0aKJZodskbDXriWpXsOFi9w 5YUjyknYQMlpnLFTuBqYLToQ5w== X-Received: by 2002:a05:600c:198d:b0:3dc:1031:14c4 with SMTP id t13-20020a05600c198d00b003dc103114c4mr14786447wmq.14.1674832567445; Fri, 27 Jan 2023 07:16:07 -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.16.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jan 2023 07:16:06 -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 15/16] target/arm/kvm: Disable Realm reboot Date: Fri, 27 Jan 2023 15:07:28 +0000 Message-Id: <20230127150727.612594-16-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::333; envelope-from=jean-philippe@linaro.org; helo=mail-wm1-x333.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 A realm cannot be reset, it must be recreated from scratch. The RMM specification defines states of a Realm as NEW -> ACTIVE -> SYSTEM_OFF, after which the Realm can only be destroyed. A PCSI_SYSTEM_RESET call, which normally reboots the system, puts the Realm in SYSTEM_OFF state. QEMU does not support recreating a VM. Normally, a reboot request by the guest causes all devices to reset, which cannot work for a Realm. Indeed, loading images into Realm memory and changing the PC is only allowed for a Realm in NEW state. Resetting the images for a Realm in SYSTEM_OFF state will cause QEMU to crash with a bus error. Handle reboot requests by the guest more gracefully, by indicating to runstate.c that the vCPUs of a Realm are not resettable, and that QEMU should exit. Signed-off-by: Jean-Philippe Brucker Reviewed-by: Richard Henderson --- target/arm/kvm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/arm/kvm.c b/target/arm/kvm.c index d8655d9041..02b5e8009f 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -1071,7 +1071,8 @@ int kvm_arch_msi_data_to_gsi(uint32_t data) bool kvm_arch_cpu_check_are_resettable(void) { - return true; + /* A Realm cannot be reset */ + return !kvm_arm_rme_enabled(); } void kvm_arch_accel_class_init(ObjectClass *oc)