From nobody Mon Feb 9 11:30:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1633623470; cv=none; d=zohomail.com; s=zohoarc; b=YPh+qZl9Zsijon/BMRMZJJtuxaq+ld+jhWL5E1Q/SdKDqdzgHkH7aaG4fx2VRS3KUjgjCX92xNkDZRR6e947QEmDELXFqD2XsMusNdhz2HNK3vbZAdSkg6PQJakySaYOQeABdPv4OhiUqYTL/MIzG/bJ//4xFWL/2TwgfzMOEh4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633623470; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=o9lSbhoBJitVWDueMdjjLMLVkRSyu1rE4Rg4emr9Ei8=; b=Z2bbJUtIXJilkkhOBSqmXA4Ta30kWrBjaDq7wQZRkaHRwox57XW0Vau6ig/oWYmC/gWh/TVmSPIbT2nUj3UB2nq9wXbQ5N9mH23c3UqaVKpfg08TonGfkatyF8kT3r2LsrNZG6kqUtlfyXdliTxs0a+7MxOPL4Z0QIMYHVPh5pk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1633623470340754.4193602853262; Thu, 7 Oct 2021 09:17:50 -0700 (PDT) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-43-cB0LOtu-NraVin1n1guCJw-1; Thu, 07 Oct 2021 12:17:47 -0400 Received: by mail-wr1-f71.google.com with SMTP id 41-20020adf812c000000b00160dfbfe1a2so1450360wrm.3 for ; Thu, 07 Oct 2021 09:17:46 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id x15sm51076wrl.74.2021.10.07.09.17.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 09:17:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633623469; 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=o9lSbhoBJitVWDueMdjjLMLVkRSyu1rE4Rg4emr9Ei8=; b=LKGWtvBY357RpRJt3l25M0pN2JPgk3OFjogVrGp6s3NzAPfOl/DitfTD7GntS6mNPQe4dd 0HhY8zSN3SFHv2Yo7iyjBNalX6LCR1l2/qH+1gKCFw5iXgtcjn26nBD6p5IF9r0L9Ud+sF KaoxjR1XSuzxPsAlCA8frRiMhEOd9xc= X-MC-Unique: cB0LOtu-NraVin1n1guCJw-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=o9lSbhoBJitVWDueMdjjLMLVkRSyu1rE4Rg4emr9Ei8=; b=vWnaSwAK4Yb3b92b3n+qsG2ME28VcE0AwbqAUSczX5FFg1qCKmfKFMtOgRqJRTCaYK 9V6CFc6JhgJhT5TsxrLNpTf3ToNuMmiRvSmQlIDDEiobutmbKNXVl2YZYcRhnWzXn1wn /fVykwjIRo2srqklr2UMNHclmeIHXjyCUf0GI258/uUDyS8MX0nG9svQeQEac46eA0IF /fuesAvZZDjK1j07g7w5wSxgx9n+mnR87I2xuMJMmd0jhTCRULreeMEldD3gmkzEwnuZ W4H6dUzfVlVKBcbX5D1D0NIsX/PvRZPdNJp9FfCviODOUrv4TtVv0+/YCNyxvZd0I4uP SlBQ== X-Gm-Message-State: AOAM532OE9jLmuQC8chv9j+AHXBYQflVZAuXwInLMhaT2D/8GTLUk1t9 uZRUniH3bvVHRAq1kCynVnzQoymKvc4q/oQxEVUVmhPAcAibvLw2bU1Ym3ZTVfPQOLi6aD5Vjbg BR8T0i9D9x8cGkw== X-Received: by 2002:a05:6000:550:: with SMTP id b16mr6795183wrf.297.1633623466017; Thu, 07 Oct 2021 09:17:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnfMiJdq3t4lKJrJn6gn2ZgOjVVHTpcfnmUwoUkpuTzHD+tLUzVsylqOO/srQz9P+TjP4dcA== X-Received: by 2002:a05:6000:550:: with SMTP id b16mr6795160wrf.297.1633623465856; Thu, 07 Oct 2021 09:17:45 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , James Bottomley , Brijesh Singh , Sergio Lopez , Dov Murik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Connor Kuehl Subject: [PATCH v4 06/23] target/i386/monitor: Return QMP error when SEV is not enabled for guest Date: Thu, 7 Oct 2021 18:16:59 +0200 Message-Id: <20211007161716.453984-7-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007161716.453984-1-philmd@redhat.com> References: <20211007161716.453984-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: 1633623471383100001 If the management layer tries to inject a secret, it gets an empty response in case the guest doesn't have SEV enabled, or the binary is 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: { "execute": "sev-inject-launch-secret", "arguments": { "packet-header": "mypkt", "secret": "mypass", "gpa": 429= 4959104 } } { "error": { "class": "GenericError", "desc": "SEV not enabled for guest" } } Note: we will remove the sev_inject_launch_secret() stub in few commits, so we don't bother to add error_setg() there. 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 eabbeb9be95..ea836678f51 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, "SEV not enabled for guest"); + return; + } if (!has_gpa) { uint8_t *data; struct sev_secret_area *area; --=20 2.31.1