From patchwork Thu Nov 8 16:33:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 150537 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1041467ljp; Thu, 8 Nov 2018 08:40:28 -0800 (PST) X-Google-Smtp-Source: AJdET5ddQd5WFq4WRPLhRbWUmGantpapdWaI5IW05kA90gGp9Se6FG8VnrW22vpKNgHwz5Wq0GwZ X-Received: by 2002:a37:1467:: with SMTP id e100mr4943958qkh.334.1541695228448; Thu, 08 Nov 2018 08:40:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541695228; cv=none; d=google.com; s=arc-20160816; b=cpcbeW0yg33A7pfnsiRoOxlmgCkqeMb5Pd1iGuQrnfYNfKe4j6ZUmHTKEqGGg2XcTU gqkj6hJe5Q3dMlkVoiks/vrDCj4VKT6c0cV9YClb54TisSmdNgptaMOXHK732zAN+x/8 CqUchhZ5ezMPU0vmPgfvHHB0I8+iynfHVdXfY4X6ZyoiVfCNdWFlsVCGdTv6bEMsJT63 7eTVH3ibLfc7BL2GYyItWGnlo6uE9AuE1+gH5dNXr4FOhQaAv3GSnVM07KGdYiJMB21N JLiEv0CuKvjMHbAWC/AZXeUth0qvCr5Vs90xdMd2xgE3i/ivmxRUXjvtIUHumpdUPH/e nJTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=HBIUDa6WnUimRx0p1xvdF1lO0WWeLDEpan0budZbRg4=; b=p2PKvo5AlsKsOU4+kzahgSIh+S+0sxy1+XG3vVGqiUaFdPspinPyvdxF1HWXvXcIzv Cu7SrFd5SaXhshfjJNKIzlCUFCzdTygCBbgIvByXiSCe5daBut+z8kTS84WV6nCZa2zu dSjucTBByZ5ttTEz6Bdu4mItBMxXAaF3/ap6UA7yGbIoIWTI6IVD9yNQmeRvrnFJ/97I 3+vBL8FLUcMkcIDazy0aMUoJrAvejYkNBtY8drIp1QoMS3jf4dEA/EHB+1EQLbhfTGpo BbqJ5MbkMu80CKq3YlYq57HgZrBXwAMt2gRKlsTtpFQrWsQrRuW8HCdYqnlEHdr9JGao 2RCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="asB1/aK6"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id r4si3545967qvh.111.2018.11.08.08.40.28 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 08 Nov 2018 08:40:28 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="asB1/aK6"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57860 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKnM3-0006yW-QD for patch@linaro.org; Thu, 08 Nov 2018 11:40:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40808) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKnFg-00083q-Dp for qemu-devel@nongnu.org; Thu, 08 Nov 2018 11:33:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gKnFe-0004uS-Ce for qemu-devel@nongnu.org; Thu, 08 Nov 2018 11:33:52 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:55672) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gKnFe-0004au-4W for qemu-devel@nongnu.org; Thu, 08 Nov 2018 11:33:50 -0500 Received: by mail-wm1-x344.google.com with SMTP id s10-v6so1908673wmc.5 for ; Thu, 08 Nov 2018 08:33:33 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=HBIUDa6WnUimRx0p1xvdF1lO0WWeLDEpan0budZbRg4=; b=asB1/aK6TOL7QVQ/8hogmyt6jiQWHwJbS2HBMHmskAe+u4IrOWHu0VbcBCWy41EYEC jWtz2SAqBYQV4Hpc3yichtVMXyZTgfbZLU7zFbnGPNPpj5qSP4PU5su7e3ZuPhIPgCWs E7lA6ro0AXUD9Ah5hfGBI9GEBf0WqSnNkl/ys= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=HBIUDa6WnUimRx0p1xvdF1lO0WWeLDEpan0budZbRg4=; b=cdxd4x1ZkG52cdve0+7hd/3VLb9gp4/Vx0xl9BqmEwt8Usbj/dIgp3388IsI05j44j uxv6ea4yb0SnVk+vInFSNEH75MyIVflCSocO7R5MM91xhgNV4Ki7YFX2ui620kf8j1Bq 8XEgW7VQXOmLMusNiUkqb0A1AQyypxYo3s/ZRa5Rokf/VnhwtPZ+YJ1nDcgRRmqoptCf UD5CV9IPzNoS9ejVdD8c3tAh6jJnDTTRONKmWfvjv9O4LfAGdDSGlJIA/11ehIKOv/hj X7lE52Ta852mvTrLK1AaHQEe/H/cpNwF9JMp5IEj1s87bjDZ+PudTtqYskQroeV3e+Xf 6DRg== X-Gm-Message-State: AGRZ1gL4J73ugZUVdukYW6e5heFwr7DbG0B9Pb5rubLA6ytwz0nl8DNh XxxgQGJFOwnsvVGUrOjKQicVjm1isrk= X-Received: by 2002:a1c:2093:: with SMTP id g141-v6mr1764357wmg.7.1541694811953; Thu, 08 Nov 2018 08:33:31 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id v9-v6sm5318751wrm.6.2018.11.08.08.33.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Nov 2018 08:33:30 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id F1AA73E045E; Thu, 8 Nov 2018 16:33:29 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Thu, 8 Nov 2018 16:33:24 +0000 Message-Id: <20181108163329.19940-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181108163329.19940-1-alex.bennee@linaro.org> References: <20181108163329.19940-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 Subject: [Qemu-devel] [PATCH v2 1/6] target/arm64: properly handle DBGVR RESS bits 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: peter.maydell@linaro.org, qemu-arm@nongnu.org, =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This only fails with some (broken) versions of gdb but we should treat the top bits of DBGBVR as RESS. Properly sign extend QEMU's reference copy of dbgbvr and also update the register descriptions in the comment. Signed-off-by: Alex Bennée --- v2 - sanitise register on insertion - update reference description --- target/arm/kvm64.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index 5de8ff0ac5..b92ce3437f 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -103,7 +103,7 @@ static void kvm_arm_init_debug(CPUState *cs) * capable of fancier matching but that will require exposing that * fanciness to GDB's interface * - * D7.3.2 DBGBCR_EL1, Debug Breakpoint Control Registers + * DBGBCR_EL1, Debug Breakpoint Control Registers * * 31 24 23 20 19 16 15 14 13 12 9 8 5 4 3 2 1 0 * +------+------+-------+-----+----+------+-----+------+-----+---+ @@ -115,12 +115,25 @@ static void kvm_arm_init_debug(CPUState *cs) * SSC/HMC/PMC: Security, Higher and Priv access control (Table D-12) * BAS: Byte Address Select (RES1 for AArch64) * E: Enable bit + * + * DBGBVR_EL1, Debug Breakpoint Value Registers + * + * 63 53 52 49 48 2 1 0 + * +------+-----------+----------+-----+ + * | RESS | VA[52:49] | VA[48:2] | 0 0 | + * +------+-----------+----------+-----+ + * + * Depending on the addressing mode bits the top bits of the register + * are a sign extension of the highest applicable VA bit. Some + * versions of GDB don't do it correctly so we ensure they are correct + * here so future PC comparisons will work properly. */ + static int insert_hw_breakpoint(target_ulong addr) { HWBreakpoint brk = { .bcr = 0x1, /* BCR E=1, enable */ - .bvr = addr + .bvr = sextract64(addr, 52, 53) }; if (cur_hw_bps >= max_hw_bps) {