From patchwork Tue Mar 25 18:30:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 333655 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 488E6140095 for ; Wed, 26 Mar 2014 05:31:46 +1100 (EST) Received: from localhost ([::1]:43538 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSW8V-000792-84 for incoming@patchwork.ozlabs.org; Tue, 25 Mar 2014 14:31:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSW7o-0006yo-TH for qemu-devel@nongnu.org; Tue, 25 Mar 2014 14:31:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WSW7i-0006uW-TL for qemu-devel@nongnu.org; Tue, 25 Mar 2014 14:31:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45610) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSW7i-0006ti-MC for qemu-devel@nongnu.org; Tue, 25 Mar 2014 14:30:54 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2PIUi0O008280 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 25 Mar 2014 14:30:45 -0400 Received: from bling.home (ovpn-113-117.phx2.redhat.com [10.3.113.117]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s2PIUJux029269; Tue, 25 Mar 2014 14:30:19 -0400 From: Alex Williamson To: peter.maydell@linaro.org, aliguori@amazon.com Date: Tue, 25 Mar 2014 12:30:19 -0600 Message-ID: <20140325183019.6587.81280.stgit@bling.home> In-Reply-To: <20140325182903.6587.14357.stgit@bling.home> References: <20140325182903.6587.14357.stgit@bling.home> User-Agent: StGit/0.17-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Bandan Das , qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 1/2] vfio: Correction in vfio_rom_read when attempting rom loading X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Bandan Das commit e638073c569e801ce9de added a flag to track whether a previous rom read had failed. Accidentally, the code ended up adding vfio_load_option_rom twice. (Thanks to Alex for spotting it) Signed-off-by: Bandan Das Signed-off-by: Alex Williamson --- hw/misc/vfio.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c index c2c688c..7147430 100644 --- a/hw/misc/vfio.c +++ b/hw/misc/vfio.c @@ -1192,11 +1192,8 @@ static uint64_t vfio_rom_read(void *opaque, hwaddr addr, unsigned size) uint64_t val = ((uint64_t)1 << (size * 8)) - 1; /* Load the ROM lazily when the guest tries to read it */ - if (unlikely(!vdev->rom)) { + if (unlikely(!vdev->rom && !vdev->rom_read_failed)) { vfio_pci_load_rom(vdev); - if (unlikely(!vdev->rom && !vdev->rom_read_failed)) { - vfio_pci_load_rom(vdev); - } } memcpy(&val, vdev->rom + addr,