From patchwork Thu Dec 7 21:46:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 10101163 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2462460329 for ; Thu, 7 Dec 2017 21:57:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1702C28754 for ; Thu, 7 Dec 2017 21:57:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A86B287B8; Thu, 7 Dec 2017 21:57:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4F76128754 for ; Thu, 7 Dec 2017 21:57:41 +0000 (UTC) Received: from localhost ([::1]:34559 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eN4Am-000072-Fl for patchwork-qemu-devel@patchwork.kernel.org; Thu, 07 Dec 2017 16:57:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eN40A-0004Br-EV for qemu-devel@nongnu.org; Thu, 07 Dec 2017 16:46:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eN408-0006bI-9X for qemu-devel@nongnu.org; Thu, 07 Dec 2017 16:46:42 -0500 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:37714) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eN407-0006at-WD for qemu-devel@nongnu.org; Thu, 07 Dec 2017 16:46:40 -0500 Received: by mail-pf0-x241.google.com with SMTP id n6so5683043pfa.4 for ; Thu, 07 Dec 2017 13:46:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=b/SjwiziciK3xBKOBXP6BKSXJTtK3jn/KJF345m5JTQ=; b=ZySqGI/yl47meSAxBDqCYopRomAmkTHb/P7v/deia/RyycL2XQswNnFoBX8VpUv0a2 S/GR8oCGR0Je5rXv2MqD3TFht+3oCu+eR9AEk0kPnFqsu3c7eLI7vc87ajHud9tsqGq/ IKNrfh2FzbHlxop2v2RjXJFpdI570Y3Oocd8e1ZPDsHSw+2tdbBHr5ltel8q53+Bfd+R gNuYYctM1kpK1FnxWqr927NYIu5ElA2vAxG4bgON/n6Yu+T3WP81djs8LXxkC7HpqrLw szeigLH4n2VKnxnkanDTSjZnuOhahLstL82dFGjooqNFhTauAxKfAqnofHjE9gOveDJZ xJug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=b/SjwiziciK3xBKOBXP6BKSXJTtK3jn/KJF345m5JTQ=; b=R2gUHM6Gv5AQvtufAh535/3a5AZRqYIeSCcozn115Vqy+DdzsYXGYobbLp2ux8TcPP uFjQqOtMPQvOe/NWXEe5YcR1e/vgNPqLn11xNDbfVZH84L6FhzkS6y80fIJQAsDXJH9W sKY0WE34+yj7LaoYDaoGUw+j8RVLULt0lw+0cW6b+LD7DsMXon0O36/TQBReoxfz7AZb iJ7VTpSrNFi/i2MRfyWsJxZ2esmKbsDGmD0tyaj9IS05BMrAv3MpONNqV+n75MSDM2Ea goAaHd3jQ6JxAVYiNQIqEbs2sl5wm/KkPuQWPMotUqm2TIjjiJOQSIu+wRucpIepY8Sx J1tA== X-Gm-Message-State: AJaThX6EfZps4SChdCoJA4MxLjQR7bNi2Sarq12W1P3uIeTfkhI+Du3Y i7XXGcDTG9vDf0vvc1lWYg== X-Google-Smtp-Source: AGs4zMYKAV6dPPtqIwVM6uXgiu9m2YBlSJm+z7m8ITraQCskLMINyuzYlilZI5kIUnhrRJ7TinBiyA== X-Received: by 10.101.101.216 with SMTP id y24mr27857827pgv.236.1512683198869; Thu, 07 Dec 2017 13:46:38 -0800 (PST) Received: from serve.minyard.net (serve.minyard.net. [2001:470:b8f6:1b::1]) by smtp.gmail.com with ESMTPSA id x4sm10391441pfk.51.2017.12.07.13.46.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Dec 2017 13:46:35 -0800 (PST) Received: from t430.minyard.net (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPA id 39EC91303; Thu, 7 Dec 2017 15:46:26 -0600 (CST) Received: by t430.minyard.net (Postfix, from userid 1000) id 9FF8030236D; Thu, 7 Dec 2017 15:46:23 -0600 (CST) From: minyard@acm.org To: qemu-devel@nongnu.org Date: Thu, 7 Dec 2017 15:46:21 -0600 Message-Id: <1512683181-8420-15-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512683181-8420-1-git-send-email-minyard@acm.org> References: <1512683181-8420-1-git-send-email-minyard@acm.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::241 Subject: [Qemu-devel] [PATCH 14/14] pc: Add an SMB0 ACPI device to q35 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Corey Minyard Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Corey Minyard This is so I2C devices can be found in the ACPI namespace. Currently that's only IPMI, but devices can be easily added now. Adding the devices required some PCI information, and the bus itself to be added to the PCMachineState structure. Note that this only works on Q35, the ACPI for PIIX4 is not capable of handling an SMBus device. Signed-off-by: Corey Minyard --- hw/i386/acpi-build.c | 15 +++++++++++++++ hw/i386/pc_piix.c | 12 ++++++------ hw/i386/pc_q35.c | 9 +++++---- include/hw/i386/pc.h | 2 ++ tests/acpi-test-data/q35/DSDT | Bin 7828 -> 7866 bytes tests/acpi-test-data/q35/DSDT.bridge | Bin 7845 -> 7883 bytes tests/acpi-test-data/q35/DSDT.cphp | Bin 8291 -> 8329 bytes tests/acpi-test-data/q35/DSDT.ipmibt | Bin 7903 -> 7941 bytes tests/acpi-test-data/q35/DSDT.memhp | Bin 9193 -> 9231 bytes 9 files changed, 28 insertions(+), 10 deletions(-) diff --git a/tests/acpi-test-data/q35/DSDT b/tests/acpi-test-data/q35/DSDT index aa402cca667f82ed0a2dc4969508d8f6e38ad910..3d95d15cedc4727a07652b5055bb3fb6553e9521 100644 GIT binary patch delta 62 zcmbPYyUUi#CDXEiBl|`!V@Xw2z4&0K_yA{5gXkv7U|%N#j(87G7aleN23C%E RN0%TTW(IkN%{G#mtN`_@4nP0^ delta 24 fcmX?YyVRD;CD0XFFx2QKET=2Ai7C1*w@K`Bi_T)g@;Xmft4fP R(Itq7nL(ambGu{&D**Ah4tW3o delta 24 fcmZp*yKl?o66_LkUygx+(R(9To#f_qlHsfXV=o7a diff --git a/tests/acpi-test-data/q35/DSDT.memhp b/tests/acpi-test-data/q35/DSDT.memhp index f0a27e1a3093ff7525f62b7509ea44dfe9eb8908..eb08477a6b90726dd7722d095d0be548d913c4ac 100644 GIT binary patch delta 62 zcmaFq-tWQX66_Mfufo8smbus && !pcmc->do_not_add_smb_acpi) { + build_smb0(dsdt, pcms->smbus, ICH9_SMB_DEV, ICH9_SMB_FUNC); + } } if (pcmc->legacy_cpu_hotplug) { diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 7e87ef0..2a7ae72 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -276,15 +276,14 @@ static void pc_init1(MachineState *machine, if (pcmc->pci_enabled && acpi_enabled) { DeviceState *piix4_pm; - I2CBus *smbus; smi_irq = qemu_allocate_irq(pc_acpi_smi_interrupt, first_cpu, 0); /* TODO: Populate SPD eeprom data. */ - smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100, - pcms->gsi[9], smi_irq, - pc_machine_is_smm_enabled(pcms), - &piix4_pm); - smbus_eeprom_init(smbus, 8, NULL, 0); + pcms->smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100, + pcms->gsi[9], smi_irq, + pc_machine_is_smm_enabled(pcms), + &piix4_pm); + smbus_eeprom_init(pcms->smbus, 8, NULL, 0); object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP, TYPE_HOTPLUG_HANDLER, @@ -489,6 +488,7 @@ static void pc_i440fx_2_6_machine_options(MachineClass *m) pc_i440fx_2_7_machine_options(m); pcmc->legacy_cpu_hotplug = true; pcmc->linuxboot_dma_enabled = false; + pcmc->do_not_add_smb_acpi = true; SET_MACHINE_COMPAT(m, PC_COMPAT_2_6); } diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 6e4bf1a..0777bb3 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -258,10 +258,10 @@ static void pc_q35_init(MachineState *machine) if (pcms->smbus_enabled) { /* TODO: Populate SPD eeprom data. */ - smbus_eeprom_init(ich9_smb_init(host_bus, - PCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_FUNC), - 0xb100), - 8, NULL, 0); + pcms->smbus = ich9_smb_init(host_bus, + PCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_FUNC), + 0xb100); + smbus_eeprom_init(pcms->smbus, 8, NULL, 0); } pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state); @@ -358,6 +358,7 @@ static void pc_q35_2_6_machine_options(MachineClass *m) pc_q35_2_7_machine_options(m); pcmc->legacy_cpu_hotplug = true; pcmc->linuxboot_dma_enabled = false; + pcmc->do_not_add_smb_acpi = true; SET_MACHINE_COMPAT(m, PC_COMPAT_2_6); } diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 713aa33..5b19d10 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -39,6 +39,7 @@ struct PCMachineState { HotplugHandler *acpi_dev; ISADevice *rtc; PCIBus *bus; + I2CBus *smbus; FWCfgState *fw_cfg; qemu_irq *gsi; @@ -122,6 +123,7 @@ struct PCMachineClass { bool rsdp_in_ram; int legacy_acpi_table_size; unsigned acpi_data_size; + bool do_not_add_smb_acpi; /* SMBIOS compat: */ bool smbios_defaults;