[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 23/33] dp8393x: replace PROP_PTR with PROP_LINK
From: |
Marc-André Lureau |
Subject: |
Re: [PATCH v3 23/33] dp8393x: replace PROP_PTR with PROP_LINK |
Date: |
Thu, 24 Oct 2019 13:12:47 +0200 |
On Thu, Oct 24, 2019 at 1:02 AM Philippe Mathieu-Daudé
<address@hidden> wrote:
>
> On 10/23/19 7:31 PM, Marc-André Lureau wrote:
> > Link property is the correct way to pass a MemoryRegion to a device
> > for DMA purposes.
> >
> > Sidenote: as a sysbus device, this remains non-usercreatable
> > even though we can drop the specific flag here.
> >
> > Signed-off-by: Marc-André Lureau <address@hidden>
> > Reviewed-by: Peter Maydell <address@hidden>
> > ---
> > hw/mips/mips_jazz.c | 3 ++-
> > hw/net/dp8393x.c | 7 +++----
> > 2 files changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
> > index 8d010a0b6e..878925a963 100644
> > --- a/hw/mips/mips_jazz.c
> > +++ b/hw/mips/mips_jazz.c
> > @@ -284,7 +284,8 @@ static void mips_jazz_init(MachineState *machine,
> > dev = qdev_create(NULL, "dp8393x");
> > qdev_set_nic_properties(dev, nd);
> > qdev_prop_set_uint8(dev, "it_shift", 2);
> > - qdev_prop_set_ptr(dev, "dma_mr", rc4030_dma_mr);
> > + object_property_set_link(OBJECT(dev), OBJECT(rc4030_dma_mr),
> > + "dma_mr", &error_abort);
> > qdev_init_nofail(dev);
> > sysbus = SYS_BUS_DEVICE(dev);
> > sysbus_mmio_map(sysbus, 0, 0x80001000);
> > diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c
> > index a5678e11fa..946c7a8f64 100644
> > --- a/hw/net/dp8393x.c
> > +++ b/hw/net/dp8393x.c
> > @@ -173,7 +173,7 @@ typedef struct dp8393xState {
> > int loopback_packet;
> >
> > /* Memory access */
> > - void *dma_mr;
> > + MemoryRegion *dma_mr;
> > AddressSpace as;
> > } dp8393xState;
> >
> > @@ -922,7 +922,8 @@ static const VMStateDescription vmstate_dp8393x = {
> >
> > static Property dp8393x_properties[] = {
> > DEFINE_NIC_PROPERTIES(dp8393xState, conf),
> > - DEFINE_PROP_PTR("dma_mr", dp8393xState, dma_mr),
> > + DEFINE_PROP_LINK("dma_mr", dp8393xState, dma_mr,
> > + TYPE_MEMORY_REGION, MemoryRegion *),
> > DEFINE_PROP_UINT8("it_shift", dp8393xState, it_shift, 0),
> > DEFINE_PROP_END_OF_LIST(),
> > };
> > @@ -936,8 +937,6 @@ static void dp8393x_class_init(ObjectClass *klass, void
> > *data)
> > dc->reset = dp8393x_reset;
> > dc->vmsd = &vmstate_dp8393x;
> > dc->props = dp8393x_properties;
> > - /* Reason: dma_mr property can't be set */
> > - dc->user_creatable = false;
>
> Patch is OK except this user_creatable change I don't understand.
It's a sysbus device, so it's not user-creatable anyway. I'll add a
commit comment.
>
> > }
> >
> > static const TypeInfo dp8393x_info = {
> >
- Re: [PATCH v3 21/33] lance: replace PROP_PTR with PROP_LINK, (continued)
- Re: [PATCH v3 21/33] lance: replace PROP_PTR with PROP_LINK, Marc-André Lureau, 2019/10/24
- Re: [PATCH v3 21/33] lance: replace PROP_PTR with PROP_LINK, Philippe Mathieu-Daudé, 2019/10/24
- Re: [PATCH v3 21/33] lance: replace PROP_PTR with PROP_LINK, Peter Maydell, 2019/10/24
- Re: [PATCH v3 21/33] lance: replace PROP_PTR with PROP_LINK, Eduardo Habkost, 2019/10/24
- Re: [PATCH v3 21/33] lance: replace PROP_PTR with PROP_LINK, Peter Maydell, 2019/10/25
- Re: [PATCH v3 21/33] lance: replace PROP_PTR with PROP_LINK, Marc-André Lureau, 2019/10/24
[PATCH v3 20/33] vmmouse: replace PROP_PTR with PROP_LINK, Marc-André Lureau, 2019/10/23
[PATCH v3 23/33] dp8393x: replace PROP_PTR with PROP_LINK, Marc-André Lureau, 2019/10/23
[PATCH v3 19/33] sm501: make SerialMM a child, export chardev property, Marc-André Lureau, 2019/10/23
[PATCH v3 22/33] etraxfs: remove PROP_PTR usage, Marc-André Lureau, 2019/10/23
[PATCH v3 24/33] leon3: use qemu_irq framework instead of callback as property, Marc-André Lureau, 2019/10/23
[PATCH v3 25/33] sparc: move PIL irq handling to cpu.c, Marc-André Lureau, 2019/10/23
[PATCH v3 26/33] RFC: mips/cps: fix setting saar property, Marc-André Lureau, 2019/10/23
[PATCH v3 27/33] cris: improve passing PIC interrupt vector to the CPU, Marc-André Lureau, 2019/10/23
[PATCH v3 29/33] omap-intc: remove PROP_PTR, Marc-André Lureau, 2019/10/23