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=-8.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 8065CC2BA12 for ; Thu, 2 Apr 2020 14:21:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5732A2078E for ; Thu, 2 Apr 2020 14:21:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="gi6NENtW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732992AbgDBOVX (ORCPT ); Thu, 2 Apr 2020 10:21:23 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:27361 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732546AbgDBOVW (ORCPT ); Thu, 2 Apr 2020 10:21:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585837281; 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=Rz5cHS4VTwbzrEglnf6iJdvfJeJuFYnGpHx5cg1Sn5I=; b=gi6NENtWOrb96CP0TkJ/8XjaDI4LbE9IysYnfHS6pTfqYFS8Wjpd05T1ihEbZqY9hsaf3r 4a+Y1GFzGUXfACyRZ9kAICFhtMyY4ofgYuTjOB1sfNA5eOMi5APoX+/NRXRStBXCwjcFfl PV1t5vvRAG8Qa2/6rUG/yB1Oi1daW10= 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-122-EBVCtGpVPMW_QfhaVWx5Tg-1; Thu, 02 Apr 2020 10:21:20 -0400 X-MC-Unique: EBVCtGpVPMW_QfhaVWx5Tg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C1E6EA0CC2; Thu, 2 Apr 2020 14:21:18 +0000 (UTC) Received: from [10.72.12.172] (ovpn-12-172.pek2.redhat.com [10.72.12.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id BFBA0391; Thu, 2 Apr 2020 14:21:13 +0000 (UTC) Subject: Re: [PATCH v2] virtio/test: fix up after IOTLB changes To: "Michael S. Tsirkin" , linux-kernel@vger.kernel.org Cc: =?UTF-8?Q?Eugenio_P=c3=a9rez?= , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org References: <20200402125406.9275-1-mst@redhat.com> From: Jason Wang Message-ID: <9e71c603-300a-e13f-dcef-bc4f9386ac0e@redhat.com> Date: Thu, 2 Apr 2020 22:21:12 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20200402125406.9275-1-mst@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/4/2 =E4=B8=8B=E5=8D=888:55, Michael S. Tsirkin wrote: > Allow building vringh without IOTLB (that's the case for userspace > builds, will be useful for CAIF/VOD down the road too). > Update for API tweaks. > Don't include vringh with userspace builds. > > Cc: Jason Wang > Cc: Eugenio P=C3=A9rez > Signed-off-by: Michael S. Tsirkin > --- > > changes from v1: > use IS_REACHEABLE to fix error reported by build bot Acked-by: Jason Wang > > drivers/vhost/test.c | 4 ++-- > drivers/vhost/vringh.c | 5 +++++ > include/linux/vringh.h | 6 ++++++ > tools/virtio/Makefile | 5 +++-- > tools/virtio/generated/autoconf.h | 0 > 5 files changed, 16 insertions(+), 4 deletions(-) > create mode 100644 tools/virtio/generated/autoconf.h > > diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c > index 394e2e5c772d..9a3a09005e03 100644 > --- a/drivers/vhost/test.c > +++ b/drivers/vhost/test.c > @@ -120,7 +120,7 @@ static int vhost_test_open(struct inode *inode, str= uct file *f) > vqs[VHOST_TEST_VQ] =3D &n->vqs[VHOST_TEST_VQ]; > n->vqs[VHOST_TEST_VQ].handle_kick =3D handle_vq_kick; > vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX, UIO_MAXIOV, > - VHOST_TEST_PKT_WEIGHT, VHOST_TEST_WEIGHT); > + VHOST_TEST_PKT_WEIGHT, VHOST_TEST_WEIGHT, NULL); > =20 > f->private_data =3D n; > =20 > @@ -225,7 +225,7 @@ static long vhost_test_reset_owner(struct vhost_tes= t *n) > { > void *priv =3D NULL; > long err; > - struct vhost_umem *umem; > + struct vhost_iotlb *umem; > =20 > mutex_lock(&n->dev.mutex); > err =3D vhost_dev_check_owner(&n->dev); > diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c > index ee0491f579ac..ba8e0d6cfd97 100644 > --- a/drivers/vhost/vringh.c > +++ b/drivers/vhost/vringh.c > @@ -13,9 +13,11 @@ > #include > #include > #include > +#if IS_REACHABLE(CONFIG_VHOST_IOTLB) > #include > #include > #include > +#endif > #include > =20 > static __printf(1,2) __cold void vringh_bad(const char *fmt, ...) > @@ -1059,6 +1061,8 @@ int vringh_need_notify_kern(struct vringh *vrh) > } > EXPORT_SYMBOL(vringh_need_notify_kern); > =20 > +#if IS_REACHABLE(CONFIG_VHOST_IOTLB) > + > static int iotlb_translate(const struct vringh *vrh, > u64 addr, u64 len, struct bio_vec iov[], > int iov_size, u32 perm) > @@ -1416,5 +1420,6 @@ int vringh_need_notify_iotlb(struct vringh *vrh) > } > EXPORT_SYMBOL(vringh_need_notify_iotlb); > =20 > +#endif > =20 > MODULE_LICENSE("GPL"); > diff --git a/include/linux/vringh.h b/include/linux/vringh.h > index bd0503ca6f8f..9e2763d7c159 100644 > --- a/include/linux/vringh.h > +++ b/include/linux/vringh.h > @@ -14,8 +14,10 @@ > #include > #include > #include > +#if IS_REACHABLE(CONFIG_VHOST_IOTLB) > #include > #include > +#endif > #include > =20 > /* virtio_ring with information needed for host access. */ > @@ -254,6 +256,8 @@ static inline __virtio64 cpu_to_vringh64(const stru= ct vringh *vrh, u64 val) > return __cpu_to_virtio64(vringh_is_little_endian(vrh), val); > } > =20 > +#if IS_REACHABLE(CONFIG_VHOST_IOTLB) > + > void vringh_set_iotlb(struct vringh *vrh, struct vhost_iotlb *iotlb); > =20 > int vringh_init_iotlb(struct vringh *vrh, u64 features, > @@ -284,4 +288,6 @@ void vringh_notify_disable_iotlb(struct vringh *vrh= ); > =20 > int vringh_need_notify_iotlb(struct vringh *vrh); > =20 > +#endif /* CONFIG_VHOST_IOTLB */ > + > #endif /* _LINUX_VRINGH_H */ > diff --git a/tools/virtio/Makefile b/tools/virtio/Makefile > index f33f32f1d208..b587b9a7a124 100644 > --- a/tools/virtio/Makefile > +++ b/tools/virtio/Makefile > @@ -4,7 +4,7 @@ test: virtio_test vringh_test > virtio_test: virtio_ring.o virtio_test.o > vringh_test: vringh_test.o vringh.o virtio_ring.o > =20 > -CFLAGS +=3D -g -O2 -Werror -Wall -I. -I../include/ -I ../../usr/includ= e/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-commo= n -MMD -U_FORTIFY_SOURCE > +CFLAGS +=3D -g -O2 -Werror -Wall -I. -I../include/ -I ../../usr/includ= e/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-commo= n -MMD -U_FORTIFY_SOURCE -include ../../include/linux/kconfig.h > vpath %.c ../../drivers/virtio ../../drivers/vhost > mod: > ${MAKE} -C `pwd`/../.. M=3D`pwd`/vhost_test V=3D${V} > @@ -22,7 +22,8 @@ OOT_CONFIGS=3D\ > CONFIG_VHOST=3Dm \ > CONFIG_VHOST_NET=3Dn \ > CONFIG_VHOST_SCSI=3Dn \ > - CONFIG_VHOST_VSOCK=3Dn > + CONFIG_VHOST_VSOCK=3Dn \ > + CONFIG_VHOST_RING=3Dn > OOT_BUILD=3DKCFLAGS=3D"-I "${OOT_VHOST} ${MAKE} -C ${OOT_KSRC} V=3D${= V} > oot-build: > echo "UNSUPPORTED! Don't use the resulting modules in production!" > diff --git a/tools/virtio/generated/autoconf.h b/tools/virtio/generated= /autoconf.h > new file mode 100644 > index 000000000000..e69de29bb2d1