Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3766578ybb; Mon, 6 Apr 2020 15:29:51 -0700 (PDT) X-Google-Smtp-Source: APiQypJmY5OD2Z9zHkutbSh/GKphxDtDj3rGJv+vUxREpDz5MRuu5FKWL0WKY5/kUexDvqLvrJSV X-Received: by 2002:aca:c6d1:: with SMTP id w200mr1278953oif.43.1586212191309; Mon, 06 Apr 2020 15:29:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586212191; cv=none; d=google.com; s=arc-20160816; b=cSqcR9d8tXVYbMBlohes7s1TD3Q8coPwYJDSlXbnD8oL1jHCDgCl7Y5mbzDAYTPGyc a8m4g3Egl3gCNAnfw8kh6V26bFEF9NqaJ6bQUdtq8jApGpXRPhTpg+2Xzh19D0/vD4ln kAvk9X569eJNfUrwJUoBqcejfMFB33O58xXhzGKErQxsQEP89sYvkVHjAWlHJFgwR0UH p75Owc1TVESj5GtGRavja8vc36//xehwLu3OnU8XFvH22s+iDSHIVDhknywYUmK9RQOH fCE34bwJyGWlJ2VU3mL7XHGHYraW2WlZfNzX2OGDg9ZOewQn9esjZ8kv9ynaxzF4H+ci Tm4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date:ironport-sdr :ironport-sdr; bh=e24VZzGA+OfWbsbrJ3AAxD2JKukJycUdGOsR3K+ERTE=; b=AdJuhIgJxYLNCoJItynFW4fPI1vJ8NhefrxiTt04HswBEMrfXApjCd5YCM3okcAKmK 93xMu5YEAO+EWGJAvz59dFml/gmQIIGqtwlCl8gZSXX9bJVjDDQQ17wSoQSVputF/AGx +TYMi1kFUjuVJrSbMqv87BFPLE0/rLz8i9j3jyXj9zHCY7TeQE9b1FXxjomCoE8fMSTP 1AuqvbVzhG19mgoHV4FlD9TEnvnxShKflXzsC7X1Ae/hee2hSxg6naAA6bTpwawEacqq pg+x82yCiCBTlUsDtDYsRsi1EP1FcZaxQrh/FQCTeicOmvt2x2M9R3qs39QtjN7S+0Dn 898Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t144si7794716oie.129.2020.04.06.15.29.39; Mon, 06 Apr 2020 15:29:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726287AbgDFW3A (ORCPT + 99 others); Mon, 6 Apr 2020 18:29:00 -0400 Received: from mga06.intel.com ([134.134.136.31]:19971 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbgDFW3A (ORCPT ); Mon, 6 Apr 2020 18:29:00 -0400 IronPort-SDR: wzPxupD2QNY6RQ4znvjoiXlQjMxdFTBZlNkA+Q/Df1opYzH9n2VG+HM4+m2R//bm1W1ZNQie5S aaYY+HgWZQjA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2020 15:28:59 -0700 IronPort-SDR: ZjSqQccUSqImH6e00wteNigxxx0JFhrPxvTy3VZpJt33qVg7jnTKeNHO8OTHQmV2oSrOUNTQ2H cwB9W+OMjnyw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,352,1580803200"; d="scan'208";a="269219159" Received: from adixit-mobl.amr.corp.intel.com (HELO adixit-arch.intel.com) ([10.212.100.187]) by orsmga002.jf.intel.com with ESMTP; 06 Apr 2020 15:28:58 -0700 Date: Mon, 06 Apr 2020 15:28:58 -0700 Message-ID: <87v9mctfit.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: "Michael S. Tsirkin" Cc: , Sudeep Dutt , Arnd Bergmann , Greg Kroah-Hartman Subject: Re: [PATCH v6 10/12] vop: switch to virtio_legacy_init/size In-Reply-To: <20200406222507.281867-11-mst@redhat.com> References: <20200406222507.281867-1-mst@redhat.com> <20200406222507.281867-11-mst@redhat.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.8 EasyPG/1.0.0 Emacs/26 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 06 Apr 2020 15:26:48 -0700, Michael S. Tsirkin wrote: > > These are used for legacy ring format, switch to APIs that make this > explicit. > > Signed-off-by: Michael S. Tsirkin > --- > > maintainers, pls ack merging this through virtio tree due to dependency > on previous patches in the patchset. Acked-by: Ashutosh Dixit > > drivers/misc/mic/vop/vop_main.c | 5 +++-- > drivers/misc/mic/vop/vop_vringh.c | 8 +++++--- > 2 files changed, 8 insertions(+), 5 deletions(-) > > diff --git a/drivers/misc/mic/vop/vop_main.c b/drivers/misc/mic/vop/vop_main.c > index 85942f6717c5..829b3b14b1d7 100644 > --- a/drivers/misc/mic/vop/vop_main.c > +++ b/drivers/misc/mic/vop/vop_main.c > @@ -283,7 +283,7 @@ static struct virtqueue *vop_new_virtqueue(unsigned int index, > bool weak_barriers = false; > struct vring vring; > > - vring_init(&vring, num, pages, MIC_VIRTIO_RING_ALIGN); > + vring_legacy_init(&vring, num, pages, MIC_VIRTIO_RING_ALIGN); > vring.used = used; > > return __vring_new_virtqueue(index, vring, vdev, weak_barriers, context, > @@ -320,7 +320,8 @@ static struct virtqueue *vop_find_vq(struct virtio_device *dev, > /* First assign the vring's allocated in host memory */ > vqconfig = _vop_vq_config(vdev->desc) + index; > memcpy_fromio(&config, vqconfig, sizeof(config)); > - _vr_size = vring_size(le16_to_cpu(config.num), MIC_VIRTIO_RING_ALIGN); > + _vr_size = vring_legacy_size(le16_to_cpu(config.num), > + MIC_VIRTIO_RING_ALIGN); > vr_size = PAGE_ALIGN(_vr_size + sizeof(struct _mic_vring_info)); > va = vpdev->hw_ops->remap(vpdev, le64_to_cpu(config.address), vr_size); > if (!va) > diff --git a/drivers/misc/mic/vop/vop_vringh.c b/drivers/misc/mic/vop/vop_vringh.c > index 30eac172f017..0535c02d637d 100644 > --- a/drivers/misc/mic/vop/vop_vringh.c > +++ b/drivers/misc/mic/vop/vop_vringh.c > @@ -296,7 +296,8 @@ static int vop_virtio_add_device(struct vop_vdev *vdev, > > num = le16_to_cpu(vqconfig[i].num); > mutex_init(&vvr->vr_mutex); > - vr_size = PAGE_ALIGN(vring_size(num, MIC_VIRTIO_RING_ALIGN) + > + vr_size = PAGE_ALIGN(vring_legacy_size(num, > + MIC_VIRTIO_RING_ALIGN) + > sizeof(struct _mic_vring_info)); > vr->va = (void *) > __get_free_pages(GFP_KERNEL | __GFP_ZERO, > @@ -308,7 +309,8 @@ static int vop_virtio_add_device(struct vop_vdev *vdev, > goto err; > } > vr->len = vr_size; > - vr->info = vr->va + vring_size(num, MIC_VIRTIO_RING_ALIGN); > + vr->info = vr->va + vring_legacy_size(num, > + MIC_VIRTIO_RING_ALIGN); > vr->info->magic = cpu_to_le32(MIC_MAGIC + vdev->virtio_id + i); > vr_addr = dma_map_single(&vpdev->dev, vr->va, vr_size, > DMA_BIDIRECTIONAL); > @@ -321,7 +323,7 @@ static int vop_virtio_add_device(struct vop_vdev *vdev, > } > vqconfig[i].address = cpu_to_le64(vr_addr); > > - vring_init(&vr->vr, num, vr->va, MIC_VIRTIO_RING_ALIGN); > + vring_legacy_init(&vr->vr, num, vr->va, MIC_VIRTIO_RING_ALIGN); > ret = vringh_init_kern(&vvr->vrh, > *(u32 *)mic_vq_features(vdev->dd), > num, false, vr->vr.desc, vr->vr.avail, > -- > MST >