{"id":2222184,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2222184/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260410195323.17937-24-philmd@linaro.org/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.1/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260410195323.17937-24-philmd@linaro.org>","date":"2026-04-10T19:53:17","name":"[v2,23/27] monitor: Do not check TARGET_I386 to build 'info sgx' command","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"91b10c164a144108847c7661b6f12708ccec4f42","submitter":{"id":85046,"url":"http://patchwork.ozlabs.org/api/1.1/people/85046/?format=json","name":"Philippe Mathieu-Daudé","email":"philmd@linaro.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260410195323.17937-24-philmd@linaro.org/mbox/","series":[{"id":499498,"url":"http://patchwork.ozlabs.org/api/1.1/series/499498/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=499498","date":"2026-04-10T19:52:54","name":"monitor: Remove need of per-target handlers","version":2,"mbox":"http://patchwork.ozlabs.org/series/499498/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2222184/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2222184/checks/","tags":{},"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=n8DmGKHl;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fsnf84M2Pz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 11 Apr 2026 05:57:52 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wBHxm-0008Rn-RZ; Fri, 10 Apr 2026 15:56:22 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1wBHxl-0008I3-0f\n for qemu-devel@nongnu.org; Fri, 10 Apr 2026 15:56:21 -0400","from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1wBHxc-00041D-VT\n for qemu-devel@nongnu.org; Fri, 10 Apr 2026 15:56:18 -0400","by mail-wm1-x32c.google.com with SMTP id\n 5b1f17b1804b1-488b0046078so24119855e9.1\n for <qemu-devel@nongnu.org>; Fri, 10 Apr 2026 12:56:12 -0700 (PDT)","from localhost.localdomain (88-187-86-199.subs.proxad.net.\n [88.187.86.199]) by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-488d531f2b6sm106301525e9.2.2026.04.10.12.56.09\n (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);\n Fri, 10 Apr 2026 12:56:10 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1775850971; x=1776455771; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=C78IbPBsz6cVs2Ym43RKAMokAYox7chDUSzKqZO66SU=;\n b=n8DmGKHlWSIX4ZQwbtlQ0+D23gzPAAiOsDkskPo8XxYh7NN2Tvrc5mjpylEeRTIdWf\n bHvJExa324wGjoLNN4cZJjZE+c7/NZqILob5JYIk7bJPmPYvZX+W3+riuu0PWKEhZuHB\n 1m9J8UMaGy91gZD1OCQTPKH006rUYUbB0zxQPSGdoX+Ntni236xs11cpgtZZdvYgDHi4\n DX/+y8GVknfROZXOb55OUmjKHqPo8dRns9RiMWx2KsRrzQzQhVCO8ant60gMpiPRqiej\n 9kYKSmSgJly5FLDf8UGV4nLhhRkbJaR5MYo58CjDOBIISqq382JHMxcbv8UmZ/dK6rzF\n xyrQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775850971; x=1776455771;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=C78IbPBsz6cVs2Ym43RKAMokAYox7chDUSzKqZO66SU=;\n b=m/s0JB7m0TQ46D0Y1uhsix0KraN7ztF6AUGbyhWPvItdVbxlKoFuWg5yVDEunsFmW9\n KaihLYKxsEeZKiOoJGHe2FulI3wWb746r53RBXAaM61OIuTyowUovjtAPy+AYCCrOrTg\n F+VCICwOEota4Dom8av6s4NCa9AZlCnluvQITyeBhihuGSU+e350Aezs8WYfUgROz9UF\n 2tyPaHhWeyOs+0Ty02zX3TLOvWpHi8wRj3OIP93e2MkgIcEqj+qyi7fhYUwKREjOSmYo\n 9fu2uYTYJgmCNt+/l7rkobMQ43MLe+S1BgEqpH8aDoDACH5qmO1RvgwPOVtDAMP9uVcI\n fLUA==","X-Gm-Message-State":"AOJu0YylXRrlFLIjUi2y0DbraBtp3rO13TDRGZL0pMNCjDN3prQ5rMJH\n OAANyun17CCMF2R26MAslLebMwDZNMOlBaX5pSMFtZT5Ir3QNnAy9AdwnlXkHYlCXJPTYNZ2ahO\n 0aBlD2CA=","X-Gm-Gg":"AeBDiesZAJnwrrSaytlm1KUymYjojuGF57i7ig8wGt8iKYC8zfKgAYrQbp/73zVq/by\n F00wq4pG2VpIYpqCoS3XI/bfCbseR+zlbQsKhMxXCr0ma8BXf8nJvusEXv6KoBefiyMJDyrgLnQ\n wPIIJMueOega0u0WJ9hH18QfUZY2e6lo1lxg0qhA845CE1cjR4x0D0y5a5Ss6uiqd6mGNVRejBH\n AqGm81Izvh2lDqTM/cV0RfItawxsI69Acz+/qFxGpAVVNuPfJck6KhM0NtqgDng9KFVqyC2O+/s\n mc51gkX7FCC0maWsmGHnQggrCz6mehAC/R/Xi7fESPA61mOoFFiYfyfkgJmG2OxT9MhV/XI5UFt\n DWADWH+2qO9WL5Foa1806HHWBW6jH5hdLTA/OznbsfozkvI0sY+n5YxPi5bh/lZ279EKFzSDOm3\n 39Ub/xXbGdJ3IpvZTsUJyEn69OIA4GC1NGpd28CnGbi7XiNqpBdyg9Bw5BQniUffzrv6WfAGZR","X-Received":"by 2002:a05:600c:45c9:b0:480:4a8f:2d5c with SMTP id\n 5b1f17b1804b1-488d689cf9emr52390385e9.29.1775850970618;\n Fri, 10 Apr 2026 12:56:10 -0700 (PDT)","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>","To":"qemu-devel@nongnu.org","Cc":"Richard Henderson <richard.henderson@linaro.org>,\n \"Dr. David Alan Gilbert\" <dave@treblig.org>,\n Pierrick Bouvier <pierrick.bouvier@linaro.org>, qemu-riscv@nongnu.org,\n Markus Armbruster <armbru@redhat.com>, qemu-s390x@nongnu.org,\n kvm@vger.kernel.org, qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud?=\n\t=?utf-8?q?=C3=A9?= <philmd@linaro.org>,\n \"Michael S. Tsirkin\" <mst@redhat.com>,\n Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,\n Paolo Bonzini <pbonzini@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>","Subject":"[PATCH v2 23/27] monitor: Do not check TARGET_I386 to build 'info\n sgx' command","Date":"Fri, 10 Apr 2026 21:53:17 +0200","Message-ID":"<20260410195323.17937-24-philmd@linaro.org>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260410195323.17937-1-philmd@linaro.org>","References":"<20260410195323.17937-1-philmd@linaro.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Received-SPF":"pass client-ip=2a00:1450:4864:20::32c;\n envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n 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":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"This command is filtered at build-time for i386/x86_64 binaries.\nBy using the recently introduced HMPCommand::arch_bitmask flag\nwe can filter it at runtime, making it possible to compile\nhmp-commands-info.hx once.\n\nSince the method depends on the CONFIG_SGX definition, define it\nin its own stub file.\n\nSigned-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>\n---\n MAINTAINERS            |  1 +\n hw/i386/sgx-hmp-stub.c | 16 ++++++++++++++++\n hw/i386/sgx-stub.c     |  5 -----\n hmp-commands-info.hx   |  3 +--\n hw/i386/meson.build    |  1 +\n 5 files changed, 19 insertions(+), 7 deletions(-)\n create mode 100644 hw/i386/sgx-hmp-stub.c","diff":"diff --git a/MAINTAINERS b/MAINTAINERS\nindex 458951bc051..31e973fdeb0 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -514,6 +514,7 @@ L: kvm@vger.kernel.org\n S: Supported\n F: docs/system/i386/amd-memory-encryption.rst\n F: docs/system/i386/sgx.rst\n+F: hw/i386/sgx*\n F: stubs/qmp-i386-sev.c\n F: stubs/qmp-i386-sgx.c\n F: target/i386/kvm/\ndiff --git a/hw/i386/sgx-hmp-stub.c b/hw/i386/sgx-hmp-stub.c\nnew file mode 100644\nindex 00000000000..cf1d9a6344b\n--- /dev/null\n+++ b/hw/i386/sgx-hmp-stub.c\n@@ -0,0 +1,16 @@\n+/*\n+ * Human Monitor 'info sgx' stub (CONFIG_SGX)\n+ *\n+ * Copyright (c) Linaro\n+ *\n+ * SPDX-License-Identifier: GPL-2.0-or-later\n+ */\n+\n+#include \"qemu/osdep.h\"\n+#include \"monitor/hmp.h\"\n+#include \"monitor/monitor.h\"\n+\n+void hmp_info_sgx(Monitor *mon, const QDict *qdict)\n+{\n+    monitor_printf(mon, \"SGX is not available in this QEMU\\n\");\n+}\ndiff --git a/hw/i386/sgx-stub.c b/hw/i386/sgx-stub.c\nindex 6e82773a86d..59d58926311 100644\n--- a/hw/i386/sgx-stub.c\n+++ b/hw/i386/sgx-stub.c\n@@ -22,11 +22,6 @@ SgxInfo *qmp_query_sgx_capabilities(Error **errp)\n     return NULL;\n }\n \n-void hmp_info_sgx(Monitor *mon, const QDict *qdict)\n-{\n-    monitor_printf(mon, \"SGX is not available in this QEMU\\n\");\n-}\n-\n void pc_machine_init_sgx_epc(PCMachineState *pcms)\n {\n     memset(&pcms->sgx_epc, 0, sizeof(SGXEPCState));\ndiff --git a/hmp-commands-info.hx b/hmp-commands-info.hx\nindex b575e4ac993..da9fdc0ab7b 100644\n--- a/hmp-commands-info.hx\n+++ b/hmp-commands-info.hx\n@@ -866,15 +866,14 @@ SRST\n     Display the vcpu dirty page limit information.\n ERST\n \n-#if defined(TARGET_I386)\n     {\n         .name       = \"sgx\",\n         .args_type  = \"\",\n         .params     = \"\",\n         .help       = \"show intel SGX information\",\n         .cmd        = hmp_info_sgx,\n+        .arch_bitmask = QEMU_ARCH_I386,\n     },\n-#endif\n \n SRST\n   ``info sgx``\ndiff --git a/hw/i386/meson.build b/hw/i386/meson.build\nindex 63ae57baa51..b611fbb5a7f 100644\n--- a/hw/i386/meson.build\n+++ b/hw/i386/meson.build\n@@ -24,6 +24,7 @@ i386_ss.add(when: 'CONFIG_VTD', if_true: files('intel_iommu.c'))\n i386_ss.add(when: 'CONFIG_VTD_ACCEL', if_true: files('intel_iommu_accel.c'))\n i386_ss.add(when: 'CONFIG_SGX', if_true: files('sgx-epc.c','sgx.c'),\n                                 if_false: files('sgx-stub.c'))\n+stub_ss.add(files('sgx-hmp-stub.c'))\n \n i386_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi-common.c'))\n i386_ss.add(when: 'CONFIG_PC', if_true: files(\n","prefixes":["v2","23/27"]}