From nobody Mon Feb 9 17:25:13 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669896816; cv=none; d=zohomail.com; s=zohoarc; b=gf7IH+WdjfhL6uTbCrqu6S5P24YC788PTa06o6nop3vjIWbq36l8sHehd++IvIoIb+iz1stPC6FmgA5Z45tVj14po24rgNsE0ShOdOS0Zmyr1eZAjg2XywHqEjdsyf0zFRdUo6DTZFToE+yiUtdeSbnhzLPzwYKN97TtwID6dn4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669896816; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FuoaHqgZPopfGjoLRo1usA7dSB1m6YAgnROu6BuKS8Y=; b=HuGkbCIoms9iPwKpSFCvoPYglQhATqeQHkwpsZOhmzmIaIhmAOFC1O2QhiJgF8/ZKGaWlBknspMI7hdhy5z3vFnoFtvqvGmKBpsXz8JPrVKpuV8eDPHBljOLlG8YfcWekuLClt95xbB6R0Y5JnrpYUfabd6e+eHMv+04EAeiCR0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1669896816635319.80829940215835; Thu, 1 Dec 2022 04:13:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p0iPy-0004Ia-PQ; Thu, 01 Dec 2022 07:11:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0iPs-0004Fq-Sd for qemu-devel@nongnu.org; Thu, 01 Dec 2022 07:11:48 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0iPp-0008Ex-17 for qemu-devel@nongnu.org; Thu, 01 Dec 2022 07:11:48 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-42-XXJgwFNFPV-6kxLzenAT0w-1; Thu, 01 Dec 2022 07:11:41 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CA75E811E84; Thu, 1 Dec 2022 12:11:40 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9C2482024CBE; Thu, 1 Dec 2022 12:11:40 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 007D021E65CA; Thu, 1 Dec 2022 13:11:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669896704; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FuoaHqgZPopfGjoLRo1usA7dSB1m6YAgnROu6BuKS8Y=; b=cKFawZJ8udAmwTQgywcnJWa9anfMPjjrGrn7lALItuI4kK91U5OHA2TkV9Sd4efgHoTvxV nE7rY0p3Cv8KMFdI9BRL86pGr8O3sbSG7IYV+ZJSVws3j6n0oO0gvEpwODZF/GUYEBMaGT chpV/7VaV9STiFR7W91AD8Jk+1cAqLE= X-MC-Unique: XXJgwFNFPV-6kxLzenAT0w-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: mst@redhat.com, marcel.apfelbaum@gmail.com, dgilbert@redhat.com, philmd@linaro.org Subject: [PATCH v2 10/13] pci: Inline do_pcie_aer_inject_error() into its only caller Date: Thu, 1 Dec 2022 13:11:30 +0100 Message-Id: <20221201121133.3813857-11-armbru@redhat.com> In-Reply-To: <20221201121133.3813857-1-armbru@redhat.com> References: <20221201121133.3813857-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1669896818614100002 Content-Type: text/plain; charset="utf-8" Signed-off-by: Markus Armbruster Reviewed-by: Michael S. Tsirkin Reviewed-by: Dr. David Alan Gilbert --- hw/pci/pci-hmp-cmds.c | 41 ++++++----------------------------------- 1 file changed, 6 insertions(+), 35 deletions(-) diff --git a/hw/pci/pci-hmp-cmds.c b/hw/pci/pci-hmp-cmds.c index ae75b920aa..a9a5bbb930 100644 --- a/hw/pci/pci-hmp-cmds.c +++ b/hw/pci/pci-hmp-cmds.c @@ -159,21 +159,7 @@ void pcibus_dev_print(Monitor *mon, DeviceState *dev, = int indent) } } =20 -typedef struct PCIEErrorDetails { - const char *id; - const char *root_bus; - int bus; - int devfn; -} PCIEErrorDetails; - -/* - * Inject an error described by @qdict. - * On success, set @details to show where error was sent. - * Return negative errno if injection failed and a message was emitted. - */ -static int do_pcie_aer_inject_error(Monitor *mon, - const QDict *qdict, - PCIEErrorDetails *details) +void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict) { const char *id =3D qdict_get_str(qdict, "id"); const char *error_name; @@ -189,12 +175,12 @@ static int do_pcie_aer_inject_error(Monitor *mon, monitor_printf(mon, "id or pci device path is invalid or device not " "found. %s\n", id); - return ret; + return; } if (!pci_is_express(dev)) { monitor_printf(mon, "the device doesn't support pci express. %s\n", id); - return -ENOSYS; + return; } =20 error_name =3D qdict_get_str(qdict, "error_status"); @@ -202,7 +188,7 @@ static int do_pcie_aer_inject_error(Monitor *mon, if (qemu_strtoui(error_name, NULL, 0, &num) < 0) { monitor_printf(mon, "invalid error status value. \"%s\"", error_name); - return -EINVAL; + return; } error_status =3D num; correctable =3D qdict_get_try_bool(qdict, "correctable", false); @@ -238,25 +224,10 @@ static int do_pcie_aer_inject_error(Monitor *mon, if (ret < 0) { monitor_printf(mon, "failed to inject error: %s\n", strerror(-ret)); - return ret; - } - details->id =3D id; - details->root_bus =3D pci_root_bus_path(dev); - details->bus =3D pci_dev_bus_num(dev); - details->devfn =3D dev->devfn; - - return 0; -} - -void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict) -{ - PCIEErrorDetails data; - - if (do_pcie_aer_inject_error(mon, qdict, &data) < 0) { return; } =20 monitor_printf(mon, "OK id: %s root bus: %s, bus: %x devfn: %x.%x\n", - data.id, data.root_bus, data.bus, - PCI_SLOT(data.devfn), PCI_FUNC(data.devfn)); + id, pci_root_bus_path(dev), pci_dev_bus_num(dev), + PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); } --=20 2.37.3