Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp173962ybb; Thu, 9 Apr 2020 20:16:54 -0700 (PDT) X-Google-Smtp-Source: APiQypLesnSaxeQcLPpu5E6/SJhVIRHYITvt1wMp7433DWfvxznvSmNdY3G/wl1FbIJKkAaOKedP X-Received: by 2002:ad4:5448:: with SMTP id h8mr3338504qvt.23.1586488614197; Thu, 09 Apr 2020 20:16:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586488614; cv=none; d=google.com; s=arc-20160816; b=XzvXmia/bQn3im45YyTO8Rx4VsaJk3oHFPbS2klvWgmTL0EaH/PXOdvLwq7tf2V3Gj e2LkHWgfxkuhdqhmXdk5ByKJOPQ3IlSEJoAW9of4w8BRBLzocsh8ejrxswXKqjTL0S9I RInRC4ErRdgYeonU7EAGt5yWoweZMKfSfEJCkoKOxtFBHOgWW6aBxxWEMG2tXTr4BD0y O3/a7Vke79UatdiY9faiqvxn9wGDkgDPQIKeOZLMdHfAxS76h8ECnUDnK3R/aeSAIxX6 DM0dZ0YHJAYWtGbDy7HczlE4Cdf+xYBfWSik/mYDe9X9yUQbeEP0kn8yIuO28dhLEidN heag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :ironport-sdr:ironport-sdr; bh=+aT3dlfbYoGmc979aEfKLGZp4/7oV/5XvWA2iA8eqOY=; b=b9pIyTYZgHPBRPYqk4QEAg04rZ3P/8OlT1voYyp38KwLY+cIxxMAssDaAZJoeWfY9+ RozSR0X6aoWO2cqQ1h3fBfrHJv6o0C4kVKIEVU60VvYxfvB6KEzF56GSJzWxuB7iedEJ bB2bTAGF4ecU0Mc4owj0YccUnTFVzG33oLEY8IqS/0Xw6dqwCB3DIYE/s945/CbDVUiB G9r02UYb3LQZFego4brbAL0PmZlnq1XtpB1cFHKhPifZpR1fL9AbGIEa92dcODqlyBfb w5U5BvGlotjRQls+TFSBD38UyxiBGgq6tOvUrHCtHiLvfBnyjnLsk+IyYqEyfpafLiz9 XmXQ== 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 s27si338275qve.183.2020.04.09.20.16.39; Thu, 09 Apr 2020 20:16:54 -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 S1726666AbgDJDQD (ORCPT + 99 others); Thu, 9 Apr 2020 23:16:03 -0400 Received: from mga07.intel.com ([134.134.136.100]:30990 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726594AbgDJDQC (ORCPT ); Thu, 9 Apr 2020 23:16:02 -0400 IronPort-SDR: PN9ikPB35N86S1TxQ1Y7iKKmRLqWdbur6JDEZcHDVGINu8KlteSPrVQybc7+IEkQzrpg8MBNWS E4L/unrmXNmQ== X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2020 20:16:02 -0700 IronPort-SDR: mwdWbfioCrT9VIiCeFwnyiAwXxTS540MpfN+bFY47xMSgBGlLgy6waCrSFIv8sRAwtyPeKw0RS G9XpNPegE/pA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,364,1580803200"; d="scan'208,223";a="270284078" Received: from lingshan-mobl5.ccr.corp.intel.com (HELO [10.255.31.39]) ([10.255.31.39]) by orsmga002.jf.intel.com with ESMTP; 09 Apr 2020 20:15:54 -0700 Subject: Re: [PATCH V9 9/9] virtio: Intel IFC VF driver for VDPA To: "Michael S. Tsirkin" , Arnd Bergmann Cc: Jason Wang , "linux-kernel@vger.kernel.org" , kvm list , virtualization@lists.linux-foundation.org, Networking , Jason Gunthorpe , maxime.coquelin@redhat.com, cunming.liang@intel.com, zhihong.wang@intel.com, rob.miller@broadcom.com, xiao.w.wang@intel.com, eperezma@redhat.com, lulu@redhat.com, Parav Pandit , kevin.tian@intel.com, Stefan Hajnoczi , Randy Dunlap , Christoph Hellwig , aadam@redhat.com, Jiri Pirko , shahafs@mellanox.com, hanand@xilinx.com, mhabets@solarflare.com, gdawar@xilinx.com, saugatm@xilinx.com, vmireyno@marvell.com, zhangweining@ruijie.com.cn, Bie Tiwei References: <20200326140125.19794-1-jasowang@redhat.com> <20200326140125.19794-10-jasowang@redhat.com> <20200409162427-mutt-send-email-mst@kernel.org> From: "Zhu, Lingshan" Message-ID: <77962da1-b9ec-2eaf-21d0-9790e7f0366d@intel.com> Date: Fri, 10 Apr 2020 11:15:53 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200409162427-mutt-send-email-mst@kernel.org> Content-Type: multipart/mixed; boundary="------------6E5E274523B4D96E25AC383C" Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a multi-part message in MIME format. --------------6E5E274523B4D96E25AC383C Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 4/10/2020 4:25 AM, Michael S. Tsirkin wrote: > On Thu, Apr 09, 2020 at 12:41:13PM +0200, Arnd Bergmann wrote: >> On Thu, Mar 26, 2020 at 3:08 PM Jason Wang wrote: >>> From: Zhu Lingshan >>> >>> This commit introduced two layers to drive IFC VF: >>> >>> (1) ifcvf_base layer, which handles IFC VF NIC hardware operations and >>> configurations. >>> >>> (2) ifcvf_main layer, which complies to VDPA bus framework, >>> implemented device operations for VDPA bus, handles device probe, >>> bus attaching, vring operations, etc. >>> >>> Signed-off-by: Zhu Lingshan >>> Signed-off-by: Bie Tiwei >>> Signed-off-by: Wang Xiao >>> Signed-off-by: Jason Wang >>> + >>> +#define IFCVF_QUEUE_ALIGNMENT PAGE_SIZE >>> +#define IFCVF_QUEUE_MAX 32768 >>> +static u16 ifcvf_vdpa_get_vq_align(struct vdpa_device *vdpa_dev) >>> +{ >>> + return IFCVF_QUEUE_ALIGNMENT; >>> +} >> This fails to build on arm64 with 64kb page size (found in linux-next): >> >> /drivers/vdpa/ifcvf/ifcvf_main.c: In function 'ifcvf_vdpa_get_vq_align': >> arch/arm64/include/asm/page-def.h:17:20: error: conversion from 'long >> unsigned int' to 'u16' {aka 'short unsigned int'} changes value from >> '65536' to '0' [-Werror=overflow] >> 17 | #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) >> | ^ >> drivers/vdpa/ifcvf/ifcvf_base.h:37:31: note: in expansion of macro 'PAGE_SIZE' >> 37 | #define IFCVF_QUEUE_ALIGNMENT PAGE_SIZE >> | ^~~~~~~~~ >> drivers/vdpa/ifcvf/ifcvf_main.c:231:9: note: in expansion of macro >> 'IFCVF_QUEUE_ALIGNMENT' >> 231 | return IFCVF_QUEUE_ALIGNMENT; >> | ^~~~~~~~~~~~~~~~~~~~~ >> >> It's probably good enough to just not allow the driver to be built in that >> configuration as it's fairly rare but unfortunately there is no simple Kconfig >> symbol for it. >> >> In a similar driver, we did >> >> config VMXNET3 >> tristate "VMware VMXNET3 ethernet driver" >> depends on PCI && INET >> depends on !(PAGE_SIZE_64KB || ARM64_64K_PAGES || \ >> IA64_PAGE_SIZE_64KB || MICROBLAZE_64K_PAGES || \ >> PARISC_PAGE_SIZE_64KB || PPC_64K_PAGES) >> >> I think we should probably make PAGE_SIZE_64KB a global symbol >> in arch/Kconfig and have it selected by the other symbols so drivers >> like yours can add a dependency for it. >> >> Arnd > It's probably easier to make the alignment u32 - I don't really know why it's > u16, all callers seem to assign the result to a u32 value. Thanks Michael! @ Arnd, would you please kindly have a try on the attached patch? I failed to find an armv8 or above platform for now. Thanks BR Zhu Lingshan --------------6E5E274523B4D96E25AC383C Content-Type: text/plain; charset=UTF-8; name="0001-vdpa-change-get_vq_align-to-u32-alignment.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="0001-vdpa-change-get_vq_align-to-u32-alignment.patch" RnJvbSBiYjIwMTlmMDYyMDYwOWZiYmRjNjg1NGJjY2M1ZmVmZGI1M2YzZDlkIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBaaHUgTGluZ3NoYW4gPGxpbmdzaGFuLnpodUBpbnRl bC5jb20+CkRhdGU6IEZyaSwgMTAgQXByIDIwMjAgMTE6MDQ6MzggKzA4MDAKU3ViamVjdDog W1BBVENIXSB2ZHBhOiBjaGFuZ2UgZ2V0X3ZxX2FsaWduKCkgdG8gdTMyIGFsaWdubWVudAoK VGhpcyBjb21taXQgY2hhbmdlIHRoZSByZXR1cm4gdmFsdWUgb2YgZ2V0X3ZxX2FsaWduKCkg dG8gdTMyLiB0aGlzCmNhbiBoZWxwIHJlc29sdmUgYSBidWlsZCBpc3N1ZSBvZiBhcm02NCBw bGF0Zm9ybSwgYW5kIGFkYXB0aW5nIHRvCnRoZSBjYWxsZXJzLgoKU2lnbmVkLW9mZi1ieTog Wmh1IExpbmdzaGFuIDxsaW5nc2hhbi56aHVAaW50ZWwuY29tPgotLS0KIGRyaXZlcnMvdmRw YS9pZmN2Zi9pZmN2Zl9tYWluLmMgIHwgMiArLQogZHJpdmVycy92ZHB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