Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp241249pxa; Tue, 11 Aug 2020 01:32:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDAnQYcKgGeyeUdYgnJVvfL3hPgzPEGIoc3Ng6TmkoWxkA5Sz9ub/q9IWGIu/1p24ehHHb X-Received: by 2002:a17:906:dbd8:: with SMTP id yc24mr24710221ejb.176.1597134731803; Tue, 11 Aug 2020 01:32:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597134731; cv=none; d=google.com; s=arc-20160816; b=r6sfa4fBvyBilMBbi7A2Sd5odouHsb8Z/zIP8m2PARKoDHCLQCVNe8U1JkTYHH+04w e2B9pXLkbAQqdM7r5YR5wbtOgfxuSKsXDC3pprG0Rf3dvx4PjvfhPkh0qKrbULtkVtsD pPrD9aBYyPQGFMnkbfoijNWYeEaO/dsdI7athO+2/NgHZzVcvlTrxaY2Yqovq/gOqKZd KUr+eMDFlh3W45pTpT5Ua8FQqp5JLHMSAsHZQFSSLZRg2vvbfy8yZmeNXO22Qq3Hauv0 Ph9PcScREXItPAqEfeGPXdljMfdKrulPQKWetGPIQwpm8DP47Yza3GA0CIQg1G2Ka16A p1nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=kDxbTcL/Td6HbF1c9Y9dgTsZrWCIPjjlXYbn9U5Rp80=; b=dEi5TuCvEkcoeBFLp1NKVL6jdyD6F5/ZL+ARjTiqmCxg4p1EgxFASTDd7ZSQlCb5kd HPtp3RFoQNLUJm7gDf1hJ2ObbTz88h3FgYq39Lk0KUMooPR80tPcFaRSLAS+C78DRcFM nyylGvm2tnxg8DrOIW5i6SFbihlCvvvrNR75G489rClVlciTUsNmtsg86zFeT8Xx5vgX PR84jYBscnudBljTom8jBHnHvZCGtz130mesmTql8nitu45y9xa0FOHFm3Ae6KC7BGSv ygOlBbEmKgRZYytGukYwbluD5LEneYAV68Ye9fpBCiXTqZHKN0/zoyuOFU6KYhDfcSJc yV+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZBztK0BH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w14si12261811ejb.720.2020.08.11.01.31.47; Tue, 11 Aug 2020 01:32:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZBztK0BH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728397AbgHKIaJ (ORCPT + 99 others); Tue, 11 Aug 2020 04:30:09 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:21473 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728390AbgHKIaI (ORCPT ); Tue, 11 Aug 2020 04:30:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597134606; 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=kDxbTcL/Td6HbF1c9Y9dgTsZrWCIPjjlXYbn9U5Rp80=; b=ZBztK0BH61MCAIthbQWdE1tQ+4m+B/lSdH6gkPzhiMEg1+sqWPsL23jXu0S0H0VyWM3f+V CzgecgGi3K0LdKgiGzQQf/25a/3rSEgrAgOY3a1R1Oc+2CIkeLhixPLNelnkaQ/nECJ5ca 4CvRC9mCuMpUP6B8rHiy8yd6ZR1g8HY= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-317-Pfbpeqr4M5O8qJ6Rp76VHg-1; Tue, 11 Aug 2020 04:30:02 -0400 X-MC-Unique: Pfbpeqr4M5O8qJ6Rp76VHg-1 Received: by mail-wm1-f71.google.com with SMTP id p23so717503wmc.2 for ; Tue, 11 Aug 2020 01:30:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=kDxbTcL/Td6HbF1c9Y9dgTsZrWCIPjjlXYbn9U5Rp80=; b=VAtEDB+9nuSqiohwhzjXFqzjUPG6ON8GA1k75pEBGGM8JGunj12gsVL1dQQkOIGm4H ydpO0BaFqRh0U2tGpQTwoe8avmYBzMfYXU1i0N3GcDhAZKfbGq8m9Wqq0qTRgV9g+eKN n1ei1lMAsOpwG8ZwakTie2IM1Zm0ARa3MbxZqEfzuFkVd1ilm4nEeFDfuUoI2ZUV26TN GiewIydarvaDtIk3YwrgR/Uga9DxBLowAwrzL0CT3tLeEoNg1TmuX1NOfF5/ExcWqcUS xhZFxEC020qjSsHFENZST/EdPcOYrapWUa19lUuHmW72/u/aJgk6mUj1YFEvEbRzKkVU k+Cw== X-Gm-Message-State: AOAM533vsDaI87j9p+Z/InvCx1KhgFWZ2dK02fldNHTPrE7SI2c9aZbc 0Ks73c1IrYt+v2hgvKEg3ZxtudEOEyUXHhNvWY2WPae1tFnRlZbMUefzl6GnnSQb6dbn3eeEMB3 u9JREBg4rouuNWpWhntFZwB8B X-Received: by 2002:adf:ed0c:: with SMTP id a12mr27814930wro.24.1597134600930; Tue, 11 Aug 2020 01:30:00 -0700 (PDT) X-Received: by 2002:adf:ed0c:: with SMTP id a12mr27814913wro.24.1597134600692; Tue, 11 Aug 2020 01:30:00 -0700 (PDT) Received: from redhat.com ([192.117.173.58]) by smtp.gmail.com with ESMTPSA id g14sm3815918wmk.37.2020.08.11.01.29.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Aug 2020 01:29:59 -0700 (PDT) Date: Tue, 11 Aug 2020 04:29:56 -0400 From: "Michael S. Tsirkin" To: Jason Wang Cc: Eli Cohen , virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, rob.miller@broadcom.com, lingshan.zhu@intel.com, eperezma@redhat.com, lulu@redhat.com, shahafs@mellanox.com, hanand@xilinx.com, mhabets@solarflare.com, gdawar@xilinx.com, saugatm@xilinx.com, vmireyno@marvell.com, zhangweining@ruijie.com.cn Subject: Re: [PATCH 1/4] vdpa: introduce config op to get valid iova range Message-ID: <20200811042733-mutt-send-email-mst@kernel.org> References: <20200617032947.6371-1-jasowang@redhat.com> <20200617032947.6371-2-jasowang@redhat.com> <20200805085035-mutt-send-email-mst@kernel.org> <20200806120354.GA171218@mtl-vdi-166.wap.labs.mlnx> <20200806082727-mutt-send-email-mst@kernel.org> <20200806124354.GA172661@mtl-vdi-166.wap.labs.mlnx> <20200810080410-mutt-send-email-mst@kernel.org> <2d1e6278-e57e-c340-399e-40ff102c74a3@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2d1e6278-e57e-c340-399e-40ff102c74a3@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 11, 2020 at 10:53:09AM +0800, Jason Wang wrote: > > On 2020/8/10 下午8:05, Michael S. Tsirkin wrote: > > On Thu, Aug 06, 2020 at 03:43:54PM +0300, Eli Cohen wrote: > > > On Thu, Aug 06, 2020 at 08:29:22AM -0400, Michael S. Tsirkin wrote: > > > > On Thu, Aug 06, 2020 at 03:03:55PM +0300, Eli Cohen wrote: > > > > > On Wed, Aug 05, 2020 at 08:51:56AM -0400, Michael S. Tsirkin wrote: > > > > > > On Wed, Jun 17, 2020 at 11:29:44AM +0800, Jason Wang wrote: > > > > > > > This patch introduce a config op to get valid iova range from the vDPA > > > > > > > device. > > > > > > > > > > > > > > Signed-off-by: Jason Wang > > > > > > > --- > > > > > > > include/linux/vdpa.h | 14 ++++++++++++++ > > > > > > > 1 file changed, 14 insertions(+) > > > > > > > > > > > > > > diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h > > > > > > > index 239db794357c..b7633ed2500c 100644 > > > > > > > --- a/include/linux/vdpa.h > > > > > > > +++ b/include/linux/vdpa.h > > > > > > > @@ -41,6 +41,16 @@ struct vdpa_device { > > > > > > > unsigned int index; > > > > > > > }; > > > > > > > +/** > > > > > > > + * vDPA IOVA range - the IOVA range support by the device > > > > > > > + * @start: start of the IOVA range > > > > > > > + * @end: end of the IOVA range > > > > > > > + */ > > > > > > > +struct vdpa_iova_range { > > > > > > > + u64 start; > > > > > > > + u64 end; > > > > > > > +}; > > > > > > > + > > > > > > > > > > > > This is ambiguous. Is end in the range or just behind it? > > > > > > How about first/last? > > > > > It is customary in the kernel to use start-end where end corresponds to > > > > > the byte following the last in the range. See struct vm_area_struct > > > > > vm_start and vm_end fields > > > > Exactly my point: > > > > > > > > include/linux/mm_types.h: unsigned long vm_end; /* The first byte after our end address > > > > > > > > in this case Jason wants it to be the last byte, not one behind. > > > > > > > > > > > Maybe start, size? Not ambiguous, and you don't need to do annoying > > > calculations like size = last - start + 1 > > Size has a bunch of issues: can overlap, can not cover the entire 64 bit > > range. The requisite checks are arguably easier to get wrong than > > getting the size if you need it. > > > Yes, so do you still prefer first/last or just begin/end which is consistent > with iommu_domain_geometry? > > Thanks I prefer first/last I think, these are unambiguous. E.g. dma_addr_t aperture_start; /* First address that can be mapped */ dma_addr_t aperture_end; /* Last address that can be mapped */ instead of addressing ambiguity with a comment, let's just name the field well. > > >