From patchwork Fri Nov 9 15:21:13 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: 150659 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp76163ljp; Fri, 9 Nov 2018 07:24:35 -0800 (PST) X-Google-Smtp-Source: AJdET5ecPFrYJ+kRbyQ2QRmG2dicC+BWEon6G5LmLiCXLWDjvdZTXFBxHjD+Y9dKWGvDym2QhQ3b X-Received: by 2002:a0c:ad53:: with SMTP id v19mr9037032qvc.83.1541777074990; Fri, 09 Nov 2018 07:24:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541777074; cv=none; d=google.com; s=arc-20160816; b=Y7tNsiEFOAqC7zj2BPORzLX77BG2M1EU1Er+EsQolQVPISkJEVyYjcIaSQIkZ8hxAP DkDjqPysEQEjcf+k8aomKlF4yM0o+sWzcj7VCzjBI5WjkQM+E1h+/SenlrQRZ7vmD0NB YRUahZD5FTub8cz8jcrKIItma+pn5IDhL5qfG5NwsCcvi7lxYaX/7Ndkxll+SFIQ0CLx sAwkT56s7iAPxHJshy4hpRvlT/OIrqlfYfbzezElyKdJFDlNCjNQrrquNZhJ33rZWuFW Qz+ZL4vKE8OS4ISdclqfQV7qN4bP09xd9BmmJ8fmwt/IVvcmhiGSWGGZ/RtsXyNm3gVO ZFjA== 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=G7ixcBUZkpRFWN8NapKcCGRdRfATrFNt/wg7PFUgvMM=; b=gP8P+EFXfZDESw7cJQANRrOdnx4FMw+oyPsC0VzDMjIjHx/kWsFZNza9EzEsteWafy rUQTR0jdpQ6Gv0YZeBz71esaejPGPF1OKT5YGwrD2hkbg0AnYpewb2q/Rbu3gnJlizKT fyn0lHHplGguBH9rH7L7h8Hblut1msI7jYnfpLRdMCe/xy2snBndkzHfUN2Afx2Ww71x PS5Ce5n0lYijBe9MRisDKwbGrWsUVXTkUL/827yx+susl0+B3380WuQYPhAcJhbULjOT Ob19ZD7RPaSwSSBGWNi1qG+7IqCq069mYS30/7WmPg+V//jhB6ahyV5V+GkbmLLkYGMj Uw/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=iMQN8RsZ; 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 m34si6012917qkh.8.2018.11.09.07.24.34 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 09 Nov 2018 07:24:34 -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=iMQN8RsZ; 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]:34724 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gL8eA-0005bW-86 for patch@linaro.org; Fri, 09 Nov 2018 10:24:34 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42449) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gL8bC-0001CK-3u for qemu-devel@nongnu.org; Fri, 09 Nov 2018 10:21:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gL8b8-0002y2-PD for qemu-devel@nongnu.org; Fri, 09 Nov 2018 10:21:29 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:32810) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gL8b6-0002Zo-V4 for qemu-devel@nongnu.org; Fri, 09 Nov 2018 10:21:25 -0500 Received: by mail-wr1-x441.google.com with SMTP id u9-v6so2313312wrr.0 for ; Fri, 09 Nov 2018 07:21:22 -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=G7ixcBUZkpRFWN8NapKcCGRdRfATrFNt/wg7PFUgvMM=; b=iMQN8RsZQqkRb2yrEcDy8aT4Nm5AhXKx8Y8X8fQKDiJlRuQow/gZt8oiqUZWP4pUms rr33kuvdg/a/UG8kjmDZNiIfmPxvLugA2vRyGVJnAj1QVQbKRVjwEXuXQPT6tbwCDLd3 0vEvjzA7f1R6dfbj5476re9avkpzeKOsOlQxM= 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=G7ixcBUZkpRFWN8NapKcCGRdRfATrFNt/wg7PFUgvMM=; b=oaqgMs6m30Ch7M3H651S7krshw7m8IgmVEvZIKmJt8P0kjphO1+fShYxoCIrfMKDBk xZVrVeGH7yRIny6LSOb6w6i3DIThd26GkEy07cJ/+mOxhGc4nlboIVkOKVmfGFmBQBu9 qIMuinbObEC5M/Z6VtKMcP9ED2nIQeqUMetB0w1pLt7tsCCrj3AJxTGJwB/w3Qm1gNdQ 3UFjRw7PbxS2pyzqdZ67g7p7A/EIrvZsKP1r94anL+uiUNGkF+tBh/hLCgKJhj8Ohdqq zDG7Z6ViYFs+9BUYkBOgGlzq2f5lDC58padvj+sSROnPnEiBa7SE3fugvyC3GdQWY9Rt nWCw== X-Gm-Message-State: AGRZ1gIUVO4YewVoTEnIHpBPyqYKOqym+WGoY1+qszLveu0ra9ZdZjqT Sywgr2Nv+JNVSstVrlncPLbp8Q== X-Received: by 2002:adf:e983:: with SMTP id h3-v6mr8244654wrm.58.1541776880758; Fri, 09 Nov 2018 07:21:20 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id n131-v6sm2941449wmd.7.2018.11.09.07.21.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Nov 2018 07:21:19 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 2C27C3E045E; Fri, 9 Nov 2018 15:21:19 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Fri, 9 Nov 2018 15:21:13 +0000 Message-Id: <20181109152119.9242-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181109152119.9242-1-alex.bennee@linaro.org> References: <20181109152119.9242-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::441 Subject: [Qemu-devel] [PATCH v3 1/7] 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 v3 - fix bogus sextract64 --- target/arm/kvm64.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) -- 2.17.1 Reviewed-by: Richard Henderson diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index 5de8ff0ac5..6351a54b28 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, 0, 53) }; if (cur_hw_bps >= max_hw_bps) {