From nobody Mon Feb 9 01:50:53 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1544726085465171.37769591612573; Thu, 13 Dec 2018 10:34:45 -0800 (PST) Received: from localhost ([::1]:54170 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXVok-0007cP-79 for importer@patchew.org; Thu, 13 Dec 2018 13:34:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXVn7-0006P6-P3 for qemu-devel@nongnu.org; Thu, 13 Dec 2018 13:32:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXVn3-0004SF-Hd for qemu-devel@nongnu.org; Thu, 13 Dec 2018 13:32:57 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:51474) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXVn3-0004RT-9F for qemu-devel@nongnu.org; Thu, 13 Dec 2018 13:32:53 -0500 Received: by mail-wm1-x342.google.com with SMTP id s14so3375558wmh.1 for ; Thu, 13 Dec 2018 10:32:53 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id o81sm3598793wmd.10.2018.12.13.10.32.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 13 Dec 2018 10:32:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hni1dgj4pTAWsllfITNlVcrBwvetiRiaVm6vUrQJEtU=; b=VZR7ZdU31yNihsMAPM57x19r1Tym/Zsf6D+j6H6+LZi+mNuGo3nx5kWFKod4EvzPIx sAVgxpelWgmZRcpxuXgsZS5kaRifZjrtL+ickVCqBpB0fXkLgSAsMvNdylQIrL0OmUyO 8kQmt8zY2uz1gH6jfiLWR64c0EM6kHWvv6nv0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hni1dgj4pTAWsllfITNlVcrBwvetiRiaVm6vUrQJEtU=; b=Otpj1QdFE1IbJagPcRXyTjsa6F1Z0lufKJIGJLV/Nch9gGCm/x2TThIKyAsNW33a16 u/IaND5hyUQ91rGHfI58FcQIzrYgqac6iQzy2FbBLaL1K9mt8pduzvJdM+CT4AQNyB0T 8DaDsVZLsFCd5/ulpmVpSUDDNujVI1pNu5mBc9CfOmDLQd6cknmmP8Kx54FVong+0pJy KZ813VTPI4reLYpKqvw7eYrwGiYYX33g3jXb5f2REBoEzBm6JHk+Vkt86Sg1EH3iQeGC Y1d4GbezGfyj/UMAUPsFg41iHG0Lo3bjtMNDDfuQrI8faRC8INvRBc1iD38PtJPF/1wL i/Mg== X-Gm-Message-State: AA+aEWbtNvU29RNd0MtYFC1CiY7vnvu+X/wSzpfMl66z7xO9RILvZhys klySL3dSi4J5kVpl9LjsRBPBdg== X-Google-Smtp-Source: AFSGD/XaKbyJEPDijeV1Dlbpd/PDVrdWSb1El3wRbsuGRlIArfcAuadR0R599VYA1NPH+bCZbobYng== X-Received: by 2002:a1c:2b01:: with SMTP id r1mr459542wmr.7.1544725972256; Thu, 13 Dec 2018 10:32:52 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Date: Thu, 13 Dec 2018 18:32:49 +0000 Message-Id: <20181213183249.3468-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PATCH] hw/misc/tz-mpc: Fix value of BLK_MAX register X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: patches@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" In the TZ Memory Protection Controller, the BLK_MAX register is supposed to return the maximum permitted value of the BLK_IDX register. Our implementation incorrectly returned max+1 (ie the total number of valid index values, since BLK_IDX is zero-based). Correct this off-by-one error. Since we consistently initialize and use s->blk_max throughout the implementation as the 'size' of the LUT, just adjust the value we return when the guest reads the BLK_MAX register, rather than trying to change the semantics of the s->blk_max internal struct field. Fixes: https://bugs.launchpad.net/qemu/+bug/1806824 Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- hw/misc/tz-mpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/misc/tz-mpc.c b/hw/misc/tz-mpc.c index e0c58ba37ec..946147b1c02 100644 --- a/hw/misc/tz-mpc.c +++ b/hw/misc/tz-mpc.c @@ -150,7 +150,7 @@ static MemTxResult tz_mpc_reg_read(void *opaque, hwaddr= addr, r =3D s->ctrl; break; case A_BLK_MAX: - r =3D s->blk_max; + r =3D s->blk_max - 1; break; case A_BLK_CFG: /* We are never in "init in progress state", so this just indicates --=20 2.19.2