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: 121101 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp8907201qgn; Thu, 7 Dec 2017 13:56:45 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ79tSLtx4SS9cbYXRkw6H1oifrAcVJBSJS84tU5VodXYEvUs/z9gUWke7sazVIOoCmGA7C X-Received: by 10.37.134.14 with SMTP id y14mr20333128ybk.91.1512683805653; Thu, 07 Dec 2017 13:56:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512683805; cv=none; d=google.com; s=arc-20160816; b=Qxz8Ga111bCVyE/mEIfrlKbFU0ZDNHlykhbmLxUe/t8PjLCprvmoOMUlbH3brUk/wN gNgHbE1tbB1BIiPMvHB67epQuer+NAjxsKpU0//M2HAYz1n+QeNbzEvkNY4UXDDjsZM1 i4Shq2SmYk/TPEaK9NdL6aQMXY6bN6AJg8RYjtNIvZDmvQG5Ed+1z/q1sUQP3Nt/TYDE 5MrGq0mZU7hsar+JNIXKW6AbOmHkgKT7XAI0SWXUendXEI3aqJFTjhS+LQYsABjMU+6R x8sFLL4ASzts0i70PUqMt0+G1yL9GsHVsZO6U8wrKlf1gMS0qjJ8oX/FFXbsTTQHMAit SXRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=b/SjwiziciK3xBKOBXP6BKSXJTtK3jn/KJF345m5JTQ=; b=k/BZjXIJPjbeE95TaFrXOrYAV6iCxcnJLboOq6szZ8spqxlALP0lHV+j/1WJfhd5Bj 1bgDPC78iVmiB7YigZWuVsucgd8aSjKH6FUtLKdfqcyK9sihdknwl1CS3sVxYkZvgdiZ u5iphwaGSKOqdpceOQaU/TAWtHc6z/K7K8xgYwlWL36aaj69O+GHkXNieO61tOKXUx60 1ZXYYuktd0EfrF+F8bwOd7VoJ0Mlxv2i/R7MDwGN8uE3m3RjrpjIinkSS9GPC8XuFtzY tD+fArtCXStn/NMZLQPTYdkfMBGOQLf5PUhfqvxLl2AaSDMloOJxTkd57qh3+iRmskL3 nAGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ZySqGI/y; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id j9si450832ywk.517.2017.12.07.13.56.45 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 07 Dec 2017 13:56:45 -0800 (PST) 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 header.s=20161025 header.b=ZySqGI/y; 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]:34554 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eN49t-0006VA-1q for patch@linaro.org; Thu, 07 Dec 2017 16:56:45 -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-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+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 | 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;