Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3765519ybb; Mon, 6 Apr 2020 15:28:02 -0700 (PDT) X-Google-Smtp-Source: APiQypIMQvLv8uhkrM7OjFthp61HfdwBYWVGGcqy49iiQoJnRU31Pdr2GP7387Pwb5HkyHUDmpiM X-Received: by 2002:a05:6808:8db:: with SMTP id k27mr1318730oij.175.1586212082483; Mon, 06 Apr 2020 15:28:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586212082; cv=none; d=google.com; s=arc-20160816; b=di7ZRCJSt/XnjpWTvKzKbbko3KMOsLLvn/b9huG3v2TSe0FKeJDxfq6/dmWQ3FUeyZ 3IyNxeSG2ujjn0BDD/FBErM1CthEmln5KZSXjbIuMFuDAaAxmJsm9b2p65fNqHsxN/Mj PTvXW7b5v0zsz8LVcQ5u2BU6u+q+c/n2Gq0tcgsEcUrNhalssEyAkMfwLev4jFdliSn1 OjskKJknG6VAu+S4WY72ASgj4OHqpb39sExtLeFwJ9Vfhckylr8S/JRDJVMwm7W9pkX0 +0t0+wwSHsyjNMU51eeeqgQDPXIHIVjNil3xe1uVXHEuIOqS4aYRw2arK97mDJsyBZCF ONbg== 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-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=nyoiGemXvXpEt4ED7nhnG2yhASqK8hx21hXdXEJe9tU=; b=E9iTOYnquP+lcR8XLseOAHPGKj4iu5muP3uZXOwR8ZbXh6KJwcqg/OvW/zISH9Zz1+ b9qD00As+Vru6YLbSA/loBMrNVkQLb4PkoXj7oB7MfhQqnkfvo+E5XmcpPjnvD+kblF5 UiZAndIko4lbPeGFh2myzoh5ahZwvPOx6Z6AOoyoXefEIwx8Jg5pP6LYqvic9c7FfPwv OFB8RMFRYp74Xo2sF8DP+VdcRIRmC+wIXGLYCr2QDJL8RhFAawjOxu7w+hvG+SRfc56R czyOeUGuDFfPVLRQ+T6afqvK/qtNj8ea8XpAJtGQIEK10xpN6dKY+SDtXNjcJjrE6ccp FSRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Z+anFnsC; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a21si495343otk.277.2020.04.06.15.27.50; Mon, 06 Apr 2020 15:28:02 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Z+anFnsC; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726634AbgDFW1B (ORCPT + 99 others); Mon, 6 Apr 2020 18:27:01 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:41291 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726579AbgDFW04 (ORCPT ); Mon, 6 Apr 2020 18:26:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586212015; 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: in-reply-to:in-reply-to:references:references; bh=nyoiGemXvXpEt4ED7nhnG2yhASqK8hx21hXdXEJe9tU=; b=Z+anFnsCSIvMt2BYN8geWKQ6M23Ip5tet4qSfvoMcAnWqzuV2u2EAoNK1Ofwo24tLueY5r eOtJxJzem+eRzUg3GpUxN8dyCzxIMPwLSa9Q9PtFvEehIMXtaz7izk3aPkmCFqqeHjuX1B azdZdwDvzi1zgNJ1EzBnOEMgO68CqXc= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-463-mL6N3wKRMMOMI6yA97z4cw-1; Mon, 06 Apr 2020 18:26:52 -0400 X-MC-Unique: mL6N3wKRMMOMI6yA97z4cw-1 Received: by mail-wr1-f69.google.com with SMTP id m15so665315wrb.0 for ; Mon, 06 Apr 2020 15:26:51 -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:in-reply-to; bh=nyoiGemXvXpEt4ED7nhnG2yhASqK8hx21hXdXEJe9tU=; b=BwLU2KrH95OM4u3+Y46AySNEOIcpI3ZGL07B02iFv7a4bORIYiiAiC7iCKuh4iODOa 76WCQmQwzNmKKWgpeg9ndtuNPMTp7DX9tN240ALQlymyCV8205gim83c2ZTaiexFqW2J 13gRnrtkstgrjjm6Zk1vj2VimoZM/DK1f9buoPtVKFwdkHLqCNxRYlKB8E6s38M/a2S2 JY87ikM51QHdDx4UeLvG4+3BUO1K/2MGgJJM7rItKaH1BwGxjfk38XsCAoHHmO4ADZGT Hrla2YfRM0z6s/eB4RsmeotpLg+CkaH84DbbSfBwYPwl1emDRALNN3WOavxOsRsFv8XM d+lA== X-Gm-Message-State: AGi0PubN9XwnFAZLqs/ThwLDjgr9qZ3+fmTkQXB9Ram+dhfTDIHUC1qF ujpxHBryJyXC9x+GZtFWOuEZ+2RTGu7UUM2/UPzSW/dJ6akuetVBOXFSeI5AI68q9xi30glM6Nf LjBP3CgCGSG8JUUjtfs3+2sFO X-Received: by 2002:a5d:4f01:: with SMTP id c1mr1463741wru.91.1586212010704; Mon, 06 Apr 2020 15:26:50 -0700 (PDT) X-Received: by 2002:a5d:4f01:: with SMTP id c1mr1463729wru.91.1586212010530; Mon, 06 Apr 2020 15:26:50 -0700 (PDT) Received: from redhat.com (bzq-79-176-51-222.red.bezeqint.net. [79.176.51.222]) by smtp.gmail.com with ESMTPSA id p10sm27022869wre.15.2020.04.06.15.26.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2020 15:26:50 -0700 (PDT) Date: Mon, 6 Apr 2020 18:26:48 -0400 From: "Michael S. Tsirkin" To: linux-kernel@vger.kernel.org Cc: Sudeep Dutt , Ashutosh Dixit , Arnd Bergmann , Greg Kroah-Hartman Subject: [PATCH v6 10/12] vop: switch to virtio_legacy_init/size Message-ID: <20200406222507.281867-11-mst@redhat.com> References: <20200406222507.281867-1-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200406222507.281867-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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