QEMU-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Paul Durrant <paul@xen.org>,
	xen-devel@lists.xenproject.org, qemu-devel@nongnu.org
Cc: Anthony Perard <anthony.perard@citrix.com>,
	Paul Durrant <pdurrant@amazon.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Jason Andryuk <jandryuk@gmail.com>
Subject: Re: [PATCH 1/2] xen: fix legacy 'xen-sysdev' and 'xen-backend' bus types
Date: Tue, 30 Jun 2020 17:19:53 +0200
Message-ID: <ee15f95a-ef85-8246-f10d-2778baa343c7@redhat.com> (raw)
In-Reply-To: <20200624121841.17971-2-paul@xen.org>

On 6/24/20 2:18 PM, Paul Durrant wrote:
> From: Paul Durrant <pdurrant@amazon.com>
> 
> 'xen-sysdev' plugs into the 'System' bus type, not 'xen-sysbus. That bus type
> is what 'xen-backend' plugs into.
> 'xen-sysdev' is drived form 'sys-bus-device' so the bus type need not be
> overridden. 'xen-backend' is derived from 'device', which plugs into the
> generic 'bus' type, so its bus type should be overridden to 'xen-sysbus'.
> 
> Without this patch, the following assertion will fail:
> 
> qemu-system-i386: hw/core/qdev.c:102: qdev_set_parent_bus: Assertion
> `dc->bus_type && object_dynamic_cast(OBJECT(bus), dc->bus_type)'
> failed.
> 
> Reported-by: Jason Andryuk <jandryuk@gmail.com>
> Fixes: 81cb05732efb ("qdev: Assert devices are plugged into a bus that can take them")
> Signed-off-by: Paul Durrant <pdurrant@amazon.com>
> ---
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Anthony Perard <anthony.perard@citrix.com>
> ---
>  hw/xen/xen-legacy-backend.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/xen/xen-legacy-backend.c b/hw/xen/xen-legacy-backend.c
> index 2335ee2e65..c5c75c0064 100644
> --- a/hw/xen/xen-legacy-backend.c
> +++ b/hw/xen/xen-legacy-backend.c
> @@ -789,11 +789,12 @@ static void xendev_class_init(ObjectClass *klass, void *data)
>      set_bit(DEVICE_CATEGORY_MISC, dc->categories);
>      /* xen-backend devices can be plugged/unplugged dynamically */
>      dc->user_creatable = true;
> +    dc->bus_type = TYPE_XENSYSBUS;
>  }
>  
>  static const TypeInfo xendev_type_info = {
>      .name          = TYPE_XENBACKEND,
> -    .parent        = TYPE_XENSYSDEV,
> +    .parent        = TYPE_DEVICE,
>      .class_init    = xendev_class_init,
>      .instance_size = sizeof(struct XenLegacyDevice),
>  };
> @@ -824,7 +825,6 @@ static void xen_sysdev_class_init(ObjectClass *klass, void *data)
>      DeviceClass *dc = DEVICE_CLASS(klass);
>  
>      device_class_set_props(dc, xen_sysdev_properties);
> -    dc->bus_type = TYPE_XENSYSBUS;
>  }
>  
>  static const TypeInfo xensysdev_info = {
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



  reply index

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-24 12:18 [PATCH 0/2] fix assertion failures when using Xen Paul Durrant
2020-06-24 12:18 ` [PATCH 1/2] xen: fix legacy 'xen-sysdev' and 'xen-backend' bus types Paul Durrant
2020-06-30 15:19   ` Philippe Mathieu-Daudé [this message]
2020-06-24 12:18 ` [PATCH 2/2] xen: cleanup unrealized flash devices Paul Durrant
2020-06-30 15:08   ` Anthony PERARD
2020-06-30 15:17     ` Paul Durrant
2020-07-01  5:56     ` Markus Armbruster
2020-06-30 15:25   ` Philippe Mathieu-Daudé
2020-06-30 15:44     ` Paul Durrant
2020-06-30 17:27       ` Philippe Mathieu-Daudé
2020-07-01  5:59         ` Markus Armbruster
2020-07-01  7:03         ` Paul Durrant
2020-07-01 12:25           ` Jason Andryuk
2020-07-01 12:40             ` Philippe Mathieu-Daudé
2020-07-01 12:55               ` Philippe Mathieu-Daudé
2020-07-01 14:59                 ` Jason Andryuk
2020-07-01 15:10                   ` Philippe Mathieu-Daudé
2020-07-02  3:55             ` Markus Armbruster

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=ee15f95a-ef85-8246-f10d-2778baa343c7@redhat.com \
    --to=philmd@redhat.com \
    --cc=anthony.perard@citrix.com \
    --cc=jandryuk@gmail.com \
    --cc=paul@xen.org \
    --cc=pdurrant@amazon.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.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

QEMU-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/qemu-devel/0 qemu-devel/git/0.git
	git clone --mirror https://lore.kernel.org/qemu-devel/1 qemu-devel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 qemu-devel qemu-devel/ https://lore.kernel.org/qemu-devel \
		qemu-devel@nongnu.org
	public-inbox-index qemu-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.nongnu.qemu-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git