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) { From patchwork Thu Nov 8 16:33:25 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: 150536 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1041343ljp; Thu, 8 Nov 2018 08:40:22 -0800 (PST) X-Google-Smtp-Source: AJdET5esCPmlVg1duKkAEyf8yQxOIWyYTsSyBl0H/w3EhM8nuyITkt9LdmL9SMYDq42y9mS+n4GM X-Received: by 2002:a37:b6c5:: with SMTP id g188-v6mr4746527qkf.188.1541695222309; Thu, 08 Nov 2018 08:40:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541695222; cv=none; d=google.com; s=arc-20160816; b=xTRYJwMuCV2ul+Y5SaFjqNScp+h/DvMTY7ftbshO6vbBLWfgGXPGZAJVCMA/Io//OM nHFDn2JymviHF1UCTvSpOIlbmEF7No2mSMzfLZK9luABL6kAOPScwt/2WSAe8TCzwZA7 KiJnj6w9HRPyxB2JdZOOtqsQmywmI7EirgKXS20EIblKdaeE5Bx3zsj1IiODB6N0R3ki 76Eh1/RfD9AtZaMFYUqOj7GTtFdO+mzFf5lrkv8wvGYrxmcSM5eef41BPSYgUyfmr61O oVoiM3NGfUcQF/7MriC84pMLF4xIxYanRB9a8F3yhjQqZ1lex7hZChPtk03nxZMhgjED RICg== 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=w8M74aiMY+nmTaqeTVUxVUfMTWRrHBW+AcCZyefwKgI=; b=D1020n24htd2s6+5jNViAiFxd2u/ssF02yKP7RvYBnZB/yJc+8T76H3173cIh8VvEB Fe/5bZNt1w3IxNVZdCmtfITiTunJ8e0GIa8YaAgGkncAlY0SdB3fanbbpTZeCQXExpPA AcBr/OA32oz0t/tEamGgqCl1V4AdAYGIYIZIm+YIaTMk8g1FeO3EhzY7a43CIXE3UJS6 eBZDNc+t2pTkfcS7s0oni3qzqCXO4W4wz9ekIlByX7EYobXABkRoUtB1vDDE9zQSjNDD LouOZJFGcsprWA9KGg7Gd+PT88deL+N5YNdCpBxJBiNAHKYWr2y3oWTR+NhR6vLRXF/B vpRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=chkbAfgF; 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 x56si2493154qtc.123.2018.11.08.08.40.21 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 08 Nov 2018 08:40:22 -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=chkbAfgF; 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]:57859 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKnLx-0006uU-JO for patch@linaro.org; Thu, 08 Nov 2018 11:40:21 -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) 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-Received: by 2002:a1c:96c7:: with SMTP id y190-v6mr1858599wmd.36.1541694812694; Thu, 08 Nov 2018 08:33:32 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn?= =?utf-8?b?w6ll?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Fix the assertion failure when running interrupts. Signed-off-by: Alex Bennée Reviewed-by: Peter Maydell --- target/arm/kvm64.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.17.1 Reviewed-by: Richard Henderson 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_debug_exit_arch *debug_exit) cs->exception_index = EXCP_BKPT; env->exception.syndrome = debug_exit->hsr; env->exception.vaddress = debug_exit->far; + qemu_mutex_lock_iothread(); cc->do_interrupt(cs); + qemu_mutex_unlock_iothread(); return false; } From patchwork Thu Nov 8 16:33:26 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: 150531 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1034826ljp; Thu, 8 Nov 2018 08:34:22 -0800 (PST) X-Google-Smtp-Source: AJdET5c+D4YrZZaqtpKgtncFNCv6StzJYY0kN4yq8Uok99/zxjFVKJ1HRzt/s7jC+PEkTBkB+K9Q X-Received: by 2002:a37:9886:: with SMTP id a128mr4952018qke.156.1541694862462; Thu, 08 Nov 2018 08:34:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541694862; cv=none; d=google.com; s=arc-20160816; b=IuSdapZJ/aNv3BpMlEbb+RSW/LCHRrMkdYHzJuHWeQuALyf3PJ2o1atVx+GA0IWKVh bJQTV4eOOP+U/ogyidU6glLBE0YMH59S61SlvIBJlzL3jVycLwkQmkI6NyFli3GNHNl9 B9Mbx1wNHeRByEceVVjVJP0M9RTPTW8H3c4eJwcvuYz/uy3zTC++KFsueunpyn5tdeVr 3AAUMEx4XKc/Q2GAERl8JwAPXGOWezp2FGy25f/XirjcFCRbNZPHe65JvwtzH1sb4mY8 55GiSnJaApLPlvHpgQAT6zClXrArLP7DXwznEPqyFSFqTUohojDVc6DwA1nG/pp/ENpM k2xA== 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=c4V6kImoCE275rdFisv3w+l9mFW+volNA+l5l+8FYus=; b=fnWT8fXWTo/sLudCGAsShWkoe9ZAtb3cfJmuF1keZq04NT7eDn/GNwDmnYsg8h8HKT T27acGaKaiBnD3UUm6sMYpbbywG43qGV/d1Mv/IHmUgBHo/MaIxfOKuSXPEFXHJbWE8j sgjbXWcnE0khnvwuYpMg0T3+gZmQkajfUirBA1hMUD6v2ElTrt83XqIZ0dRrYmyXBYr9 fFYG3Iy2HxulXbqlZFlLz3rN6ki8Be8C4gaw78hp36y6Nc6TimOydc58jDDMKW4+gti2 x8kpXfLpiPdxA4fKVMAiesECeNm8FlVZ1/7Os2DQ6f5COc/6ZJ4QeaL4YG/DLsyQSP3Y n8aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WUttG8TL; 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 u19si1118945qvj.152.2018.11.08.08.34.22 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 08 Nov 2018 08:34:22 -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=WUttG8TL; 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]:57812 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKnG9-00085j-QG for patch@linaro.org; Thu, 08 Nov 2018 11:34:21 -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) 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-Received: by 2002:a5d:4b05:: with SMTP id v5-v6mr4610710wrq.5.1541694813967; 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 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) From: =?utf-8?q?Alex_Benn=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 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_Benn?= =?utf-8?b?w6ll?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Reviewed-by: Peter Maydell --- v2 - tweak commit msg for grammar --- target/arm/kvm64.c | 1 + 1 file changed, 1 insertion(+) -- 2.17.1 Reviewed-by: Richard Henderson 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_debug_exit_arch *debug_exit) cs->exception_index = EXCP_BKPT; env->exception.syndrome = debug_exit->hsr; env->exception.vaddress = debug_exit->far; + env->exception.target_el = 1; qemu_mutex_lock_iothread(); cc->do_interrupt(cs); qemu_mutex_unlock_iothread(); From patchwork Thu Nov 8 16:33:27 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: 150532 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1037845ljp; Thu, 8 Nov 2018 08:37:01 -0800 (PST) X-Google-Smtp-Source: AJdET5cnz+GINzXSEN0RvarQacg6EnNqeguErA04zGjD0AillIOiS5XNfJdautTdd6KlCmYgr2x5 X-Received: by 2002:a37:a288:: with SMTP id l130mr4758863qke.97.1541695021421; Thu, 08 Nov 2018 08:37:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541695021; cv=none; d=google.com; s=arc-20160816; b=TTZChmEbBEjf7Adb2+2dtDBJN9R9ABMSKlWM5sUxJhlgF5oksh+bM5v2nEkVxbyikB S1nNAP41NQ2pGAtip+K5PUPvaQyUtIrmrosqq6O6XMaVu3FPyzD6dR0jHhAINltrf4CB /MhAwcamm+NMTuQ9lSGNgF8hNhSbeH3EPak/bhkyZYquHvCBSKgjew8fzd4seNV8Sd+h gMI9d6R56Wz4ibtsVbv0JiteDatK5fkH+EAmaZryz+J9V23ml+y1Syh9uRsbLmuSILxr PGKbsAjh6mMpopAl6XkPWmxuSVnpzslM2pMIrXjkPulSA1uGph5ZIAn1E0iIBF4NcZVI j7AQ== 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=VbZTTvplcBTs4brsSw+K/L4qKAqG+mzzxPpItEpWg24=; b=mdeiKktCGdK/CgsmEWWf69hHjVoyzkoNciojSFlGXgSfh1QNDoz9nD2s3InZqfiKLH 29ic5wxnmGEVNuU3ZZX6natVCoRYXmM0JTlYrc0NFCOdFkg4cAO3R0/ItmP7fsnLssNO Y6evR2waLXLkEdwmnpNapb6xM8VHg/+fKndVFX90bFwnBDXH3LIEg6IBH16JdPu+wVjI 4PPbupKWHWycc5UtEmgVweTYCiMHkGP8zGhbDpmgqZdO/Yu9gMmq6OIykWb22vUJz8ys I4TG+C5zFe18BUeZPWiljZ1nplcVsdwiBhau9FW8gVUuOHIrjX1f+OzoUg2lu5P1NZ/U S/kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="NkwjMD/P"; 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 f19si70256qtp.106.2018.11.08.08.37.01 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 08 Nov 2018 08:37:01 -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="NkwjMD/P"; 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]:57834 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKnIi-0003as-Ox for patch@linaro.org; Thu, 08 Nov 2018 11:37:00 -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) 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-Received: by 2002:adf:eb0b:: with SMTP id s11-v6mr4669466wrn.102.1541694813368; 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 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) From: =?utf-8?q?Alex_Benn=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 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_Benn?= =?utf-8?b?w6ll?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Reviewed-by: Peter Maydell --- tests/guest-debug/test-gdbstub.py | 1 + 1 file changed, 1 insertion(+) -- 2.17.1 Reviewed-by: Richard Henderson diff --git a/tests/guest-debug/test-gdbstub.py b/tests/guest-debug/test-gdbstub.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 += 1 From patchwork Thu Nov 8 16:33:28 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: 150535 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1041131ljp; Thu, 8 Nov 2018 08:40:13 -0800 (PST) X-Google-Smtp-Source: AJdET5ceGV5nkCDieVSgmxl/FM51SCcaRESCDp/rC4P49ydDphlZH7z6ZCoiUZfGcSrJvsIAUpUA X-Received: by 2002:a0c:aa84:: with SMTP id f4mr5030437qvb.243.1541695213082; Thu, 08 Nov 2018 08:40:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541695213; cv=none; d=google.com; s=arc-20160816; b=gE4oTNN1D+B2hZNQJtFbKv7m9HjYTiKyPRzavxtz1a6I7bX2toP/45eUiam9fbhu4a KhdPeiqorDdeTRDYvWQXuxhdzA7H9+1XZDeAVnyqU54wIPKaFMrJRXF6tFy6DropTTW1 kI1XGW0WRHQFvLuPmMgQddudolp5cMluxw+LSC5FVxJctxWtpZ2FTZ3t6Rel+SFa4TMA tGoWY1zYJ2LUNHJ9H2vUVV7aZv8TLVWrECz46eTv8b6yXEifPzGqjMkCY4hAVz1nm2D2 YHIynjuhwIjjD19axEItYVf9wXL3GC9j8jZqR/XlVfmUFDhulwJwLyfwgCgt9Nfp18od aJBg== 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=vp2a0usUuu0rRONaQzTjUyLAtFtoZz3yAS8fqPJZuds=; b=vDvwrAVjltXgxN0Ng0dbq3KVU3Zjz3v7QWX7iWp5xgOK9Uquf1ur6zolN/Sk6M9+Pg ELfag26A+C2Jrh8QzH2mCBR2WntCarrLbWDxaGsWkcz3h7C9f1/xipL7l7HLD+v8vRVm SIViQ83OzXwyvXweeWBCv0wFjR+JUJAhhlpecn0QiVvZvPbwX4P1i6GsMzGZHODTNeGj SJtPKpWW5HDpJek7jiSdrhh41UXsLsyClLXUQcpBNycT/8Fns0OO/rSfVjrh66qTjN35 4GDXnckO/kza3oLUbtcBXczlCkWDf4LTFXOxQVp/D+kirWOCsC9gc9nkyoA2tAry3Qfs IPXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=h9YwOg+4; 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 52-v6si2078789qtv.79.2018.11.08.08.40.12 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 08 Nov 2018 08:40:13 -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=h9YwOg+4; 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]:57850 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKnLo-0006IL-Fq for patch@linaro.org; Thu, 08 Nov 2018 11:40:12 -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) 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-Received: by 2002:a1c:4d2:: with SMTP id 201-v6mr1737853wme.133.1541694814654; 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 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) From: =?utf-8?q?Alex_Benn=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 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_Benn?= =?utf-8?b?w6ll?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We already have this symbol defined so lets use it. Signed-off-by: Alex Bennée --- target/arm/cpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 Reviewed-by: Richard Henderson 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 *env) if (arm_feature(env, ARM_FEATURE_EL2) && !secure) { route_to_el2 = env->cp15.hcr_el2 & HCR_TGE || - env->cp15.mdcr_el2 & (1 << 8); + env->cp15.mdcr_el2 & MDCR_TDE; } if (route_to_el2) { From patchwork Thu Nov 8 16:33:29 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: 150534 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1038420ljp; Thu, 8 Nov 2018 08:37:33 -0800 (PST) X-Google-Smtp-Source: AJdET5evy7v4ycWxxZIV2yGmZ7O04WwV1zchEGm98QErO3HqTopwy7ffzTHtrCYjtw7caqZSBHnn X-Received: by 2002:a0c:90a6:: with SMTP id p35mr5025788qvp.125.1541695052936; Thu, 08 Nov 2018 08:37:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541695052; cv=none; d=google.com; s=arc-20160816; b=Tbs8ZCwXMUKlhA/pib/rFz7K2LAzAxaK8s7rIzKs4KOsugP73LilJa7U4wSxWLxuOK KfHHj76E6hqnQP6I4ChnbXI8dPwU121YGvGh2U+3+4RtWYQY0MiEnmMVaUWZnUBsmiMd 7xoNwShTp20yJhyXD8boSLvCMlVy3bNL3Z84g0tMteK5NUbA1GuyBBz7ay+1fNFz8Niw Isr3IJYxut34TPFX/9VheYsW2Byls7RZtkH5WKnxwSw02WxpLCiJ7afD9Y8xwWCjTf3W QXMglCzGzfPfzTBAWetq79rLJyL10Z9iCzV7P4I8z8ZgJ6AKLTjD/nCoCu+KSJPytk6I xgkw== 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=ZVCeHrA6mrSycqRGwzmYpbWPY3l4jyoiyxlbXBtrWBw=; b=gLKyjTB6VLs7aEPZHdjig4bu+LLlmlKSn/zD50NrLWAox1A7Tq2F8I+3MdXqZDdkqu +AGwKOr5R0PeWgZbXk4Xs7RW/2MX648himyDKs67pjQDsGpT9ZSu3Mk2tiU3NzZ3gMgh 1uROTEjwcw3FigOwA3FwJImwQgreBdhnWT9yGlyAs+iRHjssBFCgFHtcMWZsM/t19bWx bhIHIQgWreeP7SO4nTOXPUxRhG4nruQhlLyrXIPh07Zu8Xo2L7LhTCpaWzuv8FhUHtxU Yf0N56oD30FqNAGOGZTfjT1lR2J8dTEbzJ9VWP8sSiY/zK13GjPeycfxvGm6uirdT8aa 6m9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="Ntm/WNCQ"; 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 m189-v6si3197983qkf.6.2018.11.08.08.37.32 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 08 Nov 2018 08:37:32 -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="Ntm/WNCQ"; 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]:57836 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gKnJE-0003fX-D0 for patch@linaro.org; Thu, 08 Nov 2018 11:37:32 -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) 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-Received: by 2002:a5d:6a0e:: with SMTP id m14-v6mr4897102wru.76.1541694815197; 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 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) From: =?utf-8?q?Alex_Benn=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 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_Benn?= =?utf-8?b?w6ll?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée --- target/arm/cpu.h | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) -- 2.17.1 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) != 0; } +/* See AArch64.GenerateDebugExceptionsFrom() in ARM ARM pseudocode */ static inline bool aa64_generate_debug_exceptions(CPUARMState *env) { + int cur_el = 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) != 0 - || arm_current_el(env) == 3) { + || cur_el == 3) { return false; } } - if (arm_current_el(env) == arm_debug_target_el(env)) { - if ((extract32(env->cp15.mdscr_el1, 13, 1) == 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 = arm_debug_target_el(env); + + if (cur_el == 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; } static inline bool aa32_generate_debug_exceptions(CPUARMState *env) @@ -2833,9 +2843,6 @@ static inline bool aa32_generate_debug_exceptions(CPUARMState *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 bits. */ static inline bool arm_generate_debug_exceptions(CPUARMState *env) {