首页 > 其他分享 >ARM64 el1_irq 处理

ARM64 el1_irq 处理

时间:2023-06-01 10:34:45浏览次数:33  
标签:handle irqnr irq sp gic ARM64 el1 stack


 


.align 6
el1_irq:
 kernel_entry 1
 msr daifclr, #1    //enable fiq
 enable_dbg_if_not_stepping x0
#ifdef CONFIG_TRACE_IRQFLAGS
 bl trace_hardirqs_off
#endif
#ifdef CONFIG_PREEMPT
 get_thread_info tsk
 ldr w24, [tsk, #TI_PREEMPT]  // get preempt count
 add w0, w24, #1   // increment it
 str w0, [tsk, #TI_PREEMPT]
#endif


 


 
irq_handler 
#ifdef CONFIG_PREEMPT
 str w24, [tsk, #TI_PREEMPT]  // restore preempt count
 cbnz w24, 1f    // preempt count != 0
 ldr x0, [tsk, #TI_FLAGS]  // get flags
 tbz x0, #TIF_NEED_RESCHED, 1f // needs rescheduling?
 bl el1_preempt
1:
#endif
 
 
 
#ifdef CONFIG_TRACE_IRQFLAGS
 bl trace_hardirqs_on
#endif
 
 
 
 kernel_exit 1
ENDPROC(el1_irq)
 
 
 
/*
 * Interrupt handling.
 */
 .macro irq_handler
 ldr_l x1, handle_arch_irq


 


相关栈处理:

.macro irq_stack_entry
 mov x19, sp   // preserve the original sp
 /*
  * Compare sp with the current thread_info, if the top
  * ~(THREAD_SIZE - 1) bits match, we are on a task stack, and
  * should switch to the irq stack.
  */
 and x25, x19, #~(THREAD_SIZE - 1)
 cmp x25, tsk
 b.ne 9998f
 this_cpu_ptr irq_stack, x25, x26
 mov x26, #IRQ_STACK_START_SP
 add x26, x25, x26
 /* switch to the irq stack */
 mov sp, x26
 /*
  * Add a dummy stack frame, this non-standard format is fixed up
  * by unwind_frame()
  */
 stp     x29, x19, [sp, #-16]!
 mov x29, sp
9998:
 .endm
 
 
 
 
 
 /*
  * x19 should be preserved between irq_stack_entry and
  * irq_stack_exit.
  */
 .macro irq_stack_exit
 mov sp, x19
 .endm

初始化处理:


kernel/irq.c
 
void __init set_handle_irq(void (*handle_irq)(struct pt_regs *))
{
 if (handle_arch_irq)
  return;
 handle_arch_irq = handle_irq;
}


需要注意的是,这里设置的handle_irq是主irq_chip下的处理函数,比如对于GIC来说,其设置是:gic_handle_irq。


 

static void __exception_irq_entry gic_handle_irq(struct pt_regs *regs)
{
 u32 irqstat, irqnr;
 struct gic_chip_data *gic = &gic_data[0];
 void __iomem *cpu_base = gic_data_cpu_base(gic);
 do {
  irqstat = readl_relaxed(cpu_base + GIC_CPU_INTACK);
  irqnr = irqstat & GICC_IAR_INT_ID_MASK;//#define GICC_IAR_INT_ID_MASK  0x3ff

上面两个操作说明,中断号是中断处理程序去读状态寄存器后得到的。

if (likely(irqnr > 15 && irqnr < 1020)) {
   if (static_key_true(&supports_deactivate))
    writel_relaxed(irqstat, cpu_base + GIC_CPU_EOI);
   handle_domain_irq(gic->domain, irqnr, regs);
   continue;
  }
(irqnr < 16) {
   writel_relaxed(irqstat, cpu_base + GIC_CPU_EOI);
   if (static_key_true(&supports_deactivate))
    writel_relaxed(irqstat, cpu_base + GIC_CPU_DEACTIVATE);
#ifdef CONFIG_SMP
   /*
    * Ensure any shared data written by the CPU sending
    * the IPI is read after we've read the ACK register
    * on the GIC.
    *
    * Pairs with the write barrier in gic_raise_softirq
    */
   smp_rmb();
   handle_IPI(irqnr, regs);
#endif
   continue;
  }
  break;
 } while (1);

}


 

标签:handle,irqnr,irq,sp,gic,ARM64,el1,stack
From: https://blog.51cto.com/u_11860992/6392713

相关文章

  • ltp(六) IRQ之irqbalance01.c源码分析
    前言      本篇文章主要是为了对ltp内irq模块的测试用例之一的irqbalance进行源码分析,作为对内核中断子系统测试项之一,其蕴含的技术知识,还是很值得学习一下的。     irqbalance是什么?项目主页上有以下描述:Irqbalanceisadaemontohelpbalancethecpuload......
  • deepin-for-arm64支持
    arm64架构支持v23仓库已经支持arm64和amd64架构软件包,arm64架构的基础环境已经具备,现在就差镜像制作工具的支持了,镜像构建工具的目标是构建出标准pc镜像。为此我借来一台紫光飞腾D2000机器进行arm64的适配工作,这台机器有相对标准的UEFI固件,目前已经支持UEFI安装,镜像地址: https......
  • Windows 11 22H2 中文版、英文版 (x64、ARM64) 下载 (updated May 2023)
    Windows11,version22H2,2023年5月更新请访问原文链接:https://sysin.org/blog/windows-11/,查看最新版。原创作品,转载请保留出处。作者主页:sysin.org全新推出Windows11全新Windows体验,让您与热爱的人和事物离得更近。获得全新视角Windows11提供一个让人平静而富......
  • ARM64启动汇编和内存初始化(上)
    文章代码分析基于linux-5.19.13,架构基于aarch64(ARM64)。涉及页表代码分析部分:(1)假设页表映射层级是4,即配置CONFIG_ARM64_PGTABLE_LEVELS=4;(2)虚拟地址宽度是48,即配置CONFIG_ARM64_VA_BITS=48;(3)物理地址宽度是48,即配置CONFIG_ARM64_PA_BITS=48;1.入口分析1.1链接脚本arch/a......
  • irq中断相关(2023.5.22)
    //irq29:nobodycared(trybootingwiththe"irqpoll"option) //aer_irqthreaded   aer_isrDIsablingIRQ#105 https://blog.csdn.net/Guet_Kite/article/details/106689126note_interrupt(){if(unlikely(desc->irqs_unhandled>99900)){ ......
  • 在.net6 使用opencvsharp4 在ubuntu arm64环境下遇到的问题
    rk3399Pro嵌入式板子在.net6中使用opencvsharp开发时,在windows平台可以正常运行,在ubuntu20.6,arm64架构下运行报错:unhandledexception.system.typeinitializationexception:thetypeinitializerfor'opencvsharp.internal.nativemethods'threwanexception.%0d%0a......
  • 使用buildx在x86机器上面编译arm64架构的Docker镜像
    buildx多架构编译安装docker下载docker下载buildx安装架构支持dockerrun--privileged--rmtonistiigi/binfmt--installall创建一个自己的空间buildxcreate--use--namemybuilder检查支持的架构buildxinspectmybuilder--bootstrapNodes:Name:mybu......
  • Laravel10 Auth 多用户(管理员、用户的区分)
    参考https://learnku.com/docs/laravel/10.x/authenticationmd/14876#retrieving-the-authenticated-user环境软件/系统版本说明windows10php8.1.9-Win32-vs16-x64composer2.5.5laravel10.8.0mysql8.0.28注意如果需要使用密码功能,还需......
  • 记录一次C#在arm64的Ubuntu下安装使用selenium的过程
    手头上有一台没用的安卓手机,想着安装Ubuntu当爬虫服务器用,安卓手机root后使用delopy安装启动Ubuntu系统这些前置过程就不谈了重点谈怎么在ssh下安装使用selenium的过程首先我们安装aptitude这个软件包管理库,这个库相对于apt功能,对软件的依赖处理更加优秀,且使用方式和apt一样su......
  • Laravel10 简单使用 Auth 生成 Token 与登录并获取用户信息
    参考https://learnku.com/docs/laravel/10.x/authenticationmd/14876https://learnku.com/docs/laravel/10.x/sanctummd/14914https://learnku.com/articles/39646环境软件/系统版本说明windows10php8.2.5-nts-Win32-vs16-x64composer2.5.5larave......