Received: by 2002:a17:906:f85:b0:a47:c39e:cbe with SMTP id q5csp1345431ejj; Tue, 26 Mar 2024 06:32:28 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV8ycibuJcBjFGv67IT/8B3EhCIXz8nf2Q4X4x9GXaMa/Ah8OS05kQ/dk3UPiIXRBlP76QDU98EGdGSlM9yy9pqa2eAQjGz X-Google-Smtp-Source: AGHT+IFHBqCxkK5vyO0v/VezuGRKU94rKtkj2VDgQQyqXX1gX+zuBp+u6NR1Wyb5uxRftV8LVNbL X-Received: by 2002:a05:6830:1e70:b0:6e6:cd07:61b5 with SMTP id m16-20020a0568301e7000b006e6cd0761b5mr8668203otr.10.1711459948078; Tue, 26 Mar 2024 06:32:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711459948; cv=none; d=google.com; s=arc-20160816; b=NIl6SKy6yoRN+P9ugUzbW/hwaO4Q9/OvvB51YYn4/pGkRih2N0Dojxe9gfoDRGrr8X g6YXx5qeu7A0eqoVw1Ve/bGbRFyXtGaNisMA60GgaHBhre1okq6ApjuIIk15qLR2aPXM rEqROnKZTW+SjcLyT/gfvz8dyo615rKNs/pWbaOekdubgrTJJELDrsgGlkPnkG4TZgbW M4goAAuNGe3/Qw8+xDtGPMzHPjudcJfb6eNNnANchwHGMF2PqWVJ3LjS204pQHEP5Ij7 xVz+9752A7UPKycpB3NonRvUoiYybyuQO3rZoE6U3DcFUIegSc7YiO9WAXbzU7jZ4hxY gSGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:dkim-signature; bh=JYLy1OCZ/WnjMGSmPadg1kQr5dKf8rmhteT200xQIug=; fh=/1zCBt+FYvWd40g+eJcpIvPB2rbEAuj7yZvrbIY+Upk=; b=kadC81nPIu9I5CH5X4tMnx0nnJM1h8porrm9JYyCSfe8zQ1bu+nx6zYx+7ExQWCIHt EMkZfMSmre/zfc+uj7RA5hWvNf7zvysi8ddwHO4RnfAdYVs045cIWaCgs6j0KQ3fNRHd zVI7yu5kRmrzcHvPEQ4gz1tUmYjFMFu9aIeMvIV1DOcjfPGjpi8S8rlig4BQKgpWTEBz JNCja3VCPHowc5IKa00sZnSI6DZD5xVJazNtj5O0GP2ODHvYBmVeGsqIjNbA60Y99x/v wO6CyorazKcdRIg/WfrJ1xaiFW50/krQ+HWw3RmK5efLsaghWwBEGHT1THr63fCvvU7C ktSQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eoQeqKzX; spf=pass (google.com: domain of armbru@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=armbru@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com. [170.10.129.124]) by mx.google.com with ESMTPS id k21-20020a05612212f500b004d424b480b2si1407653vkp.296.2024.03.26.06.32.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 06:32:28 -0700 (PDT) Received-SPF: pass (google.com: domain of armbru@redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eoQeqKzX; spf=pass (google.com: domain of armbru@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=armbru@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711459947; 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=JYLy1OCZ/WnjMGSmPadg1kQr5dKf8rmhteT200xQIug=; b=eoQeqKzXqP1z+OKkfW2NmR+hbSjzYvSPWBZVd6gSrXV2G3i8kczMXoYaLfAd2eQyLEDVQl F0AZUY0XBZFxMO7j0CvVZKzbvYECNmrslEEQVZwlv9WhFYng+olHDcov/ooVcli0To69YP r6m3IrmasCHnBzAGDeko3fHmkW8q/Jc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-645-7ebkT3aZODGhrQ3OntrHZg-1; Tue, 26 Mar 2024 09:32:21 -0400 X-MC-Unique: 7ebkT3aZODGhrQ3OntrHZg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8047B101A58F; Tue, 26 Mar 2024 13:32:19 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.81]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 40DD6107A8; Tue, 26 Mar 2024 13:32:18 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 27DA821E669D; Tue, 26 Mar 2024 14:32:13 +0100 (CET) From: Markus Armbruster To: Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Cc: qemu-devel@nongnu.org, qemu-riscv@nongnu.org, Anton Johansson , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Daniel P . =?utf-8?Q?Berrang=C3=A9?= , Paolo Bonzini , Eduardo Habkost , Claudio Fontana , Richard Henderson , Peter Maydell , Alex =?utf-8?Q?Benn=C3=A9e?= , Manos Pitsidianakis , Zhao Liu , qemu-arm@nongnu.org, Thomas Huth , Marcel Apfelbaum , Yanan Wang , Eric Blake , Song Gao , Huacai Chen , Aurelien Jarno , Jiaxun Yang , Aleksandar Rikalo , Nicholas Piggin , Daniel Henrique Barboza , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Liu Zhiwei Subject: Re: [RFC PATCH-for-9.1 21/21] qapi: Make @query-cpu-definitions target-agnostic In-Reply-To: <20240315130910.15750-22-philmd@linaro.org> ("Philippe =?utf-8?Q?Mathieu-Daud=C3=A9=22's?= message of "Fri, 15 Mar 2024 14:09:09 +0100") References: <20240315130910.15750-1-philmd@linaro.org> <20240315130910.15750-22-philmd@linaro.org> Date: Tue, 26 Mar 2024 14:32:13 +0100 Message-ID: <87o7b1m84i.fsf@pond.sub.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-TUID: 5g1vepjPJIUs Philippe Mathieu-Daud=C3=A9 writes: > All targets use the generic_query_cpu_definitions() method, > which is not target-specific. Make the command target agnostic > by moving it to machine.json. Rename generic_query_cpu_definitions > as qmp_query_cpu_definitions. > > This is an introspection change for the target that were not > implementing qmp_query_cpu_definitions(): now query-cpu-definitions > returns an their CPUs list. Do you mean "returns their CPUs list"? > > Example with SH4 before: > > { "execute": "query-cpu-definitions" } > > { "error": {"class": "CommandNotFound", "desc": "The command query-cpu-= definitions has not been found"} } > > and after: > > { "execute": "query-cpu-definitions" } > > { "return": [ > {"name": "sh7751r", "typename": "sh7751r-superh-cpu", "static":= false, "deprecated": false}, > {"name": "sh7750r", "typename": "sh7750r-superh-cpu", "static":= false, "deprecated": false}, > {"name": "sh7785", "typename": "sh7785-superh-cpu", "static": f= alse, "deprecated": false} > ] > } Does the result make sense? What do the callbacks add for the targets that define them, and why do the other targets don't need them? Conversion steps: 0. Create a generic version of the command, with optional callbacks [PATCH 14] 1. Turn the target-specific versions of the command into thin wrappers around the generic version one by one, supplying callbacks to preserve behavior [PATCH 15-20] 2. Peel off the wrappers [this patch] 3. Enable the command for all the other targets [also this patch] Correct? Split this patch? Question, not a demand. I think the commit messages of the step 1 patches should explain the target-specific behavior, i.e. the difference between their callbacks and the default behavior. Obvious for cpu_list_compare(): sorted vs. unsorted. Not obvious for add_definition(). > However this allows heterogeneous emulation to return a correct list. Cryptic. It made me go back to PATCH 14, where I discovered the loop over the arch bits. > Signed-off-by: Philippe Mathieu-Daud=C3=A9 > --- > Well, not all target got converted, I left the s390x one for later :) Haha!