qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 01/15] crypto: introduce cryptodev backend an


From: Daniel P. Berrange
Subject: Re: [Qemu-devel] [PATCH v2 01/15] crypto: introduce cryptodev backend and crypto legacy hardware
Date: Tue, 13 Sep 2016 10:59:16 +0100
User-agent: Mutt/1.7.0 (2016-08-17)

On Tue, Sep 13, 2016 at 09:55:27AM +0000, Gonglei (Arei) wrote:
> 
> >
> > From: Daniel P. Berrange [mailto:address@hidden
> > Sent: Tuesday, September 13, 2016 5:14 PM
> > Subject: Re: [PATCH v2 01/15] crypto: introduce cryptodev backend and crypto
> > legacy hardware
> > 
> > On Tue, Sep 13, 2016 at 11:52:07AM +0800, Gonglei wrote:
> > > cryptodev backend is used to realize the active work for
> > > virtual crypto device. CryptoLegacyHW device is a cryptographic
> > > hardware device seen by the virtual machine.
> > > The relationship between cryptodev backend and legacy hadware
> > > as follow:
> > >  crypto_legacy_hw device (1)--->(n) cryptodev client backend
> > >
> > > Signed-off-by: Gonglei <address@hidden>
> > 
> > > diff --git a/crypto/crypto.c b/crypto/crypto.c
> > > new file mode 100644
> > > index 0000000..fbc6497
> > > --- /dev/null
> > > +++ b/crypto/crypto.c
> > > @@ -0,0 +1,171 @@
> > > +/*
> > > + * QEMU Crypto Device Implement
> > > + *
> > > + * Copyright (c) 2016 HUAWEI TECHNOLOGIES CO., LTD.
> > > + *
> > > + * Authors:
> > > + *    Gonglei <address@hidden>
> > > + *
> > > + * Permission is hereby granted, free of charge, to any person obtaining 
> > > a
> > copy
> > > + * of this software and associated documentation files (the "Software"), 
> > > to
> > deal
> > > + * in the Software without restriction, including without limitation the 
> > > rights
> > > + * to use, copy, modify, merge, publish, distribute, sublicense, and/or 
> > > sell
> > > + * copies of the Software, and to permit persons to whom the Software is
> > > + * furnished to do so, subject to the following conditions:
> > > + *
> > > + * The above copyright notice and this permission notice shall be 
> > > included in
> > > + * all copies or substantial portions of the Software.
> > > + *
> > > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> > EXPRESS OR
> > > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> > MERCHANTABILITY,
> > > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
> > EVENT SHALL
> > > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
> > DAMAGES OR OTHER
> > > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> > ARISING FROM,
> > > + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> > OTHER DEALINGS IN
> > > + * THE SOFTWARE.
> > > + */
> > 
> > New files are expected to be submitted under the GPLv2+ license,
> > unless they're header files imported from an external project,
> > which this is not.
> > 
> > The same license mistake is made across other files / patches
> > in this series, so I won't repeat the comment - just fix all
> > of them to be GPLv2+ please.
> > 
> > > +#include "qemu/osdep.h"
> > > +#include "sysemu/sysemu.h"
> > > +#include "qapi/error.h"
> > > +#include "qemu/iov.h"
> > > +#include "qapi-visit.h"
> > > +#include "qapi/opts-visitor.h"
> > > +
> > > +#include "crypto/crypto.h"
> > > +#include "qemu/config-file.h"
> > > +#include "monitor/monitor.h"
> > > +
> > > +
> > > +static QTAILQ_HEAD(, CryptoClientState) crypto_clients;
> > > +
> > > +QemuOptsList qemu_cryptodev_opts = {
> > > +    .name = "cryptodev",
> > > +    .implied_opt_name = "type",
> > > +    .head = QTAILQ_HEAD_INITIALIZER(qemu_cryptodev_opts.head),
> > > +    .desc = {
> > > +        /*
> > > +         * no elements => accept any params
> > > +         * validation will happen later
> > > +         */
> > > +        { /* end of list */ }
> > > +    },
> > > +};
> > 
> > No new code should be adding more command line options for
> > device backends.
> > 
> > Your backend impl should be using QOM to define a object,
> > which can be created via the -object command line arg,
> > or object_add monitor command.
> > 
> Any backgrounds about this rule? Maybe I missed something.

I don't think it has been documented anywhere explicitly.
The general idea of using QOM though is that it avoids the
need for you to re-invent the wheel for command line parsing
and gives you QMP/HMP based hotplug for free at the same
time. It was first used for the RNG and hostmem backends,
and more recently my tls-creds and secrets objects.

A very very very long term goal would be for exinsting backends
to be converted to be QOM based too, but for now we're just aiming
for any new backends to use QOM from the start.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|



reply via email to

[Prev in Thread] Current Thread [Next in Thread]