All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Cam Macdonell <cam@cs.ualberta.ca>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	qemu-stable@nongnu.org, qemu-devel@nongnu.org,
	Alexander Graf <agraf@suse.de>, Blue Swirl <blauwirbel@gmail.com>
Subject: Re: [Qemu-devel] [PATCH master/v1.0.x] ivshmem: add missing msix calls
Date: Sun, 15 Jan 2012 19:15:55 +0100	[thread overview]
Message-ID: <4F1317DB.8090805@suse.de> (raw)
In-Reply-To: <CAKjmthK2t61hJb-ajyP=+Ja3mzwjStx-u8zaRc1ZXjqXmTKrOw@mail.gmail.com>

Am 13.01.2012 23:43, schrieb Cam Macdonell:
> Can this patch be merged, please?

You need to cc qemu-stable if you want it backported to v1.0.x once applied.

Andreas

> On Mon, Dec 5, 2011 at 12:48 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
>> ivshmem used msix but didn't call it on either reset or
>> config write paths. This used to partically work since
>> guests don't use all of msi-x configuration fields,
>> and reset is rarely used, but the patch 'msix: track function masked
>> in pci device state' broke that. Fix by adding appropriate calls.
>>
>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>> Reported-by: Cam Macdonell <cam@cs.ualberta.ca>
>> Tested-by: Cam Macdonell <cam@cs.ualberta.ca>
>>
>> ---
>>
>> Please apply the following to both master
>> and 1.0 stable branch. Thanks!
>>
>> diff --git a/hw/ivshmem.c b/hw/ivshmem.c
>> index 242fbea..c58f4d3 100644
>> --- a/hw/ivshmem.c
>> +++ b/hw/ivshmem.c
>> @@ -500,11 +500,29 @@ static void ivshmem_read(void *opaque, const uint8_t * buf, int flags)
>>     return;
>>  }
>>
>> +/* Select the MSI-X vectors used by device.
>> + * ivshmem maps events to vectors statically, so
>> + * we just enable all vectors on init and after reset. */
>> +static void ivshmem_use_msix(IVShmemState * s)
>> +{
>> +    int i;
>> +
>> +    if (!msix_present(&s->dev)) {
>> +        return;
>> +    }
>> +
>> +    for (i = 0; i < s->vectors; i++) {
>> +        msix_vector_use(&s->dev, i);
>> +    }
>> +}
>> +
>>  static void ivshmem_reset(DeviceState *d)
>>  {
>>     IVShmemState *s = DO_UPCAST(IVShmemState, dev.qdev, d);
>>
>>     s->intrstatus = 0;
>> +    msix_reset(&s->dev);
>> +    ivshmem_use_msix(s);
>>     return;
>>  }
>>
>> @@ -535,12 +553,8 @@ static uint64_t ivshmem_get_size(IVShmemState * s) {
>>     return value;
>>  }
>>
>> -static void ivshmem_setup_msi(IVShmemState * s) {
>> -
>> -    int i;
>> -
>> -    /* allocate the MSI-X vectors */
>> -
>> +static void ivshmem_setup_msi(IVShmemState * s)
>> +{
>>     memory_region_init(&s->msix_bar, "ivshmem-msix", 4096);
>>     if (!msix_init(&s->dev, s->vectors, &s->msix_bar, 1, 0)) {
>>         pci_register_bar(&s->dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY,
>> @@ -551,13 +565,10 @@ static void ivshmem_setup_msi(IVShmemState * s) {
>>         exit(1);
>>     }
>>
>> -    /* 'activate' the vectors */
>> -    for (i = 0; i < s->vectors; i++) {
>> -        msix_vector_use(&s->dev, i);
>> -    }
>> -
>>     /* allocate Qemu char devices for receiving interrupts */
>>     s->eventfd_table = g_malloc0(s->vectors * sizeof(EventfdEntry));
>> +
>> +    ivshmem_use_msix(s);
>>  }
>>
>>  static void ivshmem_save(QEMUFile* f, void *opaque)
>> @@ -610,6 +621,13 @@ static int ivshmem_load(QEMUFile* f, void *opaque, int version_id)
>>     return 0;
>>  }
>>
>> +static void ivshmem_write_config(PCIDevice *pci_dev, uint32_t address,
>> +                                uint32_t val, int len)
>> +{
>> +    pci_default_write_config(pci_dev, address, val, len);
>> +    msix_write_config(pci_dev, address, val, len);
>> +}
>> +
>>  static int pci_ivshmem_init(PCIDevice *dev)
>>  {
>>     IVShmemState *s = DO_UPCAST(IVShmemState, dev, dev);
>> @@ -734,6 +752,8 @@ static int pci_ivshmem_init(PCIDevice *dev)
>>
>>     }
>>
>> +    s->dev.config_write = ivshmem_write_config;
>> +
>>     return 0;
>>  }
>>

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  reply	other threads:[~2012-01-15 18:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-21 16:56 [Qemu-devel] [PATCH for v1.0 0/3] msix: fixes for 1.0 Michael S. Tsirkin
2011-11-21 16:57 ` [Qemu-devel] [PATCH for v1.0 1/3] msix: track function masked in pci device state Michael S. Tsirkin
2011-12-02 23:34   ` Cam Macdonell
2011-12-03 10:46     ` Jan Kiszka
2011-12-04 10:08     ` Michael S. Tsirkin
2011-12-04 10:20     ` Michael S. Tsirkin
2011-12-04 12:35       ` Jan Kiszka
2011-12-04 13:03         ` Michael S. Tsirkin
2011-12-04 23:47       ` Cam Macdonell
2011-12-05  9:08         ` Michael S. Tsirkin
2011-12-05 19:25           ` Cam Macdonell
2011-12-05 19:48         ` [Qemu-devel] [PATCH master/v1.0.x] ivshmem: add missing msix calls Michael S. Tsirkin
2012-01-13 22:43           ` Cam Macdonell
2012-01-15 18:15             ` Andreas Färber [this message]
2011-11-21 16:57 ` [Qemu-devel] [PATCH for v1.0 2/3] msix: Prevent bogus mask updates on MMIO accesses Michael S. Tsirkin
2011-11-21 16:57 ` [Qemu-devel] [PATCH for v1.0 3/3] msix: avoid mask updates if mask is unchanged Michael S. Tsirkin
2011-11-22  0:23 ` [Qemu-devel] [PATCH for v1.0 0/3] msix: fixes for 1.0 Anthony Liguori

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=4F1317DB.8090805@suse.de \
    --to=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=blauwirbel@gmail.com \
    --cc=cam@cs.ualberta.ca \
    --cc=jan.kiszka@siemens.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.