From patchwork Fri Jan 29 10:59:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 373288 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp2089683jam; Fri, 29 Jan 2021 03:03:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJytkxHtpsWgjbqqE3MVmhwesNJcc2czIP8mLoP+yN/UHSg7sYHywcR/+3U6chOho3gT5GTc X-Received: by 2002:a25:348c:: with SMTP id b134mr4647745yba.89.1611918192758; Fri, 29 Jan 2021 03:03:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611918192; cv=none; d=google.com; s=arc-20160816; b=B8qnGVpxSXwiD6sYrGIG/zqwCx7cS8Z/hiKgCP/g/NaG7apfYPEeAT7rbPU8v+ZnsI f4KCT6Kw2NJ8kBznuvPuPwSY4QVbLgpAIEOZ/T6Ko+xqqDyfuaTPo3xym+102K/m2rcc Hzc+8Zv/zo2T+Er407fSVgDN9uSLGKK824gj4Upb5UnnZotKIdLMhgAnMx4shoSPyCmR fWdxd77kVINswGBFYoOwzrAFdCXrS5aAhxwShPw2hpfHYOaHd/KhZuR4nx5LvTF0B248 NdjViE1TFx9sc0RxIveKUyj/7vlr0woP5ApT2vV2YHsXqEJcGSz6szbhjtFlfGDTr/w0 iKaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=eJCw4eHH3Spgo4adrfmSpNJj4lzDDpBeLfEpC7k+CtQ=; b=f4mT9YWnPX27uADiFrROd0aPh2ek40f6ohrbmcOS1MplfXMH1lqGXUa7v6FhTKNueo XxL7hoaSWXNo2CY/fwHfG0cSS/9ZhKHtnhWQg8emzk+W8ziQHaIYXe8QwiKE9PF1HK2u IfKRcMsmJV5hSO6SFb6Bjw737EG12B1DwgoXRNKLtLmAXv6wOYAYxnD0IwyLtjBzyBL7 CKcDccGOKgmsossx12y63ZJglOIgJ5H3Iun/zRcGRW9eNr051H5e9Ac4KXS+B3LWpxsD XwEzGPZsGhtN9g4fK7cDaZBhjQP40iwlFjH+gAMZD5m3AvgwDhckhmzOsHysZXCMznhZ w5hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=x83nVstF; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u188si9689089yba.195.2021.01.29.03.03.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Jan 2021 03:03:12 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=x83nVstF; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:38352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5RYW-0007mh-6v for patch@linaro.org; Fri, 29 Jan 2021 06:03:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RW0-0004Go-FQ for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:36 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:37386) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RVk-0006rg-3k for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:34 -0500 Received: by mail-wm1-x32a.google.com with SMTP id m1so3541710wml.2 for ; Fri, 29 Jan 2021 03:00:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=eJCw4eHH3Spgo4adrfmSpNJj4lzDDpBeLfEpC7k+CtQ=; b=x83nVstFTMr6K88yH4jY3hzVQ6OWcnbXkPSLCr/2kh6VDwZ90cea2A2EBHAye5DQ1o RUD6YVwz/530t6rTrW/4Rj8GhrKBRWT7sbfi6pJAKYPJFhE3OoZKxoUGuVEzUsGS5NLt ZSQEkIY2AsK9cYfpAeHKGyNWsy8J17uLylIUajWeE+Aw9J9bDmbvnBufsu91d6XH6d0i POTFUqKzLReNw4BztLw6SoZQuKy3ugR6ATCG3rp0TC0sndavrSu+MkAz1G1GkCOTifCs kV3ZKXafTSM9g45v8sivm1Oecaf5mixmFhdodt7l8b35P+P2AEC/trYJTzUArdvHGQDN IqRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eJCw4eHH3Spgo4adrfmSpNJj4lzDDpBeLfEpC7k+CtQ=; b=gHmaYtmH6vI+e30CBXqEK6rRN4V1zmNJDNBA32MaTwXiBj0YtXtuBC/Eex0j//gkrh +jUzlDullPn5PrW0XZ+tbZ2HwVr1LgqBeHKvitZc0P4xq3pTIaifJ5CbkE2sT+/qZLqa ARXxakQc3EwY9OwgruUwBs796RgZuWrAAaRp+46b7XB49cbW9FL9G4uqxEEjcb3yZKq0 8C8V2yh2DR+DfNHINkOhdgYN6ktzSC5y8nDcE5pu17l8n5yZ9BDPDTJK71uSR2zIZGfB tYQLv71qW4YCy5lFTzaoqmBTzzCJKM0batjEDKKY/gjx7rcV/KHJm///CZOJeaRKbk4J Ls5Q== X-Gm-Message-State: AOAM532n5TYkjEZVn/7bWPMcMVcjr8QBfGgsJvGc2zAv5p268rS2ZTa3 cxFdPX0OD3v8QHefXiyXkXv6NNIV2aioVg== X-Received: by 2002:a05:600c:354b:: with SMTP id i11mr3228660wmq.72.1611918017048; Fri, 29 Jan 2021 03:00:17 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:16 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/46] target/arm: Conditionalize DBGDIDR Date: Fri, 29 Jan 2021 10:59:28 +0000 Message-Id: <20210129110012.8660-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Only define the register if it exists for the cpu. Signed-off-by: Richard Henderson Message-id: 20210120031656.737646-1-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/helper.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) -- 2.20.1 diff --git a/target/arm/helper.c b/target/arm/helper.c index 417777d4bed..677a4aa79e7 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6567,11 +6567,21 @@ static void define_debug_regs(ARMCPU *cpu) */ int i; int wrps, brps, ctx_cmps; - ARMCPRegInfo dbgdidr = { - .name = "DBGDIDR", .cp = 14, .crn = 0, .crm = 0, .opc1 = 0, .opc2 = 0, - .access = PL0_R, .accessfn = access_tda, - .type = ARM_CP_CONST, .resetvalue = cpu->isar.dbgdidr, - }; + + /* + * The Arm ARM says DBGDIDR is optional and deprecated if EL1 cannot + * use AArch32. Given that bit 15 is RES1, if the value is 0 then + * the register must not exist for this cpu. + */ + if (cpu->isar.dbgdidr != 0) { + ARMCPRegInfo dbgdidr = { + .name = "DBGDIDR", .cp = 14, .crn = 0, .crm = 0, + .opc1 = 0, .opc2 = 0, + .access = PL0_R, .accessfn = access_tda, + .type = ARM_CP_CONST, .resetvalue = cpu->isar.dbgdidr, + }; + define_one_arm_cp_reg(cpu, &dbgdidr); + } /* Note that all these register fields hold "number of Xs minus 1". */ brps = arm_num_brps(cpu); @@ -6580,7 +6590,6 @@ static void define_debug_regs(ARMCPU *cpu) assert(ctx_cmps <= brps); - define_one_arm_cp_reg(cpu, &dbgdidr); define_arm_cp_regs(cpu, debug_cp_reginfo); if (arm_feature(&cpu->env, ARM_FEATURE_LPAE)) {