[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 05/23] IOMMU: simplify unmap-on-error in iommu_map()
- To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Mon, 10 Jan 2022 17:25:58 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wTdXIg9P0QuVubgLqaqmEja0RWzTevUYMxmQK3d9wRo=; b=lBF5m6QUVRhF+6eX+O57SNhwYbe4dmTDOBRlldX+fZ3Bj5jL3yzzMLPcaIvmLHFQ6fdWdGIEt/EE19UdteEU96JX1wPUKqS3bR2a2EsOLrq6trV+L7HlLI+G/3A0W30BxLc0OlnfYUZarOD4PXiT4VQlFXVNLFRDInbbhzvWU6aElIsda+hmKZkuMsyY2DgdTdVMIKWCN/U/UI8Ctzg9ToT+VERQ5077MGsisq1KyuYBHqeElLo2TY5twJsD0UPcmqxIhvTj0m+xhBptkjYUHEQl2Bh0DDqHS6qsLSk7wJTp3JQr+4m4xm5kMjIOw8XeN3+8Wgk78xFT7AgLSsbXzw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iCPZlyyjBlpGx6kn3tWwHgKZXlIgWbfseuAthvGSPetQ6M6bUM2PZHm8ojGqSoHOaiyt6VJcbYqPqI5Pd3+800fc+U6U11k+/PeK/qWs3tyk04zInm4zQzcJjYXR4Jfios67Lj/ul8AH9uOCR16WuvEDO5EIOfEiQojLBHKfyQXgV5fxYUGK8XLiD5fHrG+/2bGF+GPTfV1R0DiLNGFAMZNZmgz4AKuTXddUY5yWrMA29hFD62Ta0OUlB4tDCkqIFQ812GFV0UHcikAkwvzrJYt1QBFG1v91ViCpGHwRjPdeuozTvpSbvNTY3PokGAxOANvMCMVAqO48fMV7oicmPA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Delivery-date: Mon, 10 Jan 2022 16:26:08 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
As of 68a8aa5d7264 ("iommu: make map and unmap take a page count,
similar to flush") there's no need anymore to have a loop here.
Suggested-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
v3: New.
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -285,11 +285,9 @@ int iommu_map(struct domain *d, dfn_t df
d->domain_id, dfn_x(dfn_add(dfn, i)),
mfn_x(mfn_add(mfn, i)), rc);
- while ( i-- )
- /* if statement to satisfy __must_check */
- if ( iommu_call(hd->platform_ops, unmap_page, d, dfn_add(dfn, i),
- flush_flags) )
- continue;
+ /* while statement to satisfy __must_check */
+ while ( iommu_unmap(d, dfn, i, flush_flags) )
+ break;
if ( !is_hardware_domain(d) )
domain_crash(d);
|