* [Qemu-devel] [PATCH for-1.2] msix: make [un]use vectors on reset/load optional
@ 2012-08-29 16:40 Michael S. Tsirkin
2012-08-29 16:44 ` Jan Kiszka
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Michael S. Tsirkin @ 2012-08-29 16:40 UTC (permalink / raw)
To: qemu-devel
Cc: Avi Kivity, Jan Kiszka, Anthony Liguori, Alex Williamson,
Michael S. Tsirkin
The facility to use/unuse vectors dynamically is helpful
for virtio but little else: everyone just seems to use
vectors in their init function.
Avoid clearing msix vector use info on reset and load.
For virtio, clear it explicitly.
This should fix regressions reported with ivshmem - though
I didn't test this, I verified that virtio keeps
working like it did.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/msix.c | 13 +++++++++++--
hw/virtio-pci.c | 2 ++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/hw/msix.c b/hw/msix.c
index 800fc32..d040cc2 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -340,6 +340,15 @@ static void msix_free_irq_entries(PCIDevice *dev)
}
}
+static void msix_clear_all_vectors(PCIDevice *dev)
+{
+ int vector;
+
+ for (vector = 0; vector < dev->msix_entries_nr; ++vector) {
+ msix_clr_pending(dev, vector);
+ }
+}
+
/* Clean up resources for the device. */
void msix_uninit(PCIDevice *dev, MemoryRegion *table_bar, MemoryRegion *pba_bar)
{
@@ -394,7 +403,7 @@ void msix_load(PCIDevice *dev, QEMUFile *f)
return;
}
- msix_free_irq_entries(dev);
+ msix_clear_all_vectors(dev);
qemu_get_buffer(f, dev->msix_table, n * PCI_MSIX_ENTRY_SIZE);
qemu_get_buffer(f, dev->msix_pba, (n + 7) / 8);
msix_update_function_masked(dev);
@@ -440,7 +449,7 @@ void msix_reset(PCIDevice *dev)
if (!msix_present(dev)) {
return;
}
- msix_free_irq_entries(dev);
+ msix_clear_all_vectors(dev);
dev->config[dev->msix_cap + MSIX_CONTROL_OFFSET] &=
~dev->wmask[dev->msix_cap + MSIX_CONTROL_OFFSET];
memset(dev->msix_table, 0, dev->msix_entries_nr * PCI_MSIX_ENTRY_SIZE);
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 125eded..ca0b204 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -131,6 +131,7 @@ static int virtio_pci_load_config(void * opaque, QEMUFile *f)
if (ret) {
return ret;
}
+ msix_unuse_all_vectors(&proxy->pci_dev);
msix_load(&proxy->pci_dev, f);
if (msix_present(&proxy->pci_dev)) {
qemu_get_be16s(f, &proxy->vdev->config_vector);
@@ -246,6 +247,7 @@ void virtio_pci_reset(DeviceState *d)
VirtIOPCIProxy *proxy = container_of(d, VirtIOPCIProxy, pci_dev.qdev);
virtio_pci_stop_ioeventfd(proxy);
virtio_reset(proxy->vdev);
+ msix_unuse_all_vectors(&proxy->pci_dev);
proxy->flags &= ~VIRTIO_PCI_FLAG_BUS_MASTER_BUG;
}
--
MST
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH for-1.2] msix: make [un]use vectors on reset/load optional
2012-08-29 16:40 [Qemu-devel] [PATCH for-1.2] msix: make [un]use vectors on reset/load optional Michael S. Tsirkin
@ 2012-08-29 16:44 ` Jan Kiszka
2012-08-29 16:47 ` Michael S. Tsirkin
2012-08-29 16:54 ` Andreas Färber
2012-08-29 17:17 ` Cam Macdonell
2 siblings, 1 reply; 9+ messages in thread
From: Jan Kiszka @ 2012-08-29 16:44 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Anthony Liguori, Cam Macdonell, Alex Williamson,
qemu-devel@nongnu.org, Avi Kivity
On 2012-08-29 18:40, Michael S. Tsirkin wrote:
> The facility to use/unuse vectors dynamically is helpful
> for virtio but little else: everyone just seems to use
> vectors in their init function.
>
> Avoid clearing msix vector use info on reset and load.
> For virtio, clear it explicitly.
> This should fix regressions reported with ivshmem - though
> I didn't test this, I verified that virtio keeps
> working like it did.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> hw/msix.c | 13 +++++++++++--
> hw/virtio-pci.c | 2 ++
> 2 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/hw/msix.c b/hw/msix.c
> index 800fc32..d040cc2 100644
> --- a/hw/msix.c
> +++ b/hw/msix.c
> @@ -340,6 +340,15 @@ static void msix_free_irq_entries(PCIDevice *dev)
> }
> }
>
> +static void msix_clear_all_vectors(PCIDevice *dev)
> +{
> + int vector;
> +
> + for (vector = 0; vector < dev->msix_entries_nr; ++vector) {
> + msix_clr_pending(dev, vector);
> + }
> +}
> +
> /* Clean up resources for the device. */
> void msix_uninit(PCIDevice *dev, MemoryRegion *table_bar, MemoryRegion *pba_bar)
> {
> @@ -394,7 +403,7 @@ void msix_load(PCIDevice *dev, QEMUFile *f)
> return;
> }
>
> - msix_free_irq_entries(dev);
> + msix_clear_all_vectors(dev);
> qemu_get_buffer(f, dev->msix_table, n * PCI_MSIX_ENTRY_SIZE);
> qemu_get_buffer(f, dev->msix_pba, (n + 7) / 8);
> msix_update_function_masked(dev);
> @@ -440,7 +449,7 @@ void msix_reset(PCIDevice *dev)
> if (!msix_present(dev)) {
> return;
> }
> - msix_free_irq_entries(dev);
> + msix_clear_all_vectors(dev);
> dev->config[dev->msix_cap + MSIX_CONTROL_OFFSET] &=
> ~dev->wmask[dev->msix_cap + MSIX_CONTROL_OFFSET];
> memset(dev->msix_table, 0, dev->msix_entries_nr * PCI_MSIX_ENTRY_SIZE);
> diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
> index 125eded..ca0b204 100644
> --- a/hw/virtio-pci.c
> +++ b/hw/virtio-pci.c
> @@ -131,6 +131,7 @@ static int virtio_pci_load_config(void * opaque, QEMUFile *f)
> if (ret) {
> return ret;
> }
> + msix_unuse_all_vectors(&proxy->pci_dev);
> msix_load(&proxy->pci_dev, f);
> if (msix_present(&proxy->pci_dev)) {
> qemu_get_be16s(f, &proxy->vdev->config_vector);
> @@ -246,6 +247,7 @@ void virtio_pci_reset(DeviceState *d)
> VirtIOPCIProxy *proxy = container_of(d, VirtIOPCIProxy, pci_dev.qdev);
> virtio_pci_stop_ioeventfd(proxy);
> virtio_reset(proxy->vdev);
> + msix_unuse_all_vectors(&proxy->pci_dev);
> proxy->flags &= ~VIRTIO_PCI_FLAG_BUS_MASTER_BUG;
> }
>
>
Fine with me, but let's ask Cam to test.
Jan
--
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH for-1.2] msix: make [un]use vectors on reset/load optional
2012-08-29 16:44 ` Jan Kiszka
@ 2012-08-29 16:47 ` Michael S. Tsirkin
2012-08-29 16:59 ` Cam Macdonell
0 siblings, 1 reply; 9+ messages in thread
From: Michael S. Tsirkin @ 2012-08-29 16:47 UTC (permalink / raw)
To: Jan Kiszka
Cc: Anthony Liguori, Cam Macdonell, Alex Williamson,
qemu-devel@nongnu.org, Avi Kivity
On Wed, Aug 29, 2012 at 06:44:49PM +0200, Jan Kiszka wrote:
> On 2012-08-29 18:40, Michael S. Tsirkin wrote:
> > The facility to use/unuse vectors dynamically is helpful
> > for virtio but little else: everyone just seems to use
> > vectors in their init function.
> >
> > Avoid clearing msix vector use info on reset and load.
> > For virtio, clear it explicitly.
> > This should fix regressions reported with ivshmem - though
> > I didn't test this, I verified that virtio keeps
> > working like it did.
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> > hw/msix.c | 13 +++++++++++--
> > hw/virtio-pci.c | 2 ++
> > 2 files changed, 13 insertions(+), 2 deletions(-)
> >
> > diff --git a/hw/msix.c b/hw/msix.c
> > index 800fc32..d040cc2 100644
> > --- a/hw/msix.c
> > +++ b/hw/msix.c
> > @@ -340,6 +340,15 @@ static void msix_free_irq_entries(PCIDevice *dev)
> > }
> > }
> >
> > +static void msix_clear_all_vectors(PCIDevice *dev)
> > +{
> > + int vector;
> > +
> > + for (vector = 0; vector < dev->msix_entries_nr; ++vector) {
> > + msix_clr_pending(dev, vector);
> > + }
> > +}
> > +
> > /* Clean up resources for the device. */
> > void msix_uninit(PCIDevice *dev, MemoryRegion *table_bar, MemoryRegion *pba_bar)
> > {
> > @@ -394,7 +403,7 @@ void msix_load(PCIDevice *dev, QEMUFile *f)
> > return;
> > }
> >
> > - msix_free_irq_entries(dev);
> > + msix_clear_all_vectors(dev);
> > qemu_get_buffer(f, dev->msix_table, n * PCI_MSIX_ENTRY_SIZE);
> > qemu_get_buffer(f, dev->msix_pba, (n + 7) / 8);
> > msix_update_function_masked(dev);
> > @@ -440,7 +449,7 @@ void msix_reset(PCIDevice *dev)
> > if (!msix_present(dev)) {
> > return;
> > }
> > - msix_free_irq_entries(dev);
> > + msix_clear_all_vectors(dev);
> > dev->config[dev->msix_cap + MSIX_CONTROL_OFFSET] &=
> > ~dev->wmask[dev->msix_cap + MSIX_CONTROL_OFFSET];
> > memset(dev->msix_table, 0, dev->msix_entries_nr * PCI_MSIX_ENTRY_SIZE);
> > diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
> > index 125eded..ca0b204 100644
> > --- a/hw/virtio-pci.c
> > +++ b/hw/virtio-pci.c
> > @@ -131,6 +131,7 @@ static int virtio_pci_load_config(void * opaque, QEMUFile *f)
> > if (ret) {
> > return ret;
> > }
> > + msix_unuse_all_vectors(&proxy->pci_dev);
> > msix_load(&proxy->pci_dev, f);
> > if (msix_present(&proxy->pci_dev)) {
> > qemu_get_be16s(f, &proxy->vdev->config_vector);
> > @@ -246,6 +247,7 @@ void virtio_pci_reset(DeviceState *d)
> > VirtIOPCIProxy *proxy = container_of(d, VirtIOPCIProxy, pci_dev.qdev);
> > virtio_pci_stop_ioeventfd(proxy);
> > virtio_reset(proxy->vdev);
> > + msix_unuse_all_vectors(&proxy->pci_dev);
> > proxy->flags &= ~VIRTIO_PCI_FLAG_BUS_MASTER_BUG;
> > }
> >
> >
>
> Fine with me, but let's ask Cam to test.
>
> Jan
Cam deadline is today - can u test quickly pls?
> --
> Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
> Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH for-1.2] msix: make [un]use vectors on reset/load optional
2012-08-29 16:47 ` Michael S. Tsirkin
@ 2012-08-29 16:59 ` Cam Macdonell
0 siblings, 0 replies; 9+ messages in thread
From: Cam Macdonell @ 2012-08-29 16:59 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Jan Kiszka, Anthony Liguori, Alex Williamson,
qemu-devel@nongnu.org, Avi Kivity
Yes, will test shortly.
Cam
On Wed, Aug 29, 2012 at 10:47 AM, Michael S. Tsirkin <mst@redhat.com> wrote:
> On Wed, Aug 29, 2012 at 06:44:49PM +0200, Jan Kiszka wrote:
>> On 2012-08-29 18:40, Michael S. Tsirkin wrote:
>> > The facility to use/unuse vectors dynamically is helpful
>> > for virtio but little else: everyone just seems to use
>> > vectors in their init function.
>> >
>> > Avoid clearing msix vector use info on reset and load.
>> > For virtio, clear it explicitly.
>> > This should fix regressions reported with ivshmem - though
>> > I didn't test this, I verified that virtio keeps
>> > working like it did.
>> >
>> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>> > ---
>> > hw/msix.c | 13 +++++++++++--
>> > hw/virtio-pci.c | 2 ++
>> > 2 files changed, 13 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/hw/msix.c b/hw/msix.c
>> > index 800fc32..d040cc2 100644
>> > --- a/hw/msix.c
>> > +++ b/hw/msix.c
>> > @@ -340,6 +340,15 @@ static void msix_free_irq_entries(PCIDevice *dev)
>> > }
>> > }
>> >
>> > +static void msix_clear_all_vectors(PCIDevice *dev)
>> > +{
>> > + int vector;
>> > +
>> > + for (vector = 0; vector < dev->msix_entries_nr; ++vector) {
>> > + msix_clr_pending(dev, vector);
>> > + }
>> > +}
>> > +
>> > /* Clean up resources for the device. */
>> > void msix_uninit(PCIDevice *dev, MemoryRegion *table_bar, MemoryRegion *pba_bar)
>> > {
>> > @@ -394,7 +403,7 @@ void msix_load(PCIDevice *dev, QEMUFile *f)
>> > return;
>> > }
>> >
>> > - msix_free_irq_entries(dev);
>> > + msix_clear_all_vectors(dev);
>> > qemu_get_buffer(f, dev->msix_table, n * PCI_MSIX_ENTRY_SIZE);
>> > qemu_get_buffer(f, dev->msix_pba, (n + 7) / 8);
>> > msix_update_function_masked(dev);
>> > @@ -440,7 +449,7 @@ void msix_reset(PCIDevice *dev)
>> > if (!msix_present(dev)) {
>> > return;
>> > }
>> > - msix_free_irq_entries(dev);
>> > + msix_clear_all_vectors(dev);
>> > dev->config[dev->msix_cap + MSIX_CONTROL_OFFSET] &=
>> > ~dev->wmask[dev->msix_cap + MSIX_CONTROL_OFFSET];
>> > memset(dev->msix_table, 0, dev->msix_entries_nr * PCI_MSIX_ENTRY_SIZE);
>> > diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
>> > index 125eded..ca0b204 100644
>> > --- a/hw/virtio-pci.c
>> > +++ b/hw/virtio-pci.c
>> > @@ -131,6 +131,7 @@ static int virtio_pci_load_config(void * opaque, QEMUFile *f)
>> > if (ret) {
>> > return ret;
>> > }
>> > + msix_unuse_all_vectors(&proxy->pci_dev);
>> > msix_load(&proxy->pci_dev, f);
>> > if (msix_present(&proxy->pci_dev)) {
>> > qemu_get_be16s(f, &proxy->vdev->config_vector);
>> > @@ -246,6 +247,7 @@ void virtio_pci_reset(DeviceState *d)
>> > VirtIOPCIProxy *proxy = container_of(d, VirtIOPCIProxy, pci_dev.qdev);
>> > virtio_pci_stop_ioeventfd(proxy);
>> > virtio_reset(proxy->vdev);
>> > + msix_unuse_all_vectors(&proxy->pci_dev);
>> > proxy->flags &= ~VIRTIO_PCI_FLAG_BUS_MASTER_BUG;
>> > }
>> >
>> >
>>
>> Fine with me, but let's ask Cam to test.
>>
>> Jan
>
> Cam deadline is today - can u test quickly pls?
>
>> --
>> Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
>> Corporate Competence Center Embedded Linux
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH for-1.2] msix: make [un]use vectors on reset/load optional
2012-08-29 16:40 [Qemu-devel] [PATCH for-1.2] msix: make [un]use vectors on reset/load optional Michael S. Tsirkin
2012-08-29 16:44 ` Jan Kiszka
@ 2012-08-29 16:54 ` Andreas Färber
2012-08-29 18:13 ` Michael S. Tsirkin
2012-08-29 17:17 ` Cam Macdonell
2 siblings, 1 reply; 9+ messages in thread
From: Andreas Färber @ 2012-08-29 16:54 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Jan Kiszka, Anthony Liguori, Alex Williamson, qemu-devel,
Avi Kivity
$subject: "[un]used vectors"? -- could be fixed by committer.
/-F
Am 29.08.2012 18:40, schrieb Michael S. Tsirkin:
> The facility to use/unuse vectors dynamically is helpful
> for virtio but little else: everyone just seems to use
> vectors in their init function.
>
> Avoid clearing msix vector use info on reset and load.
> For virtio, clear it explicitly.
> This should fix regressions reported with ivshmem - though
> I didn't test this, I verified that virtio keeps
> working like it did.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH for-1.2] msix: make [un]use vectors on reset/load optional
2012-08-29 16:54 ` Andreas Färber
@ 2012-08-29 18:13 ` Michael S. Tsirkin
2012-08-30 13:34 ` Andreas Färber
0 siblings, 1 reply; 9+ messages in thread
From: Michael S. Tsirkin @ 2012-08-29 18:13 UTC (permalink / raw)
To: Andreas Färber
Cc: Jan Kiszka, Anthony Liguori, Alex Williamson, qemu-devel,
Avi Kivity
On Wed, Aug 29, 2012 at 06:54:35PM +0200, Andreas Färber wrote:
> $subject: "[un]used vectors"? -- could be fixed by committer.
>
> /-F
Sorry I don't unedrstand. it's not 'unused': it's use and unuse.
What is wrong with the subject?
> Am 29.08.2012 18:40, schrieb Michael S. Tsirkin:
> > The facility to use/unuse vectors dynamically is helpful
> > for virtio but little else: everyone just seems to use
> > vectors in their init function.
> >
> > Avoid clearing msix vector use info on reset and load.
> > For virtio, clear it explicitly.
> > This should fix regressions reported with ivshmem - though
> > I didn't test this, I verified that virtio keeps
> > working like it did.
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>
> --
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH for-1.2] msix: make [un]use vectors on reset/load optional
2012-08-29 18:13 ` Michael S. Tsirkin
@ 2012-08-30 13:34 ` Andreas Färber
2012-08-30 14:39 ` Michael S. Tsirkin
0 siblings, 1 reply; 9+ messages in thread
From: Andreas Färber @ 2012-08-30 13:34 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Jan Kiszka, Anthony Liguori, Alex Williamson, qemu-devel,
Avi Kivity
Am 29.08.2012 20:13, schrieb Michael S. Tsirkin:
> On Wed, Aug 29, 2012 at 06:54:35PM +0200, Andreas Färber wrote:
>> $subject: "[un]used vectors"? -- could be fixed by committer.
>
> Sorry I don't unedrstand. it's not 'unused': it's use and unuse.
> What is wrong with the subject?
The grammar with two verbs "make [un]use" sounded wrong to my ears.
Given your explanation of [un]use above, did you mean "make clearing
[un]use vectors optional on reset/load" or something like that?
/-F
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH for-1.2] msix: make [un]use vectors on reset/load optional
2012-08-30 13:34 ` Andreas Färber
@ 2012-08-30 14:39 ` Michael S. Tsirkin
0 siblings, 0 replies; 9+ messages in thread
From: Michael S. Tsirkin @ 2012-08-30 14:39 UTC (permalink / raw)
To: Andreas Färber
Cc: Jan Kiszka, Anthony Liguori, Alex Williamson, qemu-devel,
Avi Kivity
On Thu, Aug 30, 2012 at 03:34:42PM +0200, Andreas Färber wrote:
> Am 29.08.2012 20:13, schrieb Michael S. Tsirkin:
> > On Wed, Aug 29, 2012 at 06:54:35PM +0200, Andreas Färber wrote:
> >> $subject: "[un]used vectors"? -- could be fixed by committer.
> >
> > Sorry I don't unedrstand. it's not 'unused': it's use and unuse.
> > What is wrong with the subject?
>
> The grammar with two verbs "make [un]use" sounded wrong to my ears.
> Given your explanation of [un]use above, did you mean "make clearing
> [un]use vectors optional on reset/load" or something like that?
>
> /-F
No, sorry. What is meant is simply functions
msix_vector_use/msix_vector_unuse:
calling these on reset/load was required but
is now optional.
> --
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] [PATCH for-1.2] msix: make [un]use vectors on reset/load optional
2012-08-29 16:40 [Qemu-devel] [PATCH for-1.2] msix: make [un]use vectors on reset/load optional Michael S. Tsirkin
2012-08-29 16:44 ` Jan Kiszka
2012-08-29 16:54 ` Andreas Färber
@ 2012-08-29 17:17 ` Cam Macdonell
2 siblings, 0 replies; 9+ messages in thread
From: Cam Macdonell @ 2012-08-29 17:17 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Jan Kiszka, Anthony Liguori, Alex Williamson, qemu-devel,
Avi Kivity
Yes, works for me.
On Wed, Aug 29, 2012 at 10:40 AM, Michael S. Tsirkin <mst@redhat.com> wrote:
> The facility to use/unuse vectors dynamically is helpful
> for virtio but little else: everyone just seems to use
> vectors in their init function.
>
> Avoid clearing msix vector use info on reset and load.
> For virtio, clear it explicitly.
> This should fix regressions reported with ivshmem - though
> I didn't test this, I verified that virtio keeps
> working like it did.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Cam Macdonell <cam@cs.ualberta.ca>
> ---
> hw/msix.c | 13 +++++++++++--
> hw/virtio-pci.c | 2 ++
> 2 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/hw/msix.c b/hw/msix.c
> index 800fc32..d040cc2 100644
> --- a/hw/msix.c
> +++ b/hw/msix.c
> @@ -340,6 +340,15 @@ static void msix_free_irq_entries(PCIDevice *dev)
> }
> }
>
> +static void msix_clear_all_vectors(PCIDevice *dev)
> +{
> + int vector;
> +
> + for (vector = 0; vector < dev->msix_entries_nr; ++vector) {
> + msix_clr_pending(dev, vector);
> + }
> +}
> +
> /* Clean up resources for the device. */
> void msix_uninit(PCIDevice *dev, MemoryRegion *table_bar, MemoryRegion *pba_bar)
> {
> @@ -394,7 +403,7 @@ void msix_load(PCIDevice *dev, QEMUFile *f)
> return;
> }
>
> - msix_free_irq_entries(dev);
> + msix_clear_all_vectors(dev);
> qemu_get_buffer(f, dev->msix_table, n * PCI_MSIX_ENTRY_SIZE);
> qemu_get_buffer(f, dev->msix_pba, (n + 7) / 8);
> msix_update_function_masked(dev);
> @@ -440,7 +449,7 @@ void msix_reset(PCIDevice *dev)
> if (!msix_present(dev)) {
> return;
> }
> - msix_free_irq_entries(dev);
> + msix_clear_all_vectors(dev);
> dev->config[dev->msix_cap + MSIX_CONTROL_OFFSET] &=
> ~dev->wmask[dev->msix_cap + MSIX_CONTROL_OFFSET];
> memset(dev->msix_table, 0, dev->msix_entries_nr * PCI_MSIX_ENTRY_SIZE);
> diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
> index 125eded..ca0b204 100644
> --- a/hw/virtio-pci.c
> +++ b/hw/virtio-pci.c
> @@ -131,6 +131,7 @@ static int virtio_pci_load_config(void * opaque, QEMUFile *f)
> if (ret) {
> return ret;
> }
> + msix_unuse_all_vectors(&proxy->pci_dev);
> msix_load(&proxy->pci_dev, f);
> if (msix_present(&proxy->pci_dev)) {
> qemu_get_be16s(f, &proxy->vdev->config_vector);
> @@ -246,6 +247,7 @@ void virtio_pci_reset(DeviceState *d)
> VirtIOPCIProxy *proxy = container_of(d, VirtIOPCIProxy, pci_dev.qdev);
> virtio_pci_stop_ioeventfd(proxy);
> virtio_reset(proxy->vdev);
> + msix_unuse_all_vectors(&proxy->pci_dev);
> proxy->flags &= ~VIRTIO_PCI_FLAG_BUS_MASTER_BUG;
> }
>
> --
> MST
>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-08-30 14:38 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-29 16:40 [Qemu-devel] [PATCH for-1.2] msix: make [un]use vectors on reset/load optional Michael S. Tsirkin
2012-08-29 16:44 ` Jan Kiszka
2012-08-29 16:47 ` Michael S. Tsirkin
2012-08-29 16:59 ` Cam Macdonell
2012-08-29 16:54 ` Andreas Färber
2012-08-29 18:13 ` Michael S. Tsirkin
2012-08-30 13:34 ` Andreas Färber
2012-08-30 14:39 ` Michael S. Tsirkin
2012-08-29 17:17 ` Cam Macdonell
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).