From nobody Tue Nov 4 21:33:46 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; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 153173078563158.49973380461029; Mon, 16 Jul 2018 01:46:25 -0700 (PDT) Received: from localhost ([::1]:49812 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fez9A-0007in-TN for importer@patchew.org; Mon, 16 Jul 2018 04:46:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40019) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fez1R-0001Dh-JN for qemu-devel@nongnu.org; Mon, 16 Jul 2018 04:38:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fez1N-0004y4-3O for qemu-devel@nongnu.org; Mon, 16 Jul 2018 04:38:21 -0400 Received: from ozlabs.org ([203.11.71.1]:57239) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fez1M-0004sl-2y; Mon, 16 Jul 2018 04:38:16 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41TcHm4prNz9s2P; Mon, 16 Jul 2018 18:38:12 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531730292; bh=FZhmBzdpJT1QfUiYQ0sroRpY4IgW0QMIAd9P/KWLQNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RjK6CFc7hzLY3O9epVIgspEP6plI9ik4DZCuA5gbReaUW0mZ1/eYiPEZKpqZ9v6ir OWTfzMS7kYHR5eBWqyNPMODGvi6zY5eWK6gHMODhSFRIHCVAakL0jfj6QQBjvSUPYy 2v3NAwHRRQhuy49qiE7bRvXmBzZwCftFN51fpbug= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 16 Jul 2018 18:38:04 +1000 Message-Id: <20180716083809.17115-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180716083809.17115-1-david@gibson.dropbear.id.au> References: <20180716083809.17115-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 1/6] sm501: Update screen on frame buffer address change X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, groug@kaod.org, David Gibson , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan When the guest changes the address of the frame buffer we need to refresh the screen to correctly display the new content. This fixes display update problems when changing between screens on AmigaOS. Signed-off-by: BALATON Zoltan Signed-off-by: David Gibson --- hw/display/sm501.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 3661a89f60..9ab29d35dd 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -1235,6 +1235,7 @@ static void sm501_disp_ctrl_write(void *opaque, hwadd= r addr, if (value & 0x8000000) { qemu_log_mask(LOG_UNIMP, "Panel external memory not supported\= n"); } + s->do_full_update =3D true; break; case SM501_DC_PANEL_FB_OFFSET: s->dc_panel_fb_offset =3D value & 0x3FF03FF0; @@ -1298,6 +1299,7 @@ static void sm501_disp_ctrl_write(void *opaque, hwadd= r addr, if (value & 0x8000000) { qemu_log_mask(LOG_UNIMP, "CRT external memory not supported\n"= ); } + s->do_full_update =3D true; break; case SM501_DC_CRT_FB_OFFSET: s->dc_crt_fb_offset =3D value & 0x3FF03FF0; --=20 2.17.1 From nobody Tue Nov 4 21:33:46 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; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531730668147853.9592789995324; Mon, 16 Jul 2018 01:44:28 -0700 (PDT) Received: from localhost ([::1]:49789 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fez7L-0005gX-7B for importer@patchew.org; Mon, 16 Jul 2018 04:44:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fez1P-0001B8-Ei for qemu-devel@nongnu.org; Mon, 16 Jul 2018 04:38:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fez1N-0004yS-6s for qemu-devel@nongnu.org; Mon, 16 Jul 2018 04:38:19 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:57179) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fez1M-0004si-3V; Mon, 16 Jul 2018 04:38:17 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41TcHm3Rmkz9rvt; Mon, 16 Jul 2018 18:38:12 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531730292; bh=Jg5eoVdvB4+Y0k3gddvFYo9Vmvh25BlWuGDlNd415tI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=poWDHxbTudsBn+4xrD0BP4RcyGLhin/UJTzEiaif6dCiVuqLXz/egKnVzRW7UAk4V ETxk1cgqBsvfiPxPCje98xdQo0ibDkEdHhlj4+jMO6KrJOdjTtsUDj6KlecGIrVNMV NB4wh6WBTZXNxHk96bH2M4KGlT8fZh4f0+c+uojE= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 16 Jul 2018 18:38:05 +1000 Message-Id: <20180716083809.17115-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180716083809.17115-1-david@gibson.dropbear.id.au> References: <20180716083809.17115-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 2/6] spapr: Correct inverted test in spapr_pc_dimm_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: , Cc: David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This function was introduced between v2.11 and v2.12 to replace obsolete ways of specifying the NUMA nodes for DIMMs. It's used to find the correct node for an LMB, by locating which DIMM object it lies within. Unfortunately, one of the checks is inverted, so we check whether the address is less than two different things, rather than actually checking a range. This introduced a regression, meaning that after a reboot qemu will advertise incorrect node information for memory to the guest. Signed-off-by: David Gibson Reviewed-by: Greg Kurz Reviewed-by: Igor Mammedov --- hw/ppc/spapr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 3f5e1d3ec2..421b2dd09b 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -665,7 +665,7 @@ static uint32_t spapr_pc_dimm_node(MemoryDeviceInfoList= *list, ram_addr_t addr) if (value && value->type =3D=3D MEMORY_DEVICE_INFO_KIND_DIMM) { PCDIMMDeviceInfo *pcdimm_info =3D value->u.dimm.data; =20 - if (pcdimm_info->addr >=3D addr && + if (addr >=3D pcdimm_info->addr && addr < (pcdimm_info->addr + pcdimm_info->size)) { return pcdimm_info->node; } --=20 2.17.1 From nobody Tue Nov 4 21:33:46 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; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531730815285598.5613468887; Mon, 16 Jul 2018 01:46:55 -0700 (PDT) Received: from localhost ([::1]:49813 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fez9i-00081M-54 for importer@patchew.org; Mon, 16 Jul 2018 04:46:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40038) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fez1S-0001ER-VN for qemu-devel@nongnu.org; Mon, 16 Jul 2018 04:38:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fez1Q-00051o-Io for qemu-devel@nongnu.org; Mon, 16 Jul 2018 04:38:22 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:54455) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fez1P-0004z2-NH; Mon, 16 Jul 2018 04:38:20 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41TcHm74bfz9s7G; Mon, 16 Jul 2018 18:38:12 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531730293; bh=TQ2cvpsSwY15FmUWKEB96w2QZt+euSPb7/+jAr0mfU4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pEOo0HcmPUcXkOS355RnorkbqmsE04aTP2I27vmp61OhPnwJRoojmYkhDYOBm2Plp ge+obF8+J+66aHrT7k8nfleaer4lDR3bdLhC6weYlhaIWOBVMGXbMwav1sQk5Fi9Hd D04l2h5bxiFZguawPmkbmlltbCfa0mVn2yBzsEUE= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 16 Jul 2018 18:38:06 +1000 Message-Id: <20180716083809.17115-4-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180716083809.17115-1-david@gibson.dropbear.id.au> References: <20180716083809.17115-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 3/6] ppc/xics: fix ICP reset path X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Greg Kurz Recent cleanup in commit a028dd423ee6 dropped the ICPStateClass::reset handler. It is now up to child ICP classes to call the DeviceClass::reset handler of the parent class, thanks to device_class_set_parent_reset(). This is a better object programming pattern, but unfortunately it causes QEMU to crash during CPU hotplug: (qemu) device_add host-spapr-cpu-core,id=3Dcore1,core-id=3D1 Segmentation fault (core dumped) When the hotplug path tries to reset the ICP device, we end up calling: static void icp_kvm_reset(DeviceState *dev) { ICPStateClass *icpc =3D ICP_GET_CLASS(dev); icpc->parent_reset(dev); but icpc->parent_reset is NULL... This happens because icp_kvm_class_init() calls: device_class_set_parent_reset(dc, icp_kvm_reset, &icpc->parent_reset); but dc->reset, ie, DeviceClass::reset for the TYPE_ICP type, is itself NULL. This patch hence sets DeviceClass::reset for the TYPE_ICP type to point to icp_reset(). It then registers a reset handler that calls DeviceClass::reset. If the ICP subtype has configured its own reset handler with device_class_set_parent_reset(), this ensures it will be called first and it can then call ICPStateClass::parent_reset safely. This fixes the reset path for the TYPE_KVM_ICP type, which is the only subtype that defines its own reset function. Reported-by: Satheesh Rajendran Suggested-by: David Gibson Fixes: a028dd423ee6dfd091a8c63028240832bf10f671 Signed-off-by: Greg Kurz Signed-off-by: David Gibson --- hw/intc/xics.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index b9f1a3c972..c90c893228 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -291,7 +291,7 @@ static const VMStateDescription vmstate_icp_server =3D { }, }; =20 -static void icp_reset(void *dev) +static void icp_reset(DeviceState *dev) { ICPState *icp =3D ICP(dev); =20 @@ -303,6 +303,13 @@ static void icp_reset(void *dev) qemu_set_irq(icp->output, 0); } =20 +static void icp_reset_handler(void *dev) +{ + DeviceClass *dc =3D DEVICE_GET_CLASS(dev); + + dc->reset(dev); +} + static void icp_realize(DeviceState *dev, Error **errp) { ICPState *icp =3D ICP(dev); @@ -345,7 +352,7 @@ static void icp_realize(DeviceState *dev, Error **errp) return; } =20 - qemu_register_reset(icp_reset, dev); + qemu_register_reset(icp_reset_handler, dev); vmstate_register(NULL, icp->cs->cpu_index, &vmstate_icp_server, icp); } =20 @@ -354,7 +361,7 @@ static void icp_unrealize(DeviceState *dev, Error **err= p) ICPState *icp =3D ICP(dev); =20 vmstate_unregister(NULL, &vmstate_icp_server, icp); - qemu_unregister_reset(icp_reset, dev); + qemu_unregister_reset(icp_reset_handler, dev); } =20 static void icp_class_init(ObjectClass *klass, void *data) @@ -363,6 +370,7 @@ static void icp_class_init(ObjectClass *klass, void *da= ta) =20 dc->realize =3D icp_realize; dc->unrealize =3D icp_unrealize; + dc->reset =3D icp_reset; } =20 static const TypeInfo icp_info =3D { --=20 2.17.1 From nobody Tue Nov 4 21:33:46 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; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531730695467904.3793331176638; Mon, 16 Jul 2018 01:44:55 -0700 (PDT) Received: from localhost ([::1]:49797 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fez7m-0006S0-GG for importer@patchew.org; Mon, 16 Jul 2018 04:44:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fez1Q-0001Dc-Rn for qemu-devel@nongnu.org; Mon, 16 Jul 2018 04:38:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fez1N-0004zE-PN for qemu-devel@nongnu.org; Mon, 16 Jul 2018 04:38:20 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:34751) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fez1M-0004sy-K7; Mon, 16 Jul 2018 04:38:17 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41TcHm5pgQz9s29; Mon, 16 Jul 2018 18:38:12 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531730292; bh=uG+7cH1N2xLy+xVh/cvmiwVdYQb7j9s/4dliGvy75G4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nn7pDMeCWL5/0KvyAiz0FYfZpKsK/jc1wyjwsahcayO/oIYledKtXBNwI/hZW4lVc 7Hb5OHaQODxLhJC71HKLGY6+B7T3znf8MmC2X1L7E23mnBH62lb+/eVOR/kcEvbhFO bl3TpaYNMFpK7Qo4qieMHvWf27JUaRYM1qLs8BYc= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 16 Jul 2018 18:38:07 +1000 Message-Id: <20180716083809.17115-5-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180716083809.17115-1-david@gibson.dropbear.id.au> References: <20180716083809.17115-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 4/6] etsec: fix IRQ (un)masking X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Davidsaver , David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Michael Davidsaver Interrupt conditions occurring while masked are not being signaled when later unmasked. The fix is to raise/lower IRQs when IMASK is changed. To avoid problems like this in future, consolidate IRQ pin update logic in one function. Also fix probable typo "IEVENT_TXF | IEVENT_TXF", and update IRQ pins on reset. Signed-off-by: Michael Davidsaver Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- hw/net/fsl_etsec/etsec.c | 68 +++++++++++++++++++----------------- hw/net/fsl_etsec/etsec.h | 2 ++ hw/net/fsl_etsec/registers.h | 10 ++++++ hw/net/fsl_etsec/rings.c | 12 +------ 4 files changed, 49 insertions(+), 43 deletions(-) diff --git a/hw/net/fsl_etsec/etsec.c b/hw/net/fsl_etsec/etsec.c index 9da1932970..0b66274ce3 100644 --- a/hw/net/fsl_etsec/etsec.c +++ b/hw/net/fsl_etsec/etsec.c @@ -49,6 +49,28 @@ static const int debug_etsec; } \ } while (0) =20 +/* call after any change to IEVENT or IMASK */ +void etsec_update_irq(eTSEC *etsec) +{ + uint32_t ievent =3D etsec->regs[IEVENT].value; + uint32_t imask =3D etsec->regs[IMASK].value; + uint32_t active =3D ievent & imask; + + int tx =3D !!(active & IEVENT_TX_MASK); + int rx =3D !!(active & IEVENT_RX_MASK); + int err =3D !!(active & IEVENT_ERR_MASK); + + DPRINTF("%s IRQ ievent=3D%"PRIx32" imask=3D%"PRIx32" %c%c%c", + __func__, ievent, imask, + tx ? 'T' : '_', + rx ? 'R' : '_', + err ? 'E' : '_'); + + qemu_set_irq(etsec->tx_irq, tx); + qemu_set_irq(etsec->rx_irq, rx); + qemu_set_irq(etsec->err_irq, err); +} + static uint64_t etsec_read(void *opaque, hwaddr addr, unsigned size) { eTSEC *etsec =3D opaque; @@ -139,31 +161,6 @@ static void write_rbasex(eTSEC *etsec, etsec->regs[RBPTR0 + (reg_index - RBASE0)].value =3D value & ~0x7; } =20 -static void write_ievent(eTSEC *etsec, - eTSEC_Register *reg, - uint32_t reg_index, - uint32_t value) -{ - /* Write 1 to clear */ - reg->value &=3D ~value; - - if (!(reg->value & (IEVENT_TXF | IEVENT_TXF))) { - qemu_irq_lower(etsec->tx_irq); - } - if (!(reg->value & (IEVENT_RXF | IEVENT_RXF))) { - qemu_irq_lower(etsec->rx_irq); - } - - if (!(reg->value & (IEVENT_MAG | IEVENT_GTSC | IEVENT_GRSC | IEVENT_TX= C | - IEVENT_RXC | IEVENT_BABR | IEVENT_BABT | IEVENT_LC= | - IEVENT_CRL | IEVENT_FGPI | IEVENT_FIR | IEVENT_FIQ= | - IEVENT_DPE | IEVENT_PERR | IEVENT_EBERR | IEVENT_T= XE | - IEVENT_XFUN | IEVENT_BSY | IEVENT_MSRO | IEVENT_MM= RD | - IEVENT_MMRW))) { - qemu_irq_lower(etsec->err_irq); - } -} - static void write_dmactrl(eTSEC *etsec, eTSEC_Register *reg, uint32_t reg_index, @@ -178,9 +175,7 @@ static void write_dmactrl(eTSEC *etsec, } else { /* Graceful receive stop now */ etsec->regs[IEVENT].value |=3D IEVENT_GRSC; - if (etsec->regs[IMASK].value & IMASK_GRSCEN) { - qemu_irq_raise(etsec->err_irq); - } + etsec_update_irq(etsec); } } =20 @@ -191,9 +186,7 @@ static void write_dmactrl(eTSEC *etsec, } else { /* Graceful transmit stop now */ etsec->regs[IEVENT].value |=3D IEVENT_GTSC; - if (etsec->regs[IMASK].value & IMASK_GTSCEN) { - qemu_irq_raise(etsec->err_irq); - } + etsec_update_irq(etsec); } } =20 @@ -222,7 +215,16 @@ static void etsec_write(void *opaque, =20 switch (reg_index) { case IEVENT: - write_ievent(etsec, reg, reg_index, value); + /* Write 1 to clear */ + reg->value &=3D ~value; + + etsec_update_irq(etsec); + break; + + case IMASK: + reg->value =3D value; + + etsec_update_irq(etsec); break; =20 case DMACTRL: @@ -337,6 +339,8 @@ static void etsec_reset(DeviceState *d) MII_SR_EXTENDED_STATUS | MII_SR_100T2_HD_CAPS | MII_SR_100T2_FD_C= APS | MII_SR_10T_HD_CAPS | MII_SR_10T_FD_CAPS | MII_SR_100X_HD_CA= PS | MII_SR_100X_FD_CAPS | MII_SR_100T4_CAPS; + + etsec_update_irq(etsec); } =20 static ssize_t etsec_receive(NetClientState *nc, diff --git a/hw/net/fsl_etsec/etsec.h b/hw/net/fsl_etsec/etsec.h index 30c828e241..877988572e 100644 --- a/hw/net/fsl_etsec/etsec.h +++ b/hw/net/fsl_etsec/etsec.h @@ -163,6 +163,8 @@ DeviceState *etsec_create(hwaddr base, qemu_irq rx_irq, qemu_irq err_irq); =20 +void etsec_update_irq(eTSEC *etsec); + void etsec_walk_tx_ring(eTSEC *etsec, int ring_nbr); void etsec_walk_rx_ring(eTSEC *etsec, int ring_nbr); ssize_t etsec_rx_ring_write(eTSEC *etsec, const uint8_t *buf, size_t size); diff --git a/hw/net/fsl_etsec/registers.h b/hw/net/fsl_etsec/registers.h index c4ed2b9d62..f085537ecd 100644 --- a/hw/net/fsl_etsec/registers.h +++ b/hw/net/fsl_etsec/registers.h @@ -74,6 +74,16 @@ extern const eTSEC_Register_Definition eTSEC_registers_d= ef[]; #define IEVENT_RXC (1 << 30) #define IEVENT_BABR (1 << 31) =20 +/* Mapping between interrupt pin and interrupt flags */ +#define IEVENT_RX_MASK (IEVENT_RXF | IEVENT_RXB) +#define IEVENT_TX_MASK (IEVENT_TXF | IEVENT_TXB) +#define IEVENT_ERR_MASK (IEVENT_MAG | IEVENT_GTSC | IEVENT_GRSC | IEVENT_T= XC | \ + IEVENT_RXC | IEVENT_BABR | IEVENT_BABT | IEVENT_LC | \ + IEVENT_CRL | IEVENT_FGPI | IEVENT_FIR | IEVENT_FIQ | \ + IEVENT_DPE | IEVENT_PERR | IEVENT_EBERR | IEVENT_TXE | \ + IEVENT_XFUN | IEVENT_BSY | IEVENT_MSRO | IEVENT_MMRD | \ + IEVENT_MMRW) + #define IMASK_RXFEN (1 << 7) #define IMASK_GRSCEN (1 << 8) #define IMASK_RXBEN (1 << 15) diff --git a/hw/net/fsl_etsec/rings.c b/hw/net/fsl_etsec/rings.c index d0f93eebfc..337a55fc95 100644 --- a/hw/net/fsl_etsec/rings.c +++ b/hw/net/fsl_etsec/rings.c @@ -152,17 +152,7 @@ static void ievent_set(eTSEC *etsec, { etsec->regs[IEVENT].value |=3D flags; =20 - if ((flags & IEVENT_TXB && etsec->regs[IMASK].value & IMASK_TXBEN) - || (flags & IEVENT_TXF && etsec->regs[IMASK].value & IMASK_TXFEN))= { - qemu_irq_raise(etsec->tx_irq); - RING_DEBUG("%s Raise Tx IRQ\n", __func__); - } - - if ((flags & IEVENT_RXB && etsec->regs[IMASK].value & IMASK_RXBEN) - || (flags & IEVENT_RXF && etsec->regs[IMASK].value & IMASK_RXFEN))= { - qemu_irq_raise(etsec->rx_irq); - RING_DEBUG("%s Raise Rx IRQ\n", __func__); - } + etsec_update_irq(etsec); } =20 static void tx_padding_and_crc(eTSEC *etsec, uint32_t min_frame_len) --=20 2.17.1 From nobody Tue Nov 4 21:33:46 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; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531730415596125.80051839332668; Mon, 16 Jul 2018 01:40:15 -0700 (PDT) Received: from localhost ([::1]:49765 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fez3G-0002IF-JK for importer@patchew.org; Mon, 16 Jul 2018 04:40:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40012) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fez1R-0001Dd-Bu for qemu-devel@nongnu.org; Mon, 16 Jul 2018 04:38:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fez1N-0004y6-49 for qemu-devel@nongnu.org; Mon, 16 Jul 2018 04:38:21 -0400 Received: from ozlabs.org ([203.11.71.1]:47541) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fez1M-0004sz-2s; Mon, 16 Jul 2018 04:38:16 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41TcHm6TWbz9s3q; Mon, 16 Jul 2018 18:38:12 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531730292; bh=WNLJS5aQiigD+sgv9EbP9GFZ0vPHGT1kxrWdRZ3hego=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cgRoCWGXlh4zrJgEVkAHmJb+g5Izi7Pn5gdCloWWEMbZWgbm5G/OhXWXO01kptsio yl5UpEYbraMYRZticvYvixbooYvDEFALYbeNFpUkvN/Dqb0/95prWaMbS68+c0D9yA hwU1++1eIWqdCPW1r8Bas7u24Fcz/bw9ESeCmCgE= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 16 Jul 2018 18:38:08 +1000 Message-Id: <20180716083809.17115-6-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180716083809.17115-1-david@gibson.dropbear.id.au> References: <20180716083809.17115-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 5/6] sam460ex: Correct use after free error X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, groug@kaod.org, David Gibson , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan Commit 51b0d834c changed error handling to report file name in error message but forgot to move freeing it after usage. Noticed by Coverity. Fixes: CID 1394217 Reported-by: Paolo Bonzini Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: David Gibson --- hw/ppc/sam460ex.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index e2b7028843..0999efcc1e 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -269,11 +269,12 @@ static int sam460ex_load_device_tree(hwaddr addr, exit(1); } fdt =3D load_device_tree(filename, &fdt_size); - g_free(filename); if (!fdt) { error_report("Couldn't load dtb file `%s'", filename); + g_free(filename); exit(1); } + g_free(filename); =20 /* Manipulate device tree in memory. */ =20 --=20 2.17.1 From nobody Tue Nov 4 21:33:46 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; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531730563842274.95290355429086; Mon, 16 Jul 2018 01:42:43 -0700 (PDT) Received: from localhost ([::1]:49779 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fez5e-00049w-LN for importer@patchew.org; Mon, 16 Jul 2018 04:42:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40024) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fez1S-0001Dk-60 for qemu-devel@nongnu.org; Mon, 16 Jul 2018 04:38:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fez1Q-00051L-05 for qemu-devel@nongnu.org; Mon, 16 Jul 2018 04:38:22 -0400 Received: from ozlabs.org ([203.11.71.1]:41453) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fez1P-0004yu-EV; Mon, 16 Jul 2018 04:38:19 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41TcHn0gCgz9s2g; Mon, 16 Jul 2018 18:38:12 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531730293; bh=zXnUpfU39XzizE4+1f1+mn6F28jZP2H2aiFFNg4CxHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fhG8umfkVxPmf63jtFajqeiZieho1oXFJB1nSmHvRsjWiak8h6OeMY2TaqVMZMuV/ kt5b+9+qsDrKvdPuAiyAkj0Zx9HC5b0p7GMkoI0WGg0E+A6NKymCCJxf5amHJy5QkV 8kXzvK1HpGLiNeiU9xk6OrCj5wEKXd1FIYaMqyS0= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 16 Jul 2018 18:38:09 +1000 Message-Id: <20180716083809.17115-7-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180716083809.17115-1-david@gibson.dropbear.id.au> References: <20180716083809.17115-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 6/6] sm501: Fix warning about unreachable 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: , Cc: qemu-ppc@nongnu.org, groug@kaod.org, David Gibson , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan Coverity warned that the false arm of conditional expression is unreachable when it is inside an if with the same condition. Remove the unreachable code to avoid the warning. Fixes: CID 1394215 Reported-by: Paolo Bonzini Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: David Gibson --- hw/display/sm501.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 9ab29d35dd..874260a143 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -1024,7 +1024,7 @@ static void sm501_i2c_write(void *opaque, hwaddr addr= , uint64_t value, if (res) { SM501_DPRINTF("sm501 i2c : transfer failed" " i=3D%d, res=3D%d\n", i, res); - s->i2c_status |=3D (res ? SM501_I2C_STATUS_ERR= OR : 0); + s->i2c_status |=3D SM501_I2C_STATUS_ERROR; return; } } --=20 2.17.1