All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Yonggang Luo <luoyonggang@gmail.com>
Cc: qemu-devel@nongnu.org, David Hildenbrand <david@kernel.org>,
	Philippe Mathieu-Daude <philmd@mailo.com>,
	Matthew Rosato <mjrosato@linux.ibm.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>,
	Cornelia Huck <cohuck@redhat.com>, Fam Zheng <fam@euphon.net>,
	qemu-s390x@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
	Eric Farman <farman@linux.ibm.com>
Subject: Re: [PATCH 1/3] hw/pci: Avoid guard loadparm with target_s390x() for s390x in class_init
Date: Thu, 5 Nov 2026 11:31:32 +0000	[thread overview]
Message-ID: <auxpFIkPTLAyvzz9@redhat.com> (raw)
In-Reply-To: <20261013200525.1340-2-luoyonggang@gmail.com>

On Wed, Oct 14, 2026 at 04:05:22AM +0800, Yonggang Luo wrote:
> This is for avoid call target_info() in class_init.
> Now we directly guard in pci_qdev_property_set_loadparm instead.
> Don't know if its an API break, but the smallest change.

Suggest to reword this as follows:

 With the multi-target work, the goal is to move to a single
 unified QOM tree that applies universally across all targets.
 This complements the migration away from instance level
 properties to class level properties, which again aims to
 ensure a fixed QOM object model for each class.

 This requires that properties are either unconditionally
 registered in the class, with invalid options rejected
 at runtime (for example, during realize()), or that distinct
 subclasses are used for specialized use cases that need a
 distinct impl for some targets.

 It is harmless to have the 'loadparm' property registered
 unconditionally so take the simple option.

The same can apply to the other patches

> 
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> ---
>  hw/pci/pci.c | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)

> 
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index 0efb4eb4bb0..9d3dcd52942 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -2878,6 +2878,11 @@ static void pci_qdev_property_set_loadparm(Object *obj, const char *value,
>  {
>      void *lp_str;
>  
> +    if (!target_s390x()) {
> +        error_setg(errp, "'loadparm' is only supported on s390x");
> +        return;
> +    }
> +
>      if (object_property_get_int(obj, "bootindex", NULL) < 0) {
>          error_setg(errp, "'loadparm' is only valid for boot devices");
>          return;
> @@ -2895,14 +2900,11 @@ void pci_qdev_property_add_specifics(DeviceClass *dc)
>  {
>      ObjectClass *oc = OBJECT_CLASS(dc);
>  
> -    /* The loadparm property is only supported on s390x */
> -    if (target_s390x()) {
> -        object_class_property_add_str(oc, "loadparm",
> -                                      pci_qdev_property_get_loadparm,
> -                                      pci_qdev_property_set_loadparm);
> -        object_class_property_set_description(oc, "loadparm",
> -                                              "load parameter (s390x only)");
> -    }
> +    object_class_property_add_str(oc, "loadparm",
> +                                  pci_qdev_property_get_loadparm,
> +                                  pci_qdev_property_set_loadparm);
> +    object_class_property_set_description(oc, "loadparm",
> +                                          "load parameter (s390x only)");
>  }
>  
>  MemoryRegion *pci_address_space(PCIDevice *dev)
> -- 
> 2.55.0.windows.3
> 
> 

With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|



  reply	other threads:[~2026-11-05 11:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 20:05 [PATCH 0/3] hw/(pci/scsi/virtio-mem): Avoid call to target_info() in class_init Yonggang Luo
2026-10-13 20:05 ` [PATCH 1/3] hw/pci: Avoid guard loadparm with target_s390x() for s390x " Yonggang Luo
2026-11-05 11:31   ` Daniel P. Berrangé [this message]
2026-10-13 20:05 ` [PATCH 2/3] hw/scsi: " Yonggang Luo
2026-10-13 20:05 ` [PATCH 3/3] hw/virtio/virtio-mem: Avoid call to target_info() " Yonggang Luo
2026-11-05 11:33 ` [PATCH 0/3] hw/(pci/scsi/virtio-mem): " Daniel P. Berrangé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=auxpFIkPTLAyvzz9@redhat.com \
    --to=berrange@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=david@kernel.org \
    --cc=fam@euphon.net \
    --cc=farman@linux.ibm.com \
    --cc=luoyonggang@gmail.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@mailo.com \
    --cc=pierrick.bouvier@oss.qualcomm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.