From nobody Fri May 17 06:30:35 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1712260615; cv=none; d=zohomail.com; s=zohoarc; b=cktTagV4xGukvRYMX/AhK9EOEgTxyln4zjHAl95GgrOH+aCb48lLTY6sarUmnv7s6u4pDQV+aJeUtu8dQTkQ9VontvaTStNst93/ZPMuZc2xr8EkG7lPRrxolKUSipo83qDLnt5v1je6Sefj6Pg58DCikqsan3akdz8gXFy+SVg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712260615; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=s5hIihND0dsf9z9poWK5+DgIi8r9oQc5ysXPqjISFuw=; b=PFkmTDpc8dYzx8tNWNOBG0tzYS/RDzt1MNtFAXFT69shu4fEMMl4hFwdo5KZZisZvG/pjGMtQcviye870wBYOvZqIaytdR6RGE65QW+Nzk2FCHELSK8OLQMXna+WMceazbAfqzxgKe4GMcUaw0WNqHZkUtlq5qIaC/7cw3vaFGQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1712260615477389.6039493989447; Thu, 4 Apr 2024 12:56:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rsTBf-0003aH-PI; Thu, 04 Apr 2024 15:55:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rsTBe-0003a8-9v for qemu-devel@nongnu.org; Thu, 04 Apr 2024 15:55:50 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rsTBc-00029A-L5 for qemu-devel@nongnu.org; Thu, 04 Apr 2024 15:55:50 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-41627acfd03so9094605e9.3 for ; Thu, 04 Apr 2024 12:55:47 -0700 (PDT) Received: from m1x-phil.lan ([176.187.216.111]) by smtp.gmail.com with ESMTPSA id r10-20020a05600c35ca00b0041622c88852sm3794115wmq.16.2024.04.04.12.55.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 04 Apr 2024 12:55:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712260546; x=1712865346; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=s5hIihND0dsf9z9poWK5+DgIi8r9oQc5ysXPqjISFuw=; b=bllm8hjTUnqAECg6B8fjEGYv0DL9OEFOn/HlBSTYf4KUZXC21uvWrzh1Q7xg5uOnHA xINORvZo/6zUFTOR7LPxp+GD1alBCS8/l5gGConHQQiIyrcT2hvoPsqdAxcwSyCtfz9U ajl0iLCci5+rpgGbguApq410qjIfKt9eqJbkc5pVOkDb6Q/VJuHGAR1FXT2RiaWG+XjZ cBj9QJschFwImX8fAlzgQgkuMVO4cnK1d+7seQ6hAwZXF4gQiEGWUYTxnFo4xZ4TuymL DO0VPd0zkiQNdtvif3TAmlQJ/PISt4f202Vx20khXsudW1roZKcKsJ4tA8GVsCiOFd90 ab7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712260546; x=1712865346; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=s5hIihND0dsf9z9poWK5+DgIi8r9oQc5ysXPqjISFuw=; b=VTuxa9jmWttjtW+KzmPxI/Z3aljjVfX+6D2Jbq+5UCLFReE8slVHgM9M67iUsJFBh+ DH1pSw/Gw5+LjWWYNvgNRfZ8DxzPptFdQq3wVDrXZuJdg876oerM4ENEyvT0YE+SKD2j 6BJ0RagA/ctKwipkGFd/tHebwMzyO7TrKrJSFf6IwKFJeY6ts8k9WHtg2homDWE4bzEa AZf5nangYMSO2PTbks41xAQPX02Nn0V2LIj1GtzY7DhabgMo20H50j7UGTPq/rn3Jn0F 8oHD5V29wrVNTslD6W1j4uevh/7azDPn2a4kIFmCVmpD8bhYsuhNvCywdQLlpDJlQVSe Ws6g== X-Gm-Message-State: AOJu0YykS1q9hsB7E9mMxm3Re+oVN2IqVbpOaKewcvhJeSsHt7YLJjXc 8Sw82sQpEA4nlV4Uxe9vt2tyd4adIrXNgHRxB0mc6yk2kHRrOJhnDqJdDgFVnc/f1PdGPo3pbp4 6 X-Google-Smtp-Source: AGHT+IF/RmKNiYeV0DduMQPGbEHu3fvbRDreTJ24TbRRJCvir0Jy/Hg627XRVK9TdFZQIE5D2U0+BQ== X-Received: by 2002:a05:600c:5812:b0:416:2c78:5ecc with SMTP id jz18-20020a05600c581200b004162c785eccmr1013557wmb.36.1712260546249; Thu, 04 Apr 2024 12:55:46 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Michael Tokarev , Laurent Vivier Cc: Markus Armbruster , Michael Roth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-9.1] qapi: Do not generate commands/events/introspect code for user emulation Date: Thu, 4 Apr 2024 21:55:43 +0200 Message-ID: <20240404195543.9804-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1712260616020100001 User emulation requires the QAPI types. Due to the command line processing, some visitor code is also used. The rest is irrelevant (no QMP socket). Add an option to the qapi-gen script to allow generating the minimum when only user emulation is being built. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- RFC: Quick PoC for Markus. It is useful for user-only builds. --- qapi/meson.build | 6 +++++- scripts/qapi/main.py | 16 +++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/qapi/meson.build b/qapi/meson.build index 375d564277..5e02621145 100644 --- a/qapi/meson.build +++ b/qapi/meson.build @@ -115,10 +115,14 @@ foreach module : qapi_all_modules endif endforeach =20 +qapi_gen_cmd =3D [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@' ] +if not (have_system or have_tools) + qapi_gen_cmd +=3D [ '--types-only' ] +endif qapi_files =3D custom_target('shared QAPI source files', output: qapi_util_outputs + qapi_specific_outputs + qapi_nonmodule_outpu= ts, input: [ files('qapi-schema.json') ], - command: [ qapi_gen, '-o', 'qapi', '-b', '@INPUT0@' ], + command: qapi_gen_cmd, depend_files: [ qapi_inputs, qapi_gen_depends ]) =20 # Now go through all the outputs and add them to the right sourceset. diff --git a/scripts/qapi/main.py b/scripts/qapi/main.py index 316736b6a2..925af5841b 100644 --- a/scripts/qapi/main.py +++ b/scripts/qapi/main.py @@ -33,7 +33,8 @@ def generate(schema_file: str, prefix: str, unmask: bool =3D False, builtins: bool =3D False, - gen_tracing: bool =3D False) -> None: + gen_tracing: bool =3D False, + gen_types_only: bool =3D False) -> None: """ Generate C code for the given schema into the target directory. =20 @@ -50,9 +51,10 @@ def generate(schema_file: str, schema =3D QAPISchema(schema_file) gen_types(schema, output_dir, prefix, builtins) gen_visit(schema, output_dir, prefix, builtins) - gen_commands(schema, output_dir, prefix, gen_tracing) - gen_events(schema, output_dir, prefix) - gen_introspect(schema, output_dir, prefix, unmask) + if not gen_types_only: + gen_commands(schema, output_dir, prefix, gen_tracing) + gen_events(schema, output_dir, prefix) + gen_introspect(schema, output_dir, prefix, unmask) =20 =20 def main() -> int: @@ -75,6 +77,9 @@ def main() -> int: parser.add_argument('-u', '--unmask-non-abi-names', action=3D'store_tr= ue', dest=3D'unmask', help=3D"expose non-ABI names in introspection") + parser.add_argument('-t', '--types-only', action=3D'store_true', + dest=3D'gen_types_only', + help=3D"Only generate QAPI types") =20 # Option --suppress-tracing exists so we can avoid solving build system # problems. TODO Drop it when we no longer need it. @@ -96,7 +101,8 @@ def main() -> int: prefix=3Dargs.prefix, unmask=3Dargs.unmask, builtins=3Dargs.builtins, - gen_tracing=3Dnot args.suppress_tracing) + gen_tracing=3Dnot args.suppress_tracing, + gen_types_only=3Dargs.gen_types_only) except QAPIError as err: print(err, file=3Dsys.stderr) return 1 --=20 2.41.0