qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] tpm: Move memory subregion function into realize function
@ 2015-03-10 10:34 Stefan Berger
  2015-03-10 15:07 ` Michael S. Tsirkin
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Berger @ 2015-03-10 10:34 UTC (permalink / raw)
  To: mst, qemu-trivial, qemu-devel; +Cc: Stefan Berger, Stefan Berger

From: Stefan Berger <stefanb@us.ibm.com>

Move the memory subregion function into the DeviceClass realize function
due to isa_address_space (now) crashing if called in the instance init
function.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
---
 hw/tpm/tpm_tis.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index d0bb97f..9084ca4 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -959,18 +959,18 @@ static void tpm_tis_realizefn(DeviceState *dev, Error **errp)
     tis->bh = qemu_bh_new(tpm_tis_receive_bh, s);
 
     isa_init_irq(&s->busdev, &tis->irq, tis->irq_num);
+
+    memory_region_add_subregion(isa_address_space(ISA_DEVICE(dev)),
+                                TPM_TIS_ADDR_BASE, &s->mmio);
 }
 
 static void tpm_tis_initfn(Object *obj)
 {
-    ISADevice *dev = ISA_DEVICE(obj);
     TPMState *s = TPM(obj);
 
     memory_region_init_io(&s->mmio, OBJECT(s), &tpm_tis_memory_ops,
                           s, "tpm-tis-mmio",
                           TPM_TIS_NUM_LOCALITIES << TPM_TIS_LOCALITY_SHIFT);
-    memory_region_add_subregion(isa_address_space(dev), TPM_TIS_ADDR_BASE,
-                                &s->mmio);
 }
 
 static void tpm_tis_class_init(ObjectClass *klass, void *data)
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] tpm: Move memory subregion function into realize function
  2015-03-10 10:34 [Qemu-devel] [PATCH v2] tpm: Move memory subregion function into realize function Stefan Berger
@ 2015-03-10 15:07 ` Michael S. Tsirkin
  2015-03-10 15:48   ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Michael S. Tsirkin @ 2015-03-10 15:07 UTC (permalink / raw)
  To: Stefan Berger; +Cc: qemu-trivial, pbonzini, Stefan Berger, qemu-devel

On Tue, Mar 10, 2015 at 06:34:01AM -0400, Stefan Berger wrote:
> From: Stefan Berger <stefanb@us.ibm.com>
> 
> Move the memory subregion function into the DeviceClass realize function
> due to isa_address_space (now) crashing if called in the instance init
> function.
> 
> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>

Paolo can you ack pls?

> ---
>  hw/tpm/tpm_tis.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
> index d0bb97f..9084ca4 100644
> --- a/hw/tpm/tpm_tis.c
> +++ b/hw/tpm/tpm_tis.c
> @@ -959,18 +959,18 @@ static void tpm_tis_realizefn(DeviceState *dev, Error **errp)
>      tis->bh = qemu_bh_new(tpm_tis_receive_bh, s);
>  
>      isa_init_irq(&s->busdev, &tis->irq, tis->irq_num);
> +
> +    memory_region_add_subregion(isa_address_space(ISA_DEVICE(dev)),
> +                                TPM_TIS_ADDR_BASE, &s->mmio);
>  }
>  
>  static void tpm_tis_initfn(Object *obj)
>  {
> -    ISADevice *dev = ISA_DEVICE(obj);
>      TPMState *s = TPM(obj);
>  
>      memory_region_init_io(&s->mmio, OBJECT(s), &tpm_tis_memory_ops,
>                            s, "tpm-tis-mmio",
>                            TPM_TIS_NUM_LOCALITIES << TPM_TIS_LOCALITY_SHIFT);
> -    memory_region_add_subregion(isa_address_space(dev), TPM_TIS_ADDR_BASE,
> -                                &s->mmio);
>  }
>  
>  static void tpm_tis_class_init(ObjectClass *klass, void *data)
> -- 
> 2.1.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] tpm: Move memory subregion function into realize function
  2015-03-10 15:07 ` Michael S. Tsirkin
@ 2015-03-10 15:48   ` Paolo Bonzini
  0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2015-03-10 15:48 UTC (permalink / raw)
  To: Michael S. Tsirkin, Stefan Berger; +Cc: qemu-trivial, Stefan Berger, qemu-devel



On 10/03/2015 16:07, Michael S. Tsirkin wrote:
> On Tue, Mar 10, 2015 at 06:34:01AM -0400, Stefan Berger wrote:
>> From: Stefan Berger <stefanb@us.ibm.com>
>>
>> Move the memory subregion function into the DeviceClass realize function
>> due to isa_address_space (now) crashing if called in the instance init
>> function.
>>
>> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> 
> Paolo can you ack pls?

Yup.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>

> 
>> ---
>>  hw/tpm/tpm_tis.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
>> index d0bb97f..9084ca4 100644
>> --- a/hw/tpm/tpm_tis.c
>> +++ b/hw/tpm/tpm_tis.c
>> @@ -959,18 +959,18 @@ static void tpm_tis_realizefn(DeviceState *dev, Error **errp)
>>      tis->bh = qemu_bh_new(tpm_tis_receive_bh, s);
>>  
>>      isa_init_irq(&s->busdev, &tis->irq, tis->irq_num);
>> +
>> +    memory_region_add_subregion(isa_address_space(ISA_DEVICE(dev)),
>> +                                TPM_TIS_ADDR_BASE, &s->mmio);
>>  }
>>  
>>  static void tpm_tis_initfn(Object *obj)
>>  {
>> -    ISADevice *dev = ISA_DEVICE(obj);
>>      TPMState *s = TPM(obj);
>>  
>>      memory_region_init_io(&s->mmio, OBJECT(s), &tpm_tis_memory_ops,
>>                            s, "tpm-tis-mmio",
>>                            TPM_TIS_NUM_LOCALITIES << TPM_TIS_LOCALITY_SHIFT);
>> -    memory_region_add_subregion(isa_address_space(dev), TPM_TIS_ADDR_BASE,
>> -                                &s->mmio);
>>  }
>>  
>>  static void tpm_tis_class_init(ObjectClass *klass, void *data)
>> -- 
>> 2.1.0
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-10 15:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-10 10:34 [Qemu-devel] [PATCH v2] tpm: Move memory subregion function into realize function Stefan Berger
2015-03-10 15:07 ` Michael S. Tsirkin
2015-03-10 15:48   ` Paolo Bonzini

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).