From patchwork Mon Aug 19 20:17:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 1149572 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="qa4679rb"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46C5Dq5Pg3z9s00 for ; Tue, 20 Aug 2019 06:31:39 +1000 (AEST) Received: from localhost ([::1]:57494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzoJV-00008w-BE for incoming@patchwork.ozlabs.org; Mon, 19 Aug 2019 16:31:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45553) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzo5r-0007jH-K9 for qemu-devel@nongnu.org; Mon, 19 Aug 2019 16:17:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hzo5k-0003Nb-Bc for qemu-devel@nongnu.org; Mon, 19 Aug 2019 16:17:31 -0400 Received: from mail-ot1-x343.google.com ([2607:f8b0:4864:20::343]:44183) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hzo5k-0003NS-62 for qemu-devel@nongnu.org; Mon, 19 Aug 2019 16:17:24 -0400 Received: by mail-ot1-x343.google.com with SMTP id w4so2875137ote.11 for ; Mon, 19 Aug 2019 13:17:24 -0700 (PDT) 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=rTvu6IYGskpauBneJhK8+mpo2003CoRrIeGIo6RkqO4=; b=qa4679rbahSietwBAKvgJkNMnygieZPIFaSTtOUOrKHn593MkmumX/P4SccT7UygE/ +7sOTc9lea7ILyn7oIDTfYOM+7iBLDmzoezKf/dzlBgYimeRiNt/4/XwOc3FNgfKuik3 ca2rSfg8T2nOLPPkg+kckwPc+OLtSaWf0IiciP28pLw378eXSBcIgs7bSjG7Wpl3aqyH /WaX2EowwFV8/LxScX76v5ef3LIow76HMZ7dpPvQVXGWYVn33szS+1x9c3THLjquGpE5 r+4JnolzefKEUcyZSv6+u5P5/EDdK75oGh3mEGEgtrueQ00+l5F2BDV3HHrZdZbkkcOt wLYw== 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=rTvu6IYGskpauBneJhK8+mpo2003CoRrIeGIo6RkqO4=; b=geG9xbmsi4vvvSm0b4BW0OWLIjHoVjllNFzI/TlLRoZ2GdSvz5SDGGX012PAdg/sFj i3cUozMBtjDqCVj3cPHeqIEJLMtxQbsn1AEpi/pskqk8Othx8FWjw90yHSPlyFA2iZYE lhC0tAWFTfr9wo+argjaRzKivT3HOsD6/CI88vjTAfUficnN6Y742LlgaAnPW2WXNbRj DgWn69IXcQQ2gtRo3OIlnLJ3axjpONyrE0FuMPsyyCKqptQA7pW2re3kAG8YUSHzLsj9 XFh7jVYXJIQSgXtcVrVrQC211uRr9LLg3FKJXclh1odwS0QNK08nwqztXyuu1H3wzsOn /Bjw== X-Gm-Message-State: APjAAAVCl/Cob/pfinIp+Kxf+N5A04St7SLw8PAWv9KOM66Gge3o3UUY V0/jl41tAP8a9pw0Hfgj2Q== X-Google-Smtp-Source: APXvYqxb9bxE0G0akjgtm30r+q5Rjm7JGXOfxyh9Suvf8rZLoIEslsZtTwjh5fdDZ21VHPej0UFCWA== X-Received: by 2002:a9d:3f42:: with SMTP id m60mr19477947otc.142.1566245843332; Mon, 19 Aug 2019 13:17:23 -0700 (PDT) Received: from serve.minyard.net ([47.184.134.43]) by smtp.gmail.com with ESMTPSA id m18sm1411268oic.12.2019.08.19.13.17.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 13:17:22 -0700 (PDT) Received: from t430.minyard.net (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPA id 5244E1805AF; Mon, 19 Aug 2019 20:17:18 +0000 (UTC) Received: by t430.minyard.net (Postfix, from userid 1000) id 3F5DD301176; Mon, 19 Aug 2019 15:17:18 -0500 (CDT) From: minyard@acm.org To: QEMU Developers Date: Mon, 19 Aug 2019 15:17:05 -0500 Message-Id: <20190819201705.31633-16-minyard@acm.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819201705.31633-1-minyard@acm.org> References: <20190819201705.31633-1-minyard@acm.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::343 Subject: [Qemu-devel] [PATCH 15/15] pc: Add an SMB0 ACPI device to q35 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: Corey Minyard , Igor Mammedov , "Michael S . Tsirkin" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.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. Cc: Michael S. Tsirkin Cc: Igor Mammedov 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/data/acpi/q35/DSDT | Bin 7841 -> 7879 bytes tests/data/acpi/q35/DSDT.bridge | Bin 7858 -> 7896 bytes tests/data/acpi/q35/DSDT.cphp | Bin 8304 -> 8342 bytes tests/data/acpi/q35/DSDT.dimmpxm | Bin 9494 -> 9532 bytes tests/data/acpi/q35/DSDT.ipmibt | Bin 7916 -> 7954 bytes tests/data/acpi/q35/DSDT.memhp | Bin 9200 -> 9238 bytes tests/data/acpi/q35/DSDT.mmio64 | Bin 8971 -> 9009 bytes tests/data/acpi/q35/DSDT.numamem | Bin 7847 -> 7885 bytes 12 files changed, 28 insertions(+), 10 deletions(-) diff --git a/tests/data/acpi/q35/DSDT b/tests/data/acpi/q35/DSDT index f9f36d1645c9b57aea38350d67dfaa143845697d..77ea60ffed421c566138fe6341421f579129a582 100644 GIT binary patch delta 62 zcmZ2zd)$`GCD=)CDW690Qk}0eJT(JhZ diff --git a/tests/data/acpi/q35/DSDT.bridge b/tests/data/acpi/q35/DSDT.bridge index 29176832ca9842c6654273ae1246321aa38b2821..fbc2d40000428b402586ea9302b5ccf36ef8de1e 100644 GIT binary patch delta 62 zcmdmFd&8E?CD? delta 24 fcmbQ{_`!k8CDh%4&?v< delta 24 fcmdnvHO-65CDZvE=4t$(!5&ShNQA diff --git a/tests/data/acpi/q35/DSDT.ipmibt b/tests/data/acpi/q35/DSDT.ipmibt index 9634930e6125de4375d87a56a353f636985599d4..c3fca0a71efa7b55c958a49f305389426fbe7922 100644 GIT binary patch delta 62 zcmaE3JIRjACDI?2uJBvV)cXHo~& diff --git a/tests/data/acpi/q35/DSDT.memhp b/tests/data/acpi/q35/DSDT.memhp index dad5dc8db2f13bdb0de001da42c13b18286c3061..2abd0e36cd1344cbca3fa4ab59c5db2ea326d125 100644 GIT binary patch delta 62 zcmez1KFx#6CDsmbus && !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 9e187f856a..96311b0a91 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -283,15 +283,14 @@ else { 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, @@ -464,6 +463,7 @@ static void pc_i440fx_3_1_machine_options(MachineClass *m) pc_i440fx_4_0_machine_options(m); m->is_default = 0; + pcmc->do_not_add_smb_acpi = true; m->smbus_no_migration_support = true; m->alias = NULL; pcmc->pvh_enabled = false; diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index be3464f485..7ce4fb6fdb 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -316,10 +316,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); @@ -410,6 +410,7 @@ static void pc_q35_3_1_machine_options(MachineClass *m) pc_q35_4_0_machine_options(m); m->default_kernel_irqchip_split = false; + pcmc->do_not_add_smb_acpi = true; m->smbus_no_migration_support = true; m->alias = NULL; pcmc->pvh_enabled = false; diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 4bb9e29114..4013ac721c 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -38,6 +38,7 @@ struct PCMachineState { HotplugHandler *acpi_dev; ISADevice *rtc; PCIBus *bus; + I2CBus *smbus; FWCfgState *fw_cfg; qemu_irq *gsi; PFlashCFI01 *flash[2]; @@ -116,6 +117,7 @@ typedef 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;