All of lore.kernel.org
 help / color / mirror / Atom feed
From: Auger Eric <eric.auger@redhat.com>
To: Stefan Berger <stefanb@linux.vnet.ibm.com>, qemu-devel@nongnu.org
Cc: marcandre.lureau@redhat.com,
	Stefan Berger <stefanb@linux.ibm.com>,
	philmd@redhat.com, mkedzier@redhat.com, pbonzini@redhat.com
Subject: Re: [PATCH v4 2/8] tpm: Extend TPMIfClass with get_irqnum() function
Date: Thu, 18 Jun 2020 09:10:33 +0200	[thread overview]
Message-ID: <235fd158-16b6-e864-0b66-225ab9e12a54@redhat.com> (raw)
In-Reply-To: <20200617142305.1198672-3-stefanb@linux.vnet.ibm.com>

Hi Stefan,

On 6/17/20 4:22 PM, Stefan Berger wrote:
> From: Stefan Berger <stefanb@sbct-2.pok.ibm.com>
> 
> Implement get_irqnum() as part of the TPMIfClass to get the assigned IRQ
> number or TPM_IRQ_DISABLED (~0) in case IRQs cannot be used.
> 
> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Message-id: 20200616205721.1191408-3-stefanb@linux.vnet.ibm.com
Reviewed-by: Eric Auger <eric.auger@redhat.com>

Thanks

Eric


> ---
>  hw/tpm/tpm_tis_isa.c    |  9 +++++++++
>  hw/tpm/tpm_tis_sysbus.c |  9 +++++++++
>  include/sysemu/tpm.h    | 12 ++++++++++++
>  3 files changed, 30 insertions(+)
> 
> diff --git a/hw/tpm/tpm_tis_isa.c b/hw/tpm/tpm_tis_isa.c
> index 30ba37079d..ed6d422f05 100644
> --- a/hw/tpm/tpm_tis_isa.c
> +++ b/hw/tpm/tpm_tis_isa.c
> @@ -80,6 +80,14 @@ static enum TPMVersion tpm_tis_isa_get_tpm_version(TPMIf *ti)
>      return tpm_tis_get_tpm_version(s);
>  }
>  
> +static int8_t tpm_tis_isa_get_irqnum(TPMIf *ti)
> +{
> +    TPMStateISA *isadev = TPM_TIS_ISA(ti);
> +    TPMState *s = &isadev->state;
> +
> +    return s->irq_num;
> +}
> +
>  static void tpm_tis_isa_reset(DeviceState *dev)
>  {
>      TPMStateISA *isadev = TPM_TIS_ISA(dev);
> @@ -148,6 +156,7 @@ static void tpm_tis_isa_class_init(ObjectClass *klass, void *data)
>      dc->reset = tpm_tis_isa_reset;
>      tc->request_completed = tpm_tis_isa_request_completed;
>      tc->get_version = tpm_tis_isa_get_tpm_version;
> +    tc->get_irqnum = tpm_tis_isa_get_irqnum;
>  }
>  
>  static const TypeInfo tpm_tis_isa_info = {
> diff --git a/hw/tpm/tpm_tis_sysbus.c b/hw/tpm/tpm_tis_sysbus.c
> index eced1fc843..86b3988be5 100644
> --- a/hw/tpm/tpm_tis_sysbus.c
> +++ b/hw/tpm/tpm_tis_sysbus.c
> @@ -80,6 +80,14 @@ static enum TPMVersion tpm_tis_sysbus_get_tpm_version(TPMIf *ti)
>      return tpm_tis_get_tpm_version(s);
>  }
>  
> +static int8_t tpm_tis_sysbus_get_irqnum(TPMIf *ti)
> +{
> +    TPMStateSysBus *sbdev = TPM_TIS_SYSBUS(ti);
> +    TPMState *s = &sbdev->state;
> +
> +    return s->irq_num;
> +}
> +
>  static void tpm_tis_sysbus_reset(DeviceState *dev)
>  {
>      TPMStateSysBus *sbdev = TPM_TIS_SYSBUS(dev);
> @@ -137,6 +145,7 @@ static void tpm_tis_sysbus_class_init(ObjectClass *klass, void *data)
>      dc->reset = tpm_tis_sysbus_reset;
>      tc->request_completed = tpm_tis_sysbus_request_completed;
>      tc->get_version = tpm_tis_sysbus_get_tpm_version;
> +    tc->get_irqnum = tpm_tis_sysbus_get_irqnum;
>  }
>  
>  static const TypeInfo tpm_tis_sysbus_info = {
> diff --git a/include/sysemu/tpm.h b/include/sysemu/tpm.h
> index 03fb25941c..7ebe9f7ef0 100644
> --- a/include/sysemu/tpm.h
> +++ b/include/sysemu/tpm.h
> @@ -25,6 +25,8 @@ typedef enum TPMVersion {
>      TPM_VERSION_2_0 = 2,
>  } TPMVersion;
>  
> +#define TPM_IRQ_DISABLED  ~0
> +
>  #define TYPE_TPM_IF "tpm-if"
>  #define TPM_IF_CLASS(klass)                                 \
>      OBJECT_CLASS_CHECK(TPMIfClass, (klass), TYPE_TPM_IF)
> @@ -41,6 +43,7 @@ typedef struct TPMIfClass {
>      enum TpmModel model;
>      void (*request_completed)(TPMIf *obj, int ret);
>      enum TPMVersion (*get_version)(TPMIf *obj);
> +    int8_t (*get_irqnum)(TPMIf *obj);
>  } TPMIfClass;
>  
>  #define TYPE_TPM_TIS_ISA            "tpm-tis"
> @@ -74,4 +77,13 @@ static inline TPMVersion tpm_get_version(TPMIf *ti)
>      return TPM_IF_GET_CLASS(ti)->get_version(ti);
>  }
>  
> +static inline int8_t tpm_get_irqnum(TPMIf *ti)
> +{
> +    if (!ti || !TPM_IF_GET_CLASS(ti)->get_irqnum) {
> +        return TPM_IRQ_DISABLED;
> +    }
> +
> +    return TPM_IF_GET_CLASS(ti)->get_irqnum(ti);
> +}
> +
>  #endif /* QEMU_TPM_H */
> 



  reply	other threads:[~2020-06-18  7:11 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-17 14:22 [PATCH v4 0/8] tpm: Enable usage of TPM TIS with interrupts Stefan Berger
2020-06-17 14:22 ` [PATCH v4 1/8] tpm_tis: Allow lowering of IRQ also when locality is not active Stefan Berger
2020-06-17 14:22 ` [PATCH v4 2/8] tpm: Extend TPMIfClass with get_irqnum() function Stefan Berger
2020-06-18  7:10   ` Auger Eric [this message]
2020-06-17 14:23 ` [PATCH v4 3/8] tests: Temporarily ignore DSDT table differences Stefan Berger
2020-06-17 14:23 ` [PATCH v4 4/8] tpm: Split TPM_TIS_IRQ into TPM_TIS_ISA_IRQ and TPM_TIS_SYSBUS_IRQ Stefan Berger
2020-06-18  7:10   ` Auger Eric
2020-06-17 14:23 ` [PATCH v4 5/8] acpi: Enable TPM IRQ Stefan Berger
2020-06-18  7:12   ` Auger Eric
2020-06-23 13:01   ` Igor Mammedov
2020-06-17 14:23 ` [PATCH v4 6/8] tests: Add updated DSDT Stefan Berger
2020-06-18  7:13   ` Auger Eric
2020-06-23 13:06   ` Igor Mammedov
2020-06-17 14:23 ` [PATCH v4 7/8] tpm: Guard irq related ops in case interrupts are disabled Stefan Berger
2020-06-18  7:22   ` Auger Eric
2020-06-17 14:23 ` [PATCH v4 8/8] tpm: Disable interrupt support for TIS on sysbus Stefan Berger
2020-06-18  7:22   ` Auger Eric
2020-06-17 14:33 ` [PATCH v4 0/8] tpm: Enable usage of TPM TIS with interrupts no-reply
2020-06-17 14:50 ` no-reply
2020-06-18  7:27 ` Auger Eric
2020-06-25 22:37   ` Stefan Berger
2020-06-23 13:09 ` Michael S. Tsirkin
2020-06-23 13:23   ` Stefan Berger

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=235fd158-16b6-e864-0b66-225ab9e12a54@redhat.com \
    --to=eric.auger@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mkedzier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanb@linux.ibm.com \
    --cc=stefanb@linux.vnet.ibm.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 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.