qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 3/5] tools/vhost-user-i2c: Add backend driver


From: Alex Bennée
Subject: Re: [PATCH 3/5] tools/vhost-user-i2c: Add backend driver
Date: Tue, 30 Mar 2021 13:49:25 +0100
User-agent: mu4e 1.5.11; emacs 28.0.50

Viresh Kumar <viresh.kumar@linaro.org> writes:

> On 25-03-21, 13:09, Jie Deng wrote:
>> 
>> On 2021/3/24 15:33, Viresh Kumar wrote:
<snip>
>  
>> > +/* vhost-user-i2c definitions */
>> > +
>> > +#ifndef container_of
>> > +#define container_of(ptr, type, member) ({                      \
>> > +        const typeof(((type *) 0)->member) *__mptr = (ptr);     \
>> > +        (type *) ((char *) __mptr - offsetof(type, member));})
>> > +#endif
>> 
>> 
>> This seems to be a general interface.  I see there is a definition in
>> qemu/compiler.h.
>> 
>> Can we reuse it ?
>
> Damn. My bad (maybe not). I picked this part from the RPMB patchset
> that Alex sent and didn't bother looking for it.
>
> Though on the other hand, we are looking to make this file independent
> of qemu so it can be used by other hypervisors without any (or much)
> modifications, and maybe so it was done so.
>
> Alex ?

Yes when doing virtio-rpmb I ended up copying a bunch of helper
functions from the core QEMU to avoid a dependency on the core code.
These included the vrpmb_iov_* functions as well as the HMAC-SHA-256
implementation (which QEMU has as well).

That said maybe this is futile because I ended up having to qemuutil to
the dependencies:

  dependencies: [qemuutil, glib, gio, vhost_user],

because it ends up failing to build due to the trace_ points that have
been added to the libvhost-user library. I'm sure this wouldn't be too
difficult to overcome if needed.

That said this is all build time dependencies - the final binary does
not rely on a QEMU library as everything it needs from qemu is
statically linked in. That doesn't stop it being portable to other
hypervisors or running independently of QEMU but it does tie it to being
built as part of the source tree.

-- 
Alex Bennée



reply via email to

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