From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61F35C433E0 for ; Mon, 1 Feb 2021 13:15:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 30A9B60C41 for ; Mon, 1 Feb 2021 13:15:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231145AbhBANOn (ORCPT ); Mon, 1 Feb 2021 08:14:43 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40264 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229707AbhBANOm (ORCPT ); Mon, 1 Feb 2021 08:14:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612185196; 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=L8mFTbevZoFA+kRF9PjmbiLGvgdcLVEv0nkhCmLgueg=; b=fLV0kFqGX5SGlvcloQiQmkYMLBtDGNEAhD7nk8S5hWyGW2JuRDcg0KQF5gL+x3+3JsdZd4 bLWMxijUSbUsaIZddlxOFIFRWvQmUnFejfHkavrJuGBGmArU8LtsRUf2bJE20jbfmhmsAr wjZBiYgVNhANI5UHRhLkFxkBaA93pDU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-519-Y0p2_DHEPEKo8zNrmR6rrA-1; Mon, 01 Feb 2021 08:13:12 -0500 X-MC-Unique: Y0p2_DHEPEKo8zNrmR6rrA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 754681014E7A; Mon, 1 Feb 2021 13:13:11 +0000 (UTC) Received: from gondolin (ovpn-113-126.ams2.redhat.com [10.36.113.126]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B68B5D756; Mon, 1 Feb 2021 13:13:07 +0000 (UTC) Date: Mon, 1 Feb 2021 14:13:04 +0100 From: Cornelia Huck To: Steven Sistare Cc: kvm@vger.kernel.org, Alex Williamson , Kirti Wankhede Subject: Re: [PATCH V3 1/9] vfio: option to unmap all Message-ID: <20210201141304.2e09a191.cohuck@redhat.com> In-Reply-To: <1c152346-88ad-80da-f093-a7ebc516a239@oracle.com> References: <1611939252-7240-1-git-send-email-steven.sistare@oracle.com> <1611939252-7240-2-git-send-email-steven.sistare@oracle.com> <20210201124206.49d3c71b.cohuck@redhat.com> <1c152346-88ad-80da-f093-a7ebc516a239@oracle.com> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Mon, 1 Feb 2021 07:52:04 -0500 Steven Sistare wrote: > On 2/1/2021 6:42 AM, Cornelia Huck wrote: > > On Fri, 29 Jan 2021 08:54:04 -0800 > > Steve Sistare wrote: > > > >> For the UNMAP_DMA ioctl, delete all mappings if VFIO_DMA_UNMAP_FLAG_ALL > >> is set. Define the corresponding VFIO_UNMAP_ALL extension. > >> > >> Signed-off-by: Steve Sistare > >> --- > >> include/uapi/linux/vfio.h | 8 ++++++++ > >> 1 file changed, 8 insertions(+) > >> > >> diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h > >> index 9204705..55578b6 100644 > >> --- a/include/uapi/linux/vfio.h > >> +++ b/include/uapi/linux/vfio.h > >> @@ -46,6 +46,9 @@ > >> */ > >> #define VFIO_NOIOMMU_IOMMU 8 > >> > >> +/* Supports VFIO_DMA_UNMAP_FLAG_ALL */ > >> +#define VFIO_UNMAP_ALL 9 > >> + > >> /* > >> * The IOCTL interface is designed for extensibility by embedding the > >> * structure length (argsz) and flags into structures passed between > >> @@ -1074,6 +1077,7 @@ struct vfio_bitmap { > >> * field. No guarantee is made to the user that arbitrary unmaps of iova > >> * or size different from those used in the original mapping call will > >> * succeed. > >> + * > >> * VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP should be set to get the dirty bitmap > >> * before unmapping IO virtual addresses. When this flag is set, the user must > >> * provide a struct vfio_bitmap in data[]. User must provide zero-allocated > >> @@ -1083,11 +1087,15 @@ struct vfio_bitmap { > >> * indicates that the page at that offset from iova is dirty. A Bitmap of the > >> * pages in the range of unmapped size is returned in the user-provided > >> * vfio_bitmap.data. > >> + * > >> + * If flags & VFIO_DMA_UNMAP_FLAG_ALL, unmap all addresses. iova and size > >> + * must be 0. This may not be combined with the get-dirty-bitmap flag. > > > > wording nit: s/may not/cannot/ > > OK. So, the same edit should be applied to this from patch 4: > > + * iova's vaddr will block. DMA to already-mapped pages continues. This may > + * not be combined with the get-dirty-bitmap flag. > > Alex, can you make these edits please? With that, Reviewed-by: Cornelia Huck > > - Steve > > > Or maybe > > > > "VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP and VFIO_DMA_UNMAP_FLAG_ALL are > > mutually exclusive." > > > > ? > > > >> */ > >> struct vfio_iommu_type1_dma_unmap { > >> __u32 argsz; > >> __u32 flags; > >> #define VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP (1 << 0) > >> +#define VFIO_DMA_UNMAP_FLAG_ALL (1 << 1) > >> __u64 iova; /* IO virtual address */ > >> __u64 size; /* Size of mapping (bytes) */ > >> __u8 data[]; > > >