From nobody Sat May 4 19:27:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1572285156; cv=none; d=zoho.com; s=zohoarc; b=WcTCsG1H1o3l8VeX+GG3DLlh0i2pbRHlX0XaWljqo9bBOzrSr8Y/pT7hGPneLHNgpx84VayxDm7NQzHH4is2p6RvOBe0zmXAql2N8VhB5ZX4TOGht7OTJq9d2fIB0WuyqSD89HeYuA1tlR81cyiKZT37IZ9xmLLtzKsorK0wFNE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572285156; 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=dp/nKQVZFywaOMixL/+A3VBgd7NuzQl0q2mvB/663P0=; b=COB22m19PkO451ECRAbJYaKLJ8os4LACSjPBDl6Ezv4tvZudw+g5DoyXlM0PsBKE2Ed9vR8sCuQiDLlebuqVzNA9yQ/kJCvXomRzBNkGAgqmo3718QdNFdlRoJywnxwF1SRHBr3Dhi6qVTdlNmCyNSsHV69uj+v8OXCy4IAK37A= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.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 1572285156463656.1145631887077; Mon, 28 Oct 2019 10:52:36 -0700 (PDT) Received: from localhost ([::1]:39792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP9By-000102-G2 for importer@patchew.org; Mon, 28 Oct 2019 13:52:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41081) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP7z5-0001yR-D2 for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP7z3-0007DV-2l for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35:11 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:21729 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iP7z1-0007CC-8r for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35:07 -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-164-jv3xlSrfNuO1g5qxhHnCIQ-1; Mon, 28 Oct 2019 12:35:02 -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 E700A81A334; Mon, 28 Oct 2019 16:35:00 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-87.brq.redhat.com [10.40.204.87]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9390C26192; Mon, 28 Oct 2019 16:34:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572280506; 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=dp/nKQVZFywaOMixL/+A3VBgd7NuzQl0q2mvB/663P0=; b=V6MC+IBR1B7Op16r8sTiUS3oVUJF2idx97K2vd7bk3WT3siuAbxyf/7CTM0K7CvBlAsrjx V+Olhe438cqQtMmr+HK8dAC86QGju5cll3korj9VE5taSzBHSLDYStxGa1o5dC/oOkTaSH Bw+dhGYyHUoMOGPS3ab3Vvo75J1zoQI= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 01/20] MAINTAINERS: Keep PIIX4 South Bridge separate from PC Chipsets Date: Mon, 28 Oct 2019 17:34:28 +0100 Message-Id: <20191028163447.18541-2-philmd@redhat.com> In-Reply-To: <20191028163447.18541-1-philmd@redhat.com> References: <20191028163447.18541-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: jv3xlSrfNuO1g5qxhHnCIQ-1 X-Mimecast-Spam-Score: 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: 205.139.110.61 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" , Li Qiang , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , 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: Philippe Mathieu-Daud=C3=A9 The PIIX4 Southbridge is not used by the PC machine, but by the Malta board (MIPS). Add a new section to keep it covered. Suggested-by: Michael S. Tsirkin Reviewed-by: Aleksandar Markovic Reviewed-by: Li Qiang Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 42e702f346..1f04502fac 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1230,7 +1230,6 @@ F: hw/pci-host/q35.c F: hw/pci-host/pam.c F: include/hw/pci-host/q35.h F: include/hw/pci-host/pam.h -F: hw/isa/piix4.c F: hw/isa/lpc_ich9.c F: hw/i2c/smbus_ich9.c F: hw/acpi/piix4.c @@ -1730,6 +1729,12 @@ F: hw/display/edid* F: include/hw/display/edid.h F: qemu-edid.c =20 +PIIX4 South Bridge (i82371AB) +M: Herv=C3=A9 Poussineau +M: Philippe Mathieu-Daud=C3=A9 +S: Maintained +F: hw/isa/piix4.c + Firmware configuration (fw_cfg) M: Philippe Mathieu-Daud=C3=A9 R: Laszlo Ersek --=20 2.21.0 From nobody Sat May 4 19:27:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1572285468; cv=none; d=zoho.com; s=zohoarc; b=MfL5WHddCAWsj+Tx75BdnOTZyGcyuoc29v7/3u4nKmThTBCsJuWgC6zANPnURhKdiWHR11f95KOBjFme29GZ4sU+Any428LUJ9conZW5L2Gw3CLWoObuQZPUF3IOiqRQqFa5GqxJ/Hui1jDhSwIJObl4km+9CVInL+knHAIqM9U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572285468; 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=mPc092PHODzreV/kPpF7b8LLvV0SzNzKY/NFFvHaLRU=; b=WWlmcbDSqP+E8mSJ3XkY6eL1lt2xlMrH29YdN/Exk/x4JrjWrKTbiGs2HNEnqhRKlCI6VL1n3WWUKaexbfU9BjbDg71oq5vYd3PrO4YVDOwE2/BgK1wzmQfhNHsCEgNEMP81TEAzsekkU1quQvOzg4ct2ut2B2BI87hsb4aTwQI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.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 1572285468437933.2144874580764; Mon, 28 Oct 2019 10:57:48 -0700 (PDT) Received: from localhost ([::1]:39842 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP9H0-00061i-I4 for importer@patchew.org; Mon, 28 Oct 2019 13:57:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41092) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP7z7-00021q-MW for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP7z6-0007F9-FU for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35:13 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:39417 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iP7z6-0007EK-Bb for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35:12 -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-244-ETrxUxEKPpuEvgW4Pu6YOw-1; Mon, 28 Oct 2019 12:35:07 -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 EC2FF1005509; Mon, 28 Oct 2019 16:35:05 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-87.brq.redhat.com [10.40.204.87]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 836E31C941; Mon, 28 Oct 2019 16:35:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572280511; 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=mPc092PHODzreV/kPpF7b8LLvV0SzNzKY/NFFvHaLRU=; b=RMagsn1TLlNTLqQVkq3AJm6Ygkoxa4ADZiGIyylblm4N1SBtHWpGRKx0jRsi0cpQUXX5I5 hPxfJEzWRPfLn7yLKKXltXTfnnuW/L0JZVLUyHcvHpqMCZ+YdJLSQUeOsO2wD7jUa6H7go 7B3bVgTuLNav5K35yY7KPbLEPiPd7cQ= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 02/20] piix4: Add the Reset Control Register Date: Mon, 28 Oct 2019 17:34:29 +0100 Message-Id: <20191028163447.18541-3-philmd@redhat.com> In-Reply-To: <20191028163447.18541-1-philmd@redhat.com> References: <20191028163447.18541-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: ETrxUxEKPpuEvgW4Pu6YOw-1 X-Mimecast-Spam-Score: 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: 205.139.110.61 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" , Li Qiang , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Markovic , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , 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: Herv=C3=A9 Poussineau The RCR I/O port (0xcf9) is used to generate a hard reset or a soft reset. Acked-by: Michael S. Tsirkin Acked-by: Paolo Bonzini Signed-off-by: Herv=C3=A9 Poussineau Message-Id: <20171216090228.28505-7-hpoussin@reactos.org> Reviewed-by: Aleksandar Markovic Reviewed-by: Li Qiang [PMD: rebased, updated includes] Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/isa/piix4.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 890d999abf..7a1361a9dd 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -2,6 +2,7 @@ * QEMU PIIX4 PCI Bridge Emulation * * Copyright (c) 2006 Fabrice Bellard + * Copyright (c) 2018 Herv=C3=A9 Poussineau * * Permission is hereby granted, free of charge, to any person obtaining a= copy * of this software and associated documentation files (the "Software"), t= o deal @@ -28,11 +29,17 @@ #include "hw/isa/isa.h" #include "hw/sysbus.h" #include "migration/vmstate.h" +#include "sysemu/reset.h" +#include "sysemu/runstate.h" =20 PCIDevice *piix4_dev; =20 typedef struct PIIX4State { PCIDevice dev; + + /* Reset Control Register */ + MemoryRegion rcr_mem; + uint8_t rcr; } PIIX4State; =20 #define TYPE_PIIX4_PCI_DEVICE "PIIX4" @@ -87,15 +94,51 @@ static const VMStateDescription vmstate_piix4 =3D { } }; =20 +static void piix4_rcr_write(void *opaque, hwaddr addr, uint64_t val, + unsigned int len) +{ + PIIX4State *s =3D opaque; + + if (val & 4) { + qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); + return; + } + + s->rcr =3D val & 2; /* keep System Reset type only */ +} + +static uint64_t piix4_rcr_read(void *opaque, hwaddr addr, unsigned int len) +{ + PIIX4State *s =3D opaque; + + return s->rcr; +} + +static const MemoryRegionOps piix4_rcr_ops =3D { + .read =3D piix4_rcr_read, + .write =3D piix4_rcr_write, + .endianness =3D DEVICE_LITTLE_ENDIAN, + .impl =3D { + .min_access_size =3D 1, + .max_access_size =3D 1, + }, +}; + static void piix4_realize(PCIDevice *dev, Error **errp) { - PIIX4State *d =3D PIIX4_PCI_DEVICE(dev); + PIIX4State *s =3D PIIX4_PCI_DEVICE(dev); =20 - if (!isa_bus_new(DEVICE(d), pci_address_space(dev), + if (!isa_bus_new(DEVICE(dev), pci_address_space(dev), pci_address_space_io(dev), errp)) { return; } - piix4_dev =3D &d->dev; + + memory_region_init_io(&s->rcr_mem, OBJECT(dev), &piix4_rcr_ops, s, + "reset-control", 1); + memory_region_add_subregion_overlap(pci_address_space_io(dev), + RCR_IOPORT, &s->rcr_mem, 1); + + piix4_dev =3D dev; } =20 int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn) --=20 2.21.0 From nobody Sat May 4 19:27:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1572284200; cv=none; d=zoho.com; s=zohoarc; b=g9Iut46vtFjP25Cv56W1MNcPmBGkjTP+bMvPKR1JXw3DWArADoyoyc1JXWo3Se7BNM9CmhjMNncZEOzwqIe+JLRMe6ScmBPBNLIS98mzq9ATTCjYgLfnJXumD7Mh+BVOHcC6+lzKCnqWIBR6BHhhBGnO6WOEscDCsqK/eXsstUI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572284200; 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=gaqc/vYnF8LB/YRJMD9N+iWM1u28Nhqe2r6uBf6Iyjs=; b=YpRn4d6CK36OEId9jxGrGWIXo3mVsr73p9ZG4AEbGaY7QmKxmL28BmiaL2l2ZFie/4OROnW3/ZP4ovf8VnpkyvhWduCtoFuVAJtiU3+dH+hphxskpVHeUJ1vwjmZPCy+rTekqzuCNTldEtmjWcWH5QRtUWv8A6uoNYYBqorTXPs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.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 157228420021541.90908587284389; Mon, 28 Oct 2019 10:36:40 -0700 (PDT) Received: from localhost ([::1]:38806 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP8wX-0000Z4-5I for importer@patchew.org; Mon, 28 Oct 2019 13:36:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41104) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP7zE-00026z-GH for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP7zB-0007Hn-T4 for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35:20 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:31861 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iP7zB-0007Gt-Of for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35:17 -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-8-oWm4SKmNNE2KXH6m2pem6Q-1; Mon, 28 Oct 2019 12:35:12 -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 A95B71005509; Mon, 28 Oct 2019 16:35:10 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-87.brq.redhat.com [10.40.204.87]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 89C731C941; Mon, 28 Oct 2019 16:35:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572280515; 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=gaqc/vYnF8LB/YRJMD9N+iWM1u28Nhqe2r6uBf6Iyjs=; b=RozzBLhpg5WMV0AitUZNTa3aKX2oYNoQ3apVoFL7mo6e5uFF0IsIQan9zbC4QgPDeHVEIU xkEuKabxih2FQnW+qLwXwZu+3wJqmH4tP01Y72E2zjqt0i6seCDtr6Nk66jGEmSrDXD0t8 Nk2D/kYzEbJ8E+L+f0mBrXqMZE60SgA= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 03/20] piix4: Add an i8259 Interrupt Controller as specified in datasheet Date: Mon, 28 Oct 2019 17:34:30 +0100 Message-Id: <20191028163447.18541-4-philmd@redhat.com> In-Reply-To: <20191028163447.18541-1-philmd@redhat.com> References: <20191028163447.18541-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: oWm4SKmNNE2KXH6m2pem6Q-1 X-Mimecast-Spam-Score: 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: 205.139.110.120 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" , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Markovic , Paolo Bonzini , Aleksandar Rikalo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , 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: Herv=C3=A9 Poussineau Add ISA irqs as piix4 gpio in, and CPU interrupt request as piix4 gpio out. Remove i8259 instanciated in malta board, to not have it twice. We can also remove the now unused piix4_init() function. Acked-by: Michael S. Tsirkin Acked-by: Paolo Bonzini Signed-off-by: Herv=C3=A9 Poussineau Message-Id: <20171216090228.28505-8-hpoussin@reactos.org> Reviewed-by: Aleksandar Markovic [PMD: rebased, updated includes, use ISA_NUM_IRQS in for loop] Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/isa/piix4.c | 43 ++++++++++++++++++++++++++++++++----------- hw/mips/mips_malta.c | 32 +++++++++++++------------------- include/hw/i386/pc.h | 1 - 3 files changed, 45 insertions(+), 31 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 7a1361a9dd..7cf72e3118 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -24,6 +24,7 @@ */ =20 #include "qemu/osdep.h" +#include "hw/irq.h" #include "hw/i386/pc.h" #include "hw/pci/pci.h" #include "hw/isa/isa.h" @@ -36,6 +37,8 @@ PCIDevice *piix4_dev; =20 typedef struct PIIX4State { PCIDevice dev; + qemu_irq cpu_intr; + qemu_irq *isa; =20 /* Reset Control Register */ MemoryRegion rcr_mem; @@ -94,6 +97,18 @@ static const VMStateDescription vmstate_piix4 =3D { } }; =20 +static void piix4_request_i8259_irq(void *opaque, int irq, int level) +{ + PIIX4State *s =3D opaque; + qemu_set_irq(s->cpu_intr, level); +} + +static void piix4_set_i8259_irq(void *opaque, int irq, int level) +{ + PIIX4State *s =3D opaque; + qemu_set_irq(s->isa[irq], level); +} + static void piix4_rcr_write(void *opaque, hwaddr addr, uint64_t val, unsigned int len) { @@ -127,29 +142,35 @@ static const MemoryRegionOps piix4_rcr_ops =3D { static void piix4_realize(PCIDevice *dev, Error **errp) { PIIX4State *s =3D PIIX4_PCI_DEVICE(dev); + ISABus *isa_bus; + qemu_irq *i8259_out_irq; =20 - if (!isa_bus_new(DEVICE(dev), pci_address_space(dev), - pci_address_space_io(dev), errp)) { + isa_bus =3D isa_bus_new(DEVICE(dev), pci_address_space(dev), + pci_address_space_io(dev), errp); + if (!isa_bus) { return; } =20 + qdev_init_gpio_in_named(DEVICE(dev), piix4_set_i8259_irq, + "isa", ISA_NUM_IRQS); + qdev_init_gpio_out_named(DEVICE(dev), &s->cpu_intr, + "intr", 1); + memory_region_init_io(&s->rcr_mem, OBJECT(dev), &piix4_rcr_ops, s, "reset-control", 1); memory_region_add_subregion_overlap(pci_address_space_io(dev), RCR_IOPORT, &s->rcr_mem, 1); =20 + /* initialize i8259 pic */ + i8259_out_irq =3D qemu_allocate_irqs(piix4_request_i8259_irq, s, 1); + s->isa =3D i8259_init(isa_bus, *i8259_out_irq); + + /* initialize ISA irqs */ + isa_bus_irqs(isa_bus, s->isa); + piix4_dev =3D dev; } =20 -int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn) -{ - PCIDevice *d; - - d =3D pci_create_simple_multifunction(bus, devfn, true, "PIIX4"); - *isa_bus =3D ISA_BUS(qdev_get_child_bus(DEVICE(d), "isa.0")); - return d->devfn; -} - static void piix4_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index c1c8810e71..6d9b230322 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -97,7 +97,7 @@ typedef struct { SysBusDevice parent_obj; =20 MIPSCPSState cps; - qemu_irq *i8259; + qemu_irq i8259[ISA_NUM_IRQS]; } MaltaState; =20 static ISADevice *pit; @@ -1235,8 +1235,8 @@ void mips_malta_init(MachineState *machine) int64_t kernel_entry, bootloader_run_addr; PCIBus *pci_bus; ISABus *isa_bus; - qemu_irq *isa_irq; qemu_irq cbus_irq, i8259_irq; + PCIDevice *pci; int piix4_devfn; I2CBus *smbus; DriveInfo *dinfo; @@ -1407,30 +1407,24 @@ void mips_malta_init(MachineState *machine) /* Board ID =3D 0x420 (Malta Board with CoreLV) */ stl_p(memory_region_get_ram_ptr(bios_copy) + 0x10, 0x00000420); =20 - /* - * We have a circular dependency problem: pci_bus depends on isa_irq, - * isa_irq is provided by i8259, i8259 depends on ISA, ISA depends - * on piix4, and piix4 depends on pci_bus. To stop the cycle we have - * qemu_irq_proxy() adds an extra bit of indirection, allowing us - * to resolve the isa_irq -> i8259 dependency after i8259 is initializ= ed. - */ - isa_irq =3D qemu_irq_proxy(&s->i8259, 16); - /* Northbridge */ - pci_bus =3D gt64120_register(isa_irq); + pci_bus =3D gt64120_register(s->i8259); =20 /* Southbridge */ ide_drive_get(hd, ARRAY_SIZE(hd)); =20 - piix4_devfn =3D piix4_init(pci_bus, &isa_bus, 80); + pci =3D pci_create_simple_multifunction(pci_bus, PCI_DEVFN(10, 0), + true, "PIIX4"); + dev =3D DEVICE(pci); + isa_bus =3D ISA_BUS(qdev_get_child_bus(dev, "isa.0")); + piix4_devfn =3D pci->devfn; =20 - /* - * Interrupt controller - * The 8259 is attached to the MIPS CPU INT0 pin, ie interrupt 2 - */ - s->i8259 =3D i8259_init(isa_bus, i8259_irq); + /* Interrupt controller */ + qdev_connect_gpio_out_named(dev, "intr", 0, i8259_irq); + for (int i =3D 0; i < ISA_NUM_IRQS; i++) { + s->i8259[i] =3D qdev_get_gpio_in_named(dev, "isa", i); + } =20 - isa_bus_irqs(isa_bus, s->i8259); pci_piix4_ide_init(pci_bus, hd, piix4_devfn + 1); pci_create_simple(pci_bus, piix4_devfn + 2, "piix4-usb-uhci"); smbus =3D piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100, diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index f040a72095..f553b29652 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -266,7 +266,6 @@ PCIBus *i440fx_init(const char *host_type, const char *= pci_type, PCIBus *find_i440fx(void); /* piix4.c */ extern PCIDevice *piix4_dev; -int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn); =20 /* pc_sysfw.c */ void pc_system_flash_create(PCMachineState *pcms); --=20 2.21.0 From nobody Sat May 4 19:27:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1572285858; cv=none; d=zoho.com; s=zohoarc; b=G33dQfIUinnKwxQYJhRmOWM0Lpeyvrnwro+eYlBNjv7t0y3/yKiQj8QCQGStDkN6YZQV6DbHCjR1/6oekFL1f/dEoIfd+qLAaxlPu4op+v9+Y18KCmcGmuHk+PD40n35q2Nsn2vLeGacLBYnIVRY0ylEsriFJny7uyBr4bUicbc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572285858; 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=hYMnPZ5D9VTwMvNBI3kAdcKgWePOg0WTs5W1q22l8A8=; b=KRoRoQFK+Nly80Wfaet5kWvDXLxyt8N/i0WSDI9pqea9O8g/zC9wgnc4PAYDRBuX2z37JZyTGGSm9PsSH6EUU0yYr5wpb4OjwfKVnrCpjuHlHf8FN7/kpS4xa6oDngv4feAx+Nj9+nD9bihwL72Rv2TjPI3P1mN76aKiYm9TPvg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.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 157228585877760.83377142859126; Mon, 28 Oct 2019 11:04:18 -0700 (PDT) Received: from localhost ([::1]:39912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP9NI-0001re-7W for importer@patchew.org; Mon, 28 Oct 2019 14:04:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41134) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP7zR-0002DX-0k for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP7zN-0007O4-4H for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35:31 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:31453 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iP7zN-0007NM-0Q for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35: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-109-JLruXMsiNRucQNjQnoeqvA-1; Mon, 28 Oct 2019 12:35: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 BBBE281A334; Mon, 28 Oct 2019 16:35:14 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-87.brq.redhat.com [10.40.204.87]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3C0EE1C941; Mon, 28 Oct 2019 16:35:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572280528; 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=hYMnPZ5D9VTwMvNBI3kAdcKgWePOg0WTs5W1q22l8A8=; b=fhpCY/E2GC2XlqEDg2jkWaYEOL2jKmw6hmZWXWi1JKVNG0u+2h88Je1Yt0wdT9yp6kJKH3 fWeuuAibmh38wZ5ZL+PuSEpLJsk6EHhoilF1NlLkap1doT01/p124VP91e9sLAxetEU0op bZiChj4Snux1eI+mZN6Erb+/g77MOBA= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 04/20] Revert "irq: introduce qemu_irq_proxy()" Date: Mon, 28 Oct 2019 17:34:31 +0100 Message-Id: <20191028163447.18541-5-philmd@redhat.com> In-Reply-To: <20191028163447.18541-1-philmd@redhat.com> References: <20191028163447.18541-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: JLruXMsiNRucQNjQnoeqvA-1 X-Mimecast-Spam-Score: 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: 207.211.31.120 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: Thomas Huth , Li Qiang , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Esteban Bosse , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , 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: Philippe Mathieu-Daud=C3=A9 This function isn't used anymore. This reverts commit 22ec3283efba9ba0792790da786d6776d83f2a92. Reviewed-by: Thomas Huth Reviewed-by: Li Qiang Reviewed-by: Esteban Bosse Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/irq.c | 14 -------------- include/hw/irq.h | 5 ----- 2 files changed, 19 deletions(-) diff --git a/hw/core/irq.c b/hw/core/irq.c index 7cc0295d0e..fb3045b912 100644 --- a/hw/core/irq.c +++ b/hw/core/irq.c @@ -120,20 +120,6 @@ qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2) return qemu_allocate_irq(qemu_splitirq, s, 0); } =20 -static void proxy_irq_handler(void *opaque, int n, int level) -{ - qemu_irq **target =3D opaque; - - if (*target) { - qemu_set_irq((*target)[n], level); - } -} - -qemu_irq *qemu_irq_proxy(qemu_irq **target, int n) -{ - return qemu_allocate_irqs(proxy_irq_handler, target, n); -} - void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, in= t n) { int i; diff --git a/include/hw/irq.h b/include/hw/irq.h index fe527f6f51..24ba0ece11 100644 --- a/include/hw/irq.h +++ b/include/hw/irq.h @@ -51,11 +51,6 @@ qemu_irq qemu_irq_invert(qemu_irq irq); */ qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2); =20 -/* Returns a new IRQ set which connects 1:1 to another IRQ set, which - * may be set later. - */ -qemu_irq *qemu_irq_proxy(qemu_irq **target, int n); - /* For internal use in qtest. Similar to qemu_irq_split, but operating on an existing vector of qemu_irq. */ void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, in= t n); --=20 2.21.0 From nobody Sat May 4 19:27:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1572285257; cv=none; d=zoho.com; s=zohoarc; b=oaQxFu4zCLjPqFhL2QP5uhMCU7ox4dkp2aTvl1QDLFF95HSMoPigNBQeMtGLtXEkDN3zsNXRbmT23tFFb7STTxbDed9Rk0MW1Y/BI//bDVaQrQnytiQ8lSmNl6TF9T9CPUbGh0Tuk9TSorkopcsYvP8YkT4Dx3124pqoMPX8vSU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572285257; 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=V+bPrM8zE9f2ZPzvcaB3nRFmrtGkwHQwxvCglyVobxE=; b=Heij14yrKDb07IwvOd13pX33dlFMhe+sLn0eczLV+L6XysDer9ifktEKqscJsT5Fvgogvqo4KvyYHiEWY4ETLF/cg95px5+VgZyb7EKqeJTlYeDO+4AKjO8dMe2nUESZmrf/EB9LJLXoKO8OakbH7WteUDCv1670QAD2nlPs4tQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.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 1572285257303507.5753561962699; Mon, 28 Oct 2019 10:54:17 -0700 (PDT) Received: from localhost ([::1]:39814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP9Db-0002cW-7i for importer@patchew.org; Mon, 28 Oct 2019 13:54:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41136) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP7zR-0002DY-1g for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP7zN-0007Nz-47 for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35:32 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:41548 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iP7zM-0007NC-Vi for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35: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-100-UjtJ-kFNNm6YwXMIrxLRFg-1; Mon, 28 Oct 2019 12:35:25 -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 154981800DCB; Mon, 28 Oct 2019 16:35:24 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-87.brq.redhat.com [10.40.204.87]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5949E1C941; Mon, 28 Oct 2019 16:35:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572280528; 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=V+bPrM8zE9f2ZPzvcaB3nRFmrtGkwHQwxvCglyVobxE=; b=a+xnWFjtqWNb3pY8MRRGXp5HXWz0rAWsG+Waqp1ZioOR0jC/zH0vKw4tS0aUgCfG2DruaY 1gwul4qfRau83TM9iiXhK3+YDVWPyYqYACaBfOZPvwfw6924J1cBtnbGThe2KOFxcZXAFj SSM6q7LO5sna0BYXSe5h7fM9oeiIZs0= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 05/20] piix4: Rename PIIX4 object to piix4-isa Date: Mon, 28 Oct 2019 17:34:32 +0100 Message-Id: <20191028163447.18541-6-philmd@redhat.com> In-Reply-To: <20191028163447.18541-1-philmd@redhat.com> References: <20191028163447.18541-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: UjtJ-kFNNm6YwXMIrxLRFg-1 X-Mimecast-Spam-Score: 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: 205.139.110.61 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" , Li Qiang , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Esteban Bosse , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Markovic , Paolo Bonzini , Aleksandar Rikalo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , 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: Herv=C3=A9 Poussineau Other piix4 parts are already named piix4-ide and piix4-usb-uhci. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Michael S. Tsirkin Acked-by: Paolo Bonzini Signed-off-by: Herv=C3=A9 Poussineau Message-Id: <20171216090228.28505-15-hpoussin@reactos.org> Reviewed-by: Aleksandar Markovic Reviewed-by: Li Qiang Reviewed-by: Esteban Bosse [PMD: rebased] Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/isa/piix4.c | 1 - hw/mips/mips_malta.c | 2 +- include/hw/isa/isa.h | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 7cf72e3118..fa387919b5 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -45,7 +45,6 @@ typedef struct PIIX4State { uint8_t rcr; } PIIX4State; =20 -#define TYPE_PIIX4_PCI_DEVICE "PIIX4" #define PIIX4_PCI_DEVICE(obj) \ OBJECT_CHECK(PIIX4State, (obj), TYPE_PIIX4_PCI_DEVICE) =20 diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 6d9b230322..5086024821 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -1414,7 +1414,7 @@ void mips_malta_init(MachineState *machine) ide_drive_get(hd, ARRAY_SIZE(hd)); =20 pci =3D pci_create_simple_multifunction(pci_bus, PCI_DEVFN(10, 0), - true, "PIIX4"); + true, TYPE_PIIX4_PCI_DEVICE); dev =3D DEVICE(pci); isa_bus =3D ISA_BUS(qdev_get_child_bus(dev, "isa.0")); piix4_devfn =3D pci->devfn; diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h index 018ada4f6f..79f703fd6c 100644 --- a/include/hw/isa/isa.h +++ b/include/hw/isa/isa.h @@ -147,4 +147,6 @@ static inline ISABus *isa_bus_from_device(ISADevice *d) return ISA_BUS(qdev_get_parent_bus(DEVICE(d))); } =20 +#define TYPE_PIIX4_PCI_DEVICE "piix4-isa" + #endif --=20 2.21.0 From nobody Sat May 4 19:27:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1572284525; cv=none; d=zoho.com; s=zohoarc; b=KQwZ+hs0Q5QK8EyNtl2bFxjppy4MOtG71HjZGKusrghcUKtktrbpxzCU0Fo5Tv0zUOJ0p3npGgbiDEkFUckLvptZ9rQWDGUOZG0k02BG/gDJWBwWROB/riHDa6IHG5nV5ZtzQtCnsIO7FMCSHFP6iCahd9IgpmUiGXMZQ0Vqwbo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572284525; 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=yXfTieHKkKUUkGl1W7CJMJ6qi0AIPEuhzaznW+TBU4k=; b=RWYNwLXMNjpijW5NIFQHFpWWiPbu8x6WueAUhIlYPwu4+in1yKdTUb/qidZHMgB9KJ0uE9mpQzLLRIOZM6VQgxbWsoMaQ1PinPSHFg/6eyyPmC9uvj4HqUNB4Gpa8EeeifktWKp7gQaB5gn9taNoroKT8hVDBP7DvBQL/bAvPog= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.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 1572284525442917.4134930326716; Mon, 28 Oct 2019 10:42:05 -0700 (PDT) Received: from localhost ([::1]:39274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP91m-0006Vw-Lf for importer@patchew.org; Mon, 28 Oct 2019 13:42:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41165) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP7ze-0002Fs-Qk for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP7zZ-0007YL-Gv for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35:43 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:29351 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iP7zX-0007SV-3P for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35:40 -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-97nASJJVPWGIWJWdsj09aw-1; Mon, 28 Oct 2019 12:35:28 -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 606318017CC; Mon, 28 Oct 2019 16:35:27 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-87.brq.redhat.com [10.40.204.87]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A730226192; Mon, 28 Oct 2019 16:35:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572280532; 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=yXfTieHKkKUUkGl1W7CJMJ6qi0AIPEuhzaznW+TBU4k=; b=XoSrh2arT1VXWD0gt1kr4z3for9G0QeCDZr1DSO0XMGjcwzSe2KDn0WZt7SXLyUqXg59qV ZOG9tbZNsZjSLzgHUa62TMPpglbepPdxVWOqbZXFKVfzR5LYDAyEK99+oRbjcbTT3vYnIa 7fwCutOVK6dm4xnkZiugy210Ugz2OME= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 06/20] piix4: Add an i8257 DMA Controller as specified in datasheet Date: Mon, 28 Oct 2019 17:34:33 +0100 Message-Id: <20191028163447.18541-7-philmd@redhat.com> In-Reply-To: <20191028163447.18541-1-philmd@redhat.com> References: <20191028163447.18541-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: 97nASJJVPWGIWJWdsj09aw-1 X-Mimecast-Spam-Score: 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: 205.139.110.61 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" , Esteban Bosse , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Markovic , Paolo Bonzini , Aleksandar Rikalo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , 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: Herv=C3=A9 Poussineau The i8257 is not a chipset on the Malta board, but is part of the PIIX4 chipset. Create the i8257 in the PIIX4 code, remove the one instantiated in malta board, to not have it twice. Acked-by: Michael S. Tsirkin Acked-by: Paolo Bonzini Signed-off-by: Herv=C3=A9 Poussineau Message-Id: <20171216090228.28505-9-hpoussin@reactos.org> Reviewed-by: Aleksandar Markovic Reviewed-by: Esteban Bosse [PMD: rebased, reworded description] Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/isa/piix4.c | 4 ++++ hw/mips/mips_malta.c | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index fa387919b5..9ebe98bdc3 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -29,6 +29,7 @@ #include "hw/pci/pci.h" #include "hw/isa/isa.h" #include "hw/sysbus.h" +#include "hw/dma/i8257.h" #include "migration/vmstate.h" #include "sysemu/reset.h" #include "sysemu/runstate.h" @@ -167,6 +168,9 @@ static void piix4_realize(PCIDevice *dev, Error **errp) /* initialize ISA irqs */ isa_bus_irqs(isa_bus, s->isa); =20 + /* DMA */ + i8257_dma_init(isa_bus, 0); + piix4_dev =3D dev; } =20 diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 5086024821..44e5f8b26b 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -28,7 +28,6 @@ #include "cpu.h" #include "hw/i386/pc.h" #include "hw/isa/superio.h" -#include "hw/dma/i8257.h" #include "hw/char/serial.h" #include "net/net.h" #include "hw/boards.h" @@ -1430,7 +1429,6 @@ void mips_malta_init(MachineState *machine) smbus =3D piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100, isa_get_irq(NULL, 9), NULL, 0, NULL); pit =3D i8254_pit_init(isa_bus, 0x40, 0, NULL); - i8257_dma_init(isa_bus, 0); mc146818_rtc_init(isa_bus, 2000, NULL); =20 /* generate SPD EEPROM data */ --=20 2.21.0 From nobody Sat May 4 19:27:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1572285514; cv=none; d=zoho.com; s=zohoarc; b=ZTTVK2qqakceMf+QUUp79qGWj5OhMIu7EKRT0ZYynd9GNDTPlV/dI/TArNPmYfeZcNpr9yPnFNarpDmmOk5eJ363KTvVB2XMNQogpADLwGv1LQpwwMS2xh+NR8jeg3r668jY4j6SH7q4rAeQ1Lk/JoDOrfKdnhe89AjT9bdCp2U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572285514; 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=S1mnDPhJBEXVD5ywhdmqBZq3BJFN2BPl11JdMUU6s1g=; b=LATeRLxOOkrNEtRSal9um26ukS+9GgS9ePT7SKEaTLcWI4YpkighcX6jwDpgvYX5CGooGRp96ICtGIT0BIqLmMtNWAKFgIwtYbpwZZuCoUqnUnz7nc9YcMXTzSV5Gp0hi+rUCGKCSGpgjGH6rNl76CHS1+UF2OUWehmaSiVRxNA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.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 1572285514731140.892064010917; Mon, 28 Oct 2019 10:58:34 -0700 (PDT) Received: from localhost ([::1]:39886 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP9Hk-0006fj-9D for importer@patchew.org; Mon, 28 Oct 2019 13:58:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41181) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP7zn-0002KF-E4 for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP7zb-0007Z8-By for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35:46 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:21341 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iP7zZ-0007WK-Fy for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35:42 -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-328-b9hocVO-P5qNwLHRKkn5uw-1; Mon, 28 Oct 2019 12:35:33 -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 A8159107AD28; Mon, 28 Oct 2019 16:35:32 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-87.brq.redhat.com [10.40.204.87]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E9F3E26199; Mon, 28 Oct 2019 16:35:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572280537; 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=S1mnDPhJBEXVD5ywhdmqBZq3BJFN2BPl11JdMUU6s1g=; b=StMie+PdK6XF0+PARBp2YMjWEkiba0MffttoVHv6jWG/V5hqkH+7npoMd8FXQvPhMkNXAR d+cwr0wjjHc5gVyiCd+X9iQZHhWiQhtZyjbu3C64n1pS0j33wxZsAwEZ9m5bkZoYmSrUAf AxovctCoay16nyJve9d4l9zUgGcwlAg= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 07/20] piix4: Add an i8254 PIT Controller as specified in datasheet Date: Mon, 28 Oct 2019 17:34:34 +0100 Message-Id: <20191028163447.18541-8-philmd@redhat.com> In-Reply-To: <20191028163447.18541-1-philmd@redhat.com> References: <20191028163447.18541-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: b9hocVO-P5qNwLHRKkn5uw-1 X-Mimecast-Spam-Score: 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: 205.139.110.61 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" , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Markovic , Paolo Bonzini , Aleksandar Rikalo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , 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: Herv=C3=A9 Poussineau Remove i8254 instanciated in malta board, to not have it twice. Acked-by: Michael S. Tsirkin Acked-by: Paolo Bonzini Signed-off-by: Herv=C3=A9 Poussineau Message-Id: <20171216090228.28505-10-hpoussin@reactos.org> Reviewed-by: Aleksandar Markovic Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/isa/piix4.c | 4 ++++ hw/mips/mips_malta.c | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 9ebe98bdc3..c07a1e14a8 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -30,6 +30,7 @@ #include "hw/isa/isa.h" #include "hw/sysbus.h" #include "hw/dma/i8257.h" +#include "hw/timer/i8254.h" #include "migration/vmstate.h" #include "sysemu/reset.h" #include "sysemu/runstate.h" @@ -168,6 +169,9 @@ static void piix4_realize(PCIDevice *dev, Error **errp) /* initialize ISA irqs */ isa_bus_irqs(isa_bus, s->isa); =20 + /* initialize pit */ + i8254_pit_init(isa_bus, 0x40, 0, NULL); + /* DMA */ i8257_dma_init(isa_bus, 0); =20 diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 44e5f8b26b..9af486c77c 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -45,7 +45,6 @@ #include "hw/loader.h" #include "elf.h" #include "hw/rtc/mc146818rtc.h" -#include "hw/timer/i8254.h" #include "exec/address-spaces.h" #include "hw/sysbus.h" /* SysBusDevice */ #include "qemu/host-utils.h" @@ -99,8 +98,6 @@ typedef struct { qemu_irq i8259[ISA_NUM_IRQS]; } MaltaState; =20 -static ISADevice *pit; - static struct _loaderparams { int ram_size, ram_low_size; const char *kernel_filename; @@ -1428,7 +1425,6 @@ void mips_malta_init(MachineState *machine) pci_create_simple(pci_bus, piix4_devfn + 2, "piix4-usb-uhci"); smbus =3D piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100, isa_get_irq(NULL, 9), NULL, 0, NULL); - pit =3D i8254_pit_init(isa_bus, 0x40, 0, NULL); mc146818_rtc_init(isa_bus, 2000, NULL); =20 /* generate SPD EEPROM data */ --=20 2.21.0 From nobody Sat May 4 19:27:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1572285682; cv=none; d=zoho.com; s=zohoarc; b=MjqoRt1oBFt/q+HAvfzT5fLcfSWNWLCYx6dJ/hd6RIHj1bEeogu7v2bGJSX+Tyo2jbkjpGN11z0epJ64u7WoifgL65rj80nkGHWocqk/X1SFILlwOUyWZvJY0Y1nb0t1auVs30zsBByeiTJoBxTKJiypAgKLkdA+yJXAAg0cdYM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572285682; 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=XYh96A3bk8WETk3dsp7XF9lSfVDIViqRJLr20zg03RA=; b=E1pCAbwfl6Ivd9bpEZstcvgk8p5HQ0TdqTRKrxp9xdiR9a64lvZtxqOprQLZkUDtfO3QJTjAhQTpiA0O+9okrLgAXNyWhcN21Y1sh/mUsg3DsVmfYTuYM0LmrTlBbMMKfvKNd2JwUrULEWQksmKXLX1ItEkUlHB+stsaAqymTn8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.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 1572285682129588.0063083856077; Mon, 28 Oct 2019 11:01:22 -0700 (PDT) Received: from localhost ([::1]:39908 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP9KR-0000Sl-S5 for importer@patchew.org; Mon, 28 Oct 2019 14:01:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41233) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP7zt-0002SO-CZ for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP7zr-0007hg-Gx for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:01 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:30711 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iP7zr-0007bG-Bj for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35:59 -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-268-xfkXEjB2PPerAgANfpr64w-1; Mon, 28 Oct 2019 12:35:41 -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 84040476; Mon, 28 Oct 2019 16:35:40 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-87.brq.redhat.com [10.40.204.87]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5E21F1C941; Mon, 28 Oct 2019 16:35:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572280547; 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=XYh96A3bk8WETk3dsp7XF9lSfVDIViqRJLr20zg03RA=; b=cjaNfu6uNS8Sb6f/7MACZcIyRclw0MAmM0OBCGcu1+95eoisUsLn5QvkexvGUVttjygJmC Ee2Ova4DEq7Qaz1z11UYu895pknRAwf7bqEUu6yi5bSp/JIoSow/1Ax92eN4Uh3gopEF8/ UQ/Nis+4H+KOHdPV8Yltbv3mbDjaIOA= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 08/20] piix4: Add a MC146818 RTC Controller as specified in datasheet Date: Mon, 28 Oct 2019 17:34:35 +0100 Message-Id: <20191028163447.18541-9-philmd@redhat.com> In-Reply-To: <20191028163447.18541-1-philmd@redhat.com> References: <20191028163447.18541-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: xfkXEjB2PPerAgANfpr64w-1 X-Mimecast-Spam-Score: 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: 205.139.110.120 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" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eduardo Habkost , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Markovic , Igor Mammedov , Paolo Bonzini , Aleksandar Rikalo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aurelien Jarno , Richard Henderson 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: Philippe Mathieu-Daud=C3=A9 Remove mc146818rtc instanciated in malta board, to not have it twice. Acked-by: Michael S. Tsirkin Acked-by: Paolo Bonzini Signed-off-by: Herv=C3=A9 Poussineau Message-Id: <20171216090228.28505-13-hpoussin@reactos.org> [PMD: rebased, set RTC base_year to 2000] Reviewed-by: Aleksandar Markovic Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 3 ++- hw/acpi/piix4.c | 2 +- hw/i386/acpi-build.c | 3 +-- hw/i386/pc_piix.c | 1 + hw/isa/piix4.c | 22 ++++++++++++++++++++++ hw/mips/mips_malta.c | 4 +--- include/hw/acpi/piix4.h | 6 ------ include/hw/i386/pc.h | 6 ------ include/hw/southbridge/piix.h | 20 ++++++++++++++++++++ 9 files changed, 48 insertions(+), 19 deletions(-) delete mode 100644 include/hw/acpi/piix4.h create mode 100644 include/hw/southbridge/piix.h diff --git a/MAINTAINERS b/MAINTAINERS index 1f04502fac..90c5ece04b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1235,7 +1235,7 @@ F: hw/i2c/smbus_ich9.c F: hw/acpi/piix4.c F: hw/acpi/ich9.c F: include/hw/acpi/ich9.h -F: include/hw/acpi/piix4.h +F: include/hw/southbridge/piix.h F: hw/misc/sga.c F: hw/isa/apm.c F: include/hw/isa/apm.h @@ -1734,6 +1734,7 @@ M: Herv=C3=A9 Poussineau M: Philippe Mathieu-Daud=C3=A9 S: Maintained F: hw/isa/piix4.c +F: include/hw/southbridge/piix.h =20 Firmware configuration (fw_cfg) M: Philippe Mathieu-Daud=C3=A9 diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 4e079b39bd..2efd1605b8 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -21,6 +21,7 @@ =20 #include "qemu/osdep.h" #include "hw/i386/pc.h" +#include "hw/southbridge/piix.h" #include "hw/irq.h" #include "hw/isa/apm.h" #include "hw/i2c/pm_smbus.h" @@ -32,7 +33,6 @@ #include "qapi/error.h" #include "qemu/range.h" #include "exec/address-spaces.h" -#include "hw/acpi/piix4.h" #include "hw/acpi/pcihp.h" #include "hw/acpi/cpu_hotplug.h" #include "hw/acpi/cpu.h" diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 9dd3dbb16c..b1b050d8e2 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -34,7 +34,6 @@ #include "hw/acpi/acpi-defs.h" #include "hw/acpi/acpi.h" #include "hw/acpi/cpu.h" -#include "hw/acpi/piix4.h" #include "hw/nvram/fw_cfg.h" #include "hw/acpi/bios-linker-loader.h" #include "hw/isa/isa.h" @@ -52,7 +51,7 @@ #include "sysemu/reset.h" =20 /* Supported chipsets: */ -#include "hw/acpi/piix4.h" +#include "hw/southbridge/piix.h" #include "hw/acpi/pcihp.h" #include "hw/i386/ich9.h" #include "hw/pci/pci_bus.h" diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index c15929a1f5..a96ede19b2 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -30,6 +30,7 @@ #include "hw/i386/x86.h" #include "hw/i386/pc.h" #include "hw/i386/apic.h" +#include "hw/southbridge/piix.h" #include "hw/display/ramfb.h" #include "hw/firmware/smbios.h" #include "hw/pci/pci.h" diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index c07a1e14a8..6bf6f0c5d9 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -24,6 +24,7 @@ */ =20 #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/irq.h" #include "hw/i386/pc.h" #include "hw/pci/pci.h" @@ -31,6 +32,7 @@ #include "hw/sysbus.h" #include "hw/dma/i8257.h" #include "hw/timer/i8254.h" +#include "hw/rtc/mc146818rtc.h" #include "migration/vmstate.h" #include "sysemu/reset.h" #include "sysemu/runstate.h" @@ -42,6 +44,7 @@ typedef struct PIIX4State { qemu_irq cpu_intr; qemu_irq *isa; =20 + RTCState rtc; /* Reset Control Register */ MemoryRegion rcr_mem; uint8_t rcr; @@ -145,6 +148,7 @@ static void piix4_realize(PCIDevice *dev, Error **errp) PIIX4State *s =3D PIIX4_PCI_DEVICE(dev); ISABus *isa_bus; qemu_irq *i8259_out_irq; + Error *err =3D NULL; =20 isa_bus =3D isa_bus_new(DEVICE(dev), pci_address_space(dev), pci_address_space_io(dev), errp); @@ -175,9 +179,26 @@ static void piix4_realize(PCIDevice *dev, Error **errp) /* DMA */ i8257_dma_init(isa_bus, 0); =20 + /* RTC */ + qdev_set_parent_bus(DEVICE(&s->rtc), BUS(isa_bus)); + qdev_prop_set_int32(DEVICE(&s->rtc), "base_year", 2000); + object_property_set_bool(OBJECT(&s->rtc), true, "realized", &err); + if (err) { + error_propagate(errp, err); + return; + } + isa_init_irq(ISA_DEVICE(&s->rtc), &s->rtc.irq, RTC_ISA_IRQ); + piix4_dev =3D dev; } =20 +static void piix4_init(Object *obj) +{ + PIIX4State *s =3D PIIX4_PCI_DEVICE(obj); + + object_initialize(&s->rtc, sizeof(s->rtc), TYPE_MC146818_RTC); +} + static void piix4_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -202,6 +223,7 @@ static const TypeInfo piix4_info =3D { .name =3D TYPE_PIIX4_PCI_DEVICE, .parent =3D TYPE_PCI_DEVICE, .instance_size =3D sizeof(PIIX4State), + .instance_init =3D piix4_init, .class_init =3D piix4_class_init, .interfaces =3D (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 9af486c77c..645c223edb 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -26,7 +26,7 @@ #include "qemu/units.h" #include "qemu-common.h" #include "cpu.h" -#include "hw/i386/pc.h" +#include "hw/southbridge/piix.h" #include "hw/isa/superio.h" #include "hw/char/serial.h" #include "net/net.h" @@ -44,7 +44,6 @@ #include "hw/irq.h" #include "hw/loader.h" #include "elf.h" -#include "hw/rtc/mc146818rtc.h" #include "exec/address-spaces.h" #include "hw/sysbus.h" /* SysBusDevice */ #include "qemu/host-utils.h" @@ -1425,7 +1424,6 @@ void mips_malta_init(MachineState *machine) pci_create_simple(pci_bus, piix4_devfn + 2, "piix4-usb-uhci"); smbus =3D piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100, isa_get_irq(NULL, 9), NULL, 0, NULL); - mc146818_rtc_init(isa_bus, 2000, NULL); =20 /* generate SPD EEPROM data */ generate_eeprom_spd(&smbus_eeprom_buf[0 * 256], ram_size); diff --git a/include/hw/acpi/piix4.h b/include/hw/acpi/piix4.h deleted file mode 100644 index 028bb53e3d..0000000000 --- a/include/hw/acpi/piix4.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef HW_ACPI_PIIX4_H -#define HW_ACPI_PIIX4_H - -#define TYPE_PIIX4_PM "PIIX4_PM" - -#endif diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index f553b29652..c933c0d3a1 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -228,12 +228,6 @@ int cmos_get_fd_drive_type(FloppyDriveType fd0); =20 #define PORT92_A20_LINE "a20" =20 -/* acpi_piix.c */ - -I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, - qemu_irq sci_irq, qemu_irq smi_irq, - int smm_enabled, DeviceState **piix4_pm); - /* hpet.c */ extern int no_hpet; =20 diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h new file mode 100644 index 0000000000..b8ce26fec4 --- /dev/null +++ b/include/hw/southbridge/piix.h @@ -0,0 +1,20 @@ +/* + * QEMU PIIX South Bridge Emulation + * + * Copyright (c) 2006 Fabrice Bellard + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + * + */ + +#ifndef HW_SOUTHBRIDGE_PIIX_H +#define HW_SOUTHBRIDGE_PIIX_H + +#define TYPE_PIIX4_PM "PIIX4_PM" + +I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, + qemu_irq sci_irq, qemu_irq smi_irq, + int smm_enabled, DeviceState **piix4_pm); + +#endif --=20 2.21.0 From nobody Sat May 4 19:27:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1572285405; cv=none; d=zoho.com; s=zohoarc; b=DpzGXC+Mq2mnJM6CdZZH4eZzhB7HgENIXVEFR1fJBxjp8CI9bVKuK7VAmEAJh5A3cgWzS+jJWAkgPC7Qs/w5UpHYraCVlPgRk2R/HYcep/BV2SDOfuO7gQXSh0MLZw/CVxudTz5hw8glyjYvmFNn/caidQAWTiiIU6pvGhxr5yo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572285405; 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=Lt5h0tf7aQi9H+UHQOfKlnMmiCztk0u8qFBuajQLpTc=; b=nrH1n+a1RD+ILv1/j7IL2gMuCnSZmy1NAUk4+9dfm1y/pxw1AIWlQZy2gGJu1m0rMpoEwmpza0wS76tAopCA00w+MBcCBeKlhKaMmSeKDla0BvLOyUjjjZoC4UPmdkyM0Nu62ybW95GmQUZmj3+eftdtGf/hlOGAD2Yr/S/1KRI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.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 1572285405209565.4463447437188; Mon, 28 Oct 2019 10:56:45 -0700 (PDT) Received: from localhost ([::1]:39836 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP9Fy-0004nm-SW for importer@patchew.org; Mon, 28 Oct 2019 13:56:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41214) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP7zs-0002Py-Kn for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP7zr-0007hp-Ip for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:00 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:52164 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iP7zr-0007d9-EF for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35:59 -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-327-vOg2mMAnMH6fZ-GR5T56tA-1; Mon, 28 Oct 2019 12:35:47 -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 31556107AD28; Mon, 28 Oct 2019 16:35:46 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-87.brq.redhat.com [10.40.204.87]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0DC541C941; Mon, 28 Oct 2019 16:35:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572280551; 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=Lt5h0tf7aQi9H+UHQOfKlnMmiCztk0u8qFBuajQLpTc=; b=d+AWP4ZO2NpFqqwZg/Fpjv4Q1xSBa6hOZ8sH/2J4wIFpXKdqUJJ1V4e+z6DvoPeTuDU2Ie rDYKImsGPCtAG+efQNG2q1lqYN5xOLM27UrfUfajFa6CCInCOJ6528XX6nRIogmB70M6Si RSgKPv9VAaXBwZOZJpTLFXhETMliC7c= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 09/20] hw/mips/mips_malta: Create IDE hard drive array dynamically Date: Mon, 28 Oct 2019 17:34:36 +0100 Message-Id: <20191028163447.18541-10-philmd@redhat.com> In-Reply-To: <20191028163447.18541-1-philmd@redhat.com> References: <20191028163447.18541-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: vOg2mMAnMH6fZ-GR5T56tA-1 X-Mimecast-Spam-Score: 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: 207.211.31.120 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: Li Qiang , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Markovic , Paolo Bonzini , Aleksandar Rikalo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , 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" In the next commit we'll refactor the PIIX4 code out of mips_malta_init(). As a preliminary step, add the 'ide_drives' variable and create the drive array dynamically. Reviewed-by: Aleksandar Markovic Reviewed-by: Li Qiang Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/mips/mips_malta.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 645c223edb..239ea98ef8 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -1235,7 +1235,8 @@ void mips_malta_init(MachineState *machine) int piix4_devfn; I2CBus *smbus; DriveInfo *dinfo; - DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; + const size_t ide_drives =3D MAX_IDE_BUS * MAX_IDE_DEVS; + DriveInfo **hd; int fl_idx =3D 0; int be; =20 @@ -1406,7 +1407,8 @@ void mips_malta_init(MachineState *machine) pci_bus =3D gt64120_register(s->i8259); =20 /* Southbridge */ - ide_drive_get(hd, ARRAY_SIZE(hd)); + hd =3D g_new(DriveInfo *, ide_drives); + ide_drive_get(hd, ide_drives); =20 pci =3D pci_create_simple_multifunction(pci_bus, PCI_DEVFN(10, 0), true, TYPE_PIIX4_PCI_DEVICE); @@ -1421,6 +1423,7 @@ void mips_malta_init(MachineState *machine) } =20 pci_piix4_ide_init(pci_bus, hd, piix4_devfn + 1); + g_free(hd); pci_create_simple(pci_bus, piix4_devfn + 2, "piix4-usb-uhci"); smbus =3D piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100, isa_get_irq(NULL, 9), NULL, 0, NULL); --=20 2.21.0 From nobody Sat May 4 19:27:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1572285887; cv=none; d=zoho.com; s=zohoarc; b=OwkN0Q9D79SSLAAbtK+llXt6fF1Fy/314bwrvphLWGBJbbI44LJc+3rZRxdx2KMoWaQ+WNaJHJqhWe8l+9W6UTiqrvIzA0XaZn3H9TMlPLwSvBW7Crz34ijjMe1Nf5E1V+qcwVdB/i2RkV9fFE84fcFNdHGYtPR3h8DuKi1orLQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572285887; 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=4J3P2UfFCzOddbSMsyW2LgzLAlP7e/TG1wlFn/qvUL0=; b=QHKI9hG9zRTvcsYvJ22iEYCCkYm8am7jyejfwo5fIdhjic0EcrfyXpCD+ZoFjCoGQYCAy63ZaB2Gd0VfZdg5TRnEvTUFbNiSNfp9RlD7fL07vZzxOgC4D6Hu18B8cu5lTFq/rixHayZ6usq8Rwg6xV1LajKOVnYlSkDcjZCKUn4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.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 1572285887800422.518450481943; Mon, 28 Oct 2019 11:04:47 -0700 (PDT) Received: from localhost ([::1]:39918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP9Nm-0002pF-34 for importer@patchew.org; Mon, 28 Oct 2019 14:04:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41227) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP7zt-0002Rq-6L for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP7zr-0007hy-LB for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:01 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:40166 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iP7zr-0007fP-FT for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:35:59 -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-185-VdJVkobbP3iJP3VI_U3K8A-1; Mon, 28 Oct 2019 12:35:52 -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 9F7548017CC; Mon, 28 Oct 2019 16:35:51 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-87.brq.redhat.com [10.40.204.87]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B8C961C941; Mon, 28 Oct 2019 16:35:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572280555; 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=4J3P2UfFCzOddbSMsyW2LgzLAlP7e/TG1wlFn/qvUL0=; b=ASysei4CfRbQbQFwtwfIu9EgaJCgnCE4nC/8LIoit9W+Cp3r4Jev008OvdqeA769fcEOjy JRMNmHSr2hJF4OEI55R4+HKRIWHbBnVwnAzmtjKmIHdybWHSjUfmgl/36aTX2gRM7KtqCh c/f6KzVu9xhRlSEYd/vLc4UvX5uMWb0= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 10/20] hw/mips/mips_malta: Extract the PIIX4 creation code as piix4_create() Date: Mon, 28 Oct 2019 17:34:37 +0100 Message-Id: <20191028163447.18541-11-philmd@redhat.com> In-Reply-To: <20191028163447.18541-1-philmd@redhat.com> References: <20191028163447.18541-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: VdJVkobbP3iJP3VI_U3K8A-1 X-Mimecast-Spam-Score: 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: 207.211.31.120 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: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Markovic , Paolo Bonzini , Aleksandar Rikalo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , 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" The Malta board instantiate a PIIX4 chipset doing various calls. Refactor all those related calls into a single function: piix4_create(). Reviewed-by: Aleksandar Markovic Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/mips/mips_malta.c | 47 +++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 239ea98ef8..9014d77b7a 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -1210,6 +1210,34 @@ static void mips_create_cpu(MachineState *ms, MaltaS= tate *s, } } =20 +static DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, + I2CBus **smbus, size_t ide_buses) +{ + const size_t ide_drives =3D ide_buses * MAX_IDE_DEVS; + DriveInfo **hd; + PCIDevice *pci; + DeviceState *dev; + + pci =3D pci_create_simple_multifunction(pci_bus, PCI_DEVFN(10, 0), + true, TYPE_PIIX4_PCI_DEVICE); + dev =3D DEVICE(pci); + if (isa_bus) { + *isa_bus =3D ISA_BUS(qdev_get_child_bus(dev, "isa.0")); + } + + hd =3D g_new(DriveInfo *, ide_drives); + ide_drive_get(hd, ide_drives); + pci_piix4_ide_init(pci_bus, hd, pci->devfn + 1); + g_free(hd); + pci_create_simple(pci_bus, pci->devfn + 2, "piix4-usb-uhci"); + if (smbus) { + *smbus =3D piix4_pm_init(pci_bus, pci->devfn + 3, 0x1100, + isa_get_irq(NULL, 9), NULL, 0, NULL); + } + + return dev; +} + static void mips_malta_init(MachineState *machine) { @@ -1231,12 +1259,8 @@ void mips_malta_init(MachineState *machine) PCIBus *pci_bus; ISABus *isa_bus; qemu_irq cbus_irq, i8259_irq; - PCIDevice *pci; - int piix4_devfn; I2CBus *smbus; DriveInfo *dinfo; - const size_t ide_drives =3D MAX_IDE_BUS * MAX_IDE_DEVS; - DriveInfo **hd; int fl_idx =3D 0; int be; =20 @@ -1407,14 +1431,7 @@ void mips_malta_init(MachineState *machine) pci_bus =3D gt64120_register(s->i8259); =20 /* Southbridge */ - hd =3D g_new(DriveInfo *, ide_drives); - ide_drive_get(hd, ide_drives); - - pci =3D pci_create_simple_multifunction(pci_bus, PCI_DEVFN(10, 0), - true, TYPE_PIIX4_PCI_DEVICE); - dev =3D DEVICE(pci); - isa_bus =3D ISA_BUS(qdev_get_child_bus(dev, "isa.0")); - piix4_devfn =3D pci->devfn; + dev =3D piix4_create(pci_bus, &isa_bus, &smbus, MAX_IDE_BUS); =20 /* Interrupt controller */ qdev_connect_gpio_out_named(dev, "intr", 0, i8259_irq); @@ -1422,12 +1439,6 @@ void mips_malta_init(MachineState *machine) s->i8259[i] =3D qdev_get_gpio_in_named(dev, "isa", i); } =20 - pci_piix4_ide_init(pci_bus, hd, piix4_devfn + 1); - g_free(hd); - pci_create_simple(pci_bus, piix4_devfn + 2, "piix4-usb-uhci"); - smbus =3D piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100, - isa_get_irq(NULL, 9), NULL, 0, NULL); - /* generate SPD EEPROM data */ generate_eeprom_spd(&smbus_eeprom_buf[0 * 256], ram_size); generate_eeprom_serial(&smbus_eeprom_buf[6 * 256]); --=20 2.21.0 From nobody Sat May 4 19:27:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1572286003; cv=none; d=zoho.com; s=zohoarc; b=IT22CPiotddLyrUCjDbpK3n0P9SdV4uUF0EztYrg/qrufeq+GFhnUJafno6GsvL/7Nr2Abtz/ha4hQFFCxah9RIsiTOAPRWAkGvV6ZLdxZuhJ1BpiejamXIe0lghNz2zBjkq200oX9fTGAZ6s6KQgV9iTqCPf/EIwSxN/WqA0lM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572286003; 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=UaGGIPdRKREyMkIJNKEc0RLVDqW+DoJcRjwnPCc+80g=; b=jJM1d4VAyJwCasvcGoxPqjqQ83o6sG1PJbkZ0Dyt6dpn1ektp6/JuKZ6YGwaxiTbvrKYxVLWUAuBF8rQjVmWU65+1P7O6QTvdAmd6UpkEBWcoNxH2DnwOt+OsaU28buYbVQNH3V/AQmEop+SrEGmGDnpMF47QchXLDLZ6R40buo= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.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 1572286003079767.2935360467476; Mon, 28 Oct 2019 11:06:43 -0700 (PDT) Received: from localhost ([::1]:39958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP9Pd-0005qj-AD for importer@patchew.org; Mon, 28 Oct 2019 14:06:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41276) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP801-0002a0-3E for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP7zy-0007nm-Oj for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:08 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:23038 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iP7zy-0007nL-J8 for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:06 -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-355-z4-YBFTlN3ucC-ESpndM6w-1; Mon, 28 Oct 2019 12:36:02 -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 EC5EC107AD28; Mon, 28 Oct 2019 16:36:00 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-87.brq.redhat.com [10.40.204.87]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 37A27261B7; Mon, 28 Oct 2019 16:35:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572280565; 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=UaGGIPdRKREyMkIJNKEc0RLVDqW+DoJcRjwnPCc+80g=; b=UTxLiHpNwyrc8uUMeMgRDBxGwZolQLaKGi/1HFsg5hNCgds+lnWq1iT8KbfbrQhC3iulNQ tTm7pzB8KaHBbj2sf4ltxJDnLxjxDJjT+Wp5d1UVqENf/XikUn+3SiYbOl1YGRlHFEKcv6 NzyG8WtP354/wVbnevAqgjSP5y7AThs= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 11/20] hw/isa/piix4: Move piix4_create() to hw/isa/piix4.c Date: Mon, 28 Oct 2019 17:34:38 +0100 Message-Id: <20191028163447.18541-12-philmd@redhat.com> In-Reply-To: <20191028163447.18541-1-philmd@redhat.com> References: <20191028163447.18541-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: z4-YBFTlN3ucC-ESpndM6w-1 X-Mimecast-Spam-Score: 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: 207.211.31.81 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" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Markovic , Paolo Bonzini , Aleksandar Rikalo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , 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: Philippe Mathieu-Daud=C3=A9 Now that we properly refactored the piix4_create() function, let's move it to hw/isa/piix4.c where it belongs, so it can be reused on other places. Reviewed-by: Aleksandar Markovic Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/isa/piix4.c | 30 ++++++++++++++++++++++++++++++ hw/mips/gt64xxx_pci.c | 1 + hw/mips/mips_malta.c | 28 ---------------------------- include/hw/i386/pc.h | 2 -- include/hw/southbridge/piix.h | 6 ++++++ 5 files changed, 37 insertions(+), 30 deletions(-) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 6bf6f0c5d9..f3e21ea76d 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -27,12 +27,14 @@ #include "qapi/error.h" #include "hw/irq.h" #include "hw/i386/pc.h" +#include "hw/southbridge/piix.h" #include "hw/pci/pci.h" #include "hw/isa/isa.h" #include "hw/sysbus.h" #include "hw/dma/i8257.h" #include "hw/timer/i8254.h" #include "hw/rtc/mc146818rtc.h" +#include "hw/ide.h" #include "migration/vmstate.h" #include "sysemu/reset.h" #include "sysemu/runstate.h" @@ -237,3 +239,31 @@ static void piix4_register_types(void) } =20 type_init(piix4_register_types) + +DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, + I2CBus **smbus, size_t ide_buses) +{ + size_t ide_drives =3D ide_buses * MAX_IDE_DEVS; + DriveInfo **hd; + PCIDevice *pci; + DeviceState *dev; + + pci =3D pci_create_simple_multifunction(pci_bus, PCI_DEVFN(10, 0), + true, TYPE_PIIX4_PCI_DEVICE); + dev =3D DEVICE(pci); + if (isa_bus) { + *isa_bus =3D ISA_BUS(qdev_get_child_bus(dev, "isa.0")); + } + + hd =3D g_new(DriveInfo *, ide_drives); + ide_drive_get(hd, ide_drives); + pci_piix4_ide_init(pci_bus, hd, pci->devfn + 1); + g_free(hd); + pci_create_simple(pci_bus, pci->devfn + 2, "piix4-usb-uhci"); + if (smbus) { + *smbus =3D piix4_pm_init(pci_bus, pci->devfn + 3, 0x1100, + isa_get_irq(NULL, 9), NULL, 0, NULL); + } + + return dev; +} diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c index f325bd6c1c..c277398c0d 100644 --- a/hw/mips/gt64xxx_pci.c +++ b/hw/mips/gt64xxx_pci.c @@ -28,6 +28,7 @@ #include "hw/mips/mips.h" #include "hw/pci/pci.h" #include "hw/pci/pci_host.h" +#include "hw/southbridge/piix.h" #include "migration/vmstate.h" #include "hw/i386/pc.h" #include "hw/irq.h" diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 9014d77b7a..92e9ca5bfa 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -1210,34 +1210,6 @@ static void mips_create_cpu(MachineState *ms, MaltaS= tate *s, } } =20 -static DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, - I2CBus **smbus, size_t ide_buses) -{ - const size_t ide_drives =3D ide_buses * MAX_IDE_DEVS; - DriveInfo **hd; - PCIDevice *pci; - DeviceState *dev; - - pci =3D pci_create_simple_multifunction(pci_bus, PCI_DEVFN(10, 0), - true, TYPE_PIIX4_PCI_DEVICE); - dev =3D DEVICE(pci); - if (isa_bus) { - *isa_bus =3D ISA_BUS(qdev_get_child_bus(dev, "isa.0")); - } - - hd =3D g_new(DriveInfo *, ide_drives); - ide_drive_get(hd, ide_drives); - pci_piix4_ide_init(pci_bus, hd, pci->devfn + 1); - g_free(hd); - pci_create_simple(pci_bus, pci->devfn + 2, "piix4-usb-uhci"); - if (smbus) { - *smbus =3D piix4_pm_init(pci_bus, pci->devfn + 3, 0x1100, - isa_get_irq(NULL, 9), NULL, 0, NULL); - } - - return dev; -} - static void mips_malta_init(MachineState *machine) { diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index c933c0d3a1..2fd40ceebe 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -258,8 +258,6 @@ PCIBus *i440fx_init(const char *host_type, const char *= pci_type, MemoryRegion *ram_memory); =20 PCIBus *find_i440fx(void); -/* piix4.c */ -extern PCIDevice *piix4_dev; =20 /* pc_sysfw.c */ void pc_system_flash_create(PCMachineState *pcms); diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index b8ce26fec4..add352456b 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -2,6 +2,7 @@ * QEMU PIIX South Bridge Emulation * * Copyright (c) 2006 Fabrice Bellard + * Copyright (c) 2018 Herv=C3=A9 Poussineau * * This work is licensed under the terms of the GNU GPL, version 2 or late= r. * See the COPYING file in the top-level directory. @@ -17,4 +18,9 @@ I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t sm= b_io_base, qemu_irq sci_irq, qemu_irq smi_irq, int smm_enabled, DeviceState **piix4_pm); =20 +extern PCIDevice *piix4_dev; + +DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, + I2CBus **smbus, size_t ide_buses); + #endif --=20 2.21.0 From nobody Sat May 4 19:27:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1572284839; cv=none; d=zoho.com; s=zohoarc; b=GVBgWdckFkZa+A62ikjO/9Ux6DOHkoLqOJzaFm2oG1c8BvWCHbzIUAUETjQCcI7KT7SiDPfuBFaa6J7gm30ex+7upMYexYswplQQ7YVYwRsGp+c45gKH7xND6yRJG6LHscT8aEbRcyXvkChvl6Vu5sAsWmCFKFoueTwKfh05/8Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572284839; 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=P72P8oJYt+/4WQxh4nVCZd3h2uPcYKTRBPpr6Adz7C0=; b=IM+C/GjrUvmlCCOBpWsKKU/mHqRsOKqjA/ZcsY87xbLG2RaKIB4DbGHe51XbTJ1MXqpeqlUrjyD/x3gvqGImuvDx2pjZj1+B8bbZmvAc65Jg4jZD4GPR0Wd6qvPzE4bL1r0pv9TkzZwDptAs5fo8q8SKKHAdtBSSHcrQo88TRDw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.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 1572284839480271.40071891008586; Mon, 28 Oct 2019 10:47:19 -0700 (PDT) Received: from localhost ([::1]:39698 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP96r-00041l-43 for importer@patchew.org; Mon, 28 Oct 2019 13:47:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41289) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP80F-0002cQ-5e for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP80D-0007vz-6J for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:23 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:52999 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iP807-0007qr-4e for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:17 -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-231-9cXMR-mfMc2rB3UdtXL0Xg-1; Mon, 28 Oct 2019 12:36:09 -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 E24641005509; Mon, 28 Oct 2019 16:36:07 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-87.brq.redhat.com [10.40.204.87]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9E8C326199; Mon, 28 Oct 2019 16:36:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572280572; 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=P72P8oJYt+/4WQxh4nVCZd3h2uPcYKTRBPpr6Adz7C0=; b=epdA/JhqdItQztqW+eavf2NzzfArCfP7ZbbPB7Av8HwKyF1JNit4L6K9j2WNtCS/9r475B RP7g3jFb0BAaRL6hYsKw872CrQA6vJPZD4bRPCo7Ik3S1w49pqH/f7fnj1Qtsi2bfWyjR1 qCpq7grAC1qPdrHjto8dK8xk5Gb1eCo= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 12/20] hw/i386: Remove obsolete LoadStateHandler::load_state_old handlers Date: Mon, 28 Oct 2019 17:34:39 +0100 Message-Id: <20191028163447.18541-13-philmd@redhat.com> In-Reply-To: <20191028163447.18541-1-philmd@redhat.com> References: <20191028163447.18541-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: 9cXMR-mfMc2rB3UdtXL0Xg-1 X-Mimecast-Spam-Score: 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: 207.211.31.81 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: Peter Maydell , "Michael S. Tsirkin" , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Markovic , Igor Mammedov , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , 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" These devices implemented their load_state_old() handler 10 years ago, previous to QEMU v0.12. Since commit cc425b5ddf removed the pc-0.10 and pc-0.11 machines, we can drop this code. Note: the mips_r4k machine started to use the i8254 device just after QEMU v0.5.0, but the MIPS machine types are not versioned, so there is no migration compatibility issue removing this handler. Suggested-by: Peter Maydell Reviewed-by: Aleksandar Markovic Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/acpi/piix4.c | 40 --------------------------------- hw/intc/apic_common.c | 49 ----------------------------------------- hw/pci-host/piix.c | 25 --------------------- hw/timer/i8254_common.c | 40 --------------------------------- 4 files changed, 154 deletions(-) diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 2efd1605b8..93aec2dd2c 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -41,7 +41,6 @@ #include "hw/acpi/memory_hotplug.h" #include "hw/acpi/acpi_dev_interface.h" #include "hw/xen/xen.h" -#include "migration/qemu-file-types.h" #include "migration/vmstate.h" #include "hw/core/cpu.h" #include "trace.h" @@ -204,43 +203,6 @@ static const VMStateDescription vmstate_pci_status =3D= { } }; =20 -static int acpi_load_old(QEMUFile *f, void *opaque, int version_id) -{ - PIIX4PMState *s =3D opaque; - int ret, i; - uint16_t temp; - - ret =3D pci_device_load(PCI_DEVICE(s), f); - if (ret < 0) { - return ret; - } - qemu_get_be16s(f, &s->ar.pm1.evt.sts); - qemu_get_be16s(f, &s->ar.pm1.evt.en); - qemu_get_be16s(f, &s->ar.pm1.cnt.cnt); - - ret =3D vmstate_load_state(f, &vmstate_apm, &s->apm, 1); - if (ret) { - return ret; - } - - timer_get(f, s->ar.tmr.timer); - qemu_get_sbe64s(f, &s->ar.tmr.overflow_time); - - qemu_get_be16s(f, (uint16_t *)s->ar.gpe.sts); - for (i =3D 0; i < 3; i++) { - qemu_get_be16s(f, &temp); - } - - qemu_get_be16s(f, (uint16_t *)s->ar.gpe.en); - for (i =3D 0; i < 3; i++) { - qemu_get_be16s(f, &temp); - } - - ret =3D vmstate_load_state(f, &vmstate_pci_status, - &s->acpi_pci_hotplug.acpi_pcihp_pci_status[ACPI_PCIHP_BSEL_DEFAULT= ], 1); - return ret; -} - static bool vmstate_test_use_acpi_pci_hotplug(void *opaque, int version_id) { PIIX4PMState *s =3D opaque; @@ -312,8 +274,6 @@ static const VMStateDescription vmstate_acpi =3D { .name =3D "piix4_pm", .version_id =3D 3, .minimum_version_id =3D 3, - .minimum_version_id_old =3D 1, - .load_state_old =3D acpi_load_old, .post_load =3D vmstate_acpi_post_load, .fields =3D (VMStateField[]) { VMSTATE_PCI_DEVICE(parent_obj, PIIX4PMState), diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c index aafd8e0e33..375cb6abe9 100644 --- a/hw/intc/apic_common.c +++ b/hw/intc/apic_common.c @@ -31,7 +31,6 @@ #include "sysemu/kvm.h" #include "hw/qdev-properties.h" #include "hw/sysbus.h" -#include "migration/qemu-file-types.h" #include "migration/vmstate.h" =20 static int apic_irq_delivered; @@ -262,52 +261,6 @@ static void apic_reset_common(DeviceState *dev) apic_init_reset(dev); } =20 -/* This function is only used for old state version 1 and 2 */ -static int apic_load_old(QEMUFile *f, void *opaque, int version_id) -{ - APICCommonState *s =3D opaque; - APICCommonClass *info =3D APIC_COMMON_GET_CLASS(s); - int i; - - if (version_id > 2) { - return -EINVAL; - } - - /* XXX: what if the base changes? (registered memory regions) */ - qemu_get_be32s(f, &s->apicbase); - qemu_get_8s(f, &s->id); - qemu_get_8s(f, &s->arb_id); - qemu_get_8s(f, &s->tpr); - qemu_get_be32s(f, &s->spurious_vec); - qemu_get_8s(f, &s->log_dest); - qemu_get_8s(f, &s->dest_mode); - for (i =3D 0; i < 8; i++) { - qemu_get_be32s(f, &s->isr[i]); - qemu_get_be32s(f, &s->tmr[i]); - qemu_get_be32s(f, &s->irr[i]); - } - for (i =3D 0; i < APIC_LVT_NB; i++) { - qemu_get_be32s(f, &s->lvt[i]); - } - qemu_get_be32s(f, &s->esr); - qemu_get_be32s(f, &s->icr[0]); - qemu_get_be32s(f, &s->icr[1]); - qemu_get_be32s(f, &s->divide_conf); - s->count_shift =3D qemu_get_be32(f); - qemu_get_be32s(f, &s->initial_count); - s->initial_count_load_time =3D qemu_get_be64(f); - s->next_time =3D qemu_get_be64(f); - - if (version_id >=3D 2) { - s->timer_expiry =3D qemu_get_be64(f); - } - - if (info->post_load) { - info->post_load(s); - } - return 0; -} - static const VMStateDescription vmstate_apic_common; =20 static void apic_common_realize(DeviceState *dev, Error **errp) @@ -408,8 +361,6 @@ static const VMStateDescription vmstate_apic_common =3D= { .name =3D "apic", .version_id =3D 3, .minimum_version_id =3D 3, - .minimum_version_id_old =3D 1, - .load_state_old =3D apic_load_old, .pre_load =3D apic_pre_load, .pre_save =3D apic_dispatch_pre_save, .post_load =3D apic_dispatch_post_load, diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c index 135c645535..2f4cbcbfe9 100644 --- a/hw/pci-host/piix.c +++ b/hw/pci-host/piix.c @@ -33,7 +33,6 @@ #include "qapi/error.h" #include "qemu/range.h" #include "hw/xen/xen.h" -#include "migration/qemu-file-types.h" #include "migration/vmstate.h" #include "hw/pci-host/pam.h" #include "sysemu/reset.h" @@ -174,28 +173,6 @@ static void i440fx_write_config(PCIDevice *dev, } } =20 -static int i440fx_load_old(QEMUFile* f, void *opaque, int version_id) -{ - PCII440FXState *d =3D opaque; - PCIDevice *pd =3D PCI_DEVICE(d); - int ret, i; - uint8_t smm_enabled; - - ret =3D pci_device_load(pd, f); - if (ret < 0) - return ret; - i440fx_update_memory_mappings(d); - qemu_get_8s(f, &smm_enabled); - - if (version_id =3D=3D 2) { - for (i =3D 0; i < PIIX_NUM_PIRQS; i++) { - qemu_get_be32(f); /* dummy load for compatibility */ - } - } - - return 0; -} - static int i440fx_post_load(void *opaque, int version_id) { PCII440FXState *d =3D opaque; @@ -208,8 +185,6 @@ static const VMStateDescription vmstate_i440fx =3D { .name =3D "I440FX", .version_id =3D 3, .minimum_version_id =3D 3, - .minimum_version_id_old =3D 1, - .load_state_old =3D i440fx_load_old, .post_load =3D i440fx_post_load, .fields =3D (VMStateField[]) { VMSTATE_PCI_DEVICE(parent_obj, PCII440FXState), diff --git a/hw/timer/i8254_common.c b/hw/timer/i8254_common.c index 57bf10cc94..050875b497 100644 --- a/hw/timer/i8254_common.c +++ b/hw/timer/i8254_common.c @@ -29,7 +29,6 @@ #include "qemu/timer.h" #include "hw/timer/i8254.h" #include "hw/timer/i8254_internal.h" -#include "migration/qemu-file-types.h" #include "migration/vmstate.h" =20 /* val must be 0 or 1 */ @@ -202,43 +201,6 @@ static const VMStateDescription vmstate_pit_channel = =3D { } }; =20 -static int pit_load_old(QEMUFile *f, void *opaque, int version_id) -{ - PITCommonState *pit =3D opaque; - PITCommonClass *c =3D PIT_COMMON_GET_CLASS(pit); - PITChannelState *s; - int i; - - if (version_id !=3D 1) { - return -EINVAL; - } - - for (i =3D 0; i < 3; i++) { - s =3D &pit->channels[i]; - s->count =3D qemu_get_be32(f); - qemu_get_be16s(f, &s->latched_count); - qemu_get_8s(f, &s->count_latched); - qemu_get_8s(f, &s->status_latched); - qemu_get_8s(f, &s->status); - qemu_get_8s(f, &s->read_state); - qemu_get_8s(f, &s->write_state); - qemu_get_8s(f, &s->write_latch); - qemu_get_8s(f, &s->rw_mode); - qemu_get_8s(f, &s->mode); - qemu_get_8s(f, &s->bcd); - qemu_get_8s(f, &s->gate); - s->count_load_time =3D qemu_get_be64(f); - s->irq_disabled =3D 0; - if (i =3D=3D 0) { - s->next_transition_time =3D qemu_get_be64(f); - } - } - if (c->post_load) { - c->post_load(pit); - } - return 0; -} - static int pit_dispatch_pre_save(void *opaque) { PITCommonState *s =3D opaque; @@ -266,8 +228,6 @@ static const VMStateDescription vmstate_pit_common =3D { .name =3D "i8254", .version_id =3D 3, .minimum_version_id =3D 2, - .minimum_version_id_old =3D 1, - .load_state_old =3D pit_load_old, .pre_save =3D pit_dispatch_pre_save, .post_load =3D pit_dispatch_post_load, .fields =3D (VMStateField[]) { --=20 2.21.0 From nobody Sat May 4 19:27:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1572286058; cv=none; d=zoho.com; s=zohoarc; b=Lvs12Q8ZIxv+LttpeXvhBsszL94+qRdw/GsXGy/Zzvr7SwFdseQZNP+1XCQiQMeBwkIJ4Ag/2S0mdjdvJHFHo9OnzgTS4fbIz3sSCpo1HMz84Q5sINEFfCjvGAtv+E4FOlWpe4tS6KKdBBwdi1qZy3eCm51hF64u8CEBIT7w9Vw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572286058; 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=S/Dx+PbxKqebN9kqK3yoqBeSkpzxICQMpRExQnwgy+Q=; b=EnNO8f3p8bb9SFSTca9ivAX6NRTB3xq2QiI0DGtoxQNh0j1BzHcfeaoaHaB5jeizHv32td/B3g7SFOXweWSnSE11+ATWBSiyoY3EAjPsPdJwuBHJikDVsODMSTr2ODNOhZqq1U2vaK9hQGU8a9V1nZeOAZPHzcM9ha/Lrnvibn4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.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 1572286058071821.5283501686272; Mon, 28 Oct 2019 11:07:38 -0700 (PDT) Received: from localhost ([::1]:39968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP9QW-0007OV-70 for importer@patchew.org; Mon, 28 Oct 2019 14:07:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41301) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP80J-0002cj-74 for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP80F-0007xH-4M for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:25 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:46091 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iP80D-0007tF-6D for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:22 -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-178-nZHb64i5MISaPax7YXZxcw-1; Mon, 28 Oct 2019 12:36:14 -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 6134D1800DCB; Mon, 28 Oct 2019 16:36:13 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-87.brq.redhat.com [10.40.204.87]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 792D91C941; Mon, 28 Oct 2019 16:36:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572280578; 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=S/Dx+PbxKqebN9kqK3yoqBeSkpzxICQMpRExQnwgy+Q=; b=EkG6+qiG86lO98dIiFm/qnNMNf3Tpc8Zlbu8GZj4WvKYFSce1J7yhf4a/1K0ZIfIzCFo+p tGj9hkbTfALqy23Szh0D69v9PVXv/EYHQy/iK6IUZKGWMdL46jfTf25fGXdZ8rZVlrfRoh QfCEaoMZotLnc91n4bz6fuw1n0qQRTQ= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 13/20] hw/pci-host/piix: Extract piix3_create() Date: Mon, 28 Oct 2019 17:34:40 +0100 Message-Id: <20191028163447.18541-14-philmd@redhat.com> In-Reply-To: <20191028163447.18541-1-philmd@redhat.com> References: <20191028163447.18541-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: nZHb64i5MISaPax7YXZxcw-1 X-Mimecast-Spam-Score: 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: 205.139.110.61 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: Esteban Bosse , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Markovic , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , 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" Extract the PIIX3 creation code from the i440fx_init() function. Reviewed-by: Aleksandar Markovic Reviewed-by: Esteban Bosse Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/piix.c | 51 ++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c index 2f4cbcbfe9..3292703de7 100644 --- a/hw/pci-host/piix.c +++ b/hw/pci-host/piix.c @@ -331,6 +331,36 @@ static void i440fx_realize(PCIDevice *dev, Error **err= p) } } =20 +static PIIX3State *piix3_create(PCIBus *pci_bus, ISABus **isa_bus) +{ + PIIX3State *piix3; + PCIDevice *pci_dev; + + /* + * Xen supports additional interrupt routes from the PCI devices to + * the IOAPIC: the four pins of each PCI device on the bus are also + * connected to the IOAPIC directly. + * These additional routes can be discovered through ACPI. + */ + if (xen_enabled()) { + pci_dev =3D pci_create_simple_multifunction(pci_bus, -1, true, + TYPE_PIIX3_XEN_DEVICE); + piix3 =3D PIIX3_PCI_DEVICE(pci_dev); + pci_bus_irqs(pci_bus, xen_piix3_set_irq, xen_pci_slot_get_pirq, + piix3, XEN_PIIX_NUM_PIRQS); + } else { + pci_dev =3D pci_create_simple_multifunction(pci_bus, -1, true, + TYPE_PIIX3_DEVICE); + piix3 =3D PIIX3_PCI_DEVICE(pci_dev); + pci_bus_irqs(pci_bus, piix3_set_irq, pci_slot_get_pirq, + piix3, PIIX_NUM_PIRQS); + pci_bus_set_route_irq_fn(pci_bus, piix3_route_intx_pin_to_irq); + } + *isa_bus =3D ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0")); + + return piix3; +} + PCIBus *i440fx_init(const char *host_type, const char *pci_type, PCII440FXState **pi440fx_state, int *piix3_devfn, @@ -400,27 +430,8 @@ PCIBus *i440fx_init(const char *host_type, const char = *pci_type, PAM_EXPAN_SIZE); } =20 - /* Xen supports additional interrupt routes from the PCI devices to - * the IOAPIC: the four pins of each PCI device on the bus are also - * connected to the IOAPIC directly. - * These additional routes can be discovered through ACPI. */ - if (xen_enabled()) { - PCIDevice *pci_dev =3D pci_create_simple_multifunction(b, - -1, true, TYPE_PIIX3_XEN_DEVICE); - piix3 =3D PIIX3_PCI_DEVICE(pci_dev); - pci_bus_irqs(b, xen_piix3_set_irq, xen_pci_slot_get_pirq, - piix3, XEN_PIIX_NUM_PIRQS); - } else { - PCIDevice *pci_dev =3D pci_create_simple_multifunction(b, - -1, true, TYPE_PIIX3_DEVICE); - piix3 =3D PIIX3_PCI_DEVICE(pci_dev); - pci_bus_irqs(b, piix3_set_irq, pci_slot_get_pirq, piix3, - PIIX_NUM_PIRQS); - pci_bus_set_route_irq_fn(b, piix3_route_intx_pin_to_irq); - } + piix3 =3D piix3_create(b, isa_bus); piix3->pic =3D pic; - *isa_bus =3D ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0")); - *piix3_devfn =3D piix3->dev.devfn; =20 ram_size =3D ram_size / 8 / 1024 / 1024; --=20 2.21.0 From nobody Sat May 4 19:27:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1572286275; cv=none; d=zoho.com; s=zohoarc; b=k4lu3RCLlHkDBcR1oZaypVbjmBI1wvbyPN70riKpHGtMt1YJ1Jau5FS74m282mm1NgkR0L85tYsHXcCd+CPEQ+SyyxU35R2OU1Y30sK/KN0UdCvuYmnjExeORaG8+PhmavSVn+4uowOZEb5oxINcQ15AQEhjcxyquCMQK6v53YA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572286275; 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=QFumcyoqfTm2frQnxsT/waaWD2sDmObom9MoH51AV2A=; b=L/lZZenEuCPrzKIsp83mSCOk95T4fFPKjNKbUTRtcgiqzS9VJMd2g+tyTaCwoKSfAiSjVMsdhY4DA5gjdn0m92kf7VeFawOTQiAuFJYMgjgVOd3Ut6vTdlymoga6a0itBLKjSq61XfZxHWMml0ctD8cK1u3I8z64TMlA4BlJN5Y= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.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 1572286275173172.60318554437538; Mon, 28 Oct 2019 11:11:15 -0700 (PDT) Received: from localhost ([::1]:40080 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP9U1-0004Di-AK for importer@patchew.org; Mon, 28 Oct 2019 14:11:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41313) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP80L-0002eK-QO for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP80K-00080c-JP for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:29 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:36787 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iP80K-0007zB-Bw for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:28 -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-268-ZZrVdd1COxqSotmg7v9C4Q-1; Mon, 28 Oct 2019 12:36: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 635158017CC; Mon, 28 Oct 2019 16:36:20 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-87.brq.redhat.com [10.40.204.87]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0B1591C941; Mon, 28 Oct 2019 16:36:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572280586; 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=QFumcyoqfTm2frQnxsT/waaWD2sDmObom9MoH51AV2A=; b=Whfsz/oaFbd7Ijy4W4LYqDT6Pqaf0zNNP5otDveKTTuV+5O1b6kuSE7nw3eNVgzmT04cvW 6Q3tyFGXJxg1Pmms2YDRKIF/P0sNBf15EtVWCt5iS1mIOZ2P00hIohRe2qwIUgHA7CjbT9 znKQl1EsPz4G9/xGfIjstFYYqOBPHvw= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 14/20] hw/pci-host/piix: Move RCR_IOPORT register definition Date: Mon, 28 Oct 2019 17:34:41 +0100 Message-Id: <20191028163447.18541-15-philmd@redhat.com> In-Reply-To: <20191028163447.18541-1-philmd@redhat.com> References: <20191028163447.18541-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: ZZrVdd1COxqSotmg7v9C4Q-1 X-Mimecast-Spam-Score: 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: 205.139.110.61 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: Eduardo Habkost , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Markovic , Igor Mammedov , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aurelien Jarno , Richard Henderson 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: Philippe Mathieu-Daud=C3=A9 The RCR_IOPORT register belongs to the PIIX chipset. Move the definition to "piix.h", and prepend the PIIX prefix. Reviewed-by: Aleksandar Markovic Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/acpi-build.c | 2 +- hw/isa/piix4.c | 2 +- hw/pci-host/piix.c | 7 ++++--- include/hw/i386/pc.h | 6 ------ include/hw/southbridge/piix.h | 6 ++++++ 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index b1b050d8e2..266d9b534b 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -209,7 +209,7 @@ static void acpi_get_pm_info(MachineState *machine, Acp= iPmInfo *pm) =20 /* The above need not be conditional on machine type because the reset= port * happens to be the same on PIIX (pc) and ICH9 (q35). */ - QEMU_BUILD_BUG_ON(ICH9_RST_CNT_IOPORT !=3D RCR_IOPORT); + QEMU_BUILD_BUG_ON(ICH9_RST_CNT_IOPORT !=3D PIIX_RCR_IOPORT); =20 /* Fill in optional s3/s4 related properties */ o =3D object_property_get_qobject(obj, ACPI_PM_PROP_S3_DISABLED, NULL); diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index f3e21ea76d..86678e6829 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -166,7 +166,7 @@ static void piix4_realize(PCIDevice *dev, Error **errp) memory_region_init_io(&s->rcr_mem, OBJECT(dev), &piix4_rcr_ops, s, "reset-control", 1); memory_region_add_subregion_overlap(pci_address_space_io(dev), - RCR_IOPORT, &s->rcr_mem, 1); + PIIX_RCR_IOPORT, &s->rcr_mem, 1); =20 /* initialize i8259 pic */ i8259_out_irq =3D qemu_allocate_irqs(piix4_request_i8259_irq, s, 1); diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c index 3292703de7..6548d9a4b5 100644 --- a/hw/pci-host/piix.c +++ b/hw/pci-host/piix.c @@ -27,6 +27,7 @@ #include "hw/irq.h" #include "hw/pci/pci.h" #include "hw/pci/pci_host.h" +#include "hw/southbridge/piix.h" #include "hw/qdev-properties.h" #include "hw/isa/isa.h" #include "hw/sysbus.h" @@ -87,7 +88,7 @@ typedef struct PIIX3State { /* Reset Control Register contents */ uint8_t rcr; =20 - /* IO memory region for Reset Control Register (RCR_IOPORT) */ + /* IO memory region for Reset Control Register (PIIX_RCR_IOPORT) */ MemoryRegion rcr_mem; } PIIX3State; =20 @@ -695,8 +696,8 @@ static void piix3_realize(PCIDevice *dev, Error **errp) =20 memory_region_init_io(&d->rcr_mem, OBJECT(dev), &rcr_ops, d, "piix3-reset-control", 1); - memory_region_add_subregion_overlap(pci_address_space_io(dev), RCR_IOP= ORT, - &d->rcr_mem, 1); + memory_region_add_subregion_overlap(pci_address_space_io(dev), + PIIX_RCR_IOPORT, &d->rcr_mem, 1); =20 qemu_register_reset(piix3_reset, d); } diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 2fd40ceebe..d6ff95e047 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -240,12 +240,6 @@ typedef struct PCII440FXState PCII440FXState; =20 #define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX" =20 -/* - * Reset Control Register: PCI-accessible ISA-Compatible Register at addre= ss - * 0xcf9, provided by the PCI/ISA bridge (PIIX3 PCI function 0, 8086:7000). - */ -#define RCR_IOPORT 0xcf9 - PCIBus *i440fx_init(const char *host_type, const char *pci_type, PCII440FXState **pi440fx_state, int *piix_devfn, ISABus **isa_bus, qemu_irq *pic, diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index add352456b..e49d4a6bbe 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -18,6 +18,12 @@ I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t s= mb_io_base, qemu_irq sci_irq, qemu_irq smi_irq, int smm_enabled, DeviceState **piix4_pm); =20 +/* + * Reset Control Register: PCI-accessible ISA-Compatible Register at addre= ss + * 0xcf9, provided by the PCI/ISA bridge (PIIX3 PCI function 0, 8086:7000). + */ +#define PIIX_RCR_IOPORT 0xcf9 + extern PCIDevice *piix4_dev; =20 DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, --=20 2.21.0 From nobody Sat May 4 19:27:01 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572280659; cv=none; d=zoho.com; s=zohoarc; b=ZT1mAtAbxBBfSy1UONbyd0B0ajPqdupE81UjZoyKPE7pAIcS3V4jb9NDY4LsFhTqXcI6wVP673QnH74yqacxwOr4CrXTc2U08JqQPczhbg/YmjRUNocHJwXKw6c/96KSPmy1ihtywzqWVPBeN8ICWGFZBslMzVNk5m4hN1EDerk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572280659; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KT65D9bTB/rzblvXp75Wsb6EC+pwnl0M1j+HL0YTthA=; b=ZU158aEVBLrzR9hrA8VbnDKMwtdgjwA8F8ddsTbxBqlWG9bM8DHtrWf/N6MPwpm2GyQOpXUypsi3yC2uAfonLivCDy4aDDWMUzCgNKi6EfvoRFOeVrVheEDlO0j1lTbFq3SIhM59lAbUhYm3z6X/AWEZP3Qgwb918HNCTzK/3Ek= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1572280659603746.8612150166254; Mon, 28 Oct 2019 09:37:39 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iP80R-0007lN-CU; Mon, 28 Oct 2019 16:36:35 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iP80Q-0007lB-0M for xen-devel@lists.xenproject.org; Mon, 28 Oct 2019 16:36:34 +0000 Received: from us-smtp-1.mimecast.com (unknown [207.211.31.81]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 19d658e1-f9a1-11e9-94fb-12813bfff9fa; Mon, 28 Oct 2019 16:36:33 +0000 (UTC) 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-117-Y3ZaRss_Oh-N0mxozEsHug-1; Mon, 28 Oct 2019 12:36: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 E46C71800DCB; Mon, 28 Oct 2019 16:36:27 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-87.brq.redhat.com [10.40.204.87]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 012A81C941; Mon, 28 Oct 2019 16:36:20 +0000 (UTC) X-Inumbo-ID: 19d658e1-f9a1-11e9-94fb-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572280592; 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=8A0zZyI5mOTDSkC5unD31tlwYoyzVjIrE1Z1/ZiyoRc=; b=jSHq7wAnhEheKn+1+QVBijLxaXpEbwTwjRVVwexCATHsLdjKL8VO3Eix15jExPKwcRJwx1 hAMgnr9wI/bReW2gd96P+VIB0L9/iFZWYq54Lq71qo3bqKTzfgl+qNdydf5bipHNPZhsJ6 ojFHBowJaawaaGcRpe18q5iL/BKtxAs= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Mon, 28 Oct 2019 17:34:42 +0100 Message-Id: <20191028163447.18541-16-philmd@redhat.com> In-Reply-To: <20191028163447.18541-1-philmd@redhat.com> References: <20191028163447.18541-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: Y3ZaRss_Oh-N0mxozEsHug-1 X-Mimecast-Spam-Score: 0 Subject: [Xen-devel] [PULL 15/20] hw/pci-host/piix: Define and use the PIIX IRQ Route Control Registers X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Marcel Apfelbaum , Paul Durrant , "Michael S. Tsirkin" , Eduardo Habkost , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Markovic , "open list:X86 Xen CPUs" , Anthony Perard , Paolo Bonzini , Aleksandar Rikalo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aurelien Jarno , Richard Henderson Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The IRQ Route Control registers definitions belong to the PIIX chipset. We were only defining the 'A' register. Define the other B, C and D registers, and use them. Acked-by: Paul Durrant Reviewed-by: Aleksandar Markovic Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/xen/xen-hvm.c | 5 +++-- hw/mips/gt64xxx_pci.c | 4 ++-- hw/pci-host/piix.c | 9 ++++----- include/hw/southbridge/piix.h | 6 ++++++ 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index 95f23a263c..82ece6b9e7 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -14,6 +14,7 @@ #include "hw/pci/pci.h" #include "hw/pci/pci_host.h" #include "hw/i386/pc.h" +#include "hw/southbridge/piix.h" #include "hw/irq.h" #include "hw/hw.h" #include "hw/i386/apic-msidef.h" @@ -156,8 +157,8 @@ void xen_piix_pci_write_config_client(uint32_t address,= uint32_t val, int len) v =3D 0; } v &=3D 0xf; - if (((address + i) >=3D 0x60) && ((address + i) <=3D 0x63)) { - xen_set_pci_link_route(xen_domid, address + i - 0x60, v); + if (((address + i) >=3D PIIX_PIRQCA) && ((address + i) <=3D PIIX_P= IRQCD)) { + xen_set_pci_link_route(xen_domid, address + i - PIIX_PIRQCA, v= ); } } } diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c index c277398c0d..5cab9c1ee1 100644 --- a/hw/mips/gt64xxx_pci.c +++ b/hw/mips/gt64xxx_pci.c @@ -1013,12 +1013,12 @@ static void gt64120_pci_set_irq(void *opaque, int i= rq_num, int level) =20 /* now we change the pic irq level according to the piix irq mappings = */ /* XXX: optimize */ - pic_irq =3D piix4_dev->config[0x60 + irq_num]; + pic_irq =3D piix4_dev->config[PIIX_PIRQCA + irq_num]; if (pic_irq < 16) { /* The pic level is the logical OR of all the PCI irqs mapped to i= t. */ pic_level =3D 0; for (i =3D 0; i < 4; i++) { - if (pic_irq =3D=3D piix4_dev->config[0x60 + i]) { + if (pic_irq =3D=3D piix4_dev->config[PIIX_PIRQCA + i]) { pic_level |=3D pci_irq_levels[i]; } } diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c index 6548d9a4b5..390fb9ceba 100644 --- a/hw/pci-host/piix.c +++ b/hw/pci-host/piix.c @@ -61,7 +61,6 @@ typedef struct I440FXState { #define PIIX_NUM_PIC_IRQS 16 /* i8259 * 2 */ #define PIIX_NUM_PIRQS 4ULL /* PIRQ[A-D] */ #define XEN_PIIX_NUM_PIRQS 128ULL -#define PIIX_PIRQC 0x60 =20 typedef struct PIIX3State { PCIDevice dev; @@ -468,7 +467,7 @@ static void piix3_set_irq_level_internal(PIIX3State *pi= ix3, int pirq, int level) int pic_irq; uint64_t mask; =20 - pic_irq =3D piix3->dev.config[PIIX_PIRQC + pirq]; + pic_irq =3D piix3->dev.config[PIIX_PIRQCA + pirq]; if (pic_irq >=3D PIIX_NUM_PIC_IRQS) { return; } @@ -482,7 +481,7 @@ static void piix3_set_irq_level(PIIX3State *piix3, int = pirq, int level) { int pic_irq; =20 - pic_irq =3D piix3->dev.config[PIIX_PIRQC + pirq]; + pic_irq =3D piix3->dev.config[PIIX_PIRQCA + pirq]; if (pic_irq >=3D PIIX_NUM_PIC_IRQS) { return; } @@ -501,7 +500,7 @@ static void piix3_set_irq(void *opaque, int pirq, int l= evel) static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opaque, int pin) { PIIX3State *piix3 =3D opaque; - int irq =3D piix3->dev.config[PIIX_PIRQC + pin]; + int irq =3D piix3->dev.config[PIIX_PIRQCA + pin]; PCIINTxRoute route; =20 if (irq < PIIX_NUM_PIC_IRQS) { @@ -530,7 +529,7 @@ static void piix3_write_config(PCIDevice *dev, uint32_t address, uint32_t val, int len) { pci_default_write_config(dev, address, val, len); - if (ranges_overlap(address, len, PIIX_PIRQC, 4)) { + if (ranges_overlap(address, len, PIIX_PIRQCA, 4)) { PIIX3State *piix3 =3D PIIX3_PCI_DEVICE(dev); int pic_irq; =20 diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index e49d4a6bbe..094508b928 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -18,6 +18,12 @@ I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t s= mb_io_base, qemu_irq sci_irq, qemu_irq smi_irq, int smm_enabled, DeviceState **piix4_pm); =20 +/* PIRQRC[A:D]: PIRQx Route Control Registers */ +#define PIIX_PIRQCA 0x60 +#define PIIX_PIRQCB 0x61 +#define PIIX_PIRQCC 0x62 +#define PIIX_PIRQCD 0x63 + /* * Reset Control Register: PCI-accessible ISA-Compatible Register at addre= ss * 0xcf9, provided by the PCI/ISA bridge (PIIX3 PCI function 0, 8086:7000). --=20 2.21.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Sat May 4 19:27:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1572286455; cv=none; d=zoho.com; s=zohoarc; b=gfY6PDvgzvSdd7d6Svev4/ybZye05K35p8gEExUIv0H5FBAmzaH113HlV5/bW+T0wkyJEo/9UCsq9SYIMQe7AjNqk1pYQ9iBMl3kHwei3bF1qsZqUcaYOBrDYM2gcL+XgFXEsTXFpVYjPu75bNPX9uA0uADwsUnhG/M6ZM++t40= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572286455; 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=R2lfwmmQaDVAvDlyXppwXQpJKOOvmj7Yic9wf+wTvS4=; b=VexyqZQmnttNLt3wufC2Uq90F5UEh2qhc3XZirjs2QAVVTVjkTJEgxp6ybEmJSrWKcd/ig8YlVg4e4g15wjhGFiTjnk07uXQrtiYKLeXwfO7TLXZNBTGqisAIE+tn+GYI+6dYRKwjeAAmxVtlCkEE/kWP5603eEQ/NIydBB7dq8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.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 1572286455974659.9835210017103; Mon, 28 Oct 2019 11:14:15 -0700 (PDT) Received: from localhost ([::1]:40458 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP9Ww-0007eM-76 for importer@patchew.org; Mon, 28 Oct 2019 14:14:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41343) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP80W-0002ua-Mp for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP80T-00087V-QA for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:40 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:39203 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iP80T-00087B-JP for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:37 -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-124-Fh27MBZAP9aKt4APH8KuMw-1; Mon, 28 Oct 2019 12:36:33 -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 778A881A334; Mon, 28 Oct 2019 16:36:32 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-87.brq.redhat.com [10.40.204.87]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8EC04261B0; Mon, 28 Oct 2019 16:36:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572280597; 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=R2lfwmmQaDVAvDlyXppwXQpJKOOvmj7Yic9wf+wTvS4=; b=fntTbWrD9ygtmAnv1sX3KtFpS0w3OAFTLm2FYGmEj0en3NRsCV7MhZw3NAWAgxIMGmMs3z w5cQ+IvggWKnUobCWORvIK/oqDslbDvsvOYfwYdBA7McTwZyJAugDSqARsjG//RqpbLFQb Cj1kcyFwIEKsrBASKza0aZwZZs/Ergo= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 16/20] hw/pci-host/piix: Move i440FX declarations to hw/pci-host/i440fx.h Date: Mon, 28 Oct 2019 17:34:43 +0100 Message-Id: <20191028163447.18541-17-philmd@redhat.com> In-Reply-To: <20191028163447.18541-1-philmd@redhat.com> References: <20191028163447.18541-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: Fh27MBZAP9aKt4APH8KuMw-1 X-Mimecast-Spam-Score: 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: 205.139.110.61 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" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eduardo Habkost , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Markovic , Igor Mammedov , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aurelien Jarno , Richard Henderson 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: Philippe Mathieu-Daud=C3=A9 The hw/pci-host/piix.c contains a mix of PIIX3 and i440FX chipsets functions. To be able to split it, we need to export some declarations first. Reviewed-by: Aleksandar Markovic Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 1 + hw/acpi/pcihp.c | 2 +- hw/i386/pc_piix.c | 1 + hw/pci-host/piix.c | 1 + include/hw/i386/pc.h | 22 --------------------- include/hw/pci-host/i440fx.h | 37 ++++++++++++++++++++++++++++++++++++ stubs/pci-host-piix.c | 3 ++- 7 files changed, 43 insertions(+), 24 deletions(-) create mode 100644 include/hw/pci-host/i440fx.h diff --git a/MAINTAINERS b/MAINTAINERS index 90c5ece04b..a48daf0615 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1228,6 +1228,7 @@ F: hw/i386/ F: hw/pci-host/piix.c F: hw/pci-host/q35.c F: hw/pci-host/pam.c +F: include/hw/pci-host/i440fx.h F: include/hw/pci-host/q35.h F: include/hw/pci-host/pam.h F: hw/isa/lpc_ich9.c diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index 82d295b6e8..8413348a33 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -27,7 +27,7 @@ #include "qemu/osdep.h" #include "hw/acpi/pcihp.h" =20 -#include "hw/i386/pc.h" +#include "hw/pci-host/i440fx.h" #include "hw/pci/pci.h" #include "hw/pci/pci_bridge.h" #include "hw/acpi/acpi.h" diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index a96ede19b2..ba35d5685e 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -30,6 +30,7 @@ #include "hw/i386/x86.h" #include "hw/i386/pc.h" #include "hw/i386/apic.h" +#include "hw/pci-host/i440fx.h" #include "hw/southbridge/piix.h" #include "hw/display/ramfb.h" #include "hw/firmware/smbios.h" diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c index 390fb9ceba..95b04122fa 100644 --- a/hw/pci-host/piix.c +++ b/hw/pci-host/piix.c @@ -27,6 +27,7 @@ #include "hw/irq.h" #include "hw/pci/pci.h" #include "hw/pci/pci_host.h" +#include "hw/pci-host/i440fx.h" #include "hw/southbridge/piix.h" #include "hw/qdev-properties.h" #include "hw/isa/isa.h" diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index d6ff95e047..e6fa8418ca 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -231,28 +231,6 @@ int cmos_get_fd_drive_type(FloppyDriveType fd0); /* hpet.c */ extern int no_hpet; =20 -/* piix_pci.c */ -struct PCII440FXState; -typedef struct PCII440FXState PCII440FXState; - -#define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost" -#define TYPE_I440FX_PCI_DEVICE "i440FX" - -#define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX" - -PCIBus *i440fx_init(const char *host_type, const char *pci_type, - PCII440FXState **pi440fx_state, int *piix_devfn, - ISABus **isa_bus, qemu_irq *pic, - MemoryRegion *address_space_mem, - MemoryRegion *address_space_io, - ram_addr_t ram_size, - ram_addr_t below_4g_mem_size, - ram_addr_t above_4g_mem_size, - MemoryRegion *pci_memory, - MemoryRegion *ram_memory); - -PCIBus *find_i440fx(void); - /* pc_sysfw.c */ void pc_system_flash_create(PCMachineState *pcms); void pc_system_firmware_init(PCMachineState *pcms, MemoryRegion *rom_memor= y); diff --git a/include/hw/pci-host/i440fx.h b/include/hw/pci-host/i440fx.h new file mode 100644 index 0000000000..e327f9bf87 --- /dev/null +++ b/include/hw/pci-host/i440fx.h @@ -0,0 +1,37 @@ +/* + * QEMU i440FX North Bridge Emulation + * + * Copyright (c) 2006 Fabrice Bellard + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + * + */ + +#ifndef HW_PCI_I440FX_H +#define HW_PCI_I440FX_H + +#include "hw/hw.h" +#include "hw/pci/pci_bus.h" + +typedef struct PCII440FXState PCII440FXState; + +#define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost" +#define TYPE_I440FX_PCI_DEVICE "i440FX" + +#define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX" + +PCIBus *i440fx_init(const char *host_type, const char *pci_type, + PCII440FXState **pi440fx_state, int *piix_devfn, + ISABus **isa_bus, qemu_irq *pic, + MemoryRegion *address_space_mem, + MemoryRegion *address_space_io, + ram_addr_t ram_size, + ram_addr_t below_4g_mem_size, + ram_addr_t above_4g_mem_size, + MemoryRegion *pci_memory, + MemoryRegion *ram_memory); + +PCIBus *find_i440fx(void); + +#endif diff --git a/stubs/pci-host-piix.c b/stubs/pci-host-piix.c index 6ed81b1f21..93975adbfe 100644 --- a/stubs/pci-host-piix.c +++ b/stubs/pci-host-piix.c @@ -1,5 +1,6 @@ #include "qemu/osdep.h" -#include "hw/i386/pc.h" +#include "hw/pci-host/i440fx.h" + PCIBus *find_i440fx(void) { return NULL; --=20 2.21.0 From nobody Sat May 4 19:27:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1572286538; cv=none; d=zoho.com; s=zohoarc; b=EPPxYFOpWAgNE0GqYszCFzH3AgFsLkNj2LvZDV3gmdbCIpGktFN2dcyIxR1LQOsP7MFHohdP4+YwRig0rw4/aZMrDFCIPCBRO3RaFlqXVUxZd1YKJ6LVo0PHLt6ZzWfvgXXWbKNQF4r6zd21u8QsvpuhDhTFwRKanSV8RlEfgT4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572286538; 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=aCTIRdFiH4uf08N1aCQiObLT3mS4637DLQTQTbUuYyw=; b=c3gbHMxquNm8ganNR64IbwiAHzNSn0ilW+pfwUsqqdb4ss9yDW9jfqES6uQ8LxJVAw911ZziRGS7vK4Pq2v/DJUro5WvDIJ4K6MsAeJPiUlC/AHvJP6ZenalIEhARtHvOEtDqOFzHic549u2pG9vhfIx5+ziJFqq0iYK3daGG48= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.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 1572286538199907.9126072540497; Mon, 28 Oct 2019 11:15:38 -0700 (PDT) Received: from localhost ([::1]:40638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP9YD-0000Ki-BQ for importer@patchew.org; Mon, 28 Oct 2019 14:15:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41358) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP80Y-0002us-PN for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP80W-0008B7-Q2 for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:42 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:53846 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iP80W-00089i-Mb for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:40 -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-56-FAAXsg9ZNyyv2vgESG3QJA-1; Mon, 28 Oct 2019 12:36:37 -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 AEBAC8017CC; Mon, 28 Oct 2019 16:36:35 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-87.brq.redhat.com [10.40.204.87]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 12DAA1C941; Mon, 28 Oct 2019 16:36:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572280600; 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=aCTIRdFiH4uf08N1aCQiObLT3mS4637DLQTQTbUuYyw=; b=Ee3krbCvIMIV5/upjZDdx1YeQ4+1SzD+PKUMe0OGFS8UCNOnYblJl+7paaftxEdB2Edhp/ 97sJ9aj1FGUST7GsVhdTrGXMyAhYx/455gvM5YCfOx0p+zLHN0K9jX6UCSzbineczHDgXv JabiOukejJhjfl5iUzOsuETYgapkkzg= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 17/20] hw/pci-host/piix: Fix code style issues Date: Mon, 28 Oct 2019 17:34:44 +0100 Message-Id: <20191028163447.18541-18-philmd@redhat.com> In-Reply-To: <20191028163447.18541-1-philmd@redhat.com> References: <20191028163447.18541-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: FAAXsg9ZNyyv2vgESG3QJA-1 X-Mimecast-Spam-Score: 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: 205.139.110.120 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: Esteban Bosse , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Markovic , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , 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" We will move this code, fix its style first. Reviewed-by: Aleksandar Markovic Reviewed-by: Esteban Bosse Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/piix.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c index 95b04122fa..1544c4726b 100644 --- a/hw/pci-host/piix.c +++ b/hw/pci-host/piix.c @@ -133,9 +133,10 @@ static PCIINTxRoute piix3_route_intx_pin_to_irq(void *= opaque, int pci_intx); static void piix3_write_config_xen(PCIDevice *dev, uint32_t address, uint32_t val, int len); =20 -/* return the global irq number corresponding to a given device irq - pin. We could also use the bus number to have a more precise - mapping. */ +/* + * Return the global irq number corresponding to a given device irq + * pin. We could also use the bus number to have a more precise mapping. + */ static int pci_slot_get_pirq(PCIDevice *pci_dev, int pci_intx) { int slot_addend; --=20 2.21.0 From nobody Sat May 4 19:27:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1572286317; cv=none; d=zoho.com; s=zohoarc; b=ihwWeYsdIOWiPgCaljuCcM/VymGPQ8qEYA/ymGOT95kFA488HCn1WUBDd/1Z4LntSavfzZHgS+QzrtsHVyEFJrTh2512DE1I628xY1OS9/xp7/pMsKKzoWLJTi/SoA7v3PfgVDC8A/dyAic/3YlKNtwaNDxxF2U/dZ3hfsV+WXk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572286317; 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=DVsC2yLrT6MRwFA5ej58/UHt9DqjgWkX0qm9Kvb5ZzQ=; b=DwW5wi+VFm8NuwLk7mY2YT3+ulT/9EoUedsD/0pbrzJYa8Lu/2cOr3gbW8YV5E02C3+eeMWqHJXNkTm9tjSBZZG213OBP6y94G5X5d8byQjB7Ojefegf6OA9i/PHcSJGrqx5KpUb8vg0xbncaiCtXNRN878AL4kfeFcaMBLFyOc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.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 1572286317966518.1394796035721; Mon, 28 Oct 2019 11:11:57 -0700 (PDT) Received: from localhost ([::1]:40164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP9Ui-0004uJ-Cg for importer@patchew.org; Mon, 28 Oct 2019 14:11:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41409) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP80o-00031i-DL for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:37:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP80j-0008MU-IP for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:56 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:46119 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iP80g-0008J9-CX for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:52 -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-145-RlmiJR0YO7SdcLxfr3-ldQ-1; Mon, 28 Oct 2019 12:36:44 -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 0E02F476; Mon, 28 Oct 2019 16:36:43 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-87.brq.redhat.com [10.40.204.87]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5B3B81C941; Mon, 28 Oct 2019 16:36:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572280609; 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=DVsC2yLrT6MRwFA5ej58/UHt9DqjgWkX0qm9Kvb5ZzQ=; b=gqEq9BEcUv8sB9OcZcklv78hfbmnsLS5Ul1XxKWoGod4CfXHAOglBcYzpXcPy/OpaxSUnG QZum//RY6GnBuviuGXHfqZT7mG8QkDEuH6JC8eY9IeKm2xH4rIEVcSdirNZTKT5UduGmy2 uUfjza2VmFYFf6V9pgAEYbf8TUhtqMQ= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 18/20] hw/pci-host/piix: Extract PIIX3 functions to hw/isa/piix3.c Date: Mon, 28 Oct 2019 17:34:45 +0100 Message-Id: <20191028163447.18541-19-philmd@redhat.com> In-Reply-To: <20191028163447.18541-1-philmd@redhat.com> References: <20191028163447.18541-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: RlmiJR0YO7SdcLxfr3-ldQ-1 X-Mimecast-Spam-Score: 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: 207.211.31.81 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: Eduardo Habkost , "Michael S. Tsirkin" , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Markovic , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aurelien Jarno , Richard Henderson 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" Move all the PIIX3 functions to a new file: hw/isa/piix3.c. Reviewed-by: Aleksandar Markovic Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 1 + hw/i386/Kconfig | 1 + hw/isa/Kconfig | 4 + hw/isa/Makefile.objs | 1 + hw/isa/piix3.c | 399 +++++++++++++++++++++++++++++++++ hw/pci-host/Kconfig | 1 - hw/pci-host/piix.c | 402 ---------------------------------- include/hw/southbridge/piix.h | 36 +++ 8 files changed, 442 insertions(+), 403 deletions(-) create mode 100644 hw/isa/piix3.c diff --git a/MAINTAINERS b/MAINTAINERS index a48daf0615..e7e7bfc890 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1231,6 +1231,7 @@ F: hw/pci-host/pam.c F: include/hw/pci-host/i440fx.h F: include/hw/pci-host/q35.h F: include/hw/pci-host/pam.h +F: hw/isa/piix3.c F: hw/isa/lpc_ich9.c F: hw/i2c/smbus_ich9.c F: hw/acpi/piix4.c diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig index b25bb6d78a..d420b35548 100644 --- a/hw/i386/Kconfig +++ b/hw/i386/Kconfig @@ -61,6 +61,7 @@ config I440FX select PC_ACPI select ACPI_SMBUS select PCI_PIIX + select PIIX3 select IDE_PIIX select DIMM select SMBIOS diff --git a/hw/isa/Kconfig b/hw/isa/Kconfig index 98a289957e..8a38813cc1 100644 --- a/hw/isa/Kconfig +++ b/hw/isa/Kconfig @@ -29,6 +29,10 @@ config PC87312 select FDC select IDE_ISA =20 +config PIIX3 + bool + select ISA_BUS + config PIIX4 bool # For historical reasons, SuperIO devices are created in the board diff --git a/hw/isa/Makefile.objs b/hw/isa/Makefile.objs index ff97485504..8e73960a75 100644 --- a/hw/isa/Makefile.objs +++ b/hw/isa/Makefile.objs @@ -3,6 +3,7 @@ common-obj-$(CONFIG_ISA_SUPERIO) +=3D isa-superio.o common-obj-$(CONFIG_APM) +=3D apm.o common-obj-$(CONFIG_I82378) +=3D i82378.o common-obj-$(CONFIG_PC87312) +=3D pc87312.o +common-obj-$(CONFIG_PIIX3) +=3D piix3.o common-obj-$(CONFIG_PIIX4) +=3D piix4.o common-obj-$(CONFIG_VT82C686) +=3D vt82c686.o common-obj-$(CONFIG_SMC37C669) +=3D smc37c669-superio.o diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c new file mode 100644 index 0000000000..fd1c78879f --- /dev/null +++ b/hw/isa/piix3.c @@ -0,0 +1,399 @@ +/* + * QEMU PIIX PCI ISA Bridge Emulation + * + * Copyright (c) 2006 Fabrice Bellard + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ + +#include "qemu/osdep.h" +#include "qemu/range.h" +#include "hw/southbridge/piix.h" +#include "hw/irq.h" +#include "hw/isa/isa.h" +#include "hw/xen/xen.h" +#include "sysemu/sysemu.h" +#include "sysemu/reset.h" +#include "sysemu/runstate.h" +#include "migration/vmstate.h" + +#define XEN_PIIX_NUM_PIRQS 128ULL + +#define TYPE_PIIX3_PCI_DEVICE "pci-piix3" +#define PIIX3_PCI_DEVICE(obj) \ + OBJECT_CHECK(PIIX3State, (obj), TYPE_PIIX3_PCI_DEVICE) + +#define TYPE_PIIX3_DEVICE "PIIX3" +#define TYPE_PIIX3_XEN_DEVICE "PIIX3-xen" + +static void piix3_set_irq_pic(PIIX3State *piix3, int pic_irq) +{ + qemu_set_irq(piix3->pic[pic_irq], + !!(piix3->pic_levels & + (((1ULL << PIIX_NUM_PIRQS) - 1) << + (pic_irq * PIIX_NUM_PIRQS)))); +} + +static void piix3_set_irq_level_internal(PIIX3State *piix3, int pirq, int = level) +{ + int pic_irq; + uint64_t mask; + + pic_irq =3D piix3->dev.config[PIIX_PIRQCA + pirq]; + if (pic_irq >=3D PIIX_NUM_PIC_IRQS) { + return; + } + + mask =3D 1ULL << ((pic_irq * PIIX_NUM_PIRQS) + pirq); + piix3->pic_levels &=3D ~mask; + piix3->pic_levels |=3D mask * !!level; +} + +static void piix3_set_irq_level(PIIX3State *piix3, int pirq, int level) +{ + int pic_irq; + + pic_irq =3D piix3->dev.config[PIIX_PIRQCA + pirq]; + if (pic_irq >=3D PIIX_NUM_PIC_IRQS) { + return; + } + + piix3_set_irq_level_internal(piix3, pirq, level); + + piix3_set_irq_pic(piix3, pic_irq); +} + +static void piix3_set_irq(void *opaque, int pirq, int level) +{ + PIIX3State *piix3 =3D opaque; + piix3_set_irq_level(piix3, pirq, level); +} + +static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opaque, int pin) +{ + PIIX3State *piix3 =3D opaque; + int irq =3D piix3->dev.config[PIIX_PIRQCA + pin]; + PCIINTxRoute route; + + if (irq < PIIX_NUM_PIC_IRQS) { + route.mode =3D PCI_INTX_ENABLED; + route.irq =3D irq; + } else { + route.mode =3D PCI_INTX_DISABLED; + route.irq =3D -1; + } + return route; +} + +/* irq routing is changed. so rebuild bitmap */ +static void piix3_update_irq_levels(PIIX3State *piix3) +{ + PCIBus *bus =3D pci_get_bus(&piix3->dev); + int pirq; + + piix3->pic_levels =3D 0; + for (pirq =3D 0; pirq < PIIX_NUM_PIRQS; pirq++) { + piix3_set_irq_level(piix3, pirq, pci_bus_get_irq_level(bus, pirq)); + } +} + +static void piix3_write_config(PCIDevice *dev, + uint32_t address, uint32_t val, int len) +{ + pci_default_write_config(dev, address, val, len); + if (ranges_overlap(address, len, PIIX_PIRQCA, 4)) { + PIIX3State *piix3 =3D PIIX3_PCI_DEVICE(dev); + int pic_irq; + + pci_bus_fire_intx_routing_notifier(pci_get_bus(&piix3->dev)); + piix3_update_irq_levels(piix3); + for (pic_irq =3D 0; pic_irq < PIIX_NUM_PIC_IRQS; pic_irq++) { + piix3_set_irq_pic(piix3, pic_irq); + } + } +} + +static void piix3_write_config_xen(PCIDevice *dev, + uint32_t address, uint32_t val, int len) +{ + xen_piix_pci_write_config_client(address, val, len); + piix3_write_config(dev, address, val, len); +} + +static void piix3_reset(void *opaque) +{ + PIIX3State *d =3D opaque; + uint8_t *pci_conf =3D d->dev.config; + + pci_conf[0x04] =3D 0x07; /* master, memory and I/O */ + pci_conf[0x05] =3D 0x00; + pci_conf[0x06] =3D 0x00; + pci_conf[0x07] =3D 0x02; /* PCI_status_devsel_medium */ + pci_conf[0x4c] =3D 0x4d; + pci_conf[0x4e] =3D 0x03; + pci_conf[0x4f] =3D 0x00; + pci_conf[0x60] =3D 0x80; + pci_conf[0x61] =3D 0x80; + pci_conf[0x62] =3D 0x80; + pci_conf[0x63] =3D 0x80; + pci_conf[0x69] =3D 0x02; + pci_conf[0x70] =3D 0x80; + pci_conf[0x76] =3D 0x0c; + pci_conf[0x77] =3D 0x0c; + pci_conf[0x78] =3D 0x02; + pci_conf[0x79] =3D 0x00; + pci_conf[0x80] =3D 0x00; + pci_conf[0x82] =3D 0x00; + pci_conf[0xa0] =3D 0x08; + pci_conf[0xa2] =3D 0x00; + pci_conf[0xa3] =3D 0x00; + pci_conf[0xa4] =3D 0x00; + pci_conf[0xa5] =3D 0x00; + pci_conf[0xa6] =3D 0x00; + pci_conf[0xa7] =3D 0x00; + pci_conf[0xa8] =3D 0x0f; + pci_conf[0xaa] =3D 0x00; + pci_conf[0xab] =3D 0x00; + pci_conf[0xac] =3D 0x00; + pci_conf[0xae] =3D 0x00; + + d->pic_levels =3D 0; + d->rcr =3D 0; +} + +static int piix3_post_load(void *opaque, int version_id) +{ + PIIX3State *piix3 =3D opaque; + int pirq; + + /* + * Because the i8259 has not been deserialized yet, qemu_irq_raise + * might bring the system to a different state than the saved one; + * for example, the interrupt could be masked but the i8259 would + * not know that yet and would trigger an interrupt in the CPU. + * + * Here, we update irq levels without raising the interrupt. + * Interrupt state will be deserialized separately through the i8259. + */ + piix3->pic_levels =3D 0; + for (pirq =3D 0; pirq < PIIX_NUM_PIRQS; pirq++) { + piix3_set_irq_level_internal(piix3, pirq, + pci_bus_get_irq_level(pci_get_bus(&piix3->dev), pirq)); + } + return 0; +} + +static int piix3_pre_save(void *opaque) +{ + int i; + PIIX3State *piix3 =3D opaque; + + for (i =3D 0; i < ARRAY_SIZE(piix3->pci_irq_levels_vmstate); i++) { + piix3->pci_irq_levels_vmstate[i] =3D + pci_bus_get_irq_level(pci_get_bus(&piix3->dev), i); + } + + return 0; +} + +static bool piix3_rcr_needed(void *opaque) +{ + PIIX3State *piix3 =3D opaque; + + return (piix3->rcr !=3D 0); +} + +static const VMStateDescription vmstate_piix3_rcr =3D { + .name =3D "PIIX3/rcr", + .version_id =3D 1, + .minimum_version_id =3D 1, + .needed =3D piix3_rcr_needed, + .fields =3D (VMStateField[]) { + VMSTATE_UINT8(rcr, PIIX3State), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_piix3 =3D { + .name =3D "PIIX3", + .version_id =3D 3, + .minimum_version_id =3D 2, + .post_load =3D piix3_post_load, + .pre_save =3D piix3_pre_save, + .fields =3D (VMStateField[]) { + VMSTATE_PCI_DEVICE(dev, PIIX3State), + VMSTATE_INT32_ARRAY_V(pci_irq_levels_vmstate, PIIX3State, + PIIX_NUM_PIRQS, 3), + VMSTATE_END_OF_LIST() + }, + .subsections =3D (const VMStateDescription*[]) { + &vmstate_piix3_rcr, + NULL + } +}; + + +static void rcr_write(void *opaque, hwaddr addr, uint64_t val, unsigned le= n) +{ + PIIX3State *d =3D opaque; + + if (val & 4) { + qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); + return; + } + d->rcr =3D val & 2; /* keep System Reset type only */ +} + +static uint64_t rcr_read(void *opaque, hwaddr addr, unsigned len) +{ + PIIX3State *d =3D opaque; + + return d->rcr; +} + +static const MemoryRegionOps rcr_ops =3D { + .read =3D rcr_read, + .write =3D rcr_write, + .endianness =3D DEVICE_LITTLE_ENDIAN +}; + +static void piix3_realize(PCIDevice *dev, Error **errp) +{ + PIIX3State *d =3D PIIX3_PCI_DEVICE(dev); + + if (!isa_bus_new(DEVICE(d), get_system_memory(), + pci_address_space_io(dev), errp)) { + return; + } + + memory_region_init_io(&d->rcr_mem, OBJECT(dev), &rcr_ops, d, + "piix3-reset-control", 1); + memory_region_add_subregion_overlap(pci_address_space_io(dev), + PIIX_RCR_IOPORT, &d->rcr_mem, 1); + + qemu_register_reset(piix3_reset, d); +} + +static void pci_piix3_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); + + dc->desc =3D "ISA bridge"; + dc->vmsd =3D &vmstate_piix3; + dc->hotpluggable =3D false; + k->realize =3D piix3_realize; + k->vendor_id =3D PCI_VENDOR_ID_INTEL; + /* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */ + k->device_id =3D PCI_DEVICE_ID_INTEL_82371SB_0; + k->class_id =3D PCI_CLASS_BRIDGE_ISA; + /* + * Reason: part of PIIX3 southbridge, needs to be wired up by + * pc_piix.c's pc_init1() + */ + dc->user_creatable =3D false; +} + +static const TypeInfo piix3_pci_type_info =3D { + .name =3D TYPE_PIIX3_PCI_DEVICE, + .parent =3D TYPE_PCI_DEVICE, + .instance_size =3D sizeof(PIIX3State), + .abstract =3D true, + .class_init =3D pci_piix3_class_init, + .interfaces =3D (InterfaceInfo[]) { + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { }, + }, +}; + +static void piix3_class_init(ObjectClass *klass, void *data) +{ + PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); + + k->config_write =3D piix3_write_config; +} + +static const TypeInfo piix3_info =3D { + .name =3D TYPE_PIIX3_DEVICE, + .parent =3D TYPE_PIIX3_PCI_DEVICE, + .class_init =3D piix3_class_init, +}; + +static void piix3_xen_class_init(ObjectClass *klass, void *data) +{ + PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); + + k->config_write =3D piix3_write_config_xen; +}; + +static const TypeInfo piix3_xen_info =3D { + .name =3D TYPE_PIIX3_XEN_DEVICE, + .parent =3D TYPE_PIIX3_PCI_DEVICE, + .class_init =3D piix3_xen_class_init, +}; + +static void piix3_register_types(void) +{ + type_register_static(&piix3_pci_type_info); + type_register_static(&piix3_info); + type_register_static(&piix3_xen_info); +} + +type_init(piix3_register_types) + +/* + * Return the global irq number corresponding to a given device irq + * pin. We could also use the bus number to have a more precise mapping. + */ +static int pci_slot_get_pirq(PCIDevice *pci_dev, int pci_intx) +{ + int slot_addend; + slot_addend =3D (pci_dev->devfn >> 3) - 1; + return (pci_intx + slot_addend) & 3; +} + +PIIX3State *piix3_create(PCIBus *pci_bus, ISABus **isa_bus) +{ + PIIX3State *piix3; + PCIDevice *pci_dev; + + /* + * Xen supports additional interrupt routes from the PCI devices to + * the IOAPIC: the four pins of each PCI device on the bus are also + * connected to the IOAPIC directly. + * These additional routes can be discovered through ACPI. + */ + if (xen_enabled()) { + pci_dev =3D pci_create_simple_multifunction(pci_bus, -1, true, + TYPE_PIIX3_XEN_DEVICE); + piix3 =3D PIIX3_PCI_DEVICE(pci_dev); + pci_bus_irqs(pci_bus, xen_piix3_set_irq, xen_pci_slot_get_pirq, + piix3, XEN_PIIX_NUM_PIRQS); + } else { + pci_dev =3D pci_create_simple_multifunction(pci_bus, -1, true, + TYPE_PIIX3_DEVICE); + piix3 =3D PIIX3_PCI_DEVICE(pci_dev); + pci_bus_irqs(pci_bus, piix3_set_irq, pci_slot_get_pirq, + piix3, PIIX_NUM_PIRQS); + pci_bus_set_route_irq_fn(pci_bus, piix3_route_intx_pin_to_irq); + } + *isa_bus =3D ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0")); + + return piix3; +} diff --git a/hw/pci-host/Kconfig b/hw/pci-host/Kconfig index 1edc1a31d4..397043b289 100644 --- a/hw/pci-host/Kconfig +++ b/hw/pci-host/Kconfig @@ -32,7 +32,6 @@ config PCI_PIIX bool select PCI select PAM - select ISA_BUS =20 config PCI_EXPRESS_Q35 bool diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c index 1544c4726b..79ecd58a2b 100644 --- a/hw/pci-host/piix.c +++ b/hw/pci-host/piix.c @@ -24,22 +24,15 @@ =20 #include "qemu/osdep.h" #include "hw/i386/pc.h" -#include "hw/irq.h" #include "hw/pci/pci.h" #include "hw/pci/pci_host.h" #include "hw/pci-host/i440fx.h" #include "hw/southbridge/piix.h" #include "hw/qdev-properties.h" -#include "hw/isa/isa.h" #include "hw/sysbus.h" #include "qapi/error.h" -#include "qemu/range.h" -#include "hw/xen/xen.h" #include "migration/vmstate.h" #include "hw/pci-host/pam.h" -#include "sysemu/reset.h" -#include "sysemu/runstate.h" -#include "hw/i386/ioapic.h" #include "qapi/visitor.h" #include "qemu/error-report.h" =20 @@ -59,49 +52,9 @@ typedef struct I440FXState { uint32_t short_root_bus; } I440FXState; =20 -#define PIIX_NUM_PIC_IRQS 16 /* i8259 * 2 */ -#define PIIX_NUM_PIRQS 4ULL /* PIRQ[A-D] */ -#define XEN_PIIX_NUM_PIRQS 128ULL - -typedef struct PIIX3State { - PCIDevice dev; - - /* - * bitmap to track pic levels. - * The pic level is the logical OR of all the PCI irqs mapped to it - * So one PIC level is tracked by PIIX_NUM_PIRQS bits. - * - * PIRQ is mapped to PIC pins, we track it by - * PIIX_NUM_PIRQS * PIIX_NUM_PIC_IRQS =3D 64 bits with - * pic_irq * PIIX_NUM_PIRQS + pirq - */ -#if PIIX_NUM_PIC_IRQS * PIIX_NUM_PIRQS > 64 -#error "unable to encode pic state in 64bit in pic_levels." -#endif - uint64_t pic_levels; - - qemu_irq *pic; - - /* This member isn't used. Just for save/load compatibility */ - int32_t pci_irq_levels_vmstate[PIIX_NUM_PIRQS]; - - /* Reset Control Register contents */ - uint8_t rcr; - - /* IO memory region for Reset Control Register (PIIX_RCR_IOPORT) */ - MemoryRegion rcr_mem; -} PIIX3State; - -#define TYPE_PIIX3_PCI_DEVICE "pci-piix3" -#define PIIX3_PCI_DEVICE(obj) \ - OBJECT_CHECK(PIIX3State, (obj), TYPE_PIIX3_PCI_DEVICE) - #define I440FX_PCI_DEVICE(obj) \ OBJECT_CHECK(PCII440FXState, (obj), TYPE_I440FX_PCI_DEVICE) =20 -#define TYPE_PIIX3_DEVICE "PIIX3" -#define TYPE_PIIX3_XEN_DEVICE "PIIX3-xen" - struct PCII440FXState { /*< private >*/ PCIDevice parent_obj; @@ -128,22 +81,6 @@ struct PCII440FXState { */ #define I440FX_COREBOOT_RAM_SIZE 0x57 =20 -static void piix3_set_irq(void *opaque, int pirq, int level); -static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opaque, int pci_intx= ); -static void piix3_write_config_xen(PCIDevice *dev, - uint32_t address, uint32_t val, int len); - -/* - * Return the global irq number corresponding to a given device irq - * pin. We could also use the bus number to have a more precise mapping. - */ -static int pci_slot_get_pirq(PCIDevice *pci_dev, int pci_intx) -{ - int slot_addend; - slot_addend =3D (pci_dev->devfn >> 3) - 1; - return (pci_intx + slot_addend) & 3; -} - static void i440fx_update_memory_mappings(PCII440FXState *d) { int i; @@ -333,36 +270,6 @@ static void i440fx_realize(PCIDevice *dev, Error **err= p) } } =20 -static PIIX3State *piix3_create(PCIBus *pci_bus, ISABus **isa_bus) -{ - PIIX3State *piix3; - PCIDevice *pci_dev; - - /* - * Xen supports additional interrupt routes from the PCI devices to - * the IOAPIC: the four pins of each PCI device on the bus are also - * connected to the IOAPIC directly. - * These additional routes can be discovered through ACPI. - */ - if (xen_enabled()) { - pci_dev =3D pci_create_simple_multifunction(pci_bus, -1, true, - TYPE_PIIX3_XEN_DEVICE); - piix3 =3D PIIX3_PCI_DEVICE(pci_dev); - pci_bus_irqs(pci_bus, xen_piix3_set_irq, xen_pci_slot_get_pirq, - piix3, XEN_PIIX_NUM_PIRQS); - } else { - pci_dev =3D pci_create_simple_multifunction(pci_bus, -1, true, - TYPE_PIIX3_DEVICE); - piix3 =3D PIIX3_PCI_DEVICE(pci_dev); - pci_bus_irqs(pci_bus, piix3_set_irq, pci_slot_get_pirq, - piix3, PIIX_NUM_PIRQS); - pci_bus_set_route_irq_fn(pci_bus, piix3_route_intx_pin_to_irq); - } - *isa_bus =3D ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0")); - - return piix3; -} - PCIBus *i440fx_init(const char *host_type, const char *pci_type, PCII440FXState **pi440fx_state, int *piix3_devfn, @@ -455,312 +362,6 @@ PCIBus *find_i440fx(void) return s ? s->bus : NULL; } =20 -/* PIIX3 PCI to ISA bridge */ -static void piix3_set_irq_pic(PIIX3State *piix3, int pic_irq) -{ - qemu_set_irq(piix3->pic[pic_irq], - !!(piix3->pic_levels & - (((1ULL << PIIX_NUM_PIRQS) - 1) << - (pic_irq * PIIX_NUM_PIRQS)))); -} - -static void piix3_set_irq_level_internal(PIIX3State *piix3, int pirq, int = level) -{ - int pic_irq; - uint64_t mask; - - pic_irq =3D piix3->dev.config[PIIX_PIRQCA + pirq]; - if (pic_irq >=3D PIIX_NUM_PIC_IRQS) { - return; - } - - mask =3D 1ULL << ((pic_irq * PIIX_NUM_PIRQS) + pirq); - piix3->pic_levels &=3D ~mask; - piix3->pic_levels |=3D mask * !!level; -} - -static void piix3_set_irq_level(PIIX3State *piix3, int pirq, int level) -{ - int pic_irq; - - pic_irq =3D piix3->dev.config[PIIX_PIRQCA + pirq]; - if (pic_irq >=3D PIIX_NUM_PIC_IRQS) { - return; - } - - piix3_set_irq_level_internal(piix3, pirq, level); - - piix3_set_irq_pic(piix3, pic_irq); -} - -static void piix3_set_irq(void *opaque, int pirq, int level) -{ - PIIX3State *piix3 =3D opaque; - piix3_set_irq_level(piix3, pirq, level); -} - -static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opaque, int pin) -{ - PIIX3State *piix3 =3D opaque; - int irq =3D piix3->dev.config[PIIX_PIRQCA + pin]; - PCIINTxRoute route; - - if (irq < PIIX_NUM_PIC_IRQS) { - route.mode =3D PCI_INTX_ENABLED; - route.irq =3D irq; - } else { - route.mode =3D PCI_INTX_DISABLED; - route.irq =3D -1; - } - return route; -} - -/* irq routing is changed. so rebuild bitmap */ -static void piix3_update_irq_levels(PIIX3State *piix3) -{ - PCIBus *bus =3D pci_get_bus(&piix3->dev); - int pirq; - - piix3->pic_levels =3D 0; - for (pirq =3D 0; pirq < PIIX_NUM_PIRQS; pirq++) { - piix3_set_irq_level(piix3, pirq, pci_bus_get_irq_level(bus, pirq)); - } -} - -static void piix3_write_config(PCIDevice *dev, - uint32_t address, uint32_t val, int len) -{ - pci_default_write_config(dev, address, val, len); - if (ranges_overlap(address, len, PIIX_PIRQCA, 4)) { - PIIX3State *piix3 =3D PIIX3_PCI_DEVICE(dev); - int pic_irq; - - pci_bus_fire_intx_routing_notifier(pci_get_bus(&piix3->dev)); - piix3_update_irq_levels(piix3); - for (pic_irq =3D 0; pic_irq < PIIX_NUM_PIC_IRQS; pic_irq++) { - piix3_set_irq_pic(piix3, pic_irq); - } - } -} - -static void piix3_write_config_xen(PCIDevice *dev, - uint32_t address, uint32_t val, int len) -{ - xen_piix_pci_write_config_client(address, val, len); - piix3_write_config(dev, address, val, len); -} - -static void piix3_reset(void *opaque) -{ - PIIX3State *d =3D opaque; - uint8_t *pci_conf =3D d->dev.config; - - pci_conf[0x04] =3D 0x07; /* master, memory and I/O */ - pci_conf[0x05] =3D 0x00; - pci_conf[0x06] =3D 0x00; - pci_conf[0x07] =3D 0x02; /* PCI_status_devsel_medium */ - pci_conf[0x4c] =3D 0x4d; - pci_conf[0x4e] =3D 0x03; - pci_conf[0x4f] =3D 0x00; - pci_conf[0x60] =3D 0x80; - pci_conf[0x61] =3D 0x80; - pci_conf[0x62] =3D 0x80; - pci_conf[0x63] =3D 0x80; - pci_conf[0x69] =3D 0x02; - pci_conf[0x70] =3D 0x80; - pci_conf[0x76] =3D 0x0c; - pci_conf[0x77] =3D 0x0c; - pci_conf[0x78] =3D 0x02; - pci_conf[0x79] =3D 0x00; - pci_conf[0x80] =3D 0x00; - pci_conf[0x82] =3D 0x00; - pci_conf[0xa0] =3D 0x08; - pci_conf[0xa2] =3D 0x00; - pci_conf[0xa3] =3D 0x00; - pci_conf[0xa4] =3D 0x00; - pci_conf[0xa5] =3D 0x00; - pci_conf[0xa6] =3D 0x00; - pci_conf[0xa7] =3D 0x00; - pci_conf[0xa8] =3D 0x0f; - pci_conf[0xaa] =3D 0x00; - pci_conf[0xab] =3D 0x00; - pci_conf[0xac] =3D 0x00; - pci_conf[0xae] =3D 0x00; - - d->pic_levels =3D 0; - d->rcr =3D 0; -} - -static int piix3_post_load(void *opaque, int version_id) -{ - PIIX3State *piix3 =3D opaque; - int pirq; - - /* Because the i8259 has not been deserialized yet, qemu_irq_raise - * might bring the system to a different state than the saved one; - * for example, the interrupt could be masked but the i8259 would - * not know that yet and would trigger an interrupt in the CPU. - * - * Here, we update irq levels without raising the interrupt. - * Interrupt state will be deserialized separately through the i8259. - */ - piix3->pic_levels =3D 0; - for (pirq =3D 0; pirq < PIIX_NUM_PIRQS; pirq++) { - piix3_set_irq_level_internal(piix3, pirq, - pci_bus_get_irq_level(pci_get_bus(&piix3->dev), pirq)); - } - return 0; -} - -static int piix3_pre_save(void *opaque) -{ - int i; - PIIX3State *piix3 =3D opaque; - - for (i =3D 0; i < ARRAY_SIZE(piix3->pci_irq_levels_vmstate); i++) { - piix3->pci_irq_levels_vmstate[i] =3D - pci_bus_get_irq_level(pci_get_bus(&piix3->dev), i); - } - - return 0; -} - -static bool piix3_rcr_needed(void *opaque) -{ - PIIX3State *piix3 =3D opaque; - - return (piix3->rcr !=3D 0); -} - -static const VMStateDescription vmstate_piix3_rcr =3D { - .name =3D "PIIX3/rcr", - .version_id =3D 1, - .minimum_version_id =3D 1, - .needed =3D piix3_rcr_needed, - .fields =3D (VMStateField[]) { - VMSTATE_UINT8(rcr, PIIX3State), - VMSTATE_END_OF_LIST() - } -}; - -static const VMStateDescription vmstate_piix3 =3D { - .name =3D "PIIX3", - .version_id =3D 3, - .minimum_version_id =3D 2, - .post_load =3D piix3_post_load, - .pre_save =3D piix3_pre_save, - .fields =3D (VMStateField[]) { - VMSTATE_PCI_DEVICE(dev, PIIX3State), - VMSTATE_INT32_ARRAY_V(pci_irq_levels_vmstate, PIIX3State, - PIIX_NUM_PIRQS, 3), - VMSTATE_END_OF_LIST() - }, - .subsections =3D (const VMStateDescription*[]) { - &vmstate_piix3_rcr, - NULL - } -}; - - -static void rcr_write(void *opaque, hwaddr addr, uint64_t val, unsigned le= n) -{ - PIIX3State *d =3D opaque; - - if (val & 4) { - qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); - return; - } - d->rcr =3D val & 2; /* keep System Reset type only */ -} - -static uint64_t rcr_read(void *opaque, hwaddr addr, unsigned len) -{ - PIIX3State *d =3D opaque; - - return d->rcr; -} - -static const MemoryRegionOps rcr_ops =3D { - .read =3D rcr_read, - .write =3D rcr_write, - .endianness =3D DEVICE_LITTLE_ENDIAN -}; - -static void piix3_realize(PCIDevice *dev, Error **errp) -{ - PIIX3State *d =3D PIIX3_PCI_DEVICE(dev); - - if (!isa_bus_new(DEVICE(d), get_system_memory(), - pci_address_space_io(dev), errp)) { - return; - } - - memory_region_init_io(&d->rcr_mem, OBJECT(dev), &rcr_ops, d, - "piix3-reset-control", 1); - memory_region_add_subregion_overlap(pci_address_space_io(dev), - PIIX_RCR_IOPORT, &d->rcr_mem, 1); - - qemu_register_reset(piix3_reset, d); -} - -static void pci_piix3_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); - - dc->desc =3D "ISA bridge"; - dc->vmsd =3D &vmstate_piix3; - dc->hotpluggable =3D false; - k->realize =3D piix3_realize; - k->vendor_id =3D PCI_VENDOR_ID_INTEL; - /* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */ - k->device_id =3D PCI_DEVICE_ID_INTEL_82371SB_0; - k->class_id =3D PCI_CLASS_BRIDGE_ISA; - /* - * Reason: part of PIIX3 southbridge, needs to be wired up by - * pc_piix.c's pc_init1() - */ - dc->user_creatable =3D false; -} - -static const TypeInfo piix3_pci_type_info =3D { - .name =3D TYPE_PIIX3_PCI_DEVICE, - .parent =3D TYPE_PCI_DEVICE, - .instance_size =3D sizeof(PIIX3State), - .abstract =3D true, - .class_init =3D pci_piix3_class_init, - .interfaces =3D (InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, - }, -}; - -static void piix3_class_init(ObjectClass *klass, void *data) -{ - PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); - - k->config_write =3D piix3_write_config; -} - -static const TypeInfo piix3_info =3D { - .name =3D TYPE_PIIX3_DEVICE, - .parent =3D TYPE_PIIX3_PCI_DEVICE, - .class_init =3D piix3_class_init, -}; - -static void piix3_xen_class_init(ObjectClass *klass, void *data) -{ - PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); - - k->config_write =3D piix3_write_config_xen; -}; - -static const TypeInfo piix3_xen_info =3D { - .name =3D TYPE_PIIX3_XEN_DEVICE, - .parent =3D TYPE_PIIX3_PCI_DEVICE, - .class_init =3D piix3_xen_class_init, -}; - static void i440fx_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -922,9 +523,6 @@ static void i440fx_register_types(void) { type_register_static(&i440fx_info); type_register_static(&igd_passthrough_i440fx_info); - type_register_static(&piix3_pci_type_info); - type_register_static(&piix3_info); - type_register_static(&piix3_xen_info); type_register_static(&i440fx_pcihost_info); } =20 diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index 094508b928..152628c6d9 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -12,6 +12,8 @@ #ifndef HW_SOUTHBRIDGE_PIIX_H #define HW_SOUTHBRIDGE_PIIX_H =20 +#include "hw/pci/pci.h" + #define TYPE_PIIX4_PM "PIIX4_PM" =20 I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, @@ -30,8 +32,42 @@ I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t s= mb_io_base, */ #define PIIX_RCR_IOPORT 0xcf9 =20 +#define PIIX_NUM_PIC_IRQS 16 /* i8259 * 2 */ +#define PIIX_NUM_PIRQS 4ULL /* PIRQ[A-D] */ + +typedef struct PIIXState { + PCIDevice dev; + + /* + * bitmap to track pic levels. + * The pic level is the logical OR of all the PCI irqs mapped to it + * So one PIC level is tracked by PIIX_NUM_PIRQS bits. + * + * PIRQ is mapped to PIC pins, we track it by + * PIIX_NUM_PIRQS * PIIX_NUM_PIC_IRQS =3D 64 bits with + * pic_irq * PIIX_NUM_PIRQS + pirq + */ +#if PIIX_NUM_PIC_IRQS * PIIX_NUM_PIRQS > 64 +#error "unable to encode pic state in 64bit in pic_levels." +#endif + uint64_t pic_levels; + + qemu_irq *pic; + + /* This member isn't used. Just for save/load compatibility */ + int32_t pci_irq_levels_vmstate[PIIX_NUM_PIRQS]; + + /* Reset Control Register contents */ + uint8_t rcr; + + /* IO memory region for Reset Control Register (PIIX_RCR_IOPORT) */ + MemoryRegion rcr_mem; +} PIIX3State; + extern PCIDevice *piix4_dev; =20 +PIIX3State *piix3_create(PCIBus *pci_bus, ISABus **isa_bus); + DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, I2CBus **smbus, size_t ide_buses); =20 --=20 2.21.0 From nobody Sat May 4 19:27:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1572286092; cv=none; d=zoho.com; s=zohoarc; b=TL39GGDljXdve/HVTvBveTcDRxKK7/euWmTiJhlVN1GhnKUikrwvl71RQG3N5EFz048XYCm2LjxSWyTi3xOrsgmQCCW67aX2uNNJjUXn/pn0BsPRryvCK39N3RmaPRPGvwAgYQd0mFYxPBHxCepDDJ93zH8S1qhA5wYzKGZuJ8U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572286092; 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=j8Ov6K9gjAmVTeZvfxxVP3jRwrZORnzk/ILSZphq89g=; b=V9/EhP2czFMWs5vityAKm59RYFBvcM4uOSmvVgPE8YOo6ceNXdYD6x7gbIYr+Wg1EtsGta2jUbDNoFNZ/xglQPLoRF2NAA6HFo6zTFK4wAkD+GnysXIwtAdp2JWLx99E/BrpibLYsTaxVS4f5ZXAlHQ4i/CCJGjDSdfeZUp29ko= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.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 1572286092346501.31074596022734; Mon, 28 Oct 2019 11:08:12 -0700 (PDT) Received: from localhost ([::1]:39972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP9R4-00088G-TS for importer@patchew.org; Mon, 28 Oct 2019 14:08:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41403) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP80m-00031f-FJ for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP80l-0008OF-7u for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:56 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:55237 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iP80l-0008Nz-3u for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:36:55 -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-369-LwoKiBkNOG-sUeGRMg0MCA-1; Mon, 28 Oct 2019 12:36:51 -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 DF8AA107AD29; Mon, 28 Oct 2019 16:36:49 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-87.brq.redhat.com [10.40.204.87]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 992EB26199; Mon, 28 Oct 2019 16:36:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572280614; 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=j8Ov6K9gjAmVTeZvfxxVP3jRwrZORnzk/ILSZphq89g=; b=eJUk9JlB+ETlRAtK8t96tyyXENHtFK5cPpNhjpdlTFlbBOn7r3QAHS++hq5JxzlODsFoS8 R1VC53XmkS5UDlxdafKDGUFT/reAZ8A2y3xnXrCOOf//Z+r8ukieCoW0X5c5y3cYF0KMAd KSnZoutQmGMLLMDRZMqmmRmn1KJRTeg= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 19/20] hw/pci-host: Rename incorrectly named 'piix' as 'i440fx' Date: Mon, 28 Oct 2019 17:34:46 +0100 Message-Id: <20191028163447.18541-20-philmd@redhat.com> In-Reply-To: <20191028163447.18541-1-philmd@redhat.com> References: <20191028163447.18541-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: LwoKiBkNOG-sUeGRMg0MCA-1 X-Mimecast-Spam-Score: 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: 207.211.31.120 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: Eduardo Habkost , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Markovic , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aurelien Jarno , Richard Henderson 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: Philippe Mathieu-Daud=C3=A9 We moved all the PIIX3 southbridge code out of hw/pci-host/piix.c, it now only contains i440FX northbridge code. Rename it to match the chipset modelled. Reviewed-by: Aleksandar Markovic Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 2 +- hw/i386/Kconfig | 2 +- hw/pci-host/Kconfig | 2 +- hw/pci-host/Makefile.objs | 2 +- hw/pci-host/{piix.c =3D> i440fx.c} | 0 5 files changed, 4 insertions(+), 4 deletions(-) rename hw/pci-host/{piix.c =3D> i440fx.c} (100%) diff --git a/MAINTAINERS b/MAINTAINERS index e7e7bfc890..87e7fb1a65 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1225,7 +1225,7 @@ M: Marcel Apfelbaum S: Supported F: include/hw/i386/ F: hw/i386/ -F: hw/pci-host/piix.c +F: hw/pci-host/i440fx.c F: hw/pci-host/q35.c F: hw/pci-host/pam.c F: include/hw/pci-host/i440fx.h diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig index d420b35548..5a494342ea 100644 --- a/hw/i386/Kconfig +++ b/hw/i386/Kconfig @@ -60,7 +60,7 @@ config I440FX select PC_PCI select PC_ACPI select ACPI_SMBUS - select PCI_PIIX + select PCI_I440FX select PIIX3 select IDE_PIIX select DIMM diff --git a/hw/pci-host/Kconfig b/hw/pci-host/Kconfig index 397043b289..b0aa8351c4 100644 --- a/hw/pci-host/Kconfig +++ b/hw/pci-host/Kconfig @@ -28,7 +28,7 @@ config PCI_SABRE select PCI bool =20 -config PCI_PIIX +config PCI_I440FX bool select PCI select PAM diff --git a/hw/pci-host/Makefile.objs b/hw/pci-host/Makefile.objs index a9cd3e022d..efd752b766 100644 --- a/hw/pci-host/Makefile.objs +++ b/hw/pci-host/Makefile.objs @@ -13,7 +13,7 @@ common-obj-$(CONFIG_VERSATILE_PCI) +=3D versatile.o =20 common-obj-$(CONFIG_PCI_SABRE) +=3D sabre.o common-obj-$(CONFIG_FULONG) +=3D bonito.o -common-obj-$(CONFIG_PCI_PIIX) +=3D piix.o +common-obj-$(CONFIG_PCI_I440FX) +=3D i440fx.o common-obj-$(CONFIG_PCI_EXPRESS_Q35) +=3D q35.o common-obj-$(CONFIG_PCI_EXPRESS_GENERIC_BRIDGE) +=3D gpex.o common-obj-$(CONFIG_PCI_EXPRESS_XILINX) +=3D xilinx-pcie.o diff --git a/hw/pci-host/piix.c b/hw/pci-host/i440fx.c similarity index 100% rename from hw/pci-host/piix.c rename to hw/pci-host/i440fx.c --=20 2.21.0 From nobody Sat May 4 19:27:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1572286902; cv=none; d=zoho.com; s=zohoarc; b=Cy24NIMSzx6f+nxRMTe7Z3HiC4JMYgfRMnzTcUgmoVC1lWFSs0wUM/kvbbUFpYvc/Yloyh4COCpbSbe32m4KxxBgEZ6ztw6b+m75y5I+I8Glg7hHdFQ6e8ccW6zW7JRZa++PsqVsn/QBf08Du4/WQwq0CoK4l1OHwoEFL/6Qr+E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572286902; 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=WQsFUyLAwDljpdipMYVdl0GqrBsJ3XrvhlsEYkdcey4=; b=cI6viqeazhI65Fbj5PSNn7vcSuyxuidg0Jm8pYZ7MYrVyFEI/gU4PyvNXeum5cLFymf5C24tcB4KhbkvOz0Eeh9x5nuXLoBLABJwMIw5oM5gbIBkog0CxUdtwfSuSkS16v9tYbeGgv/qLjmxSaCW1rkL7CunC+t6qNvo6ht6Ye8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.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 1572286902699486.2487648716932; Mon, 28 Oct 2019 11:21:42 -0700 (PDT) Received: from localhost ([::1]:41282 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP9e6-0005BZ-GU for importer@patchew.org; Mon, 28 Oct 2019 14:21:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41424) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP80w-00033p-Gm for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:37:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP80u-0008UY-80 for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:37:06 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:23555 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iP80s-0008Qn-CG for qemu-devel@nongnu.org; Mon, 28 Oct 2019 12:37:04 -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-388-V_b7dxXEP4ekLOYa2E_hEg-1; Mon, 28 Oct 2019 12:36:56 -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 6897F476; Mon, 28 Oct 2019 16:36:55 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-87.brq.redhat.com [10.40.204.87]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B2F926199; Mon, 28 Oct 2019 16:36:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572280620; 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=WQsFUyLAwDljpdipMYVdl0GqrBsJ3XrvhlsEYkdcey4=; b=TFs0qeKcEwwf64lzyRH8oT32qOLCPLmHHKKSj5UEt2d3Jvqioricq+wMNjgHv+PBA2qeyi 8PBvLewRCd1qC2xNpy8gV9RE1nEQGlL5wQ1ZmKp1Oly5rQ3ULDzuTnAwocVtY2bcDZMalH GF52W+0eLJ8xwFtbCwo8nL5wtvbLBSc= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 20/20] hw/pci-host/i440fx: Remove the last PIIX3 traces Date: Mon, 28 Oct 2019 17:34:47 +0100 Message-Id: <20191028163447.18541-21-philmd@redhat.com> In-Reply-To: <20191028163447.18541-1-philmd@redhat.com> References: <20191028163447.18541-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: V_b7dxXEP4ekLOYa2E_hEg-1 X-Mimecast-Spam-Score: 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: 205.139.110.61 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" , Eduardo Habkost , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Markovic , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aurelien Jarno , Richard Henderson 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" The PIIX3 is not tied to the i440FX and can even be used without it. Move its creation to the machine code (pc_piix.c). We have now removed the last trace of southbridge code in the i440FX northbridge. Reviewed-by: Aleksandar Markovic Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc_piix.c | 8 +++++++- hw/pci-host/i440fx.c | 8 -------- include/hw/pci-host/i440fx.h | 3 +-- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index ba35d5685e..2aefa3b8df 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -192,14 +192,20 @@ static void pc_init1(MachineState *machine, gsi_state =3D pc_gsi_create(&x86ms->gsi, pcmc->pci_enabled); =20 if (pcmc->pci_enabled) { + PIIX3State *piix3; + pci_bus =3D i440fx_init(host_type, pci_type, - &i440fx_state, &piix3_devfn, &isa_bus, x86ms= ->gsi, + &i440fx_state, system_memory, system_io, machine->ram_size, x86ms->below_4g_mem_size, x86ms->above_4g_mem_size, pci_memory, ram_memory); pcms->bus =3D pci_bus; + + piix3 =3D piix3_create(pci_bus, &isa_bus); + piix3->pic =3D x86ms->gsi; + piix3_devfn =3D piix3->dev.devfn; } else { pci_bus =3D NULL; i440fx_state =3D NULL; diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 79ecd58a2b..f27131102d 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -27,7 +27,6 @@ #include "hw/pci/pci.h" #include "hw/pci/pci_host.h" #include "hw/pci-host/i440fx.h" -#include "hw/southbridge/piix.h" #include "hw/qdev-properties.h" #include "hw/sysbus.h" #include "qapi/error.h" @@ -272,8 +271,6 @@ static void i440fx_realize(PCIDevice *dev, Error **errp) =20 PCIBus *i440fx_init(const char *host_type, const char *pci_type, PCII440FXState **pi440fx_state, - int *piix3_devfn, - ISABus **isa_bus, qemu_irq *pic, MemoryRegion *address_space_mem, MemoryRegion *address_space_io, ram_addr_t ram_size, @@ -286,7 +283,6 @@ PCIBus *i440fx_init(const char *host_type, const char *= pci_type, PCIBus *b; PCIDevice *d; PCIHostState *s; - PIIX3State *piix3; PCII440FXState *f; unsigned i; I440FXState *i440fx; @@ -339,10 +335,6 @@ PCIBus *i440fx_init(const char *host_type, const char = *pci_type, PAM_EXPAN_SIZE); } =20 - piix3 =3D piix3_create(b, isa_bus); - piix3->pic =3D pic; - *piix3_devfn =3D piix3->dev.devfn; - ram_size =3D ram_size / 8 / 1024 / 1024; if (ram_size > 255) { ram_size =3D 255; diff --git a/include/hw/pci-host/i440fx.h b/include/hw/pci-host/i440fx.h index e327f9bf87..f54e6466e4 100644 --- a/include/hw/pci-host/i440fx.h +++ b/include/hw/pci-host/i440fx.h @@ -22,8 +22,7 @@ typedef struct PCII440FXState PCII440FXState; #define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX" =20 PCIBus *i440fx_init(const char *host_type, const char *pci_type, - PCII440FXState **pi440fx_state, int *piix_devfn, - ISABus **isa_bus, qemu_irq *pic, + PCII440FXState **pi440fx_state, MemoryRegion *address_space_mem, MemoryRegion *address_space_io, ram_addr_t ram_size, --=20 2.21.0