All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>
Cc: qemu-devel@nongnu.org, dgilbert@redhat.com, peterx@redhat.com,
	Amarnath Valluri <amarnath.valluri@intel.com>
Subject: Re: [Qemu-devel] [PATCH] tpm: Fix compilation with --disable-tpm
Date: Wed, 18 Oct 2017 11:27:09 +0200	[thread overview]
Message-ID: <874lqwolg2.fsf@secure.laptop> (raw)
In-Reply-To: <cfb8e3d0-7c4e-f83f-3887-18e6af8b0418@redhat.com> (Laurent Vivier's message of "Wed, 18 Oct 2017 11:09:19 +0200")

Laurent Vivier <lvivier@redhat.com> wrote:
> On 18/10/2017 10:33, Juan Quintela wrote:
>> Commit
>>    c37cacabf2285b0731b44c1f667781fdd4f2b658
>> 
>> broke compilation without tpm.  Just add an empty tpm_cleanup() stub.
>
> tpm_init() and tpm_config_parse() are managed in a different way: they
> are included in a "#ifdef CONFIG_TPM .. #endif" in vl.c
>
> I think you should follow the same way.

tpm is weird (TM):

in include/sysemu/tpm.h we do that in an incline function

static inline TPMVersion tpm_get_version(void)
{
#ifdef CONFIG_TPM
    Object *obj = object_resolve_path_type("", TYPE_TPM_TIS, NULL);

    if (obj) {
        return tpm_tis_get_tpm_version(obj);
    }
#endif
    return TPM_VERSION_UNSPEC;
}


tpm.c, we have an ifdef in the middle of the file

#ifdef CONFIG_TPM

#endif


vl.c, we protect tpm_* calls with CONFIG_TPM

#ifdef CONFIG_TPM
            case QEMU_OPTION_tpmdev:
                if (tpm_config_parse(qemu_find_opts("tpmdev"), optarg) < 0) {
                    exit(1);
                }
                break;
#endif


but we almost never do:

#ifdef CONFIG_TPM
   tpm_cleanup()
#endif

We normally create an stub function.

So ......

We are going to be inconsistent whatever we did.

I would have vote for

#ifdef CONFIG_TPM
void tpm_cleanup(void);
#else
static inline void tpm_cleanup(void) {}
#endif

On the header file (it was my first solution), but having CONFIG_TPM on
tpm.c sounded gross.

So ....

I think that now that the problem is spotted, I will left the choose of
the solution to the maintaner O:-)

Later, Juan.

  reply	other threads:[~2017-10-18  9:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-18  8:33 [Qemu-devel] [PATCH] tpm: Fix compilation with --disable-tpm Juan Quintela
2017-10-18  9:09 ` Laurent Vivier
2017-10-18  9:27   ` Juan Quintela [this message]
2017-10-18 10:04     ` Valluri, Amarnath

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=874lqwolg2.fsf@secure.laptop \
    --to=quintela@redhat.com \
    --cc=amarnath.valluri@intel.com \
    --cc=dgilbert@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=peterx@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.