From patchwork Fri Mar 23 18:49:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 132361 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp951019ljb; Fri, 23 Mar 2018 11:53:41 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/Bni4JRXjJAWeM34ehhjceUJxtyeSeN2lsCi8RL8V60Yr+fXn/RN/b2PyNshA7/v8I26sk X-Received: by 10.237.45.132 with SMTP id i4mr14482854qtd.64.1521831221549; Fri, 23 Mar 2018 11:53:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521831221; cv=none; d=google.com; s=arc-20160816; b=qyq2PpqkeXN6ELxOZmB4la5hszx8jbYQ4p5mWBgLYCsSOgkAmXNlxnOGxm/gWL5QCH VcffxhayeDF1wP6fN//fvAovNGdqhllzPdiwXpkVwknukzPfef/M08AQ+VSaohrUJnDY SPUaIAMLvsWnnNcwiGuz1xNHKnJQRtOqI7GpDtSJILGN2HDs1ixv1lQ/dPG/7IeYwLNH zTYtT9chkIk7sQQE66AU6uuGDQJKIXfKfSOu8PfJyhjPet4eR+3Sx8pfAZ54uy/jME0M LVjdRqWa5CDr8uGRyMmiFFLbQoqGngO3AIoGjlJ6+uL4V7jcEhR1XXN7g6An5Lyh7lor imGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:arc-authentication-results; bh=e19ubnZjndigbnG5On5otvLrUyWg/I+3Ka1bVcP/Rto=; b=0nnZeDZgnh7VODJVS5E112bWl9M0KdAtekOTGHGICplHQV3Rz7LN67+JBD46FKlveV pzdSXh0cFincqZNp4NStep78fldrx53fqOOGBAxA6Lu/85DxBH/YR4wjfdafuaxhga2C IWK2zitqhUST+Oe0l3e0ETNsIpVwpySdbXjbIgFzKR5Jd6e7ZIeGaEkB8KMKaqQ3j28P IZnvoreCbUKWJ8ALS7QZ6VMLMsg35NEaTK1dbWCCn/Put82kjOkg3zuXcGgssSYSzEqs eAOfee3JzjHJ/Lz29mdY6gTxSPFCbednQjcV24zDGlbtBz2TvFa9EZffyT22weYjzbRl Bcxg== ARC-Authentication-Results: i=1; mx.google.com; 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 h136si221998qka.142.2018.03.23.11.53.41 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 23 Mar 2018 11:53:41 -0700 (PDT) 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; 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]:39381 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezRor-0003iF-0h for patch@linaro.org; Fri, 23 Mar 2018 14:53:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezRlM-00017c-O4 for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ezRlL-0004Ea-PF for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:04 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40508) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ezRlL-0004DB-HX for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:03 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1ezRlI-0007dd-42 for qemu-devel@nongnu.org; Fri, 23 Mar 2018 18:50:00 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 23 Mar 2018 18:49:49 +0000 Message-Id: <20180323184958.14252-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323184958.14252-1-peter.maydell@linaro.org> References: <20180323184958.14252-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 01/10] arm/translate-a64: treat DISAS_UPDATE as variant of DISAS_EXIT 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Victor Kamensky In OE project 4.15 linux kernel boot hang was observed under single cpu aarch64 qemu. Kernel code was in a loop waiting for vtimer arrival, spinning in TC generated blocks, while interrupt was pending unprocessed. This happened because when qemu tried to handle vtimer interrupt target had interrupts disabled, as result flag indicating TCG exit, cpu->icount_decr.u16.high, was cleared but arm_cpu_exec_interrupt function did not call arm_cpu_do_interrupt to process interrupt. Later when target reenabled interrupts, it happened without exit into main loop, so following code that waited for result of interrupt execution run in infinite loop. To solve the problem instructions that operate on CPU sys state (i.e enable/disable interrupt), and marked as DISAS_UPDATE, should be considered as DISAS_EXIT variant, and should be forced to exit back to main loop so qemu will have a chance processing pending CPU state updates, including pending interrupts. This change brings consistency with how DISAS_UPDATE is treated in aarch32 case. CC: Peter Maydell CC: Alex Bennée CC: qemu-stable@nongnu.org Suggested-by: Peter Maydell Signed-off-by: Victor Kamensky Reviewed-by: Richard Henderson Message-id: 1521526368-1996-1-git-send-email-kamensky@cisco.com Signed-off-by: Peter Maydell --- target/arm/translate-a64.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.16.2 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 31ff0479e6..327513ef40 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -13378,12 +13378,12 @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) case DISAS_UPDATE: gen_a64_set_pc_im(dc->pc); /* fall through */ - case DISAS_JUMP: - tcg_gen_lookup_and_goto_ptr(); - break; case DISAS_EXIT: tcg_gen_exit_tb(0); break; + case DISAS_JUMP: + tcg_gen_lookup_and_goto_ptr(); + break; case DISAS_NORETURN: case DISAS_SWI: break; From patchwork Fri Mar 23 18:49:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 132355 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp948498ljb; Fri, 23 Mar 2018 11:50:40 -0700 (PDT) X-Google-Smtp-Source: AG47ELtUoQHYBwPh/wdr/hoTxiNZ9L61xKfTIitx2mgqCb90rmzGZsWFuvdkI0DkiCyg/Zt4ciW5 X-Received: by 10.233.232.215 with SMTP id a206mr42757166qkg.238.1521831040691; Fri, 23 Mar 2018 11:50:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521831040; cv=none; d=google.com; s=arc-20160816; b=vboBWBVpVzIblwLHAY/x96AZA9aBLmCDECW2JbZOddw9CBurGFeQ3xC5rBNVKTnYn/ 9VarIx4qZ5JQfEqPf/x6ob9snr6SRuoDocrMJyAcET6nqqQIS6IoItm+YFIePaS1a6T6 YIYfDKFGxwZ+qXiKuqHWG5gzrFGd6zXelYuY87nU3MBk2u78OJU8fqkHaepjASqHPxyw kPZc3+kenpWf09CmnV7/CHQgwo+LHvZsHckyCLz58l1aKk5JVeMzBOZQVpN6WyXsGX6L Mri6OEZZYCUn2cW49pQQLUzY4A+CjfHsy2Fm1dIQUeP103Ogsckx2paaHL+cD00ZQnfk gBZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:arc-authentication-results; bh=y1P7/hDCaAmz8Xoavyr1CifeN3rofM6Ac3TluqWjMsI=; b=rztLa2oc4utB+a3gZF3EWW7J+lwrdyAelWg+uc0FYteQpS/4ejThNYck9flO4n9QGL fyQifrSvy92DYKNN+NpQ34Xa+1pFYE0WVebJAFdST+idhTrXh5P4U1B2lIT7uOFxfl0K SBlLZoPV6pO5q4oBk1UU7qUnKvbr/R0s2hdYovkTw8kQpew53dMp51XRh9lfTV/0KQul ptjNYHcNYlo81ZesXF0GQhnZ3HZkYhMJ9XeTCswKxjYyUE3qgOFvcbumsHw/UUj0810B B8bBi1j8K6vITqyHfwRBsa6ji0yxn5f7O0UoTdl1QKDwnXyXptNIXjM2XG5XLWPghML3 gTVw== ARC-Authentication-Results: i=1; mx.google.com; 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 v34si1919973qtv.369.2018.03.23.11.50.40 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 23 Mar 2018 11:50:40 -0700 (PDT) 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; 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]:39367 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezRlw-00018X-3g for patch@linaro.org; Fri, 23 Mar 2018 14:50:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezRlL-00017O-Bg for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ezRlK-0004DZ-Fw for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:03 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40506) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ezRlK-0004CA-9S for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:02 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1ezRlI-0007e8-R0 for qemu-devel@nongnu.org; Fri, 23 Mar 2018 18:50:00 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 23 Mar 2018 18:49:50 +0000 Message-Id: <20180323184958.14252-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323184958.14252-1-peter.maydell@linaro.org> References: <20180323184958.14252-1-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 02/10] sdhci: fix incorrect use of Error * 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Detected by Coverity (CID 1386072, 1386073, 1386076, 1386077). local_err was unused, and this made the static analyzer unhappy. Signed-off-by: Paolo Bonzini Message-id: 20180320151355.25854-1-pbonzini@redhat.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/sd/sdhci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.16.2 diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index 1b828b104d..63c44a4ee8 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -1474,7 +1474,7 @@ static void sdhci_pci_realize(PCIDevice *dev, Error **errp) Error *local_err = NULL; sdhci_initfn(s); - sdhci_common_realize(s, errp); + sdhci_common_realize(s, &local_err); if (local_err) { error_propagate(errp, local_err); return; @@ -1556,7 +1556,7 @@ static void sdhci_sysbus_realize(DeviceState *dev, Error ** errp) SysBusDevice *sbd = SYS_BUS_DEVICE(dev); Error *local_err = NULL; - sdhci_common_realize(s, errp); + sdhci_common_realize(s, &local_err); if (local_err) { error_propagate(errp, local_err); return; From patchwork Fri Mar 23 18:49:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 132360 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp950990ljb; Fri, 23 Mar 2018 11:53:40 -0700 (PDT) X-Google-Smtp-Source: AG47ELss9lQH5dQZC60Tm6VLpq++/DnUivBB0y+cU94G+M79ek8gj68uUu7UI2xZKRlo6YyFLio7 X-Received: by 10.237.43.228 with SMTP id e91mr44257039qtd.17.1521831219928; Fri, 23 Mar 2018 11:53:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521831219; cv=none; d=google.com; s=arc-20160816; b=DPLLHFU1c1u+U88zy5crjroXb4Wl6T/G0pgkbBiB/x3VD/gtk9MBYl1TK5hkfyrKXT U8fSo+LWQXoEhIlOUwtfm/jkMIC2GdHOV8BWlEPGReoQVoVBsLJq6j/TSKzE1g235Xe2 q36YLz2keGaxREdp1nAWoIGiws3wlyzFC+XNwQJnSzQIRC7km+EI/+TLtUs+wWQkw+Iv HgAWNcu3BbknzgGwgwtLuoSORtjVc9Qy1yiz7QQzB9YJr1bmvzVFBAcZdn5+YdPdDkTG 1SEuCGgJwDxzZFt6rllN6jc/YljWE+Xi8xLt+eBEIXrdKAKCAvS2+tZ752GIFV7OLQFP rrZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:arc-authentication-results; bh=drGhuAKM/txalP7J6IBNUPUJlXYsBzUWY0zmKumdvJE=; b=F/UbTQlFIiMPxsDKBdqwaF4ezjnlAGX+nNUFfzXNk7siMmBNckofIWiIbalLy8hRvd TS48oMWPmbN3sx0T26PMfJuEg04b2SIUCvilYAw6zd+vNahujb1srN0IfC2P8BoPIO6T 0q85N2ighDUICubBevj1+nNcBd6XLMEyeeOIcOWDGWvOEiD1WzsYLKDHGMmhIHJ2mOPy abNWldcyCjJlQZBRq/FqbOVCMUududxOROlYlR+Xin+Xelqx49laSdZXkIx04quhi8G7 gBlR4X0lCCkH2PaFst6uWiNEvFj9TwbVN6mNs/VwMU6nArZrIUH+PP760uzFQzzK+ZlP LkJA== ARC-Authentication-Results: i=1; mx.google.com; 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 k67si3886816qkd.372.2018.03.23.11.53.39 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 23 Mar 2018 11:53:39 -0700 (PDT) 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; 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]:39380 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezRop-0003fx-D2 for patch@linaro.org; Fri, 23 Mar 2018 14:53:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezRlL-00017S-Tk for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ezRlK-0004Dp-R4 for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:04 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40508) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ezRlK-0004DB-Jm for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:02 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1ezRlJ-0007ec-H5 for qemu-devel@nongnu.org; Fri, 23 Mar 2018 18:50:01 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 23 Mar 2018 18:49:51 +0000 Message-Id: <20180323184958.14252-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323184958.14252-1-peter.maydell@linaro.org> References: <20180323184958.14252-1-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 03/10] hw/intc/arm_gicv3: Fix secure-GIC NS ICC_PMR and ICC_RPR accesses 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" If the GIC has the security extension support enabled, then a non-secure access to ICC_PMR must take account of the non-secure view of interrupt priorities, where real priorities 0x00..0x7f are secure-only and not visible to the non-secure guest, and priorities 0x80..0xff are shown to the guest as if they were 0x00..0xff. We had the logic here wrong: * on reads, the priority is in the secure range if bit 7 is clear, not if it is set * on writes, we want to set bit 7, not mask everything else Our ICC_RPR read code had the same error as ICC_PMR. (Compare the GICv3 spec pseudocode functions ICC_RPR_EL1 and ICC_PMR_EL1.) Fixes: https://bugs.launchpad.net/qemu/+bug/1748434 Signed-off-by: Peter Maydell Reviewed-by: Andrew Jones Message-id: 20180315133441.24149-1-peter.maydell@linaro.org --- hw/intc/arm_gicv3_cpuif.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.16.2 diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c index 5cbafaf497..26f5eeda94 100644 --- a/hw/intc/arm_gicv3_cpuif.c +++ b/hw/intc/arm_gicv3_cpuif.c @@ -836,7 +836,7 @@ static uint64_t icc_pmr_read(CPUARMState *env, const ARMCPRegInfo *ri) /* NS access and Group 0 is inaccessible to NS: return the * NS view of the current priority */ - if (value & 0x80) { + if ((value & 0x80) == 0) { /* Secure priorities not visible to NS */ value = 0; } else if (value != 0xff) { @@ -871,7 +871,7 @@ static void icc_pmr_write(CPUARMState *env, const ARMCPRegInfo *ri, /* Current PMR in the secure range, don't allow NS to change it */ return; } - value = (value >> 1) & 0x80; + value = (value >> 1) | 0x80; } cs->icc_pmr_el1 = value; gicv3_cpuif_update(cs); @@ -1609,7 +1609,7 @@ static uint64_t icc_rpr_read(CPUARMState *env, const ARMCPRegInfo *ri) if (arm_feature(env, ARM_FEATURE_EL3) && !arm_is_secure(env) && (env->cp15.scr_el3 & SCR_FIQ)) { /* NS GIC access and Group 0 is inaccessible to NS */ - if (prio & 0x80) { + if ((prio & 0x80) == 0) { /* NS mustn't see priorities in the Secure half of the range */ prio = 0; } else if (prio != 0xff) { From patchwork Fri Mar 23 18:49:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 132357 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp950656ljb; Fri, 23 Mar 2018 11:53:11 -0700 (PDT) X-Google-Smtp-Source: AG47ELuv7/UzLg3u0aBVlaDR5AwIcWDNXwyD0s38ffpY1GJKL4tXkyJxNlegPcWjAU53Nk4jwxcF X-Received: by 10.237.57.65 with SMTP id l59mr38989406qte.198.1521831191706; Fri, 23 Mar 2018 11:53:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521831191; cv=none; d=google.com; s=arc-20160816; b=0bAtOE9OTSZTyah8SlvHNfK+iRUK0MI1kXvyWvHY06xWeNqENrDBUhraGP1EMJe9bt +P+wYwTHNt2/otmbquZK7ePo2RPo7WvnMdGkG3LAZxbrQKkp8n/xP0UnzpKNYQPvF+co FcoreBe/5X4/E00otr9RLeNm+qNhlDrneuirrkMKq4KR9txWiRDvJTZwewA3C0sy1lMa IRP/2yt738AP1Jimbf6c4M5QiA10A5poO1440WalSBCvQwJNF2aRk+tUkJxP9gjUgwco Gt1cKL2Q1+yxZj3cCHYdW68GtBq92NL+KbcIcUOOYkSgcwT6J51YvWSyQ66l++Z23wcl 9Fog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:arc-authentication-results; bh=LYP5i45AURrlZqga6I94SW+p/jbXEBSEVlFZJZQh77Q=; b=ztxrpKLBr35DymM1B/YpTCJqeOtPOlqvXdlBwv82y9W37Tgg5+0eMomsY8VXuWfYCf flsjg0FI2GIOuQSswZG9KFqvrGvDXnyJA5FIGylWdgmRVXJ4VMEN73S1KY7vX4fyuVT4 D4lSrv7JZzexaqNaqGj5On58148qBZLotLu3AfMBrsPTYyqXoidepkpVpgy+pWgdC+f5 DOuawSLGSm2kzTp+nqilMW+SWCBnOwc3wj+1F2SSHNU8r2FrIme9rPnllNsWndoTO6lD kK1cIpkaH0JrlGzRGIwlE97o0CF06UVLE71eDd7rVnTscTOpiFnzEeVs5zAicM/jJFeM ZHcg== ARC-Authentication-Results: i=1; mx.google.com; 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 141si2238358qkk.455.2018.03.23.11.53.11 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 23 Mar 2018 11:53:11 -0700 (PDT) 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; 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]:39373 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezRoN-0002S0-5t for patch@linaro.org; Fri, 23 Mar 2018 14:53:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezRlM-00017b-Dq for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ezRlL-0004EF-Ej for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:04 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40506) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ezRlL-0004CA-6u for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:03 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1ezRlK-0007et-6q for qemu-devel@nongnu.org; Fri, 23 Mar 2018 18:50:02 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 23 Mar 2018 18:49:52 +0000 Message-Id: <20180323184958.14252-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323184958.14252-1-peter.maydell@linaro.org> References: <20180323184958.14252-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 04/10] hw/arm/bcm2836: Use the Cortex-A7 instead of Cortex-A15 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The BCM2836 uses a Cortex-A7, not a Cortex-A15. Update the device to use the correct CPU. https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2836/QA7_rev3.4.pdf When the BCM2836 was introduced (bad5623690b) the Cortex-A7 was not available, so the very similar Cortex-A15 was used. Since dcf578ed8ce we can model the correct core. Signed-off-by: Peter Maydell Reviewed-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daudé Message-id: 20180319110215.16755-1-peter.maydell@linaro.org --- hw/arm/bcm2836.c | 2 +- hw/arm/raspi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- 2.16.2 diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index 3e7e8ca791..3c4b44a53e 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -32,7 +32,7 @@ struct BCM283XInfo { static const BCM283XInfo bcm283x_socs[] = { { .name = TYPE_BCM2836, - .cpu_type = ARM_CPU_TYPE_NAME("cortex-a15"), + .cpu_type = ARM_CPU_TYPE_NAME("cortex-a7"), .clusterid = 0xf, }, #ifdef TARGET_AARCH64 diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 06f1e08ca9..955a7c4e80 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -226,7 +226,7 @@ static void raspi2_machine_init(MachineClass *mc) mc->no_parallel = 1; mc->no_floppy = 1; mc->no_cdrom = 1; - mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15"); + mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a7"); mc->max_cpus = BCM283X_NCPUS; mc->min_cpus = BCM283X_NCPUS; mc->default_cpus = BCM283X_NCPUS; From patchwork Fri Mar 23 18:49:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 132359 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp950971ljb; Fri, 23 Mar 2018 11:53:38 -0700 (PDT) X-Google-Smtp-Source: AG47ELs+0WHUSPupVhQ+qbvgXGowieBDHnBwI07VdIFP0A7he3Nsj2gTP5qd5NV/OjtX9NaAQkL8 X-Received: by 10.55.46.194 with SMTP id u185mr25575279qkh.63.1521831218857; Fri, 23 Mar 2018 11:53:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521831218; cv=none; d=google.com; s=arc-20160816; b=GAavtrdGBunDhTLtAz8Ldv8Iu21GGBo0wHB9uFkJwjWpx/9qVCEGDhISIqT3mmj0/Q tEyfKmxNYrOQjzzXTHnz6zrzP0dJWCqvhzy9NH3q7it4eRQHP/FCMon0aQTBxT+op9u5 j6W7cboT94l+pVi0R/6KxQSrfleqjOQBqUQpxTq2UhijihGd/py5pXmmEqkKZKlMY7T4 3bKcI/if3WZRO1TW0S2DGdGUuvHqP+p0iVgH8MdGkT0gcql7YyERfkJuKNKMHlUuFgXU JqWsknxlxuA5muPAWxllHu5xl8sAj96Ty7CACBcd5hMjXq66NsYnfAXHiPT/k6sHgbtV CmFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:arc-authentication-results; bh=M60ZGieKX5w0JciJgXcZWYlHLMXstzRMroAno1RCcNU=; b=zvU/LiHYYeESIQvXtGzaxZN3rKzOgK6zd5DeesNUsAAHfKyxxW1sOPH85hOXH7Gmoc M5vyzOYX9jo+3xgN5b6SKdQMg3Agi8r0XYxLR3QMgAja+pXABcSi51A6DAOgsQ2xRNNa RZvGErt7I6Bw0evxQUF6E3FNnlvTeOEh3IawOeRtb+VUs8akhz0008VIuTh5KiF10Dxv dQzNA55VCsdj2o/RoVEMR9IB/76ZSAqYoEayuvdI2gTwQpe8Noq0LlwAj/2fttiBE/67 4lFtxRQEp3o+38/9SxQLmCjewyExRvKKDOEy210UimNrOfDZJpHzQ0FtxxKxznw5EaMj nfuQ== ARC-Authentication-Results: i=1; mx.google.com; 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 f4si4037810qkj.329.2018.03.23.11.53.38 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 23 Mar 2018 11:53:38 -0700 (PDT) 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; 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]:39379 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezRoo-0003ez-C6 for patch@linaro.org; Fri, 23 Mar 2018 14:53:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49140) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezRlN-00017i-4y for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ezRlM-0004Et-5P for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:05 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40510) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ezRlL-0004EB-VW for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:04 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1ezRlK-0007fP-Tu for qemu-devel@nongnu.org; Fri, 23 Mar 2018 18:50:02 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 23 Mar 2018 18:49:53 +0000 Message-Id: <20180323184958.14252-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323184958.14252-1-peter.maydell@linaro.org> References: <20180323184958.14252-1-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 05/10] i.MX: Support serial RS-232 break properly 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Trent Piepho Linux does not detect a break from this IMX serial driver as a magic sysrq. Nor does it note a break in the port error counts. The former is because the Linux driver uses the BRCD bit in the USR2 register to trigger the RS-232 break handler in the kernel, which is where sysrq hooks in. The emulated UART was not setting this status bit. The latter is because the Linux driver expects, in addition to the BRK bit, that the ERR bit is set when a break is read in the FIFO. A break should also count as a frame error, so add that bit too. Cc: Andrey Smirnov Signed-off-by: Trent Piepho Message-id: 20180320013657.25038-1-tpiepho@impinj.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- include/hw/char/imx_serial.h | 1 + hw/char/imx_serial.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) -- 2.16.2 diff --git a/include/hw/char/imx_serial.h b/include/hw/char/imx_serial.h index 5b99cee7cf..ee80da12e6 100644 --- a/include/hw/char/imx_serial.h +++ b/include/hw/char/imx_serial.h @@ -26,6 +26,7 @@ #define URXD_CHARRDY (1<<15) /* character read is valid */ #define URXD_ERR (1<<14) /* Character has error */ +#define URXD_FRMERR (1<<12) /* Character has frame error */ #define URXD_BRK (1<<11) /* Break received */ #define USR1_PARTYER (1<<15) /* Parity Error */ diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c index 1e5540472b..0747db9f2b 100644 --- a/hw/char/imx_serial.c +++ b/hw/char/imx_serial.c @@ -308,6 +308,9 @@ static void imx_put_data(void *opaque, uint32_t value) s->usr2 |= USR2_RDR; s->uts1 &= ~UTS1_RXEMPTY; s->readbuff = value; + if (value & URXD_BRK) { + s->usr2 |= USR2_BRCD; + } imx_update(s); } @@ -319,7 +322,7 @@ static void imx_receive(void *opaque, const uint8_t *buf, int size) static void imx_event(void *opaque, int event) { if (event == CHR_EVENT_BREAK) { - imx_put_data(opaque, URXD_BRK); + imx_put_data(opaque, URXD_BRK | URXD_FRMERR | URXD_ERR); } } From patchwork Fri Mar 23 18:49:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 132358 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp950746ljb; Fri, 23 Mar 2018 11:53:19 -0700 (PDT) X-Google-Smtp-Source: AG47ELtlTFTYN7tIH5Zq6odi/PRzIFnuvxNYVm5WCoQjv8Le+7ELl3zZ522B6b4HKOzQZHw3shV8 X-Received: by 10.237.54.161 with SMTP id f30mr43830536qtb.128.1521831199408; Fri, 23 Mar 2018 11:53:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521831199; cv=none; d=google.com; s=arc-20160816; b=oNm43/VMc5HHxAjLbP0vxt27avhqPPL2HlbgYIUnkzvIq7SmbkLd6rqAUbOppYucFD bGbggeney4BKSsR/SapsQdp+NA17yLmRolFck4Me9C7sJBs7Ub0Q8hgr5WMudj4N4vo2 X82cwFuY4nb/Bxd0yvlsG+BouZj2xDdsClnezXLspKuL7nAmiJvUHcORqLi3vwbV/c/U tBcl1CdR+SePZFd3p34yUcQbKBf/nJHCPR1mGmTpgWYzBAwesVC0Oi0/T8eCsYVfhHdC 7buibrFzMN+bRBVU76DM3A9cBVfLWWz/NK4W68V/G+4jypveLZHOvbCTrwYgrs8utZUj DVxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:arc-authentication-results; bh=XB7+UJoM8Min2ezrRwoE/7pncWNWRUyJVX8OCIWJ+7Y=; b=y36qAUuaIfoGegidwTfboZfpkByPR3Cv6vbn1FuCYrS2sJuNjTrWlbwtcTumnSc+1j UDwqz1f4YZUa4VigfEq1rIQTJeJ0Y1C6Fw/iTEWh6Wwlb0wr6LjEc+zTXzdXK+T4E36w AogRO/FJJx0NGVZ5jLYq3XBi95sdRHdPJfz+5EEDijvmfF+OJtwFjUSlF5wM3gwwIFp7 ZkzHm0WkoVUQd7J6B37vSAnhzLvW4dhx7X4A/fJZrnkIJnoVtMgwjJa6+125Py1z1YH8 V814BAVqzyx2MumFrM3Zwnv+WyIwWhacpca7BqadPgSP6XUkA3WyFxkFgdV2y+FRp6x8 B45A== ARC-Authentication-Results: i=1; mx.google.com; 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 j9si570260qkm.75.2018.03.23.11.53.19 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 23 Mar 2018 11:53:19 -0700 (PDT) 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; 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]:39375 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezRoU-0002WL-Qc for patch@linaro.org; Fri, 23 Mar 2018 14:53:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49155) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezRlO-00018I-23 for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ezRlN-0004Fd-3a for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:06 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40510) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ezRlM-0004EB-Ss for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:05 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1ezRlL-0007fu-JK for qemu-devel@nongnu.org; Fri, 23 Mar 2018 18:50:03 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 23 Mar 2018 18:49:54 +0000 Message-Id: <20180323184958.14252-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323184958.14252-1-peter.maydell@linaro.org> References: <20180323184958.14252-1-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 06/10] mach-virt: Set VM's SMBIOS system version to mc->name 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Wei Huang Instead of using "1.0" as the system version of SMBIOS, we should use mc->name for mach-virt machine type to be consistent other architectures. With this patch, "dmidecode -t 1" (e.g., "-M virt-2.12,accel=kvm") will show: Handle 0x0100, DMI type 1, 27 bytes System Information Manufacturer: QEMU Product Name: KVM Virtual Machine Version: virt-2.12 Serial Number: Not Specified ... instead of: Handle 0x0100, DMI type 1, 27 bytes System Information Manufacturer: QEMU Product Name: KVM Virtual Machine Version: 1.0 Serial Number: Not Specified ... For backward compatibility, we allow older machine types to keep "1.0" as the default system version. Signed-off-by: Wei Huang Reviewed-by: Andrew Jones Message-id: 20180322212318.7182-1-wei@redhat.com Signed-off-by: Peter Maydell --- include/hw/arm/virt.h | 1 + hw/arm/virt.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) -- 2.16.2 diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 33b0ff3892..ba0c1a4faa 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -85,6 +85,7 @@ typedef struct { bool no_its; bool no_pmu; bool claim_edge_triggered_timers; + bool smbios_old_sys_ver; } VirtMachineClass; typedef struct { diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 2c07245047..94dcb125d3 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1132,6 +1132,8 @@ static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size) static void virt_build_smbios(VirtMachineState *vms) { + MachineClass *mc = MACHINE_GET_CLASS(vms); + VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms); uint8_t *smbios_tables, *smbios_anchor; size_t smbios_tables_len, smbios_anchor_len; const char *product = "QEMU Virtual Machine"; @@ -1145,7 +1147,8 @@ static void virt_build_smbios(VirtMachineState *vms) } smbios_set_defaults("QEMU", product, - "1.0", false, true, SMBIOS_ENTRY_POINT_30); + vmc->smbios_old_sys_ver ? "1.0" : mc->name, false, + true, SMBIOS_ENTRY_POINT_30); smbios_get_tables(NULL, 0, &smbios_tables, &smbios_tables_len, &smbios_anchor, &smbios_anchor_len); @@ -1646,8 +1649,11 @@ static void virt_2_11_instance_init(Object *obj) static void virt_machine_2_11_options(MachineClass *mc) { + VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); + virt_machine_2_12_options(mc); SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_11); + vmc->smbios_old_sys_ver = true; } DEFINE_VIRT_MACHINE(2, 11) From patchwork Fri Mar 23 18:49:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 132362 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp954116ljb; Fri, 23 Mar 2018 11:57:16 -0700 (PDT) X-Google-Smtp-Source: AG47ELvJKkgceAzJU/MIia6NM8VD0f8RuUYGaB7IH91GvQecbS3OT6IUNSUwec0nGn8lxZ8nxr2Y X-Received: by 10.55.125.194 with SMTP id y185mr42244128qkc.263.1521831436450; Fri, 23 Mar 2018 11:57:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521831436; cv=none; d=google.com; s=arc-20160816; b=dYCePH6iOc4RPw4/b+FsSZKalwKql8nfOlJuXOK9xkVv+ELKdchxo90uv09fI7lBTK Pk60FG4tLgY5YHZ9nE0pCT6iVPzphHTgdy1kNYuFYwYtKzb8b5AKjxgUrIOu3N6CTcZa 3oUGPmFKN6BaqWaA2CUjomzrYvmAVK36c5EoONsiXDdij28u9+jo+mpP8jCQ67rbyyki qE091J/Ix+s7VtPUJd/v8dbtlUbIgUA1R3juSwVAJhTXXrl+KRnmmtl5WeB3Wugc8EDV H09Q5R1MHRb7co9dDqY36RF263TIr0cDiitC3wc4whnElTcaKVHyNT8xQCZUe53xVjxm 5/uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:arc-authentication-results; bh=74OMlKPSOJRoIF8+JMGXxccCeOp40Y7a7xiQpcJ8EJY=; b=jlR8jRm3tHU19Zvjl5lUEKsknz8DAe2NJUPkuVDZyQiDkvHt+WsS+OpgWRcwWlqiJJ 1HTGO/1r4FPZg/KWCNGdNKTpa3JrhjmyF2scSVDVup9ZCgjn3+EMD7UNel4qvDcUQV3D b8EksUbt5Z2GBhwplZcRMiZrdoIPlF/3+dzAm9sZf+bjkvlN7Hkh023pcmvPjedPEJxh VcRAoT302wpgGRN9QDzPrA1EMP44inHyVGUIfjosoE6bI4qI5OACn/09c1mV8yXllnW4 RgwlFzqv4GPjd2s2Ct7CioPKW5cDUfZSXrwm4Osdw0dqg01/6aFawxwFpuCOhUFXq47j J3nA== ARC-Authentication-Results: i=1; mx.google.com; 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 h52si6138862qtc.390.2018.03.23.11.57.16 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 23 Mar 2018 11:57:16 -0700 (PDT) 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; 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]:39397 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezRsK-0006Fq-09 for patch@linaro.org; Fri, 23 Mar 2018 14:57:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezRlO-000198-Pv for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ezRlN-0004G7-JJ for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:06 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40512) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ezRlN-0004FG-Aq for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:05 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1ezRlM-0007gb-9d for qemu-devel@nongnu.org; Fri, 23 Mar 2018 18:50:04 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 23 Mar 2018 18:49:55 +0000 Message-Id: <20180323184958.14252-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323184958.14252-1-peter.maydell@linaro.org> References: <20180323184958.14252-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 07/10] target/arm: Honour MDCR_EL2.TDE when routing exceptions due to BKPT/BRK 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The MDCR_EL2.TDE bit allows the exception level targeted by debug exceptions to be set to EL2 for code executing at EL0. We handle this in the arm_debug_target_el() function, but this is only used for hardware breakpoint and watchpoint exceptions, not for the exception generated when the guest executes an AArch32 BKPT or AArch64 BRK instruction. We don't have enough information for a translate-time equivalent of arm_debug_target_el(), so instead make BKPT and BRK call a special purpose helper which can do the routing, rather than the generic exception_with_syndrome helper. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Message-id: 20180320134114.30418-2-peter.maydell@linaro.org --- target/arm/helper.h | 1 + target/arm/op_helper.c | 8 ++++++++ target/arm/translate-a64.c | 15 +++++++++++++-- target/arm/translate.c | 19 ++++++++++++++----- 4 files changed, 36 insertions(+), 7 deletions(-) -- 2.16.2 diff --git a/target/arm/helper.h b/target/arm/helper.h index 0d2094f2be..34e8cc8904 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -47,6 +47,7 @@ DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32) DEF_HELPER_2(exception_internal, void, env, i32) DEF_HELPER_4(exception_with_syndrome, void, env, i32, i32, i32) +DEF_HELPER_2(exception_bkpt_insn, void, env, i32) DEF_HELPER_1(setend, void, env) DEF_HELPER_2(wfi, void, env, i32) DEF_HELPER_1(wfe, void, env) diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 7a88fd2c92..4b123d2bd6 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -483,6 +483,14 @@ void HELPER(exception_with_syndrome)(CPUARMState *env, uint32_t excp, raise_exception(env, excp, syndrome, target_el); } +/* Raise an EXCP_BKPT with the specified syndrome register value, + * targeting the correct exception level for debug exceptions. + */ +void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome) +{ + raise_exception(env, EXCP_BKPT, syndrome, arm_debug_target_el(env)); +} + uint32_t HELPER(cpsr_read)(CPUARMState *env) { return cpsr_read(env) & ~(CPSR_EXEC | CPSR_RESERVED); diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 327513ef40..c91329249d 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -321,6 +321,18 @@ static void gen_exception_insn(DisasContext *s, int offset, int excp, s->base.is_jmp = DISAS_NORETURN; } +static void gen_exception_bkpt_insn(DisasContext *s, int offset, + uint32_t syndrome) +{ + TCGv_i32 tcg_syn; + + gen_a64_set_pc_im(s->pc - offset); + tcg_syn = tcg_const_i32(syndrome); + gen_helper_exception_bkpt_insn(cpu_env, tcg_syn); + tcg_temp_free_i32(tcg_syn); + s->base.is_jmp = DISAS_NORETURN; +} + static void gen_ss_advance(DisasContext *s) { /* If the singlestep state is Active-not-pending, advance to @@ -1839,8 +1851,7 @@ static void disas_exc(DisasContext *s, uint32_t insn) break; } /* BRK */ - gen_exception_insn(s, 4, EXCP_BKPT, syn_aa64_bkpt(imm16), - default_exception_el(s)); + gen_exception_bkpt_insn(s, 4, syn_aa64_bkpt(imm16)); break; case 2: if (op2_ll != 0) { diff --git a/target/arm/translate.c b/target/arm/translate.c index ba6ab7d287..fc03b5b8c8 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1248,6 +1248,18 @@ static void gen_exception_insn(DisasContext *s, int offset, int excp, s->base.is_jmp = DISAS_NORETURN; } +static void gen_exception_bkpt_insn(DisasContext *s, int offset, uint32_t syn) +{ + TCGv_i32 tcg_syn; + + gen_set_condexec(s); + gen_set_pc_im(s, s->pc - offset); + tcg_syn = tcg_const_i32(syn); + gen_helper_exception_bkpt_insn(cpu_env, tcg_syn); + tcg_temp_free_i32(tcg_syn); + s->base.is_jmp = DISAS_NORETURN; +} + /* Force a TB lookup after an instruction that changes the CPU state. */ static inline void gen_lookup_tb(DisasContext *s) { @@ -8774,9 +8786,7 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) case 1: /* bkpt */ ARCH(5); - gen_exception_insn(s, 4, EXCP_BKPT, - syn_aa32_bkpt(imm16, false), - default_exception_el(s)); + gen_exception_bkpt_insn(s, 4, syn_aa32_bkpt(imm16, false)); break; case 2: /* Hypervisor call (v7) */ @@ -11983,8 +11993,7 @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) { int imm8 = extract32(insn, 0, 8); ARCH(5); - gen_exception_insn(s, 2, EXCP_BKPT, syn_aa32_bkpt(imm8, true), - default_exception_el(s)); + gen_exception_bkpt_insn(s, 2, syn_aa32_bkpt(imm8, true)); break; } From patchwork Fri Mar 23 18:49:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 132365 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp955496ljb; Fri, 23 Mar 2018 11:58:59 -0700 (PDT) X-Google-Smtp-Source: AG47ELvuE7KUEBjowsL/RC+UdX5Nz0gOYpD0BjmIe8cY1qB43J3xI1P1NALxAzkXKgn34iKDYAw4 X-Received: by 10.237.48.161 with SMTP id 30mr42673519qtf.145.1521831539799; Fri, 23 Mar 2018 11:58:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521831539; cv=none; d=google.com; s=arc-20160816; b=roElZAgMbTHEhyd1O/YAfcWvTLhARX1x3SKzZhbcnKOinBVoIm7VXo5oz3+yPsIevb KpWav+9F7AuLXQHqLu2xHMWU+sMN8tChn67YHAYCw2fK8ETxKlClL++00+/AT4Iq4P+p BTVmV3D1pwlhMy4hJ+rm54Qd8Uw6W4Bd5lWuTQwdsX3BWpwsT27XdVa53uSeKjSycj1t 2S/j6bM/qfG+bUmqByNvJz1Iv2NP1Dz3wXB8AwswwNc8TbK6LG9J8QxPfp967dAZMBOH wKLMOZt7QW5hA1hY5BFFYM/6FYiIMls0UMAleBxyAuPalldwcNEFcbNsw500AMZ+xWam UY8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:arc-authentication-results; bh=XmX6hOjLsN8Zh+QaXnccJ0jUyr4BjVzBjaeaGNIHVQo=; b=j/4g+WIlQ30QKOa8aSVMWls5FAtzabB+wkc7uWclwSfTHc1Nw5bu5BfqB/b+LUQBjQ FNNLusfHwp9NElc3Q1PslkO2smFOIACd9H9xymRB+6D4zLHdZxtzB+x5+XrUyvKTl8x9 WWuQSJxOwEIF0uT2LpxrUuDFI6KzIu96eDsGGNuqLzGuO2KjW7nLHktLxAZ5YUR4TaJ1 qRREU2A0NAFydWjZOf5LAVUkRRCGY1npkbosNHZxIIEwmQqkIRqFMHJd+VdUl3/ONTV1 LY+U3tNMEPlrr61Z+FkEG33x0B71j/1TrQ1QjwbrmZivNdYm6oczwtCPZAgb+iwWhHQ5 Cblg== ARC-Authentication-Results: i=1; mx.google.com; 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 w36si10425452qta.192.2018.03.23.11.58.59 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 23 Mar 2018 11:58:59 -0700 (PDT) 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; 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]:39404 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezRtz-0007ft-8c for patch@linaro.org; Fri, 23 Mar 2018 14:58:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49178) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezRlR-00019N-C7 for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ezRlO-0004Gn-HZ for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:07 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40512) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ezRlO-0004FG-9u for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:06 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1ezRlM-0007gs-Va for qemu-devel@nongnu.org; Fri, 23 Mar 2018 18:50:04 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 23 Mar 2018 18:49:56 +0000 Message-Id: <20180323184958.14252-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323184958.14252-1-peter.maydell@linaro.org> References: <20180323184958.14252-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 08/10] target/arm: Factor out code to calculate FSR for debug exceptions 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" When a debug exception is taken to AArch32, it appears as a Prefetch Abort, and the Instruction Fault Status Register (IFSR) must be set. The IFSR has two possible formats, depending on whether LPAE is in use. Factor out the code in arm_debug_excp_handler() which picks an FSR value into its own utility function, update it to use arm_fi_to_lfsc() and arm_fi_to_sfsc() rather than hard-coded constants, and use the correct condition to select long or short format. In particular this fixes a bug where we could select the short format because we're at EL0 and the EL1 translation regime is not using LPAE, but then route the debug exception to EL2 because of MDCR_EL2.TDE and hand EL2 the wrong format FSR. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Message-id: 20180320134114.30418-3-peter.maydell@linaro.org --- target/arm/internals.h | 25 +++++++++++++++++++++++++ target/arm/op_helper.c | 12 ++---------- 2 files changed, 27 insertions(+), 10 deletions(-) -- 2.16.2 diff --git a/target/arm/internals.h b/target/arm/internals.h index 47cc224a46..8ce944b7a0 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -763,4 +763,29 @@ static inline bool regime_is_secure(CPUARMState *env, ARMMMUIdx mmu_idx) } } +/* Return the FSR value for a debug exception (watchpoint, hardware + * breakpoint or BKPT insn) targeting the specified exception level. + */ +static inline uint32_t arm_debug_exception_fsr(CPUARMState *env) +{ + ARMMMUFaultInfo fi = { .type = ARMFault_Debug }; + int target_el = arm_debug_target_el(env); + bool using_lpae = false; + + if (target_el == 2 || arm_el_is_aa64(env, target_el)) { + using_lpae = true; + } else { + if (arm_feature(env, ARM_FEATURE_LPAE) && + (env->cp15.tcr_el[target_el].raw_tcr & TTBCR_EAE)) { + using_lpae = true; + } + } + + if (using_lpae) { + return arm_fi_to_lfsc(&fi); + } else { + return arm_fi_to_sfsc(&fi); + } +} + #endif diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 4b123d2bd6..75efff9edf 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -1330,11 +1330,7 @@ void arm_debug_excp_handler(CPUState *cs) cs->watchpoint_hit = NULL; - if (extended_addresses_enabled(env)) { - env->exception.fsr = (1 << 9) | 0x22; - } else { - env->exception.fsr = 0x2; - } + env->exception.fsr = arm_debug_exception_fsr(env); env->exception.vaddress = wp_hit->hitaddr; raise_exception(env, EXCP_DATA_ABORT, syn_watchpoint(same_el, 0, wnr), @@ -1354,11 +1350,7 @@ void arm_debug_excp_handler(CPUState *cs) return; } - if (extended_addresses_enabled(env)) { - env->exception.fsr = (1 << 9) | 0x22; - } else { - env->exception.fsr = 0x2; - } + env->exception.fsr = arm_debug_exception_fsr(env); /* FAR is UNKNOWN, so doesn't need setting */ raise_exception(env, EXCP_PREFETCH_ABORT, syn_breakpoint(same_el), From patchwork Fri Mar 23 18:49:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 132363 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp954142ljb; Fri, 23 Mar 2018 11:57:17 -0700 (PDT) X-Google-Smtp-Source: AG47ELuYu8HVZgjOLsGTXZQOLFQtuFAzPSdrdLpb8tXB491nRuSonyPex9teV+rb7r2c3dJVjVFa X-Received: by 10.200.38.7 with SMTP id u7mr28082549qtu.269.1521831437764; Fri, 23 Mar 2018 11:57:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521831437; cv=none; d=google.com; s=arc-20160816; b=n2SlIrUAGFWOBfDP+nPRat1B/6Zb+dmqAMPw/Mys2UueQoTOXshgRYtjqt3/d3SgRY s3AOiRa1n0vCETOOPG8tDbe/bfVeF5fCg60kB9S4MQ3Clrqw5QSGZgQZ0HbFjUpBEXGr O9s6VwJHHP5HhB0KBFU9oPLw08NGTyxg3reVXnbmnaufFveeFDxGQnEzbqS6EhpoH6+P 2czgJUKvIPSVvM5wUuM9Y6hiG+fyticJkkKP2noUwFGClwpjfPM1lBDU5UIwK5R2QZYp IOp3Gm1hvwAlGOVE83HfZEJzcqAgpWFZ128vzffWk+p/aS/dZlK1hNu/sGhufdma65R1 khFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:arc-authentication-results; bh=KPkUs7ZBMsr+1rvB66W/lPUGep2rseCGlUdU/KfzHIQ=; b=MAEeUYqf2EPrx65NGJ9YprnyAWWNSF/vgAQ7m3iTA9/OQnAsw981276cn0ZuZLkaFr AWz5UhaZaZWpe1D1ibtt8bJD0kGp/fK45n467MA2yNgWmughJ5UuGOO9vOWpnz9iUrQZ r2QYztr3vOTStt/7a8fP9IkimHUa12GfFljGbRtM7r4/UK7akdZAnNfIJ2RscsICldZR w3bpfDGj6tJz931bNVVqUJVekjOEV241FTuU92ho6MFgIp1pzozbns7ceMZ+5xYVcTvJ bDCeYD0CqM1G5H8znXX9NoFfHJX4Bgllt6scue3RPkZjVDpvI0Gr2eIPaU/4845/eNqL wKBA== ARC-Authentication-Results: i=1; mx.google.com; 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 c20si1832631qtb.476.2018.03.23.11.57.17 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 23 Mar 2018 11:57:17 -0700 (PDT) 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; 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]:39398 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezRsL-0006H1-9G for patch@linaro.org; Fri, 23 Mar 2018 14:57:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezRlR-00019O-C5 for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ezRlP-0004H9-04 for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:08 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40514) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ezRlO-0004GT-PS for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:06 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1ezRlN-0007hX-Mt for qemu-devel@nongnu.org; Fri, 23 Mar 2018 18:50:05 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 23 Mar 2018 18:49:57 +0000 Message-Id: <20180323184958.14252-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323184958.14252-1-peter.maydell@linaro.org> References: <20180323184958.14252-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 09/10] target/arm: Set FSR for BKPT, BRK when raising exception 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Now that we have a helper function specifically for the BRK and BKPT instructions, we can set the exception.fsr there rather than in arm_cpu_do_interrupt_aarch32(). This allows us to use our new arm_debug_exception_fsr() helper. In particular this fixes a bug where we were hardcoding the short-form IFSR value, which is wrong if the target exception level has LPAE enabled. Fixes: https://bugs.launchpad.net/qemu/+bug/1756927 Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Message-id: 20180320134114.30418-4-peter.maydell@linaro.org --- target/arm/helper.c | 1 - target/arm/op_helper.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) -- 2.16.2 diff --git a/target/arm/helper.c b/target/arm/helper.c index 09893e3f72..dcb8476d9e 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -7910,7 +7910,6 @@ static void arm_cpu_do_interrupt_aarch32(CPUState *cs) offset = 0; break; case EXCP_BKPT: - env->exception.fsr = 2; /* Fall through to prefetch abort. */ case EXCP_PREFETCH_ABORT: A32_BANKED_CURRENT_REG_SET(env, ifsr, env->exception.fsr); diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 75efff9edf..8e1e521193 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -488,6 +488,8 @@ void HELPER(exception_with_syndrome)(CPUARMState *env, uint32_t excp, */ void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome) { + /* FSR will only be used if the debug target EL is AArch32. */ + env->exception.fsr = arm_debug_exception_fsr(env); raise_exception(env, EXCP_BKPT, syndrome, arm_debug_target_el(env)); } From patchwork Fri Mar 23 18:49:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 132364 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp954352ljb; Fri, 23 Mar 2018 11:57:33 -0700 (PDT) X-Google-Smtp-Source: AG47ELsKh4KHw5VuA8DDd7xQ0104FbxgWBkCd0cQeEx13e+799chz0fgkRq2NnGYDHNOUYoKPdLU X-Received: by 10.55.217.145 with SMTP id q17mr43768728qkl.302.1521831453535; Fri, 23 Mar 2018 11:57:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521831453; cv=none; d=google.com; s=arc-20160816; b=gR7ccFGz46K4FQh3iKmtnPPAaQBYs2D4NuZtP2mtP4cuga/rOIHKRd9DSI8mcUaPDP 3+CklA1EiPnxxW9orZY2NpzLRXmcEi9rubTXKpaxswh7tVYsV7XlTW8TK1jBiNNlU6si nF6EDZpmal3sX1g6Q7KD7zIhWhhQaqv8DFeqzReEekqpCrh00McORfrvKH8Bb+jHvWJl 7pGJjX1iZ/EbXNEBU71ET3XCzWZojsmjvYBsewAeCNWjGabwQyv8rlOi7YrdriApMqps PnHjcvlYx6anEhAdY6lBc1qAe4/e9Y0kCQynhv6g6qtNLpU7hiowqRNxgqcabKfB0Vx3 vmuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:arc-authentication-results; bh=NZpaYC8t7YT+KGCkoNB38GNF7wjnuvt6WfeGNUQ82+E=; b=AJ0UxZTx0PNu+c7oM8MibG1E9Irw26GZg/WLNyaS2WT0x4IwsdoeOyKXtKvf3HPIea u3o8qWTwDn+RJKpJwttIM6OLXNUKCzJTFXrjnbaGZ6ddKcCv18G9XhQcxkroAG834H/2 piwmvdHfZcrUmA/8dRg5ZTAfymsKddOD9xUzy3asgMKGXgeM4EuAfLRUKnCUFYKRBGeG ElgGMoXc26uJUClHFMLoHLvd3tz/USaq377sSpvx8oEqAL2m7VC7moKw7uasP+DlH2sq mM0fNRmPNxL0P5Fa7E0LdbI2uZOI5sM1xpyWDqFuOvLUNoKg/V3Wej1Abdo5tZB3eMXb zL6g== ARC-Authentication-Results: i=1; mx.google.com; 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 n23si6101826qtn.198.2018.03.23.11.57.33 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 23 Mar 2018 11:57:33 -0700 (PDT) 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; 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]:39401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezRsb-0006xP-1d for patch@linaro.org; Fri, 23 Mar 2018 14:57:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49188) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezRlR-00019P-C5 for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ezRlP-0004Hi-TD for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:09 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40514) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ezRlP-0004GT-M7 for qemu-devel@nongnu.org; Fri, 23 Mar 2018 14:50:07 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1ezRlO-0007ho-DG for qemu-devel@nongnu.org; Fri, 23 Mar 2018 18:50:06 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 23 Mar 2018 18:49:58 +0000 Message-Id: <20180323184958.14252-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323184958.14252-1-peter.maydell@linaro.org> References: <20180323184958.14252-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 10/10] target/arm: Always set FAR to a known unknown value for debug exceptions 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" For debug exceptions due to breakpoints or the BKPT instruction which are taken to AArch32, the Fault Address Register is architecturally UNKNOWN. We were using that as license to simply not set env->exception.vaddress, but this isn't correct, because it will expose to the guest whatever old value was in that field when arm_cpu_do_interrupt_aarch32() writes it to the guest IFSR. That old value might be a FAR for a previous guest EL2 or secure exception, in which case we shouldn't show it to an EL1 or non-secure exception handler. It might also be a non-deterministic value, which is bad for record-and-replay. Clear env->exception.vaddress before taking breakpoint debug exceptions, to avoid this minor information leak. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Message-id: 20180320134114.30418-5-peter.maydell@linaro.org --- target/arm/op_helper.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) -- 2.16.2 diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 8e1e521193..a266cc0116 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -490,6 +490,11 @@ void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome) { /* FSR will only be used if the debug target EL is AArch32. */ env->exception.fsr = arm_debug_exception_fsr(env); + /* FAR is UNKNOWN: clear vaddress to avoid potentially exposing + * values to the guest that it shouldn't be able to see at its + * exception/security level. + */ + env->exception.vaddress = 0; raise_exception(env, EXCP_BKPT, syndrome, arm_debug_target_el(env)); } @@ -1353,7 +1358,11 @@ void arm_debug_excp_handler(CPUState *cs) } env->exception.fsr = arm_debug_exception_fsr(env); - /* FAR is UNKNOWN, so doesn't need setting */ + /* FAR is UNKNOWN: clear vaddress to avoid potentially exposing + * values to the guest that it shouldn't be able to see at its + * exception/security level. + */ + env->exception.vaddress = 0; raise_exception(env, EXCP_PREFETCH_ABORT, syn_breakpoint(same_el), arm_debug_target_el(env));