On 2017-09-05 10:59, Lokesh Vutla wrote:
> 
> 
> On Tuesday 05 September 2017 11:56 AM, Jan Kiszka wrote:
>> On 2017-08-30 12:34, 'Lokesh Vutla' via Jailhouse wrote:
>>> Even though 'struct sgi' already supports for passing affinity levels,
>>> gic_handle_sgir_write() looks only for target fields and triggers sgis
>>> to its respective targets. This will fail in case of armv8 with affinity
>>> routing enabled. So parse all the affinity levels in sgi before sending
>>> sgi.
>>>
>>> Suggested-by: Nikhil Devshatwar <[email protected]>
>>> Signed-off-by: Nikhil Devshatwar <[email protected]>
>>> Signed-off-by: Lokesh Vutla <[email protected]>
>>> ---
>>>  hypervisor/arch/arm-common/irqchip.c | 14 ++++++++++++--
>>>  1 file changed, 12 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/hypervisor/arch/arm-common/irqchip.c 
>>> b/hypervisor/arch/arm-common/irqchip.c
>>> index 2019342..64c081d 100644
>>> --- a/hypervisor/arch/arm-common/irqchip.c
>>> +++ b/hypervisor/arch/arm-common/irqchip.c
>>> @@ -132,6 +132,7 @@ void gic_handle_sgir_write(struct sgi *sgi, bool 
>>> virt_input)
>>>     struct per_cpu *cpu_data = this_cpu_data();
>>>     unsigned long targets = sgi->targets;
>>>     unsigned int cpu;
>>> +   u64 mpidr, clst, sgi_clst, core;
>>
>> Let's write this out: cluster.
> 
> okay.
> 
>>
>>>  
>>>     if (sgi->routing_mode == 2) {
>>>             /* Route to the caller itself */
>>> @@ -139,14 +140,23 @@ void gic_handle_sgir_write(struct sgi *sgi, bool 
>>> virt_input)
>>>             sgi->targets = (1 << cpu_data->cpu_id);
>>>     } else {
>>>             sgi->targets = 0;
>>> +           sgi_clst = (u64)sgi->aff3 << MPIDR_LEVEL_SHIFT(3) |
>>> +                           (u64)sgi->aff2 << MPIDR_LEVEL_SHIFT(2) |
>>> +                           (u64)sgi->aff1 << MPIDR_LEVEL_SHIFT(1);
>>
>> I wonder if we shouldn't refactor the sgi structure and encode the
>> cluster information in it via a single field that is encoded like mpidr.
>> That may save us from juggling with the aff1..3 fields all the time.
> 
> After think a bit, I do not see any issue replacing aff[123] with
> cluster_id and store the value as "mpidr && ~0xffUL"? Will try to make
> changes and repost the entire series.

Better use MPIDR_CPUID_MASK - it filters the right bits per architecture.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to