From nobody Sun Nov 24 20:39:13 2024 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=reject dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1720449310; cv=none; d=zohomail.com; s=zohoarc; b=HYZGQnGLapgbY3YFdHBe3MY7TKuZwsXOoaAfS0SxvAhrY4tudPbOBWcnr4qg5nE7J79VV9u6fY7i9Ux+rdPEQAC70xn5kky2uNkyiYxp5D4UaAb0apNS1IYcrcEaUc5tWOmLthgGZqu6CJ6TAra7j/l3CzjXS3qowDvrPpEVjC4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1720449310; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=x3j0+sR/TAD6m8XQ92iblNU4/A1p/wrxZ1UPJ/XqQ7U=; b=Uor3famyP+ICtTKsYAh1hMuVV4XQ4VNhaY6FlOZ4DEWsgWa5fVrD5+bNLPXWosYaOSgPDG/9KXXsfMaqvod4cu9GFdX8UmbsjLQETjDrde8XwjwSAwNKuNgH0YXA5vGlyGQJ6loQOiGDM2Kfd/l0c0LR/8uGFlmRGMUTyDy6Dj4= 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=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1720449310854577.2623289203707; Mon, 8 Jul 2024 07:35:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQpRy-0003qJ-0I; Mon, 08 Jul 2024 10:34:42 -0400 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 1sQpRv-0003dL-Ds for qemu-devel@nongnu.org; Mon, 08 Jul 2024 10:34:39 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQpRu-0002Uw-0h for qemu-devel@nongnu.org; Mon, 08 Jul 2024 10:34:39 -0400 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4687fdY5017452; Mon, 8 Jul 2024 14:34:36 GMT Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 406wknjsrg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 08 Jul 2024 14:34:35 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 468DIo26007172; Mon, 8 Jul 2024 14:34:35 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 407tu1r6tf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 08 Jul 2024 14:34:35 +0000 Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 468EXkZ9037381; Mon, 8 Jul 2024 14:34:34 GMT Received: from joaomart-mac.nl.oracle.com (dhcp-10-175-56-128.vpn.oracle.com [10.175.56.128]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 407tu1r6ms-4; Mon, 08 Jul 2024 14:34:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=corp-2023-11-20; bh=x 3j0+sR/TAD6m8XQ92iblNU4/A1p/wrxZ1UPJ/XqQ7U=; b=oCHLkwh76FURm7pkR E6Lq0bRH9072f04Vw0jm2sowdO18m2KT63+z/yAM7jyfnM2Ah58bWu1c1JGR/w65 gRM1+LVMiYXU915PdAiaDnR74l1mYKpleR81ZgSrR6N0nAj0KHyZeDwIrW2tFa2D GJXcPMwvvvVWXK1KNSFWD2yrpxjtApTaLje0TjsY/JQAocD/llgQZuq856Oal/zo dsYaZGr+CpmuPDKaqDzL25Azn/BqxF/02hrWpBhx1h7Du/ZamDO2/0Mgg/9OWwyF lsMmafEGK8tjnZZpUfzemUkopt9xQl78V1x5L5nbiXsN59IwvLAuHizddPo3io0i 7WWbA== From: Joao Martins To: qemu-devel@nongnu.org Cc: Yi Liu , Eric Auger , Zhenzhong Duan , Alex Williamson , Cedric Le Goater , Jason Gunthorpe , Avihai Horon , Joao Martins Subject: [PATCH v3 03/10] vfio/iommufd: Return errno in iommufd_cdev_attach_ioas_hwpt() Date: Mon, 8 Jul 2024 15:34:13 +0100 Message-Id: <20240708143420.16953-4-joao.m.martins@oracle.com> In-Reply-To: <20240708143420.16953-1-joao.m.martins@oracle.com> References: <20240708143420.16953-1-joao.m.martins@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-08_09,2024-07-05_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=892 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2407080109 X-Proofpoint-GUID: bYwBZkItY7kcA10f4jMNK5kdqeE9y3z7 X-Proofpoint-ORIG-GUID: bYwBZkItY7kcA10f4jMNK5kdqeE9y3z7 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=205.220.177.32; envelope-from=joao.m.martins@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=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 @oracle.com) X-ZM-MESSAGEID: 1720449311192100001 Content-Type: text/plain; charset="utf-8" In preparation to implement auto domains have the attach function return the errno it got during domain attach instead of a bool. -EINVAL is tracked to track domain incompatibilities, and decide whether to create a new IOMMU domain. Signed-off-by: Joao Martins --- hw/vfio/iommufd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c index 9cee71659b1c..5a5993b17c2e 100644 --- a/hw/vfio/iommufd.c +++ b/hw/vfio/iommufd.c @@ -172,7 +172,7 @@ out: return ret; } =20 -static bool iommufd_cdev_attach_ioas_hwpt(VFIODevice *vbasedev, uint32_t i= d, +static int iommufd_cdev_attach_ioas_hwpt(VFIODevice *vbasedev, uint32_t id, Error **errp) { int iommufd =3D vbasedev->iommufd->fd; @@ -187,12 +187,12 @@ static bool iommufd_cdev_attach_ioas_hwpt(VFIODevice = *vbasedev, uint32_t id, error_setg_errno(errp, errno, "[iommufd=3D%d] error attach %s (%d) to id=3D%d", iommufd, vbasedev->name, vbasedev->fd, id); - return false; + return -errno; } =20 trace_iommufd_cdev_attach_ioas_hwpt(iommufd, vbasedev->name, vbasedev->fd, id); - return true; + return 0; } =20 static bool iommufd_cdev_detach_ioas_hwpt(VFIODevice *vbasedev, Error **er= rp) @@ -216,7 +216,7 @@ static bool iommufd_cdev_attach_container(VFIODevice *v= basedev, VFIOIOMMUFDContainer *container, Error **errp) { - return iommufd_cdev_attach_ioas_hwpt(vbasedev, container->ioas_id, err= p); + return !iommufd_cdev_attach_ioas_hwpt(vbasedev, container->ioas_id, er= rp); } =20 static void iommufd_cdev_detach_container(VFIODevice *vbasedev, --=20 2.17.2