Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2520890pxy; Mon, 3 May 2021 01:49:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvbzv+v09/cxwBIKgaMs86vrqNHw0RvHA0whV0L79Ie925IXnSMvyJtSjSc36Jc0tzsuAp X-Received: by 2002:a17:906:7016:: with SMTP id n22mr15664238ejj.23.1620031764875; Mon, 03 May 2021 01:49:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620031764; cv=none; d=google.com; s=arc-20160816; b=lVGblaikkgeqPMCQu+V/r+r4fbbItJBvGxwVMK5OmgoUaQHuebFh3T89bqg0Cp3GHD EcsQQXYRkxNm1ERB7GFAwrfG0X3v3vQ6ONFjlGcW4MqS0AMjUAwue5AcWSHmAurqQGuZ lFDlneDPPDEG1uy36xd48PH7o5rB+cqEyzcNXbUto5QWspBSBmOcT9wcg323Qhyhhnup pGYWXHaif49eba3jtTwlxlFkDZeFHKeNWcpwPqKtcISWSNyG4jiGjBytCaCb9aaIm+nS cbiwqmbmfJOSwsZfQMauFs9MuqDYMVRNrrNg5D098qvM8ga+tRD1TXJtrxIV43OY7Ula wAQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=oNh3VIIaagnprujVXdPtNBa4jPKLHbvzqtglqUzkcjA=; b=JNkOvnHpH81ckZprZZsC7N9xA1KqEjui0MpHsepFrUygroVspe6MZSnEjRF9khMaPV PnM3cU6xD3816NcHPigl0xVEQjMzjcu9hUr6AavIjIi5xfaGPE4roGZKnYkbwqTx5zop 1o1Ci7rKd2t4AeUrjFxZfCwcqPr7zcMnDrbpRjij2C1J/hoVGh6kXuNJ+W0xdpQzTLUN Jrql3QAf1GNBdO674ATIEFeJA/nlICDsc6ZzzJQJk5Fq2EDIqNN2+9aa7o77Bzu+meEu Cwj9WFNfaIQEn/vMKmk9vq91OkG+f81h97dlNlBf3zDiMSHeQyrmSoQklht/dHxb+AJ8 gX3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=e8RC2eL+; 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 v26si8334265edy.391.2021.05.03.01.49.00; Mon, 03 May 2021 01:49:24 -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=e8RC2eL+; 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 S232972AbhECIs2 (ORCPT + 99 others); Mon, 3 May 2021 04:48:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:29456 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230490AbhECIs1 (ORCPT ); Mon, 3 May 2021 04:48:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620031654; 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=oNh3VIIaagnprujVXdPtNBa4jPKLHbvzqtglqUzkcjA=; b=e8RC2eL+gnIHgBWKOfx+Hl9RYkeKrrYo7MUxRfcsI1bb2zm01SWe7udILlPhPmH+L6IE1h TCg0jyyWlhPi24bWNYZIweJXrCFs4a9ofidjuvD9PJc0aYFwrZSqY6fDGQd1905vSDLIYG LS2GmVgq0j6RcEMYA96HrKjQYpkBKzQ= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-309-MNjSWEppO9yUZHMM3tGezg-1; Mon, 03 May 2021 04:47:32 -0400 X-MC-Unique: MNjSWEppO9yUZHMM3tGezg-1 Received: by mail-wr1-f72.google.com with SMTP id 63-20020adf84450000b029010dd0171a96so2940191wrf.21 for ; Mon, 03 May 2021 01:47:32 -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=oNh3VIIaagnprujVXdPtNBa4jPKLHbvzqtglqUzkcjA=; b=iz0EYbgkBnfymMfklMOpnFD55y8S8JIY0gxhtQNcEM7hLhtemx4zd2IoCylH2wDJPK mPUiA/mNiFWSX/zAWpJSJI9BeOW5U1/iXfdIrBeQ8jr/Fo5YsiE3ULb7LJFOzvrE6gAt /ZhRn0tK/k9fiD8HTQ4gvegU5UVDg8UxBQsSjVLycc27j2J/IXGBn4Qc1yeUF4rBf8cC n1lMSVUjjhAPPzQiCBmO/IRemlPkdjP1GYVYbQ8T7IpaYRGhXHzbj700r4CPcrhKh2iO Pxx5RRfoMKiK4XZS46Ob233AHhgxentR+uLgdv0XeaSFtE31pbmXCwNg7ZVA5X0VEqat jMgw== X-Gm-Message-State: AOAM532W+EkDMGkm8aF1ljHdiyoXk7Th/vMF7UOgyG2cRtT8Uwd1QN9X CIQPtasyQwioGcQUKInKq4RdlwEHpoOMn0eC1F+1MsRETwzNdMUxJXPypUT+VK5N6V5hOspsgRD LpsQ9GWcaX/XSggBA2a6GQ0do X-Received: by 2002:adf:f00a:: with SMTP id j10mr23036892wro.231.1620031651547; Mon, 03 May 2021 01:47:31 -0700 (PDT) X-Received: by 2002:adf:f00a:: with SMTP id j10mr23036877wro.231.1620031651405; Mon, 03 May 2021 01:47:31 -0700 (PDT) Received: from redhat.com ([2a10:800a:cdef:0:114d:2085:61e4:7b41]) by smtp.gmail.com with ESMTPSA id i20sm20091020wmq.29.2021.05.03.01.47.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 01:47:30 -0700 (PDT) Date: Mon, 3 May 2021 04:47:28 -0400 From: "Michael S. Tsirkin" To: Zhu Lingshan Cc: jasowang@redhat.com, lulu@redhat.com, sgarzare@redhat.com, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V4 2/3] vDPA/ifcvf: enable Intel C5000X-PL virtio-block for vDPA Message-ID: <20210503043801-mutt-send-email-mst@kernel.org> References: <20210419063326.3748-1-lingshan.zhu@intel.com> <20210419063326.3748-3-lingshan.zhu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210419063326.3748-3-lingshan.zhu@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 19, 2021 at 02:33:25PM +0800, Zhu Lingshan wrote: > This commit enabled Intel FPGA SmartNIC C5000X-PL virtio-block > for vDPA. > > Signed-off-by: Zhu Lingshan > Reviewed-by: Stefano Garzarella > Acked-by: Jason Wang > --- > drivers/vdpa/ifcvf/ifcvf_base.h | 8 +++++++- > drivers/vdpa/ifcvf/ifcvf_main.c | 19 ++++++++++++++++++- > 2 files changed, 25 insertions(+), 2 deletions(-) > > diff --git a/drivers/vdpa/ifcvf/ifcvf_base.h b/drivers/vdpa/ifcvf/ifcvf_base.h > index 1c04cd256fa7..0111bfdeb342 100644 > --- a/drivers/vdpa/ifcvf/ifcvf_base.h > +++ b/drivers/vdpa/ifcvf/ifcvf_base.h > @@ -15,6 +15,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -28,7 +29,12 @@ > #define C5000X_PL_SUBSYS_VENDOR_ID 0x8086 > #define C5000X_PL_SUBSYS_DEVICE_ID 0x0001 > > -#define IFCVF_SUPPORTED_FEATURES \ > +#define C5000X_PL_BLK_VENDOR_ID 0x1AF4 Come on this is just PCI_VENDOR_ID_REDHAT_QUMRANET right? > +#define C5000X_PL_BLK_DEVICE_ID 0x1001 0x1001 is a transitional blk device from virtio spec too right? Let's add these to virtio_ids.h? > +#define C5000X_PL_BLK_SUBSYS_VENDOR_ID 0x8086 > +#define C5000X_PL_BLK_SUBSYS_DEVICE_ID 0x0002 VIRTIO_ID_BLOCK? > + > +#define IFCVF_NET_SUPPORTED_FEATURES \ > ((1ULL << VIRTIO_NET_F_MAC) | \ > (1ULL << VIRTIO_F_ANY_LAYOUT) | \ > (1ULL << VIRTIO_F_VERSION_1) | \ > diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c > index 66927ec81fa5..9a4a6df91f08 100644 > --- a/drivers/vdpa/ifcvf/ifcvf_main.c > +++ b/drivers/vdpa/ifcvf/ifcvf_main.c > @@ -168,10 +168,23 @@ static struct ifcvf_hw *vdpa_to_vf(struct vdpa_device *vdpa_dev) > > static u64 ifcvf_vdpa_get_features(struct vdpa_device *vdpa_dev) > { > + struct ifcvf_adapter *adapter = vdpa_to_adapter(vdpa_dev); > struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev); > + struct pci_dev *pdev = adapter->pdev; > + > u64 features; > > - features = ifcvf_get_features(vf) & IFCVF_SUPPORTED_FEATURES; > + switch (vf->dev_type) { > + case VIRTIO_ID_NET: > + features = ifcvf_get_features(vf) & IFCVF_NET_SUPPORTED_FEATURES; > + break; > + case VIRTIO_ID_BLOCK: > + features = ifcvf_get_features(vf); > + break; > + default: > + features = 0; > + IFCVF_ERR(pdev, "VIRTIO ID %u not supported\n", vf->dev_type); > + } > > return features; > } > @@ -514,6 +527,10 @@ static struct pci_device_id ifcvf_pci_ids[] = { > C5000X_PL_DEVICE_ID, > C5000X_PL_SUBSYS_VENDOR_ID, > C5000X_PL_SUBSYS_DEVICE_ID) }, > + { PCI_DEVICE_SUB(C5000X_PL_BLK_VENDOR_ID, > + C5000X_PL_BLK_DEVICE_ID, > + C5000X_PL_BLK_SUBSYS_VENDOR_ID, > + C5000X_PL_BLK_SUBSYS_DEVICE_ID) }, > > { 0 }, > }; > -- > 2.27.0