qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: "Cédric Le Goater" <clg@kaod.org>, qemu-s390x@nongnu.org
Cc: qemu-devel@nongnu.org, "Halil Pasic" <pasic@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"David Hildenbrand" <david@redhat.com>,
	"Ilya Leoshkevich" <iii@linux.ibm.com>,
	"Eric Farman" <farman@linux.ibm.com>,
	"Cédric Le Goater" <clg@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Yanan Wang" <wangyanan55@huawei.com>
Subject: Re: [PATCH 1/5] confidential guest support: Introduce a 'check' class handler
Date: Thu, 5 Jan 2023 09:46:32 +0100	[thread overview]
Message-ID: <fa7b4a10-0fd5-7435-53e0-89779f0f526f@redhat.com> (raw)
In-Reply-To: <20230104115111.3240594-2-clg@kaod.org>

On 04/01/2023 12.51, Cédric Le Goater wrote:
> From: Cédric Le Goater <clg@redhat.com>
> 
> Some machines have specific requirements to activate confidential
> guest support. Add a class handler to the confidential guest support
> interface to let the arch implementation perform extra checks.
> 
> Cc: Eduardo Habkost <eduardo@habkost.net>
> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>
> Cc: Yanan Wang <wangyanan55@huawei.com>
> Signed-off-by: Cédric Le Goater <clg@redhat.com>
> ---
>   include/exec/confidential-guest-support.h |  4 +++-
>   hw/core/machine.c                         | 11 ++++++-----
>   2 files changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/include/exec/confidential-guest-support.h b/include/exec/confidential-guest-support.h
> index ba2dd4b5df..9e6d362b26 100644
> --- a/include/exec/confidential-guest-support.h
> +++ b/include/exec/confidential-guest-support.h
> @@ -23,7 +23,8 @@
>   #include "qom/object.h"
>   
>   #define TYPE_CONFIDENTIAL_GUEST_SUPPORT "confidential-guest-support"
> -OBJECT_DECLARE_SIMPLE_TYPE(ConfidentialGuestSupport, CONFIDENTIAL_GUEST_SUPPORT)
> +OBJECT_DECLARE_TYPE(ConfidentialGuestSupport, ConfidentialGuestSupportClass,
> +                    CONFIDENTIAL_GUEST_SUPPORT)
>   
>   struct ConfidentialGuestSupport {
>       Object parent;
> @@ -55,6 +56,7 @@ struct ConfidentialGuestSupport {
>   
>   typedef struct ConfidentialGuestSupportClass {
>       ObjectClass parent;
> +    bool (*check)(const Object *obj, Error **errp);
>   } ConfidentialGuestSupportClass;
>   
>   #endif /* !CONFIG_USER_ONLY */
> diff --git a/hw/core/machine.c b/hw/core/machine.c
> index f589b92909..bab43cd675 100644
> --- a/hw/core/machine.c
> +++ b/hw/core/machine.c
> @@ -502,11 +502,12 @@ static void machine_check_confidential_guest_support(const Object *obj,
>                                                        Object *new_target,
>                                                        Error **errp)
>   {
> -    /*
> -     * So far the only constraint is that the target has the
> -     * TYPE_CONFIDENTIAL_GUEST_SUPPORT interface, and that's checked
> -     * by the QOM core
> -     */
> +    ConfidentialGuestSupportClass *cgsc =
> +        CONFIDENTIAL_GUEST_SUPPORT_GET_CLASS(new_target);
> +
> +    if (cgsc->check) {
> +        cgsc->check(obj, errp);

I assume the caller is checking *errp, so it's ok to ignore the return value 
of the check function here?

> +    }
>   }
>   
>   static bool machine_get_nvdimm(Object *obj, Error **errp)

Reviewed-by: Thomas Huth <thuth@redhat.com>



  reply	other threads:[~2023-01-05  8:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04 11:51 [PATCH 0/5] s390x/pv: Improve protected VM support Cédric Le Goater
2023-01-04 11:51 ` [PATCH 1/5] confidential guest support: Introduce a 'check' class handler Cédric Le Goater
2023-01-05  8:46   ` Thomas Huth [this message]
2023-01-05 10:34     ` Philippe Mathieu-Daudé
2023-01-05 13:56     ` Cédric Le Goater
2023-01-04 11:51 ` [PATCH 2/5] s390x/pv: Implement CGS check handler Cédric Le Goater
2023-01-05 11:42   ` Thomas Huth
2023-01-05 13:58     ` Claudio Imbrenda
2023-01-05 14:47       ` Cédric Le Goater
2023-01-05 14:53         ` Thomas Huth
2023-01-05 17:12           ` Cédric Le Goater
2023-01-04 11:51 ` [PATCH 3/5] s390x/pv: Check for support on the host Cédric Le Goater
2023-01-05 11:46   ` Thomas Huth
2023-01-04 11:51 ` [PATCH 4/5] s390x/pv: Introduce a s390_pv_check() helper for runtime Cédric Le Goater
2023-01-05 12:33   ` Thomas Huth
2023-01-05 14:24   ` Claudio Imbrenda
2023-01-04 11:51 ` [PATCH 5/5] s390x/pv: Move check on hugepage under s390_pv_guest_check() Cédric Le Goater
2023-01-05 12:37   ` Thomas Huth

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=fa7b4a10-0fd5-7435-53e0-89779f0f526f@redhat.com \
    --to=thuth@redhat.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=clg@kaod.org \
    --cc=clg@redhat.com \
    --cc=david@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=farman@linux.ibm.com \
    --cc=iii@linux.ibm.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=pasic@linux.ibm.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=wangyanan55@huawei.com \
    /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).