From nobody Mon Feb 9 16:18:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1630007466; cv=none; d=zohomail.com; s=zohoarc; b=QnuuLIriMISBHA7JasVVjZ5rMvC9OEs175tkGe/r3mfxEUtNxKCaIChX9q0RFy81Jx6+oQ9ChzILE1Dotz2KMDjFoxkJ8ovXTDxqsvkOWgC/RIDmIYcoy0IJ49ulsgnrV5UYm3YTEHVGNYHlxq1cZVwkd/YMVfbcOMVPMoXlCg0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630007466; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=bIzUg2n6cWwWuyxJa1hqTDlzAZlGw1TJMvDOruqrhIU=; b=FDz+CfdojwhVUVgQ+j/s/uXrTFhPrkhaEgvaHAbXXmDbZaWWBlms0dK96BMgkVor3n2cifAdNZrdToS5zD/LiStR2hJR/ktMA/1Jk+HT3znUq2x0ywryZV6uS/esG+yL4kJ1VurWwdbDHpM5ECl9TbrXnLmcCkF7/LAprXJwcGI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1630007466142763.6032354557956; Thu, 26 Aug 2021 12:51:06 -0700 (PDT) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-412-S4OZkNjcNbW-BQy48V7jsw-1; Thu, 26 Aug 2021 15:51:01 -0400 Received: by mail-wr1-f71.google.com with SMTP id a13-20020adfed0d000000b00156fd70137aso1210157wro.8 for ; Thu, 26 Aug 2021 12:51:01 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (163.red-83-52-55.dynamicip.rima-tde.net. [83.52.55.163]) by smtp.gmail.com with ESMTPSA id p13sm4146951wro.8.2021.08.26.12.50.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 12:50:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630007465; 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=bIzUg2n6cWwWuyxJa1hqTDlzAZlGw1TJMvDOruqrhIU=; b=gMRidvcnLTNxILEOGBIwcnFV4+cfOI/QMus2jRP5njxl1o1x3UfCY6GFCdiDqEXLhCB/aM vy1rUBNK/OGT6umR+zsBiENfEgmFiyJJ7Rt8IaDEPjbE6Hsx9cZNtfADuLh8rh3vejcF8h 4hj5QY02HqlWqeDCRewqZjVF0T8DJDQ= X-MC-Unique: S4OZkNjcNbW-BQy48V7jsw-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=bIzUg2n6cWwWuyxJa1hqTDlzAZlGw1TJMvDOruqrhIU=; b=EPD92AxMkIJvSxwqOxaKJjxYb5Eudof1j/URxk2iDqSMZzSQVX6VLh1rDQM/waloiz oojNOAVjAfr/Os85iC0jLyZzwsFendhMZuhWSWMESYv6hV6wmWQf97301NKcFgXzoxwm T3yjcEIGp42gtKuL6eZg5kuLh9hV1fDbn0zVvtMtm39lqEpWz+27nADxD7VrUr4A6qGQ 9AmZUgq9uYVfUmMJGGWynNNKF9UHmyGhOeaFC0cgHvNdW8mHI96cEs5eeBnUJKVLLsXE Is8D6fjLS72PBrsdsnqWJs0nPhGQuaRUe+8KLprqdW07C2XUgshVY5sf/a6dT61YDSzR gQ1Q== X-Gm-Message-State: AOAM532KNyDAN5DhIZkkAzc1K86JcS1xVkyJq+LLPN1Xhde70tJ8d6Vl cAJ5+FbtvXbNwGqAif5Yys22tyN7qtjZ5AjxDyvbvL+i2bA0HhIrbeIdQZvkLbm832KS5KfACWO 0CRIJ4sO5Dz9+tg== X-Received: by 2002:adf:e449:: with SMTP id t9mr5856707wrm.135.1630007460193; Thu, 26 Aug 2021 12:51:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypfB0khH35T8LBtMh71Lwudql1ndIwhOb+rF6A0wR8+745Q2L5H/jEZtVH9bG+6Nl4wPnv/Q== X-Received: by 2002:adf:e449:: with SMTP id t9mr5856688wrm.135.1630007460069; Thu, 26 Aug 2021 12:51:00 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Hanna Reitz , Klaus Jensen , Kevin Wolf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-block@nongnu.org, Fam Zheng , Stefan Hajnoczi , Auger Eric Subject: [PATCH v2 10/11] util/vfio-helpers: Let qemu_vfio_do_mapping() propagate Error Date: Thu, 26 Aug 2021 21:50:13 +0200 Message-Id: <20210826195014.2180369-11-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826195014.2180369-1-philmd@redhat.com> References: <20210826195014.2180369-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) X-ZM-MESSAGEID: 1630007467302100001 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 48b4384e8c8..0c011b3dbc8 100644 --- a/util/vfio-helpers.c +++ b/util/vfio-helpers.c @@ -610,7 +610,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), @@ -622,7 +622,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; @@ -774,7 +774,7 @@ int qemu_vfio_dma_map(QEMUVFIOState *s, void *host, siz= e_t size, =20 mapping =3D qemu_vfio_add_mapping(s, host, size, index + 1, io= va0); 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 < 0) { qemu_vfio_undo_mapping(s, mapping, NULL); return ret; @@ -784,7 +784,7 @@ int qemu_vfio_dma_map(QEMUVFIOState *s, void *host, siz= e_t size, if (qemu_vfio_find_temp_iova(s, size, &iova0, errp)) { return -ENOMEM; } - ret =3D qemu_vfio_do_mapping(s, host, size, iova0); + ret =3D qemu_vfio_do_mapping(s, host, size, iova0, errp); if (ret < 0) { return ret; } --=20 2.31.1