From nobody Sun Feb 8 02:21:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1602676419; cv=none; d=zohomail.com; s=zohoarc; b=kmP3eHauJfHXi/qpG0T6+NnOiRuANFyMaS/ckPutDn5KbH85lXLfKgpD38bNDW7hxnJU521+qNvLWdUPrxrTZSjBVGDJcr2+CgrXSpr8psibC6iTaxmLf8smNl7oi2Jyf1mD174Kx8jvu/+bO2p9fTHTCf1j3DMi4I0Tq8zWw9Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602676419; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=+MF6CELc3HUdf4Q8Rj0ad0iLARqM18cYceZFctPs7+I=; b=FV+7/1biKemoJmRI/ItUVikI4+9ddpt8zUhfezdLe15VFBoO/IGavdTAmah8VPLcApH1ofg/vWmWJE6eJqPSpvM9hDX8JgCuf5DFkHBF+XrBFUjqgHMXbU1VqwU7A3539IlLmCybcho0gE86Kjy0gqfrgtIldgDFNeCC9p4KMFo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1602676419035430.521253298087; Wed, 14 Oct 2020 04:53:39 -0700 (PDT) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-547-tv-vfTLyPryZMsWF9atpsQ-1; Wed, 14 Oct 2020 07:53:36 -0400 Received: by mail-wm1-f69.google.com with SMTP id 73so446532wma.5 for ; Wed, 14 Oct 2020 04:53:36 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (106.red-83-59-162.dynamicip.rima-tde.net. [83.59.162.106]) by smtp.gmail.com with ESMTPSA id z11sm4503433wrh.70.2020.10.14.04.53.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 04:53:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602676418; 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=+MF6CELc3HUdf4Q8Rj0ad0iLARqM18cYceZFctPs7+I=; b=GBoxdOYYwhi6AWrImA7568HYOtlMgvR7M9zC+7Q4NCw3W1TGkRop2RRGXivpSZIyhNcbBJ 3VAtf2NspW/spk2nNWEruzGWtxOdYaiNQYObO9a+eA1C4AYCSCyniK5osL4eLJH1tUMKWs mMKyhE/YRewOQvvKAK66uxXR9plpZl0= X-MC-Unique: tv-vfTLyPryZMsWF9atpsQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+MF6CELc3HUdf4Q8Rj0ad0iLARqM18cYceZFctPs7+I=; b=Cp4iUIGU7tYdTGB2iKImT6adcsBmuJPD5MxmNQqwrksX4dAGNtd/3UFI6RapzqPcio xKykNwzeZ3tZJLuWtufI3Bm4m2eecKJsh5IqAQT+47CYdJflOCVOgVtwjUEoJnLCL3mC IDMBeuPGasEKoOHyifncK2BLiSOl0witDu4z4V4OaE6Bpz9EeWr8LG928jphGHJE6IEB zEo6n53eHlKLYBgXa1J0OYrygS8f9KHX5pekRlqkUNrD+jTiZRp1PRXT5roSbXtSA+L3 LiLjAQXok4tqPTepwuMPMMd3JK3lKkO2DrYwgCuRC6r6KvbRXDHfQdLcG+d6fl16O7Is ZUcw== X-Gm-Message-State: AOAM533lOfjVg0gaA9l3lep4vKzgcQGXhnujWK4j0hPt4hjdOgm+xcHK DCx73j1pSfzS71xetsIS0LA0ZjQyRtPeeVIBWdYJXIvYkIOquO9o0sGpFBdVgYCLn9BNfBijH+F WJ1KzRBiXMvtMQQ== X-Received: by 2002:adf:e8cb:: with SMTP id k11mr5067242wrn.91.1602676415203; Wed, 14 Oct 2020 04:53:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyL2e9IVbFz59KuTP2nwDmqI5XVzLoDSQqKHOW3W0u3Sy/zE9IC6aSMNJOLvMUQa6Yu11m1mA== X-Received: by 2002:adf:e8cb:: with SMTP id k11mr5067223wrn.91.1602676414996; Wed, 14 Oct 2020 04:53:34 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Max Reitz , Fam Zheng , qemu-block@nongnu.org, Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 8/9] util/vfio-helpers: Let qemu_vfio_do_mapping() propagate Error Date: Wed, 14 Oct 2020 13:52:52 +0200 Message-Id: <20201014115253.25276-9-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201014115253.25276-1-philmd@redhat.com> References: <20201014115253.25276-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Pass qemu_vfio_do_mapping() an Error* argument so it can propagate any error to callers. Replace error_report() which only report to the monitor by the more generic error_setg_errno(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- util/vfio-helpers.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c index c03fe0b7156..2c4598d7faa 100644 --- a/util/vfio-helpers.c +++ b/util/vfio-helpers.c @@ -609,7 +609,7 @@ static IOVAMapping *qemu_vfio_add_mapping(QEMUVFIOState= *s, =20 /* Do the DMA mapping with VFIO. */ static int qemu_vfio_do_mapping(QEMUVFIOState *s, void *host, size_t size, - uint64_t iova) + uint64_t iova, Error **errp) { struct vfio_iommu_type1_dma_map dma_map =3D { .argsz =3D sizeof(dma_map), @@ -621,7 +621,7 @@ static int qemu_vfio_do_mapping(QEMUVFIOState *s, void = *host, size_t size, trace_qemu_vfio_do_mapping(s, host, iova, size); =20 if (ioctl(s->container, VFIO_IOMMU_MAP_DMA, &dma_map)) { - error_report("VFIO_MAP_DMA failed: %s", strerror(errno)); + error_setg_errno(errp, errno, "VFIO_MAP_DMA failed"); return -errno; } return 0; @@ -757,7 +757,7 @@ int qemu_vfio_dma_map(QEMUVFIOState *s, void *host, siz= e_t size, goto out; } assert(qemu_vfio_verify_mappings(s)); - ret =3D qemu_vfio_do_mapping(s, host, size, iova0); + ret =3D qemu_vfio_do_mapping(s, host, size, iova0, errp); if (ret) { qemu_vfio_undo_mapping(s, mapping, NULL); goto out; @@ -768,7 +768,7 @@ int qemu_vfio_dma_map(QEMUVFIOState *s, void *host, siz= e_t size, ret =3D -ENOMEM; goto out; } - ret =3D qemu_vfio_do_mapping(s, host, size, iova0); + ret =3D qemu_vfio_do_mapping(s, host, size, iova0, errp); if (ret) { goto out; } --=20 2.26.2