Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1255586lqp; Sun, 14 Apr 2024 23:55:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWmw7YETr70WbZQfb6DQ1eNGC4R1ScWWPLJvOm4hoLIhgkafaLErxBjkRwdQRvWhHf7woLy7AHzPlRhDTCMMBrmijSIHK8U8FH2D3E7KA== X-Google-Smtp-Source: AGHT+IGzJ3UekT0+D/c8B91RY/U8HKo/YLGyHEZv4WcBud/RRzrF1/BbaAwcaF31yCEyjwIrFDH+ X-Received: by 2002:a05:620a:12ce:b0:78d:68fa:6e41 with SMTP id e14-20020a05620a12ce00b0078d68fa6e41mr9892771qkl.64.1713164130266; Sun, 14 Apr 2024 23:55:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713164130; cv=pass; d=google.com; s=arc-20160816; b=qoH4U53mI3gN8GWBrbZgjpRunvHfQARMbHsq++rNqyIiNd43VegNeo1OdZLsKQYqwy klLAU7r5VQu/mYGjrHaJmpvXyTPpgwrVemZiMpqck27Mvpfr1uTO6dtIlnLoVU6fT6nu 7HTeluIppu6ETJY70w5vWPPI7bWClK29GFkOwqAP5Y8Atx27tdHJsQiw2FUadR7ZjFRF WXen+FEipoXqkDOSJWsMCaGdVR+pGwWn583Zs9VPC9cthudSIiGB3aF4Y2Vdp8a724Ez 66Qw+ldOh6pQhhJ5SOLYOSuUnyYpTjMhzJz49Z2YMOOcUM32Aq/ilI+rfhAQpth3p3di 2S2Q== 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=ACDzcgbaNdVZh5rYGX5uvjuD7vJOIVWNQkRf+hZhqPI=; b=V2IAPJQqAs12oSX1exwRFmRZNwL0G2YrPNwvxguQW94G+XK2vKwHQSUd/9h5BLyDEO F/gK6TnGtOziyN40qyd6uyMRR7mNPok2qONbcm8n46D4juzFqbdWtGZgIlWQJBW4vPcM Z1d5QUbFHAo/8yOj9cLosGmQoPovSYQ/O5XM4PRw7HbODVIO38stptHVfUmfRH1gyRPX 5LirpvmgpOhl7QY2+/v8EAMgThYaCGmg0GD0tNgkj2yHUHUUX+yQVHwf0AeSHU2aagRN RQkIdpDXD6ZqudbSZxQ0u7GadFF0ULI+p58w8yp6IbE3zm5x9IiTbdNpvLRqIWRQjmEq 08uw==; 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-144618-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144618-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f6-20020a05620a12e600b0078d52a3bf77si9275572qkl.162.2024.04.14.23.55.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Apr 2024 23:55:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-144618-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; 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-144618-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144618-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id F3E771C2211C for ; Mon, 15 Apr 2024 06:55:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 858352C6BD; Mon, 15 Apr 2024 06:54:34 +0000 (UTC) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (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 356612C6B9 for ; Mon, 15 Apr 2024 06:54:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713164074; cv=none; b=QV33oVt5vfhihp5sprl5mtIZwD81j0Qp/yRC2i82WQJIYd9mVcMvKBj3Q7Ty6tyafX8TQzwaRcD0CwULcJAu3nKGMRrStG3wUo6vLeUz3FtLrpeRNI8JW9fsH+H3Lj47wtcEdmmldVXzLAbpnmyw343oThU7jOlcr+Ie71VE6Ac= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713164074; 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=nki7dm3OIjYJbKEYiE30375dTObMSV/+hv7lRqjsF+7KOtSadqXUUiMuIe1w9cSeYaAp4Y0rY0VNb7LLqtRdjB8oFtsW+HQqbrxdcGIFhqSkuPUohngIw4eABUpJn/VuYBN07HK8cLits6BYLqs+7KGisOVcAIno+ktlju14RZE= 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.191 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.163.17]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4VHyYs4Yy4z1GGdb; Mon, 15 Apr 2024 14:53:37 +0800 (CST) Received: from kwepemd200013.china.huawei.com (unknown [7.221.188.133]) by mail.maildlp.com (Postfix) with ESMTPS id F0E6D1A0172; Mon, 15 Apr 2024 14:54:28 +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; Mon, 15 Apr 2024 14:54:27 +0800 From: Liao Chang To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , Subject: [PATCH v3 7/8] irqchip/gic-v3: Improve the maintainability of NMI masking in GIC driver Date: Mon, 15 Apr 2024 06:47:57 +0000 Message-ID: <20240415064758.3250209-8-liaochang1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240415064758.3250209-1-liaochang1@huawei.com> References: <20240415064758.3250209-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: dggems701-chm.china.huawei.com (10.3.19.178) 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