From patchwork Tue Apr 21 01:43:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 47385 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CEF382121F for ; Tue, 21 Apr 2015 01:44:22 +0000 (UTC) Received: by wicmx19 with SMTP id mx19sf872911wic.3 for ; Mon, 20 Apr 2015 18:44:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:references:in-reply-to:content-type :content-transfer-encoding:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=Lu9PcJ9M90QJiN7PiGju6ptbSlcjVxa9mJSHgvxPJAA=; b=aSN1IUB9dH6WDNXjY/5QLz+DjyUluV1NOgf9eCmhmWmQjpWEH1T/U+0jh661qWTfcc zlZvR+/CYVVASHwOOxEUX209ZF4FWHNarpxH8CYcbCiHJscSh/D2LkXX/HsoFYLsbsvd L4xXFtPzXb9qgXfkaQkIhwh2oVp02EJZCW6XqyZjA9y8PhBW05om07PqxzvZxfXjzoda f7vhCCLa00NedT0aQFPNRbB9qDU52ZIHgj6koREImJfqTRG/ttPCM6Tq6wzoVmDaleVG +oCh6tz9AOD1zYiVXOLsJikMtZnIkCYhH63gAKQHANTtGaUgh8t5Hq2N+YPXovBkq7D7 nvWg== X-Gm-Message-State: ALoCoQkMw425gikwHvooHjDse0eacRi13L1D60Z5+CAedBaMyjiVgoStiOMLoxxbtrGE6kM1gzJT X-Received: by 10.180.11.101 with SMTP id p5mr316288wib.3.1429580662098; Mon, 20 Apr 2015 18:44:22 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.162 with SMTP id z2ls840682laj.75.gmail; Mon, 20 Apr 2015 18:44:21 -0700 (PDT) X-Received: by 10.112.161.66 with SMTP id xq2mr18081392lbb.103.1429580661815; Mon, 20 Apr 2015 18:44:21 -0700 (PDT) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id od5si234254lbb.123.2015.04.20.18.44.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Apr 2015 18:44:21 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by lbbqq2 with SMTP id qq2so144337049lbb.3 for ; Mon, 20 Apr 2015 18:44:21 -0700 (PDT) X-Received: by 10.112.140.231 with SMTP id rj7mr17550333lbb.76.1429580661469; Mon, 20 Apr 2015 18:44:21 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp346468lbt; Mon, 20 Apr 2015 18:44:20 -0700 (PDT) X-Received: by 10.55.53.7 with SMTP id c7mr33000140qka.60.1429580660096; Mon, 20 Apr 2015 18:44:20 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 16si423791qkr.80.2015.04.20.18.44.19 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 20 Apr 2015 18:44:20 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:55887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkNEZ-0000UD-3a for patch@linaro.org; Mon, 20 Apr 2015 21:44:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55802) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkNE8-0000DF-UM for qemu-devel@nongnu.org; Mon, 20 Apr 2015 21:43:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YkNE5-0007cD-FN for qemu-devel@nongnu.org; Mon, 20 Apr 2015 21:43:52 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:34080) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkNE5-0007bg-7R for qemu-devel@nongnu.org; Mon, 20 Apr 2015 21:43:49 -0400 Received: by pacyx8 with SMTP id yx8so224765950pac.1 for ; Mon, 20 Apr 2015 18:43:48 -0700 (PDT) X-Received: by 10.68.177.226 with SMTP id ct2mr11758402pbc.105.1429580628254; Mon, 20 Apr 2015 18:43:48 -0700 (PDT) Received: from [10.11.6.138] ([167.160.116.164]) by mx.google.com with ESMTPSA id h12sm228392pdk.77.2015.04.20.18.43.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Apr 2015 18:43:46 -0700 (PDT) Message-ID: <5535AB48.6010808@linaro.org> Date: Tue, 21 Apr 2015 09:43:36 +0800 From: Shannon Zhao User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Cornelia Huck References: <1429518001-1040-1-git-send-email-shannon.zhao@linaro.org> <1429518001-1040-2-git-send-email-shannon.zhao@linaro.org> <20150420133203.2fd6caff.cornelia.huck@de.ibm.com> In-Reply-To: <20150420133203.2fd6caff.cornelia.huck@de.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.220.41 Cc: peter.maydell@linaro.org, hangaohuai@huawei.com, mst@redhat.com, peter.huangpeng@huawei.com, qemu-devel@nongnu.org, zhaoshenglong@huawei.com, pbonzini@redhat.com, christoffer.dall@linaro.org Subject: Re: [Qemu-devel] [PATCH v2 1/2] hw/net/virtio-net: Move DEFINE_VIRTIO_NET_FEATURES to virtio-net X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: shannon.zhao@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 On 2015/4/20 19:32, Cornelia Huck wrote: > On Mon, 20 Apr 2015 16:20:00 +0800 > shannon.zhao@linaro.org wrote: > >> From: Shannon Zhao >> >> Move DEFINE_VIRTIO_NET_FEATURES to the backend virtio-net. >> The transports just sync the host features from backend. >> >> Signed-off-by: Shannon Zhao >> Signed-off-by: Shannon Zhao >> --- >> hw/net/virtio-net.c | 4 ++++ >> hw/s390x/s390-virtio-bus.c | 1 - >> hw/s390x/virtio-ccw.c | 1 - >> hw/virtio/virtio-pci.c | 1 - >> include/hw/virtio/virtio-net.h | 1 + >> 5 files changed, 5 insertions(+), 3 deletions(-) > > I need the following change to make this work for virtio-ccw: > Maybe we can use following patch. This moves virtio_net_set_config_size to virtio_net_device_realize function. As the features are moved to virtio-net, so we should set the config_size in virtio-net too. And this can be useful to virtio-mmio which now doesn't call virtio_net_set_config_size in virtio-mmio's realize function. Cornelia, could you check if this works on s390? Thanks. > diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c > index 2252789..7a2bdff 100644 > --- a/hw/s390x/virtio-ccw.c > +++ b/hw/s390x/virtio-ccw.c > @@ -779,7 +779,6 @@ static void virtio_ccw_net_realize(VirtioCcwDevice *ccw_dev, Error **errp) > DeviceState *vdev = DEVICE(&dev->vdev); > Error *err = NULL; > > - virtio_net_set_config_size(&dev->vdev, ccw_dev->host_features[0]); > virtio_net_set_netclient_name(&dev->vdev, qdev->id, > object_get_typename(OBJECT(qdev))); > qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); > @@ -790,6 +789,7 @@ static void virtio_ccw_net_realize(VirtioCcwDevice *ccw_dev, Error **errp) > } > > virtio_ccw_device_realize(ccw_dev, VIRTIO_DEVICE(vdev), errp); > + virtio_net_set_config_size(&dev->vdev, ccw_dev->host_features[0]); > } > > static void virtio_ccw_net_instance_init(Object *obj) > > host_features used to be statically populated, so > virtio_net_set_config_size() was able to use the various feature bits > for its decisions. > > It does not seem quite right, however, since the set of feature bits > had not been through virtio-net's ->get_features() routine (or the > feature bit manipulations in virtio-ccw's realize() routine) - it was > just good enough. > > Maybe the right place for calling set_config_size() would be in a > virtio-net specific ->plugged() callback? > > I'm not sure why virtio-pci works, but they have a different topology > with pci device and virtio-pci device separate, so it might work out > there. > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 27ec5b1..36ba027 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1588,6 +1588,7 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp) NetClientState *nc; int i; + virtio_net_set_config_size(n, n->host_features); virtio_init(vdev, "virtio-net", VIRTIO_ID_NET, n->config_size); n->max_queues = MAX(n->nic_conf.peers.queues, 1); diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c index 1987873..b893e02 100644 --- a/hw/s390x/s390-virtio-bus.c +++ b/hw/s390x/s390-virtio-bus.c @@ -145,7 +145,6 @@ static void s390_virtio_net_realize(VirtIOS390Device *s390_dev, Error **errp) DeviceState *vdev = DEVICE(&dev->vdev); Error *err = NULL; - virtio_net_set_config_size(&dev->vdev, s390_dev->host_features); virtio_net_set_netclient_name(&dev->vdev, qdev->id, object_get_typename(OBJECT(qdev))); qdev_set_parent_bus(vdev, BUS(&s390_dev->bus)); diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 803526a..1252162 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -779,7 +779,6 @@ static void virtio_ccw_net_realize(VirtioCcwDevice *ccw_dev, Error **errp) DeviceState *vdev = DEVICE(&dev->vdev); Error *err = NULL; - virtio_net_set_config_size(&dev->vdev, ccw_dev->host_features[0]); virtio_net_set_netclient_name(&dev->vdev, qdev->id, object_get_typename(OBJECT(qdev))); qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 772244e..c6b99f9 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1369,7 +1369,6 @@ static void virtio_net_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) VirtIONetPCI *dev = VIRTIO_NET_PCI(vpci_dev); DeviceState *vdev = DEVICE(&dev->vdev); - virtio_net_set_config_size(&dev->vdev, vpci_dev->host_features); virtio_net_set_netclient_name(&dev->vdev, qdev->id, object_get_typename(OBJECT(qdev))); qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));