Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp219011lqg; Wed, 10 Apr 2024 23:57:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW8P48vTCeSzeqGzLR5/EE/CT/EOmTsP4eLjBsSBnKCZzSIyJV2z2lsNFkKChM+A8SgBo4yv5PLREGWDWED/thqcaCUKt8F+kFnWl/aIQ== X-Google-Smtp-Source: AGHT+IG7nz3/HhGqu+0wfYYFp29ub7Xy/RnvfiFxsDdiYxRY3pHRSA14StjmOv+fJRMIkaj/kwBT X-Received: by 2002:a17:907:1ca2:b0:a51:d081:4bab with SMTP id nb34-20020a1709071ca200b00a51d0814babmr1750293ejc.21.1712818629002; Wed, 10 Apr 2024 23:57:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712818628; cv=pass; d=google.com; s=arc-20160816; b=agfpNaAlHrahMRez9+bGBOXLhB1T4XMMM3BmeqIJMTpM2UFlkN5t3sGBkpT1LoAn0a tIXep0Iv+POi/DFVJnov5lCk6sFt0e/7BwGO0LeVTTHaSFcmYqsjNQ6v0Bg2cUTf69Mq TskP8gpLCxGbIMvguhbM5qXyhtZJFKFiaNVzudegusyb/Z/GN1Q7TOtB9z3YW1DP+Xoh OIeCe2HLy/klDQ40L2EIrL7FDdwU1LXKqbMFpBXVDUwaazaCngr0QYp22x7i3r5G0JUt k19+OYvaSzU8uYbDhe0OJZCoi/JZX3QMXdZqdjrvwDLkAIiUBWDB7abUT1W6rpOSgjcy Tfrg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=7u+D+dZZ76jD6exXcFiPUJi2n0c3ZnlbKevJlAmOa7M=; fh=YdO+N/xgHGUZo91bKIWUSgUg8Z1p+7IAoQc3PdTUf0o=; b=aYcSlmbgoXOVV2It5YxoLZCyCJACT1LNPkleKgGAUFYMtq5sIKI9JygTCWfS3ZqdsJ biBK0qpLEvmMW42BR/WbLzTg0K0eb/lQk6eopnZWaf8q5T6AkP5OjaTsUZVSgYZ1+9wl voAC1xozu07dkgwaCDXFmFN3dXqilCIZ5tbfj7a6+Se6YubZPslpri5ZuGGPKkoawbzk Z7FHk29Pi6fUKcKeRhMAU05WkNx4uOGs0twIqWW4xWKKUi5WPjO/O4lxoq3GaM4AEqzp MeoRCXM3OXf8L/KM91pKvJZZuGaShNVreombq+wuJgdeIs1/CkhscPVI2ogeSsfSfdgi Ganw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-139896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139896-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id u19-20020a170906069300b00a46ee0ca85bsi469155ejb.525.2024.04.10.23.57.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 23:57:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-139896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139896-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id AAAB11F21F95 for ; Thu, 11 Apr 2024 06:57:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DA25E13F44E; Thu, 11 Apr 2024 06:55:29 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 155E513E8BE for ; Thu, 11 Apr 2024 06:55:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712818529; cv=none; b=Ltk+qR4U5WJ0jQcbg9M3r9cv/5bs+5AsSeaFbLq75lYXVyr1ZgF253ow45NiNNssSepy8jEPgmzsc2Tp6m9khgMrdz384+oiRxb5deqpOcLBgucE+zMqMdezNLNDUkW9bqpTzFQLISCoJLIyoZR18Ugbsp5ZO0M2d/l1EibtVYY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712818529; c=relaxed/simple; bh=MuHFOgP+VINNMeVH16+DixeNsqv/i9paZgGXoPbFS4c=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VQNPnywZwxAv1JQkt9zn1j77U7eCLUWCX/ees2/vpiqBRe0aYyL+uBIYBJUm4vO85Sbc85y3J48zHPmisqOBg8Eb+rmjISh335q0ULlcfKEoZEHwdWbm+lAJ7nMOsd98Rh9dvb01ju+N9rTzJ9gBpa/GRh3OY/QReCfBZGJG48M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4VFVl84jfVz1yn2R; Thu, 11 Apr 2024 14:53:08 +0800 (CST) Received: from kwepemd200013.china.huawei.com (unknown [7.221.188.133]) by mail.maildlp.com (Postfix) with ESMTPS id 3B58B140156; Thu, 11 Apr 2024 14:55:25 +0800 (CST) Received: from huawei.com (10.67.174.28) by kwepemd200013.china.huawei.com (7.221.188.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Thu, 11 Apr 2024 14:55:23 +0800 From: Liao Chang To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , Subject: [PATCH v2 9/9] irqchip/gic-v3: Improve the maintainability of NMI masking in GIC driver Date: Thu, 11 Apr 2024 06:48:58 +0000 Message-ID: <20240411064858.3232574-10-liaochang1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240411064858.3232574-1-liaochang1@huawei.com> References: <20240411064858.3232574-1-liaochang1@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemd200013.china.huawei.com (7.221.188.133) It has a better maintainability to use the local_nmi_enable() in GIC driver to unmask NMI and keep regular IRQ and FIQ maskable, instead of writing raw value into DAIF, PMR and ALLINT directly. Signed-off-by: Liao Chang --- arch/arm64/include/asm/daifflags.h | 13 +++++++++++++ drivers/irqchip/irq-gic-v3.c | 6 ++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/daifflags.h b/arch/arm64/include/asm/daifflags.h index b831def08bb3..1196eb85aa8d 100644 --- a/arch/arm64/include/asm/daifflags.h +++ b/arch/arm64/include/asm/daifflags.h @@ -330,4 +330,17 @@ static inline void local_errnmi_enable(void) irqflags.fields.allint = 0; local_allint_restore(irqflags); } + +/* + * local_nmi_enable - Enable NMI with or without superpriority. + */ +static inline void local_nmi_enable(void) +{ + arch_irqflags_t irqflags; + + irqflags.fields.daif = read_sysreg(daif); + irqflags.fields.pmr = GIC_PRIO_IRQOFF; + irqflags.fields.allint = 0; + local_allint_restore(irqflags); +} #endif diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 6fb276504bcc..ed7d8d87768f 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "irq-gic-common.h" @@ -813,10 +814,7 @@ static void __gic_handle_irq_from_irqson(struct pt_regs *regs) nmi_exit(); } - if (gic_prio_masking_enabled()) { - gic_pmr_mask_irqs(); - gic_arch_enable_irqs(); - } + local_nmi_enable(); if (!is_nmi) __gic_handle_irq(irqnr, regs); -- 2.34.1