From patchwork Fri Dec 24 03:14:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 76587 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 03D4FB70CF for ; Fri, 24 Dec 2010 14:32:00 +1100 (EST) Received: from localhost ([127.0.0.1]:39421 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PVyNo-0000SS-EI for incoming@patchwork.ozlabs.org; Thu, 23 Dec 2010 22:31:56 -0500 Received: from [140.186.70.92] (port=55500 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PVy6p-0008UZ-8f for qemu-devel@nongnu.org; Thu, 23 Dec 2010 22:14:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PVy6n-0001pu-Md for qemu-devel@nongnu.org; Thu, 23 Dec 2010 22:14:23 -0500 Received: from mail.valinux.co.jp ([210.128.90.3]:41211) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PVy6n-0001pS-5o for qemu-devel@nongnu.org; Thu, 23 Dec 2010 22:14:21 -0500 Received: from ps.local.valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by mail.valinux.co.jp (Postfix) with SMTP id BB58528049; Fri, 24 Dec 2010 12:14:19 +0900 (JST) Received: (nullmailer pid 8332 invoked by uid 1000); Fri, 24 Dec 2010 03:14:16 -0000 From: Isaku Yamahata To: qemu-devel@nongnu.org Date: Fri, 24 Dec 2010 12:14:16 +0900 Message-Id: X-Mailer: git-send-email 1.7.1.1 In-Reply-To: References: In-Reply-To: References: X-Virus-Scanned: clamav-milter 0.95.2 at va-mail.local.valinux.co.jp X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: yamahata@valinux.co.jp, mst@redhat.com Subject: [Qemu-devel] [PATCH v11 5/5] pcie/aer: use fw device path as fallback for aer injection command X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org pcie_aer_inject command: When qdev id failed, try fw device path as fallback. Signed-off-by: Isaku Yamahata --- hmp-commands.hx | 7 ++++++- hw/pcie_aer.c | 12 ++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 8d84ddc..928ded4 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -878,12 +878,17 @@ ETEXI "id:s,error_status:s," "header0:i?,header1:i?,header2:i?,header3:i?," "prefix0:i?,prefix1:i?,prefix2:i?,prefix3:i?", - .params = "[-a] [-c] id " + .params = "[-a] [-c] [id|pci_fw_dev_path] " " [ []]", .help = "inject pcie aer error\n\t\t\t" " -a for advisory non fatal error\n\t\t\t" " -c for correctable error\n\t\t\t" " = qdev device id\n\t\t\t" + " = fw device path to pci device" + "\n\t\t\t/pci@" + "[]@,/.../" + "[]@,\n\t\t\t" + "e.g. /pci@i0cf8/@1,1\n\t\t\t" " = error string or 32bit\n\t\t\t" " = 32bit x 4\n\t\t\t" " = 32bit x 4", diff --git a/hw/pcie_aer.c b/hw/pcie_aer.c index 6e653dd..6bad79c 100644 --- a/hw/pcie_aer.c +++ b/hw/pcie_aer.c @@ -969,10 +969,14 @@ int do_pcie_aer_inejct_error(Monitor *mon, ret = pci_qdev_find_device(id, &dev); if (ret < 0) { - monitor_printf(mon, - "id or pci device path is invalid or device not " - "found. %s\n", id); - return ret; + /* fall back to fw device path */ + ret = pci_parse_fw_dev_path(id, &dev); + if (ret < 0) { + monitor_printf(mon, + "id or pci device path is invalid or device not " + "found. %s\n", id); + return ret; + } } if (!pci_is_express(dev)) { monitor_printf(mon, "the device doesn't support pci express. %s\n",