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

Re: [RFC PATCH] xen/device-tree: Experimental support for TI K3 custom interrupt properties


  • To: 정석용 <jed@xxxxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Tue, 10 Nov 2026 15:27:18 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=cyberperseus.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=quPG9Sq5MvpTcara0/p1JthR/s5Lk4XDxLq7gOIWmnI=; b=R+IF9jrqLUPnRHU6YKNR1DiT8FiHsHdNOc+grhsAEfEsyHyEmCJq7A/w87xQq88RXOWooeQ1GQgw40tdrZbcimf9hBNzs9CHGO+AYe3S7IOmomttm9PpGKBjqzktZIet3DRN8LUUVSfntDfmRmCrP3BppU6LvwOHXyApfv0doVr5adhqL/q0fFYiuOavyfBEyFK7nQRIiWPhldFVw5k9OOQWcw42tRerljeJLAmGi6BN7xsbY+rePhtBn2ltgKERu+BwJu0OFTKEaCJrp7zHwKsoHDEKZ9EfnwNcVed0vzPbmxSPQwtlkYtpV8ayAeymPxyWZyi7+vuCTA3YO3NlKA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uDJpSrQiv53PXkZQ0sHSXBLzY1tqORc1Ra2iJyVF2CJsk9NI6gZiQpM5FxbFOD+wdlWoJJeXxFGfZR6BTT1LXI+RDjMzUKNwwYdFIKRX0lni4dkot/WM5jrINGB1Ix7FJLLQY5K7ecQTLxGhyUT7WUvlLP+vmuNVu5qudUVofQbDWcj7VtBchArHkFCkK76orU6wR/JC4LEFiDUgGxTiTxtixmCmAyjbvjj8OT7PtF12Jc8a5eLdxTaDC4ygZcv+zooEQuDhJdO2ylfYF6JW3dxGYu/zawvEIRZUlTrI9vWqkbMEjthob1E7Qh4aUicTYB0M0aFeRd63Z0pAsN2qrA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Delivery-date: Tue, 10 Nov 2026 14:29:47 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 20-Oct-26 09:25, 정석용 wrote:
> Hello,
> 
> This RFC patch adds support for Texas Instruments (TI) K3 custom 
> interrupt properties ('ti,interrupt-ranges' and 'ti,intr-trigger-type') 
> in Xen's device tree parser.
> 
> On TI K3 platforms, certain devices use these custom properties instead 
> of the standard 'interrupts' property due to the TI-SCI interrupt router 
> architecture. Currently, Xen fails to parse these nodes, preventing 
> proper interrupt configuration for those devices.
> 
> To address this, the attached experimental patch extends 
> dt_number_of_irq() and dt_device_get_raw_irq() to parse 
> 'ti,interrupt-ranges' and calculate raw IRQs accordingly.
> 
> However, this implementation has several limitations and is far from ideal:
> 1. Vendor-specific properties are hardcoded into Xen's common 
>    device tree parser.
> 2. Manual index calculations and magic numbers are used rather than 
>    leveraging a proper abstraction layer.
> 
> We would greatly appreciate community feedback on the following points:
> - Is there a preferred way to handle vendor-specific interrupt 
>   bindings like this within Xen's DT framework?
> - Would it be better to refactor this logic into a separate 
>   architecture-specific or controller-specific layer, or is there 
>   an existing mechanism we missed?
> 
> Any advice, suggestions, or architectural guidance is welcome.
One way is to add a new platform like TI K3 for your boards (listing proper
compatibles) and implement a new platform hook for custom IRQ translation (e.g.
platform_irq_xlate()). AFAICT you don't need to implement other hooks like
.init, .smc, etc. because the platform functions should always check for the
hook being non-NULL. The platform gets registered provided there was a
successful compatible match. The new hook could take a dt node pointer to the
device node and to the interrupt parent (INTR in your case) and return a GIC 
SPI.

NIT: please use Xen coding style.
NIT: remember to use Signed-off-by for the submission

~Michal

> 
> Best regards,
> Jed
> 
> ---
>  xen/common/device-tree/device-tree.c | 64 ++++++++++++++++++++++++++--
>  1 file changed, 60 insertions(+), 4 deletions(-)
> 
> diff --git a/xen/common/device-tree/device-tree.c 
> b/xen/common/device-tree/device-tree.c
> index 0b5375f151..a084f03487 100644
> --- a/xen/common/device-tree/device-tree.c
> +++ b/xen/common/device-tree/device-tree.c
> @@ -1123,8 +1123,23 @@ unsigned int dt_number_of_irq(const struct 
> dt_device_node *device)
>  
>      /* Get the interrupts property */
>      intspec = dt_get_property(device, "interrupts", &intlen);
> -    if ( intspec == NULL )
> -        return 0;
> +    if ( intspec == NULL ) {
> +        int i, retintnum = 0;
> +        intspec = dt_get_property(device, "ti,interrupt-ranges", &intlen);
> +        if(intspec == NULL) {
> +            return 0;
> +        }
> +        intlen /= sizeof(*intspec);
> +        dt_dprintk(" using 'ti,interrupt-ranges' property\n");
> +
> +        for( i = 2 ; i < intlen; i+=3){
> +            retintnum += be32_to_cpu(intspec[i]);
> +        }
> +        dt_dprintk(" intspec=%d intlen=%d\n", be32_to_cpu(*intspec), 
> retintnum);
> +
> +        return retintnum;
> +    }
> +
>      intlen /= sizeof(*intspec);
>  
>      dt_dprintk(" using 'interrupts' property\n");
> @@ -1578,8 +1593,49 @@ int dt_device_get_raw_irq(const struct dt_device_node 
> *device,
>  
>      /* Get the interrupts property */
>      intspec = dt_get_property(device, "interrupts", &intlen);
> -    if ( intspec == NULL )
> -        return -EINVAL;
> +    if ( intspec == NULL ){
> +        int i = 0, newidx = 0, curmax = 0, triggertype = 4;
> +        u32 typelen;
> +
> +        intspec = dt_get_property(device, "ti,interrupt-ranges", &intlen);
> +        if(intspec == NULL) {
> +            return -EINVAL;
> +        }
> +        intlen /= sizeof(*intspec);
> +        dt_dprintk(" using 'ti,interrupt-ranges' property\n");
> +        dt_dprintk(" intspec=%d intlen=%d\n", be32_to_cpu(*intspec), intlen);
> +
> +        p = dt_irq_find_parent(device);
> +        if ( p == NULL )
> +            return -EINVAL;
> +
> +        i = 0;
> +        newidx = index;
> +        curmax = be32_to_cpu(intspec[i + 2]);
> +        while(newidx >= curmax){
> +            newidx -= curmax;
> +
> +            i += 3;
> +            curmax = be32_to_cpu(intspec[i + 2]);
> +        }
> +
> +        tmp = dt_get_property(device, "ti,intr-trigger-type", &typelen);
> +        if(tmp != NULL) {
> +            dt_dprintk(" using 'ti,intr-trigger-type' property\n");
> +            dt_dprintk(" tmp=%d typelen=%d\n", be32_to_cpu(*tmp), typelen);
> +
> +            triggertype = be32_to_cpu(*tmp);
> +        }
> +
> +        out_irq->specifier[0] = 0;
> +        out_irq->specifier[1] = be32_to_cpu(intspec[i + 1]) + newidx - 32;
> +        out_irq->specifier[2] = triggertype;
> +        out_irq->size = 3;
> +        out_irq->controller = p;
> +
> +        return 0;
> +    }
> +
>      intlen /= sizeof(*intspec);
>  
>      dt_dprintk(" using 'interrupts' property\n");




 


Rackspace

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