From nobody Tue Feb 10 12:57:53 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 15126839086521.8063413104384836; Thu, 7 Dec 2017 13:58:28 -0800 (PST) Received: from localhost ([::1]:34559 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eN4BI-000072-2F for importer@patchew.org; Thu, 07 Dec 2017 16:58:12 -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) 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) 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) 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 84d82bc..9ec8268 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1859,6 +1859,18 @@ static Aml *build_q35_osc_method(void) return method; } =20 +static void build_smb0(Aml *table, I2CBus *smbus, int devnr, int func) +{ + Aml *scope =3D aml_scope("_SB.PCI0"); + Aml *dev =3D aml_device("SMB0"); + + aml_append(dev, aml_name_decl("_HID", aml_eisaid("APP0005"))); + aml_append(dev, aml_name_decl("_ADR", aml_int(devnr << 16 | func))); + build_acpi_ipmi_devices(dev, BUS(smbus), "\\_SB.PCI0.SMB0"); + aml_append(scope, dev); + aml_append(table, scope); +} + static void build_dsdt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm, AcpiMiscInfo *misc, @@ -1910,6 +1922,9 @@ build_dsdt(GArray *table_data, BIOSLinker *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); + } } =20 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, =20 if (pcmc->pci_enabled && acpi_enabled) { DeviceState *piix4_pm; - I2CBus *smbus; =20 smi_irq =3D qemu_allocate_irq(pc_acpi_smi_interrupt, first_cpu, 0); /* TODO: Populate SPD eeprom data. */ - smbus =3D 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 =3D 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); =20 object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_P= ROP, 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 =3D true; pcmc->linuxboot_dma_enabled =3D false; + pcmc->do_not_add_smb_acpi =3D true; SET_MACHINE_COMPAT(m, PC_COMPAT_2_6); } =20 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) =20 if (pcms->smbus_enabled) { /* TODO: Populate SPD eeprom data. */ - smbus_eeprom_init(ich9_smb_init(host_bus, - PCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_F= UNC), - 0xb100), - 8, NULL, 0); + pcms->smbus =3D ich9_smb_init(host_bus, + PCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_FUNC), + 0xb100); + smbus_eeprom_init(pcms->smbus, 8, NULL, 0); } =20 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 =3D true; pcmc->linuxboot_dma_enabled =3D false; + pcmc->do_not_add_smb_acpi =3D true; SET_MACHINE_COMPAT(m, PC_COMPAT_2_6); } =20 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; =20 @@ -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; =20 /* SMBIOS compat: */ bool smbios_defaults; diff --git a/tests/acpi-test-data/q35/DSDT b/tests/acpi-test-data/q35/DSDT index aa402cca667f82ed0a2dc4969508d8f6e38ad910..3d95d15cedc4727a07652b5055b= b3fb6553e9521 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=3D2Ai7C1*w@K`Bi_T)g@;Xmft4fP R(Itq7nL(ambGu{&D**Ah4tW3o delta 24 fcmZp*yKl?o66_LkUygx+(R(9To#f_qlHsfXV=3Do7a diff --git a/tests/acpi-test-data/q35/DSDT.memhp b/tests/acpi-test-data/q35= /DSDT.memhp index f0a27e1a3093ff7525f62b7509ea44dfe9eb8908..eb08477a6b90726dd7722d095d0= be548d913c4ac 100644 GIT binary patch delta 62 zcmaFq-tWQX66_Mfufo8