{"id":2228672,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2228672/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260427080738.77138-16-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":"<20260427080738.77138-16-philmd@linaro.org>","date":"2026-04-27T08:07:21","name":"[v4,15/32] 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/20260427080738.77138-16-philmd@linaro.org/mbox/","series":[{"id":501599,"url":"http://patchwork.ozlabs.org/api/1.1/series/501599/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=501599","date":"2026-04-27T08:07:06","name":"monitor: Remove need of per-target handlers","version":4,"mbox":"http://patchwork.ozlabs.org/series/501599/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2228672/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2228672/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=AyVtClKy;\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=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.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 4g3x7V0b1Sz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 18:09:58 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wHH23-000234-WE; Mon, 27 Apr 2026 04:09:32 -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 1wHH20-0001rz-8h\n for qemu-devel@nongnu.org; Mon, 27 Apr 2026 04:09:28 -0400","from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e])\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 1wHH1y-00021v-CY\n for qemu-devel@nongnu.org; Mon, 27 Apr 2026 04:09:27 -0400","by mail-wr1-x42e.google.com with SMTP id\n ffacd0b85a97d-44261378651so1035171f8f.0\n for <qemu-devel@nongnu.org>; Mon, 27 Apr 2026 01:09:25 -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 ffacd0b85a97d-43fe4e4ffa8sm81205156f8f.35.2026.04.27.01.09.23\n (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);\n Mon, 27 Apr 2026 01:09:24 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1777277365; x=1777882165; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:to:from:from:to:cc:subject:date:message-id\n :reply-to; bh=dMU/VWsKmdyzWtFbXIxN14oBh1lK9MG9g4e1e4MZRyI=;\n b=AyVtClKyjIDBKfU8QA/C2R9ZZfQtspU/wEwgILDnne9NSIsOWthdaHyoAO/yEU7LKd\n GmjtQoeVYBi9cwvhxtBZz/kVK+vB2gAKKWB8dyQvBfTrCk0KF66qrNRDi+QmZFShnQoc\n V9sCPcv9J4qCJK+Hqh12zo2wwCEhTlGYpQPk1ZN/gke4oIKbhX3oOL74txM1vhhBqb2f\n SB9VAq9r02mH6HfiiGXKSrBzUQHkFRkX8kqKjGrtF/DNB32X4UWwB4Pi0hoSuzGCrDkb\n go6W3ZPJ79F/Py5FnzXA0YJIctVRleKkPbMlq0lqf7SyRrnUO9j+PBI5f9NTDwDcx2ZL\n IVUA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777277365; x=1777882165;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to\n :cc:subject:date:message-id:reply-to;\n bh=dMU/VWsKmdyzWtFbXIxN14oBh1lK9MG9g4e1e4MZRyI=;\n b=VjB/z9FfVN8uh7nrg0GWr5Cdl1F72+EGsA5pCgnat+gQ3OE0b1b+U4wNyk3W8CMyhv\n YqvwfCXhjwd5bHsOYSKLJjuJU7pVWhZ1UcMNYIydziVqLxfKMd+tG/mICODUwjLp+6q0\n vXywS2YLSTwt60cj9JjrwoLd/jJu7SwsUAzmk3FRAUgPKkCZAk859DGRBKfLNQjddkGS\n NI+HcA6tSKHt4X3Y0z5aoUCMLUKs1oby5cGzbaNlv8HWJsFCcXaW1HYsKbMq5tYr1kaE\n VTFyQjWaqIS3X1k55AZAEnw6x4tLIq0LtUW+DQy2cXR0twX6vAiLShwt9YwxUOANYG1E\n 1PnQ==","X-Forwarded-Encrypted":"i=1;\n AFNElJ98B/czmtkXusivhOcOhcNrlZkQzJvDmLrfScWXrAc+GZ57o6ccSD7TOmqxo9kWhkrmmV8ct+XTTRKR@nongnu.org","X-Gm-Message-State":"AOJu0YxozoALbwcDDyCnzhKfkDTQxnzohb/8eOWcFyn7R3nl1bUjPxwM\n qDPfIsv/SSo8rpEZiGGrCGct/2syZoMtmPcS6hLJCM8Esfui86bX+ctcSM9qTXaiwMhGYPR2PBv\n pYfqkcTE=","X-Gm-Gg":"AeBDiesEvM6uAGQPla72Z53V2SSvGYHi4Ls3dyQCdr66+WTyXIwmaQ9qmcKJpEG0TE5\n U4cl3XfHW1k5qvuFlZYIbBKkgQ9urKTNhRyVJfBYxzfD534gghO6/ICA50ubX6wkRurRW59Vyj1\n OHD/90Pjv3yff/SlOGkKa2a/bjmGt6O/L7XhvaPWMOPIQmO6HhSAsfl9fvfBtuGbuyCyng18N06\n XqTDwT0HCuvuzT6PI3tdWX/zFVNoE3Q4Dho+mee97iKvBnhwucln070OhE4ZIY5pgaTq14fcmjT\n Lpwh2ZvLn88j4GuT5KKGv0gwquX0bh93q4yUbcq07p0xALZ66E571M38PuLN0BwVhSmC1zwxNTf\n z8e1c0vbP581BR+KBRIZYmrSQvzwsw/AK/HqsOHw65LFChPq3P1gg1WaBd00VFpXTFT5rRcozee\n MLlqgffuAu4MP4g1cNageAvDO2kr47x2dpvTSDK42MTUVQ9BuVrsYGP9d3r1aVxgtm3tUYjB2Wg\n 9r+sbq9+uA=","X-Received":"by 2002:a5d:5d83:0:b0:43c:fc5c:aa08 with SMTP id\n ffacd0b85a97d-43fe4034413mr65432120f8f.8.1777277364616;\n Mon, 27 Apr 2026 01:09:24 -0700 (PDT)","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>","To":"Markus Armbruster <armbru@redhat.com>,\n\tqemu-devel@nongnu.org","Subject":"[PATCH v4 15/32] monitor: Do not check TARGET_I386 to build 'info\n sgx' command","Date":"Mon, 27 Apr 2026 10:07:21 +0200","Message-ID":"<20260427080738.77138-16-philmd@linaro.org>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260427080738.77138-1-philmd@linaro.org>","References":"<20260427080738.77138-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::42e;\n envelope-from=philmd@linaro.org; helo=mail-wr1-x42e.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=ham 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>\nReviewed-by: Richard Henderson <richard.henderson@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 8493b12a342..8f587756cbd 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 1dd8d9afbfa..2b083c77bc1 100644\n--- a/hw/i386/sgx-stub.c\n+++ b/hw/i386/sgx-stub.c\n@@ -23,11 +23,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":["v4","15/32"]}