From: Peter Maydell <peter.maydell@linaro.org>
To: Mario Smarduch <m.smarduch@samsung.com>
Cc: "KONRAD Frédéric" <fred.konrad@greensocs.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"QEMU Developers" <qemu-devel@nongnu.org>,
"Anthony Liguori" <aliguori@amazon.com>,
"Patch Tracking" <patches@linaro.org>
Subject: Re: [Qemu-devel] [PATCH] virtio: set virtio-net/virtio-mmio host features
Date: Fri, 14 Feb 2014 23:49:53 +0000 [thread overview]
Message-ID: <CAFEAcA8sFYTUTEZmM_vjmd-HJZp4NQZO0f1_fmQsctxHGyOU-w@mail.gmail.com> (raw)
In-Reply-To: <52FD3593.3040109@samsung.com>
CCing the virtio maintainers.
thanks
-- PMM
On 13 February 2014 21:13, Mario Smarduch <m.smarduch@samsung.com> wrote:
> virtio: set virtio-net/virtio-mmio host features
>
> Patch sets 'virtio-net/virtio-mmio' host features to enable network
> features based on peer capabilities. Currently host features turn
> of all features by default.
>
> Signed-off-by: Mario Smarduch <m.smarduch@samsung.com>
> ---
> hw/virtio/virtio-mmio.c | 29 +++++++++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
> diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
> index 8829eb0..1d940b7 100644
> --- a/hw/virtio/virtio-mmio.c
> +++ b/hw/virtio/virtio-mmio.c
> @@ -23,6 +23,7 @@
> #include "hw/virtio/virtio.h"
> #include "qemu/host-utils.h"
> #include "hw/virtio/virtio-bus.h"
> +#include "hw/virtio/virtio-net.h"
>
> /* #define DEBUG_VIRTIO_MMIO */
>
> @@ -92,6 +93,12 @@ typedef struct {
> static void virtio_mmio_bus_new(VirtioBusState *bus, size_t bus_size,
> VirtIOMMIOProxy *dev);
>
> +/* all possible virtio-net features supported */
> +static Property virtio_mmio_net_properties[] = {
> + DEFINE_VIRTIO_NET_FEATURES(VirtIOMMIOProxy, host_features),
> + DEFINE_PROP_END_OF_LIST(),
> +};
> +
> static uint64_t virtio_mmio_read(void *opaque, hwaddr offset, unsigned size)
> {
> VirtIOMMIOProxy *proxy = (VirtIOMMIOProxy *)opaque;
> @@ -347,11 +354,33 @@ static void virtio_mmio_reset(DeviceState *d)
>
> /* virtio-mmio device */
>
> +/* Walk virtio-net possible supported features and set host_features, this
> + * should be done earlier when the object is instantiated but at that point
> + * you don't know what type of device will be plugged in.
> + */
> +static void virtio_mmio_set_net_features(Property *prop, uint32_t *features)
> +{
> + for (; prop && prop->name; prop++) {
> + if (prop->defval == true) {
> + *features |= (1 << prop->bitnr);
> + } else {
> + *features &= ~(1 << prop->bitnr);
> + }
> + }
> +}
> +
> /* This is called by virtio-bus just after the device is plugged. */
> static void virtio_mmio_device_plugged(DeviceState *opaque)
> {
> VirtIOMMIOProxy *proxy = VIRTIO_MMIO(opaque);
> + VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
> + Object *obj = OBJECT(vdev);
>
> + /* set host features only for virtio-net */
> + if (object_dynamic_cast(obj, TYPE_VIRTIO_NET)) {
> + virtio_mmio_set_net_features(virtio_mmio_net_properties,
> + &proxy->host_features);
> + }
> proxy->host_features |= (0x1 << VIRTIO_F_NOTIFY_ON_EMPTY);
> proxy->host_features = virtio_bus_get_vdev_features(&proxy->bus,
> proxy->host_features);
> --
> 1.7.9.5
>
next prev parent reply other threads:[~2014-02-14 23:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <52FD328A.40605@samsung.com>
2014-02-13 21:13 ` [Qemu-devel] [PATCH] virtio: set virtio-net/virtio-mmio host features Mario Smarduch
2014-02-14 23:49 ` Peter Maydell [this message]
2014-02-20 18:12 ` Mario Smarduch
2014-02-20 18:30 ` Peter Maydell
2014-02-20 19:09 ` Mario Smarduch
2014-02-20 19:35 ` Peter Maydell
2014-02-20 21:59 ` Mario Smarduch
2014-02-20 22:10 ` Peter Maydell
2014-02-20 22:36 ` Mario Smarduch
2014-02-20 22:47 ` Peter Maydell
2014-02-20 23:17 ` Mario Smarduch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFEAcA8sFYTUTEZmM_vjmd-HJZp4NQZO0f1_fmQsctxHGyOU-w@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=aliguori@amazon.com \
--cc=fred.konrad@greensocs.com \
--cc=m.smarduch@samsung.com \
--cc=mst@redhat.com \
--cc=patches@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).