Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1255816lqp; Sun, 14 Apr 2024 23:56:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXSWaEKghCI+F44vz7opBNsF3TCiEbs1MAt+042synmBwobDkW7uaLRQ22ISXwDDHoa16RPXpDQe2xXknbgm9O+vc1HfWJSqRCzf2rXJg== X-Google-Smtp-Source: AGHT+IEKmKhLq0BtJdqVilxpPQsjfzA9cV8lfEh+I0s0hKjAj9c7eumu0EfX5T1mzZbd/2uB5mE5 X-Received: by 2002:a05:6358:1612:b0:181:65b4:f99c with SMTP id c18-20020a056358161200b0018165b4f99cmr15498984rwi.19.1713164185506; Sun, 14 Apr 2024 23:56:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713164185; cv=pass; d=google.com; s=arc-20160816; b=jy7J7i+K64O72Ivud3nciD2ek5eH6OTodbOzbeljC1v8K7AWhndjjFsO2vciOlmeRd QM3uQMj8n3HBwrGe+3QGZaZKgF+fhCycvwAumLEW9XqBYw+dcndGBk7NBlxhhFgZHlOI 19mC7Z33ju9xzY6QmSHGNGNeneiNK6lgvDshu/UNhv986dQJPhONAJ4X16etH9QOPoGz PzPXMcL09MBB8sCZtMv9YcA6GvfjwBn0XUz5LYoBCS7ifS78bqvDi3gJ5nr6h4aGVT10 g4R6HOykyd5yVF+f53EbmFn1/EH5bdlscGMk6s9beAkAxVf5T/AXhgPiEQjzdFeL++DE /EFA== 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=3seL72l4J3BvJLKP6h4+HTFDPhxZOQVOmf6NTpM8xIY=; fh=ACDzcgbaNdVZh5rYGX5uvjuD7vJOIVWNQkRf+hZhqPI=; b=mpniufnGcUEXj7Z4WgwfmgazXVzP10vB5Nj+cARCYw4P5pyOwHNqYLJN19aImzcHaG /HmrZtce27HSiHYvrL2dWa9zG/+NFDUoWLIAXdkOwEVLSECWYwVIbeBorpviZHJhVPvI GqiIwo/1UHj2VQf8MhUSCt+mHVLISlR1GHn/kjzCKDVR2HZbgH5lBnWLU/MAAQEMf7Ij tB10chbg0w3+Wrpfp8Hqp/A2pzVtG70VV8vaBP/WtCmYojz5DKeOFVX6E2b7HcssoAZi eoGIgr+U+FkosyFp2IjNT/zTc+Y49n+89RDwLYiXslmN599D+PqylW/YQGXF3d+5NfUU buZQ==; 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-144616-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144616-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 16-20020a631850000000b005dc491389a5si7494796pgy.812.2024.04.14.23.56.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Apr 2024 23:56:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-144616-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; 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-144616-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144616-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 66EFFB233EE for ; Mon, 15 Apr 2024 06:55:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8FF1F23776; Mon, 15 Apr 2024 06:54:28 +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 308071EEE3 for ; Mon, 15 Apr 2024 06:54:25 +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=1713164068; cv=none; b=US0KuVWrr7p1Rrrm8fPG5URbELcXltXTt0VlILDuBVKZFPDhkMuIumrPSvPNhlfO68NUKWF5QAFjYdYz/vaiXWFWtIVV/C/9+CbMRXSCzC0I3oDko0KiO17EfMsmj5ZTy9AR+9Qvclx7IKZWfOXWFz1NKWHiuT/8lDJZ2ipu5p0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713164068; c=relaxed/simple; bh=+ZAsXcduXtDFuKJ1ZouQjGGY7R92ssHvZ/okn6q7MH0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CPAtfdt0ZUu79l+9EqZHjWIMjobozGrXmXMTEvT7tKaZbBztKhoC+IBVqkFFi51ys571JIIzrtxtzpUW2e5BDyjjrQeFoXerYgqmvUQFDZQTXeKBwPl1cfJUvLL5c0dDgnkNvoLaJ97nJEobHu8aCgUnXogqLmb8YYEwTjgHQj8= 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.88.234]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4VHyYj6j39z1GHNc; Mon, 15 Apr 2024 14:53:29 +0800 (CST) Received: from kwepemd200013.china.huawei.com (unknown [7.221.188.133]) by mail.maildlp.com (Postfix) with ESMTPS id 46E0614011B; Mon, 15 Apr 2024 14:54:21 +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:19 +0800 From: Liao Chang To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , Subject: [PATCH v3 1/8] arm64/sysreg: Add definitions for immediate versions of MSR ALLINT Date: Mon, 15 Apr 2024 06:47:51 +0000 Message-ID: <20240415064758.3250209-2-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) From: Mark Brown Encodings are provided for ALLINT which allow setting of ALLINT.ALLINT using an immediate rather than requiring that a register be loaded with the value to write. Since these don't currently fit within the scheme we have for sysreg generation add manual encodings like we currently do for other similar registers such as SVCR. Since it is required that these immediate versions be encoded with xzr as the source register provide asm wrapper which ensure this is the case. Signed-off-by: Mark Brown Signed-off-by: Liao Chang --- arch/arm64/include/asm/nmi.h | 27 +++++++++++++++++++++++++++ arch/arm64/include/asm/sysreg.h | 2 ++ 2 files changed, 29 insertions(+) create mode 100644 arch/arm64/include/asm/nmi.h diff --git a/arch/arm64/include/asm/nmi.h b/arch/arm64/include/asm/nmi.h new file mode 100644 index 000000000000..0c566c649485 --- /dev/null +++ b/arch/arm64/include/asm/nmi.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2022 ARM Ltd. + */ +#ifndef __ASM_NMI_H +#define __ASM_NMI_H + +#ifndef __ASSEMBLER__ + +#include + +extern bool arm64_supports_nmi(void); + +#endif /* !__ASSEMBLER__ */ + +static __always_inline void _allint_clear(void) +{ + asm volatile(__msr_s(SYS_ALLINT_CLR, "xzr")); +} + +static __always_inline void _allint_set(void) +{ + asm volatile(__msr_s(SYS_ALLINT_SET, "xzr")); +} + +#endif + diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h index 9e8999592f3a..b105773c57ca 100644 --- a/arch/arm64/include/asm/sysreg.h +++ b/arch/arm64/include/asm/sysreg.h @@ -167,6 +167,8 @@ * System registers, organised loosely by encoding but grouped together * where the architected name contains an index. e.g. ID_MMFR_EL1. */ +#define SYS_ALLINT_CLR sys_reg(0, 1, 4, 0, 0) +#define SYS_ALLINT_SET sys_reg(0, 1, 4, 1, 0) #define SYS_SVCR_SMSTOP_SM_EL0 sys_reg(0, 3, 4, 2, 3) #define SYS_SVCR_SMSTART_SM_EL0 sys_reg(0, 3, 4, 3, 3) #define SYS_SVCR_SMSTOP_SMZA_EL0 sys_reg(0, 3, 4, 6, 3) -- 2.34.1