From patchwork Wed Jun 1 16:27:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 69048 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp194630qge; Wed, 1 Jun 2016 09:39:21 -0700 (PDT) X-Received: by 10.237.47.67 with SMTP id l61mr4556389qtd.89.1464799161797; Wed, 01 Jun 2016 09:39:21 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id y65si35366894qkc.228.2016.06.01.09.39.21 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 01 Jun 2016 09:39:21 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:43097 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b89Av-0006Ax-Aw for patch@linaro.org; Wed, 01 Jun 2016 12:39:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49581) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b88zF-0005SB-Vc for qemu-devel@nongnu.org; Wed, 01 Jun 2016 12:27:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b88z8-00058U-Or for qemu-devel@nongnu.org; Wed, 01 Jun 2016 12:27:16 -0400 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:33357) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b88z8-00058O-FK for qemu-devel@nongnu.org; Wed, 01 Jun 2016 12:27:10 -0400 Received: by mail-pf0-x243.google.com with SMTP id b124so4473697pfb.0 for ; Wed, 01 Jun 2016 09:27:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=JDoLSauq8Q52sM3Wi3dQGKHwzYcfypNHBN0mhpBKXMg=; b=c3RrNmgn6JEHuKHDdsQ3iJEDE8AFNmEGmbYb/upT1Wk5R7R2OOkOyJXpPRQi5YVOhY kXhdAIzIXzfwCd2QWLfrDOgJQ/qXgDB1hykW7lPohgpKh/d+da4EOTz4BgJRhwbwqfq1 C5FifylyNGAjfxuVJyBIXXPyKPwt6wo3agyS1sRaMoAWal7ZIqOWeq8BV4EjLZyiq9jE B5JL35+7CUMlywFOT10wlUQRpKHKonaxOcbkPpVL8/DSBrrQZHZZ/+jzdwypJSdGbR5q MMaTFsvEB3ooe2Bsmwy2viyNcezZCNkDgq2arUsIPcqvAN7nT1T7wLbnyYdCTOilVh7u pOJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=JDoLSauq8Q52sM3Wi3dQGKHwzYcfypNHBN0mhpBKXMg=; b=I7HwxnUhCyg3qEmFIxXb8vMy1yAmAls8tbQXqXxmvHri+EebqzNfaROF9L2gG4w9Ff G0KMyTmdlvXILNVjF054QROqIVTH9f1uWwL70/2bwp4bn7r0C9jv+Y8MVRm/wZacylpv Rgwf5uIYrt9CRc/G42l9RaY/dHS10s3Y6MHZmU8OLvGhwqY1WMaWt0eJTzj5ZjdFD0Fa uGoy8VrmubeSIFY0aM5Awf3+1L/71J7S0iSfYvBZoytiq+NsjND4VCRFS+acTMUAx4Up ZZuch0+eIcGK83k5zmPWtjoT1LE6QClW8+skYjRbVRzJPcYsjukYw1mJTmdIOkt0Fc/3 raKg== X-Gm-Message-State: ALyK8tLP9sma9B1oiuYTGvOvoM6q3w7P9XQCkNkaPuNiTrptbNKutC/O4NTfO3rMciGa+w== X-Received: by 10.98.99.6 with SMTP id x6mr2616765pfb.140.1464798429755; Wed, 01 Jun 2016 09:27:09 -0700 (PDT) Received: from serve.minyard.net ([108.19.215.157]) by smtp.gmail.com with ESMTPSA id f191sm49334060pfa.26.2016.06.01.09.27.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jun 2016 09:27:09 -0700 (PDT) Received: from t430.minyard.net (unknown [IPv6:2001:470:b8f6:1b:c93f:6d1d:c142:8409]) by serve.minyard.net (Postfix) with ESMTPA id 893471C6D; Wed, 1 Jun 2016 11:27:05 -0500 (CDT) Received: by t430.minyard.net (Postfix, from userid 1000) id 8F91030052F; Wed, 1 Jun 2016 11:27:03 -0500 (CDT) From: minyard@acm.org To: Igor Mammedov , "Michael S . Tsirkin" , Paolo Bonzini , qemu-devel@nongnu.org, minyard@acm.org, cminyard@mvista.com Date: Wed, 1 Jun 2016 11:27:00 -0500 Message-Id: <1464798420-12018-8-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1464798420-12018-1-git-send-email-minyard@acm.org> References: <1464798420-12018-1-git-send-email-minyard@acm.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c00::243 Subject: [Qemu-devel] [PATCH v2 7/7] 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 | 16 ++++++++++++++++ hw/i386/pc_piix.c | 13 +++++++------ hw/i386/pc_q35.c | 10 ++++++---- include/hw/i386/pc.h | 2 ++ tests/acpi-test-data/q35/DSDT | Bin 8357 -> 8395 bytes tests/acpi-test-data/q35/DSDT.bridge | Bin 8374 -> 8412 bytes tests/acpi-test-data/q35/DSDT.ipmibt | Bin 8432 -> 8470 bytes 7 files changed, 31 insertions(+), 10 deletions(-) diff --git a/tests/acpi-test-data/q35/DSDT b/tests/acpi-test-data/q35/DSDT index 1c089c34b06c9f2ea9fe67abb45498021319303c..9f3d165c756f6efc875e5364a157051e4ac929a5 100644 GIT binary patch delta 62 zcmZ4Lc-oQ6CD;M`y4+H=J delta 24 fcmX@@xYUu$CD;Mz?4(I>? delta 24 gcmccPxXqEvCDtq delta 24 gcmbQ{^udwKCDram_slots; int root_bus_limit = 0xFF; PCIBus *bus = NULL; @@ -2053,6 +2066,9 @@ build_dsdt(GArray *table_data, GArray *linker, build_q35_isa_bridge(dsdt); build_isa_devices_aml(dsdt); build_q35_pci0_int(dsdt); + if (pcms->smbus && !pcmc->do_not_add_smb_acpi) { + build_smb0(dsdt, pcms->smbus, ICH9_SMB_DEV, ICH9_SMB_FUNC); + } } build_cpu_hotplug_aml(dsdt); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index bf44093..4e0ed1f 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -252,15 +252,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, - 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, + 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, @@ -429,9 +428,11 @@ DEFINE_I440FX_MACHINE(v2_7, "pc-i440fx-2.7", NULL, static void pc_i440fx_2_6_machine_options(MachineClass *m) { + PCMachineClass *pcmc = PC_MACHINE_CLASS(m); pc_i440fx_2_7_machine_options(m); m->alias = NULL; m->is_default = 0; + 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 4787df1..2742bb2 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -240,10 +240,10 @@ static void pc_q35_init(MachineState *machine) } /* 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); @@ -294,8 +294,10 @@ DEFINE_Q35_MACHINE(v2_7, "pc-q35-2.7", NULL, static void pc_q35_2_6_machine_options(MachineClass *m) { + PCMachineClass *pcmc = PC_MACHINE_CLASS(m); pc_q35_2_7_machine_options(m); m->alias = NULL; + 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 dd6d644..6737efc 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -51,6 +51,7 @@ struct PCMachineState { HotplugHandler *acpi_dev; ISADevice *rtc; PCIBus *bus; + I2CBus *smbus; FWCfgState *fw_cfg; /* Configuration options: */ @@ -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;