From patchwork Mon Feb 26 11:14:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 775863 Delivered-To: patch@linaro.org Received: by 2002:a5d:6103:0:b0:33d:da16:65b6 with SMTP id v3csp272848wrt; Mon, 26 Feb 2024 03:17:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWch3AHdeWUW27d0VjGWlSVZ8WOf3lMKn8q+fCbGI4bl+IOJ2aSV4/qhSjLlMae0+VSyFALsQHYqZAgssCI507P X-Google-Smtp-Source: AGHT+IGrC3PtxZ9d9kMwM4LFDePZpL+a96G0x3RRi+uzxjY59dlpfvHfpZyIw9XO+vLG0VcBzGyb X-Received: by 2002:a05:6808:1445:b0:3c1:9b7d:d60e with SMTP id x5-20020a056808144500b003c19b7dd60emr5020468oiv.38.1708946266610; Mon, 26 Feb 2024 03:17:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708946266; cv=none; d=google.com; s=arc-20160816; b=B/IJmy27/Z/vIkaiOvWPjn8X99tj50iaQ03KbQmoNafBfHUCuPMS6mbrYTfHu7Vkn9 g+GS1zhNv4xr8O8JUB8c+zn9HddrVmc04aA9nFatemqanlZ5+Un9+zQx4dhpJrQ2e2jb 39HVPW/6qRREtj0BC/pV7VCq+YYXsYAuunnet3tOlP8PKTL+tM+NHiEi47OC+8etzYyx nXiOS5C3djE2bbGtmbZ/qZfo0OAuRj8+88tYeyw51t5QBIRQP5e/OhZx5dZ2y1nOWvyS J0ZzS3/v1IxIAOad14yPiLCjcZDlnem65fnMbBND/QpnPcPTZ5A1w0DWTtwTo62iTma+ siNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lZ1MjFFP7CBRD+d2PVUAbb1TpM05+DB5Hf5IgGpJXgc=; fh=j4MxUKsQnom9H3Srwq13mMegTaYVxToeDvl/PNa+M5c=; b=RMrglpmgR2HBs4NzcCZYnC7g6PSWzHoNcu/BNReTL13tBryy2EeCZEXcvj3QLLo+el M1tkEZBHvkoeB6rxu8wZIGAz8Fqrsp813dokXuX6ZugUrGyRu9xgS2PUxPLnxHs0bC6W qxK7bYgnZ0GJj4bZRuQfVhPgpBOkNOUWUn74vk12IlYUIVjMcXPi2j6e4h71qDA1QD7H 7yzfBPK/mS1ExmOJnEsfdqtHhXAzvt3TK/68jCcNrgFgJ356QzsSHOlQjdeMcF52UMw9 Bdl5kr1Fl9gFaNt8gp96Gdm7zwlQbyrSWP7oQwF+U6arx53XLjhNrauzf/TXN7lRGsqi zNxA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ny6WxQK4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id jz6-20020a0562140e6600b0068f5fe88aa6si4877034qvb.34.2024.02.26.03.17.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Feb 2024 03:17:46 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ny6WxQK4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1reYxM-0001ui-3R; Mon, 26 Feb 2024 06:15:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1reYxC-0001cd-Un for qemu-devel@nongnu.org; Mon, 26 Feb 2024 06:15:29 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1reYxA-0000Iu-Nt for qemu-devel@nongnu.org; Mon, 26 Feb 2024 06:15:26 -0500 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-33d6cc6d2fcso1885957f8f.2 for ; Mon, 26 Feb 2024 03:15:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708946121; x=1709550921; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lZ1MjFFP7CBRD+d2PVUAbb1TpM05+DB5Hf5IgGpJXgc=; b=ny6WxQK4rC/cP4TcHMA6eWsTI0awq7r9g4y1Yd2sJ/nmdqcjHdcAlaog3l/DUl65vH n8oG1tpyATPb5BdHfJgigXPO8ca7jgldi39wJzw3SAdr5n0sRdyE6hLJSJ/aWHib+Muc lBBEHdXz+D37uLVDsExxgqEB4H34WIA3Ivu7F0wtqNEvgcZxhPCYvM93oK4DQ3AjJXBs hwELeVI18ec9gQ9GiiLsMppZqTrB9HPLqSekclfZk+PFBU5ShMMit4u27Sph2I1mzevB ldsjYH38oVXR/WzGst7s9PBq9VwlRuo2vq/V++NtE0zC+l1DXA6UZDpuqlyhiNGuIgnP 2jqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708946121; x=1709550921; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lZ1MjFFP7CBRD+d2PVUAbb1TpM05+DB5Hf5IgGpJXgc=; b=hGatApEVlU0id34jO52otGftPUAHdSAizDWXA3h4WfzyRfBcc4GNCIACLV0gm62WYd 9ZROJyrN1de/EzQeUrtbl+JyG5PWJ2EbSCJhBn1tS1tR6JnIjbIMm9JvP2JGD0po7mfZ NDUKA1jb3DMqs4QlzikrwFSwKQAMQcnb0heeJOI8qbXdVTl1oshftZom4EZDeSFkuLJQ HA1cd2zgSmwkoNUkFAOPeDb+4mujzopDbT/WvyP4dJFTETt4P0sfZ4ixby1Y0s64dR30 QLwcErawgca0yzDbZMjrr1MIBivezNd7E4D2BDFUx+PL0TByHF8M14wxzDYyTCJCoPm7 /1XQ== X-Gm-Message-State: AOJu0Yw9eD2fgRR4uRwAOi8Kn/ePvrMe4QxfW4Nux7h2EdH65pRxDd1/ Z1nmsAIlb3Lykx828/yIOpSdBOGPg58gjJ1v778L7Z2QXbZV+lzekW4oYxf8ncKMWKjSELokbZ2 / X-Received: by 2002:adf:db07:0:b0:33d:82ae:67f8 with SMTP id s7-20020adfdb07000000b0033d82ae67f8mr4697015wri.50.1708946121143; Mon, 26 Feb 2024 03:15:21 -0800 (PST) Received: from m1x-phil.lan ([176.176.164.69]) by smtp.gmail.com with ESMTPSA id z6-20020a5d4d06000000b0033d873f08d4sm7910526wrt.98.2024.02.26.03.15.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 26 Feb 2024 03:15:20 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Bernhard Beschow Cc: Laurent Vivier , Thomas Huth , BALATON Zoltan , Ani Sinha , qemu-block@nongnu.org, Marcel Apfelbaum , Eduardo Habkost , John Snow , Paolo Bonzini , "Michael S. Tsirkin" , Igor Mammedov , Richard Henderson , Mark Cave-Ayland , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH v2 10/15] hw/southbridge/ich9: Add the DMI-to-PCI bridge Date: Mon, 26 Feb 2024 12:14:09 +0100 Message-ID: <20240226111416.39217-11-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240226111416.39217-1-philmd@linaro.org> References: <20240226111416.39217-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+patch=linaro.org@nongnu.org Instantiate TYPE_ICH_DMI_PCI_BRIDGE in TYPE_ICH9_SOUTHBRIDGE. Since the Q35 machine doesn't use it, add the 'd2p-enabled' property to disable it. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/southbridge/ich9.h | 9 --------- hw/i386/pc_q35.c | 1 + hw/southbridge/ich9.c | 27 +++++++++++++++++++++++++++ hw/southbridge/Kconfig | 1 + 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/include/hw/southbridge/ich9.h b/include/hw/southbridge/ich9.h index 162ae3baa1..b9122d299d 100644 --- a/include/hw/southbridge/ich9.h +++ b/include/hw/southbridge/ich9.h @@ -108,15 +108,6 @@ struct ICH9LPCState { #define ICH9_USB_UHCI1_DEV 29 #define ICH9_USB_UHCI1_FUNC 0 -/* D30:F0 DMI-to-PCI bridge */ -#define ICH9_D2P_BRIDGE "ICH9 D2P BRIDGE" -#define ICH9_D2P_BRIDGE_SAVEVM_VERSION 0 - -#define ICH9_D2P_BRIDGE_DEV 30 -#define ICH9_D2P_BRIDGE_FUNC 0 - -#define ICH9_D2P_SECONDARY_DEFAULT (256 - 8) - /* D31:F0 LPC Processor Interface */ #define ICH9_RST_CNT_IOPORT 0xCF9 diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 8c8a2f65b8..f951cf1e3a 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -226,6 +226,7 @@ static void pc_q35_init(MachineState *machine) object_property_add_child(OBJECT(machine), "ich9", OBJECT(ich9)); object_property_set_link(OBJECT(ich9), "mch-pcie-bus", OBJECT(pcms->pcibus), &error_abort); + qdev_prop_set_bit(ich9, "d2p-enabled", false); qdev_realize_and_unref(ich9, NULL, &error_fatal); /* create ISA bus */ diff --git a/hw/southbridge/ich9.c b/hw/southbridge/ich9.c index f3a9b932ab..8c4356ff74 100644 --- a/hw/southbridge/ich9.c +++ b/hw/southbridge/ich9.c @@ -12,16 +12,23 @@ #include "hw/qdev-properties.h" #include "hw/southbridge/ich9.h" #include "hw/pci/pci.h" +#include "hw/pci-bridge/ich9_dmi.h" + +#define ICH9_D2P_DEVFN PCI_DEVFN(30, 0) struct ICH9State { DeviceState parent_obj; + I82801b11Bridge d2p; + PCIBus *pci_bus; + bool d2p_enabled; }; static Property ich9_props[] = { DEFINE_PROP_LINK("mch-pcie-bus", ICH9State, pci_bus, TYPE_PCIE_BUS, PCIBus *), + DEFINE_PROP_BOOL("d2p-enabled", ICH9State, d2p_enabled, true), DEFINE_PROP_END_OF_LIST(), }; @@ -29,6 +36,22 @@ static void ich9_init(Object *obj) { } +static bool ich9_realize_d2p(ICH9State *s, Error **errp) +{ + if (!module_object_class_by_name(TYPE_ICH_DMI_PCI_BRIDGE)) { + error_setg(errp, "DMI-to-PCI function not available in this build"); + return false; + } + object_initialize_child(OBJECT(s), "d2p", &s->d2p, TYPE_ICH_DMI_PCI_BRIDGE); + qdev_prop_set_int32(DEVICE(&s->d2p), "addr", ICH9_D2P_DEVFN); + if (!qdev_realize(DEVICE(&s->d2p), BUS(s->pci_bus), errp)) { + return false; + } + object_property_add_alias(OBJECT(s), "pci.0", OBJECT(&s->d2p), "pci.0"); + + return true; +} + static void ich9_realize(DeviceState *dev, Error **errp) { ICH9State *s = ICH9_SOUTHBRIDGE(dev); @@ -37,6 +60,10 @@ static void ich9_realize(DeviceState *dev, Error **errp) error_setg(errp, "'pcie-bus' property must be set"); return; } + + if (s->d2p_enabled && !ich9_realize_d2p(s, errp)) { + return; + } } static void ich9_class_init(ObjectClass *klass, void *data) diff --git a/hw/southbridge/Kconfig b/hw/southbridge/Kconfig index 852b7f346f..db7259bf6f 100644 --- a/hw/southbridge/Kconfig +++ b/hw/southbridge/Kconfig @@ -3,3 +3,4 @@ config ICH9 bool depends on PCI_EXPRESS + imply I82801B11