Message ID | 1471529754-29690-1-git-send-email-caoj.fnst@cn.fujitsu.com |
---|---|
State | New |
Headers | show |
> On 18 Aug 2016, at 17:15, Cao jin <caoj.fnst@cn.fujitsu.com> wrote: > > Commit 66bf7d58 removed internal msi state flag E1000E_USE_MSI, E1000E_USE_MSIX > is not necessary too, remove it now. And interrupt flag field intr_state also > can be removed now. > > CC: Dmitry Fleytman <dmitry@daynix.com> > CC: Jason Wang <jasowang@redhat.com> > CC: Markus Armbruster <armbru@redhat.com> > CC: Marcel Apfelbaum <marcel@redhat.com> > CC: Michael S. Tsirkin <mst@redhat.com> > CC: Paolo Bonzini <pbonzini@redhat.com> > Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com> > --- > hw/net/e1000e.c | 8 +------- > 1 file changed, 1 insertion(+), 7 deletions(-) > > diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c > index 82a7be1..72aad21 100644 > --- a/hw/net/e1000e.c > +++ b/hw/net/e1000e.c > @@ -69,7 +69,6 @@ typedef struct E1000EState { > uint16_t subsys_ven_used; > uint16_t subsys_used; > > - uint32_t intr_state; > bool disable_vnet; > > E1000ECore core; > @@ -89,8 +88,6 @@ typedef struct E1000EState { > #define E1000E_MSIX_TABLE (0x0000) > #define E1000E_MSIX_PBA (0x2000) > > -#define E1000E_USE_MSIX BIT(0) > - > static uint64_t > e1000e_mmio_read(void *opaque, hwaddr addr, unsigned size) > { > @@ -302,8 +299,6 @@ e1000e_init_msix(E1000EState *s) > } else { > if (!e1000e_use_msix_vectors(s, E1000E_MSIX_VEC_NUM)) { > msix_uninit(d, &s->msix, &s->msix); > - } else { > - s->intr_state |= E1000E_USE_MSIX; So you are removing error handling here. But what if e1000e_use_msix_vectors fails? > } > } > } > @@ -311,7 +306,7 @@ e1000e_init_msix(E1000EState *s) > static void > e1000e_cleanup_msix(E1000EState *s) > { > - if (s->intr_state & E1000E_USE_MSIX) { > + if (msix_enabled(PCI_DEVICE(s))) { > e1000e_unuse_msix_vectors(s, E1000E_MSIX_VEC_NUM); > msix_uninit(PCI_DEVICE(s), &s->msix, &s->msix); > } > @@ -601,7 +596,6 @@ static const VMStateDescription e1000e_vmstate = { > VMSTATE_MSIX(parent_obj, E1000EState), > > VMSTATE_UINT32(ioaddr, E1000EState), > - VMSTATE_UINT32(intr_state, E1000EState), > VMSTATE_UINT32(core.rxbuf_min_shift, E1000EState), > VMSTATE_UINT8(core.rx_desc_len, E1000EState), > VMSTATE_UINT32_ARRAY(core.rxbuf_sizes, E1000EState, > -- > 2.1.0 > > >
Dmitry Fleytman <dmitry@daynix.com> writes: >> On 18 Aug 2016, at 17:15, Cao jin <caoj.fnst@cn.fujitsu.com> wrote: >> >> Commit 66bf7d58 removed internal msi state flag E1000E_USE_MSI, E1000E_USE_MSIX >> is not necessary too, remove it now. And interrupt flag field intr_state also >> can be removed now. >> >> CC: Dmitry Fleytman <dmitry@daynix.com> >> CC: Jason Wang <jasowang@redhat.com> >> CC: Markus Armbruster <armbru@redhat.com> >> CC: Marcel Apfelbaum <marcel@redhat.com> >> CC: Michael S. Tsirkin <mst@redhat.com> >> CC: Paolo Bonzini <pbonzini@redhat.com> >> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com> >> --- >> hw/net/e1000e.c | 8 +------- >> 1 file changed, 1 insertion(+), 7 deletions(-) >> >> diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c >> index 82a7be1..72aad21 100644 >> --- a/hw/net/e1000e.c >> +++ b/hw/net/e1000e.c >> @@ -69,7 +69,6 @@ typedef struct E1000EState { >> uint16_t subsys_ven_used; >> uint16_t subsys_used; >> >> - uint32_t intr_state; >> bool disable_vnet; >> >> E1000ECore core; >> @@ -89,8 +88,6 @@ typedef struct E1000EState { >> #define E1000E_MSIX_TABLE (0x0000) >> #define E1000E_MSIX_PBA (0x2000) >> >> -#define E1000E_USE_MSIX BIT(0) >> - >> static uint64_t >> e1000e_mmio_read(void *opaque, hwaddr addr, unsigned size) >> { >> @@ -302,8 +299,6 @@ e1000e_init_msix(E1000EState *s) >> } else { >> if (!e1000e_use_msix_vectors(s, E1000E_MSIX_VEC_NUM)) { >> msix_uninit(d, &s->msix, &s->msix); >> - } else { >> - s->intr_state |= E1000E_USE_MSIX; > > So you are removing error handling here. But what if e1000e_use_msix_vectors fails? Before the patch, E1000E_USE_MSIX is set exactly when MSI-X was enabled successfully. It's only use is in MSI-X cleanup (next hunk): cleanup is skipped when the flag isn't set. The flag is pointless, because we can just as well test whether MSI-X is enabled directly. That's what the patch does. > >> } >> } >> } >> @@ -311,7 +306,7 @@ e1000e_init_msix(E1000EState *s) >> static void >> e1000e_cleanup_msix(E1000EState *s) >> { >> - if (s->intr_state & E1000E_USE_MSIX) { >> + if (msix_enabled(PCI_DEVICE(s))) { >> e1000e_unuse_msix_vectors(s, E1000E_MSIX_VEC_NUM); >> msix_uninit(PCI_DEVICE(s), &s->msix, &s->msix); >> } >> @@ -601,7 +596,6 @@ static const VMStateDescription e1000e_vmstate = { >> VMSTATE_MSIX(parent_obj, E1000EState), >> >> VMSTATE_UINT32(ioaddr, E1000EState), >> - VMSTATE_UINT32(intr_state, E1000EState), We can still do this, because as Paolo pointed out, no released version of QEMU had this device. >> VMSTATE_UINT32(core.rxbuf_min_shift, E1000EState), >> VMSTATE_UINT8(core.rx_desc_len, E1000EState), >> VMSTATE_UINT32_ARRAY(core.rxbuf_sizes, E1000EState, >> -- >> 2.1.0 Reviewed-by: Markus Armbruster <armbru@redhat.com>
On 18/08/2016 16:15, Cao jin wrote: > Commit 66bf7d58 removed internal msi state flag E1000E_USE_MSI, E1000E_USE_MSIX > is not necessary too, remove it now. And interrupt flag field intr_state also > can be removed now. > > CC: Dmitry Fleytman <dmitry@daynix.com> > CC: Jason Wang <jasowang@redhat.com> > CC: Markus Armbruster <armbru@redhat.com> > CC: Marcel Apfelbaum <marcel@redhat.com> > CC: Michael S. Tsirkin <mst@redhat.com> > CC: Paolo Bonzini <pbonzini@redhat.com> > Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com> > --- > hw/net/e1000e.c | 8 +------- > 1 file changed, 1 insertion(+), 7 deletions(-) > > diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c > index 82a7be1..72aad21 100644 > --- a/hw/net/e1000e.c > +++ b/hw/net/e1000e.c > @@ -69,7 +69,6 @@ typedef struct E1000EState { > uint16_t subsys_ven_used; > uint16_t subsys_used; > > - uint32_t intr_state; > bool disable_vnet; > > E1000ECore core; > @@ -89,8 +88,6 @@ typedef struct E1000EState { > #define E1000E_MSIX_TABLE (0x0000) > #define E1000E_MSIX_PBA (0x2000) > > -#define E1000E_USE_MSIX BIT(0) > - > static uint64_t > e1000e_mmio_read(void *opaque, hwaddr addr, unsigned size) > { > @@ -302,8 +299,6 @@ e1000e_init_msix(E1000EState *s) > } else { > if (!e1000e_use_msix_vectors(s, E1000E_MSIX_VEC_NUM)) { > msix_uninit(d, &s->msix, &s->msix); > - } else { > - s->intr_state |= E1000E_USE_MSIX; > } > } > } > @@ -311,7 +306,7 @@ e1000e_init_msix(E1000EState *s) > static void > e1000e_cleanup_msix(E1000EState *s) > { > - if (s->intr_state & E1000E_USE_MSIX) { > + if (msix_enabled(PCI_DEVICE(s))) { > e1000e_unuse_msix_vectors(s, E1000E_MSIX_VEC_NUM); > msix_uninit(PCI_DEVICE(s), &s->msix, &s->msix); > } > @@ -601,7 +596,6 @@ static const VMStateDescription e1000e_vmstate = { > VMSTATE_MSIX(parent_obj, E1000EState), > > VMSTATE_UINT32(ioaddr, E1000EState), > - VMSTATE_UINT32(intr_state, E1000EState), > VMSTATE_UINT32(core.rxbuf_min_shift, E1000EState), > VMSTATE_UINT8(core.rx_desc_len, E1000EState), > VMSTATE_UINT32_ARRAY(core.rxbuf_sizes, E1000EState, > If there's time to get this in 2.7, it would be good. Jason? Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Markus Armbruster <armbru@redhat.com> writes: > Dmitry Fleytman <dmitry@daynix.com> writes: > >>> On 18 Aug 2016, at 17:15, Cao jin <caoj.fnst@cn.fujitsu.com> wrote: [...] >>> @@ -601,7 +596,6 @@ static const VMStateDescription e1000e_vmstate = { >>> VMSTATE_MSIX(parent_obj, E1000EState), >>> >>> VMSTATE_UINT32(ioaddr, E1000EState), >>> - VMSTATE_UINT32(intr_state, E1000EState), > > We can still do this, because as Paolo pointed out, no released version > of QEMU had this device. Which means we better get this into 2.7.0. Thoughts? >>> VMSTATE_UINT32(core.rxbuf_min_shift, E1000EState), >>> VMSTATE_UINT8(core.rx_desc_len, E1000EState), >>> VMSTATE_UINT32_ARRAY(core.rxbuf_sizes, E1000EState, >>> -- >>> 2.1.0 > > Reviewed-by: Markus Armbruster <armbru@redhat.com>
> On 18 Aug 2016, at 19:41 PM, Markus Armbruster <armbru@redhat.com> wrote: > > Dmitry Fleytman <dmitry@daynix.com> writes: > >>> On 18 Aug 2016, at 17:15, Cao jin <caoj.fnst@cn.fujitsu.com> wrote: >>> >>> Commit 66bf7d58 removed internal msi state flag E1000E_USE_MSI, E1000E_USE_MSIX >>> is not necessary too, remove it now. And interrupt flag field intr_state also >>> can be removed now. >>> >>> CC: Dmitry Fleytman <dmitry@daynix.com> >>> CC: Jason Wang <jasowang@redhat.com> >>> CC: Markus Armbruster <armbru@redhat.com> >>> CC: Marcel Apfelbaum <marcel@redhat.com> >>> CC: Michael S. Tsirkin <mst@redhat.com> >>> CC: Paolo Bonzini <pbonzini@redhat.com> >>> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com> >>> --- >>> hw/net/e1000e.c | 8 +------- >>> 1 file changed, 1 insertion(+), 7 deletions(-) >>> >>> diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c >>> index 82a7be1..72aad21 100644 >>> --- a/hw/net/e1000e.c >>> +++ b/hw/net/e1000e.c >>> @@ -69,7 +69,6 @@ typedef struct E1000EState { >>> uint16_t subsys_ven_used; >>> uint16_t subsys_used; >>> >>> - uint32_t intr_state; >>> bool disable_vnet; >>> >>> E1000ECore core; >>> @@ -89,8 +88,6 @@ typedef struct E1000EState { >>> #define E1000E_MSIX_TABLE (0x0000) >>> #define E1000E_MSIX_PBA (0x2000) >>> >>> -#define E1000E_USE_MSIX BIT(0) >>> - >>> static uint64_t >>> e1000e_mmio_read(void *opaque, hwaddr addr, unsigned size) >>> { >>> @@ -302,8 +299,6 @@ e1000e_init_msix(E1000EState *s) >>> } else { >>> if (!e1000e_use_msix_vectors(s, E1000E_MSIX_VEC_NUM)) { >>> msix_uninit(d, &s->msix, &s->msix); >>> - } else { >>> - s->intr_state |= E1000E_USE_MSIX; >> >> So you are removing error handling here. But what if e1000e_use_msix_vectors fails? > > Before the patch, E1000E_USE_MSIX is set exactly when MSI-X was enabled > successfully. It's only use is in MSI-X cleanup (next hunk): cleanup is > skipped when the flag isn't set. > > The flag is pointless, because we can just as well test whether MSI-X is > enabled directly. That's what the patch does. I see. Acked-by: Dmitry Fleytman <dmitry@daynix.com> > >> >>> } >>> } >>> } >>> @@ -311,7 +306,7 @@ e1000e_init_msix(E1000EState *s) >>> static void >>> e1000e_cleanup_msix(E1000EState *s) >>> { >>> - if (s->intr_state & E1000E_USE_MSIX) { >>> + if (msix_enabled(PCI_DEVICE(s))) { >>> e1000e_unuse_msix_vectors(s, E1000E_MSIX_VEC_NUM); >>> msix_uninit(PCI_DEVICE(s), &s->msix, &s->msix); >>> } >>> @@ -601,7 +596,6 @@ static const VMStateDescription e1000e_vmstate = { >>> VMSTATE_MSIX(parent_obj, E1000EState), >>> >>> VMSTATE_UINT32(ioaddr, E1000EState), >>> - VMSTATE_UINT32(intr_state, E1000EState), > > We can still do this, because as Paolo pointed out, no released version > of QEMU had this device. > >>> VMSTATE_UINT32(core.rxbuf_min_shift, E1000EState), >>> VMSTATE_UINT8(core.rx_desc_len, E1000EState), >>> VMSTATE_UINT32_ARRAY(core.rxbuf_sizes, E1000EState, >>> -- >>> 2.1.0 > > Reviewed-by: Markus Armbruster <armbru@redhat.com>
On 2016年08月19日 00:57, Paolo Bonzini wrote: > > On 18/08/2016 16:15, Cao jin wrote: >> Commit 66bf7d58 removed internal msi state flag E1000E_USE_MSI, E1000E_USE_MSIX >> is not necessary too, remove it now. And interrupt flag field intr_state also >> can be removed now. >> >> CC: Dmitry Fleytman <dmitry@daynix.com> >> CC: Jason Wang <jasowang@redhat.com> >> CC: Markus Armbruster <armbru@redhat.com> >> CC: Marcel Apfelbaum <marcel@redhat.com> >> CC: Michael S. Tsirkin <mst@redhat.com> >> CC: Paolo Bonzini <pbonzini@redhat.com> >> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com> >> --- >> hw/net/e1000e.c | 8 +------- >> 1 file changed, 1 insertion(+), 7 deletions(-) >> >> diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c >> index 82a7be1..72aad21 100644 >> --- a/hw/net/e1000e.c >> +++ b/hw/net/e1000e.c >> @@ -69,7 +69,6 @@ typedef struct E1000EState { >> uint16_t subsys_ven_used; >> uint16_t subsys_used; >> >> - uint32_t intr_state; >> bool disable_vnet; >> >> E1000ECore core; >> @@ -89,8 +88,6 @@ typedef struct E1000EState { >> #define E1000E_MSIX_TABLE (0x0000) >> #define E1000E_MSIX_PBA (0x2000) >> >> -#define E1000E_USE_MSIX BIT(0) >> - >> static uint64_t >> e1000e_mmio_read(void *opaque, hwaddr addr, unsigned size) >> { >> @@ -302,8 +299,6 @@ e1000e_init_msix(E1000EState *s) >> } else { >> if (!e1000e_use_msix_vectors(s, E1000E_MSIX_VEC_NUM)) { >> msix_uninit(d, &s->msix, &s->msix); >> - } else { >> - s->intr_state |= E1000E_USE_MSIX; >> } >> } >> } >> @@ -311,7 +306,7 @@ e1000e_init_msix(E1000EState *s) >> static void >> e1000e_cleanup_msix(E1000EState *s) >> { >> - if (s->intr_state & E1000E_USE_MSIX) { >> + if (msix_enabled(PCI_DEVICE(s))) { >> e1000e_unuse_msix_vectors(s, E1000E_MSIX_VEC_NUM); >> msix_uninit(PCI_DEVICE(s), &s->msix, &s->msix); >> } >> @@ -601,7 +596,6 @@ static const VMStateDescription e1000e_vmstate = { >> VMSTATE_MSIX(parent_obj, E1000EState), >> >> VMSTATE_UINT32(ioaddr, E1000EState), >> - VMSTATE_UINT32(intr_state, E1000EState), >> VMSTATE_UINT32(core.rxbuf_min_shift, E1000EState), >> VMSTATE_UINT8(core.rx_desc_len, E1000EState), >> VMSTATE_UINT32_ARRAY(core.rxbuf_sizes, E1000EState, >> > If there's time to get this in 2.7, it would be good. Jason? Yes, will send a pull request with this today. > > Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Thanks and applied to -net.
diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c index 82a7be1..72aad21 100644 --- a/hw/net/e1000e.c +++ b/hw/net/e1000e.c @@ -69,7 +69,6 @@ typedef struct E1000EState { uint16_t subsys_ven_used; uint16_t subsys_used; - uint32_t intr_state; bool disable_vnet; E1000ECore core; @@ -89,8 +88,6 @@ typedef struct E1000EState { #define E1000E_MSIX_TABLE (0x0000) #define E1000E_MSIX_PBA (0x2000) -#define E1000E_USE_MSIX BIT(0) - static uint64_t e1000e_mmio_read(void *opaque, hwaddr addr, unsigned size) { @@ -302,8 +299,6 @@ e1000e_init_msix(E1000EState *s) } else { if (!e1000e_use_msix_vectors(s, E1000E_MSIX_VEC_NUM)) { msix_uninit(d, &s->msix, &s->msix); - } else { - s->intr_state |= E1000E_USE_MSIX; } } } @@ -311,7 +306,7 @@ e1000e_init_msix(E1000EState *s) static void e1000e_cleanup_msix(E1000EState *s) { - if (s->intr_state & E1000E_USE_MSIX) { + if (msix_enabled(PCI_DEVICE(s))) { e1000e_unuse_msix_vectors(s, E1000E_MSIX_VEC_NUM); msix_uninit(PCI_DEVICE(s), &s->msix, &s->msix); } @@ -601,7 +596,6 @@ static const VMStateDescription e1000e_vmstate = { VMSTATE_MSIX(parent_obj, E1000EState), VMSTATE_UINT32(ioaddr, E1000EState), - VMSTATE_UINT32(intr_state, E1000EState), VMSTATE_UINT32(core.rxbuf_min_shift, E1000EState), VMSTATE_UINT8(core.rx_desc_len, E1000EState), VMSTATE_UINT32_ARRAY(core.rxbuf_sizes, E1000EState,
Commit 66bf7d58 removed internal msi state flag E1000E_USE_MSI, E1000E_USE_MSIX is not necessary too, remove it now. And interrupt flag field intr_state also can be removed now. CC: Dmitry Fleytman <dmitry@daynix.com> CC: Jason Wang <jasowang@redhat.com> CC: Markus Armbruster <armbru@redhat.com> CC: Marcel Apfelbaum <marcel@redhat.com> CC: Michael S. Tsirkin <mst@redhat.com> CC: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com> --- hw/net/e1000e.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)