From nobody Mon Feb 9 09:28:44 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1612228269; cv=none; d=zohomail.com; s=zohoarc; b=k+QAVeh4ZqiZpG3LlYXdjrAwRt1afnqPRR7JehNk2tSdj/j2dn7aFfa/uGzLvxwfbYzk8TnN6ITyIb5qebMV2RggoAVc/gol+KvFOdY4XCzHyyh+VCfhGlrfYC90cW9c2pn0w7xZVp+aspbYC0pyJACAJvhozAF90+LAPxCDGlo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612228269; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Z7Cu4SxWZ8LfcIbNWiD1ChbmJRQTKBUD1TZO1RSz96M=; b=L36xx2Alua7QfkTyxw1jF096GT9tZtx2Va2JitOVvOP2FiVDck5WIEfs+24k73n9nBv/Tt8avPzdNxr9BGaNwu8GmVRSPIfxc6MDSyEGFo+ezEAYE68XlYYnoWnhYiB3t+cUHDGZgQk9fifHQbvBHqtO99yi9KO2A8V3Lbbp8YQ= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161222826975834.22240188344642; Mon, 1 Feb 2021 17:11:09 -0800 (PST) Received: from localhost ([::1]:33198 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6kDk-0001fq-Lh for importer@patchew.org; Mon, 01 Feb 2021 20:11:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6k3F-0008NW-Mn for qemu-devel@nongnu.org; Mon, 01 Feb 2021 20:00:18 -0500 Received: from mga18.intel.com ([134.134.136.126]:33366) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6k3C-0001pl-Sm for qemu-devel@nongnu.org; Mon, 01 Feb 2021 20:00:17 -0500 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2021 17:00:03 -0800 Received: from jambrizm-mobl1.amr.corp.intel.com (HELO bwidawsk-mobl5.local) ([10.252.133.15]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2021 17:00:02 -0800 IronPort-SDR: 9pADIWwGqbGWaNObvIUay0f4+fZpmd4BSzlLItMbpTvj9cZ5Sxy7m7ffHX5OTPHKPXHiPBCjOq uLHOxvop2BBQ== X-IronPort-AV: E=McAfee;i="6000,8403,9882"; a="168457095" X-IronPort-AV: E=Sophos;i="5.79,393,1602572400"; d="scan'208";a="168457095" IronPort-SDR: 1tYPthxBJp+5IJLJM/J4PqEwVO8Fh0L1C3aEi0byhdJNvuYDCglGaPMNkSJGeCWqz2G802pfdk P8Q9YsIr0zqw== X-IronPort-AV: E=Sophos;i="5.79,393,1602572400"; d="scan'208";a="581764121" From: Ben Widawsky To: qemu-devel@nongnu.org Subject: [RFC PATCH v3 10/31] hw/pxb: Use a type for realizing expanders Date: Mon, 1 Feb 2021 16:59:27 -0800 Message-Id: <20210202005948.241655-11-ben.widawsky@intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210202005948.241655-1-ben.widawsky@intel.com> References: <20210202005948.241655-1-ben.widawsky@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=134.134.136.126; envelope-from=ben.widawsky@intel.com; helo=mga18.intel.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Ben Widawsky , David Hildenbrand , Vishal Verma , "John Groves \(jgroves\)" , Chris Browy , Markus Armbruster , linux-cxl@vger.kernel.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Jonathan Cameron , Igor Mammedov , Dan Williams , Ira Weiny Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This opens up the possibility for more types of expanders (other than PCI and PCIe). We'll need this to create a CXL expander. Signed-off-by: Ben Widawsky --- hw/pci-bridge/pci_expander_bridge.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expand= er_bridge.c index aedded1064..232b7ce305 100644 --- a/hw/pci-bridge/pci_expander_bridge.c +++ b/hw/pci-bridge/pci_expander_bridge.c @@ -24,6 +24,8 @@ #include "hw/boards.h" #include "qom/object.h" =20 +enum BusType { PCI, PCIE }; + #define TYPE_PXB_BUS "pxb-bus" typedef struct PXBBus PXBBus; DECLARE_INSTANCE_CHECKER(PXBBus, PXB_BUS, @@ -214,7 +216,8 @@ static gint pxb_compare(gconstpointer a, gconstpointer = b) 0; } =20 -static void pxb_dev_realize_common(PCIDevice *dev, bool pcie, Error **errp) +static void pxb_dev_realize_common(PCIDevice *dev, enum BusType type, + Error **errp) { PXBDev *pxb =3D convert_to_pxb(dev); DeviceState *ds, *bds =3D NULL; @@ -239,7 +242,7 @@ static void pxb_dev_realize_common(PCIDevice *dev, bool= pcie, Error **errp) } =20 ds =3D qdev_new(TYPE_PXB_HOST); - if (pcie) { + if (type =3D=3D PCIE) { bus =3D pci_root_bus_new(ds, dev_name, NULL, NULL, 0, TYPE_PXB_PCI= E_BUS); } else { bus =3D pci_root_bus_new(ds, "pxb-internal", NULL, NULL, 0, TYPE_P= XB_BUS); @@ -287,7 +290,7 @@ static void pxb_dev_realize(PCIDevice *dev, Error **err= p) return; } =20 - pxb_dev_realize_common(dev, false, errp); + pxb_dev_realize_common(dev, PCI, errp); } =20 static void pxb_dev_exitfn(PCIDevice *pci_dev) @@ -339,7 +342,7 @@ static void pxb_pcie_dev_realize(PCIDevice *dev, Error = **errp) return; } =20 - pxb_dev_realize_common(dev, true, errp); + pxb_dev_realize_common(dev, PCIE, errp); } =20 static void pxb_pcie_dev_class_init(ObjectClass *klass, void *data) --=20 2.30.0