Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp602647pxu; Thu, 26 Nov 2020 06:54:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJxTuvtp6qVSTiLv7XFss2WJOzSH+0LUffjN/5LBCEZOWp4jnGmz26OPKaddZPwTH+gMvLif X-Received: by 2002:a17:906:3153:: with SMTP id e19mr3077096eje.17.1606402479534; Thu, 26 Nov 2020 06:54:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606402479; cv=none; d=google.com; s=arc-20160816; b=l5XzF3PcAmZc7U+j9UIp/xjlmU6ZiYtRq2ynBemSb9Z0GIDGRb267JMGZKqT2zukOm 6n3/1uJRbqqllEdUDgkuoA9ZMnRU2spmkIcbTGZZ3u2ZuNTc9P+hHFgaM+5C7oAyDZSV 2KYaA/moUgMsHGGfe+MKCBCXx8k7BDqLoLNsBNs6nSFXdRKJ6QkhmCC89ZZR/UeGI3iM mxYjucRLqjNalHRmhffth2g2QLlATPF4AJPMBTgb/yGDtAfKqCae/mFJn/q2YMbc0gVN 79FRm7eRhSsN+tG2MG/JhTtQYYKC/O1f6+2NDNv6OitNLHs1GNn0qJTnHhqQg8sXD084 PMPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cgeOvdyIExWUoyLX31++F3PhFzZaDc7ReaHXAYKQi0E=; b=zn2v2RpduXtZe82VXAfbL8tJ/D1a16GlrJXkjWHJHbOt81r9fcxtsioeZvTStH0B7E eNajd8syEhZLw+I3CnSmDHAFfu+TZQF9wJRTyoaYnBb0dqWSI0v4cFNF497f7jfmeOJQ bHA5i57ZCdsig7RMGa3bDh8nIrz8iQIDbTg+kBT3kMDoQdazUDwIiZhJB4s0vHkTICQw 8Xfz+gHACWe1aoxyEJMzVZajqr00w43lT3uRMbZLK0bmofW6zAPHndpjAGXbSoClFoyD TMyue3gpBS7wzhj7Z/M3kDr45p9riu86Zim67PN5sxoqdWT3TU6is9M+aYPxgrVPLvNf Rf0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="TpJ4/KNB"; 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 p89si3170724edp.328.2020.11.26.06.54.17; Thu, 26 Nov 2020 06:54:39 -0800 (PST) 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="TpJ4/KNB"; 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 S2390284AbgKZOus (ORCPT + 99 others); Thu, 26 Nov 2020 09:50:48 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:26833 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389756AbgKZOuq (ORCPT ); Thu, 26 Nov 2020 09:50:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606402245; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cgeOvdyIExWUoyLX31++F3PhFzZaDc7ReaHXAYKQi0E=; b=TpJ4/KNBCl/idNC6c9IfCbmFihIgZcsdiPBDq3Kzkz/ZzKFSE1Z01AK2UTiObLjYtI2jby /+6b3bRT2LlrblsQQHbJTmH1l+8/NiY7Ms8Avu24FPKqv5qky4+kvQwjptHZs3c/c1Ttw+ srwjPz1KvLpHN6OAr9ZuYkkfexlg2qE= 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-241-KtY14Q4pPNeDm9PhnlYJUg-1; Thu, 26 Nov 2020 09:50:43 -0500 X-MC-Unique: KtY14Q4pPNeDm9PhnlYJUg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D4C51805BFA; Thu, 26 Nov 2020 14:50:41 +0000 (UTC) Received: from steredhat.redhat.com (ovpn-113-252.ams2.redhat.com [10.36.113.252]) by smtp.corp.redhat.com (Postfix) with ESMTP id 19F1B5C1BD; Thu, 26 Nov 2020 14:50:39 +0000 (UTC) From: Stefano Garzarella To: virtualization@lists.linux-foundation.org Cc: Stefan Hajnoczi , linux-kernel@vger.kernel.org, Laurent Vivier , Max Gurtovoy , "Michael S. Tsirkin" , Eli Cohen , Jason Wang Subject: [PATCH v2 07/17] vdpa_sim: add device id field in vdpasim_dev_attr Date: Thu, 26 Nov 2020 15:49:40 +0100 Message-Id: <20201126144950.92850-8-sgarzare@redhat.com> In-Reply-To: <20201126144950.92850-1-sgarzare@redhat.com> References: <20201126144950.92850-1-sgarzare@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove VDPASIM_DEVICE_ID macro and add 'id' field in vdpasim_dev_attr, that will be returned by vdpasim_get_device_id(). Use VIRTIO_ID_NET for vDPA-net simulator device id. Co-developed-by: Max Gurtovoy Signed-off-by: Max Gurtovoy Signed-off-by: Stefano Garzarella --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c index f98262add0e1..393b54a9f0e4 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c @@ -44,7 +44,6 @@ struct vdpasim_virtqueue { #define VDPASIM_QUEUE_ALIGN PAGE_SIZE #define VDPASIM_QUEUE_MAX 256 -#define VDPASIM_DEVICE_ID 0x1 #define VDPASIM_VENDOR_ID 0 #define VDPASIM_IOTLB_LIMIT 0 /* unlimited */ #define VDPASIM_VQ_NUM 0x2 @@ -57,6 +56,7 @@ static u64 vdpasim_features = (1ULL << VIRTIO_F_ANY_LAYOUT) | struct vdpasim_dev_attr { int nvqs; + u32 id; }; /* State of each vdpasim device */ @@ -536,7 +536,9 @@ static u16 vdpasim_get_vq_num_max(struct vdpa_device *vdpa) static u32 vdpasim_get_device_id(struct vdpa_device *vdpa) { - return VDPASIM_DEVICE_ID; + struct vdpasim *vdpasim = vdpa_to_sim(vdpa); + + return vdpasim->dev_attr.id; } static u32 vdpasim_get_vendor_id(struct vdpa_device *vdpa) @@ -719,6 +721,7 @@ static int __init vdpasim_dev_init(void) { struct vdpasim_dev_attr dev_attr = {}; + dev_attr.id = VIRTIO_ID_NET; dev_attr.nvqs = VDPASIM_VQ_NUM; vdpasim_dev = vdpasim_create(&dev_attr); -- 2.26.2