From patchwork Fri May 6 16:21:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570194 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp1834569mal; Fri, 6 May 2022 09:24:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAedzgXlQvc2nkwLhn1mdHouZQ8Vc2pCFMvapSjZIWGjpRr0cA9fXMMONQdfHl5c1tF5uk X-Received: by 2002:ac8:5e54:0:b0:2f1:f60d:2b3c with SMTP id i20-20020ac85e54000000b002f1f60d2b3cmr3460276qtx.667.1651854294916; Fri, 06 May 2022 09:24:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651854294; cv=none; d=google.com; s=arc-20160816; b=GMr4VkpZXskHToFmblr1xJAHXgqlJlkqQwTbHNZab/pDe0usjn4L7Ts7qaS4A86kQ5 aEPuf812OpqJJ0rwm16kpA4Ny0HM5Z/xiHL/WwyJe2Y1q/NpUWneV1gCBumqeVRdy713 78TIOpcucPoY0HrLfxnFFk3EVidO74OJwfEEdZWfxOhHJJIMMq4uSkflftdCR6BV+3ti dbaYVg3SL68p9IXgZxSQYLqSIjinDCM93VuNxLznTk5zQdyeLRw7/wgosXucbaXz2onA xlLOXcLQJSzkzlvgiTbe+HBjd4aRCEsZPTW5o3gHQxEWYqgZT85mcBpKOE8sfgmBTwCC Sl+g== 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=s5hwKzJz7oHObalRn4AoZXqvpOR58c84KtTr/3Ljs14=; b=1AaFCYjwqxIWYFM9civawWQVaYZ1FX+gB6vtP5SFf1kLneDeiXxjITliIeSOX39fg7 XW7VF/kHNYyjv+bYDWXAAM/VC1SMGihBYaqz6PD6y3qcgg+Y+NA2/gMXE8pmqTu3EzTI Co+dLemu8+lrI24ng4iqGyqgYygkLW0PV02RpB7oCWxC2OikUOcya/seDs7aJzdKCuYA yMtdKthYEro2L8ZJ/SCL8iaCwEWFpCZ4cSpWCGBK6LBmrkAVqhD98cQLzejJ+kvSenqk BCdWpVsWQaoDxXS7o/G2xkUad6wccN9DZ4/9II6jQcJzMGsqdySuTuAM7hzpGz1jOQ98 fLHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pLXF4dt1; 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 18-20020ac85652000000b002f202844accsi2140452qtt.679.2022.05.06.09.24.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 May 2022 09:24:54 -0700 (PDT) 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=pLXF4dt1; 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]:60598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nn0lC-0001Vk-Gk for patch@linaro.org; Fri, 06 May 2022 12:24:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39168) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nn0i1-0005NN-3a for qemu-devel@nongnu.org; Fri, 06 May 2022 12:21:37 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:35467) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nn0hy-00052r-PS for qemu-devel@nongnu.org; Fri, 06 May 2022 12:21:36 -0400 Received: by mail-wr1-x429.google.com with SMTP id j15so10713902wrb.2 for ; Fri, 06 May 2022 09:21:34 -0700 (PDT) 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=s5hwKzJz7oHObalRn4AoZXqvpOR58c84KtTr/3Ljs14=; b=pLXF4dt1YULS2dJNp1N6sAxWyGU+7tQPTqookMr1nTArZbRuQGq6EW0AN+WYacusDS Ts1f0Sh1jRjEZ3AfGdAsgWHJb4PzEfmSTFaSW7H+VdP8SgaiQaptuLhJ/hqs4p5UqSQw UUVBnFaNlMvGMh8y5H3+bXAOhyxsertWQI7N+uJSXOuRAfIJR2CclmeBgdN86ti8vjMa 1zZYYuceJOnYKWE77jQHld+hePRci16VFE1JnHGwACjGPqpEdV5Pxl37IwZ3tlpLpl+d 3cZwfzyNAt+fosXCQsMrxOl2UUK/VpzkUuwEcpoRVA+x7JPWjDNxviS9HQKm9kQRSEBY Kykw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s5hwKzJz7oHObalRn4AoZXqvpOR58c84KtTr/3Ljs14=; b=ufO8TZ+tN9coGagSkLt7GinvB5ExUed8wesJkd+tPa/Mpp7NeTpTiAntWCHY8P3Pz5 c6GMypj1VmqJDW0Zz2S0vtS1+1WhPlXw2qvU0hTvm50HDTIVC9gISkYiDfQdOA4y7vwK DAHdgWeVe/CYNRxDoPV+RVYytioK1IcIJ/4RbnQIzZtAvkfsmzqQiXSXnlRtg9Rk7/Gi gm+xerF+7t5lhVa3VP8Cdb6QuknU3v0N0zLGnOPChmLAJ7qxWd5Erufea5R9xD8DFJ2i zfiWie3564I2C0iTG62rbKyt1gmpI+vB/o8qq16gXXYVGrxSgra+e/Zedi1EoXTH/2SK pMqQ== X-Gm-Message-State: AOAM531oJevyWoIH3J3DV8DybiT9jn/hUKvJVoBkkF9yEpBqvvyJO2yH ljNppBjI9nI4V7H03aSdcejdlvbvgXHQ7g== X-Received: by 2002:a05:6000:1868:b0:20c:95c4:ed9a with SMTP id d8-20020a056000186800b0020c95c4ed9amr3302258wri.243.1651854093461; Fri, 06 May 2022 09:21:33 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id j2-20020a5d4482000000b0020c5253d926sm3782082wrq.114.2022.05.06.09.21.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 May 2022 09:21:33 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 2/5] hw/intc/arm_gicv3_kvm.c: Stop using GIC_MIN_BPR constant Date: Fri, 6 May 2022 17:21:26 +0100 Message-Id: <20220506162129.2896966-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220506162129.2896966-1-peter.maydell@linaro.org> References: <20220506162129.2896966-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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" The GIC_MIN_BPR constant defines the minimum BPR value that the TCG emulated GICv3 supports. We're currently using this also as the value we reset the KVM GICv3 ICC_BPR registers to, but this is only right by accident. We want to make the emulated GICv3 use a configurable number of priority bits, which means that GIC_MIN_BPR will no longer be a constant. Replace the uses in the KVM reset code with literal 0, plus a constant explaining why this is reasonable. Signed-off-by: Peter Maydell --- hw/intc/arm_gicv3_kvm.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c index 2922c516e56..3ca643ecba4 100644 --- a/hw/intc/arm_gicv3_kvm.c +++ b/hw/intc/arm_gicv3_kvm.c @@ -673,9 +673,19 @@ static void arm_gicv3_icc_reset(CPUARMState *env, const ARMCPRegInfo *ri) s = c->gic; c->icc_pmr_el1 = 0; - c->icc_bpr[GICV3_G0] = GIC_MIN_BPR; - c->icc_bpr[GICV3_G1] = GIC_MIN_BPR; - c->icc_bpr[GICV3_G1NS] = GIC_MIN_BPR; + /* + * Architecturally the reset value of the ICC_BPR registers + * is UNKNOWN. We set them all to 0 here; when the kernel + * uses these values to program the ICH_VMCR_EL2 fields that + * determine the guest-visible ICC_BPR register values, the + * hardware's "writing a value less than the minimum sets + * the field to the minimum value" behaviour will result in + * them effectively resetting to the correct minimum value + * for the host GIC. + */ + c->icc_bpr[GICV3_G0] = 0; + c->icc_bpr[GICV3_G1] = 0; + c->icc_bpr[GICV3_G1NS] = 0; c->icc_sre_el1 = 0x7; memset(c->icc_apr, 0, sizeof(c->icc_apr));