Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1701323lqe; Mon, 8 Apr 2024 18:31:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXIWXtA4PpCYMb2dxCsAqq7I26Z+6Z2kFx/xhNF5YGEkoKPpeXdHvMufaLP+d6sX2sZgSBGNovUanOzY5S36l1rDcuQccNpM0T8CDBTcQ== X-Google-Smtp-Source: AGHT+IFDktvxZh9ES2XSVhIFY/sQbVRTNGkYJVGbP9LkDscbTQDvOcd3bcay/hR9ho9y5TIUfVwN X-Received: by 2002:a50:9b56:0:b0:56b:fd17:3522 with SMTP id a22-20020a509b56000000b0056bfd173522mr7493095edj.14.1712626313280; Mon, 08 Apr 2024 18:31:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712626313; cv=pass; d=google.com; s=arc-20160816; b=MfGljOywDlozWAUzmkECZdmugzUmENi8NCaJgy0w/+chKiFCG4vZ19USO6UB5vhhvY P74+ASQ/giI2tamy9Uxo3E3V3wVZ7D9Kyj/gU3Pn+Kb/ClgM1omQug4kqko0VNaoYYGs faYeiXYpnrpDFTGCKV2mHXXgpBweBSR3YOw5MkQCEsq75pPxaYZdV8jHvQugsxchQRk/ BwaC2YQmopZbChxqRpKkpASXpIw3KpHPNWDcQ/hw+ni7pRnwYAj1pBh609L8BLfZkj45 7t/h8/T9dSMHMRBFADS0JmQc8npLf5/EDbU9P1b3/L4aywq3mGUgpQVmyEKqRrl5j4CS Tckg== 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=RatWSVbNJ1/MmnzWWlcZp/KokkZi2YybezTbDh3X02M=; b=Kcj6Ll2Iaj4aXbF+21NPQUADxfUoiOi6DhFPTOIlqbgRHs7d9J4ILEBhH7NqLx46qL nyhUqf/OkTAHmbpb/YaoqMuag+qR/iZ6HwnLD+Fc1GID+L7nuRaBnCz7/6XwE1YglQMF /tn65JWQ0DuAg5nRnp5WxKdEGNEG2Ku5/RwmkAa5nYIuXGq+Y1M51T6Ky5X0joNp7qGy UIen8J6SUte8geyl/w2d+VqEJdKgxg21nPfWKQ37tAiddosJiYUFSuJtc8cpUQppxX/d PAgB8xyxOPJ2YWl9iIrchGfBx9VvRDrnIK5BRW3rw3RP3kudumow1sgVLYUw41dPeADj UM1Q==; 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-136086-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136086-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. [147.75.80.249]) by mx.google.com with ESMTPS id eb9-20020a0564020d0900b0056e2d0fcfefsi4388200edb.76.2024.04.08.18.31.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 18:31:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136086-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; 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-136086-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136086-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 08E001F22AAC for ; Tue, 9 Apr 2024 01:31:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB164C139; Tue, 9 Apr 2024 01:30:13 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (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 BEC4936137 for ; Tue, 9 Apr 2024 01:30:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712626213; cv=none; b=rFTj+dVPeXfGpfGkv1/vpje7zCKCDbXzRPrhHI0912AuXWN7AYeIhaODu7vwfCYw3ZV4sa1jNENRvJkXuth2y0bbdX/Ji6mobslyjQJ5m3lQ1F7pFtxUSIeBpLz+7V9kse5g3/UiB1VT1UrUvP959cx9UEfG++C4yvas9vW8vzc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712626213; 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=h7uPdADMiNOmxFoUJHkVnY06++3/fkRFJ8UU0uoXln4DrCvi5pzl0+iiI7Tk6dyQt1DO/GPQOQzp4pWw3otRk8Umq3I35QeXmUnVpzUrR7z1HaN7wjGldaSusjT+anFaHdSyZtKSm+02uwUsJ9HciJdBLqJMiLYYDyv9JjmQ9Bw= 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.187 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.174]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4VD7c04CDRzwRfS; Tue, 9 Apr 2024 09:27:12 +0800 (CST) Received: from kwepemd200013.china.huawei.com (unknown [7.221.188.133]) by mail.maildlp.com (Postfix) with ESMTPS id 0FA9F14059C; Tue, 9 Apr 2024 09:30:06 +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; Tue, 9 Apr 2024 09:30:04 +0800 From: Liao Chang To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , Subject: [PATCH 9/9] irqchip/gic-v3: Improve the maintainability of NMI masking in GIC driver Date: Tue, 9 Apr 2024 01:23:44 +0000 Message-ID: <20240409012344.3194724-10-liaochang1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240409012344.3194724-1-liaochang1@huawei.com> References: <20240409012344.3194724-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: dggems704-chm.china.huawei.com (10.3.19.181) 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