Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp354461lqh; Tue, 7 May 2024 00:41:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXMP8SxUzYB9eQ6PAxAVaCVuHa3VcSiI3RMRygj69827iknyxqBT8cUvYFtb5fzDS/YicFzxZGoYoXGOMHoFCJtz16V87rpsk5hYxwRtQ== X-Google-Smtp-Source: AGHT+IEYEfvc+ODxvVK07YFw34jQH68mf9RESYqHlydKqXmGUaP6p7OMjmsZfD+aTq8+RMkAvwiA X-Received: by 2002:a17:902:680d:b0:1e7:b6f4:2d77 with SMTP id h13-20020a170902680d00b001e7b6f42d77mr2347706plk.22.1715067691169; Tue, 07 May 2024 00:41:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715067691; cv=pass; d=google.com; s=arc-20160816; b=EW13mRcVyn6n+8mmC9hB62PwWiYxWJMatBB98OvcvmwpZKi+sxDwKK7Bv1vVtAQlyq TW1ppu3otrVMT0j7+plazG32ydUxpEW5d2o55BdiLaY4GJqlPUKV3CK4NE06b6TXnYhM NPN/SgV+mgG+kbmnWGkIaTMR6bTEfIr1xSBwncvJDE8OqbAYWHiGx8A6IKslBoy98oU8 nLPNJB3wkabp1o54pvYJ4KGZi7Ota3h4zfqPlnj8FJuTd0J7ByHOR59CDwRrdipDE7Sl WasHqImdGYelMtNNSzHOlIGMAmXpyZe/y/+hOG/Foz7iHE/u6ztkzep5Cc6OA/iQKpKm F0uA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id; bh=+UkC8fCo5LF6PLBvOuO5YsXSZ9aRoIWaz3WAF/bo9tQ=; fh=m2yLxQ3Scgidq6j0GnIc+hNjCnGobWlQd/aReu71AdQ=; b=GbkQT01kDO82j8BT7LNUO5m+x3Ol7df2FwowL4CyQSjWW3WWy+2zGHoBjirJsjkrn4 Z1V17XAR05wEYBosvztUMhaEwJmi2v+KSI6d/06yia2b69ThN84UhEQnn/cFEWvJldhC 6inmCdCC56//j6Au37FmjSCZxqw3RB78Hx7NpQThZ2CabE4Dw9UHjDpDLCIFRK6DAhp4 HXfInubkYl8tx7z5UZeF6+GuHDTdKRcsQrgTeKz6QfGFq/EUvxuLp706Sz3d8tCIhpPb SvM/RPu6r9Ao7fOEh92mq0s7HKmZTsO21+VflL8wc9bC3OCvce3U5cy6CF+4GOgUXkfc QZAw==; 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-170823-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170823-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id lv11-20020a1709032a8b00b001edaffdfff3si5525263plb.653.2024.05.07.00.41.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 00:41:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170823-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; 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-170823-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170823-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 11B35281A84 for ; Tue, 7 May 2024 07:41:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5769813BC39; Tue, 7 May 2024 07:41:25 +0000 (UTC) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) (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 CCEFDA59 for ; Tue, 7 May 2024 07:41:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715067684; cv=none; b=kdzjJsc6hEVK9xHe8cjYWkKHaUL7rG9ZJ6/gXR/r6X539LsSvL8L9J6K/W7J4hMbZcYYfdw+840XTY63rVjoCWquRV6e2pLVM17gDnEj8N5I6cdkUsNf4naTWN8bgzHTJosiDjIBL55bHtTPzR7WBXbeg2H9PvjsFDlF+8tdLW4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715067684; c=relaxed/simple; bh=s0uYKH7sT3FXzkClZdG3yO71HRP6nYGiBJTJ1UnI0KY=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=W/nuxKVogSpQANeu4Gc6mA2LYznMsmzxuUKYKz2vBRddIHk48EaHVs+v3VFimsgWIOnhJdwxc7ejsi/JX3hBzRwqP0kWu4ewMtuHgxqbOS54i/7CMLEmSDgXvNrj4KN6WitXlXIkdn96OcaLywc3D+1rXcHIc5tlZ7nXQlRtwEs= 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.189 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.194]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4VYVWR58SCzNw23; Tue, 7 May 2024 15:38:27 +0800 (CST) Received: from kwepemd200013.china.huawei.com (unknown [7.221.188.133]) by mail.maildlp.com (Postfix) with ESMTPS id 343651403D2; Tue, 7 May 2024 15:41:13 +0800 (CST) Received: from [10.67.110.108] (10.67.110.108) 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, 7 May 2024 15:41:09 +0800 Message-ID: Date: Tue, 7 May 2024 15:41:08 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Subject: Re: [PATCH v3 1/8] arm64/sysreg: Add definitions for immediate versions of MSR ALLINT To: Mark Brown , Mark Rutland CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , References: <20240415064758.3250209-1-liaochang1@huawei.com> <20240415064758.3250209-2-liaochang1@huawei.com> From: "Liao, Chang" In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemd200013.china.huawei.com (7.221.188.133) Hi, Mark. 在 2024/5/6 23:15, Mark Brown 写道: > On Fri, May 03, 2024 at 05:00:49PM +0100, Mark Rutland wrote: >> On Mon, Apr 15, 2024 at 06:47:51AM +0000, Liao Chang wrote: > >> +#define PSTATE_ALLINT pstate_field(1, 0) > >> +#define set_pstate_allint(x) asm volatile(SET_PSTATE_ALLINT(x)) > > Hrm, those helpers are not ideally discoverable, partly due to the > system register description for ALLINT not providing any references to > this being a general scheme (which is fixable there) and partly due to Based on the Arm ISA reference manual, the instruction accessing the ALLINT field of PSTATE uses the following encoding: op0 op1 CRn CRm op2 MSR ALLINT, # 0b00 0b001 0b0100 0b000x 0b000 In this encoding, the 'x' represents the LSB of #, op1 is fixed as 0b001 and op2 is fixed as 0b000. With this understanding, those helpers seem like a good approach for accessing the PSTATE.ALLINT field. I've aslo confirmed that the binary encoding generated by those helpers is same with the encoding of v3. > the use of __emit_inst() with a numeric literal - we should probably add > a comment next to the __emit_inst() saying what instruction we are > emitting Arm Architecture Reference Manual for A-profile outlines two variants for MSR instructions used to modify PSTATE fields direclty using immediate. The major difference between these variants lies in the CRm field encoding: - 4 bit immediate, examples include "MSR DAIFSET,#Imm4" and "MSR DAIFCLR,#Imm4". The CRm field in this variant uses the least 4 bits of immediate. - 1 bit immediate, currently, only "MSR ALLINT,#Imm1" uses this variant. The CRm field uses only the least 1 bit of immediate. The current implementation of the macro SET_PSTATE() defaults to the 1 bit immediate variant (!!x << PSTATE_Imm_shift). Currently, this macro is used to generate instructions accessing PAN, UAO, SSBS, TCO and DIT which require 1 bit immediate variant, hence I would say it also work for ALLINT as well. Thanks. -- BR Liao, Chang