From nobody Sun May 5 20:13:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585340200; cv=none; d=zohomail.com; s=zohoarc; b=GFLiQ3a5xSqmUuGgut21NEZkRcfzCX/9s24+YUPWDkKVlLqrBhxYMkusEGhRtZv6o/n4JI8dufg3yUVve6QwZ+HUQFYTwV78T3wGlDKFEmha4XoPYy3u17vFYmHkypsD+Th0V0Rvr86ALXkJNai7ocC/Q0DPOr04fsV0r0OAKuk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585340200; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LWjdcU0+UwWOy2uhLjizldByOPRYIeGKr/Jd6SGhlS4=; b=JDk0kS1wr7IofeANq7Jodb+HA6RB4X3ULn/g1dWbjnfY3BvOkIyqt2d7VhbJ9emVxHl/dXVUMRmBZbm66GIoHUB6P0n+MBick6aC5bTGaVEk0oz1tH89g2Re+2ahXS2xVmYsZEExxaU2ob0XDywGgY5pqFVMEfXDYL20CQdbxrE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585340200482795.4089330942162; Fri, 27 Mar 2020 13:16:40 -0700 (PDT) Received: from localhost ([::1]:46482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHvPD-0003xs-50 for importer@patchew.org; Fri, 27 Mar 2020 16:16:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57728) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHvO2-00027j-Lg for qemu-devel@nongnu.org; Fri, 27 Mar 2020 16:15:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHvO1-0002yA-3A for qemu-devel@nongnu.org; Fri, 27 Mar 2020 16:15:26 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:23055) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jHvO0-0002xe-Vd for qemu-devel@nongnu.org; Fri, 27 Mar 2020 16:15:25 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-340-srW0rZfPOVKNqb2ljTKN6A-1; Fri, 27 Mar 2020 16:15:22 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 60F6C107ACC7; Fri, 27 Mar 2020 20:15:18 +0000 (UTC) Received: from probe.redhat.com (ovpn-113-210.rdu2.redhat.com [10.10.113.210]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C47819C7F; Fri, 27 Mar 2020 20:15:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585340124; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LWjdcU0+UwWOy2uhLjizldByOPRYIeGKr/Jd6SGhlS4=; b=CGClqOiQdpZddTPw8HkK/wipQ51M9V4xVldABNoEjhLmLawl1HZ6zVTiGOlS4EBHQhVqNM 0jgqgRSjS/+9zi1bHx1ksQT0vggSdsn2zYFOkr38aj+WzISKb6V/jLWGKS1JdjZDcMgi2k yuVhAfMMZDmKqSkhg38d+TT54ZY86/s= X-MC-Unique: srW0rZfPOVKNqb2ljTKN6A-1 From: John Snow To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 1/5] fdc/i8257: implement verify transfer mode Date: Fri, 27 Mar 2020 16:14:57 -0400 Message-Id: <20200327201501.1417-2-jsnow@redhat.com> In-Reply-To: <20200327201501.1417-1-jsnow@redhat.com> References: <20200327201501.1417-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Michael S. Tsirkin" , Mark Cave-Ayland , Sven Schnelle , qemu-block@nongnu.org, Helge Deller , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Rikalo , David Gibson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Laurent Vivier , Thomas Huth , Eduardo Habkost , John Snow , Richard Henderson , Kevin Wolf , Max Reitz , qemu-ppc@nongnu.org, Aleksandar Markovic , Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Sven Schnelle While working on the Tulip driver i tried to write some Teledisk images to a floppy image which didn't work. Turned out that Teledisk checks the writt= en data by issuing a READ command to the FDC but running the DMA controller in VERIFY mode. As we ignored the DMA request in that case, the DMA transfer never finished, and Teledisk reported an error. The i8257 spec says about verify transfers: 3) DMA verify, which does not actually involve the transfer of data. When an 8257 channel is in the DMA verify mode, it will respond the same as describ= ed for transfer operations, except that no memory or I/O read/write control si= gnals will be generated. Herv=C3=A9 proposed to remove all the dma_mode_ok stuff from fdc to have a = more clear boundary between DMA and FDC, so this patch also does that. Suggested-by: Herv=C3=A9 Poussineau Signed-off-by: Sven Schnelle Reviewed-by: Herv=C3=A9 Poussineau Signed-off-by: John Snow --- include/hw/isa/isa.h | 1 - hw/block/fdc.c | 61 +++++++++++++------------------------------- hw/dma/i8257.c | 20 ++++++++++----- 3 files changed, 31 insertions(+), 51 deletions(-) diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h index e9ac1f1205..59a4d4b50a 100644 --- a/include/hw/isa/isa.h +++ b/include/hw/isa/isa.h @@ -56,7 +56,6 @@ typedef int (*IsaDmaTransferHandler)(void *opaque, int nc= han, int pos, typedef struct IsaDmaClass { InterfaceClass parent; =20 - IsaDmaTransferMode (*get_transfer_mode)(IsaDma *obj, int nchan); bool (*has_autoinitialization)(IsaDma *obj, int nchan); int (*read_memory)(IsaDma *obj, int nchan, void *buf, int pos, int len= ); int (*write_memory)(IsaDma *obj, int nchan, void *buf, int pos, int le= n); diff --git a/hw/block/fdc.c b/hw/block/fdc.c index 22e954e0dc..33bc9e2f92 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -1714,53 +1714,28 @@ static void fdctrl_start_transfer(FDCtrl *fdctrl, i= nt direction) } fdctrl->eot =3D fdctrl->fifo[6]; if (fdctrl->dor & FD_DOR_DMAEN) { - IsaDmaTransferMode dma_mode; + /* DMA transfer is enabled. */ IsaDmaClass *k =3D ISADMA_GET_CLASS(fdctrl->dma); - bool dma_mode_ok; - /* DMA transfer are enabled. Check if DMA channel is well programm= ed */ - dma_mode =3D k->get_transfer_mode(fdctrl->dma, fdctrl->dma_chann); - FLOPPY_DPRINTF("dma_mode=3D%d direction=3D%d (%d - %d)\n", - dma_mode, direction, - (128 << fdctrl->fifo[5]) * + + FLOPPY_DPRINTF("direction=3D%d (%d - %d)\n", + direction, (128 << fdctrl->fifo[5]) * (cur_drv->last_sect - ks + 1), fdctrl->data_len); - switch (direction) { - case FD_DIR_SCANE: - case FD_DIR_SCANL: - case FD_DIR_SCANH: - dma_mode_ok =3D (dma_mode =3D=3D ISADMA_TRANSFER_VERIFY); - break; - case FD_DIR_WRITE: - dma_mode_ok =3D (dma_mode =3D=3D ISADMA_TRANSFER_WRITE); - break; - case FD_DIR_READ: - dma_mode_ok =3D (dma_mode =3D=3D ISADMA_TRANSFER_READ); - break; - case FD_DIR_VERIFY: - dma_mode_ok =3D true; - break; - default: - dma_mode_ok =3D false; - break; - } - if (dma_mode_ok) { - /* No access is allowed until DMA transfer has completed */ - fdctrl->msr &=3D ~FD_MSR_RQM; - if (direction !=3D FD_DIR_VERIFY) { - /* Now, we just have to wait for the DMA controller to - * recall us... - */ - k->hold_DREQ(fdctrl->dma, fdctrl->dma_chann); - k->schedule(fdctrl->dma); - } else { - /* Start transfer */ - fdctrl_transfer_handler(fdctrl, fdctrl->dma_chann, 0, - fdctrl->data_len); - } - return; + + /* No access is allowed until DMA transfer has completed */ + fdctrl->msr &=3D ~FD_MSR_RQM; + if (direction !=3D FD_DIR_VERIFY) { + /* + * Now, we just have to wait for the DMA controller to + * recall us... + */ + k->hold_DREQ(fdctrl->dma, fdctrl->dma_chann); + k->schedule(fdctrl->dma); } else { - FLOPPY_DPRINTF("bad dma_mode=3D%d direction=3D%d\n", dma_mode, - direction); + /* Start transfer */ + fdctrl_transfer_handler(fdctrl, fdctrl->dma_chann, 0, + fdctrl->data_len); } + return; } FLOPPY_DPRINTF("start non-DMA transfer\n"); fdctrl->msr |=3D FD_MSR_NONDMA | FD_MSR_RQM; diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c index ef15c06d77..1b3435ab58 100644 --- a/hw/dma/i8257.c +++ b/hw/dma/i8257.c @@ -292,12 +292,6 @@ static uint64_t i8257_read_cont(void *opaque, hwaddr n= port, unsigned size) return val; } =20 -static IsaDmaTransferMode i8257_dma_get_transfer_mode(IsaDma *obj, int nch= an) -{ - I8257State *d =3D I8257(obj); - return (d->regs[nchan & 3].mode >> 2) & 3; -} - static bool i8257_dma_has_autoinitialization(IsaDma *obj, int nchan) { I8257State *d =3D I8257(obj); @@ -400,6 +394,11 @@ static void i8257_dma_register_channel(IsaDma *obj, in= t nchan, r->opaque =3D opaque; } =20 +static bool i8257_is_verify_transfer(I8257Regs *r) +{ + return (r->mode & 0x0c) =3D=3D 0; +} + static int i8257_dma_read_memory(IsaDma *obj, int nchan, void *buf, int po= s, int len) { @@ -407,6 +406,10 @@ static int i8257_dma_read_memory(IsaDma *obj, int ncha= n, void *buf, int pos, I8257Regs *r =3D &d->regs[nchan & 3]; hwaddr addr =3D ((r->pageh & 0x7f) << 24) | (r->page << 16) | r->now[A= DDR]; =20 + if (i8257_is_verify_transfer(r)) { + return len; + } + if (r->mode & 0x20) { int i; uint8_t *p =3D buf; @@ -431,6 +434,10 @@ static int i8257_dma_write_memory(IsaDma *obj, int nch= an, void *buf, int pos, I8257Regs *r =3D &s->regs[nchan & 3]; hwaddr addr =3D ((r->pageh & 0x7f) << 24) | (r->page << 16) | r->now[A= DDR]; =20 + if (i8257_is_verify_transfer(r)) { + return len; + } + if (r->mode & 0x20) { int i; uint8_t *p =3D buf; @@ -597,7 +604,6 @@ static void i8257_class_init(ObjectClass *klass, void *= data) dc->vmsd =3D &vmstate_i8257; device_class_set_props(dc, i8257_properties); =20 - idc->get_transfer_mode =3D i8257_dma_get_transfer_mode; idc->has_autoinitialization =3D i8257_dma_has_autoinitialization; idc->read_memory =3D i8257_dma_read_memory; idc->write_memory =3D i8257_dma_write_memory; --=20 2.21.1 From nobody Sun May 5 20:13:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585340382; cv=none; d=zohomail.com; s=zohoarc; b=PMeFUn8SR+fg0rFyZoWhpRWccAUjNTiPlpJtQB4aVBLoU1DGnKwzq3/IXvu63+kd25mtp2vMV0B3WTHcAbcNGp1kSWvUNemGIqTTMFPplG9H5pXj3ZW7O/w2pHokLz731/NK3XssqevL/5HVskP4rfgCLP6DgyVydlTKVdcBmpg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585340382; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zQFNGKhJkuckNqnn3T7IwEfqRFWlsvZN8tLTUAXGp1c=; b=CFcM0LYHs9BYuNaGSeitzyfjelj+3H4X8bXUZvm38lwxf5sQlsXWeHiK7ybDbJlRwtUWIxFsJrA1MZG5f2ixeFp/OTQ6gAEoP24hrnFAbHbya7LyRUR3Gxx9j/SCC7igCCcrxST69cWx4iTOaM1BMfu5L71sjT48HAfpI2ypsFM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585340382462165.22431641395553; Fri, 27 Mar 2020 13:19:42 -0700 (PDT) Received: from localhost ([::1]:46516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHvS9-0007Pb-7f for importer@patchew.org; Fri, 27 Mar 2020 16:19:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57785) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHvO6-0002Fd-DH for qemu-devel@nongnu.org; Fri, 27 Mar 2020 16:15:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHvO5-00036Z-2x for qemu-devel@nongnu.org; Fri, 27 Mar 2020 16:15:30 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:20753) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jHvO4-00035C-UV for qemu-devel@nongnu.org; Fri, 27 Mar 2020 16:15:29 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-98-63m6sd7hMv2m9i_kiFuqZA-1; Fri, 27 Mar 2020 16:15:24 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3616D801A0F; Fri, 27 Mar 2020 20:15:22 +0000 (UTC) Received: from probe.redhat.com (ovpn-113-210.rdu2.redhat.com [10.10.113.210]) by smtp.corp.redhat.com (Postfix) with ESMTP id 889BD166AE; Fri, 27 Mar 2020 20:15:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585340128; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zQFNGKhJkuckNqnn3T7IwEfqRFWlsvZN8tLTUAXGp1c=; b=iRriy04fTFI305HxNdrL2Ukq8Ry2nXAUrzxuiXqSXYmew9KKUBe6QrenP7rXJa5KkQSldH QUfSwpbDuEYMBp/4JONj9PF2ZItGJggdtCEYaYezaHL7PN+V66BVqUV9auBHd10HvscRTR ibYnBl4yOpovpxnLgv+/OOhCJAwVoo4= X-MC-Unique: 63m6sd7hMv2m9i_kiFuqZA-1 From: John Snow To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 2/5] hw/ide/sii3112: Use qdev gpio rather than qemu_allocate_irqs() Date: Fri, 27 Mar 2020 16:14:58 -0400 Message-Id: <20200327201501.1417-3-jsnow@redhat.com> In-Reply-To: <20200327201501.1417-1-jsnow@redhat.com> References: <20200327201501.1417-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Michael S. Tsirkin" , Mark Cave-Ayland , qemu-block@nongnu.org, Helge Deller , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Rikalo , David Gibson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Laurent Vivier , Thomas Huth , Eduardo Habkost , John Snow , Richard Henderson , Kevin Wolf , Max Reitz , qemu-ppc@nongnu.org, Aleksandar Markovic , Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Peter Maydell Coverity points out (CID 1421984) that we are leaking the memory returned by qemu_allocate_irqs(). We can avoid this leak by switching to using qdev_init_gpio_in(); the base class finalize will free the irqs that this allocates under the hood. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: John Snow Tested-by: BALATON Zoltan Message-id: 20200323151715.29454-1-peter.maydell@linaro.org [Maintainer edit: replace `DEVICE(dev)` by `ds` --js] Signed-off-by: John Snow --- hw/ide/sii3112.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/ide/sii3112.c b/hw/ide/sii3112.c index 06605d7af2..d69079c3d9 100644 --- a/hw/ide/sii3112.c +++ b/hw/ide/sii3112.c @@ -251,8 +251,8 @@ static void sii3112_pci_realize(PCIDevice *dev, Error *= *errp) { SiI3112PCIState *d =3D SII3112_PCI(dev); PCIIDEState *s =3D PCI_IDE(dev); + DeviceState *ds =3D DEVICE(dev); MemoryRegion *mr; - qemu_irq *irq; int i; =20 pci_config_set_interrupt_pin(dev->config, 1); @@ -280,10 +280,10 @@ static void sii3112_pci_realize(PCIDevice *dev, Error= **errp) memory_region_init_alias(mr, OBJECT(d), "sii3112.bar4", &d->mmio, 0, 1= 6); pci_register_bar(dev, 4, PCI_BASE_ADDRESS_SPACE_IO, mr); =20 - irq =3D qemu_allocate_irqs(sii3112_set_irq, d, 2); + qdev_init_gpio_in(ds, sii3112_set_irq, 2); for (i =3D 0; i < 2; i++) { - ide_bus_new(&s->bus[i], sizeof(s->bus[i]), DEVICE(dev), i, 1); - ide_init2(&s->bus[i], irq[i]); + ide_bus_new(&s->bus[i], sizeof(s->bus[i]), ds, i, 1); + ide_init2(&s->bus[i], qdev_get_gpio_in(ds, i)); =20 bmdma_init(&s->bus[i], &s->bmdma[i], s); s->bmdma[i].bus =3D &s->bus[i]; --=20 2.21.1 From nobody Sun May 5 20:13:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585340304; cv=none; d=zohomail.com; s=zohoarc; b=crzE3xbVtfvYu3122GWsETyErTbBclxhkh1Tn3637TQs+m126CImugz6fqyz3n98EfHbe9lb2scGLUmkWOe+O1/v23jljtW/DGSTHjR6TyOKWUQ44Uk7Wu9MaeH7HaiuWB2HvitH8VvQumuvFYj0nnpIEHnIg/6X6sEPebCPcD8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585340304; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YPke/Eo9yLBSwedbOokwjPMQC/LRtOf0e/P1yN/8H/M=; b=AdScUay06rbWdM5VsuHTUX/LjmSHevbjk9Xn6PYTxmWAvmPk/W/v0EYt/kG2F4mZxOGnY3j4TvyAaTYG3YcNEySowYywV0LWhdJES86i/kh7DSo1ogNv9bTj82LeEZ6doE4CMT4wm3EG6kP/JoEJ57zBDjOlu2pXtsvOGZWiLVY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585340304386561.7742539998316; Fri, 27 Mar 2020 13:18:24 -0700 (PDT) Received: from localhost ([::1]:46506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHvQs-0005qY-52 for importer@patchew.org; Fri, 27 Mar 2020 16:18:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57800) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHvO7-0002Gq-0t for qemu-devel@nongnu.org; Fri, 27 Mar 2020 16:15:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHvO5-000382-Us for qemu-devel@nongnu.org; Fri, 27 Mar 2020 16:15:30 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:43449) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jHvO5-00037A-QR for qemu-devel@nongnu.org; Fri, 27 Mar 2020 16:15:29 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-238-JtKweeeHOQC9-lldGvQNjw-1; Fri, 27 Mar 2020 16:15:27 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 124E4107ACC9; Fri, 27 Mar 2020 20:15:25 +0000 (UTC) Received: from probe.redhat.com (ovpn-113-210.rdu2.redhat.com [10.10.113.210]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E51619C7F; Fri, 27 Mar 2020 20:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585340129; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YPke/Eo9yLBSwedbOokwjPMQC/LRtOf0e/P1yN/8H/M=; b=JoQgRZSpQ8632ilSd3iQaZJ3IJpwQ5ndE3Cke8+cTHFeNPuUGYFh+MPrqQnoStymFU5i97 UdFIR7wQeuaobY7YMUVn5DVOXaZWWpFUzZ+44FP4xPgKWl8DusK77W6EHzffCZ0iEQIRxp mmNS9qEUCUO7GzUa65MxXp3lq15X+fY= X-MC-Unique: JtKweeeHOQC9-lldGvQNjw-1 From: John Snow To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 3/5] via-ide: don't use PCI level for legacy IRQs Date: Fri, 27 Mar 2020 16:14:59 -0400 Message-Id: <20200327201501.1417-4-jsnow@redhat.com> In-Reply-To: <20200327201501.1417-1-jsnow@redhat.com> References: <20200327201501.1417-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Michael S. Tsirkin" , Mark Cave-Ayland , qemu-block@nongnu.org, Helge Deller , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Rikalo , David Gibson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Laurent Vivier , Thomas Huth , Eduardo Habkost , John Snow , Richard Henderson , Kevin Wolf , Max Reitz , qemu-ppc@nongnu.org, Aleksandar Markovic , Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland The PCI level calculation was accidentally left in when rebasing from a previous patchset. Since both IRQs are driven separately, the value being passed into the IRQ handler should be used directly. Signed-off-by: Mark Cave-Ayland Message-id: 20200324210519.2974-2-mark.cave-ayland@ilande.co.uk Signed-off-by: John Snow --- hw/ide/via.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/ide/via.c b/hw/ide/via.c index 8de4945cc1..2a55b7fbc6 100644 --- a/hw/ide/via.c +++ b/hw/ide/via.c @@ -112,7 +112,6 @@ static void via_ide_set_irq(void *opaque, int n, int le= vel) d->config[0x70 + n * 8] &=3D ~0x80; } =20 - level =3D (d->config[0x70] & 0x80) || (d->config[0x78] & 0x80); qemu_set_irq(isa_get_irq(NULL, 14 + n), level); } =20 --=20 2.21.1 From nobody Sun May 5 20:13:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585340467; cv=none; d=zohomail.com; s=zohoarc; b=SIGEAdQfGkzthvbvoafl8X1Vf0RQfCZlJWjtF2c31fX5l3FEjXyYFEKgNzffXrbHDOR3AslZARyuk9FeycxhZAi5SYclX7RmyWReHaxDsoXsw3Vur28bGzJK+rO/04PgaViBX6ISk7NjLwPgtPxNYJM7rpSeL3sdnwa71554sgk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585340467; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Wb57722k04O6Jmrt5TZW6SVzmKByiDi63Qbe3WI68UM=; b=l8j0B094mrmhLKu52iA1raAWarQDdKTZLU9Cr2sCPtaMnSpN98UDsA2hplA/Mnt8ZftfRYlDYUSsCiUg1srpJEoTtSqO2Bw8PctpxJnK3SZ1AdvBQpZb2AUUz4Aum8LHlSpL5/1uVeC+9J7xRmiEyspM/vqvUQLOkJeOaADptpg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585340467327290.4589696806411; Fri, 27 Mar 2020 13:21:07 -0700 (PDT) Received: from localhost ([::1]:46536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHvTV-0000AL-MC for importer@patchew.org; Fri, 27 Mar 2020 16:21:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57851) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHvO9-0002Ll-78 for qemu-devel@nongnu.org; Fri, 27 Mar 2020 16:15:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHvO8-0003Bv-3y for qemu-devel@nongnu.org; Fri, 27 Mar 2020 16:15:33 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:57040) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jHvO8-0003BI-08 for qemu-devel@nongnu.org; Fri, 27 Mar 2020 16:15:32 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-2-dfFpU7mVNl2109tX3WiM-g-1; Fri, 27 Mar 2020 16:15:29 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7B2CFDB21; Fri, 27 Mar 2020 20:15:27 +0000 (UTC) Received: from probe.redhat.com (ovpn-113-210.rdu2.redhat.com [10.10.113.210]) by smtp.corp.redhat.com (Postfix) with ESMTP id 36E2519C7F; Fri, 27 Mar 2020 20:15:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585340131; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Wb57722k04O6Jmrt5TZW6SVzmKByiDi63Qbe3WI68UM=; b=B2Q42VHF5/3GsPKBRdPl7Q/trQsn0CFpSrhStAnC+zZRtkpweiRjVvIkeFGyAQGTip6wcy q+tUU/HhgM44Xw23A+k9Uy5YgvGBy5w/aif5IDDRB+X8scn0NMRto5IDXin7gpFT0BpwXs ZiICdoZ3wO0nk/gNYLiGyHsFaywONns= X-MC-Unique: dfFpU7mVNl2109tX3WiM-g-1 From: John Snow To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 4/5] via-ide: use qdev gpio rather than qemu_allocate_irqs() Date: Fri, 27 Mar 2020 16:15:00 -0400 Message-Id: <20200327201501.1417-5-jsnow@redhat.com> In-Reply-To: <20200327201501.1417-1-jsnow@redhat.com> References: <20200327201501.1417-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Michael S. Tsirkin" , Mark Cave-Ayland , qemu-block@nongnu.org, Helge Deller , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Rikalo , David Gibson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Laurent Vivier , Thomas Huth , Eduardo Habkost , John Snow , Richard Henderson , Kevin Wolf , Max Reitz , qemu-ppc@nongnu.org, Aleksandar Markovic , Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland This prevents the memory from qemu_allocate_irqs() from being leaked which can in some cases be spotted by Coverity (CID 1421984). Signed-off-by: Mark Cave-Ayland Message-id: 20200324210519.2974-3-mark.cave-ayland@ilande.co.uk Signed-off-by: John Snow --- hw/ide/via.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/ide/via.c b/hw/ide/via.c index 2a55b7fbc6..be09912b33 100644 --- a/hw/ide/via.c +++ b/hw/ide/via.c @@ -160,6 +160,7 @@ static void via_ide_reset(DeviceState *dev) static void via_ide_realize(PCIDevice *dev, Error **errp) { PCIIDEState *d =3D PCI_IDE(dev); + DeviceState *ds =3D DEVICE(dev); uint8_t *pci_conf =3D dev->config; int i; =20 @@ -187,9 +188,10 @@ static void via_ide_realize(PCIDevice *dev, Error **er= rp) bmdma_setup_bar(d); pci_register_bar(dev, 4, PCI_BASE_ADDRESS_SPACE_IO, &d->bmdma_bar); =20 + qdev_init_gpio_in(ds, via_ide_set_irq, 2); for (i =3D 0; i < 2; i++) { - ide_bus_new(&d->bus[i], sizeof(d->bus[i]), DEVICE(d), i, 2); - ide_init2(&d->bus[i], qemu_allocate_irq(via_ide_set_irq, d, i)); + ide_bus_new(&d->bus[i], sizeof(d->bus[i]), ds, i, 2); + ide_init2(&d->bus[i], qdev_get_gpio_in(ds, i)); =20 bmdma_init(&d->bus[i], &d->bmdma[i], d); d->bmdma[i].bus =3D &d->bus[i]; --=20 2.21.1 From nobody Sun May 5 20:13:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585340544; cv=none; d=zohomail.com; s=zohoarc; b=cl5D79WI/89RIycb25uMFGfwT+V54sxZP5nozVdTV9oDXiKCn+sgqeBZ+ufKeYCCBw6ggnyBMNYzqHr15B4c9bJRWZRCXpM7psxF/ZJ4qQr6lIvHJ4e8xFVGy9udXHC1UUbwiLiShc3R+VIZIo4M5ZpB04+1tprFchxqa7+ymu4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585340544; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HlEC6r3nGGTqkFYTMWughwRPS15kMqFsrxaGydRPwtM=; b=X1KbiUJm0H4h+osRvn+zhumpdJUF/Xbdv2Bkg6l0gmsgHpiAYnrS6uofqqz7VcP5VWa+shQJpPjgBluxYdXeVUr61wIYUCwyE3wBiIkLuViqPEuA0evZnLy6c/j8zvjSXj2MnEuWnzYeY6h9XlVALQ9ZGTa8DTk0wzBcnqZ6Rac= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585340544303261.18214919388015; Fri, 27 Mar 2020 13:22:24 -0700 (PDT) Received: from localhost ([::1]:46546 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHvUk-00018S-Ny for importer@patchew.org; Fri, 27 Mar 2020 16:22:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57895) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHvOC-0002TB-4C for qemu-devel@nongnu.org; Fri, 27 Mar 2020 16:15:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHvOA-0003GT-Vw for qemu-devel@nongnu.org; Fri, 27 Mar 2020 16:15:36 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:20082) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jHvOA-0003Fa-Rg for qemu-devel@nongnu.org; Fri, 27 Mar 2020 16:15:34 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-445-wAfPHWDINoaLzZj_G7dV9A-1; Fri, 27 Mar 2020 16:15:32 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1D414100551A; Fri, 27 Mar 2020 20:15:30 +0000 (UTC) Received: from probe.redhat.com (ovpn-113-210.rdu2.redhat.com [10.10.113.210]) by smtp.corp.redhat.com (Postfix) with ESMTP id A07C819C7F; Fri, 27 Mar 2020 20:15:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585340134; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HlEC6r3nGGTqkFYTMWughwRPS15kMqFsrxaGydRPwtM=; b=g/8+W8kuiGw9PeTTqfzJjLfcgkGIacQWx40LFqP7O4zDkyMZsdQI0pxkQyhX4+1OrdzCnM d6Py5y5fiL9N/g/G0zOF5JOqnGnLvXyDW6E/VfDZkocT/PRnQBivKk3XvjA0TyPw0vPOrA F7LHupWd4XKfxGVDqvurxO026xrtNZg= X-MC-Unique: wAfPHWDINoaLzZj_G7dV9A-1 From: John Snow To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 5/5] cmd646-ide: use qdev gpio rather than qemu_allocate_irqs() Date: Fri, 27 Mar 2020 16:15:01 -0400 Message-Id: <20200327201501.1417-6-jsnow@redhat.com> In-Reply-To: <20200327201501.1417-1-jsnow@redhat.com> References: <20200327201501.1417-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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: 216.205.24.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Michael S. Tsirkin" , Mark Cave-Ayland , qemu-block@nongnu.org, Helge Deller , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Rikalo , David Gibson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Laurent Vivier , Thomas Huth , Eduardo Habkost , John Snow , Richard Henderson , Kevin Wolf , Max Reitz , qemu-ppc@nongnu.org, Aleksandar Markovic , Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland This prevents the memory from qemu_allocate_irqs() from being leaked which can in some cases be spotted by Coverity (CID 1421984). Signed-off-by: Mark Cave-Ayland Message-id: 20200324210519.2974-4-mark.cave-ayland@ilande.co.uk Signed-off-by: John Snow --- hw/ide/cmd646.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c index 699f25824d..c254631485 100644 --- a/hw/ide/cmd646.c +++ b/hw/ide/cmd646.c @@ -249,8 +249,8 @@ static void cmd646_pci_config_write(PCIDevice *d, uint3= 2_t addr, uint32_t val, static void pci_cmd646_ide_realize(PCIDevice *dev, Error **errp) { PCIIDEState *d =3D PCI_IDE(dev); + DeviceState *ds =3D DEVICE(dev); uint8_t *pci_conf =3D dev->config; - qemu_irq *irq; int i; =20 pci_conf[PCI_CLASS_PROG] =3D 0x8f; @@ -291,16 +291,15 @@ static void pci_cmd646_ide_realize(PCIDevice *dev, Er= ror **errp) /* TODO: RST# value should be 0 */ pci_conf[PCI_INTERRUPT_PIN] =3D 0x01; // interrupt on pin 1 =20 - irq =3D qemu_allocate_irqs(cmd646_set_irq, d, 2); + qdev_init_gpio_in(ds, cmd646_set_irq, 2); for (i =3D 0; i < 2; i++) { - ide_bus_new(&d->bus[i], sizeof(d->bus[i]), DEVICE(dev), i, 2); - ide_init2(&d->bus[i], irq[i]); + ide_bus_new(&d->bus[i], sizeof(d->bus[i]), ds, i, 2); + ide_init2(&d->bus[i], qdev_get_gpio_in(ds, i)); =20 bmdma_init(&d->bus[i], &d->bmdma[i], d); d->bmdma[i].bus =3D &d->bus[i]; ide_register_restart_cb(&d->bus[i]); } - g_free(irq); } =20 static void pci_cmd646_ide_exitfn(PCIDevice *dev) --=20 2.21.1