From nobody Tue Feb 10 01:16:00 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1603709771; cv=none; d=zohomail.com; s=zohoarc; b=EY3LPP0AGLHOCa4x5l4fvj9Uo+JuAEWu4tSNsKTYmYhEOWWrOQoy4QojAYa+Qn6ik0KScNkpOwl43iFeMmTbs1jY/jlR0ruW/stiSdr9rKnD2ozRmTyVG94GrpA2ihh4JQiREQar7PFdVWAyZmZQnJm4IgZPOPz+W5fqgAqZa44= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603709771; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=drjwmQSo3TPMr2yqHnKgPcr0+zGutJeRfAQssJrVzdY=; b=c0fxddJQiEvc8niYCMKw7jiIBgDkIjR1/mlwY+TR+S9kOuezAfxk0GO+ElHvEmZDXmDoGNHFL2Mr38g0vSqfAC8ykwSEJ/xBv0XA7KSuiFVliu5eNyuEk5d//EDJnj6Ok6YQhl7U33m0eBIcyy4Bbt6kUcmBpkTjSa5UV2yOF8w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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 [63.128.21.124]) by mx.zohomail.com with SMTPS id 1603709771125973.3152582098048; Mon, 26 Oct 2020 03:56:11 -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-408-ivDYRvmbOHSxQAo1vsKc9g-1; Mon, 26 Oct 2020 06:56:06 -0400 Received: by mail-wm1-f69.google.com with SMTP id s140so147161wme.3 for ; Mon, 26 Oct 2020 03:56:06 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id e11sm22193488wrj.75.2020.10.26.03.56.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Oct 2020 03:56:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603709770; 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=drjwmQSo3TPMr2yqHnKgPcr0+zGutJeRfAQssJrVzdY=; b=XKcwTRWJvi63HBqN4xbeyHhD/gILO6G2hJdvSLsTKnxaQonYN1/IDpfExGf4kp6/n4mjY4 sZvQhk/I+L5x/Wfr2dGN14FU+HaySjhWxKDMvKJi+AjRS3fr+atNHQ6XmEXmr/B81Tlppp i1ny/lHNnadOaoCxaihdbQ/xHeW2TJ4= X-MC-Unique: ivDYRvmbOHSxQAo1vsKc9g-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=drjwmQSo3TPMr2yqHnKgPcr0+zGutJeRfAQssJrVzdY=; b=FeAP2RRU2Ex113Dtihvilom0AhwEK0fUaI+hqSQo46F00ubCBjyh2DhdZ0FFNh9A2f Ru7k6BqnodjsfeHpUBgFviwXOW9J02qtXeqV88QwynKyUm4mcJrvRY/s416v1m5ZXc67 PFUH/fXGMDKoj2E/SLcQX81/XP+2gP9EWqY3ac0WrZEsY/eOxowTlQv4f7QM62y+nwAZ ZchqiGSBnKUh+tMtPJHIr2NOmcJo/IgkEo5gO5GXp70c0+I2lifp+yi6Di72tn2zdQsb 6O4t6rx6ma6TKa78jQaNKVE5+E8AICLshyI0ImbWOsUDeDL/BxWy9vlIMY+fEyA3MezN usTQ== X-Gm-Message-State: AOAM530/XQ1hzET0+aB4ecpQEfHbFCOMCm9PyViwrpBgTX2t8EHNzHO/ 3FWgGH+TsMpVmJ1aGdREPMwBY8q19HazTBzGAbrPOd8lxn9S2ShnuLNLE+qdEAspkTmdC2stzts 10veMATY9UIFfuw== X-Received: by 2002:adf:fe89:: with SMTP id l9mr17280964wrr.264.1603709765029; Mon, 26 Oct 2020 03:56:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHRe3awfpH73MG7A/5OOqXAxovuCJFl1y6Y0demSgVXpYmRrwIMyFpa1uHINWPVbZ8vXezFA== X-Received: by 2002:adf:fe89:: with SMTP id l9mr17280941wrr.264.1603709764820; Mon, 26 Oct 2020 03:56:04 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eric Auger , Alex Williamson , qemu-block@nongnu.org, Fam Zheng , Max Reitz , Stefan Hajnoczi , Kevin Wolf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 12/19] util/vfio-helpers: Let qemu_vfio_do_mapping() propagate Error Date: Mon, 26 Oct 2020 11:54:57 +0100 Message-Id: <20201026105504.4023620-13-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201026105504.4023620-1-philmd@redhat.com> References: <20201026105504.4023620-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(). Reviewed-by: Fam Zheng Reviewed-by: Stefan Hajnoczi 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