From patchwork Tue Nov 26 11:22:01 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: 845562 Delivered-To: patch@linaro.org Received: by 2002:a5d:6989:0:b0:382:43a8:7b94 with SMTP id g9csp155005wru; Tue, 26 Nov 2024 03:24:22 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU/MgmKy2PvHaxtW1HdHD+SEsb3VHUUx1IC8R7PL9h3ZnZjisY9zyfeikhLNhxO76N0eye4IA==@linaro.org X-Google-Smtp-Source: AGHT+IFUEsSFzN2VQrbgDf/XgdgzG8ObWl/Tt5+5CFl/j0/7lQu+3kNbPkFky3zJHH/AvG3y4fiK X-Received: by 2002:a05:620a:4448:b0:7b1:5424:e994 with SMTP id af79cd13be357-7b5144e639dmr2255825185a.26.1732620262184; Tue, 26 Nov 2024 03:24:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732620262; cv=none; d=google.com; s=arc-20240605; b=Qj8eY/bIqaAIglNY4C1zTDZ11azKrYitmyHHrr4fy0ZadEjyQgb2UilYcVl/2EswP4 zPguyPp/XDQWrOYecbYanNEejQFjaO0oS9+d3sUWegAmAV62P+rjnlLoqI6aTQMJkKQq zoH93goEInNCkt7bkNCJurNPMksBpegZC8JBT76WOjTfszeoVtDay/HrvaAIPGfDZEK6 FZLwVMlKPxMhJcumtdizeOfwdNXt3cIDSt+I51KTMnbdkhR3x3pcrq9qob5W4SSrVkwE eDsHdfmJAvawZC1CxsAXYdXCxDnF6x9PoAyFnJVQo1TLRp/ddZXt60808FouIQ+wyfe4 iS3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=XytEl+ZiAvdgFcp20ox+30b5Cy75Cc7byEhOtvETzBY=; fh=siS/4HMv/4Bjpv+J3MqwgZ5TPB6jtxhL8giIGJt6+cQ=; b=G8yTS8SEORMTwbR9IxIMHGymKJP8PjEN4Hrms9ai7n34tEc76sve4DlItCrqQbg0RA u/3EkvVpyaWjf8jAfNcLtHeW54JGUiQ7y/PBT36u5LgzjdZULndSeJ9DskHq6HABa6uu 58y11BTLqQxlBLMq+itsLUgxfAG7U5oH2GdodBcyezbU3BEwoZn7wWwdaB/VU7+wLHd3 UdG+wS8smN75m5ku7ayLNSTm5FUrkBNESRfTHNr7axnbOTMpWnpAO7xpG+exWvpDsm3w BEfV7TeyupRhWrcoK0VnRwWK/7fsNisWd0HI//iSA236he9TCRnkTp/Fr5AsdHbdO3de Sy+A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ab6xEX7/"; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b657518999si989294085a.156.2024.11.26.03.24.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Nov 2024 03:24:22 -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="ab6xEX7/"; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tFteM-0003mH-1c; Tue, 26 Nov 2024 06:22:34 -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 1tFteJ-0003kP-Nm for qemu-devel@nongnu.org; Tue, 26 Nov 2024 06:22:31 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tFteG-0002bs-Tq for qemu-devel@nongnu.org; Tue, 26 Nov 2024 06:22:31 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-434a8640763so1939345e9.1 for ; Tue, 26 Nov 2024 03:22:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732620147; x=1733224947; 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=XytEl+ZiAvdgFcp20ox+30b5Cy75Cc7byEhOtvETzBY=; b=ab6xEX7/KSPKZkv7SByMMrs0kYhVjUQBBrRexX3FJdSh4nnpyuts4vH/QREzROZ6YY GX6pRdpJxZJFN5g3A/xKSAaFXtvkp7eo1B1g2iZuYZr80xU8kM0MMSQoNfYimvYrS7vD 5OzLv7yzecdjhWr11LqQsA6VlMJ1GPyILVu/gircI7+lUUoROLvRRGf5ZOlJEV8HTC7k 3NiUupdMlVS37Y9+FEiYuKCciVKITRwF1kbgZjtc+1nOAayjGShQlGuyzX7XtAY9D0uX lY5Kjgo7B0bNL5PlFDxf9Z8DlwQqH21i51lpwMsbwB9RauvG++djPSre1dsfyJSugINY 6lWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732620147; x=1733224947; 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=XytEl+ZiAvdgFcp20ox+30b5Cy75Cc7byEhOtvETzBY=; b=Co3o+MR7XU5F91Uk27rfOti51cyVknuBFdCGIFeu7+ITng3SCsF1VaotTVrMzjMR4+ ofch+bZN5+NCHqYbMpZ0Uq0zbQZbMCLs7Nb0rOKM89cTP8K6xquAdqm0cHVH0vdiwnKB z14VygmOCMZ7lj2zo6SEN/LhRci7hm19k6EQh6bxN80hnbXWOru635JcfURH5o12hVo4 TrQsUCgm20syke67eQV1v009sBZ+XHU1EYLjn/Icpp1Pp0y6pTMgivN11YiAnOUipqA9 35RAOY7r4fJ3Q6ffDUuTvBLCeK0T4b7N9kJp/DcAFAo9I4lZPbx9Xe3AFx/C5FsRVuFe ikDg== X-Gm-Message-State: AOJu0Yw3Gf2kOAZzUqG0oXZywytcfOsgroQwkykACzmsxShXCioxSrkq TjYdGoioRiLBqN4k/xNHKy4Em8Zt6ZF4oA3T1wfLsNgz9RhuZzqArWKi+XkbzwemLuZry+a4J06 m X-Gm-Gg: ASbGncupjYSrogwqSsB9qYCPvsWUXFw6imyJmT3ArnkCCytAS3lc93nd8ubnK701Fbd lnzH2AzlwLE1Ill+Bc3IXWpMqUdofQ16yl+5zxxaQeFMkvy52GnyX1RY0OW9Q5n18asYAHv1JnX odt0Tv9vQPAvNpeSaKI3M8UU9SOMLdHi5Ktm2UtUraqxNdDEXPkE3jmTlgi24wRHyDMIjDZuZOM SrXNxhtRV/1F+YnsAyQJZEqG02o32JMfoDWDDgLB2MeU2wlCxrosX+JQ7DIXB+yFKrxhBQS X-Received: by 2002:a05:600c:3b91:b0:434:a29d:6c71 with SMTP id 5b1f17b1804b1-434a29d6d6bmr39357155e9.27.1732620147073; Tue, 26 Nov 2024 03:22:27 -0800 (PST) Received: from localhost.localdomain ([176.176.143.205]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3825fb25d74sm13208001f8f.47.2024.11.26.03.22.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 26 Nov 2024 03:22:26 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, Thomas Huth , "Michael S. Tsirkin" , qemu-riscv@nongnu.org, Marcel Apfelbaum , Peter Maydell , qemu-arm@nongnu.org, Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH-for-10.0 v2 02/13] hw/pci-bridge: Initialize bridge with parent bus flags Date: Tue, 26 Nov 2024 12:22:01 +0100 Message-ID: <20241126112212.64524-3-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241126112212.64524-1-philmd@linaro.org> References: <20241126112212.64524-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.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 autolearn=unavailable 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 Bridged buses inherit their parent flag, except they can not be a root. Signed-off-by: Philippe Mathieu-Daudé --- hw/pci-bridge/pci_expander_bridge.c | 8 ++++++-- hw/pci/pci_bridge.c | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c index 07d411cff52..bbf615f544b 100644 --- a/hw/pci-bridge/pci_expander_bridge.c +++ b/hw/pci-bridge/pci_expander_bridge.c @@ -336,6 +336,7 @@ static bool pxb_dev_realize_common(PCIDevice *dev, enum BusType type, PXBDev *pxb = PXB_DEV(dev); DeviceState *ds, *bds = NULL; PCIBus *bus; + PCIBus *parent_bus = pci_get_bus(dev); const char *dev_name = NULL; Error *local_err = NULL; MachineState *ms = MACHINE(qdev_get_machine()); @@ -358,12 +359,15 @@ static bool pxb_dev_realize_common(PCIDevice *dev, enum BusType type, ds = qdev_new(type == CXL ? TYPE_PXB_CXL_HOST : TYPE_PXB_HOST); if (type == PCIE) { bus = pci_root_bus_new(ds, dev_name, NULL, NULL, 0, TYPE_PXB_PCIE_BUS); + bus->flags = parent_bus->flags & ~PCI_BUS_IS_ROOT; } else if (type == CXL) { bus = pci_root_bus_new(ds, dev_name, NULL, NULL, 0, TYPE_PXB_CXL_BUS); + bus->flags = parent_bus->flags & ~PCI_BUS_IS_ROOT; bus->flags |= PCI_BUS_CXL; PXB_CXL_DEV(dev)->cxl_host_bridge = PXB_CXL_HOST(ds); } else { bus = pci_root_bus_new(ds, "pxb-internal", NULL, NULL, 0, TYPE_PXB_BUS); + bus->flags = parent_bus->flags & ~PCI_BUS_IS_ROOT; bds = qdev_new("pci-bridge"); bds->id = g_strdup(dev_name); qdev_prop_set_uint8(bds, PCI_BRIDGE_DEV_PROP_CHASSIS_NR, pxb->bus_nr); @@ -371,8 +375,8 @@ static bool pxb_dev_realize_common(PCIDevice *dev, enum BusType type, } bus->parent_dev = dev; - bus->address_space_mem = pci_get_bus(dev)->address_space_mem; - bus->address_space_io = pci_get_bus(dev)->address_space_io; + bus->address_space_mem = parent_bus->address_space_mem; + bus->address_space_io = parent_bus->address_space_io; bus->map_irq = pxb_map_irq_fn; PCI_HOST_BRIDGE(ds)->bus = bus; diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c index 2c7bb1a5254..d47ded9e0cf 100644 --- a/hw/pci/pci_bridge.c +++ b/hw/pci/pci_bridge.c @@ -376,6 +376,7 @@ void pci_bridge_initfn(PCIDevice *dev, const char *typename) qbus_init(sec_bus, sizeof(br->sec_bus), typename, DEVICE(dev), br->bus_name); + sec_bus->flags = parent->flags & ~PCI_BUS_IS_ROOT; sec_bus->parent_dev = dev; sec_bus->map_irq = br->map_irq ? br->map_irq : pci_swizzle_map_irq_fn; sec_bus->address_space_mem = &br->address_space_mem;