From patchwork Tue Apr 10 12:17:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 133083 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1243139ljb; Tue, 10 Apr 2018 05:27:12 -0700 (PDT) X-Google-Smtp-Source: AIpwx48m8ZNCpcYpDp8MRsvtTdWQn0I0+W0lCnQzcWi9ZyE2oUBqej4v5CivMrKKP2zjjVoaS7gI X-Received: by 10.55.45.131 with SMTP id t125mr291651qkh.10.1523363232725; Tue, 10 Apr 2018 05:27:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523363232; cv=none; d=google.com; s=arc-20160816; b=ZxqgbsIX0rXZTvPjWkJvnH0eULglmmMb2O8FvTAxAuifncB9VDJPJZivXAny6MNvym gqssTXH4QnvB1gyaVMqfoZigsv9Jhor6djyZu+9CmB1LByh4MtJn4T/YgTvRRlbe/+yg gitacAV7AaUO4CJ6czisDtSoDdqHd4TET7KrOFuQN1o+ri3ixauVsBoX9YZCNwIVzwQx rxeWF8PfcxEK4ofp0gIESHAtLDtF+Y4dl2nnc8kIlJ+adXfRBD+LwqIUZAoID09Lik7L CZy3aWE5N1P4h4icxAcjjv5LsmzlGM//cgLLASa1fPrAhOHOHFT35OIm58CTmpTOoj3v ECLQ== 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=pfyANCl2PNZ20B4IZN2IcJv/GodzgoS6Ojm8Jzf7SJo=; b=FUguZ/vEcAdKHnWgpB3HO+dq74nXlDNlf+33bl4AKm+8GP31VqGKET2lKbQTwQCH40 eVByLnU4MxWJJoZFnfzoOPnl2PyvIgu2cUOSZUIOiaSGZcHB0y1lPApXECYsIwdsxHPA ML8CMjlm0uYTBVG4bTFh273jfo70Z8D7fVpO6KasrF2UOZAgqXrBqdfWVSavjFIyCE87 SSFMFrnYj95gQObtlf3/VilnFPZaswY264OmsmAQx556kyi9ox6qNCzd1vQCUZ9jbqjj zYUAD0qwSlo1ljkSsGovEuXkGpmztdlcefUNpX4MH4GfJQBngc+9Xon+9MYPizKO9/+y +0Pw== 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 q7si3290671qtk.325.2018.04.10.05.27.12 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 10 Apr 2018 05:27:12 -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]:40748 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sMi-0007z9-64 for patch@linaro.org; Tue, 10 Apr 2018 08:27:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sDV-0007wf-EJ for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5sDU-0000lz-GU for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:41 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40762) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f5sDU-0000iH-7E for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:40 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1f5sDH-0007ZG-58 for qemu-devel@nongnu.org; Tue, 10 Apr 2018 13:17:27 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 10 Apr 2018 13:17:13 +0100 Message-Id: <20180410121724.8549-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180410121724.8549-1-peter.maydell@linaro.org> References: <20180410121724.8549-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 01/12] hw/arm: Allow manually specified /psci node 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: Andrey Smirnov Change the code to avoid exiting QEMU if user provided DTB contains manually specified /psci node and skip any /psci related fixups instead. Fixes: 4cbca7d9b4 ("hw/arm: Move virt's PSCI DT fixup code to arm/boot.c") Signed-off-by: Andrey Smirnov Reported-by: Marc Zyngier Tested-by: Marc Zyngier Message-id: 20180402205654.14572-1-andrew.smirnov@gmail.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/arm/boot.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.16.2 diff --git a/hw/arm/boot.c b/hw/arm/boot.c index 9319b12fcd..26184bcd7c 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -422,6 +422,7 @@ static void fdt_add_psci_node(void *fdt) ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(0)); const char *psci_method; int64_t psci_conduit; + int rc; psci_conduit = object_property_get_int(OBJECT(armcpu), "psci-conduit", @@ -439,6 +440,15 @@ static void fdt_add_psci_node(void *fdt) g_assert_not_reached(); } + /* + * If /psci node is present in provided DTB, assume that no fixup + * is necessary and all PSCI configuration should be taken as-is + */ + rc = fdt_path_offset(fdt, "/psci"); + if (rc >= 0) { + return; + } + qemu_fdt_add_subnode(fdt, "/psci"); if (armcpu->psci_version == 2) { const char comp[] = "arm,psci-0.2\0arm,psci"; From patchwork Tue Apr 10 12:17:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 133081 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1242865ljb; Tue, 10 Apr 2018 05:26:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+w9GmDKZTvj7bD2dBOo5FOWXfyMIy4VeDOPmN4QvqCx/7lHlJyCtfWxzDPXMoSi4Gzes55 X-Received: by 10.55.128.67 with SMTP id b64mr297148qkd.78.1523363211266; Tue, 10 Apr 2018 05:26:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523363211; cv=none; d=google.com; s=arc-20160816; b=tWYzJlbJASG9s6Rh6k0L2fnJ+1wiXRlUd5h3x/kIJM3sSRotMrlpYjlprPssrYfNP9 DqtZWWY8hEkmg4mddbrb/H0nH1lvO0EdLddzxdaxnE1FXFGvfuxM+sHQ7XwG0EYo6oDH maC1c+RKcNyUyBn7+jVnLaQab+pVAfP9rVujSobO2tuAxtzg9J65Mo4oelmaP4EUcBj9 +HTAj+/5kztMHcI27zHB0fKltkOKxyiJTh9CUiRP2W4bPi7hfAU8e7te2KUw7Sm7d7P2 OV7T1uSiaVuv3XbREEEdrGgy/8VLzwyQq3O/ykubPzdxx5Y/c8/nt1sjM4UjKuNC/Vyg Va5g== 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=lETdiqBRR1tj4hIoCiEBXr2JiK12wAMS9USe0Rx+EB8=; b=gvElI4G3nkLfLnBSOiEY/SD6Is6/WIpxOo6GrggLTHheCbAM6Ttj4XGg48w1Ny9r6r kSJjNxSjNtCeEMPjW8AJ0yia3MoKuhJak/rQ3Mq16LQltygyWoGefZ9f2VWY4vhAEec+ VcIP7BRO7fOAhNkyBNGf+Y8F5gdugTk64O/HKo7WkUge6vhd2i8hgzLsc++Oazs1TcpG /msA6qa97URI5uIyGvMx4WZNYdkocR53Y5GjFudzxRHYZad7eozjh+GQ9toXnuf64KEQ pRc0bRikHAgMxJtwLu94Bd6QkyugjqgQaZ0B/i5rJMPCJI7BEmg+h6nDE8pqPOi47gut JO8w== 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 t14si547253qkj.5.2018.04.10.05.26.51 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 10 Apr 2018 05:26:51 -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]:40729 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sMM-00070s-MN for patch@linaro.org; Tue, 10 Apr 2018 08:26:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57004) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sDV-0007w9-2W for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5sDT-0000lI-UL for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:41 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40760) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f5sDT-0000er-Mh for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:39 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1f5sDH-0007Zr-TM for qemu-devel@nongnu.org; Tue, 10 Apr 2018 13:17:27 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 10 Apr 2018 13:17:14 +0100 Message-Id: <20180410121724.8549-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180410121724.8549-1-peter.maydell@linaro.org> References: <20180410121724.8549-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 02/12] hw/arm/integratorcp: Don't do things that could be fatal in the instance_init 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: Thomas Huth An instance_init function must not fail - and might be called multiple times, e.g. during device introspection with the 'device-list-properties' QMP command. Since the integratorcm device ignores this rule, QEMU currently aborts in this case (though it really should not): echo "{'execute':'qmp_capabilities'}"\ "{'execute':'device-list-properties',"\ "'arguments':{'typename':'integrator_core'}}" \ | arm-softmmu/qemu-system-arm -M integratorcp,accel=qtest -qmp stdio {"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2}, "package": "build-all"}, "capabilities": []}} {"return": {}} RAMBlock "integrator.flash" already registered, abort! Aborted (core dumped) Move the problematic code to the realize() function instead to fix this problem. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Thomas Huth Message-id: 1522906473-11252-1-git-send-email-thuth@redhat.com Signed-off-by: Peter Maydell --- hw/arm/integratorcp.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) -- 2.16.2 diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c index e8303b83be..58b40efc19 100644 --- a/hw/arm/integratorcp.c +++ b/hw/arm/integratorcp.c @@ -266,7 +266,6 @@ static const MemoryRegionOps integratorcm_ops = { static void integratorcm_init(Object *obj) { IntegratorCMState *s = INTEGRATOR_CM(obj); - SysBusDevice *dev = SYS_BUS_DEVICE(obj); s->cm_osc = 0x01000048; /* ??? What should the high bits of this value be? */ @@ -276,20 +275,28 @@ static void integratorcm_init(Object *obj) s->cm_init = 0x00000112; s->cm_refcnt_offset = muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), 24, 1000); - memory_region_init_ram(&s->flash, obj, "integrator.flash", 0x100000, - &error_fatal); - memory_region_init_io(&s->iomem, obj, &integratorcm_ops, s, - "integratorcm", 0x00800000); - sysbus_init_mmio(dev, &s->iomem); - - integratorcm_do_remap(s); /* ??? Save/restore. */ } static void integratorcm_realize(DeviceState *d, Error **errp) { IntegratorCMState *s = INTEGRATOR_CM(d); + SysBusDevice *dev = SYS_BUS_DEVICE(d); + Error *local_err = NULL; + + memory_region_init_ram(&s->flash, OBJECT(d), "integrator.flash", 0x100000, + &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + + memory_region_init_io(&s->iomem, OBJECT(d), &integratorcm_ops, s, + "integratorcm", 0x00800000); + sysbus_init_mmio(dev, &s->iomem); + + integratorcm_do_remap(s); if (s->memsz >= 256) { integrator_spd[31] = 64; From patchwork Tue Apr 10 12:17:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 133082 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1242868ljb; Tue, 10 Apr 2018 05:26:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/m+C+LsYYKN+3zfaLxvNoGQzsyyMu96Rv/ZJVwEjC7kTZ2Pz84ucI/PlbUVGSDyEvDfsX8 X-Received: by 10.200.112.71 with SMTP id y7mr302289qtm.208.1523363211872; Tue, 10 Apr 2018 05:26:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523363211; cv=none; d=google.com; s=arc-20160816; b=dCvQ0rNpVeND1HdiPx1k4PSXC/+Xz0tQXBBY5KhOuVCNVR7RgNwB4nMKUHXeNvIZWv fwEpDT+6Q9l6NZhnClPf/q6e7UZTZAA6drgmowpFcvO9375t3CokKrP/xQAcPrqf97j7 5EUL/ZRa6KAFPRtUb4zUM/5EM1TuEtfnxxYJECZsRdCBp/qU7UY3B1Mneu/xDB69zNjm RV51XeWK4Q6LVGBqSalfxn2OscRf0/BjSHeWASVw1koKsXfepYw8mr0O7X6lfRqYCnsJ qrjSOM5VqRORC4NDbQKnVbEcM5laLOIHUUJkyS9ka3gtwIgCeYRNZo2LEoRvNa2rOi8T 9Zcw== 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=TV6OPiQSRFkEJAy7kmpf7niluOb92774QkZUqYWyqho=; b=JVZtS7xt6zkQRgkORtlLULu83Co2VJtvcTVX1MxGK4BZFxwfbkk4ibw0xHXgM21hcv eFBXwS3poLqDUXmxpSHdnH5pM0Pj+X6CA4Dw5YtNu3c4sYyiWHi3Wo/QxDRE3Zj/c47g 8qQcQdQLxqqmPdZX7vCR8DZZigPF4cJCIKvtineREK7ZgzvJBDOXVavW+JgqG3f/voX9 Tith1WXlT8stmpEBUZbyWYbHfHJAE0JjIkbclvWnL6CZdH/IX2RjbDGI+XhMblJmjLMw cPm2op7m6k/KhkL5yYBNxqLnai2T6owWDaF4bj1spwN2s/TxUX572FWvWez4uiL9XJOk fS6Q== 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 27si1072252qtu.362.2018.04.10.05.26.51 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 10 Apr 2018 05:26:51 -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]:40730 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sMN-000723-8w for patch@linaro.org; Tue, 10 Apr 2018 08:26:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sDU-0007vc-Bs for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5sDT-0000kr-GY for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:40 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40762) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f5sDT-0000iH-9X for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:39 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1f5sDI-0007aN-PO for qemu-devel@nongnu.org; Tue, 10 Apr 2018 13:17:28 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 10 Apr 2018 13:17:15 +0100 Message-Id: <20180410121724.8549-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180410121724.8549-1-peter.maydell@linaro.org> References: <20180410121724.8549-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/12] target-arm: Check undefined opcodes for SWP in A32 decoder 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: Onur Sahin Make sure we are not treating architecturally Undefined instructions as a SWP, by verifying the opcodes as per section A8.8.229 of ARMv7-A specification. Bits [21:20] must be zero for this to be a SWP or SWPB. We also choose to UNDEF for the architecturally UNPREDICTABLE case of bits [11:8] not being zero. Signed-off-by: Onur Sahin [PMM: tweaked commit message] Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/translate.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- 2.16.2 diff --git a/target/arm/translate.c b/target/arm/translate.c index fc03b5b8c8..db1ce6510a 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -9237,11 +9237,14 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) } } tcg_temp_free_i32(addr); - } else { + } else if ((insn & 0x00300f00) == 0) { + /* 0bcccc_0001_0x00_xxxx_xxxx_0000_1001_xxxx + * - SWP, SWPB + */ + TCGv taddr; TCGMemOp opc = s->be_data; - /* SWP instruction */ rm = (insn) & 0xf; if (insn & (1 << 22)) { @@ -9259,6 +9262,8 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) get_mem_index(s), opc); tcg_temp_free(taddr); store_reg(s, rd, tmp); + } else { + goto illegal_op; } } } else { From patchwork Tue Apr 10 12:17:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 133074 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1237803ljb; Tue, 10 Apr 2018 05:20:55 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/+FNzPxOgMY+8bT1H3Z5GBftxYIH1YBLYdCtLvM6HU/nE9CSBYSEuEB/wYGJ0uVYYOIPUR X-Received: by 10.55.78.199 with SMTP id c190mr244382qkb.166.1523362855026; Tue, 10 Apr 2018 05:20:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523362855; cv=none; d=google.com; s=arc-20160816; b=EjCm2iHyOsp/oz/c3Zj9Jp1mknAmyAhFu1/6NrQlVtzNOLn7CwHKI6qzu6PXf2wYlX Fiun92AQ1Qw/m1ANznQMQwRI2AIpkgWaFeEXHj03E18kIw5+hFMs2IkCcKPNKYFcD3Ji cidJVuUAJgu3yCdwDPrxClLt2tgvwfSlaa4Z2xfUmkTB+7goqbrmWjPsNbKyonHvxjqc mNw8DSeslaDxVUGf3AvgWsvGjUBhmQ7eX5yubONUFigoXQbMjg0Ix1GBHaQcVp0Udaz8 1Xz3RhZPNqO5l7Bci/aizb76jR4E4MeVOr+XP/Bzybd2JRM9FOHFIjvzs89BsctKMZXp reiA== 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=aP65sYbnFABIVBzvpTQ+zSLcpnC3hD1WnazRV1fGH/4=; b=uAgI4qOROUaq1AM9Qpykgww9jlkddvrP/Hvt4j9ynHY+Tnd6d7i8PRql7Ajcehf1PL vZMfqpFWuLNy28dfKMwW8fSJkdYIuGbkzH/RspMrbEXeIudSKQ7QYvA37lBKaNDnnCsN 1dxPnkLO0DMIBFHG7svvo1tXPvXBFE3+PCelfl2JzwAR/TmIfoXKBIjTJ14yNshlnXCj e4kkKPWHO0DP5JTmfBlUqu4YB8YjkDdyxykzbHwtYIHZP+fu70jGbAonOi+Qm/1ZSnAy CsW3PJjVGU0SbwogVwrA4bh3ApVoq73TR2ryyHvgRpLVhIqLFuN2vGrUwqpn86ryJkQA qTBQ== 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 s123si3122117qke.479.2018.04.10.05.20.54 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 10 Apr 2018 05:20:55 -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]:40583 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sGc-0000pn-Bk for patch@linaro.org; Tue, 10 Apr 2018 08:20:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sDU-0007va-9H for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5sDT-0000kT-0M for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:40 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40760) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f5sDS-0000er-PS for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:38 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1f5sDJ-0007ap-GK for qemu-devel@nongnu.org; Tue, 10 Apr 2018 13:17:29 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 10 Apr 2018 13:17:16 +0100 Message-Id: <20180410121724.8549-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180410121724.8549-1-peter.maydell@linaro.org> References: <20180410121724.8549-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/12] hw/sd/bcm2835_sdhost: Add tracepoints 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" Add some tracepoints to the bcm2835_sdhost driver, to assist debugging. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Tested-by: Gerd Hoffmann Message-id: 20180319161556.16446-2-peter.maydell@linaro.org --- hw/sd/bcm2835_sdhost.c | 10 ++++++++++ hw/sd/trace-events | 6 ++++++ 2 files changed, 16 insertions(+) -- 2.16.2 diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c index f7f4e656df..79f3c5ceeb 100644 --- a/hw/sd/bcm2835_sdhost.c +++ b/hw/sd/bcm2835_sdhost.c @@ -15,6 +15,7 @@ #include "qemu/log.h" #include "sysemu/blockdev.h" #include "hw/sd/bcm2835_sdhost.h" +#include "trace.h" #define TYPE_BCM2835_SDHOST_BUS "bcm2835-sdhost-bus" #define BCM2835_SDHOST_BUS(obj) \ @@ -99,6 +100,7 @@ static void bcm2835_sdhost_update_irq(BCM2835SDHostState *s) { uint32_t irq = s->status & (SDHSTS_BUSY_IRPT | SDHSTS_BLOCK_IRPT | SDHSTS_SDIO_IRPT); + trace_bcm2835_sdhost_update_irq(irq); qemu_set_irq(s->irq, !!irq); } @@ -211,6 +213,7 @@ static void bcm2835_sdhost_fifo_run(BCM2835SDHostState *s) s->edm &= ~0xf; s->edm |= SDEDM_FSM_DATAMODE; + trace_bcm2835_sdhost_edm_change("datacnt 0", s->edm); if (s->config & SDHCFG_DATA_IRPT_EN) { s->status |= SDHSTS_SDIO_IRPT; @@ -229,6 +232,7 @@ static void bcm2835_sdhost_fifo_run(BCM2835SDHostState *s) s->edm &= ~(0x1f << 4); s->edm |= ((s->fifo_len & 0x1f) << 4); + trace_bcm2835_sdhost_edm_change("fifo run", s->edm); } static uint64_t bcm2835_sdhost_read(void *opaque, hwaddr offset, @@ -280,6 +284,8 @@ static uint64_t bcm2835_sdhost_read(void *opaque, hwaddr offset, break; } + trace_bcm2835_sdhost_read(offset, res, size); + return res; } @@ -288,6 +294,8 @@ static void bcm2835_sdhost_write(void *opaque, hwaddr offset, { BCM2835SDHostState *s = (BCM2835SDHostState *)opaque; + trace_bcm2835_sdhost_write(offset, value, size); + switch (offset) { case SDCMD: s->cmd = value; @@ -314,6 +322,7 @@ static void bcm2835_sdhost_write(void *opaque, hwaddr offset, value &= ~0xf; } s->edm = value; + trace_bcm2835_sdhost_edm_change("guest register write", s->edm); break; case SDHCFG: s->config = value; @@ -390,6 +399,7 @@ static void bcm2835_sdhost_reset(DeviceState *dev) s->cmd = 0; s->cmdarg = 0; s->edm = 0x0000c60f; + trace_bcm2835_sdhost_edm_change("device reset", s->edm); s->config = 0; s->hbct = 0; s->hblc = 0; diff --git a/hw/sd/trace-events b/hw/sd/trace-events index 2059ace61f..bfd1d62efc 100644 --- a/hw/sd/trace-events +++ b/hw/sd/trace-events @@ -1,5 +1,11 @@ # See docs/devel/tracing.txt for syntax documentation. +# hw/sd/bcm2835_sdhost.c +bcm2835_sdhost_read(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" +bcm2835_sdhost_write(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" +bcm2835_sdhost_edm_change(const char *why, uint32_t edm) "(%s) EDM now 0x%x" +bcm2835_sdhost_update_irq(uint32_t irq) "IRQ bits 0x%x\n" + # hw/sd/core.c sdbus_command(const char *bus_name, uint8_t cmd, uint32_t arg, uint8_t crc) "@%s CMD%02d arg 0x%08x crc 0x%02x" sdbus_read(const char *bus_name, uint8_t value) "@%s value 0x%02x" From patchwork Tue Apr 10 12:17:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 133078 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1240411ljb; Tue, 10 Apr 2018 05:24:02 -0700 (PDT) X-Google-Smtp-Source: AIpwx49+Rz7wG1LEnkO1FxKciv3eifWubpio5r1ITB6JudaGYC3dBfvy46PgR/0eycWEDkYaKXoF X-Received: by 10.55.159.17 with SMTP id i17mr255734qke.162.1523363042461; Tue, 10 Apr 2018 05:24:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523363042; cv=none; d=google.com; s=arc-20160816; b=d3Jes6v+E6StqoFOBq98H/6e8CB8GdluPuyqyKjGRxcyPqjB2Vn+1R7Y3/H0LUcal2 eVd93ONhWgdpKthLWewEUyarcRCAzi+vCQM3k+VCBabmnkjDflTWzVfmzSvFZs4W5BOn 5RH3RopZzrXsJ6fgqltht0dOYS6rNR+OkxRJdZJj4UtE4wiYL7D21G0I5IlmT16MPMNs mPTGcS/Rol46+H15tXEHlPCMYRKb8lj9Dm3IRZeiCpUTrjJZgCzh2l0Egs/llp9TJ/W7 AI31AtMZk3eVUZ+pTlN5nnPCJYnF0afKekvJPkf1whn2lHy0cqcHGpEgwDX0lztVhWXs uQSQ== 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=pQ58w1nkV0G5md0yLOv7gIVBJluO8lgw0mtybEghFuM=; b=xFekrATXxa7bANqkcGEb/tPZy/kdjqQabanKEQl+EeLOHWMUMdmF9K6Avcur99viKN m4g9k2JmezvIyXZ761wRUrEbXpwWR21uJgiNfPWsL63bLpNgNVOctWLJciN3jPUXbGJi Z83EaY3T6WiQoF7Z3g4S3rxVpKui6DPqAyCmmM+jTwS8SgM34DnJV3YHimGyCtDPHVxD R2DtdED+QQ/OJQykMFBescKHV6mo2ajwjHOZdNEQztGWA2LOJ6QmF8rCyezLiYWqzPk/ FFsR3jGc+AgNLkcUlpVSFe6IC5vC7UBvUMNjAzVyC7hJTrXiaPItT3Mk7VUIVzF3PuOm zftw== 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 m18si3248290qtb.22.2018.04.10.05.24.02 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 10 Apr 2018 05:24:02 -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]:40602 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sJd-0003so-Pp for patch@linaro.org; Tue, 10 Apr 2018 08:24:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56950) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sDT-0007v9-MM for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5sDS-0000kB-Iq for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:39 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40762) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f5sDS-0000iH-Av for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:38 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1f5sDK-0007bH-7T for qemu-devel@nongnu.org; Tue, 10 Apr 2018 13:17:30 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 10 Apr 2018 13:17:17 +0100 Message-Id: <20180410121724.8549-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180410121724.8549-1-peter.maydell@linaro.org> References: <20180410121724.8549-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 05/12] hw/sd/bcm2835_sdhost: Don't raise spurious interrupts 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 Linux bcm2835_sdhost driver doesn't work on QEMU, because our model raises spurious data interrupts. Our function bcm2835_sdhost_fifo_run() will flag an interrupt any time it is called with s->datacnt == 0, even if the host hasn't actually issued a data read or write command yet. This means that the driver gets a spurious data interrupt as soon as it enables IRQs and then does something else that causes us to call the fifo_run routine, like writing to SDHCFG, and before it does the write to SDCMD to issue the read. The driver's IRQ handler then spins forever complaining that there's no data and the SD controller isn't in a state where there's going to be any data: [ 41.040738] sdhost-bcm2835 3f202000.mmc: fsm 1, hsts 00000000 [ 41.042059] sdhost-bcm2835 3f202000.mmc: fsm 1, hsts 00000000 (continues forever). Move the interrupt flag setting to more plausible places: * for BUSY, raise this as soon as a BUSYWAIT command has executed * for DATA, raise this when the FIFO has any space free (for a write) or any data in it (for a read) * for BLOCK, raise this when the data count is 0 and we've actually done some reading or writing This is pure guesswork since the documentation for this hardware is not public, but it is sufficient to get the Linux bcm2835_sdhost driver to work. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Tested-by: Gerd Hoffmann Message-id: 20180319161556.16446-3-peter.maydell@linaro.org --- hw/sd/bcm2835_sdhost.c | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) -- 2.16.2 diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c index 79f3c5ceeb..ebf3b926c2 100644 --- a/hw/sd/bcm2835_sdhost.c +++ b/hw/sd/bcm2835_sdhost.c @@ -137,6 +137,12 @@ static void bcm2835_sdhost_send_command(BCM2835SDHostState *s) } #undef RWORD } + /* We never really delay commands, so if this was a 'busywait' command + * then we've completed it now and can raise the interrupt. + */ + if ((s->cmd & SDCMD_BUSYWAIT) && (s->config & SDHCFG_BUSY_IRPT_EN)) { + s->status |= SDHSTS_BUSY_IRPT; + } return; error: @@ -187,18 +193,27 @@ static void bcm2835_sdhost_fifo_run(BCM2835SDHostState *s) n++; if (n == 4) { bcm2835_sdhost_fifo_push(s, value); + s->status |= SDHSTS_DATA_FLAG; + if (s->config & SDHCFG_DATA_IRPT_EN) { + s->status |= SDHSTS_SDIO_IRPT; + } n = 0; value = 0; } } if (n != 0) { bcm2835_sdhost_fifo_push(s, value); + s->status |= SDHSTS_DATA_FLAG; } } else { /* write */ n = 0; while (s->datacnt > 0 && (s->fifo_len > 0 || n > 0)) { if (n == 0) { value = bcm2835_sdhost_fifo_pop(s); + s->status |= SDHSTS_DATA_FLAG; + if (s->config & SDHCFG_DATA_IRPT_EN) { + s->status |= SDHSTS_SDIO_IRPT; + } n = 4; } n--; @@ -207,28 +222,19 @@ static void bcm2835_sdhost_fifo_run(BCM2835SDHostState *s) value >>= 8; } } + if (s->datacnt == 0) { + s->edm &= ~SDEDM_FSM_MASK; + s->edm |= SDEDM_FSM_DATAMODE; + trace_bcm2835_sdhost_edm_change("datacnt 0", s->edm); + + if ((s->cmd & SDCMD_WRITE_CMD) && + (s->config & SDHCFG_BLOCK_IRPT_EN)) { + s->status |= SDHSTS_BLOCK_IRPT; + } + } } - if (s->datacnt == 0) { - s->status |= SDHSTS_DATA_FLAG; - s->edm &= ~0xf; - s->edm |= SDEDM_FSM_DATAMODE; - trace_bcm2835_sdhost_edm_change("datacnt 0", s->edm); - - if (s->config & SDHCFG_DATA_IRPT_EN) { - s->status |= SDHSTS_SDIO_IRPT; - } - - if ((s->cmd & SDCMD_BUSYWAIT) && (s->config & SDHCFG_BUSY_IRPT_EN)) { - s->status |= SDHSTS_BUSY_IRPT; - } - - if ((s->cmd & SDCMD_WRITE_CMD) && (s->config & SDHCFG_BLOCK_IRPT_EN)) { - s->status |= SDHSTS_BLOCK_IRPT; - } - - bcm2835_sdhost_update_irq(s); - } + bcm2835_sdhost_update_irq(s); s->edm &= ~(0x1f << 4); s->edm |= ((s->fifo_len & 0x1f) << 4); From patchwork Tue Apr 10 12:17:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 133084 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1244814ljb; Tue, 10 Apr 2018 05:29:17 -0700 (PDT) X-Google-Smtp-Source: AIpwx48Cv6Y+YlfjaDyhHKgdgMC9rb4eS6IhfplfIVxBfKKKOaTG9E0qDG50vlYDSJUB+VT4v5yo X-Received: by 10.237.54.161 with SMTP id f30mr325395qtb.128.1523363357115; Tue, 10 Apr 2018 05:29:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523363357; cv=none; d=google.com; s=arc-20160816; b=nwacBmkcBn2w0wvbwgl4mpwY6E14X1LwlfbKm6VHFtSIFJ25YAQIzzYW0ZGRkdj3XD 4lz39ZfeKti198uAAyzkvpF6ZGGyxohXew/30VwuSo87kdkQxwOkC5EKXyE46x/SapEv KtiV96IMJ5gO3L0TOGlRp/5lurTzxClzD/j71uj3NSYiDpUjfmJAtYmPYH4THOly+3si NXykmIVZRaKkyGKWeJKzK+kCnad/fpG2veq+vsgayBY67qCJQw0ip0RUBV+87oPBseM8 z7VivhmRqvIA3Zo6ANzkXJJB03XRisOBZOTEgrak80UHs/AeUgOSzMdCLoKJQzO3Cdrp 0DNg== 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=rsUziFq3xEXqjlK0Aqz55NFs1p8gkJkqLUABO+2T0vs=; b=npS3lNYdjjbTXeApDNuN82WqSxaMe3P0dw1fZHfXR11JAaa9QBE/PFK4CHZjNa6jmm jXy7Rb/NCDVUMNYOC4ZIfPJvrm8lArCEGBMFZqjnMkMnOy3L8/BI+vdX1wlSxrIAXDEO 3EzhOnb65OEcs6uJOB0snMWmkX3YqLJspPOx0qgI3P0YQUjTprPg6cnOgnUkKEDSQoud WArdeFh3+FfoL6iihNE8Zs6LBAltBKmQ4qYx14525442NM0rmqWcgMiMdvcGnf5AmptU Cf+gJ11rM9zDQv0qGyRb0PJELxNjOEghojuuEVMqHNzlhBg1Kb8NqFgE3F0UnuUkJ4wB w+Sg== 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 12si827250qkj.2.2018.04.10.05.29.16 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 10 Apr 2018 05:29: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]:40898 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sOi-0000Zz-HP for patch@linaro.org; Tue, 10 Apr 2018 08:29:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57035) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sDY-0007zI-5S for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5sDS-0000jr-1G for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:44 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40760) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f5sDR-0000er-Pw for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:37 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1f5sDK-0007bi-Vj for qemu-devel@nongnu.org; Tue, 10 Apr 2018 13:17:30 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 10 Apr 2018 13:17:18 +0100 Message-Id: <20180410121724.8549-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180410121724.8549-1-peter.maydell@linaro.org> References: <20180410121724.8549-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/12] hw/arm/allwinner-a10: Do not use nd_table in instance_init function 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: Thomas Huth The instance_init function of a device can be called at any time, even if the device is not going to be used (i.e. not going to be realized). So a instance_init function must not do things that could cause QEMU to exit, like calling qemu_check_nic_model(&nd_table[0], ...) for example. But this is what the instance_init function of the allwinner-a10 device is currently doing - and this causes QEMU to quit unexpectedly when you run the 'device-list-properties' QMP command for example: $ echo "{'execute':'qmp_capabilities'}"\ "{'execute':'device-list-properties',"\ " 'arguments':{'typename':'allwinner-a10'}}" \ | arm-softmmu/qemu-system-arm -M mps2-an505,accel=qtest -qmp stdio {"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2}, "package": "build-all"}, "capabilities": []}} {"return": {}} Unsupported NIC model: lan9118 ... and QEMU quits after printing the last line (which should not happen just because of running 'device-list-properties' here). And with the cubieboard, this even causes QEMU to abort(): $ echo "{'execute':'qmp_capabilities'}"\ "{'execute':'device-list-properties',"\ " 'arguments':{'typename':'allwinner-a10'}}" \ | arm-softmmu/qemu-system-arm -M cubieboard,accel=qtest -qmp stdio {"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2}, "package": "build-all"}, "capabilities": []}} {"return": {}} Unexpected error in error_set_from_qdev_prop_error() at hw/core/qdev-properties.c:1095: Property 'allwinner-emac.netdev' can't take value 'hub0port0', it's in use Aborted (core dumped) To fix the problem we've got to move the offending code to the realize function instead. Signed-off-by: Thomas Huth Message-id: 1522862420-7484-1-git-send-email-thuth@redhat.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/arm/allwinner-a10.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 2.16.2 diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c index 43a3f01f45..5dbbacb7e8 100644 --- a/hw/arm/allwinner-a10.c +++ b/hw/arm/allwinner-a10.c @@ -38,11 +38,6 @@ static void aw_a10_init(Object *obj) object_initialize(&s->emac, sizeof(s->emac), TYPE_AW_EMAC); qdev_set_parent_bus(DEVICE(&s->emac), sysbus_get_default()); - /* FIXME use qdev NIC properties instead of nd_table[] */ - if (nd_table[0].used) { - qemu_check_nic_model(&nd_table[0], TYPE_AW_EMAC); - qdev_set_nic_properties(DEVICE(&s->emac), &nd_table[0]); - } object_initialize(&s->sata, sizeof(s->sata), TYPE_ALLWINNER_AHCI); qdev_set_parent_bus(DEVICE(&s->sata), sysbus_get_default()); @@ -91,6 +86,11 @@ static void aw_a10_realize(DeviceState *dev, Error **errp) sysbus_connect_irq(sysbusdev, 4, s->irq[67]); sysbus_connect_irq(sysbusdev, 5, s->irq[68]); + /* FIXME use qdev NIC properties instead of nd_table[] */ + if (nd_table[0].used) { + qemu_check_nic_model(&nd_table[0], TYPE_AW_EMAC); + qdev_set_nic_properties(DEVICE(&s->emac), &nd_table[0]); + } object_property_set_bool(OBJECT(&s->emac), true, "realized", &err); if (err != NULL) { error_propagate(errp, err); @@ -118,7 +118,7 @@ static void aw_a10_class_init(ObjectClass *oc, void *data) DeviceClass *dc = DEVICE_CLASS(oc); dc->realize = aw_a10_realize; - /* Reason: Uses serial_hds in realize and nd_table in instance_init */ + /* Reason: Uses serial_hds and nd_table in realize function */ dc->user_creatable = false; } From patchwork Tue Apr 10 12:17:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 133076 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1240358ljb; Tue, 10 Apr 2018 05:23:59 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/VZ2F8UpATJHknjONAJl4xm7r0yJbohw8wYH19ChShMuG0P9xs1iQ0Qt1BUx5qAo4WBsyh X-Received: by 10.55.72.79 with SMTP id v76mr212303qka.193.1523363039239; Tue, 10 Apr 2018 05:23:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523363039; cv=none; d=google.com; s=arc-20160816; b=SVFh+7kgy9kUZXL0NRU8qnbU55zRP+QLEenP5MvDNMJQnXAIesjtKllluCiKseripl dUJ9dyw+kENW/nOs6N5PJggLs4UheAPEW0TuuNzYSt4zwhE+7ul8zNFvO0ZrCY35lHkP 4a0N9QgeAY/OPnGNk/7tawBdyi3tQr97r2qTZ8UPeeiR0KrPiTGjglXXIAB/wYuN7QEU z3fKqhlscYmqrG1vofvJDldIqKsuxXqmWd1BcTVmJOEvJamiTGTCySaJ36Pe/qHV/jQn 8qgm8O2K0aTihp1ZKbmkFG56T1uKggjIfRat4/BCfkqQHtH6Naz4EW+SX8qICrBvrwI0 RZgw== 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=JRW/9XIPhZ40KG07VH2hCFScNu7cEBEGX0h+QNKI5ZQ=; b=Ab8T68ryHYw+1SKb4botqPhr285CsZobzt++BKQaLg++6HAjSBTmxGrzf2qrV+PkGV JL2KQD4NkE3FfI31e3kIWGri022Ql1x47NK1fF9doBAEzor7GVH0tKs/Y6HvRfhYb1bZ QBW1pKMz85bZF3COaGn5mk/FHxH/Cv2TEQoQUxq6YDH8M01h10aofy8D5WijRyhztKqb 2FKADM+O4VP6N5b6ZtBSLJgMB6OxA7YxKPVqBPqalT6/fII9TsgiswfAzXv18dPswes/ FCjTr+MA0Z/FAVVXuWIji7tlFDyh+gfQUUF/5/nX7nGbYZ8hbtFeZmIUsWPDj4w55Ycc hpVQ== 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 k64si1570926qkc.463.2018.04.10.05.23.59 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 10 Apr 2018 05:23: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]:40601 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sJa-0003sB-Jj for patch@linaro.org; Tue, 10 Apr 2018 08:23:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sDX-0007yL-CF for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5sDR-0000jg-Jc for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:43 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40762) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f5sDR-0000iH-CD for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:37 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1f5sDL-0007cA-N7 for qemu-devel@nongnu.org; Tue, 10 Apr 2018 13:17:31 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 10 Apr 2018 13:17:19 +0100 Message-Id: <20180410121724.8549-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180410121724.8549-1-peter.maydell@linaro.org> References: <20180410121724.8549-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 07/12] hw/arm/fsl-imx: Fix introspection problem with fsl-imx6 and fsl-imx7 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: Thomas Huth QEMU currently exits unexpectedly when trying to introspect the fsl-imx6 and fsl-imx7 devices on systems with many SMP CPUs: $ echo "{'execute':'qmp_capabilities'}"\ "{'execute':'device-list-properties',"\ " 'arguments':{'typename':'fsl,imx6'}}" \ | arm-softmmu/qemu-system-arm -M virt,accel=qtest -qmp stdio -smp 8 {"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2}, "package": "build-all"}, "capabilities": []}} {"return": {}} fsl,imx6: Only 4 CPUs are supported (8 requested) And: $ echo "{'execute':'qmp_capabilities'}"\ "{'execute':'device-list-properties',"\ " 'arguments':{'typename':'fsl,imx7'}}" \ | arm-softmmu/qemu-system-arm -M raspi2,accel=qtest -qmp stdio {"QMP": {"version": {"qemu": {"micro": 91, "minor": 11, "major": 2}, "package": "build-all"}, "capabilities": []}} {"return": {}} fsl,imx7: Only 2 CPUs are supported (4 requested) This happens because these devices are doing an exit() from their instance_init function - which should never be done since instance_init can be called at any time for device introspection! Fix it by moving the deadly check into the realize() function instead. Signed-off-by: Thomas Huth Message-id: 1522908551-14885-1-git-send-email-thuth@redhat.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/arm/fsl-imx6.c | 14 +++++++------- hw/arm/fsl-imx7.c | 13 +++++++------ 2 files changed, 14 insertions(+), 13 deletions(-) -- 2.16.2 diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c index b6ac72de27..9dfbc9a8c4 100644 --- a/hw/arm/fsl-imx6.c +++ b/hw/arm/fsl-imx6.c @@ -37,13 +37,7 @@ static void fsl_imx6_init(Object *obj) char name[NAME_SIZE]; int i; - if (smp_cpus > FSL_IMX6_NUM_CPUS) { - error_report("%s: Only %d CPUs are supported (%d requested)", - TYPE_FSL_IMX6, FSL_IMX6_NUM_CPUS, smp_cpus); - exit(1); - } - - for (i = 0; i < smp_cpus; i++) { + for (i = 0; i < MIN(smp_cpus, FSL_IMX6_NUM_CPUS); i++) { object_initialize(&s->cpu[i], sizeof(s->cpu[i]), "cortex-a9-" TYPE_ARM_CPU); snprintf(name, NAME_SIZE, "cpu%d", i); @@ -119,6 +113,12 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) uint16_t i; Error *err = NULL; + if (smp_cpus > FSL_IMX6_NUM_CPUS) { + error_setg(errp, "%s: Only %d CPUs are supported (%d requested)", + TYPE_FSL_IMX6, FSL_IMX6_NUM_CPUS, smp_cpus); + return; + } + for (i = 0; i < smp_cpus; i++) { /* On uniprocessor, the CBAR is set to 0 */ diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c index 26ef36c79a..390b4310e6 100644 --- a/hw/arm/fsl-imx7.c +++ b/hw/arm/fsl-imx7.c @@ -35,13 +35,8 @@ static void fsl_imx7_init(Object *obj) char name[NAME_SIZE]; int i; - if (smp_cpus > FSL_IMX7_NUM_CPUS) { - error_report("%s: Only %d CPUs are supported (%d requested)", - TYPE_FSL_IMX7, FSL_IMX7_NUM_CPUS, smp_cpus); - exit(1); - } - for (i = 0; i < smp_cpus; i++) { + for (i = 0; i < MIN(smp_cpus, FSL_IMX7_NUM_CPUS); i++) { object_initialize(&s->cpu[i], sizeof(s->cpu[i]), ARM_CPU_TYPE_NAME("cortex-a7")); snprintf(name, NAME_SIZE, "cpu%d", i); @@ -197,6 +192,12 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) qemu_irq irq; char name[NAME_SIZE]; + if (smp_cpus > FSL_IMX7_NUM_CPUS) { + error_setg(errp, "%s: Only %d CPUs are supported (%d requested)", + TYPE_FSL_IMX7, FSL_IMX7_NUM_CPUS, smp_cpus); + return; + } + for (i = 0; i < smp_cpus; i++) { o = OBJECT(&s->cpu[i]); From patchwork Tue Apr 10 12:17:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 133077 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1240384ljb; Tue, 10 Apr 2018 05:24:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx49Dym784QPMjVce33XfoM0q6GbwDNeRDO3sLZVb9f2jOBeHDSJ0Wnn8H3Anwdwb++sc/kBl X-Received: by 10.55.155.138 with SMTP id d132mr209900qke.247.1523363040709; Tue, 10 Apr 2018 05:24:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523363040; cv=none; d=google.com; s=arc-20160816; b=OhS50JCYlIBETOipHm0GKgicQPlocqqNQSk1NHJ0Q9wBFuDVlvmGiqz/Sqsegbxz19 ceZMrWiBpKxv39m6OIgsZTMG8fDKd0MW7GihsdERZkeQgNuleYThVlBtyIlrpyCA8RA1 r71PWGJSDW4v2EnYT/S6xhBZLb4ergRIndYh+1TcfUYRvVtbUX2jtfv9IPRWO6jBe0n4 YDnQD0Jzn/5UuTJY1xBidXZSFpBohHEKu57TwlWUiwNOJSZfhgIu0vMre9mPPobjZmq2 W9YDCMhIfqdL8oub5GJVzdQjDQlsW9SuVqCOdWdbLbMiNSqawSiAT8yU3twYDPLKPAzU uPcw== 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=/L1k1rOG5WP7uJvJHN/7/nB6MWjcL3+mSoa3GJBQ66c=; b=CMzIaaU1WGz10OSwN0b3LS0h60eRRjt72J2du74XjCZh8gjvZpdRQ1wjxWTh/deoP0 xu/jFmraMm50J8HetPRTl+izHMoID0i6fOX33rBixTGlHx6VdQRBlXYanmIKhkseOIcH a0gDI8lhbKB/71sYaAEhIGnf71HzTNga4yX9H75/ooDckZ8MCveplpjzu9LciSz1WH3H ffLpkdMy7eSzUSThxpDtyrBGqQel9F7uaryDHlbIjWkTXtRj5VAJ1W9f4RchaFg6HMxa 0oiRlY2xgPwJWsU5fDuXhZUG/f87qKxDJ/P+Ia3aGomMacddiQ4YPojOPMkFhYBq56EF UV+A== 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 a130si1806924qkg.352.2018.04.10.05.24.00 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 10 Apr 2018 05:24:00 -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]:40600 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sJc-0003rn-3D for patch@linaro.org; Tue, 10 Apr 2018 08:24:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56927) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sDT-0007v2-2G for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5sDR-0000jL-2H for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:39 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40760) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f5sDQ-0000er-SF for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:37 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1f5sDM-0007cc-EO for qemu-devel@nongnu.org; Tue, 10 Apr 2018 13:17:32 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 10 Apr 2018 13:17:20 +0100 Message-Id: <20180410121724.8549-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180410121724.8549-1-peter.maydell@linaro.org> References: <20180410121724.8549-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/12] target/arm: Report unsupported MPU region sizes more clearly 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" Currently our PMSAv7 and ARMv7M MPU implementation cannot handle MPU region sizes smaller than our TARGET_PAGE_SIZE. However we report that in a slightly confusing way: DRSR[3]: No support for MPU (sub)region alignment of 9 bits. Minimum is 10 The problem is not the alignment of the region, but its size; tweak the error message to say so: DRSR[3]: No support for MPU (sub)region size of 512 bytes. Minimum is 1024. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Message-id: 20180405172554.27401-1-peter.maydell@linaro.org --- target/arm/helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.16.2 diff --git a/target/arm/helper.c b/target/arm/helper.c index dcb8476d9e..b14fdab140 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -9625,9 +9625,9 @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, } if (rsize < TARGET_PAGE_BITS) { qemu_log_mask(LOG_UNIMP, - "DRSR[%d]: No support for MPU (sub)region " - "alignment of %" PRIu32 " bits. Minimum is %d\n", - n, rsize, TARGET_PAGE_BITS); + "DRSR[%d]: No support for MPU (sub)region size of" + " %" PRIu32 " bytes. Minimum is %d.\n", + n, (1 << rsize), TARGET_PAGE_SIZE); continue; } if (srdis) { From patchwork Tue Apr 10 12:17:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 133073 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1237794ljb; Tue, 10 Apr 2018 05:20:54 -0700 (PDT) X-Google-Smtp-Source: AIpwx48WXLyBwHOqdDpzx6wy3rEkZj6oW60Fy2lXIRtgrld/8NNj3WRGyNpwVaP8mQeZ6Uaf451r X-Received: by 10.55.79.5 with SMTP id d5mr260263qkb.82.1523362854241; Tue, 10 Apr 2018 05:20:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523362854; cv=none; d=google.com; s=arc-20160816; b=N7eAP98hObR2/a+19paC7dbaV8BjE8gdEdq97YtrySnvWPVFURPL5/HQ7r6Ax5iz5l GVCJui4kvP8hp98M80zNdetfbvmpvica/0BWRL1hzLgwffyGyUs0/tKFbw9bNGHyQa+G FlSybFFyp4Ak7KxLe1IIpFnTE9Dob0ACGZMR7yPN5lenISoR8Sx1N5WcV4p/vjxoGjWh Cps9O4kQbox06eHF7no3hbDHaFZFaYsYDG0hHi9/1sb1gkLJhujApqvHf6kwf9X+xT3i hMKs176jLIAvBZj05dIpEyqg7eSN64mORcTGPyAVa6U9rzdNAP6zj6liEITJWfDHadaI BFuA== 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=XKyjdMfoP8RtjO+V/ekeKHBa80MWO/DJ4Cnb3rj1odA=; b=kEbGMQ5KErXzp1El2mpyhSkvf2dYMaGG5CD53P7OaCFwBYyHZpK4iEjzBgZrR0CYKh Nf8M0oZuxa3B8p/ngJsq10R/CeX45zzMLcrho9PVrM0zQb823PYPPbk85OyL9mDz31jg Vrc1xIu16ZgjvHkxJK62ETZOeYB8u149qZl0+HP2hukKv5f/Oic3KavjOmp5e/VinXE+ RtTiEsgs3t6/PLwxexKyLM11jRye4bLmpIQCQKI64zxlVgWrrP9OrKhVtp7tm7qiWNvm CflFIk0x6SGoR2zYbfUDkCbgC/RFi7QlPGUs9jZV8YRMQa2oB2AH325ErC1SPiuZCzmG ttzg== 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 u205si3148002qka.329.2018.04.10.05.20.54 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 10 Apr 2018 05:20:54 -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]:40582 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sGb-0000oG-If for patch@linaro.org; Tue, 10 Apr 2018 08:20:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sDR-0007ui-E0 for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5sDQ-0000iw-66 for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:37 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40760) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f5sDP-0000er-VM for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:36 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1f5sDN-0007d4-5f for qemu-devel@nongnu.org; Tue, 10 Apr 2018 13:17:33 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 10 Apr 2018 13:17:21 +0100 Message-Id: <20180410121724.8549-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180410121724.8549-1-peter.maydell@linaro.org> References: <20180410121724.8549-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/12] cpus.c: ensure running CPU recalculates icount deadlines on timer expiry 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 we run in TCG icount mode, we calculate the number of instructions to execute using tcg_get_icount_limit(), which ensures that we stop execution at the next timer deadline. However there is a bug where currently we do not recalculate that limit if the guest reprograms a timer so that the next deadline moves closer, and so we will continue execution until the original limit and fire the timer later than we should. Fix this bug in qemu_timer_notify_cb(): if we are currently running a VCPU in icount mode, we simply need to kick it out of the main loop and back to tcg_cpu_exec(), where it will recalculate the icount limit. If we are not currently running a VCPU, then we retain the existing logic for waking up a halted CPU. Cc: qemu-stable@nongnu.org Fixes: https://bugs.launchpad.net/qemu/+bug/1754038 Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Message-id: 20180406123838.21249-1-peter.maydell@linaro.org --- cpus.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 2.16.2 diff --git a/cpus.c b/cpus.c index 2e6701795b..38eba8bff3 100644 --- a/cpus.c +++ b/cpus.c @@ -892,11 +892,19 @@ void qemu_timer_notify_cb(void *opaque, QEMUClockType type) return; } - if (!qemu_in_vcpu_thread() && first_cpu) { + if (qemu_in_vcpu_thread()) { + /* A CPU is currently running; kick it back out to the + * tcg_cpu_exec() loop so it will recalculate its + * icount deadline immediately. + */ + qemu_cpu_kick(current_cpu); + } else if (first_cpu) { /* qemu_cpu_kick is not enough to kick a halted CPU out of * qemu_tcg_wait_io_event. async_run_on_cpu, instead, * causes cpu_thread_is_idle to return false. This way, * handle_icount_deadline can run. + * If we have no CPUs at all for some reason, we don't + * need to do anything. */ async_run_on_cpu(first_cpu, do_nothing, RUN_ON_CPU_NULL); } From patchwork Tue Apr 10 12:17:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 133072 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1237662ljb; Tue, 10 Apr 2018 05:20:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx4++4mpjZ9yRVn+1ioYk/vlG5Hg+VwFkWPSuY2r1YtFrl5CzDczXxRWiV2gSuUKqbVEYOD9c X-Received: by 10.55.5.145 with SMTP id 139mr216613qkf.332.1523362845843; Tue, 10 Apr 2018 05:20:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523362845; cv=none; d=google.com; s=arc-20160816; b=vHdgdrDAT0SdORI+xsobjDkoMAmQUBw9t1m2qqY6doXHL8dV7CDesMPI7GDQ1twMKW CGlFZUE8jZ3drckC+NnpTLAfD7Rx74ZDYuqaGtysX1sL4WEiYBkRCxvCj6LQNVfBDe4f +xwknBnj6jxcYoQEojIMHTGOrbk6pEFjERblEH2x2cFFhDeTh8xY7mL7Nrv7fRyDxPjh 7FozQZYgzc32szgoc/CnsifgIKauXUE42oHDGOM935wfmFPpvAk6xZASWgzT2aKidm3H ok6jQqxiqdff60V9281gKPKxztWkGl+WtiRREIfh+q3XhnM/4cR6HdoupOlLsJSwKmnT hPhw== 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=ph17cESIl9LnZZzjST1hOP3Jxd9HJtruEd7EWUr4fsg=; b=l6MJ2DwWCpJgjspxbcLJ8ivBjIlWSbFn0QGc9Y4AtlUMZfe066qkcr5BfRFDWMeRe0 vCjuVEX8bODgj5wRwnTzQMy6dHvKuvMZ2o4JkA/StdJTB0aFM27ojfAZaCTgCXaFHBcn 7vGNk7eA7rCLkUCPOjiKAhadJ8XCPx1i/YhytxY+MdPthHjWRA+NzSrX2ZNhP7NwrGI/ Wca9BZ+GulHtZx2uVRaOcoC8k0ISvka7et9g/RK/e6akxf/ofUHOI1+F7NfY/UjNkWSG q7n0ocalvIhai/BoEA9j6/Bi8FdqpD75wrQoAYGG8Xp6SxDza7RFmkRO2Mx+RD+6qRkp uwQQ== 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 12si1803966qko.353.2018.04.10.05.20.45 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 10 Apr 2018 05:20:45 -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]:40581 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sGT-0000l9-6I for patch@linaro.org; Tue, 10 Apr 2018 08:20:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56879) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sDQ-0007uU-Ke for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5sDP-0000iS-B5 for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:36 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40760) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f5sDP-0000er-2d for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:35 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1f5sDN-0007dW-U3 for qemu-devel@nongnu.org; Tue, 10 Apr 2018 13:17:33 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 10 Apr 2018 13:17:22 +0100 Message-Id: <20180410121724.8549-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180410121724.8549-1-peter.maydell@linaro.org> References: <20180410121724.8549-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 10/12] linux-user/signal.c: Ensure AArch64 signal frame isn't too small 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 AArch64 signal frame design was extended for SVE in commit 8c5931de0ac77388096d79ceb, so that instead of having a fixed setup we now add various records to the frame, with some of them possibly overflowing into an extra space outside the original 4K reserved block in the target_sigcontext. However, we failed to ensure that we always at least allocate the 4K reserved block. This is ABI, and some userspace programs rely on it. In particular the dash shell would segfault if the frame wasn't as big enough. (Compare the kernel's sigframe_size() function in arch/arm64/kernel/signal.c.) Reported-by: Richard Henwood Reviewed-by: Laurent Vivier Reviewed-by: Richard Henderson Message-id: 20180409140714.26841-1-peter.maydell@linaro.org Fixes: https://bugs.launchpad.net/bugs/1761535 Fixes: 8c5931de0ac77388096d79ceb Signed-off-by: Peter Maydell --- linux-user/signal.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.16.2 diff --git a/linux-user/signal.c b/linux-user/signal.c index 046d4c8aa0..8d9e6e8410 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -1850,6 +1850,12 @@ static void target_setup_frame(int usig, struct target_sigaction *ka, fr_ofs = layout.total_size; layout.total_size += sizeof(struct target_rt_frame_record); + /* We must always provide at least the standard 4K reserved space, + * even if we don't use all of it (this is part of the ABI) + */ + layout.total_size = MAX(layout.total_size, + sizeof(struct target_rt_sigframe)); + frame_addr = get_sigframe(ka, env, layout.total_size); trace_user_setup_frame(env, frame_addr); if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) { From patchwork Tue Apr 10 12:17:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 133071 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1235212ljb; Tue, 10 Apr 2018 05:18:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx49uyhI3R/zjrQz6cjhNkrBF04Xohy+6I7P1H3lY6Z0c+tNLQXPdSHlfDweI3TLiMox2O7d0 X-Received: by 10.55.101.131 with SMTP id z125mr236026qkb.178.1523362691315; Tue, 10 Apr 2018 05:18:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523362691; cv=none; d=google.com; s=arc-20160816; b=J7okVxib4M6cXFdfzX6+4pB5gQ8gfRuq9b/YCtIpov4A99hE9D4bjnf1BgblO/zx18 onQ92ym3K//+YiJ4oZTSCXFFHI3IDtcZi+glvpV4zUNIX/Co9IOEnX48d/AIOk3Ghp6D wTVh80CH1P1lpLHDhiEMhgC9bTLCHHOoAglTlrssop+I5SYgWFapCr0WPBvEgB1EP04N 1rLp+59CdfAE7OHzBc6LIK60GZDVOtRALAAgmRTokcF93EddrZHVpPnQlZY1V1RiryoP /c+QOsyGaGijDn/Dd8t0n7C5IAf8nWRXnPEbBgAYj0dZi/eSfi0NAuCvRYxZ25TokR/f dt+g== 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=9hOmWV3UcDL9TS8K2FIGyCi4utIcSg+BIyzLi7qoqCw=; b=WAYmHLv/rWjXTDBE0CZUwPU1lvG7B+YoOQnmg4cpP4UUJcW5x9NfmFe9oT2apDHm04 G8wsR0pGrQlLwQqN+OzwjUjfMM5Q9J9oLS8jF87moHtJKXQtSwri4PH2ZFklExeNnPsV /+OS3MDqhrK6ApaSmLuWOsRSL2HypDdBg5GXCly9XcuYb6sFVKy2xlSncndyzoA90uvP HLz4Nyn1+qgB+Dnowlj92rVpApkRL7Qg6SERC6kdLRkZ11tWhhyf73cY24jtPI5WoRs7 25BySB5SQx4c28SRSPj9e1Grq0k9Lo6HRzkhdCWysAMdOP/oTjc24BNs1kVD1KY5RlKa jVWg== 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 i10si3204300qtp.59.2018.04.10.05.18.11 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 10 Apr 2018 05:18: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]:40578 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sDy-0007xv-NX for patch@linaro.org; Tue, 10 Apr 2018 08:18:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56957) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sDT-0007vE-T7 for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5sDP-0000ig-P9 for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:39 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40762) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f5sDP-0000iH-Hx for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:35 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1f5sDO-0007dz-Ky for qemu-devel@nongnu.org; Tue, 10 Apr 2018 13:17:34 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 10 Apr 2018 13:17:23 +0100 Message-Id: <20180410121724.8549-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180410121724.8549-1-peter.maydell@linaro.org> References: <20180410121724.8549-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 11/12] tcg: Introduce tcg_set_insn_start_param 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: Richard Henderson The parameters for tcg_gen_insn_start are target_ulong, which may be split into two TCGArg parameters for storage in the opcode on 32-bit hosts. Fixes the ARM target and its direct use of tcg_set_insn_param, which would set the wrong argument in the 64-on-32 case. Cc: qemu-stable@nongnu.org Reported-by: alarson@ddci.com Signed-off-by: Richard Henderson Message-id: 20180410003558.2470-1-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/translate.h | 2 +- tcg/tcg.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) -- 2.16.2 diff --git a/target/arm/translate.h b/target/arm/translate.h index c47febf99d..4428c98e2e 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -120,7 +120,7 @@ static inline void disas_set_insn_syndrome(DisasContext *s, uint32_t syn) /* We check and clear insn_start_idx to catch multiple updates. */ assert(s->insn_start != NULL); - tcg_set_insn_param(s->insn_start, 2, syn); + tcg_set_insn_start_param(s->insn_start, 2, syn); s->insn_start = NULL; } diff --git a/tcg/tcg.h b/tcg/tcg.h index 9e2d909a4a..30896ca304 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -825,6 +825,16 @@ static inline void tcg_set_insn_param(TCGOp *op, int arg, TCGArg v) op->args[arg] = v; } +static inline void tcg_set_insn_start_param(TCGOp *op, int arg, target_ulong v) +{ +#if TARGET_LONG_BITS <= TCG_TARGET_REG_BITS + tcg_set_insn_param(op, arg, v); +#else + tcg_set_insn_param(op, arg * 2, v); + tcg_set_insn_param(op, arg * 2 + 1, v >> 32); +#endif +} + /* The last op that was emitted. */ static inline TCGOp *tcg_last_op(void) { From patchwork Tue Apr 10 12:17:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 133075 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1238123ljb; Tue, 10 Apr 2018 05:21:18 -0700 (PDT) X-Google-Smtp-Source: AIpwx49pKRBJ42kOAd9WKo6cVGOyG5TwUziQBza3rR3v2Ay2B8qJN+u+pi6JD9O413cg/q3SdqZe X-Received: by 10.55.119.196 with SMTP id s187mr194669qkc.171.1523362878629; Tue, 10 Apr 2018 05:21:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523362878; cv=none; d=google.com; s=arc-20160816; b=p6xlGP92jlW33S/mPJ/VNrkn2a1caEb4ITLweFyFCzgsGt1m9UgWbUS/qOwL4mLmRW 7fgI4rgsEzxDSIWyh5gfUYInTZApzDgv2CM3CxSB2BeFhvgoOISx+zsx5c2cwR+jVrTp FzCqXfxh+5VmMAoMWb9ikut4Q3BR8Sg+n1YgPHSss8w4uuEhGfp3LeIvjimrARSzBOXc M3ODb9lqWQSOAfZ+czAikFnl9jr+aZQn1RsIHoRlJs4rIn/zlqEkVB34gUHDuLqIY+FN B+JRHsD/0Y3za1zizGhs4etu+sbF/GZMNNQc08zuAZQxVqpC3BY4OM2bHe9unPAn5ba9 a5Fw== 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=3SifdluTgu3TolKp4klXfO+jcDFX7YqIPxVrtrgjIDQ=; b=EXyxAcgWODG8koBAIfWLwtl+6kWI8mGymVtnl+I/8WMi3XZ7dcMdcFYM7PpKMS7HHS 5mq6Mcot0YZVXkQtezSciWaDA1lJ4K+FOmB+kAgkHSghhMF0bUQcuvM1uv3EOQes6sTf pdQrJqvqIZ+wyfS1LhwBhqw9cHq858OzvNNCNQpOXbOsRcPjuxnl+SoWQARy0JD5y0zW odL4499UWXOcB4LNl2IN0caUjPKDnfpA9F6ISfC95Wg+raBBYr9ee2SvQhkWdoJWgLnl qbpt4ahqXV7s8iToftjVUVBAR8x3tfMmcWEuS+x0vAjrfP19WEyBAs1hf0Hobo4BRUkZ viVQ== 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 d26si3107640qtp.428.2018.04.10.05.21.18 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 10 Apr 2018 05:21:18 -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]:40591 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sH0-0002O3-27 for patch@linaro.org; Tue, 10 Apr 2018 08:21:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5sDR-0007uj-G1 for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5sDQ-0000jA-Lz for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:37 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:40762) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f5sDQ-0000iH-Ej for qemu-devel@nongnu.org; Tue, 10 Apr 2018 08:17:36 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1f5sDP-0007eE-Bu for qemu-devel@nongnu.org; Tue, 10 Apr 2018 13:17:35 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 10 Apr 2018 13:17:24 +0100 Message-Id: <20180410121724.8549-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180410121724.8549-1-peter.maydell@linaro.org> References: <20180410121724.8549-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 12/12] fpu: Fix rounding mode for floatN_to_uintM_round_to_zero 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: Richard Henderson We incorrectly passed in the current rounding mode instead of float_round_to_zero. Signed-off-by: Richard Henderson Message-id: 20180410055912.934-1-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- fpu/softfloat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.16.2 diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 6e16284e66..b46dccc63e 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -1486,8 +1486,8 @@ uint ## isz ## _t float ## fsz ## _to_uint ## isz ## _round_to_zero \ (float ## fsz a, float_status *s) \ { \ FloatParts p = float ## fsz ## _unpack_canonical(a, s); \ - return round_to_uint_and_pack(p, s->float_rounding_mode, \ - UINT ## isz ## _MAX, s); \ + return round_to_uint_and_pack(p, float_round_to_zero, \ + UINT ## isz ## _MAX, s); \ } FLOAT_TO_UINT(16, 16)