Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E9996C433F5 for ; Thu, 10 Mar 2022 14:46:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UZy+PnmTlQqJjguCxgf1tfefOKyvJjTx/s1YcMnnhm0=; b=HbfRoPzmQjuQp0 STPyg96WZTg319Z2A/TdNmLTRQR6uKnajNG0iDOONsHs/iIUfhlWMuuDcfPJwWywq2PLsb00TCWDc 3GoahQ/1UZ2RtgPiKtH49K3f4GQvBOEXazz4p/43XZM+kVmtZSJQnqlLE+AYosGaiaECiRjQQrokT FcawZIk0TbY7UjcqZWbAbIjl2shcxGtuedYnCVdqDurf1NYdZW2I3IpaTlWo5X+U4VI0TX2vMd/EE xIxGlqdMJqZX/XiZgLcOwkXKVNDCZjbW3PXeCPySoNtB24Vl/PYyvittuCOQU+Vy1irs5ca+nqEpn o2/8sSl8VP6t8OGWIKDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nSK2u-00DB0a-7P; Thu, 10 Mar 2022 14:45:40 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nSK2L-00DAhw-0B for linux-arm-kernel@lists.infradead.org; Thu, 10 Mar 2022 14:45:06 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A6D95B825BA; Thu, 10 Mar 2022 14:45:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D22C5C340F5; Thu, 10 Mar 2022 14:45:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646923502; bh=c/QRjRg/RfwQM4QUDJCU9l2+mRZW/DETr9jPGJCCKNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GJ0L6EbPauPZB0q34twBFXLII9o/MMCYB5geKNxlvHpGz1LJ9iTlrs1shbEx4ZWr/ OPi1eYsghPGz0AuxM5oubIxmWrgblMeVOi6zVkocMuqVKxnIP4tMR9BvMSBxuAXljk 78VvkUs1QiqVecSnDqddt0sTse/tXOri8sgCZi1VMQABoAqvB30pXNHFMZA/5Fg7jf d9QcYsTwolaPpRM5F4hCmcakVLuksqmWSGZ3QHBSCb8xAXjHV/zwnxrxGPW/lDmJBI yrYsPrelfDBUhdC8uGKijW0N9qJ6DY7oHIxFTmOFuUpbnzXJ6a2F0PbMTTeJoOByzY GjkA4Mr+9voKw== From: Mark Brown To: Catalin Marinas , Will Deacon , Shuah Khan Cc: Joey Gouly , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Mark Brown Subject: [PATCH v1 3/4] kselftest/arm64: Refactor parameter checking in mte_switch_mode() Date: Thu, 10 Mar 2022 14:43:34 +0000 Message-Id: <20220310144335.2097457-4-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220310144335.2097457-1-broonie@kernel.org> References: <20220310144335.2097457-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1416; h=from:subject; bh=c/QRjRg/RfwQM4QUDJCU9l2+mRZW/DETr9jPGJCCKNs=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBiKg6UYO4Htw/wuc9XIZMUYMqZqBKEuEUSqdMjqtv3 2RBeeHWJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYioOlAAKCRAk1otyXVSH0At8CA CGZMB/JMIYdKaUu3+UDmuyL/istCbmwuTNUd3Jsm0BZDkCJNDxSyRPD6TBaLjIfcOBJFn6z1m/htaA RwqnXQS6gtul5J6Idy3yFrAvupx9QfPxFik8po7AFekE6RV3xyimSqST3yoxbx74Sz/3q55GvYXvlJ BlYQtQHJsbI41jNonuxaJyK4J3mWCixl0AulokASI0yhlsMKEEaSNW66jCWPdTaJKBQyLIYIFBPBiz u4ZrCf6JrSMBeCwfMy4jQKtbuX5Khbq9reKtk8NmDgwai+02vXqDSlIrQOyvhQDyWJhE/+mhf+uRcv 3dq621gY2FnTG0STAq5y/iAwo9+vGF X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220310_064505_229036_7D18F8FD X-CRM114-Status: GOOD ( 11.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Currently we just have a big if statement with a non-specific diagnostic checking both the mode and the tag. Since we'll need to dynamically check for asymmetric mode support in the system and to improve debugability split these checks out. Signed-off-by: Mark Brown --- .../testing/selftests/arm64/mte/mte_common_util.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/arm64/mte/mte_common_util.c b/tools/testing/selftests/arm64/mte/mte_common_util.c index 24b0c14203cb..9b4529ef2b29 100644 --- a/tools/testing/selftests/arm64/mte/mte_common_util.c +++ b/tools/testing/selftests/arm64/mte/mte_common_util.c @@ -271,9 +271,18 @@ int mte_switch_mode(int mte_option, unsigned long incl_mask) { unsigned long en = 0; - if (!(mte_option == MTE_SYNC_ERR || mte_option == MTE_ASYNC_ERR || - mte_option == MTE_NONE_ERR || incl_mask <= MTE_ALLOW_NON_ZERO_TAG)) { - ksft_print_msg("FAIL: Invalid mte config option\n"); + switch (mte_option) { + case MTE_NONE_ERR: + case MTE_SYNC_ERR: + case MTE_ASYNC_ERR: + break; + default: + ksft_print_msg("FAIL: Invalid MTE option %x\n", mte_option); + return -EINVAL; + } + + if (!(incl_mask <= MTE_ALLOW_NON_ZERO_TAG)) { + ksft_print_msg("FAIL: Invalid incl_mask %lx\n", incl_mask); return -EINVAL; } en = PR_TAGGED_ADDR_ENABLE; -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel