From patchwork Fri Mar 13 08:24:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1254289 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ilande.co.uk Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48dzKv2hDHz9sRN for ; Fri, 13 Mar 2020 19:25:55 +1100 (AEDT) Received: from localhost ([::1]:55468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCfdh-0008Db-5s for incoming@patchwork.ozlabs.org; Fri, 13 Mar 2020 04:25:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56550) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCfcr-00084D-OI for qemu-devel@nongnu.org; Fri, 13 Mar 2020 04:25:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCfcq-0004la-OZ for qemu-devel@nongnu.org; Fri, 13 Mar 2020 04:25:01 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:51500 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jCfco-0004gl-Q9; Fri, 13 Mar 2020 04:24:58 -0400 Received: from host86-185-91-43.range86-185.btcentralplus.com ([86.185.91.43] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1jCfd9-0007Mr-FE; Fri, 13 Mar 2020 08:25:22 +0000 From: Mark Cave-Ayland To: jsnow@redhat.com, philmd@redhat.com, amarkovic@wavecomp.com, mst@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, balaton@eik.bme.hu Date: Fri, 13 Mar 2020 08:24:38 +0000 Message-Id: <20200313082444.2439-2-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200313082444.2439-1-mark.cave-ayland@ilande.co.uk> References: <20200313082444.2439-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 86.185.91.43 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH 1/7] via-ide: move registration of VMStateDescription to DeviceClass X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:41c9:1:41f::167 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé --- hw/ide/via.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/ide/via.c b/hw/ide/via.c index 096de8dba0..84f0efff94 100644 --- a/hw/ide/via.c +++ b/hw/ide/via.c @@ -190,8 +190,6 @@ static void via_ide_realize(PCIDevice *dev, Error **errp) bmdma_setup_bar(d); pci_register_bar(dev, 4, PCI_BASE_ADDRESS_SPACE_IO, &d->bmdma_bar); - vmstate_register(VMSTATE_IF(dev), 0, &vmstate_ide_pci, d); - for (i = 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)); @@ -227,6 +225,7 @@ static void via_ide_class_init(ObjectClass *klass, void *data) PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); dc->reset = via_ide_reset; + dc->vmsd = &vmstate_ide_pci; k->realize = via_ide_realize; k->exit = via_ide_exitfn; k->vendor_id = PCI_VENDOR_ID_VIA; From patchwork Fri Mar 13 08:24:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1254291 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ilande.co.uk Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48dzMx6jxTz9sRN for ; Fri, 13 Mar 2020 19:27:41 +1100 (AEDT) Received: from localhost ([::1]:55502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCffN-0002wI-JI for incoming@patchwork.ozlabs.org; Fri, 13 Mar 2020 04:27:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56710) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCfcy-0008Pt-EJ for qemu-devel@nongnu.org; Fri, 13 Mar 2020 04:25:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCfcx-0004wJ-8V for qemu-devel@nongnu.org; Fri, 13 Mar 2020 04:25:08 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:51510 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jCfcu-0004qL-Ji; Fri, 13 Mar 2020 04:25:04 -0400 Received: from host86-185-91-43.range86-185.btcentralplus.com ([86.185.91.43] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1jCfdC-0007Mr-Qw; Fri, 13 Mar 2020 08:25:27 +0000 From: Mark Cave-Ayland To: jsnow@redhat.com, philmd@redhat.com, amarkovic@wavecomp.com, mst@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, balaton@eik.bme.hu Date: Fri, 13 Mar 2020 08:24:39 +0000 Message-Id: <20200313082444.2439-3-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200313082444.2439-1-mark.cave-ayland@ilande.co.uk> References: <20200313082444.2439-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 86.185.91.43 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH 2/7] ide/via: Get rid of via_ide_init() X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:41c9:1:41f::167 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: BALATON Zoltan Follow example of CMD646 and remove via_ide_init function and do it directly in board code instead. Signed-off-by: BALATON Zoltan Reviewed-by: Mark Cave-Ayland --- hw/ide/via.c | 8 -------- hw/mips/mips_fulong2e.c | 5 ++++- include/hw/ide.h | 1 - 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/hw/ide/via.c b/hw/ide/via.c index 84f0efff94..3153be8862 100644 --- a/hw/ide/via.c +++ b/hw/ide/via.c @@ -211,14 +211,6 @@ static void via_ide_exitfn(PCIDevice *dev) } } -void via_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn) -{ - PCIDevice *dev; - - dev = pci_create_simple(bus, devfn, "via-ide"); - pci_ide_create_devs(dev, hd_table); -} - static void via_ide_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index 4727b1d3a4..639ba2a091 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -37,6 +37,7 @@ #include "qemu/log.h" #include "hw/loader.h" #include "hw/ide.h" +#include "hw/ide/pci.h" #include "elf.h" #include "hw/isa/vt82c686.h" #include "hw/rtc/mc146818rtc.h" @@ -239,6 +240,7 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc, qemu_irq *i8259; ISABus *isa_bus; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; + PCIDevice *dev; isa_bus = vt82c686b_isa_init(pci_bus, PCI_DEVFN(slot, 0)); if (!isa_bus) { @@ -256,8 +258,9 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc, /* Super I/O */ isa_create_simple(isa_bus, TYPE_VT82C686B_SUPERIO); + dev = pci_create_simple(pci_bus, PCI_DEVFN(slot, 1), "via-ide"); ide_drive_get(hd, ARRAY_SIZE(hd)); - via_ide_init(pci_bus, hd, PCI_DEVFN(slot, 1)); + pci_ide_create_devs(dev, hd); pci_create_simple(pci_bus, PCI_DEVFN(slot, 2), "vt82c686b-usb-uhci"); pci_create_simple(pci_bus, PCI_DEVFN(slot, 3), "vt82c686b-usb-uhci"); diff --git a/include/hw/ide.h b/include/hw/ide.h index 28d8a06439..575c099b5b 100644 --- a/include/hw/ide.h +++ b/include/hw/ide.h @@ -18,7 +18,6 @@ PCIDevice *pci_piix3_xen_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn); PCIDevice *pci_piix3_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn); PCIDevice *pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn); int pci_piix3_xen_ide_unplug(DeviceState *dev, bool aux); -void via_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn); /* ide-mmio.c */ void mmio_ide_init_drives(DeviceState *dev, DriveInfo *hd0, DriveInfo *hd1); From patchwork Fri Mar 13 08:24:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1254294 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ilande.co.uk Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48dzPr0YTwz9sQx for ; Fri, 13 Mar 2020 19:29:20 +1100 (AEDT) Received: from localhost ([::1]:55526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCfh0-0005WJ-1s for incoming@patchwork.ozlabs.org; Fri, 13 Mar 2020 04:29:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56724) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCfcy-0008RO-Qr for qemu-devel@nongnu.org; Fri, 13 Mar 2020 04:25:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCfcx-0004xE-Nu for qemu-devel@nongnu.org; Fri, 13 Mar 2020 04:25:08 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:51520 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jCfcv-0004sW-Fa; Fri, 13 Mar 2020 04:25:05 -0400 Received: from host86-185-91-43.range86-185.btcentralplus.com ([86.185.91.43] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1jCfdH-0007Mr-P2; Fri, 13 Mar 2020 08:25:29 +0000 From: Mark Cave-Ayland To: jsnow@redhat.com, philmd@redhat.com, amarkovic@wavecomp.com, mst@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, balaton@eik.bme.hu Date: Fri, 13 Mar 2020 08:24:40 +0000 Message-Id: <20200313082444.2439-4-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200313082444.2439-1-mark.cave-ayland@ilande.co.uk> References: <20200313082444.2439-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 86.185.91.43 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH 3/7] pci: Honour wmask when resetting PCI_INTERRUPT_LINE X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:41c9:1:41f::167 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: BALATON Zoltan The pci_do_device_reset() function (called from pci_device_reset) clears the PCI_INTERRUPT_LINE config reg of devices on the bus but did this without taking wmask into account. We'll have a device model now that needs to set a constant value for this reg and this patch allows to do that without additional workaround in device emulation to reverse the effect of this PCI bus reset function. Suggested-by: Mark Cave-Ayland Signed-off-by: BALATON Zoltan Reviewed-by: Michael S. Tsirkin Reviewed-by: Mark Cave-Ayland --- hw/pci/pci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index e1ed6677e1..b5bc842fac 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -302,8 +302,11 @@ static void pci_do_device_reset(PCIDevice *dev) pci_word_test_and_clear_mask(dev->config + PCI_STATUS, pci_get_word(dev->wmask + PCI_STATUS) | pci_get_word(dev->w1cmask + PCI_STATUS)); + /* Some devices make bits of PCI_INTERRUPT_LINE read only */ + pci_byte_test_and_clear_mask(dev->config + PCI_INTERRUPT_LINE, + pci_get_word(dev->wmask + PCI_INTERRUPT_LINE) | + pci_get_word(dev->w1cmask + PCI_INTERRUPT_LINE)); dev->config[PCI_CACHE_LINE_SIZE] = 0x0; - dev->config[PCI_INTERRUPT_LINE] = 0x0; for (r = 0; r < PCI_NUM_REGIONS; ++r) { PCIIORegion *region = &dev->io_regions[r]; if (!region->size) { From patchwork Fri Mar 13 08:24:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1254290 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ilande.co.uk Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48dzL75gcRz9sQx for ; Fri, 13 Mar 2020 19:26:06 +1100 (AEDT) Received: from localhost ([::1]:55474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCfds-0000LU-2C for incoming@patchwork.ozlabs.org; Fri, 13 Mar 2020 04:26:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56855) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCfd5-0000Gy-3V for qemu-devel@nongnu.org; Fri, 13 Mar 2020 04:25:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCfd3-00058P-3I for qemu-devel@nongnu.org; Fri, 13 Mar 2020 04:25:15 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:51530 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jCfd0-00050d-P0; Fri, 13 Mar 2020 04:25:10 -0400 Received: from host86-185-91-43.range86-185.btcentralplus.com ([86.185.91.43] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1jCfdJ-0007Mr-P4; Fri, 13 Mar 2020 08:25:34 +0000 From: Mark Cave-Ayland To: jsnow@redhat.com, philmd@redhat.com, amarkovic@wavecomp.com, mst@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, balaton@eik.bme.hu Date: Fri, 13 Mar 2020 08:24:41 +0000 Message-Id: <20200313082444.2439-5-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200313082444.2439-1-mark.cave-ayland@ilande.co.uk> References: <20200313082444.2439-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 86.185.91.43 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH 4/7] via-ide: ensure that PCI_INTERRUPT_LINE is hard-wired to its default value X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:41c9:1:41f::167 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Some firmwares accidentally write to PCI_INTERRUPT_LINE on startup which has no effect on real hardware since it is hard-wired to its default value, but causes the guest OS to become confused trying to initialise IDE devices when running under QEMU. Signed-off-by: Mark Cave-Ayland --- hw/ide/via.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ide/via.c b/hw/ide/via.c index 3153be8862..8363bd4802 100644 --- a/hw/ide/via.c +++ b/hw/ide/via.c @@ -169,7 +169,7 @@ static void via_ide_realize(PCIDevice *dev, Error **errp) pci_config_set_prog_interface(pci_conf, 0x8f); /* native PCI ATA mode */ pci_set_long(pci_conf + PCI_CAPABILITY_LIST, 0x000000c0); - dev->wmask[PCI_INTERRUPT_LINE] = 0xf; + dev->wmask[PCI_INTERRUPT_LINE] = 0; memory_region_init_io(&d->data_bar[0], OBJECT(d), &pci_ide_data_le_ops, &d->bus[0], "via-ide0-data", 8); From patchwork Fri Mar 13 08:24:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1254293 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ilande.co.uk Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48dzN83sJQz9sRN for ; Fri, 13 Mar 2020 19:27:52 +1100 (AEDT) Received: from localhost ([::1]:55516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCffa-0003LR-FZ for incoming@patchwork.ozlabs.org; Fri, 13 Mar 2020 04:27:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57007) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCfdC-0000cg-CZ for qemu-devel@nongnu.org; Fri, 13 Mar 2020 04:25:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCfdA-0005Lw-Sx for qemu-devel@nongnu.org; Fri, 13 Mar 2020 04:25:22 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:51540 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jCfd7-0005Fy-RI; Fri, 13 Mar 2020 04:25:17 -0400 Received: from host86-185-91-43.range86-185.btcentralplus.com ([86.185.91.43] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1jCfdO-0007Mr-Kv; Fri, 13 Mar 2020 08:25:40 +0000 From: Mark Cave-Ayland To: jsnow@redhat.com, philmd@redhat.com, amarkovic@wavecomp.com, mst@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, balaton@eik.bme.hu Date: Fri, 13 Mar 2020 08:24:42 +0000 Message-Id: <20200313082444.2439-6-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200313082444.2439-1-mark.cave-ayland@ilande.co.uk> References: <20200313082444.2439-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 86.185.91.43 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH 5/7] via-ide: initialise IDE controller in legacy mode X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:41c9:1:41f::167 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" According to both the VT82C686B and VT8231 datasheets the VIA Southbridge IDE controller is initialised in legacy mode. This allows Linux to correctly determine that legacy rather than PCI IRQ routing should be used since the boot console text in the fulong2e test image changes from: scsi0 : pata_via scsi1 : pata_via ata1: PATA max UDMA/100 cmd 0xffffffffbfd04050 ctl 0xffffffffbfd04062 \ bmdma 0xffffffffbfd04040 irq 14 ata2: PATA max UDMA/100 cmd 0xffffffffbfd04058 ctl 0xffffffffbfd04066 \ bmdma 0xffffffffbfd04048 irq 14 to: scsi0 : pata_via scsi1 : pata_via ata1: PATA max UDMA/100 cmd 0xffffffffbfd001f0 ctl 0xffffffffbfd003f6 \ bmdma 0xffffffffbfd04040 irq 14 ata2: PATA max UDMA/100 cmd 0xffffffffbfd00170 ctl 0xffffffffbfd00376 \ bmdma 0xffffffffbfd04048 irq 15 Signed-off-by: Mark Cave-Ayland --- hw/ide/via.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ide/via.c b/hw/ide/via.c index 8363bd4802..c8835de01b 100644 --- a/hw/ide/via.c +++ b/hw/ide/via.c @@ -167,7 +167,7 @@ static void via_ide_realize(PCIDevice *dev, Error **errp) uint8_t *pci_conf = dev->config; int i; - pci_config_set_prog_interface(pci_conf, 0x8f); /* native PCI ATA mode */ + pci_config_set_prog_interface(pci_conf, 0x8a); /* legacy mode */ pci_set_long(pci_conf + PCI_CAPABILITY_LIST, 0x000000c0); dev->wmask[PCI_INTERRUPT_LINE] = 0; From patchwork Fri Mar 13 08:24:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1254295 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ilande.co.uk Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48dzSD0Lvzz9sSR for ; Fri, 13 Mar 2020 19:31:22 +1100 (AEDT) Received: from localhost ([::1]:55564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCfix-0007v9-PS for incoming@patchwork.ozlabs.org; Fri, 13 Mar 2020 04:31:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57130) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCfdM-0000nT-0x for qemu-devel@nongnu.org; Fri, 13 Mar 2020 04:25:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCfdK-0005Yh-Az for qemu-devel@nongnu.org; Fri, 13 Mar 2020 04:25:31 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:51550 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jCfdD-0005R9-Pa; Fri, 13 Mar 2020 04:25:23 -0400 Received: from host86-185-91-43.range86-185.btcentralplus.com ([86.185.91.43] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1jCfdU-0007Mr-SA; Fri, 13 Mar 2020 08:25:47 +0000 From: Mark Cave-Ayland To: jsnow@redhat.com, philmd@redhat.com, amarkovic@wavecomp.com, mst@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, balaton@eik.bme.hu Date: Fri, 13 Mar 2020 08:24:43 +0000 Message-Id: <20200313082444.2439-7-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200313082444.2439-1-mark.cave-ayland@ilande.co.uk> References: <20200313082444.2439-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 86.185.91.43 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH 6/7] via-ide: allow guests to write to PCI_CLASS_PROG X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:41c9:1:41f::167 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" MorphOS writes to PCI_CLASS_PROG during IDE initialisation to place the controller in native mode, but thinks the initialisation has failed because the native mode bits aren't set when reading the register back. Signed-off-by: Mark Cave-Ayland --- hw/ide/via.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/ide/via.c b/hw/ide/via.c index c8835de01b..3c4d474e48 100644 --- a/hw/ide/via.c +++ b/hw/ide/via.c @@ -170,6 +170,7 @@ static void via_ide_realize(PCIDevice *dev, Error **errp) pci_config_set_prog_interface(pci_conf, 0x8a); /* legacy mode */ pci_set_long(pci_conf + PCI_CAPABILITY_LIST, 0x000000c0); dev->wmask[PCI_INTERRUPT_LINE] = 0; + dev->wmask[PCI_CLASS_PROG] = 5; memory_region_init_io(&d->data_bar[0], OBJECT(d), &pci_ide_data_le_ops, &d->bus[0], "via-ide0-data", 8); From patchwork Fri Mar 13 08:24:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1254292 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ilande.co.uk Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48dzN82qTPz9sQx for ; Fri, 13 Mar 2020 19:27:52 +1100 (AEDT) Received: from localhost ([::1]:55514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCffa-0003KQ-96 for incoming@patchwork.ozlabs.org; Fri, 13 Mar 2020 04:27:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57184) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCfdO-0000pP-3o for qemu-devel@nongnu.org; Fri, 13 Mar 2020 04:25:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCfdN-0005bx-5H for qemu-devel@nongnu.org; Fri, 13 Mar 2020 04:25:34 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:51558 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jCfdK-0005Xz-Am; Fri, 13 Mar 2020 04:25:30 -0400 Received: from host86-185-91-43.range86-185.btcentralplus.com ([86.185.91.43] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1jCfdb-0007Mr-N6; Fri, 13 Mar 2020 08:25:52 +0000 From: Mark Cave-Ayland To: jsnow@redhat.com, philmd@redhat.com, amarkovic@wavecomp.com, mst@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, balaton@eik.bme.hu Date: Fri, 13 Mar 2020 08:24:44 +0000 Message-Id: <20200313082444.2439-8-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200313082444.2439-1-mark.cave-ayland@ilande.co.uk> References: <20200313082444.2439-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 86.185.91.43 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH 7/7] via-ide: always use legacy IRQ 14/15 routing X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:41c9:1:41f::167 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The existing code uses fixed PCI IRQ routing on IRQ 14 rather than legacy IRQ 14/15 routing as documented in the datasheet. With the changes in this patchset guest OSs now correctly detect and configure the VIA controller in legacy IRQ routing mode, allowing the incorrect fixed PCI IRQ routing to be removed. Note that this fixed legacy IRQ 14/15 routing is identical to similar behaviour in the early PIIX IDE controllers. Signed-off-by: Mark Cave-Ayland --- hw/ide/via.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hw/ide/via.c b/hw/ide/via.c index 3c4d474e48..8de4945cc1 100644 --- a/hw/ide/via.c +++ b/hw/ide/via.c @@ -113,10 +113,7 @@ static void via_ide_set_irq(void *opaque, int n, int level) } level = (d->config[0x70] & 0x80) || (d->config[0x78] & 0x80); - n = pci_get_byte(d->config + PCI_INTERRUPT_LINE); - if (n) { - qemu_set_irq(isa_get_irq(NULL, n), level); - } + qemu_set_irq(isa_get_irq(NULL, 14 + n), level); } static void via_ide_reset(DeviceState *dev)