From patchwork Mon Nov 1 04:54:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reiji Watanabe X-Patchwork-Id: 12595741 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA553C433EF for ; Mon, 1 Nov 2021 04:56:26 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 90E1760FE8 for ; Mon, 1 Nov 2021 04:56:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 90E1760FE8 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:Cc:To:From:Subject:Mime-Version: Message-Id:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=HkmlwcEZSqFttHyJHaTqCiijuXyMWhhzBTG7QFiKU38=; b=Yuz Q0fcioqi/m9/isitWcNhapaH7uc4W70uMuRwOVMv1pjCdJOd/2DD1GTHK+rn9zbXXp6U2BNMktI23 Kjy0HzumS8L8Y6Daw9AvI1cKPgE/G1QFiW8pGWjrC5z2kFWAkgRPpwxNcmnqk8IAq/FsG/MxmmEBY fvKZS3hazAWnrvZNktYjcpHj0glERLPvIiDRWqZswRkAb5rzL1khqq0JmwdMUb4xaHNVzbAubgZ+f bYz6z8UuXlIzMVPfnq6y9sStWvgqakC/LoYwXF6WSO0wkN0zxlTOpzfaUfwglR68zY4K4glmsT3/R nm2e5BqNlOJhcKzXJipJwYGJb3fcyJw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mhPLF-00FH1a-5R; Mon, 01 Nov 2021 04:54:41 +0000 Received: from mail-pj1-x1049.google.com ([2607:f8b0:4864:20::1049]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mhPLA-00FH0x-FK for linux-arm-kernel@lists.infradead.org; Mon, 01 Nov 2021 04:54:38 +0000 Received: by mail-pj1-x1049.google.com with SMTP id y22-20020a17090a6c9600b001a38db472c0so8334840pjj.7 for ; Sun, 31 Oct 2021 21:54:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=p/9PpIhO81J92KHEsvNbYIBfk1RBqXde99CirjVeHwA=; b=RL09JRj0+dN4/RgWQTJ5ncGk/A+/lv5FyUld2XcYgY9YGX5k9D8lDPzPZfKNXhDapB WB+3f7rSLCaVmG13tTrZ6Fz2p+owKCzXclwqhBKYf/fiT4aPDBrE+6FT9NQNCO62kNbL 1xzUf4rZG363FJmhfh+w7TT6mzzbhvqkPE02xJ6IVz2Wb4SGZWb8+XS2hY0eaPqiWCpQ ANAdcefYvsYZVmclpnm5UudsZHzEXDKbsVlrnBHOLsvJGvyxqe6jRvSoo8PWYb+6/bAp AdP8yAb/OzYDLNQqTR9Ac3ojF2NbQ+C9u0Ic6W2/L6z6M3VQtDKKhjJNOhwiksvh+8lr 9V6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=p/9PpIhO81J92KHEsvNbYIBfk1RBqXde99CirjVeHwA=; b=hI1lAVJ8gBj4sHLgGlrIhK83A6C56UMPsd3mwE+jgvHOdPuRVa3Bf3xLhWV46g8e0n UfSdfBbacZGgyXTwfd2YV38h1B5Qp0X0Y0bXFQyFIaFbYSwz6BgVUyiuMGdBcHo2fgF8 jSr90q6XgAakqcGaVVYQHBk8Jbo4x4p1lFh/P1oQIfz3UsoGmg8noZWWURWbgz08gufK UzU68Lmbt5/TSC4RZLI1ZQSDQ416IAWjXrOERGGRdrHlvwJ215m0sP1/WveLmbJUQdWC rx7hPMET+h1er68dixKNSrMILZSFVpBmJ3hQ0j28WO5KupZeIneNowdlQm+JS+tSWK5G tlbg== X-Gm-Message-State: AOAM5331qZOxvVVRyC8VHiYZf1sWPep1WlmyEObSuQZadb6k9q7oK0nR OqIgFAP79Q2gTJngP5mlTZGpFdV44KY= X-Google-Smtp-Source: ABdhPJxYgwllBLVtL5buUdf6uWEf62miu3EwqK4efdw3zb0mgUPGFE7nXc90+WUuC5fmTcJLtOwNm/h4/fM= X-Received: from reiji-vws-sp.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:3d59]) (user=reijiw job=sendgmr) by 2002:a17:90a:5285:: with SMTP id w5mr780281pjh.1.1635742472361; Sun, 31 Oct 2021 21:54:32 -0700 (PDT) Date: Sun, 31 Oct 2021 21:54:21 -0700 Message-Id: <20211101045421.2215822-1-reijiw@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.33.1.1089.g2158813163f-goog Subject: [PATCH] arm64: arm64_ftr_reg->name may not be a human-readable string From: Reiji Watanabe To: Catalin Marinas , Will Deacon Cc: Marc Zyngier , linux-arm-kernel@lists.infradead.org, Peter Shier , Ricardo Koller , Oliver Upton , Jing Zhang , Raghavendra Rao Anata , Reiji Watanabe X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211031_215436_579993_2B65BDAA X-CRM114-Status: GOOD ( 13.86 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The id argument of ARM64_FTR_REG_OVERRIDE() is used for two purposes: one as the system register encoding (used for the sys_id field of __ftr_reg_entry), and the other as the register name (stringified and used for the name field of arm64_ftr_reg), which is debug information. The id argument is supposed to be a macro that indicates an encoding of the register (eg. SYS_ID_AA64PFR0_EL1, etc). ARM64_FTR_REG(), which also has the same id argument, uses ARM64_FTR_REG_OVERRIDE() and passes the id to the macro. Since the id argument is completely macro-expanded before it is substituted into a macro body of ARM64_FTR_REG_OVERRIDE(), the stringified id in the body of ARM64_FTR_REG_OVERRIDE is not a human-readable register name, but a string of numeric bitwise operations. Fix this so that human-readable register names are available as debug information. Fixes: 8f266a5d878a ("arm64: cpufeature: Add global feature override facility") Signed-off-by: Reiji Watanabe Acked-by: Marc Zyngier Reviewed-by: Oliver Upton --- arch/arm64/kernel/cpufeature.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 6ec7036ef7e1..7553c98f379f 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -573,15 +573,19 @@ static const struct arm64_ftr_bits ftr_raz[] = { ARM64_FTR_END, }; -#define ARM64_FTR_REG_OVERRIDE(id, table, ovr) { \ +#define __ARM64_FTR_REG_OVERRIDE(id_str, id, table, ovr) { \ .sys_id = id, \ .reg = &(struct arm64_ftr_reg){ \ - .name = #id, \ + .name = id_str, \ .override = (ovr), \ .ftr_bits = &((table)[0]), \ }} -#define ARM64_FTR_REG(id, table) ARM64_FTR_REG_OVERRIDE(id, table, &no_override) +#define ARM64_FTR_REG_OVERRIDE(id, table, ovr) \ + __ARM64_FTR_REG_OVERRIDE(#id, id, table, ovr) + +#define ARM64_FTR_REG(id, table) \ + __ARM64_FTR_REG_OVERRIDE(#id, id, table, &no_override) struct arm64_ftr_override __ro_after_init id_aa64mmfr1_override; struct arm64_ftr_override __ro_after_init id_aa64pfr1_override;