From nobody Thu Dec 18 22:22:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531759510752242.0686843219479; Mon, 16 Jul 2018 09:45:10 -0700 (PDT) Received: from localhost ([::1]:52829 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ff6cX-0001Nm-Kx for importer@patchew.org; Mon, 16 Jul 2018 12:45:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ff6aY-0008U4-NO for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ff6aX-0005ZS-O1 for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:06 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:43586) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ff6aX-0005YP-F9 for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:05 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1ff6aU-0000ym-D7 for qemu-devel@nongnu.org; Mon, 16 Jul 2018 17:43:02 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 16 Jul 2018 17:42:53 +0100 Message-Id: <20180716164300.6731-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180716164300.6731-1-peter.maydell@linaro.org> References: <20180716164300.6731-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 1/8] target/arm: Fix LD1W and LDFF1W (scalar plus vector) 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 From: Richard Henderson 'I' was being double-incremented; correctly within the inner loop and incorrectly within the outer loop. Signed-off-by: Richard Henderson Reviewed-by: Laurent Desnogues Reviewed-by: Alex Benn=C3=A9e Tested-by: Alex Benn=C3=A9e Message-id: 20180711103957.3040-1-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/sve_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c index a03ca773542..54795c91945 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -4459,7 +4459,7 @@ void HELPER(NAME)(CPUARMState *env, void *vd, void *v= g, void *vm, \ intptr_t i, oprsz =3D simd_oprsz(desc); \ unsigned scale =3D simd_data(desc); \ uintptr_t ra =3D GETPC(); \ - for (i =3D 0; i < oprsz; i++) { \ + for (i =3D 0; i < oprsz; ) { \ uint16_t pg =3D *(uint16_t *)(vg + H1_2(i >> 3)); \ do { \ TYPEM m =3D 0; \ @@ -4540,7 +4540,7 @@ void HELPER(NAME)(CPUARMState *env, void *vd, void *v= g, void *vm, \ uintptr_t ra =3D GETPC(); \ bool first =3D true; \ mmap_lock(); \ - for (i =3D 0; i < oprsz; i++) { \ + for (i =3D 0; i < oprsz; ) { \ uint16_t pg =3D *(uint16_t *)(vg + H1_2(i >> 3)); \ do { \ TYPEM m =3D 0; \ --=20 2.17.1 From nobody Thu Dec 18 22:22:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531759719503211.87855549224753; Mon, 16 Jul 2018 09:48:39 -0700 (PDT) Received: from localhost ([::1]:52846 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ff6fl-0003mv-7s for importer@patchew.org; Mon, 16 Jul 2018 12:48:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50629) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ff6aX-0008TT-M5 for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ff6aW-0005Z2-PO for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:05 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:43586) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ff6aW-0005YP-H1 for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:04 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1ff6aV-0000zQ-3A for qemu-devel@nongnu.org; Mon, 16 Jul 2018 17:43:03 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 16 Jul 2018 17:42:54 +0100 Message-Id: <20180716164300.6731-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180716164300.6731-1-peter.maydell@linaro.org> References: <20180716164300.6731-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 2/8] aspeed: Implement write-1-{set, clear} for AST2500 strapping 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Andrew Jeffery The AST2500 SoC family changes the runtime behaviour of the hardware strapping register (SCU70) to write-1-set/write-1-clear, with write-1-clear implemented on the "read-only" SoC revision register (SCU7C). For the the AST2400, the hardware strapping is runtime-configured with read-modify-write semantics. Signed-off-by: Andrew Jeffery Reviewed-by: Joel Stanley Message-id: 20180709143524.17480-1-andrew@aj.id.au Signed-off-by: Peter Maydell --- include/hw/misc/aspeed_scu.h | 2 ++ hw/misc/aspeed_scu.c | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/include/hw/misc/aspeed_scu.h b/include/hw/misc/aspeed_scu.h index f662c38188f..38996adc59f 100644 --- a/include/hw/misc/aspeed_scu.h +++ b/include/hw/misc/aspeed_scu.h @@ -41,6 +41,8 @@ typedef struct AspeedSCUState { #define AST2500_A0_SILICON_REV 0x04000303U #define AST2500_A1_SILICON_REV 0x04010303U =20 +#define ASPEED_IS_AST2500(si_rev) ((((si_rev) >> 24) & 0xff) =3D=3D 0x= 04) + extern bool is_supported_silicon_rev(uint32_t silicon_rev); =20 #define ASPEED_SCU_PROT_KEY 0x1688A8A8 diff --git a/hw/misc/aspeed_scu.c b/hw/misc/aspeed_scu.c index 59333b50abd..c8217740efc 100644 --- a/hw/misc/aspeed_scu.c +++ b/hw/misc/aspeed_scu.c @@ -247,11 +247,26 @@ static void aspeed_scu_write(void *opaque, hwaddr off= set, uint64_t data, s->regs[reg] =3D data; aspeed_scu_set_apb_freq(s); break; - + case HW_STRAP1: + if (ASPEED_IS_AST2500(s->regs[SILICON_REV])) { + s->regs[HW_STRAP1] |=3D data; + return; + } + /* Jump to assignment below */ + break; + case SILICON_REV: + if (ASPEED_IS_AST2500(s->regs[SILICON_REV])) { + s->regs[HW_STRAP1] &=3D ~data; + } else { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Write to read-only offset 0x%" HWADDR_PRIx = "\n", + __func__, offset); + } + /* Avoid assignment below, we've handled everything */ + return; case FREQ_CNTR_EVAL: case VGA_SCRATCH1 ... VGA_SCRATCH8: case RNG_DATA: - case SILICON_REV: case FREE_CNTR4: case FREE_CNTR4_EXT: qemu_log_mask(LOG_GUEST_ERROR, --=20 2.17.1 From nobody Thu Dec 18 22:22:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531759506861827.0037382437046; Mon, 16 Jul 2018 09:45:06 -0700 (PDT) Received: from localhost ([::1]:52828 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ff6cT-0001Df-Oi for importer@patchew.org; Mon, 16 Jul 2018 12:45:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ff6aY-0008Th-02 for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ff6aX-0005ZC-2B for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:06 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:43588) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ff6aW-0005Yr-R4 for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:04 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1ff6aV-0000zr-Qe for qemu-devel@nongnu.org; Mon, 16 Jul 2018 17:43:03 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 16 Jul 2018 17:42:55 +0100 Message-Id: <20180716164300.6731-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180716164300.6731-1-peter.maydell@linaro.org> References: <20180716164300.6731-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 3/8] hw/intc/arm_gic: Check interrupt number in gic_deactivate_irq() 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" In gic_deactivate_irq() the interrupt number comes from the guest (on a write to the GICC_DIR register), so we need to sanity check that it isn't out of range before we use it as an array index. Handle this in a similar manner to the check we do in gic_complete_irq() for the GICC_EOI register. The array overrun is not disastrous because the calling code uses (value & 0x3ff) to extract the interrupt field, so the only out-of-range values possible are 1020..1023, which allow overrunning only from irq_state[] into the following irq_target[] array which the guest can already manipulate. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Luc Michel Message-id: 20180712154152.32183-2-peter.maydell@linaro.org --- hw/intc/arm_gic.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c index ea0323f9691..b0a69d6386e 100644 --- a/hw/intc/arm_gic.c +++ b/hw/intc/arm_gic.c @@ -543,7 +543,21 @@ static bool gic_eoi_split(GICState *s, int cpu, MemTxA= ttrs attrs) static void gic_deactivate_irq(GICState *s, int cpu, int irq, MemTxAttrs a= ttrs) { int cm =3D 1 << cpu; - int group =3D gic_has_groups(s) && GIC_TEST_GROUP(irq, cm); + int group; + + if (irq >=3D s->num_irq) { + /* + * This handles two cases: + * 1. If software writes the ID of a spurious interrupt [ie 1023] + * to the GICC_DIR, the GIC ignores that write. + * 2. If software writes the number of a non-existent interrupt + * this must be a subcase of "value written is not an active inter= rupt" + * and so this is UNPREDICTABLE. We choose to ignore it. + */ + return; + } + + group =3D gic_has_groups(s) && GIC_TEST_GROUP(irq, cm); =20 if (!gic_eoi_split(s, cpu, attrs)) { /* This is UNPREDICTABLE; we choose to ignore it */ --=20 2.17.1 From nobody Thu Dec 18 22:22:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531759723426848.9079608876133; Mon, 16 Jul 2018 09:48:43 -0700 (PDT) Received: from localhost ([::1]:52847 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ff6fn-0003oB-7H for importer@patchew.org; Mon, 16 Jul 2018 12:48:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ff6aY-0008UG-UM for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ff6aY-0005Zv-1K for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:06 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:43588) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ff6aX-0005Yr-P6 for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:05 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1ff6aW-00010E-H9 for qemu-devel@nongnu.org; Mon, 16 Jul 2018 17:43:04 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 16 Jul 2018 17:42:56 +0100 Message-Id: <20180716164300.6731-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180716164300.6731-1-peter.maydell@linaro.org> References: <20180716164300.6731-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 4/8] hw/intc/arm_gic: Fix handling of GICD_ITARGETSR 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The GICD_ITARGETSR implementation still has some 11MPCore behaviour that we were incorrectly using in our GICv1 and GICv2 implementations for the case where the interrupt number is less than GIC_INTERNAL. The desired behaviour here is: * for 11MPCore: RAZ/WI for irqs 0..28; read a number matching the CPU doing the read for irqs 29..31 * for GICv1 and v2: RAZ/WI if uniprocessor; otherwise read a number matching the CPU doing the read for all irqs < 32 Stop squashing GICD_ITARGETSR to 0 for IRQs 0..28 unless this is an 11MPCore GIC. Reported-by: Jan Kiszka Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Luc Michel Message-id: 20180712154152.32183-3-peter.maydell@linaro.org --- hw/intc/arm_gic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c index b0a69d6386e..34dc84ae813 100644 --- a/hw/intc/arm_gic.c +++ b/hw/intc/arm_gic.c @@ -751,7 +751,9 @@ static uint32_t gic_dist_readb(void *opaque, hwaddr off= set, MemTxAttrs attrs) if (irq >=3D s->num_irq) { goto bad_reg; } - if (irq >=3D 29 && irq <=3D 31) { + if (irq < 29 && s->revision =3D=3D REV_11MPCORE) { + res =3D 0; + } else if (irq < GIC_INTERNAL) { res =3D cm; } else { res =3D GIC_TARGET(irq); @@ -1014,7 +1016,7 @@ static void gic_dist_writeb(void *opaque, hwaddr offs= et, if (irq >=3D s->num_irq) { goto bad_reg; } - if (irq < 29) { + if (irq < 29 && s->revision =3D=3D REV_11MPCORE) { value =3D 0; } else if (irq < GIC_INTERNAL) { value =3D ALL_CPU_MASK; --=20 2.17.1 From nobody Thu Dec 18 22:22:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531759819408905.5134547749054; Mon, 16 Jul 2018 09:50:19 -0700 (PDT) Received: from localhost ([::1]:52857 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ff6hW-0005Fk-AI for importer@patchew.org; Mon, 16 Jul 2018 12:50:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50673) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ff6aZ-0008Uc-8J for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ff6aY-0005aE-Ex for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:07 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:43590) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ff6aY-0005ZO-7C for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:06 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1ff6aX-00010n-71 for qemu-devel@nongnu.org; Mon, 16 Jul 2018 17:43:05 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 16 Jul 2018 17:42:57 +0100 Message-Id: <20180716164300.6731-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180716164300.6731-1-peter.maydell@linaro.org> References: <20180716164300.6731-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 5/8] hw/arm/bcm2836: Mark the bcm2836 / bcm2837 devices with user_creatable = false 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth These devices are currently causing some problems when a user is trying to hot-plug or introspect them during runtime. Since these devices can not be instantiated by the user at all (they need to be wired up in code instead), we should mark them with user_creatable =3D false anyway, then we avoid at least the crashes with the hot-plugging. The introspection problem will be handled by a separate patch. Signed-off-by: Thomas Huth Message-id: 1531415537-26037-1-git-send-email-thuth@redhat.com Reviewed-by: Peter Maydell Reviewed-by: Markus Armbruster Signed-off-by: Peter Maydell --- hw/arm/bcm2836.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index 6805a7d7c81..45d9e40c454 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -185,6 +185,8 @@ static void bcm283x_class_init(ObjectClass *oc, void *d= ata) bc->info =3D data; dc->realize =3D bcm2836_realize; dc->props =3D bcm2836_props; + /* Reason: Must be wired up in code (see raspi_init() function) */ + dc->user_creatable =3D false; } =20 static const TypeInfo bcm283x_type_info =3D { --=20 2.17.1 From nobody Thu Dec 18 22:22:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531759722949420.2887406678053; Mon, 16 Jul 2018 09:48:42 -0700 (PDT) Received: from localhost ([::1]:52848 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ff6fr-0003qb-O2 for importer@patchew.org; Mon, 16 Jul 2018 12:48:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ff6aa-0008Vi-CV for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ff6aZ-0005ao-DB for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:08 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:43590) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ff6aZ-0005ZO-51 for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:07 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1ff6aX-00011L-VK for qemu-devel@nongnu.org; Mon, 16 Jul 2018 17:43:05 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 16 Jul 2018 17:42:58 +0100 Message-Id: <20180716164300.6731-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180716164300.6731-1-peter.maydell@linaro.org> References: <20180716164300.6731-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 6/8] bcm2835_aux: Swap RX and TX interrupt assignments 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Guenter Roeck RX and TX interrupt bits were reversed, resulting in an endless sequence of serial interupts in the emulated system and the following repeated error message when booting Linux. serial8250: too much work for irq61 This results in a boot failure most of the time. Qemu command line used to reproduce the problem: qemu-system-aarch64 -M raspi3 -m 1024 \ -kernel arch/arm64/boot/Image \ --append "rdinit=3D/sbin/init console=3DttyS1,115200" -initrd rootfs.cpio \ -dtb arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dtb \ -nographic -monitor null -serial null -serial stdio This is with arm64:defconfig. The root file system was generated using buildroot. NB that this error likely arises from an erratum in the BCM2835 datasheet where the TX and RX bits were swapped in the AU_MU_IER_REG description (but correct for IIR): https://elinux.org/BCM2835_datasheet_errata#p12 Signed-off-by: Guenter Roeck Message-id: 1529355846-25102-1-git-send-email-linux@roeck-us.net Reviewed-by: Peter Maydell [PMM: added NB about datasheet] Signed-off-by: Peter Maydell --- hw/char/bcm2835_aux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/char/bcm2835_aux.c b/hw/char/bcm2835_aux.c index 370dc7e2968..0364596c552 100644 --- a/hw/char/bcm2835_aux.c +++ b/hw/char/bcm2835_aux.c @@ -39,8 +39,8 @@ #define AUX_MU_BAUD_REG 0x68 =20 /* bits in IER/IIR registers */ -#define TX_INT 0x1 -#define RX_INT 0x2 +#define RX_INT 0x1 +#define TX_INT 0x2 =20 static void bcm2835_aux_update(BCM2835AuxState *s) { --=20 2.17.1 From nobody Thu Dec 18 22:22:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 153175989095388.12667444686372; Mon, 16 Jul 2018 09:51:30 -0700 (PDT) Received: from localhost ([::1]:52866 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ff6if-00064p-Qg for importer@patchew.org; Mon, 16 Jul 2018 12:51:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50707) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ff6aa-0008W4-Ou for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ff6aZ-0005b0-Tw for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:08 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:43592) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ff6aZ-0005ae-M8 for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:07 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1ff6aY-00011z-M7 for qemu-devel@nongnu.org; Mon, 16 Jul 2018 17:43:06 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 16 Jul 2018 17:42:59 +0100 Message-Id: <20180716164300.6731-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180716164300.6731-1-peter.maydell@linaro.org> References: <20180716164300.6731-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 7/8] accel/tcg: Use correct test when looking in victim TLB for code 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" In get_page_addr_code(), we were incorrectly looking in the victim TLB for an entry which matched the target address for reads, not for code accesses. This meant that we could hit on a victim TLB entry that indicated that the address was readable but not executable, and incorrectly bypass the call to tlb_fill() which should generate the guest MMU exception. Fix this bug. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20180713141636.18665-2-peter.maydell@linaro.org --- accel/tcg/cputlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 20c147d6554..2d5fb15d9a3 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -967,7 +967,7 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env, ta= rget_ulong addr) index =3D (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); mmu_idx =3D cpu_mmu_index(env, true); if (unlikely(!tlb_hit(env->tlb_table[mmu_idx][index].addr_code, addr))= ) { - if (!VICTIM_TLB_HIT(addr_read, addr)) { + if (!VICTIM_TLB_HIT(addr_code, addr)) { tlb_fill(ENV_GET_CPU(env), addr, 0, MMU_INST_FETCH, mmu_idx, 0= ); } } --=20 2.17.1 From nobody Thu Dec 18 22:22:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531759671732131.25400499501643; Mon, 16 Jul 2018 09:47:51 -0700 (PDT) Received: from localhost ([::1]:52845 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ff6f8-0003LZ-CX for importer@patchew.org; Mon, 16 Jul 2018 12:47:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ff6ab-00005l-Qj for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ff6aa-0005bd-Sr for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:09 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:43592) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ff6aa-0005ae-L5 for qemu-devel@nongnu.org; Mon, 16 Jul 2018 12:43:08 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1ff6aZ-00012E-EY for qemu-devel@nongnu.org; Mon, 16 Jul 2018 17:43:07 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 16 Jul 2018 17:43:00 +0100 Message-Id: <20180716164300.6731-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180716164300.6731-1-peter.maydell@linaro.org> References: <20180716164300.6731-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 8/8] accel/tcg: Assert that tlb fill gave us a valid TLB entry 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" In commit 4b1a3e1e34ad97 we added a check for whether the TLB entry we had following a tlb_fill had the INVALID bit set. This could happen in some circumstances because a stale or wrong TLB entry was pulled out of the victim cache. However, after commit 68fea038553039e (which prevents stale entries being in the victim cache) and the previous commit (which ensures we don't incorrectly hit in the victim cache)) this should never be possible. Drop the check on TLB_INVALID_MASK from the "is this a TLB_RECHECK?" condition, and instead assert that the tlb fill procedure has given us a valid TLB entry (or longjumped out with a guest exception). Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20180713141636.18665-3-peter.maydell@linaro.org --- accel/tcg/cputlb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 2d5fb15d9a3..563fa30117e 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -970,10 +970,10 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env, = target_ulong addr) if (!VICTIM_TLB_HIT(addr_code, addr)) { tlb_fill(ENV_GET_CPU(env), addr, 0, MMU_INST_FETCH, mmu_idx, 0= ); } + assert(tlb_hit(env->tlb_table[mmu_idx][index].addr_code, addr)); } =20 - if (unlikely((env->tlb_table[mmu_idx][index].addr_code & - (TLB_RECHECK | TLB_INVALID_MASK)) =3D=3D TLB_RECHECK)) { + if (unlikely(env->tlb_table[mmu_idx][index].addr_code & TLB_RECHECK)) { /* * This is a TLB_RECHECK access, where the MMU protection * covers a smaller range than a target page, and we must --=20 2.17.1