From mboxrd@z Thu Jan 1 00:00:00 1970 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 BE702C433EF for ; Wed, 23 Feb 2022 11:21:54 +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:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:Subject:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=G3MuyNZ1eQe7x/AdXLWZ1VOA32eAM2/fpIikeftSTJs=; b=DBMwAtNFiFiVx1arjd4V0TmVdA sgjGF+rydLypS8B65hQLRxSpSVv4qklf4r6nSXulJ+Rdr+OFHa3PKLkO0nUW6148TcoIL/Rjx9YBR FunPb25p0l20DGHXx8VfvjpG18zwfdhiCfg4VuhhgGi0cbmBqxF0DCuqRC6VkeV2Beol5AeFqBjo6 ae++gpEbungiMaUQpSt6SmIjJlDQZq39rDMMGxo1UxsSrjZkxuxdYl6h86JxYNJfx3klsVuRfyChH bhleyQF5+Ydbqtzeli/n9mLtOKsQeEhzTk7Sv8/bIRaLTWO0GNjcaha2Mv3755AtgqsMz3bE8UFEm gY08FyRQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMphS-00DqAv-KO; Wed, 23 Feb 2022 11:20:50 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMphO-00Dq86-0o for linux-arm-kernel@lists.infradead.org; Wed, 23 Feb 2022 11:20:47 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C83AD106F; Wed, 23 Feb 2022 03:20:42 -0800 (PST) Received: from [10.1.29.140] (e121487-lin.cambridge.arm.com [10.1.29.140]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1B9FB3F70D; Wed, 23 Feb 2022 03:20:41 -0800 (PST) Subject: Re: [PATCH v2 4/4] arm64: Add support of PAuth QARMA3 architected algorithm To: Will Deacon Cc: linux-arm-kernel@lists.infradead.org, maz@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com References: <20220131170654.62381-1-vladimir.murzin@arm.com> <20220131170654.62381-5-vladimir.murzin@arm.com> <20220215182154.GB8748@willie-the-truck> <0f0ede07-d2ac-e2e5-c2c3-65c237e60ff6@arm.com> <20220222215001.GA16710@willie-the-truck> From: Vladimir Murzin Message-ID: Date: Wed, 23 Feb 2022 11:20:40 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20220222215001.GA16710@willie-the-truck> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220223_032046_226210_52C2F50A X-CRM114-Status: GOOD ( 19.44 ) 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 On 2/22/22 9:50 PM, Will Deacon wrote: > On Mon, Feb 21, 2022 at 02:47:02PM +0000, Vladimir Murzin wrote: >> On 2/15/22 6:21 PM, Will Deacon wrote: >>> On Mon, Jan 31, 2022 at 05:06:54PM +0000, Vladimir Murzin wrote: >>>> QARMA3 is relaxed version of the QARMA5 algorithm which expected to >>>> reduce the latency of calculation while still delivering a suitable >>>> level of security. >>>> >>>> Support for QARMA3 can be discovered via ID_AA64ISAR2_EL1 >>>> >>>> APA3, bits [15:12] Indicates whether the QARMA3 algorithm is >>>> implemented in the PE for address >>>> authentication in AArch64 state. >>>> >>>> GPA3, bits [11:8] Indicates whether the QARMA3 algorithm is >>>> implemented in the PE for generic code >>>> authentication in AArch64 state. >>>> >>>> Signed-off-by: Vladimir Murzin >>>> --- > > [...] > >>>> @@ -596,6 +600,7 @@ static const struct arm64_ftr_bits ftr_raz[] = { >>>> struct arm64_ftr_override __ro_after_init id_aa64mmfr1_override; >>>> struct arm64_ftr_override __ro_after_init id_aa64pfr1_override; >>>> struct arm64_ftr_override __ro_after_init id_aa64isar1_override; >>>> +struct arm64_ftr_override __ro_after_init id_aa64isar2_override; >>>> >>>> static const struct __ftr_reg_entry { >>>> u32 sys_id; >>>> @@ -644,6 +649,8 @@ static const struct __ftr_reg_entry { >>>> ARM64_FTR_REG_OVERRIDE(SYS_ID_AA64ISAR1_EL1, ftr_id_aa64isar1, >>>> &id_aa64isar1_override), >>>> ARM64_FTR_REG(SYS_ID_AA64ISAR2_EL1, ftr_id_aa64isar2), >>>> + ARM64_FTR_REG_OVERRIDE(SYS_ID_AA64ISAR2_EL1, ftr_id_aa64isar2, >>>> + &id_aa64isar2_override), >>>> >>>> /* Op1 = 0, CRn = 0, CRm = 7 */ >>>> ARM64_FTR_REG(SYS_ID_AA64MMFR0_EL1, ftr_id_aa64mmfr0), >>>> @@ -1834,10 +1841,11 @@ static bool has_address_auth_metacap(const struct arm64_cpu_capabilities *entry, >>>> { >>>> bool api = has_address_auth_cpucap(cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_IMP_DEF], scope); >>>> bool apa = has_address_auth_cpucap(cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_ARCH_QARMA5], scope); >>>> + bool apa3 = has_address_auth_cpucap(cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_ARCH_QARMA3], scope); >>>> >>>> - WARN_ON(apa && api); >>>> + WARN_ON((apa && api) || (apa && apa3) || (api && apa3)); >>> >>> I don't really get the point in this warning, what is somebody supposed to >>> do if they hit it? The kernel isn't the right place to make assertions about >>> the CPU design. >> >> Right, there is nothing user can do other than reporting about that. It was >> inspired by the similar check in cpu_has_fwb(), yet I was under impression >> that assertion can be triggered via id regester override as well - now I see >> that invalid override is ignored. I'm fine with removing assertion as long >> as code base use assertions consistently... > > Yes, please send a version with these WARN_ON()s and I can queue it up. ^^^^^^ Sorry, Will, did you mean *without*? Do you want separate patch to remove WARN_ON from cpu_has_fwb() as well? Cheers Vladimir > > Cheers, > > Will > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel