diff mbox

[RFC,19/26] ppc/xive: introduce a helper to map the XIVE memory regions

Message ID 1499274819-15607-20-git-send-email-clg@kaod.org
State New
Headers show

Commit Message

Cédric Le Goater July 5, 2017, 5:13 p.m. UTC
It will be used when the guest chooses the XIVE exploitation mode in
CAS.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/intc/xive.c        | 11 +++++++++++
 include/hw/ppc/xive.h |  2 ++
 2 files changed, 13 insertions(+)

Comments

Alexey Kardashevskiy July 25, 2017, 2:54 a.m. UTC | #1
On 06/07/17 03:13, Cédric Le Goater wrote:
> It will be used when the guest chooses the XIVE exploitation mode in
> CAS.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>  hw/intc/xive.c        | 11 +++++++++++
>  include/hw/ppc/xive.h |  2 ++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/hw/intc/xive.c b/hw/intc/xive.c
> index cda1fa18e44d..895dd2b2f61b 100644
> --- a/hw/intc/xive.c
> +++ b/hw/intc/xive.c
> @@ -915,3 +915,14 @@ bool xive_eq_for_target(XIVE *x, uint32_t target, uint8_t priority,
>  
>      return true;
>  }
> +
> +void xive_mmio_map(XIVE *x)
> +{
> +    /* ESBs */
> +    sysbus_mmio_map(SYS_BUS_DEVICE(x), 0, x->vc_base);
> +
> +    /* Thread Management Interrupt Areas */
> +    /* TODO: Only map the OS TIMA for the moment. Mapping the whole
> +     * region needs some rework in the handlers */
> +    sysbus_mmio_map(SYS_BUS_DEVICE(x), 1, x->tm_base + (1 << x->tm_shift));
> +}


imho it makes more sense to squash such small patches (this one and 20/26,
21/26) into those which actually make use of the new helpers - easier to
review, better for bisectability.


> diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h
> index 288116aeb8f4..560f6ab66f73 100644
> --- a/include/hw/ppc/xive.h
> +++ b/include/hw/ppc/xive.h
> @@ -68,4 +68,6 @@ typedef struct sPAPRMachineState sPAPRMachineState;
>  void xive_spapr_init(sPAPRMachineState *spapr);
>  void xive_spapr_populate(XIVE *x, void *fdt);
>  
> +void xive_mmio_map(XIVE *x);
> +
>  #endif /* PPC_XIVE_H */
>
Cédric Le Goater July 25, 2017, 9:18 a.m. UTC | #2
On 07/25/2017 04:54 AM, Alexey Kardashevskiy wrote:
> On 06/07/17 03:13, Cédric Le Goater wrote:
>> It will be used when the guest chooses the XIVE exploitation mode in
>> CAS.
>>
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>> ---
>>  hw/intc/xive.c        | 11 +++++++++++
>>  include/hw/ppc/xive.h |  2 ++
>>  2 files changed, 13 insertions(+)
>>
>> diff --git a/hw/intc/xive.c b/hw/intc/xive.c
>> index cda1fa18e44d..895dd2b2f61b 100644
>> --- a/hw/intc/xive.c
>> +++ b/hw/intc/xive.c
>> @@ -915,3 +915,14 @@ bool xive_eq_for_target(XIVE *x, uint32_t target, uint8_t priority,
>>  
>>      return true;
>>  }
>> +
>> +void xive_mmio_map(XIVE *x)
>> +{
>> +    /* ESBs */
>> +    sysbus_mmio_map(SYS_BUS_DEVICE(x), 0, x->vc_base);
>> +
>> +    /* Thread Management Interrupt Areas */
>> +    /* TODO: Only map the OS TIMA for the moment. Mapping the whole
>> +     * region needs some rework in the handlers */
>> +    sysbus_mmio_map(SYS_BUS_DEVICE(x), 1, x->tm_base + (1 << x->tm_shift));
>> +}
> 
> 
> imho it makes more sense to squash such small patches (this one and 20/26,
> 21/26) into those which actually make use of the new helpers - easier to
> review, better for bisectability.

ok. I am also realizing we should unmap.

Thanks,

C.
 
> 
>> diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h
>> index 288116aeb8f4..560f6ab66f73 100644
>> --- a/include/hw/ppc/xive.h
>> +++ b/include/hw/ppc/xive.h
>> @@ -68,4 +68,6 @@ typedef struct sPAPRMachineState sPAPRMachineState;
>>  void xive_spapr_init(sPAPRMachineState *spapr);
>>  void xive_spapr_populate(XIVE *x, void *fdt);
>>  
>> +void xive_mmio_map(XIVE *x);
>> +
>>  #endif /* PPC_XIVE_H */
>>
> 
>
Alexey Kardashevskiy July 25, 2017, 2:16 p.m. UTC | #3
On 25/07/17 19:18, Cédric Le Goater wrote:
> On 07/25/2017 04:54 AM, Alexey Kardashevskiy wrote:
>> On 06/07/17 03:13, Cédric Le Goater wrote:
>>> It will be used when the guest chooses the XIVE exploitation mode in
>>> CAS.
>>>
>>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>>> ---
>>>  hw/intc/xive.c        | 11 +++++++++++
>>>  include/hw/ppc/xive.h |  2 ++
>>>  2 files changed, 13 insertions(+)
>>>
>>> diff --git a/hw/intc/xive.c b/hw/intc/xive.c
>>> index cda1fa18e44d..895dd2b2f61b 100644
>>> --- a/hw/intc/xive.c
>>> +++ b/hw/intc/xive.c
>>> @@ -915,3 +915,14 @@ bool xive_eq_for_target(XIVE *x, uint32_t target, uint8_t priority,
>>>  
>>>      return true;
>>>  }
>>> +
>>> +void xive_mmio_map(XIVE *x)
>>> +{
>>> +    /* ESBs */
>>> +    sysbus_mmio_map(SYS_BUS_DEVICE(x), 0, x->vc_base);
>>> +
>>> +    /* Thread Management Interrupt Areas */
>>> +    /* TODO: Only map the OS TIMA for the moment. Mapping the whole
>>> +     * region needs some rework in the handlers */
>>> +    sysbus_mmio_map(SYS_BUS_DEVICE(x), 1, x->tm_base + (1 << x->tm_shift));
>>> +}
>>
>>
>> imho it makes more sense to squash such small patches (this one and 20/26,
>> 21/26) into those which actually make use of the new helpers - easier to
>> review, better for bisectability.
> 
> ok. I am also realizing we should unmap.


I could not find a helper to do unmapping for sysbus regions so I suppose
it has to be memory_region_set_enabled() or (imho better)
memory_region_set_size() which would take zero size for the XICS emulation
case.


> 
> Thanks,
> 
> C.
>  
>>
>>> diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h
>>> index 288116aeb8f4..560f6ab66f73 100644
>>> --- a/include/hw/ppc/xive.h
>>> +++ b/include/hw/ppc/xive.h
>>> @@ -68,4 +68,6 @@ typedef struct sPAPRMachineState sPAPRMachineState;
>>>  void xive_spapr_init(sPAPRMachineState *spapr);
>>>  void xive_spapr_populate(XIVE *x, void *fdt);
>>>  
>>> +void xive_mmio_map(XIVE *x);
>>> +
>>>  #endif /* PPC_XIVE_H */
>>>
>>
>>
>
diff mbox

Patch

diff --git a/hw/intc/xive.c b/hw/intc/xive.c
index cda1fa18e44d..895dd2b2f61b 100644
--- a/hw/intc/xive.c
+++ b/hw/intc/xive.c
@@ -915,3 +915,14 @@  bool xive_eq_for_target(XIVE *x, uint32_t target, uint8_t priority,
 
     return true;
 }
+
+void xive_mmio_map(XIVE *x)
+{
+    /* ESBs */
+    sysbus_mmio_map(SYS_BUS_DEVICE(x), 0, x->vc_base);
+
+    /* Thread Management Interrupt Areas */
+    /* TODO: Only map the OS TIMA for the moment. Mapping the whole
+     * region needs some rework in the handlers */
+    sysbus_mmio_map(SYS_BUS_DEVICE(x), 1, x->tm_base + (1 << x->tm_shift));
+}
diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h
index 288116aeb8f4..560f6ab66f73 100644
--- a/include/hw/ppc/xive.h
+++ b/include/hw/ppc/xive.h
@@ -68,4 +68,6 @@  typedef struct sPAPRMachineState sPAPRMachineState;
 void xive_spapr_init(sPAPRMachineState *spapr);
 void xive_spapr_populate(XIVE *x, void *fdt);
 
+void xive_mmio_map(XIVE *x);
+
 #endif /* PPC_XIVE_H */