qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] spapr-iommu: extend SPAPR_TCE_TABLE class
@ 2013-11-20  5:39 Alexey Kardashevskiy
  2013-12-05  9:39 ` Alexey Kardashevskiy
  2014-03-13 18:04 ` [Qemu-devel] " Mike Day
  0 siblings, 2 replies; 8+ messages in thread
From: Alexey Kardashevskiy @ 2013-11-20  5:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexey Kardashevskiy, qemu-ppc, Alexander Graf

This adds a put_tce() callback to the SPAPR TCE TABLE device class.
The new callback allows to have different IOMMU types such as upcoming
VFIO IOMMU and it will be used more by the upcoming Multi-TCE support.

This reworks the H_PUT_TCE handler to make use of the new put_tce()
callback.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 hw/ppc/spapr_iommu.c   | 21 +++++++++++++++++----
 include/hw/ppc/spapr.h | 13 +++++++++++++
 2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
index ef45f4f..0016c13 100644
--- a/hw/ppc/spapr_iommu.c
+++ b/hw/ppc/spapr_iommu.c
@@ -207,7 +207,7 @@ static target_ulong put_tce_emu(sPAPRTCETable *tcet, target_ulong ioba,
     IOMMUTLBEntry entry;
 
     if (ioba >= tcet->window_size) {
-        hcall_dprintf("spapr_vio_put_tce on out-of-bounds IOBA 0x"
+        hcall_dprintf("spapr put_tce_emu on out-of-bounds IOBA 0x"
                       TARGET_FMT_lx "\n", ioba);
         return H_PARAMETER;
     }
@@ -232,12 +232,21 @@ static target_ulong h_put_tce(PowerPCCPU *cpu, sPAPREnvironment *spapr,
     target_ulong tce = args[2];
     target_ulong ret = H_PARAMETER;
     sPAPRTCETable *tcet = spapr_tce_find_by_liobn(liobn);
+    sPAPRTCETableClass *info;
+
+    if (!tcet) {
+        return H_PARAMETER;
+    }
+
+    info = SPAPR_TCE_TABLE_GET_CLASS(tcet);
+    if (!info || !info->put_tce) {
+        return H_PARAMETER;
+    }
 
     ioba &= ~(SPAPR_TCE_PAGE_SIZE - 1);
 
-    if (tcet) {
-        ret = put_tce_emu(tcet, ioba, tce);
-    }
+    ret = info->put_tce(tcet, ioba, tce);
+
     trace_spapr_iommu_put(liobn, ioba, tce, ret);
 
     return ret;
@@ -287,9 +296,12 @@ int spapr_tcet_dma_dt(void *fdt, int node_off, const char *propname,
 static void spapr_tce_table_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    sPAPRTCETableClass *stc = SPAPR_TCE_TABLE_CLASS(klass);
+
     dc->vmsd = &vmstate_spapr_tce_table;
     dc->init = spapr_tce_table_realize;
     dc->reset = spapr_tce_reset;
+    stc->put_tce = put_tce_emu;
 
     QLIST_INIT(&spapr_tce_tables);
 
@@ -302,6 +314,7 @@ static TypeInfo spapr_tce_table_info = {
     .parent = TYPE_DEVICE,
     .instance_size = sizeof(sPAPRTCETable),
     .class_init = spapr_tce_table_class_init,
+    .class_size = sizeof(sPAPRTCETableClass),
     .instance_finalize = spapr_tce_table_finalize,
 };
 
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index fdaab2d..827cda2 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -367,12 +367,25 @@ int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr,
 
 #define RTAS_ERROR_LOG_MAX      2048
 
+typedef struct sPAPRTCETableClass sPAPRTCETableClass;
 typedef struct sPAPRTCETable sPAPRTCETable;
 
 #define TYPE_SPAPR_TCE_TABLE "spapr-tce-table"
 #define SPAPR_TCE_TABLE(obj) \
     OBJECT_CHECK(sPAPRTCETable, (obj), TYPE_SPAPR_TCE_TABLE)
 
+#define SPAPR_TCE_TABLE_CLASS(klass) \
+     OBJECT_CLASS_CHECK(sPAPRTCETableClass, (klass), TYPE_SPAPR_TCE_TABLE)
+#define SPAPR_TCE_TABLE_GET_CLASS(obj) \
+     OBJECT_GET_CLASS(sPAPRTCETableClass, (obj), TYPE_SPAPR_TCE_TABLE)
+
+struct sPAPRTCETableClass {
+    DeviceClass parent_class;
+
+    target_ulong (*put_tce)(sPAPRTCETable *tcet, target_ulong ioba,
+                            target_ulong tce);
+};
+
 struct sPAPRTCETable {
     DeviceState parent;
     uint32_t liobn;
-- 
1.8.4.rc4

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

* Re: [Qemu-devel] [PATCH] spapr-iommu: extend SPAPR_TCE_TABLE class
  2013-11-20  5:39 [Qemu-devel] [PATCH] spapr-iommu: extend SPAPR_TCE_TABLE class Alexey Kardashevskiy
@ 2013-12-05  9:39 ` Alexey Kardashevskiy
  2013-12-20  2:47   ` Alexey Kardashevskiy
  2014-03-13 18:04 ` [Qemu-devel] " Mike Day
  1 sibling, 1 reply; 8+ messages in thread
From: Alexey Kardashevskiy @ 2013-12-05  9:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexey Kardashevskiy, qemu-ppc, Alexander Graf

On 11/20/2013 04:39 PM, Alexey Kardashevskiy wrote:
> This adds a put_tce() callback to the SPAPR TCE TABLE device class.
> The new callback allows to have different IOMMU types such as upcoming
> VFIO IOMMU and it will be used more by the upcoming Multi-TCE support.
> 
> This reworks the H_PUT_TCE handler to make use of the new put_tce()
> callback.


Ping?


> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
>  hw/ppc/spapr_iommu.c   | 21 +++++++++++++++++----
>  include/hw/ppc/spapr.h | 13 +++++++++++++
>  2 files changed, 30 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
> index ef45f4f..0016c13 100644
> --- a/hw/ppc/spapr_iommu.c
> +++ b/hw/ppc/spapr_iommu.c
> @@ -207,7 +207,7 @@ static target_ulong put_tce_emu(sPAPRTCETable *tcet, target_ulong ioba,
>      IOMMUTLBEntry entry;
>  
>      if (ioba >= tcet->window_size) {
> -        hcall_dprintf("spapr_vio_put_tce on out-of-bounds IOBA 0x"
> +        hcall_dprintf("spapr put_tce_emu on out-of-bounds IOBA 0x"
>                        TARGET_FMT_lx "\n", ioba);
>          return H_PARAMETER;
>      }
> @@ -232,12 +232,21 @@ static target_ulong h_put_tce(PowerPCCPU *cpu, sPAPREnvironment *spapr,
>      target_ulong tce = args[2];
>      target_ulong ret = H_PARAMETER;
>      sPAPRTCETable *tcet = spapr_tce_find_by_liobn(liobn);
> +    sPAPRTCETableClass *info;
> +
> +    if (!tcet) {
> +        return H_PARAMETER;
> +    }
> +
> +    info = SPAPR_TCE_TABLE_GET_CLASS(tcet);
> +    if (!info || !info->put_tce) {
> +        return H_PARAMETER;
> +    }
>  
>      ioba &= ~(SPAPR_TCE_PAGE_SIZE - 1);
>  
> -    if (tcet) {
> -        ret = put_tce_emu(tcet, ioba, tce);
> -    }
> +    ret = info->put_tce(tcet, ioba, tce);
> +
>      trace_spapr_iommu_put(liobn, ioba, tce, ret);
>  
>      return ret;
> @@ -287,9 +296,12 @@ int spapr_tcet_dma_dt(void *fdt, int node_off, const char *propname,
>  static void spapr_tce_table_class_init(ObjectClass *klass, void *data)
>  {
>      DeviceClass *dc = DEVICE_CLASS(klass);
> +    sPAPRTCETableClass *stc = SPAPR_TCE_TABLE_CLASS(klass);
> +
>      dc->vmsd = &vmstate_spapr_tce_table;
>      dc->init = spapr_tce_table_realize;
>      dc->reset = spapr_tce_reset;
> +    stc->put_tce = put_tce_emu;
>  
>      QLIST_INIT(&spapr_tce_tables);
>  
> @@ -302,6 +314,7 @@ static TypeInfo spapr_tce_table_info = {
>      .parent = TYPE_DEVICE,
>      .instance_size = sizeof(sPAPRTCETable),
>      .class_init = spapr_tce_table_class_init,
> +    .class_size = sizeof(sPAPRTCETableClass),
>      .instance_finalize = spapr_tce_table_finalize,
>  };
>  
> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
> index fdaab2d..827cda2 100644
> --- a/include/hw/ppc/spapr.h
> +++ b/include/hw/ppc/spapr.h
> @@ -367,12 +367,25 @@ int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr,
>  
>  #define RTAS_ERROR_LOG_MAX      2048
>  
> +typedef struct sPAPRTCETableClass sPAPRTCETableClass;
>  typedef struct sPAPRTCETable sPAPRTCETable;
>  
>  #define TYPE_SPAPR_TCE_TABLE "spapr-tce-table"
>  #define SPAPR_TCE_TABLE(obj) \
>      OBJECT_CHECK(sPAPRTCETable, (obj), TYPE_SPAPR_TCE_TABLE)
>  
> +#define SPAPR_TCE_TABLE_CLASS(klass) \
> +     OBJECT_CLASS_CHECK(sPAPRTCETableClass, (klass), TYPE_SPAPR_TCE_TABLE)
> +#define SPAPR_TCE_TABLE_GET_CLASS(obj) \
> +     OBJECT_GET_CLASS(sPAPRTCETableClass, (obj), TYPE_SPAPR_TCE_TABLE)
> +
> +struct sPAPRTCETableClass {
> +    DeviceClass parent_class;
> +
> +    target_ulong (*put_tce)(sPAPRTCETable *tcet, target_ulong ioba,
> +                            target_ulong tce);
> +};
> +
>  struct sPAPRTCETable {
>      DeviceState parent;
>      uint32_t liobn;
> 


-- 
Alexey

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

* Re: [Qemu-devel] [PATCH] spapr-iommu: extend SPAPR_TCE_TABLE class
  2013-12-05  9:39 ` Alexey Kardashevskiy
@ 2013-12-20  2:47   ` Alexey Kardashevskiy
  2014-03-12  3:54     ` Alexey Kardashevskiy
  0 siblings, 1 reply; 8+ messages in thread
From: Alexey Kardashevskiy @ 2013-12-20  2:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexey Kardashevskiy, qemu-ppc, Alexander Graf

On 12/05/2013 08:39 PM, Alexey Kardashevskiy wrote:
> On 11/20/2013 04:39 PM, Alexey Kardashevskiy wrote:
>> This adds a put_tce() callback to the SPAPR TCE TABLE device class.
>> The new callback allows to have different IOMMU types such as upcoming
>> VFIO IOMMU and it will be used more by the upcoming Multi-TCE support.
>>
>> This reworks the H_PUT_TCE handler to make use of the new put_tce()
>> callback.
> 
> 
> Ping?


Ping?



> 
>>
>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>> ---
>>  hw/ppc/spapr_iommu.c   | 21 +++++++++++++++++----
>>  include/hw/ppc/spapr.h | 13 +++++++++++++
>>  2 files changed, 30 insertions(+), 4 deletions(-)
>>
>> diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
>> index ef45f4f..0016c13 100644
>> --- a/hw/ppc/spapr_iommu.c
>> +++ b/hw/ppc/spapr_iommu.c
>> @@ -207,7 +207,7 @@ static target_ulong put_tce_emu(sPAPRTCETable *tcet, target_ulong ioba,
>>      IOMMUTLBEntry entry;
>>  
>>      if (ioba >= tcet->window_size) {
>> -        hcall_dprintf("spapr_vio_put_tce on out-of-bounds IOBA 0x"
>> +        hcall_dprintf("spapr put_tce_emu on out-of-bounds IOBA 0x"
>>                        TARGET_FMT_lx "\n", ioba);
>>          return H_PARAMETER;
>>      }
>> @@ -232,12 +232,21 @@ static target_ulong h_put_tce(PowerPCCPU *cpu, sPAPREnvironment *spapr,
>>      target_ulong tce = args[2];
>>      target_ulong ret = H_PARAMETER;
>>      sPAPRTCETable *tcet = spapr_tce_find_by_liobn(liobn);
>> +    sPAPRTCETableClass *info;
>> +
>> +    if (!tcet) {
>> +        return H_PARAMETER;
>> +    }
>> +
>> +    info = SPAPR_TCE_TABLE_GET_CLASS(tcet);
>> +    if (!info || !info->put_tce) {
>> +        return H_PARAMETER;
>> +    }
>>  
>>      ioba &= ~(SPAPR_TCE_PAGE_SIZE - 1);
>>  
>> -    if (tcet) {
>> -        ret = put_tce_emu(tcet, ioba, tce);
>> -    }
>> +    ret = info->put_tce(tcet, ioba, tce);
>> +
>>      trace_spapr_iommu_put(liobn, ioba, tce, ret);
>>  
>>      return ret;
>> @@ -287,9 +296,12 @@ int spapr_tcet_dma_dt(void *fdt, int node_off, const char *propname,
>>  static void spapr_tce_table_class_init(ObjectClass *klass, void *data)
>>  {
>>      DeviceClass *dc = DEVICE_CLASS(klass);
>> +    sPAPRTCETableClass *stc = SPAPR_TCE_TABLE_CLASS(klass);
>> +
>>      dc->vmsd = &vmstate_spapr_tce_table;
>>      dc->init = spapr_tce_table_realize;
>>      dc->reset = spapr_tce_reset;
>> +    stc->put_tce = put_tce_emu;
>>  
>>      QLIST_INIT(&spapr_tce_tables);
>>  
>> @@ -302,6 +314,7 @@ static TypeInfo spapr_tce_table_info = {
>>      .parent = TYPE_DEVICE,
>>      .instance_size = sizeof(sPAPRTCETable),
>>      .class_init = spapr_tce_table_class_init,
>> +    .class_size = sizeof(sPAPRTCETableClass),
>>      .instance_finalize = spapr_tce_table_finalize,
>>  };
>>  
>> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
>> index fdaab2d..827cda2 100644
>> --- a/include/hw/ppc/spapr.h
>> +++ b/include/hw/ppc/spapr.h
>> @@ -367,12 +367,25 @@ int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr,
>>  
>>  #define RTAS_ERROR_LOG_MAX      2048
>>  
>> +typedef struct sPAPRTCETableClass sPAPRTCETableClass;
>>  typedef struct sPAPRTCETable sPAPRTCETable;
>>  
>>  #define TYPE_SPAPR_TCE_TABLE "spapr-tce-table"
>>  #define SPAPR_TCE_TABLE(obj) \
>>      OBJECT_CHECK(sPAPRTCETable, (obj), TYPE_SPAPR_TCE_TABLE)
>>  
>> +#define SPAPR_TCE_TABLE_CLASS(klass) \
>> +     OBJECT_CLASS_CHECK(sPAPRTCETableClass, (klass), TYPE_SPAPR_TCE_TABLE)
>> +#define SPAPR_TCE_TABLE_GET_CLASS(obj) \
>> +     OBJECT_GET_CLASS(sPAPRTCETableClass, (obj), TYPE_SPAPR_TCE_TABLE)
>> +
>> +struct sPAPRTCETableClass {
>> +    DeviceClass parent_class;
>> +
>> +    target_ulong (*put_tce)(sPAPRTCETable *tcet, target_ulong ioba,
>> +                            target_ulong tce);
>> +};
>> +
>>  struct sPAPRTCETable {
>>      DeviceState parent;
>>      uint32_t liobn;
>>
> 
> 


-- 
Alexey

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

* Re: [Qemu-devel] [PATCH] spapr-iommu: extend SPAPR_TCE_TABLE class
  2013-12-20  2:47   ` Alexey Kardashevskiy
@ 2014-03-12  3:54     ` Alexey Kardashevskiy
  0 siblings, 0 replies; 8+ messages in thread
From: Alexey Kardashevskiy @ 2014-03-12  3:54 UTC (permalink / raw)
  To: qemu-devel
  Cc: Mike Day, Paolo Bonzini, qemu-ppc, Alexander Graf,
	Andreas Färber

On 12/20/2013 01:47 PM, Alexey Kardashevskiy wrote:
> On 12/05/2013 08:39 PM, Alexey Kardashevskiy wrote:
>> On 11/20/2013 04:39 PM, Alexey Kardashevskiy wrote:
>>> This adds a put_tce() callback to the SPAPR TCE TABLE device class.
>>> The new callback allows to have different IOMMU types such as upcoming
>>> VFIO IOMMU and it will be used more by the upcoming Multi-TCE support.
>>>
>>> This reworks the H_PUT_TCE handler to make use of the new put_tce()
>>> callback.
>>
>>
>> Ping?
> 
> 
> Ping?


Ping, anyone, please? This is QOM'fication...


> 
> 
> 
>>
>>>
>>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>>> ---
>>>  hw/ppc/spapr_iommu.c   | 21 +++++++++++++++++----
>>>  include/hw/ppc/spapr.h | 13 +++++++++++++
>>>  2 files changed, 30 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
>>> index ef45f4f..0016c13 100644
>>> --- a/hw/ppc/spapr_iommu.c
>>> +++ b/hw/ppc/spapr_iommu.c
>>> @@ -207,7 +207,7 @@ static target_ulong put_tce_emu(sPAPRTCETable *tcet, target_ulong ioba,
>>>      IOMMUTLBEntry entry;
>>>  
>>>      if (ioba >= tcet->window_size) {
>>> -        hcall_dprintf("spapr_vio_put_tce on out-of-bounds IOBA 0x"
>>> +        hcall_dprintf("spapr put_tce_emu on out-of-bounds IOBA 0x"
>>>                        TARGET_FMT_lx "\n", ioba);
>>>          return H_PARAMETER;
>>>      }
>>> @@ -232,12 +232,21 @@ static target_ulong h_put_tce(PowerPCCPU *cpu, sPAPREnvironment *spapr,
>>>      target_ulong tce = args[2];
>>>      target_ulong ret = H_PARAMETER;
>>>      sPAPRTCETable *tcet = spapr_tce_find_by_liobn(liobn);
>>> +    sPAPRTCETableClass *info;
>>> +
>>> +    if (!tcet) {
>>> +        return H_PARAMETER;
>>> +    }
>>> +
>>> +    info = SPAPR_TCE_TABLE_GET_CLASS(tcet);
>>> +    if (!info || !info->put_tce) {
>>> +        return H_PARAMETER;
>>> +    }
>>>  
>>>      ioba &= ~(SPAPR_TCE_PAGE_SIZE - 1);
>>>  
>>> -    if (tcet) {
>>> -        ret = put_tce_emu(tcet, ioba, tce);
>>> -    }
>>> +    ret = info->put_tce(tcet, ioba, tce);
>>> +
>>>      trace_spapr_iommu_put(liobn, ioba, tce, ret);
>>>  
>>>      return ret;
>>> @@ -287,9 +296,12 @@ int spapr_tcet_dma_dt(void *fdt, int node_off, const char *propname,
>>>  static void spapr_tce_table_class_init(ObjectClass *klass, void *data)
>>>  {
>>>      DeviceClass *dc = DEVICE_CLASS(klass);
>>> +    sPAPRTCETableClass *stc = SPAPR_TCE_TABLE_CLASS(klass);
>>> +
>>>      dc->vmsd = &vmstate_spapr_tce_table;
>>>      dc->init = spapr_tce_table_realize;
>>>      dc->reset = spapr_tce_reset;
>>> +    stc->put_tce = put_tce_emu;
>>>  
>>>      QLIST_INIT(&spapr_tce_tables);
>>>  
>>> @@ -302,6 +314,7 @@ static TypeInfo spapr_tce_table_info = {
>>>      .parent = TYPE_DEVICE,
>>>      .instance_size = sizeof(sPAPRTCETable),
>>>      .class_init = spapr_tce_table_class_init,
>>> +    .class_size = sizeof(sPAPRTCETableClass),
>>>      .instance_finalize = spapr_tce_table_finalize,
>>>  };
>>>  
>>> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
>>> index fdaab2d..827cda2 100644
>>> --- a/include/hw/ppc/spapr.h
>>> +++ b/include/hw/ppc/spapr.h
>>> @@ -367,12 +367,25 @@ int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr,
>>>  
>>>  #define RTAS_ERROR_LOG_MAX      2048
>>>  
>>> +typedef struct sPAPRTCETableClass sPAPRTCETableClass;
>>>  typedef struct sPAPRTCETable sPAPRTCETable;
>>>  
>>>  #define TYPE_SPAPR_TCE_TABLE "spapr-tce-table"
>>>  #define SPAPR_TCE_TABLE(obj) \
>>>      OBJECT_CHECK(sPAPRTCETable, (obj), TYPE_SPAPR_TCE_TABLE)
>>>  
>>> +#define SPAPR_TCE_TABLE_CLASS(klass) \
>>> +     OBJECT_CLASS_CHECK(sPAPRTCETableClass, (klass), TYPE_SPAPR_TCE_TABLE)
>>> +#define SPAPR_TCE_TABLE_GET_CLASS(obj) \
>>> +     OBJECT_GET_CLASS(sPAPRTCETableClass, (obj), TYPE_SPAPR_TCE_TABLE)
>>> +
>>> +struct sPAPRTCETableClass {
>>> +    DeviceClass parent_class;
>>> +
>>> +    target_ulong (*put_tce)(sPAPRTCETable *tcet, target_ulong ioba,
>>> +                            target_ulong tce);
>>> +};
>>> +
>>>  struct sPAPRTCETable {
>>>      DeviceState parent;
>>>      uint32_t liobn;
>>>
>>
>>
> 
> 


-- 
Alexey

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

* Re: [Qemu-devel] spapr-iommu: extend SPAPR_TCE_TABLE class
  2013-11-20  5:39 [Qemu-devel] [PATCH] spapr-iommu: extend SPAPR_TCE_TABLE class Alexey Kardashevskiy
  2013-12-05  9:39 ` Alexey Kardashevskiy
@ 2014-03-13 18:04 ` Mike Day
  2014-03-13 18:50   ` Andreas Färber
  1 sibling, 1 reply; 8+ messages in thread
From: Mike Day @ 2014-03-13 18:04 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: qemu-ppc, qemu-devel, Alexander Graf

On 20/11/13 16:39 +1100, Alexey Kardashevskiy wrote:
> This adds a put_tce() callback to the SPAPR TCE TABLE device class.
> The new callback allows to have different IOMMU types such as upcoming
> VFIO IOMMU and it will be used more by the upcoming Multi-TCE support.
> 
> This reworks the H_PUT_TCE handler to make use of the new put_tce()
> callback.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Mike Day <ncmike@ncultra.org>



> ---
>  hw/ppc/spapr_iommu.c   | 21 +++++++++++++++++----
>  include/hw/ppc/spapr.h | 13 +++++++++++++
>  2 files changed, 30 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
> index ef45f4f..0016c13 100644
> --- a/hw/ppc/spapr_iommu.c
> +++ b/hw/ppc/spapr_iommu.c
> @@ -207,7 +207,7 @@ static target_ulong put_tce_emu(sPAPRTCETable *tcet, target_ulong ioba,
>      IOMMUTLBEntry entry;
>  
>      if (ioba >= tcet->window_size) {
> -        hcall_dprintf("spapr_vio_put_tce on out-of-bounds IOBA 0x"
> +        hcall_dprintf("spapr put_tce_emu on out-of-bounds IOBA 0x"
>                        TARGET_FMT_lx "\n", ioba);
>          return H_PARAMETER;
>      }
> @@ -232,12 +232,21 @@ static target_ulong h_put_tce(PowerPCCPU *cpu, sPAPREnvironment *spapr,
>      target_ulong tce = args[2];
>      target_ulong ret = H_PARAMETER;
>      sPAPRTCETable *tcet = spapr_tce_find_by_liobn(liobn);
> +    sPAPRTCETableClass *info;
> +
> +    if (!tcet) {
> +        return H_PARAMETER;
> +    }
> +
> +    info = SPAPR_TCE_TABLE_GET_CLASS(tcet);
> +    if (!info || !info->put_tce) {
> +        return H_PARAMETER;
> +    }
>  
>      ioba &= ~(SPAPR_TCE_PAGE_SIZE - 1);
>  
> -    if (tcet) {
> -        ret = put_tce_emu(tcet, ioba, tce);
> -    }
> +    ret = info->put_tce(tcet, ioba, tce);
> +
>      trace_spapr_iommu_put(liobn, ioba, tce, ret);
>  
>      return ret;
> @@ -287,9 +296,12 @@ int spapr_tcet_dma_dt(void *fdt, int node_off, const char *propname,
>  static void spapr_tce_table_class_init(ObjectClass *klass, void *data)
>  {
>      DeviceClass *dc = DEVICE_CLASS(klass);
> +    sPAPRTCETableClass *stc = SPAPR_TCE_TABLE_CLASS(klass);
> +
>      dc->vmsd = &vmstate_spapr_tce_table;
>      dc->init = spapr_tce_table_realize;
>      dc->reset = spapr_tce_reset;
> +    stc->put_tce = put_tce_emu;
>  
>      QLIST_INIT(&spapr_tce_tables);
>  
> @@ -302,6 +314,7 @@ static TypeInfo spapr_tce_table_info = {
>      .parent = TYPE_DEVICE,
>      .instance_size = sizeof(sPAPRTCETable),
>      .class_init = spapr_tce_table_class_init,
> +    .class_size = sizeof(sPAPRTCETableClass),
>      .instance_finalize = spapr_tce_table_finalize,
>  };
>  
> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
> index fdaab2d..827cda2 100644
> --- a/include/hw/ppc/spapr.h
> +++ b/include/hw/ppc/spapr.h
> @@ -367,12 +367,25 @@ int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr,
>  
>  #define RTAS_ERROR_LOG_MAX      2048
>  
> +typedef struct sPAPRTCETableClass sPAPRTCETableClass;
>  typedef struct sPAPRTCETable sPAPRTCETable;
>  
>  #define TYPE_SPAPR_TCE_TABLE "spapr-tce-table"
>  #define SPAPR_TCE_TABLE(obj) \
>      OBJECT_CHECK(sPAPRTCETable, (obj), TYPE_SPAPR_TCE_TABLE)
>  
> +#define SPAPR_TCE_TABLE_CLASS(klass) \
> +     OBJECT_CLASS_CHECK(sPAPRTCETableClass, (klass), TYPE_SPAPR_TCE_TABLE)
> +#define SPAPR_TCE_TABLE_GET_CLASS(obj) \
> +     OBJECT_GET_CLASS(sPAPRTCETableClass, (obj), TYPE_SPAPR_TCE_TABLE)
> +
> +struct sPAPRTCETableClass {
> +    DeviceClass parent_class;
> +
> +    target_ulong (*put_tce)(sPAPRTCETable *tcet, target_ulong ioba,
> +                            target_ulong tce);
> +};
> +
>  struct sPAPRTCETable {
>      DeviceState parent;
>      uint32_t liobn;
> -- 
> 1.8.4.rc4
> 
> 
> 
> 

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

* Re: [Qemu-devel] spapr-iommu: extend SPAPR_TCE_TABLE class
  2014-03-13 18:04 ` [Qemu-devel] " Mike Day
@ 2014-03-13 18:50   ` Andreas Färber
  2014-03-13 23:19     ` Alexey Kardashevskiy
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Färber @ 2014-03-13 18:50 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: qemu-ppc, qemu-devel, Alexander Graf

Am 13.03.2014 19:04, schrieb Mike Day:
> On 20/11/13 16:39 +1100, Alexey Kardashevskiy wrote:
>> This adds a put_tce() callback to the SPAPR TCE TABLE device class.
>> The new callback allows to have different IOMMU types such as upcoming
>> VFIO IOMMU and it will be used more by the upcoming Multi-TCE support.
>>
>> This reworks the H_PUT_TCE handler to make use of the new put_tce()
>> callback.
>>
>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> Reviewed-by: Mike Day <ncmike@ncultra.org>

Looks reasonable, but not needed for 2.0 unless a second implementation
comes up.

Reviewed-by: Andreas Färber <afaerber@suse.de>

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

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

* Re: [Qemu-devel] spapr-iommu: extend SPAPR_TCE_TABLE class
  2014-03-13 18:50   ` Andreas Färber
@ 2014-03-13 23:19     ` Alexey Kardashevskiy
  2014-03-13 23:59       ` Alexander Graf
  0 siblings, 1 reply; 8+ messages in thread
From: Alexey Kardashevskiy @ 2014-03-13 23:19 UTC (permalink / raw)
  To: Andreas Färber; +Cc: qemu-ppc, qemu-devel, Alexander Graf

On 03/14/2014 05:50 AM, Andreas Färber wrote:
> Am 13.03.2014 19:04, schrieb Mike Day:
>> On 20/11/13 16:39 +1100, Alexey Kardashevskiy wrote:
>>> This adds a put_tce() callback to the SPAPR TCE TABLE device class.
>>> The new callback allows to have different IOMMU types such as upcoming
>>> VFIO IOMMU and it will be used more by the upcoming Multi-TCE support.
>>>
>>> This reworks the H_PUT_TCE handler to make use of the new put_tce()
>>> callback.
>>>
>>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>> Reviewed-by: Mike Day <ncmike@ncultra.org>
> 
> Looks reasonable, but not needed for 2.0 unless a second implementation
> comes up.

Thanks! What is now? It goes to your ppc-next? Or Alex's ppc-next? I am
confused with recent activity in PPC field :)


> Reviewed-by: Andreas Färber <afaerber@suse.de>



-- 
Alexey

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

* Re: [Qemu-devel] spapr-iommu: extend SPAPR_TCE_TABLE class
  2014-03-13 23:19     ` Alexey Kardashevskiy
@ 2014-03-13 23:59       ` Alexander Graf
  0 siblings, 0 replies; 8+ messages in thread
From: Alexander Graf @ 2014-03-13 23:59 UTC (permalink / raw)
  To: Alexey Kardashevskiy
  Cc: qemu-ppc@nongnu.org, Andreas Färber, qemu-devel@nongnu.org



> Am 14.03.2014 um 07:19 schrieb Alexey Kardashevskiy <aik@ozlabs.ru>:
> 
>> On 03/14/2014 05:50 AM, Andreas Färber wrote:
>> Am 13.03.2014 19:04, schrieb Mike Day:
>>> On 20/11/13 16:39 +1100, Alexey Kardashevskiy wrote:
>>>> This adds a put_tce() callback to the SPAPR TCE TABLE device class.
>>>> The new callback allows to have different IOMMU types such as upcoming
>>>> VFIO IOMMU and it will be used more by the upcoming Multi-TCE support.
>>>> 
>>>> This reworks the H_PUT_TCE handler to make use of the new put_tce()
>>>> callback.
>>>> 
>>>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>>> Reviewed-by: Mike Day <ncmike@ncultra.org>
>> 
>> Looks reasonable, but not needed for 2.0 unless a second implementation
>> comes up.
> 
> Thanks! What is now? It goes to your ppc-next? Or Alex's ppc-next? I am
> confused with recent activity in PPC field :)

I am currently on vacation and Andreas has fortunately offered to help out with collecting bug fixes for the 2.0 release. We are in the stabilization phase for 2.0 right now, so from now on until the release there should only be bug fixes landing in the tree :).

I'll pick up everything that was left behind (features, refactorings, etc) after the 2.0 release ;).

Greetings from Malaysia,

Alex

> 
> 
>> Reviewed-by: Andreas Färber <afaerber@suse.de>
> 
> 
> 
> -- 
> Alexey

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

end of thread, other threads:[~2014-03-14  0:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-20  5:39 [Qemu-devel] [PATCH] spapr-iommu: extend SPAPR_TCE_TABLE class Alexey Kardashevskiy
2013-12-05  9:39 ` Alexey Kardashevskiy
2013-12-20  2:47   ` Alexey Kardashevskiy
2014-03-12  3:54     ` Alexey Kardashevskiy
2014-03-13 18:04 ` [Qemu-devel] " Mike Day
2014-03-13 18:50   ` Andreas Färber
2014-03-13 23:19     ` Alexey Kardashevskiy
2014-03-13 23:59       ` Alexander Graf

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