From nobody Tue Feb 10 01:15:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623876240; cv=none; d=zohomail.com; s=zohoarc; b=IWUcVZMFyeaXkBVgMEGrkFGS57CeudrtCish0hermAGS5lX5c2fZ9/uEWBFtwIZQCuIJU86s/tdFxkJ3686WZT8dWk1IQ7hgWb8Z+xV++25Q7F6F0u/I2otSxu1uYYmbPrz2TbfJ6FSDGQIKLivRPBxK1vvqZeghfhumhW8Ow14= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623876240; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=y+XSms8lsmaWxWcSMyaabFLhR1SIAMwTYvlPcGQF/+0=; b=TYaVDQKQlnu9ak6T08d8p3Hrtn2MyPAUODlgr/kw8QTiEgTjR760dtsz9wMShK18rWb6TXwOL9RxcD3NdCgJ1DPWnP1c7xEK72vFy0Cv1iapwqWydhbkYNNIfCQrxL7u4ufoMMEyz6Ehkk7kMlBA0/cYVOlZaMgD95uL7CfhAek= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1623876240577713.6695077074995; Wed, 16 Jun 2021 13:44:00 -0700 (PDT) Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-538--RQH8F74MwKR2Uc9nSAJXA-1; Wed, 16 Jun 2021 16:43:56 -0400 Received: by mail-wr1-f72.google.com with SMTP id e9-20020a5d6d090000b0290119e91be97dso1874313wrq.1 for ; Wed, 16 Jun 2021 13:43:56 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (93.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.93]) by smtp.gmail.com with ESMTPSA id k11sm5887058wmj.1.2021.06.16.13.43.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 13:43:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623876239; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y+XSms8lsmaWxWcSMyaabFLhR1SIAMwTYvlPcGQF/+0=; b=GvGduTrbTwqIGNbX5/IIxmZWLeAj1QkDfNY+AhThH3Zeyu4b27OVANjrZmlCA47WvHxiYl Vi/MjMmJZOeXk+gCIkXPcT/cOKgej8PGSyNz3k1ZptIkXJneT4y4ykvTzoTjJTWpd/QARA Hav6JPHlBopx6RrkgX0GKstYULjWoAk= X-MC-Unique: -RQH8F74MwKR2Uc9nSAJXA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=y+XSms8lsmaWxWcSMyaabFLhR1SIAMwTYvlPcGQF/+0=; b=Amyjx/cJsJNQoZ//9e/CRRwnOtcU5/4W39vSOyVTiEY4SExlmbmmZDppj379DHBFLK 7s7hi5MtmvTFq8wb20fZRk7r2rWgtKWXov2HdpdQUwYDQ1p0Dnp20uQJv9P9Sq//A4hH QwSlBSPOayMGtOREJnbz+i5aJPn+xgOZ5hp6X2OYh48kvDG0rsMTTSTamYlCozlPMD2c sw+FbB72hr0y9CL+XzgcQn0hWj4wUMHx8thGoMwGdqSWhBBqxmYiPa9Eoly6JH/Uh2kU MON2fsaIKZD9pYaQ12YcbVVviBgR6eRpPQioh3wX/2kYuEAlYq6by8bF0ldZcqD5ol7+ t8Pg== X-Gm-Message-State: AOAM530R3ROHP8g/5PnFWsj6O3rC8XHIkuxfkBuPY1KolrGBHCIhFG66 Kxzklk0nbNytnKSvJ9XRFBn0iyTYeiDIIug1IaMo5uD2/GXT4CZVlF3HxJFwkr2JF5GetYwUsHJ mlK6/EpWFCALYQA== X-Received: by 2002:adf:d227:: with SMTP id k7mr1128718wrh.271.1623876235237; Wed, 16 Jun 2021 13:43:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCFjv4rL99lSTphSmutBg0e/eHY24V0R7vvtUv4PPiA85ngHRUEZlvcC1MGBknBDMOlyPo3A== X-Received: by 2002:adf:d227:: with SMTP id k7mr1128695wrh.271.1623876235124; Wed, 16 Jun 2021 13:43:55 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Paolo Bonzini , Connor Kuehl , Gerd Hoffmann , Brijesh Singh , "Dr . David Alan Gilbert" , Eric Blake , Eduardo Habkost , Markus Armbruster , Igor Mammedov , James Bottomley , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Sergio Lopez , Marcel Apfelbaum , "Michael S. Tsirkin" , Laszlo Ersek , Dov Murik Subject: [PATCH v2 04/23] target/i386/monitor: Return QMP error when SEV is disabled in build Date: Wed, 16 Jun 2021 22:43:09 +0200 Message-Id: <20210616204328.2611406-5-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210616204328.2611406-1-philmd@redhat.com> References: <20210616204328.2611406-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) If the management layer tries to inject a secret, it gets an empty response in case the binary built without SEV: { "execute": "sev-inject-launch-secret", "arguments": { "packet-header": "mypkt", "secret": "mypass", "gpa": 429= 4959104 } } { "return": { } } Make it clearer by returning an error, mentioning the feature is disabled: { "execute": "sev-inject-launch-secret", "arguments": { "packet-header": "mypkt", "secret": "mypass", "gpa": 429= 4959104 } } { "error": { "class": "GenericError", "desc": "this feature or command is not currently supported" } } Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Connor Kuehl Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/monitor.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 119211f0b06..c83cca80dc2 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -28,6 +28,7 @@ #include "monitor/hmp-target.h" #include "monitor/hmp.h" #include "qapi/qmp/qdict.h" +#include "qapi/qmp/qerror.h" #include "sysemu/kvm.h" #include "sysemu/sev.h" #include "qapi/error.h" @@ -742,6 +743,10 @@ void qmp_sev_inject_launch_secret(const char *packet_h= dr, bool has_gpa, uint64_t gpa, Error **errp) { + if (!sev_enabled()) { + error_setg(errp, QERR_UNSUPPORTED); + return; + } if (!has_gpa) { uint8_t *data; struct sev_secret_area *area; --=20 2.31.1