From nobody Mon Feb 9 16:12:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1633179225; cv=none; d=zohomail.com; s=zohoarc; b=G7jjjZX32jrnHUQ3GGOSO6+VG88hzfw36Ixb2dWO7wt5znIIduDtvabeci0e1J8IB5AnU0ovYTj9jQC6BL3UXeWy7u+1+hgQhFNyHIrciNBS81XJjRM0yPbmlo2Q7Gy/9tijF6NLW/Gp/PefT6V5ApxMuA3JKruF7LkyHtO+YEg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633179225; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=l2pfbYxP1f86zn1O+UmnIVR/OdXuADklhW48W/+4agE=; b=X+LUKCK/LKiKWyQG4dzfxRkI5TGguebE+Un4425Cgn0DBKWDYjHIVAHHnsU5+lR0sjbY6wGf8lS0uAG5puywi5IKagdp7DjFKuF4SazekYCeMw9N8K4zMJjjKEokPdjcs3l7yHgeEkFPCq9C5meGaL9OVge1RnLbr3pWt004fYU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633179225204926.0231205991621; Sat, 2 Oct 2021 05:53:45 -0700 (PDT) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-367-9LIFfTulOcSgohn_JfJSEA-1; Sat, 02 Oct 2021 08:53:43 -0400 Received: by mail-wm1-f69.google.com with SMTP id r66-20020a1c4445000000b0030cf0c97157so6084764wma.1 for ; Sat, 02 Oct 2021 05:53:42 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id l21sm1643231wmg.18.2021.10.02.05.53.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:53:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179224; 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=l2pfbYxP1f86zn1O+UmnIVR/OdXuADklhW48W/+4agE=; b=a3wrPNUsBVuFSd39Ry5BR29l1bW+jcDy5QBt08URukX0JGgIkzXeWJrWzxncBvMAbMCQNK nNx5S92KP1jCFXOCFsHEIrFWTGRXNiKjWOV1bRGXsa/x+AGEOqI0g7wAUIc2/iZF27Rx8v 5HPsJCE+J5IVaEI3zdZwixgEnjmT8pU= X-MC-Unique: 9LIFfTulOcSgohn_JfJSEA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l2pfbYxP1f86zn1O+UmnIVR/OdXuADklhW48W/+4agE=; b=AFneEQW/vwzl8l0s+8EtJWO735zqTvDPPriA3VgoEa2FAI9kqGWEKIi4t9R15/sOez aOUDtzHMYMBHbzIPHONuebJsWgjveRk2/w44BW9I9SUq96kx3EF/pHdgJrsz+4zzJroD drhFCjZnZ/HrmGR/Ch7WoQlHr6nOXDZbIGg+kAlskJGrP+/tIv7kK32Eynv/mTO8HKEA 8oTZG/QQd5SjXcLZ1TKnloPzo260WNPs06l0gOUJ5u6jJ0ELQ+RULM1pDbBCyuJoZYjZ bOrn3wJZplFoMh6oY1c4rE3MQNRn5JYJ6EEXNU6FPHsN/MjbjfA4eFyEfsbVjN+6gT/3 Nk/Q== X-Gm-Message-State: AOAM531NfRYDQSG421c5FPEABifJtyM2DgvMeOHdqC1AppjGayvgTVka NY27Rsv/raX+2uOlGFAoNLqGBgn/+YQ+V6gxTEv2AF5IriKjVs6C61QUfixErb7zUYaskbmpsLc D/e8UPFJ76cB5cQ== X-Received: by 2002:adf:b19b:: with SMTP id q27mr3023136wra.125.1633179222032; Sat, 02 Oct 2021 05:53:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0wFJ6jOD1dsu7MobrHxWDwOimiCMUGE3Wc9F0Vh2YBeD1QDrYkdFU3s2oEYQ/eTvQ2tlbQw== X-Received: by 2002:adf:b19b:: with SMTP id q27mr3023109wra.125.1633179221880; Sat, 02 Oct 2021 05:53:41 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" , Connor Kuehl Subject: [PATCH v3 05/22] target/i386/monitor: Return QMP error when SEV is disabled in build Date: Sat, 2 Oct 2021 14:53:00 +0200 Message-Id: <20211002125317.3418648-6-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211002125317.3418648-1-philmd@redhat.com> References: <20211002125317.3418648-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) X-ZM-MESSAGEID: 1633179226722100001 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 196c1c9e77f..a9f85acd473 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" @@ -743,6 +744,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