From patchwork Sat Oct 2 12:53:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12532087 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89FD8C433EF for ; Sat, 2 Oct 2021 12:56:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2DDE161A51 for ; Sat, 2 Oct 2021 12:56:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2DDE161A51 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:59710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWeYb-0003k2-Cy for qemu-devel@archiver.kernel.org; Sat, 02 Oct 2021 08:56:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33086) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWQ-0000pl-Gb for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:53:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45039) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWeWP-0000eB-0N for qemu-devel@nongnu.org; Sat, 02 Oct 2021 08:53:46 -0400 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= 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-197-LI-aGiA4MamwNBeYTy0WZg-1; Sat, 02 Oct 2021 08:53:43 -0400 X-MC-Unique: LI-aGiA4MamwNBeYTy0WZg-1 Received: by mail-wm1-f69.google.com with SMTP id 10-20020a05600c240a00b0030d403f24e2so3204588wmp.9 for ; Sat, 02 Oct 2021 05:53:43 -0700 (PDT) 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=qFnyfu5o5Of9xVEXWPNi7EywkXBsmGm8VwyvAzOo67Ckr0/SsMQZL8cZVn6q5RdO1x +gt4/D78jnfSbYqM8XFxaWwPPFBbVIFFYMyfH6/a64AmQlZOjM8DdE4XrxFRAYmyrDJX mSNGXROXZzwtZssA1SYWTL+l7pJcEwbvkV0yGSJvYjnYr85yvxAvTMj3RUvIJ2l3IX+h OHv/FKiF5/ebrfZAtfMnpCoR/kS3jybjnKkJHtWwWViRoIRnTOrPyW1VrDhHMsNb5b+z S5wcbH4LmOblAblXoPp8F5sJUS8iezHWZunX351a5x/ZlBuAe7lDXsjMPJFE+s9xmi4p wuUQ== X-Gm-Message-State: AOAM533jMHUlRg9Lo4WMZ+6/0AV25FPhS1cBg7JINvzbhv+o9mss5GOJ peScsUqTnTZbb8wpb5qtIiluXzDUpDqZB1vwP5iagPjKB/n63Z8S9uj2WtZkT/65kdzHeJv2DeY lr5hLKcFYW3mJZron0hJEf/CrXaNmLlNSgQiC62pR+GtLENrKq/0kmNfzSrQ5gq4M X-Received: by 2002:adf:b19b:: with SMTP id q27mr3023141wra.125.1633179222070; 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brijesh Singh , kvm@vger.kernel.org, Sergio Lopez , Connor Kuehl , James Bottomley , "Dr . David Alan Gilbert" , Dov Murik , "Daniel P . Berrange" , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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": 4294959104 } } { "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": 4294959104 } } { "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é --- 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_hdr, 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;