+17
−0
Loading
Merge Pull Request from: @liujie-248683921 This series enables the architecture and GIC support for the arm64 FEAT_NMI and FEAT_GICv3_NMI extensions in host kernels. These introduce support for a new category of interrupts in the architecture code which we can use to provide NMI like functionality, though the interrupts are in fact maskable as the name would not imply. The GIC support was done by Loreozo Pieralisi. There are two modes for using this FEAT_NMI, the one we use is the one where SCTLR_EL1.SPINTMASK is set which means that any entry to ELn causes all interrupts including those with superpriority to be masked by a new mask bit PSTATE.ALLINT on entry to ELn until the mask is explicitly removed by software. PSTATE.ALLINT can be managed by software using the new register control ALLINT.ALLINT. Independent controls are provided for this feature at each EL, usage at EL1 should not disrupt EL2 or EL3. To simplify integration we manage masking for superpriority interrupts along with our masking for DAIF, much as is done for psedo NMIs. This means that superpriority interrupts are unmasked whenever DAIF.A is unmasked. This should ensure that no additional code can be preempted when using the architected feature. The separate mask in the architected feature means that we require management of this in the assembly code as well as C code, masking DAIF is not sufficient to mask superpriority interrupts. In order to ensure that we do not have both pseudo NMIs and architected NMIs simultaneously enabled we disable the architected NMIs if pseudo NMI support is enabled in the kernel and has been requested on the command line. This avoids any potential confusion or conflict between the two mechanisms. Since pseudo NMIs require explicit enablement it seemed most sensible to trust that the user preferred them for some reason. A feature override is also provided for FEAT_NMI, allowing it to be directly disabled in case of problems. Using this feature in KVM guests will require the implementation of vGIC support which is not present in this series, this is due to my and Lorenzo's schedules not lining up perfectly and wanting to get the review of the architecture side started. The architecture code should be fine when running in guests but doesn't accomplish anything and can't be meaningfully tested without an interrupt controller. As a result the feature is not exposed to guests and we enable traps for writes to ALLINT when running guests, detecting any guests that attempt to use the feature. The vGIC support should follow soon. There is no other usage of the feature in the hypervisor. https://gitee.com/openeuler/kernel/issues/I90N2C Link:https://gitee.com/openeuler/kernel/pulls/4425 Reviewed-by:Liu Chao <liuchao173@huawei.com> Reviewed-by:
Kevin Zhu <zhukeqian1@huawei.com> Reviewed-by:
Zhang Jianhua <chris.zjh@huawei.com> Signed-off-by:
Zheng Zengkai <zhengzengkai@huawei.com>