[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xen/arm: irq: Use appropriate priority for SGIs in setup_irq()


  • To: Mykola Kvach <xakep.amatop@xxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Wed, 14 Jan 2026 07:18:08 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=gmail.com smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yOlTYnTSnWsZXgfHDSS1qm5mjToMpwCQTjJRsK5HXwY=; b=uz+YQX7CtFK0fOG3PwFDznXAcmIHf5izagkUXp+r3kl23/K12yp5iBe8dcymUtzln/+lQi8ZUCSWKKPuQdA6OyPJ265QDLFvYakiUh8Yk5ogYHXmhEQZN9iCv9Wuo0MyS+rk2idPMxltJxRPUxku/QvGlc8udBCkTmFglPOCc/ubAbwFYt0tjCWh8MEeNFwiVsDV5xgrfeCk4JNJBgcLO5aRwQVIPAe/92UC5LNUS880QTeFMmVy5y6Wo1KENIntnJE0yxQVcci9IYceyk8VLH9eg4zdsZdLpFjZpye2krjgU7PQ7b+tr/wr7/pO9b4PtVXh3TSqWNlp/WjKMgMi3Q==
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yOlTYnTSnWsZXgfHDSS1qm5mjToMpwCQTjJRsK5HXwY=; b=XUWV5es3n4t2IPRwKXROnaf3NxXzITZgsmsj41Y4R7x1n4qC149RZfIr+ZbJntLC1wmIUjQYB7luPYyeJXKm0EiE6z1WuoEy5WIaR41wwBh+YLnBh2HpUvaendS9UO0pRo7i5tC+pqfafbwas07IHp7iigr4hsS4Kj8uDjzG0pnXOTSU5FC9d8bhQZidtSnl8Di6IzX+ENTsMwei9jtSBIuwfxCiuhlWsasrG96uVB6f7Pw3utyB5HFu1QVtpVmVoR4/MukKrD8wKmZ6FVhGsCxe6Pr6lgAucAuXOA6v36t6N7u12gplpvPu1u2mWvckIIO7Ygbq+lW3qxcJjXF6CA==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=Ct3dXnM4L90laIjQrP6wQ2mmOtS5T6Kiokdu8dMHBhIP9qodiGXpKJd9k8nBTBZTzJrK9Q4dCTUezZURqKBHoz40JfUW47ggwZkufW13Ksv68cTXojg9EOr9T2XdgnD5C7fcgdzioS2oZ+bBZtOHumOmgl5ebL1scF8Hq6399o8NCyljiZ2f22QWmugDWfxGQDwP8EAs3oJ9zBUnsBGaRHciJxA9xLI5eKCgLgsXesm4qwGHkLWrj9+IA57GzPz4p+Y5L0KEZMkt/lTpwe3G906fY9pG5/M0mpInH1tINIr6Z2Tij/IVC3fEBf/KrMhKOwCzlW+8uaor+nUZNC0Tmg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fiaXin1SAy+hIdEehbuUTnRSDp6KV+rieP6tatKIayRQ4jWXy+ZlvVkYxgvgkXMTPTMYoAiZ7bJPaaHFOEokqDsv5xWhU8S7a73mbSLuPh+7o7XIb86KbHxp8ycG2pKBvkJIS4FtwAAh763n/pOY/e24gGZsTAQnyCp6ngow/NyxtpvnWuIk59sEYV247RVM0+x2zPfGISK7nrS/y2lKSiQCyiP2TVvt8a3FT0OXYJ1NaXIeltznTQWrnOrzAe9fdyaWLjlBB94iUuyou+1sgQeXHKj2r/bcUfvDUMRkUqfNFNAgMKBkxu+i6ITUfQWZXVrjsBkcGIokgeTnSHR3Ag==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Julien Grall <julien@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Mykola Kvach <mykola_kvach@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Delivery-date: Wed, 14 Jan 2026 07:19:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Thread-index: AQHcHH4xsTo+MqBrSUGlzawFWy7VyrSQKKUAgAWFLACAeYuAgIAA5fEAgEHdygCAABXJAA==
  • Thread-topic: [PATCH] xen/arm: irq: Use appropriate priority for SGIs in setup_irq()

Hi Mykola,

> On 14 Jan 2026, at 07:00, Mykola Kvach <xakep.amatop@xxxxxxxxx> wrote:
> 
> Hi Bertrand, Julien,
> 
> First of all, please accept my apologies for the delayed response.
> 
> On Wed, Dec 3, 2025 at 10:10 AM Bertrand Marquis
> <Bertrand.Marquis@xxxxxxx> wrote:
>> 
>> Hi Julien/Mykola,
>> 
>>> On 2 Dec 2025, at 19:26, Julien Grall <julien@xxxxxxx> wrote:
>>> 
>>> Hi,
>>> 
>>> Sorry for the late answer.
>>> 
>>> On 16/09/2025 11:19, Mykola Kvach wrote:
>>>> On Sat, Sep 13, 2025 at 1:01 AM Julien Grall <julien@xxxxxxx> wrote:
>>>>>> Signed-off-by: Mykola Kvach <mykola_kvach@xxxxxxxx>
>>>>>> ---
>>>>>>  xen/arch/arm/irq.c | 8 +++++++-
>>>>>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>>>>> 
>>>>>> diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
>>>>>> index 02ca82c089..17c7ac92b5 100644
>>>>>> --- a/xen/arch/arm/irq.c
>>>>>> +++ b/xen/arch/arm/irq.c
>>>>>> @@ -397,7 +397,13 @@ int setup_irq(unsigned int irq, unsigned int 
>>>>>> irqflags, struct irqaction *new)
>>>>> AFAIK, we are not using setup_irq() to handle SGIs because they are all
>>>>> static and always enabled. Are you planning to handle dynamic SGIs? If
>>>>> yes, then can you provide more details?As far as I know, there can be at 
>>>>> least one “dynamic” SGI in Xen.
>>>> As far as I know, there is at least one “dynamic” SGI in Xen. For
>>>> example, see ffa_notif.c in the functions ffa_notif_init_interrupt
>>>> and ffa_notif_init, which handle initialization of such SGIs.
>>> 
>>> Bertrand can you comment on this? In particular, do we want the FFA SGIs to 
>>> have the priority of the internal ones?
>> 
>> The following is only an advice, definitely not a requirement. I would
>> be ok to ack the current way to do things as right now FF-A is unsupported 
>> and
>> is the only case of usage of dynamic SGI.
>> I would though require to have a log message to warn the user that SGI xx
>> has the same priority as xen internal interrupts during request_irq.
>> 
>> Here is what I think:
>> 
>> FFA SGIs can only be generated by the secure world and in practice they will
>> be generated mostly when coming coming back from the secure world (either
>> after a preemption or on a return to an smc call) but one could also be
>> generated from the secure world from another core, preempting whatever runs
>> (but same would occur when an interrupt is directly handled in the secure 
>> world).
>> 
>> Linux kernel implementation is not lowering the FF-A SGI interrupt as far as 
>> I know.
>> 
>> In my view having the FFA SGI having the same priority as ffa internal SGI 
>> would mean
>> we have some trust that the secure world will not overload us.
>> 
>> But in reality it would make sense to have a priority ordering like:
>> - Xen internal SGIs
>> - FF-A SGI (or any other dynamic SGI)
>> - any other kind of interrupt
>> 
>> So that Xen internal SGIs have the highest priority, but having other SGIs 
>> still having
>> a better priority than other interrupts.
>> 
>> In any case, whatever we do, we should keep it possible to have one specific 
>> dynamic
>> SGI at the maximum level or even at an higher level (ie lower down xen 
>> internal SGIs)
>> for specific use cases (handling hardware errors comes to mind) but this is 
>> ok to make
>> this possible only by changing xen code or when creating such a specific 
>> driver.
> 
> Thank you for the detailed feedback regarding the priority handling for
> dynamic SGIs. Based on Bertrand's suggestions, I would like to propose
> a more structured approach to interrupt priorities.
> 
> To avoid having dynamic SGIs share the exact same priority as Xen's
> internal IPIs, while still ensuring they can preempt normal interrupts,
> I propose the following hierarchy:
> 
> #define GIC_PRI_LOWEST 0xf0U
> #define GIC_PRI_IRQ 0xb0U
> #define GIC_PRI_DYNAMIC_SGI 0xa0U
> #define GIC_PRI_IPI 0x90U /* IPIs must preempt normal interrupts */
> #define GIC_PRI_HIGHEST 0x80U /* Higher priorities belong to Secure-World */
> 
> 
> Key changes:
> 1. Shift GIC_PRI_IRQ to 0xb0U: This moves standard interrupts one level
> down.
> 2. Introduce GIC_PRI_DYNAMIC_SGI at 0xa0U: This creates a dedicated
> priority level for dynamic SGIs (like FF-A).
> 
> This structure ensures that:
> - Internal Xen IPIs (0x90) remain the highest priority for the
> hypervisor.
> - Dynamic SGIs (0xa0) can preempt normal interrupts but cannot
> interfere with internal Xen signaling.
> - We stay within the safe range for Xen (starting from 0x80).
> 
> Does this approach look acceptable to you? In particular, do you see any
> concerns with shifting the default GIC_PRI_IRQ from 0xa0 to 0xb0 on ARM?

This sounds reasonable but would definitely need some extensive testing to 
validate
that we do not break existing systems based on the current scheme.

Maybe we should have command line parameters so that a system somehow dependent
on the old priority scheme could have a way to configure the priorities without 
modifying
xen code (gic_pri_irq=, gic_pri_sgi=, gic_pri_ipi= with values 0 to 8 to make 
things easier),
this would give a way to be backward compatible easily.

Regarding FF-A interrup priorities, I am not completely sure if that should or 
not have higher
priority than normal IRQs but that i could make configurable through a command 
line parameter.

> 
> If this looks good to you, I will send a v2 with these changes.

Works for me

Cheers
Bertrand




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.