From nobody Sun May 5 07:08:48 2024 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1541695172196907.0201940748457; Thu, 8 Nov 2018 08:39:32 -0800 (PST) Received: from localhost ([::1]:57846 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKnL9-0005P3-0W for importer@patchew.org; Thu, 08 Nov 2018 11:39:31 -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) 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) 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-Google-Smtp-Source: AJdET5cDgY6hC2AIrx0mMOLaGJJs610mqJVbChjgGFGJMGLCJVCuHDacmkqu+PIqd0NgYCs+wbaNCw== X-Received: by 2002:a1c:2093:: with SMTP id g141-v6mr1764357wmg.7.1541694811953; Thu, 08 Nov 2018 08:33:31 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=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 Content-Type: text/plain; charset="utf-8" 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::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=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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=C3=A9e --- v2 - sanitise register on insertion - update reference description --- target/arm/kvm64.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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 =3D { .bcr =3D 0x1, /* BCR E=3D1, enable */ - .bvr =3D addr + .bvr =3D sextract64(addr, 52, 53) }; =20 if (cur_hw_bps >=3D max_hw_bps) { --=20 2.17.1 From nobody Sun May 5 07:08:48 2024 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15416951707361018.3934479655825; Thu, 8 Nov 2018 08:39:30 -0800 (PST) Received: from localhost ([::1]:57845 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKnL7-0005MK-Gp for importer@patchew.org; Thu, 08 Nov 2018 11:39:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKnFg-00083o-CH 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-0004ud-Lo for qemu-devel@nongnu.org; Thu, 08 Nov 2018 11:33:52 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:55670) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gKnFe-0004bE-Bs for qemu-devel@nongnu.org; Thu, 08 Nov 2018 11:33:50 -0500 Received: by mail-wm1-x341.google.com with SMTP id s10-v6so1908711wmc.5 for ; Thu, 08 Nov 2018 08:33:33 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id h16-v6sm5120832wrb.73.2018.11.08.08.33.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Nov 2018 08:33:32 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 0FAF13E0467; Thu, 8 Nov 2018 16:33:30 +0000 (GMT) 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=w8M74aiMY+nmTaqeTVUxVUfMTWRrHBW+AcCZyefwKgI=; b=chkbAfgF4Saita7FmeT0R5R5u5SShvytNjZR4MRkGUN5xI9pOWzKe7yBm2ppk7oX6d 4Z0hQAh1bWNpWFKt4ieL5nRlFF58rcLmhb8Jl6A2fWBxaInErF1WbpmK6+8YuMsulQuJ kEVOcihQJUjpHcxtvF3d1t4nH+XHRfrb3HsvI= 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=w8M74aiMY+nmTaqeTVUxVUfMTWRrHBW+AcCZyefwKgI=; b=osNjODK46Ftaxy2Hfsnt+U5nJGlRKesmBmOXqbhOkzPWWjx/e+kJ6qHOiGiJUqMTB5 1WQWY1ezycSTGrZos3eUWw1WN5xC/hRPU5Lxrkpsdij+/GlYyQ4rugMTfSVICHUc/tw/ h9PKYSTFi2k/hLrLIhWcTFR7KZbBNZNiA4v0+sCEnm/5q9/i0u9702WSTBuA/4pDPjYN 8+io2kK5t6d+IKQL1nUkj9NADxijyuvrlk1iH/hHr5q3/k80EH7RwY+yl9FbQOm4iTJG dpySh1S4WDqkltaoeAbpTZ7aqkTLyeO972BrHyRHbDTlfgeal9BB8ADE+pqGU9Ma6PNq dQZA== X-Gm-Message-State: AGRZ1gKDl9JUoBFKKYXLclmcHVp1JBad+CyWZ8PgyA8nRJFFm90XraHM mNylnqk6IABHhDdHtkVDoKORGqSIE4Y= X-Google-Smtp-Source: AJdET5cjpJa9Fg9lAOpCbnykPBV5hS7zlkDXdf4ZgpZfDR9NSqzM7aIKjIvOxmb+otDk+DTtEGVhaA== X-Received: by 2002:a1c:96c7:: with SMTP id y190-v6mr1858599wmd.36.1541694812694; Thu, 08 Nov 2018 08:33:32 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Thu, 8 Nov 2018 16:33:25 +0000 Message-Id: <20181108163329.19940-3-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 Content-Type: text/plain; charset="utf-8" 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::341 Subject: [Qemu-devel] [PATCH v2 2/6] target/arm64: hold BQL when calling do_interrupt() 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=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Fix the assertion failure when running interrupts. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/kvm64.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index b92ce3437f..03b0f78831 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -1000,7 +1000,9 @@ bool kvm_arm_handle_debug(CPUState *cs, struct kvm_de= bug_exit_arch *debug_exit) cs->exception_index =3D EXCP_BKPT; env->exception.syndrome =3D debug_exit->hsr; env->exception.vaddress =3D debug_exit->far; + qemu_mutex_lock_iothread(); cc->do_interrupt(cs); + qemu_mutex_unlock_iothread(); =20 return false; } --=20 2.17.1 From nobody Sun May 5 07:08:48 2024 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1541694970456186.02320739353877; Thu, 8 Nov 2018 08:36:10 -0800 (PST) Received: from localhost ([::1]:57825 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKnHt-0002Sz-CF for importer@patchew.org; Thu, 08 Nov 2018 11:36:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKnFf-00083G-ET for qemu-devel@nongnu.org; Thu, 08 Nov 2018 11:33:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gKnFe-0004uA-24 for qemu-devel@nongnu.org; Thu, 08 Nov 2018 11:33:51 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:42021) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gKnFd-0004hq-HZ for qemu-devel@nongnu.org; Thu, 08 Nov 2018 11:33:49 -0500 Received: by mail-wr1-x441.google.com with SMTP id y15-v6so21922421wru.9 for ; Thu, 08 Nov 2018 08:33:35 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id o130-v6sm7213212wmd.11.2018.11.08.08.33.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Nov 2018 08:33:32 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 22F1C3E04A5; Thu, 8 Nov 2018 16:33:30 +0000 (GMT) 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=c4V6kImoCE275rdFisv3w+l9mFW+volNA+l5l+8FYus=; b=WUttG8TLum+3d0kNMbCfC3VErS3eLtbeP1uDYWCb3lh/grsuvzNRrH0DcBtS/kSd8R B0yq6ZGbfOedrDr/Bp4zn7oeNWChI40bglfPbQQQ0hh2OTC2///IbBXy0q3VmouWjeZS 5Jr+evyeKVnGR94BtTx232t3/hc8+mKl6PaBc= 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=c4V6kImoCE275rdFisv3w+l9mFW+volNA+l5l+8FYus=; b=f5+kbZyJ+DS8FJ0azR1vk92+jjLlHMyRt73S1N+Lu+TQNULZRwYEzxPWkkmsBanbMa ZTKrS2ERJu3rLkf5zzI8o7Onc+0q1AkxxVnhRG4BWyJd/ArABmOtsY7fgP+onLI8G2Pv t0Mqhlv2fr6xOeVj+roNppTUCrqlZ9SyUrK01Kr5gzBPUw5lcaSgjVzZCwoR+wuaSE0s 8xO58coq5eXVgnzdztDZJgltrzjx68G0i5UXnF6Ldw0WixBDwGPZxQ2eeBNN/jYhysqd 0EKyJARtG/kimzrskukLMq3avxnT2ryaLMQ65SghdPvFYC6pbJroJp0bfGLWcQAoK4yX LfXw== X-Gm-Message-State: AGRZ1gLgtC/KW1+9Rz9mOnVMzxygBK/i+uDQPZq/zHjFWsnorc2G0e3I zkyBhqQcPl+mCe81obtaJip67A== X-Google-Smtp-Source: AJdET5cSe/Ps9Ivztpm07qjBUF91WKOQChK1lNsj7CeG1vU1UWPaIDRgVA+EMHwlH2keTCz9XMYO0w== X-Received: by 2002:a5d:4b05:: with SMTP id v5-v6mr4610710wrq.5.1541694813967; Thu, 08 Nov 2018 08:33:33 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Thu, 8 Nov 2018 16:33:26 +0000 Message-Id: <20181108163329.19940-4-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 Content-Type: text/plain; charset="utf-8" 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::441 Subject: [Qemu-devel] [PATCH v2 3/6] target/arm64: kvm debug set target_el when passing exception to guest 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=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) When we are debugging the guest all exceptions come our way but might be for the guest's own debug exceptions. We use the ->do_interrupt() infrastructure to inject the exception into the guest. However, we are missing a full setup of the exception structure, causing an assert later down the line. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Peter Maydell Reviewed-by: Richard Henderson --- v2 - tweak commit msg for grammar --- target/arm/kvm64.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index 03b0f78831..bf7824d862 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -1000,6 +1000,7 @@ bool kvm_arm_handle_debug(CPUState *cs, struct kvm_de= bug_exit_arch *debug_exit) cs->exception_index =3D EXCP_BKPT; env->exception.syndrome =3D debug_exit->hsr; env->exception.vaddress =3D debug_exit->far; + env->exception.target_el =3D 1; qemu_mutex_lock_iothread(); cc->do_interrupt(cs); qemu_mutex_unlock_iothread(); --=20 2.17.1 From nobody Sun May 5 07:08:48 2024 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1541694975898271.21814568296907; Thu, 8 Nov 2018 08:36:15 -0800 (PST) Received: from localhost ([::1]:57826 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKnHu-0002T1-P4 for importer@patchew.org; Thu, 08 Nov 2018 11:36:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40747) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKnFf-00083H-ER 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 1gKnFd-0004ts-Kx for qemu-devel@nongnu.org; Thu, 08 Nov 2018 11:33:51 -0500 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:40864) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gKnFd-0004eO-CC for qemu-devel@nongnu.org; Thu, 08 Nov 2018 11:33:49 -0500 Received: by mail-wr1-x444.google.com with SMTP id i17-v6so21941824wre.7 for ; Thu, 08 Nov 2018 08:33:34 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id j25-v6sm1378553wrd.30.2018.11.08.08.33.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Nov 2018 08:33:32 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 353133E0581; Thu, 8 Nov 2018 16:33:30 +0000 (GMT) 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=VbZTTvplcBTs4brsSw+K/L4qKAqG+mzzxPpItEpWg24=; b=NkwjMD/P0RIhCA6miDYgdI4mew4oFjveu3OYfZezI9GmTxZfrJ3iVG4fB6Pxpx54n0 1l0iwvZwhoEGRC3SFkFpkJqydO0cbTEyUSwB5fy4p2Om0EMid0RcERtnaS4hXPB/hf+Y kerHSBBkX2s+Khyi7jGK02Sa/Prt0FTt/7v3E= 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=VbZTTvplcBTs4brsSw+K/L4qKAqG+mzzxPpItEpWg24=; b=r1oHTMyE/KQom+0/pex9Kfmu4ArsGY2ZFvdL2rz/WQWh1Q0ASxuOPYX2ypUweOXA2w qOHIsRGxvs6gq/qc+YdTICyFydnPtG1Ga5VmYbHdXsW4i+5KawKi2JnM58GAqLtAv43A mHZd9bz8jCMkrvo0PISMldPvDj8U/m9xMFgKSnHLajP6FmJPCKYT7ESXbvyqoCL9RJye WL9jaiDPpdP33eNkz+WPkPukdMyXiv7+q+D3NpVblFXis/HihTQd5PcsnVsl8hkDlCCg kgATKmq+WX8qsNw8pPH3fUoCR10boFhsmtkbhQQyO2lhWH/inXtpfQSvFOXQ/ikdzbtd E3/w== X-Gm-Message-State: AGRZ1gLAIuoWDn1k5cOeUOLews9TcP49nlwTTrpQ1jCWc3ba8x/TRcF8 sAL2V8p+96GWthxBkZdddQhR65tYsJQ= X-Google-Smtp-Source: AJdET5fGUl2Iv4m7hBuCIfHcxikFPMZPmodPo6r1bWZ8d7hdLrAdAuBoR6/NW/NrNNWH20ltLFqyBg== X-Received: by 2002:adf:eb0b:: with SMTP id s11-v6mr4669466wrn.102.1541694813368; Thu, 08 Nov 2018 08:33:33 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Thu, 8 Nov 2018 16:33:27 +0000 Message-Id: <20181108163329.19940-5-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 Content-Type: text/plain; charset="utf-8" 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::444 Subject: [Qemu-devel] [PATCH v2 4/6] tests/guest-debug: fix scoping of failcount 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=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) You should declare you are using a global version of a variable before you attempt to modify it in a function. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Peter Maydell Reviewed-by: Richard Henderson --- tests/guest-debug/test-gdbstub.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/guest-debug/test-gdbstub.py b/tests/guest-debug/test-gdb= stub.py index 0e4ac01426..c7e3986a24 100644 --- a/tests/guest-debug/test-gdbstub.py +++ b/tests/guest-debug/test-gdbstub.py @@ -16,6 +16,7 @@ def report(cond, msg): print ("PASS: %s" % (msg)) else: print ("FAIL: %s" % (msg)) + global failcount failcount +=3D 1 =20 =20 --=20 2.17.1 From nobody Sun May 5 07:08:48 2024 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1541695306054502.81739866840826; Thu, 8 Nov 2018 08:41:46 -0800 (PST) Received: from localhost ([::1]:57869 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKnNI-0007q5-RG for importer@patchew.org; Thu, 08 Nov 2018 11:41:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKnFf-00083T-VO for qemu-devel@nongnu.org; Thu, 08 Nov 2018 11:33:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gKnFe-0004ux-O9 for qemu-devel@nongnu.org; Thu, 08 Nov 2018 11:33:51 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:50195) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gKnFe-0004kr-EO for qemu-devel@nongnu.org; Thu, 08 Nov 2018 11:33:50 -0500 Received: by mail-wm1-x341.google.com with SMTP id 124-v6so1919690wmw.0 for ; Thu, 08 Nov 2018 08:33:35 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id k4sm6288158wrx.91.2018.11.08.08.33.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Nov 2018 08:33:32 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 476673E0593; Thu, 8 Nov 2018 16:33:30 +0000 (GMT) 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=vp2a0usUuu0rRONaQzTjUyLAtFtoZz3yAS8fqPJZuds=; b=h9YwOg+4hcj+ZrFNhUqeRGK1uRQuXj1PLvnzZk1ofo90xxogb3EWNaslRrbsDtXlR6 vpwTVXWitlWpTtJzYjifVclUtjRhoKLM7egwxNKrrH8s1WWN01OO/RCvCrGPd2f9rcsh VvTaj/EoC5VSIveG9QSByZU4/1Nvb1e3lvc+s= 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=vp2a0usUuu0rRONaQzTjUyLAtFtoZz3yAS8fqPJZuds=; b=qDKSpUK3gy8r5mw6Gc3/pKwji9dhUY36DoL/KSR/L1Mv9OQPGhNmFCsgIhvoPp42GQ qnsgaQcEKfQAFvBMFaUqilj646CiUveVm0UC/OBOST2Amly5scNFdOBv91hs3g53MHV6 Ezs3NAlge4an8kO7acaJ7xVPcT2cmDp/tXTfeKt2ubMZNESGAw1yRGu5rIBKvKsUjne0 87togAUJUFY0TCJqHVDYPzVFyuDvuGahFQEn+jgvqRBwv2r0fKkUIvDwoHuRQp2C228l 3MG7LizHHSlnZQxHa0eVe468xdnJxGjrlJYUD3zO5QbQxPQVxedVu1ZKd/61taYPHyFY LQjg== X-Gm-Message-State: AGRZ1gLIQfFhk/9gUsY82bDY3XQ5IEd3dYLsC51wVQe6JTIogmEXEXZB AKdfsdVykouuR4Znw1WAtaoN5V4Cy1I= X-Google-Smtp-Source: AJdET5eF114f/hgA6aXwLASjpjAdw3vz5X2pGFoOUPJEZLnaSgWUFf9hwBI4eYu71oUYG5er214oYw== X-Received: by 2002:a1c:4d2:: with SMTP id 201-v6mr1737853wme.133.1541694814654; Thu, 08 Nov 2018 08:33:34 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Thu, 8 Nov 2018 16:33:28 +0000 Message-Id: <20181108163329.19940-6-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 Content-Type: text/plain; charset="utf-8" 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::341 Subject: [Qemu-devel] [PATCH v2 5/6] arm: use symbolic MDCR_TDE in arm_debug_target_el 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=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) We already have this symbol defined so lets use it. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- target/arm/cpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index b5eff79f73..1efff21a18 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2743,7 +2743,7 @@ static inline int arm_debug_target_el(CPUARMState *en= v) =20 if (arm_feature(env, ARM_FEATURE_EL2) && !secure) { route_to_el2 =3D env->cp15.hcr_el2 & HCR_TGE || - env->cp15.mdcr_el2 & (1 << 8); + env->cp15.mdcr_el2 & MDCR_TDE; } =20 if (route_to_el2) { --=20 2.17.1 From nobody Sun May 5 07:08:48 2024 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1541695156379161.1771774665914; Thu, 8 Nov 2018 08:39:16 -0800 (PST) Received: from localhost ([::1]:57843 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKnKt-00055a-2e for importer@patchew.org; Thu, 08 Nov 2018 11:39:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40794) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKnFg-00083d-69 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-0004uH-6G for qemu-devel@nongnu.org; Thu, 08 Nov 2018 11:33:52 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:45701) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gKnFd-0004nW-VW for qemu-devel@nongnu.org; Thu, 08 Nov 2018 11:33:50 -0500 Received: by mail-wr1-x443.google.com with SMTP id k15-v6so18957750wre.12 for ; Thu, 08 Nov 2018 08:33:36 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id e8-v6sm4243641wrw.75.2018.11.08.08.33.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Nov 2018 08:33:32 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 59D063E059D; Thu, 8 Nov 2018 16:33:30 +0000 (GMT) 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=ZVCeHrA6mrSycqRGwzmYpbWPY3l4jyoiyxlbXBtrWBw=; b=Ntm/WNCQ+h8DTZ6qYRlLYuMtu71ngOReYZrASRBcX/KmEMnaM3GKX5hCbQT4uyKdA1 GhIcDA6yfoO5cvXHWKejf1XTJ84cFLgTwgUHJUZUZvZRq7z4jUhzkWS/Zm90WXpL39kY cvM0UEA9NQpaZKAgWhMojc3rgnic3coIhnQto= 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=ZVCeHrA6mrSycqRGwzmYpbWPY3l4jyoiyxlbXBtrWBw=; b=cTQaN2k67CkhAzBb4nzlWM07M+Z8OhgRF+VpJ5wDOtlLb9fjF5lWm/zsMNwpJ/wTlt OxqOUi4ToOQM6jSVXqnyBMfQtANK6vTWH7lJE4rC5PimGsfAykhaTT8vRY2FbDWVgtQe vNomPGWB6AWX4wHnNQMRugPcyHjUnpcLtldGVgq6WUijfvF3ZZnAGB//snZdkxIHR1wx M9UYpStGWw9YdytUMcbQtHN9VSuxwxYLGb+BwrcvDGeakrXVPCsT+tYxWEFlAyR9F7FI N27pTSrSBfa3BSTgYcfAC4cXw/Z9UWQeVbB2/DAf5YZx4LRD6fvLHGBiA6O2MWRb9EiT j+2w== X-Gm-Message-State: AGRZ1gKP8zIkRfKep4qMZTy+Wt6RTPRUTSBR/de0+xOj9Jne1ykxGuHI EiZwsUkiMSCceRsa3wZy/DWKvA== X-Google-Smtp-Source: AJdET5emdwaPQ/zVxrbq4G0VjD3/CsksSZNK6dKiEP8+PeIF5f6fBdMBwyJgS51PnWcPINMmMhasVg== X-Received: by 2002:a5d:6a0e:: with SMTP id m14-v6mr4897102wru.76.1541694815197; Thu, 08 Nov 2018 08:33:35 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Thu, 8 Nov 2018 16:33:29 +0000 Message-Id: <20181108163329.19940-7-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 Content-Type: text/plain; charset="utf-8" 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::443 Subject: [Qemu-devel] [PATCH v2 6/6] arm: fix aa64_generate_debug_exceptions to work with EL2 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=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The test was incomplete and incorrectly caused debug exceptions to be generated when returning to EL2 after a failed attempt to single-step an EL1 instruction. Fix this while cleaning up the function a little. Signed-off-by: Alex Benn=C3=A9e --- target/arm/cpu.h | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 1efff21a18..a6d8eb14f6 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2764,23 +2764,33 @@ static inline bool arm_v7m_csselr_razwi(ARMCPU *cpu) return (cpu->clidr & R_V7M_CLIDR_CTYPE_ALL_MASK) !=3D 0; } =20 +/* See AArch64.GenerateDebugExceptionsFrom() in ARM ARM pseudocode */ static inline bool aa64_generate_debug_exceptions(CPUARMState *env) { + int cur_el =3D arm_current_el(env); + int debug_el; + if (arm_is_secure(env)) { /* MDCR_EL3.SDD disables debug events from Secure state */ if (extract32(env->cp15.mdcr_el3, 16, 1) !=3D 0 - || arm_current_el(env) =3D=3D 3) { + || cur_el =3D=3D 3) { return false; } } =20 - if (arm_current_el(env) =3D=3D arm_debug_target_el(env)) { - if ((extract32(env->cp15.mdscr_el1, 13, 1) =3D=3D 0) - || (env->daif & PSTATE_D)) { - return false; - } + /* + * Same EL to same EL debug exceptions need MDSCR_KDE enabled + * while not masking the (D)ebug bit in DAIF. + */ + debug_el =3D arm_debug_target_el(env); + + if (cur_el =3D=3D debug_el) { + return extract32(env->cp15.mdscr_el1, 13, 1) + && !(env->daif & PSTATE_D); } - return true; + + /* Otherwise the debug target needs to be a higher EL */ + return debug_el > cur_el; } =20 static inline bool aa32_generate_debug_exceptions(CPUARMState *env) @@ -2833,9 +2843,6 @@ static inline bool aa32_generate_debug_exceptions(CPU= ARMState *env) * since the pseudocode has it at all callsites except for the one in * CheckSoftwareStep(), where it is elided because both branches would * always return the same value. - * - * Parts of the pseudocode relating to EL2 and EL3 are omitted because we - * don't yet implement those exception levels or their associated trap bit= s. */ static inline bool arm_generate_debug_exceptions(CPUARMState *env) { --=20 2.17.1