From patchwork Thu Feb 27 18:54:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bandan Das X-Patchwork-Id: 324893 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 CA8432C0081 for ; Fri, 28 Feb 2014 05:55:22 +1100 (EST) Received: from localhost ([::1]:47449 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJ675-0003Ax-EX for incoming@patchwork.ozlabs.org; Thu, 27 Feb 2014 13:55:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47599) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJ66l-00039B-1J for qemu-devel@nongnu.org; Thu, 27 Feb 2014 13:55:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WJ66f-0008Py-20 for qemu-devel@nongnu.org; Thu, 27 Feb 2014 13:54:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:5870) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WJ66e-0008PY-QF for qemu-devel@nongnu.org; Thu, 27 Feb 2014 13:54:52 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1RIsoK6027868 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 27 Feb 2014 13:54:50 -0500 Received: from nelium.bos.redhat.com ([10.18.25.173]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s1RIsnu5021987 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Thu, 27 Feb 2014 13:54:49 -0500 From: Bandan Das To: qemu-devel@nongnu.org Date: Thu, 27 Feb 2014 13:54:48 -0500 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Alex Williamson Subject: [Qemu-devel] [PATCH] 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 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 --- 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,