From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:57753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmUeN-0001iz-Bx for qemu-devel@nongnu.org; Sun, 15 Jan 2012 13:17:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RmUeM-0003iH-1P for qemu-devel@nongnu.org; Sun, 15 Jan 2012 13:17:51 -0500 Message-ID: <4F1317DB.8090805@suse.de> Date: Sun, 15 Jan 2012 19:15:55 +0100 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <27ef57671106d9214757df8a1d4cc28287dae07c.1321893802.git.mst@redhat.com> <20111204102036.GB15464@redhat.com> <20111205194843.GA18939@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH master/v1.0.x] ivshmem: add missing msix calls List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cam Macdonell Cc: Anthony Liguori , "Michael S. Tsirkin" , Jan Kiszka , qemu-stable@nongnu.org, qemu-devel@nongnu.org, Alexander Graf , Blue Swirl 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 appli= ed. Andreas > On Mon, Dec 5, 2011 at 12:48 PM, Michael S. Tsirkin wr= ote: >> 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 >> Reported-by: Cam Macdonell >> Tested-by: Cam Macdonell >> >> --- >> >> 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 uin= t8_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 =3D 0; i < s->vectors; i++) { >> + msix_vector_use(&s->dev, i); >> + } >> +} >> + >> static void ivshmem_reset(DeviceState *d) >> { >> IVShmemState *s =3D DO_UPCAST(IVShmemState, dev.qdev, d); >> >> s->intrstatus =3D 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 =3D 0; i < s->vectors; i++) { >> - msix_vector_use(&s->dev, i); >> - } >> - >> /* allocate Qemu char devices for receiving interrupts */ >> s->eventfd_table =3D 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 =3D DO_UPCAST(IVShmemState, dev, dev); >> @@ -734,6 +752,8 @@ static int pci_ivshmem_init(PCIDevice *dev) >> >> } >> >> + s->dev.config_write =3D ivshmem_write_config; >> + >> return 0; >> } >> --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg