From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:58758) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjpaL-0003Ni-6x for qemu-devel@nongnu.org; Sun, 08 Jan 2012 05:02:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RjpaK-0006Xm-3C for qemu-devel@nongnu.org; Sun, 08 Jan 2012 05:02:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:24241) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjpaJ-0006Xf-SE for qemu-devel@nongnu.org; Sun, 08 Jan 2012 05:02:40 -0500 Message-ID: <4F0969BB.7080208@redhat.com> Date: Sun, 08 Jan 2012 12:02:35 +0200 From: Avi Kivity MIME-Version: 1.0 References: <1325687322-6797-1-git-send-email-avi@redhat.com> <20120104144721.GA5961@redhat.com> <4F05BE55.8030209@weilnetz.de> <20120108091706.GA25444@redhat.com> In-Reply-To: <20120108091706.GA25444@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH master/stable-1.0] pci: fix corrupted pci conf index register by unaligned write List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Stefan Weil , qemu-devel@nongnu.org On 01/08/2012 11:17 AM, Michael S. Tsirkin wrote: > On Thu, Jan 05, 2012 at 04:14:29PM +0100, Stefan Weil wrote: > > Am 04.01.2012 15:47, schrieb Michael S. Tsirkin: > > >On Wed, Jan 04, 2012 at 04:28:42PM +0200, Avi Kivity wrote: > > >>Commit d0ed8076cbdc261 converted the PCI config access to the memory > > >>API, but also inadvertantly changed it to accept unaligned writes, > > >>and corrupt the index register in the process. This causes a regression > > >>booting NetBSD. > > >> > > >>Fix by ignoring unaligned or non-dword writes. > > >> > > >>https://bugs.launchpad.net/qemu/+bug/897771 > > >> > > >>Reported-by: Andreas Gustafsson > > >>Signed-off-by: Avi Kivity > > > > > >Acked-by: Michael S. Tsirkin > > > > > >>--- > > >> > > >>hw/pci_host.c | 3 +++ > > >>1 files changed, 3 insertions(+), 0 deletions(-) > > >> > > >>diff --git a/hw/pci_host.c b/hw/pci_host.c > > >>index 44c6c20..8041778 100644 > > >>--- a/hw/pci_host.c > > >>+++ b/hw/pci_host.c > > >>@@ -101,6 +101,9 @@ static void pci_host_config_write(void > > >>*opaque, target_phys_addr_t addr, > > >> > > >>PCI_DPRINTF("%s addr " TARGET_FMT_plx " len %d val %"PRIx64"\n", > > >>__func__, addr, len, val); > > >>+ if (addr != 0 || len != 4) { > > >>+ return; > > >>+ } > > >>s->config_reg = val; > > >>} > > >> > > >>-- > > >>1.7.7.1 > > > > Non dword writes are quite common. I get them with Linux kernels, too. > > Do you really want to ignore them? > > Are you sure? > Note this is an io write at cf8. Not an unaligned config write. > > > And the check for unaligned writes is, well, unusual :-) What's unusual? > This seems to be how memory API behaves ... right, Avi? > Maybe this should be documented somewhere. Document what? -- error compiling committee.c: too many arguments to function