From: Peter Maydell <peter.maydell@linaro.org>
To: Suramya Shah <shah.suramya@gmail.com>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
Jason Wang <jasowang@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] hw/net: convert "dma" property type from ptr to link
Date: Mon, 3 Apr 2017 15:41:53 +0100 [thread overview]
Message-ID: <CAFEAcA8S_h+2jT0P_ZoJX3QYHmgf=6ufsrpNguZifErCqqZBeQ@mail.gmail.com> (raw)
In-Reply-To: <20170403073550.29162-1-shah.suramya@gmail.com>
On 3 April 2017 at 08:35, Suramya Shah <shah.suramya@gmail.com> wrote:
> The lance device needs pointer to ISA DMA device to operate. But according to
> qdev-properties.h, properties of pointer type should be avoided.
> A link type property is a good substitution.
>
> Signed-off-by: Suramya Shah <shah.suramya@gmail.com>
> ---
> hw/net/lance.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/hw/net/lance.c b/hw/net/lance.c
> index 573d724..3996b9c 100644
> --- a/hw/net/lance.c
> +++ b/hw/net/lance.c
> @@ -44,6 +44,7 @@
> #include "pcnet.h"
> #include "trace.h"
> #include "sysemu/sysemu.h"
> +#include "qapi/error.h"
>
> #define TYPE_LANCE "lance"
> #define SYSBUS_PCNET(obj) \
> @@ -145,10 +146,14 @@ static void lance_instance_init(Object *obj)
> device_add_bootindex_property(obj, &s->conf.bootindex,
> "bootindex", "/ethernet-phy@0",
> DEVICE(obj), NULL);
> +
> + object_property_add_link(obj, "dma", TYPE_LANCE,
> + (Object **)&d->state.dma_opaque,
> + qdev_prop_allow_set_link_before_realize,
> + 0, &error_abort);
> }
>
> static Property lance_properties[] = {
> - DEFINE_PROP_PTR("dma", SysBusPCNetState, state.dma_opaque),
> DEFINE_NIC_PROPERTIES(SysBusPCNetState, state.conf),
> DEFINE_PROP_END_OF_LIST(),
> };
Hi. I'm afraid that this doesn't pass "make check":
TEST: tests/qom-test... (pid=5185)
/sparc/qom/SS-10:
qemu-system-sparc:
/home/petmay01/linaro/qemu-from-laptop/qemu/hw/core/qdev-properties.c:1037:
qdev_prop_set_ptr: Assertion `prop && prop->info == &qdev_prop_ptr'
failed.
Broken pipe
FAIL
This is because you've changed the device implementation from
a pointer property to a link, but you haven't changed the code
that uses it, so now when that code tries to set the pointer
property it crashes.
It's always a good idea to use "make check" to do at least
a basic test of your changes (and if you can find test images
that exercise the devices you're changing that's also good,
because 'make check' often doesn't cover as much as we'd like).
> @@ -164,7 +169,6 @@ static void lance_class_init(ObjectClass *klass, void *data)
> dc->reset = lance_reset;
> dc->vmsd = &vmstate_lance;
> dc->props = lance_properties;
> - /* Reason: pointer property "dma" */
> dc->cannot_instantiate_with_device_add_yet = true;
This comment is describing the reason why the line below it
sets dc->cannot_instantiate_with_device_add_yet, so you
can't remove only the comment. Either:
(1) this change means it is now possible to instantiate with
device-add, in which case remove both the comment and the
setting of the flag, or
(2) it's still not possible to instantiate with device-add,
in which case update the comment to give the new reason.
thanks
-- PMM
prev parent reply other threads:[~2017-04-03 14:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-03 7:35 [Qemu-devel] [PATCH] hw/net: convert "dma" property type from ptr to link Suramya Shah
2017-04-03 14:14 ` Suramya Shah
2017-04-03 14:41 ` Peter Maydell [this message]
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='CAFEAcA8S_h+2jT0P_ZoJX3QYHmgf=6ufsrpNguZifErCqqZBeQ@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=jasowang@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=shah.suramya@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).