From patchwork Thu Jan 5 13:07:03 2023 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: 13089841 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 53617C54E76 for ; Thu, 5 Jan 2023 13:09:19 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pDPxq-0004B5-Eh; Thu, 05 Jan 2023 08:07:22 -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 1pDPxo-0004Ax-LH for qemu-devel@nongnu.org; Thu, 05 Jan 2023 08:07:20 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDPxn-0004FG-3X for qemu-devel@nongnu.org; Thu, 05 Jan 2023 08:07:20 -0500 Received: by mail-wm1-x32f.google.com with SMTP id p1-20020a05600c1d8100b003d8c9b191e0so1244453wms.4 for ; Thu, 05 Jan 2023 05:07:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=9bzKDU+QhZIYaALyoUGzm3s2plmjJ1qhwx3qEViOyr0=; b=vPm5fUvXOnr8MOtRKHhoPAjhAAPxDrW0+y/SzrOad2NcDMSpG7YTh2Me4LVIkc6YMZ V8wx9VM2h0KM1eOp9QPC0k5jSQ5TkGJjgaf1s1tbEi4SWGYm8iOyQ8IUt3qksAAxe9qw Eox3jNTyFfP0FD60prTbeAfUIk8B1a/6vV+pz4fVEMfUxeiFmZNuOBI9lNQjq4VuCDRT WsdKvQuSy8gB/3tYiEJJUneivXZ9zD5Q9xMjHPld/+RPrdyEJayAt3ZLELewevAyjCr1 AGUvQ/GbRO8lE2jcbYx1zmbnLZVgPqRfOw8hJC2Ka30qqQDPLFDy6Kdxauy6NdZuK365 Segw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=9bzKDU+QhZIYaALyoUGzm3s2plmjJ1qhwx3qEViOyr0=; b=kOClj+dhxUQoHPek0hb6/gruk7HaX7SH++4l4F9h2oz3+FFuAvWJQazCyyo0Y6gIVi 7Mu5Kc+3d5/NjENjeIcIecwip2D7UB52vfXLzAl4pJIAybaILk9kWv/nRgk1vflEIqzd GVc9K/ETCiupJFlBn2hBslUf7lMXUpsedo5uHEdqyHkKzJBYbdeZ/roUXTkJev//u0lZ ZhjeyjQcsB3DePjqqQn7lQNrI8C0BrXkbnBU7Tp5d9xBMlerBsxyTG237GECjN9UsFj1 ExnmELCXQXveo+UaKVZP4bbtu4yxAQETWvWXrsbTicvs0r/XswVgpSTHUioaUiJZfEt7 Z8Lg== X-Gm-Message-State: AFqh2kqkmSq3ysRpwPaWmnY/a53WVkha9KF6iKINeLv7BhLdZDW356Xy vbfoYuj41pQ1PGb4ofVwOoL+LRKHPBtEIdEN X-Google-Smtp-Source: AMrXdXunnNE+7HFY6+UufQovmenRYdzFpeg39ejVgFq/zCf5qH5BAYJQRAirCstIiZUw6KDvsQVJTA== X-Received: by 2002:a05:600c:4e07:b0:3d3:5319:b6d3 with SMTP id b7-20020a05600c4e0700b003d35319b6d3mr36697329wmq.38.1672924037429; Thu, 05 Jan 2023 05:07:17 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id bj11-20020a0560001e0b00b002a6f329203esm3845012wrb.61.2023.01.05.05.07.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 05 Jan 2023 05:07:17 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Huacai Chen , Bernhard Beschow , Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH 1/8] hw/pci-host/bonito: Convert to 3-phase reset Date: Thu, 5 Jan 2023 14:07:03 +0100 Message-Id: <20230105130710.49264-2-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230105130710.49264-1-philmd@linaro.org> References: <20230105130710.49264-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.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=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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Philippe Mathieu-Daudé Convert the TYPE_PCI_BONITO class to use 3-phase reset. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/pci-host/bonito.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index a57e81e3a9..b0d09c85d0 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -47,7 +47,6 @@ #include "hw/mips/mips.h" #include "hw/pci/pci_host.h" #include "migration/vmstate.h" -#include "sysemu/reset.h" #include "sysemu/runstate.h" #include "hw/misc/unimp.h" #include "hw/registerfields.h" @@ -593,9 +592,9 @@ static int pci_bonito_map_irq(PCIDevice *pci_dev, int irq_num) } } -static void bonito_reset(void *opaque) +static void bonito_reset_hold(Object *obj) { - PCIBonitoState *s = opaque; + PCIBonitoState *s = PCI_BONITO(obj); uint32_t val = 0; /* set the default value of north bridge registers */ @@ -739,8 +738,6 @@ static void bonito_realize(PCIDevice *dev, Error **errp) pci_set_byte(dev->config + PCI_MIN_GNT, 0x3c); pci_set_byte(dev->config + PCI_MAX_LAT, 0x00); - - qemu_register_reset(bonito_reset, s); } PCIBus *bonito_init(qemu_irq *pic) @@ -770,7 +767,9 @@ static void bonito_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); + ResettableClass *rc = RESETTABLE_CLASS(klass); + rc->phases.hold = bonito_reset_hold; k->realize = bonito_realize; k->vendor_id = 0xdf53; k->device_id = 0x00d5; From patchwork Thu Jan 5 13:07:04 2023 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: 13089837 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 66277C3DA7A for ; Thu, 5 Jan 2023 13:08:08 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pDPxv-0004CA-9L; Thu, 05 Jan 2023 08:07:27 -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 1pDPxt-0004BZ-Fz for qemu-devel@nongnu.org; Thu, 05 Jan 2023 08:07:25 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDPxs-0004Fz-1O for qemu-devel@nongnu.org; Thu, 05 Jan 2023 08:07:25 -0500 Received: by mail-wm1-x32d.google.com with SMTP id bg13-20020a05600c3c8d00b003d9712b29d2so1267456wmb.2 for ; Thu, 05 Jan 2023 05:07:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=2LQQtF6mRwowaB8cMgADklf0rC+6ac5gfQ1xXYhmt1U=; b=fab5WOaHaFzusPOu6s5XqZeEdYjzSX1/z1hAHXHX/OX+a5nF66nKV09HJ7ixBIFPY0 i4lJQZGy+KBkNDj41Xr6vl2hBm6LWl+Mws66LRfupf1z2wFXiQJw55fb+gKvDRduU/zX mK5b2jJ/PwHtQAu6vgVvuylKWPOK6SG5nP+968tQ0MKjHfcwdwaeLBHgDd6LN5sL9xkC dWCtWszITLqFYTR1w37tWbHf3Xzfksl2QppUXcZ6J8Oc3+/YUQwQiW6XkzK4IpUJMYBb +eGlqbOhZWlWUoSdf+6RKxOHXyxWvmJb5x3a/9CMvoGwyBtzJ66sQN+CeLbV+qOBf2K9 puHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=2LQQtF6mRwowaB8cMgADklf0rC+6ac5gfQ1xXYhmt1U=; b=ysBP9cz5/ot6UHBG3LJ2R6diU5RFsSDLhXF5xFsl0+5u1ZZ7RcIgOQSqGCPMNmBSkz T7/rslLGVr3gjUSl4cXSmGBeA6p0R0uKQLmeYXGx+8EzgXDHO4dfzxrxgHhrvnLzfMeP CNpMK+DjQy7wSqNRbxsRWC5ZzEEpAgyCvXxaGHzp7QZN5tgKcm8hG0rlBRnhGEWmDLRf yK1T6VxqNPGmpC7AbIpvwPX1HRdEUjJxt0ItvJVDGhODSnnP7PwfBH4YrpVZUIyvw27w /231btu3ilAaNA2gwzucqudsQ5V+T6AzuUV8N/tVod3DGp10m4JeRrfKzInedytGjQsg bJhQ== X-Gm-Message-State: AFqh2kp7ccmNv1e8d148oe7+qafuNdqM7PXDgvEh+vcgJiUdo1+ThNx/ ZLOqLuZRetbOTbnm5rPB/S3zCsDzP6DOW3U2 X-Google-Smtp-Source: AMrXdXuSQqa2trccbPf4aM7VbMdS5qT97PBZXgvT5z0i6qCohOr3WxUMmFLvvM2GkITEPDzBi1zXjg== X-Received: by 2002:a05:600c:16c5:b0:3d1:f687:1fd0 with SMTP id l5-20020a05600c16c500b003d1f6871fd0mr36512864wmn.12.1672924042358; Thu, 05 Jan 2023 05:07:22 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id j1-20020a05600c1c0100b003cfaae07f68sm2650283wms.17.2023.01.05.05.07.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 05 Jan 2023 05:07:22 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Huacai Chen , Bernhard Beschow , Jiaxun Yang Subject: [PATCH 2/8] hw/pci-host/bonito: Use 'bonito_host' for PCI host bridge code Date: Thu, 5 Jan 2023 14:07:04 +0100 Message-Id: <20230105130710.49264-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230105130710.49264-1-philmd@linaro.org> References: <20230105130710.49264-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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=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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org To make it easier to differentiate between the Host Bridge object and its PCI function #0, rename bonito_pcihost* as bonito_host*. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/pci-host/bonito.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index b0d09c85d0..a804731f49 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -627,7 +627,7 @@ static const VMStateDescription vmstate_bonito = { } }; -static void bonito_pcihost_realize(DeviceState *dev, Error **errp) +static void bonito_host_realize(DeviceState *dev, Error **errp) { PCIHostState *phb = PCI_HOST_BRIDGE(dev); BonitoState *bs = BONITO_PCI_HOST_BRIDGE(dev); @@ -795,23 +795,23 @@ static const TypeInfo bonito_info = { }, }; -static void bonito_pcihost_class_init(ObjectClass *klass, void *data) +static void bonito_host_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - dc->realize = bonito_pcihost_realize; + dc->realize = bonito_host_realize; } -static const TypeInfo bonito_pcihost_info = { +static const TypeInfo bonito_host_info = { .name = TYPE_BONITO_PCI_HOST_BRIDGE, .parent = TYPE_PCI_HOST_BRIDGE, .instance_size = sizeof(BonitoState), - .class_init = bonito_pcihost_class_init, + .class_init = bonito_host_class_init, }; static void bonito_register_types(void) { - type_register_static(&bonito_pcihost_info); + type_register_static(&bonito_host_info); type_register_static(&bonito_info); } From patchwork Thu Jan 5 13:07:05 2023 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: 13089836 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id E1E48C3DA7D for ; Thu, 5 Jan 2023 13:07:56 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pDPy0-0004KW-7t; Thu, 05 Jan 2023 08:07:32 -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 1pDPxy-0004FQ-Ls for qemu-devel@nongnu.org; Thu, 05 Jan 2023 08:07:30 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDPxw-0004Gb-Q0 for qemu-devel@nongnu.org; Thu, 05 Jan 2023 08:07:30 -0500 Received: by mail-wr1-x432.google.com with SMTP id bs20so33960038wrb.3 for ; Thu, 05 Jan 2023 05:07:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=tCZjTrjK3GXyfOZTeSp83EZ0svOoUH+ua/AMM4VRkZ0=; b=BkFp411HDvBFYgI5Jw+qZ7OG9s+xWYLHxdEQnm371vCC87kndx3bAcbjPwWrW//d0E A5fBJs+A+K3xQlTPLKuEc3ylx1EGyjH1/N+aFggZdth1omQ7tsV4JqJzVunYlwLJhnKl ivgsZrJZfrHreIAWIrfDR1pHrk0yQeexumjHtU4YqrWj6xMUl+4B4YRQRwTQrfNdjN9W 14UUCP/31kFSgf3lodYQvPtAa452v61k1+Mvs3pqcFGVd8RLvKRYBQDJOpYkh74ZnMzF A4Yu1RjanMfME3mQDnDTJd68MZJMKcccWbqtbnouedPPh4wo5aUmJRTZJcDzBKdpd3zF TKZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=tCZjTrjK3GXyfOZTeSp83EZ0svOoUH+ua/AMM4VRkZ0=; b=Zt0EMcaUDVpez0zIgG1HfiZ3no5tDAIcqNbRDoVIzFQs/OqB92uN9QErsqyWgElLpA i2YdKeZvLkXOc5gINmAIdTbxgQucBS/SOnlrU2/EbIuqAGB7dfikWwtmTnId29rpbg9U LlZsy2rFWTgTjYC5TjvH8sLh6i0tQ8kgkzGQLtb5P1VZX1M7dV0QK8XPCW8DAUO51BXg JjGlhy4ION+0NpqRkM+AtBaLRJuJ6vyEnoI76JCMha82USHUMGBze4Cbyv5Pc9+yyecS bZpOJjul5OtNaIXR+eMd2+GtTZr9rrvQVYIw0OD23p6tOpFVgyW0Hp7OusE7au51QrCZ 8VeA== X-Gm-Message-State: AFqh2koeXRkK9O1KdcoxksjbdAM5H5HadpURrQ580nBbgWIyKxAvahBB zmRsm6ZdLtU8NInqC+HMrEelyTDVxxSIanzl X-Google-Smtp-Source: AMrXdXs0MQngbw9IihUoOzHQRNrF40hRr/8IM752SI+6Qa6slzL4SKAsiueGXjTKS/6FoNTc6dZEzw== X-Received: by 2002:a5d:5a19:0:b0:242:1ef7:9ad5 with SMTP id bq25-20020a5d5a19000000b002421ef79ad5mr35280183wrb.68.1672924047021; Thu, 05 Jan 2023 05:07:27 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id cc15-20020a5d5c0f000000b00298d87b6309sm11823514wrb.78.2023.01.05.05.07.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 05 Jan 2023 05:07:26 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Huacai Chen , Bernhard Beschow , Jiaxun Yang Subject: [PATCH 3/8] hw/pci-host/bonito: Use 'bonito_pci' for PCI function #0 code Date: Thu, 5 Jan 2023 14:07:05 +0100 Message-Id: <20230105130710.49264-4-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230105130710.49264-1-philmd@linaro.org> References: <20230105130710.49264-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.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=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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org To make it easier to differentiate between the Host Bridge object and its PCI function #0, rename bonito* as bonito_pci*. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/pci-host/bonito.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index a804731f49..80ec424f86 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -617,7 +617,7 @@ static void bonito_reset_hold(Object *obj) s->regs[BONITO_PCIMAP] = 0x6140; } -static const VMStateDescription vmstate_bonito = { +static const VMStateDescription vmstate_bonito_pci = { .name = "Bonito", .version_id = 1, .minimum_version_id = 1, @@ -653,7 +653,7 @@ static void bonito_host_realize(DeviceState *dev, Error **errp) create_unimplemented_device("pci.io", BONITO_PCIIO_BASE, 1 * MiB); } -static void bonito_realize(PCIDevice *dev, Error **errp) +static void bonito_pci_realize(PCIDevice *dev, Error **errp) { PCIBonitoState *s = PCI_BONITO(dev); SysBusDevice *sysbus = SYS_BUS_DEVICE(s->pcihost); @@ -763,20 +763,20 @@ PCIBus *bonito_init(qemu_irq *pic) return phb->bus; } -static void bonito_class_init(ObjectClass *klass, void *data) +static void bonito_pci_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); ResettableClass *rc = RESETTABLE_CLASS(klass); rc->phases.hold = bonito_reset_hold; - k->realize = bonito_realize; + k->realize = bonito_pci_realize; k->vendor_id = 0xdf53; k->device_id = 0x00d5; k->revision = 0x01; k->class_id = PCI_CLASS_BRIDGE_HOST; dc->desc = "Host bridge"; - dc->vmsd = &vmstate_bonito; + dc->vmsd = &vmstate_bonito_pci; /* * PCI-facing part of the host bridge, not usable without the * host-facing part, which can't be device_add'ed, yet. @@ -784,11 +784,11 @@ static void bonito_class_init(ObjectClass *klass, void *data) dc->user_creatable = false; } -static const TypeInfo bonito_info = { +static const TypeInfo bonito_pci_info = { .name = TYPE_PCI_BONITO, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(PCIBonitoState), - .class_init = bonito_class_init, + .class_init = bonito_pci_class_init, .interfaces = (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, { }, @@ -812,7 +812,7 @@ static const TypeInfo bonito_host_info = { static void bonito_register_types(void) { type_register_static(&bonito_host_info); - type_register_static(&bonito_info); + type_register_static(&bonito_pci_info); } type_init(bonito_register_types) From patchwork Thu Jan 5 13:07:06 2023 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: 13089835 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 03FD4C3DA7A for ; Thu, 5 Jan 2023 13:07:57 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pDPyJ-0004RF-Mo; Thu, 05 Jan 2023 08:07:52 -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 1pDPy3-0004Pk-Ii for qemu-devel@nongnu.org; Thu, 05 Jan 2023 08:07:35 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDPy1-0004H3-O7 for qemu-devel@nongnu.org; Thu, 05 Jan 2023 08:07:35 -0500 Received: by mail-wr1-x42c.google.com with SMTP id az7so11665637wrb.5 for ; Thu, 05 Jan 2023 05:07:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=g9+vx6ckYIqNiK6kSQbDp2C/LOtZEZcv8fwDtklzB2Y=; b=rprm4epUEkcHvL4o606+D421l9uZnnvEFbB4F6MCEEkfRgK7/ChG0xHcg7i9uJ4whz S+EEUp9xo/tGKlzjaHbha1FrGlXIvhguBJNDEtEFl6HPAUHQV4DAG15UtlnXbNECT1LG ZfnK0TANI+NP0cj75ByXOoi8oqzv2NtaF2gqMCwcwHJMh1Bvfl9G95voOPsCkTj6b0fg 9IgYC8fETYx+ZaSskh/mqzvIVHNrRfmQrk32+JDKQ2ZEngD6Mc3Fa2H5uM/jUcfB7cFB 6lR3uJl+BVfl2dEd1e+UJiQTEvmb/rDxz/e0B0OXy2hNggW4D2ac+xNZ5NVovg+z4qVj hbGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=g9+vx6ckYIqNiK6kSQbDp2C/LOtZEZcv8fwDtklzB2Y=; b=JZF91zyWy9QSeDLr3NGQizTcTAHv1ehtVupMv9K4J1ztpkl3W8tqH2T7WYzGsDH2Vd bzh3NoQh2c+7cpD75Hat20D3WZn02yt8cugp49ppEFOQcaznY/IchTZNIWVGjBvSCtB5 GftMfD3iYFW89lqbLlT7zpky7VpXJe+fkNh8qaAnTTwKUC+W2erD2NB90TA5bJBDhDhE 7AQ6pr5C4oQTKD3xK+DGHz7J4ZOvt6j7TGq2vWZR6NbRH6LcDCJ6lN7HyK/qLnflshRr Rk/zfpv4sQRoH3oS4G+OxwFfQfUC0704V3Uq5QVgLP9NwXm5Mby9dWcOuIHrk37e6W8g mVFA== X-Gm-Message-State: AFqh2krJx38t6r9bF+M9HSLhQW3vTi3eL6U023RMkdfHxJ0XE6rF7vaw DOx5wLvyAQzAESlhI2plXhIRRB7roj3jzrv3 X-Google-Smtp-Source: AMrXdXuAOFzH05Pn1iUQ6WjKIEE/1k1fdE+mBnvn+5axhhskfiWraCWM2HVCR2wyjZhNYid6YK0K7w== X-Received: by 2002:a5d:6dc1:0:b0:242:3353:26ed with SMTP id d1-20020a5d6dc1000000b00242335326edmr28423582wrz.62.1672924051802; Thu, 05 Jan 2023 05:07:31 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id ba13-20020a0560001c0d00b002a91572638csm3427875wrb.75.2023.01.05.05.07.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 05 Jan 2023 05:07:31 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Huacai Chen , Bernhard Beschow , Jiaxun Yang Subject: [PATCH 4/8] hw/pci-host/bonito: Set reference using object_property_add_const_link() Date: Thu, 5 Jan 2023 14:07:06 +0100 Message-Id: <20230105130710.49264-5-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230105130710.49264-1-philmd@linaro.org> References: <20230105130710.49264-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philmd@linaro.org; helo=mail-wr1-x42c.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=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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org A QOM object shouldn't poke at another object internals. Here the PCI host bridge instantiates its PCI function #0 and sets a reference to itself (so the function can access the bridge fields). Pass this reference with object_property_add_const_link(), since the reference won't change during the object lifetime. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/pci-host/bonito.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index 80ec424f86..d881c85509 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -656,10 +656,17 @@ static void bonito_host_realize(DeviceState *dev, Error **errp) static void bonito_pci_realize(PCIDevice *dev, Error **errp) { PCIBonitoState *s = PCI_BONITO(dev); - SysBusDevice *sysbus = SYS_BUS_DEVICE(s->pcihost); - PCIHostState *phb = PCI_HOST_BRIDGE(s->pcihost); - BonitoState *bs = BONITO_PCI_HOST_BRIDGE(s->pcihost); MemoryRegion *pcimem_alias = g_new(MemoryRegion, 1); + SysBusDevice *sysbus; + PCIHostState *phb; + BonitoState *bs; + Object *obj; + + obj = object_property_get_link(OBJECT(dev), "host-bridge", &error_abort); + s->pcihost = BONITO_PCI_HOST_BRIDGE(obj); + sysbus = SYS_BUS_DEVICE(obj); + phb = PCI_HOST_BRIDGE(obj); + bs = BONITO_PCI_HOST_BRIDGE(obj); /* * Bonito North Bridge, built on FPGA, @@ -745,7 +752,6 @@ PCIBus *bonito_init(qemu_irq *pic) DeviceState *dev; BonitoState *pcihost; PCIHostState *phb; - PCIBonitoState *s; PCIDevice *d; dev = qdev_new(TYPE_BONITO_PCI_HOST_BRIDGE); @@ -755,10 +761,9 @@ PCIBus *bonito_init(qemu_irq *pic) sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); d = pci_new(PCI_DEVFN(0, 0), TYPE_PCI_BONITO); - s = PCI_BONITO(d); - s->pcihost = pcihost; - pcihost->pci_dev = s; + object_property_add_const_link(OBJECT(d), "host-bridge", OBJECT(dev)); pci_realize_and_unref(d, phb->bus, &error_fatal); + pcihost->pci_dev = PCI_BONITO(d); return phb->bus; } From patchwork Thu Jan 5 13:07:07 2023 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: 13089844 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 04E34C3DA7D for ; Thu, 5 Jan 2023 13:11:10 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pDPyN-0004cf-3b; Thu, 05 Jan 2023 08:07:55 -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 1pDPy7-0004Qw-Rv for qemu-devel@nongnu.org; Thu, 05 Jan 2023 08:07:40 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDPy6-0004Hz-5i for qemu-devel@nongnu.org; Thu, 05 Jan 2023 08:07:39 -0500 Received: by mail-wr1-x434.google.com with SMTP id d4so28085762wrw.6 for ; Thu, 05 Jan 2023 05:07:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=0b6s6o5206pTndNparQo6CPOMKbDBezGjOtaupQnzDA=; b=o8uMe4XO74xL6WJIEnzxIkPbS9rW9JejOJURNPhLukbAv2XNcePRMqI67WpwStRYKU q7nsublbLRICfRuVCpjNFbpn1bDZdj+rBQS4TOLGX/umkOpYaH1fF8MXAG4m2Jz9KWAD mzTGNuYs4B0MNoCV75klOxoIDca64JAIuJ15/BdOij+qMlaxrf9Qj9bRbv/9iYv9w7jj IwsGjTe6kvIhOxRhVkdb2cVKGS7/RJA5p6UbLxFRn7GuXatRPaMzxLnjYoNogKih03YN zVC8ctDHr0v3cqyGChFD5WKcIy+yqY4lgK7hbRvppYhdkjK9bzZCTLfTQCX3svNVp+eX rLoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=0b6s6o5206pTndNparQo6CPOMKbDBezGjOtaupQnzDA=; b=GFvW/goaQGKwG9TSEJ0gbciS9Mv4OY5ATbh/Z/bOroppNIIoyCVi3fLXLRa2NnGQrj aWkzhWWoogofuQSGLZlnVkVcc811rrRYx3tVIUn8AOIrlJeGR7axpFBuPUSA7ZPDRcfS 3G8WmK/kURC+Mm7nljS1GEZ8cM211SzBxw8ntW50GCFL12+mXOWxcoXqqJl0s2bJT0X3 i8XnUtkQXOfB9j3hPIHGOWt/huo/+4jmHftgjqXeDZSkTIjHHidEn9TgSJwq6cGXQQ4h igjKr66nshS69jd0rbEq7o/qBDhYjCZ+ZKps9sZPx1nsQf9WvGaB0NiO68O5UkNEMXy5 VKPA== X-Gm-Message-State: AFqh2kpTtYQqsPDb3VEIbbFaz6WinP/ZD1/RbYMMv0Bl8G9t65MdezeZ kUsVl3fMeNCYDd22KxeDJOwsOLfCUx3KpR03 X-Google-Smtp-Source: AMrXdXvPYAlUrUKKaXDmXe8zgK71LiCYXtu5r89KBBrYJCCTnKnYAEqVj1rl4LvUMoTHMoTUp75LvQ== X-Received: by 2002:adf:e703:0:b0:242:48df:b4da with SMTP id c3-20020adfe703000000b0024248dfb4damr29241943wrm.42.1672924056585; Thu, 05 Jan 2023 05:07:36 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id n41-20020a05600c502900b003cf6a55d8e8sm2430200wmr.7.2023.01.05.05.07.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 05 Jan 2023 05:07:36 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Huacai Chen , Bernhard Beschow , Jiaxun Yang Subject: [PATCH 5/8] hw/pci-host/bonito: Create PCI function #0 in bridge realize() handler Date: Thu, 5 Jan 2023 14:07:07 +0100 Message-Id: <20230105130710.49264-6-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230105130710.49264-1-philmd@linaro.org> References: <20230105130710.49264-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.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=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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The PCI function #0 is an integral part of the PCI bridge, instantiate it internally during the bridge creation. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/pci-host/bonito.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index d881c85509..7722636e9e 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -651,6 +651,11 @@ static void bonito_host_realize(DeviceState *dev, Error **errp) } create_unimplemented_device("pci.io", BONITO_PCIIO_BASE, 1 * MiB); + + bs->pci_dev = PCI_BONITO(pci_new(PCI_DEVFN(0, 0), TYPE_PCI_BONITO)); + object_property_add_const_link(OBJECT(bs->pci_dev), "host-bridge", + OBJECT(bs)); + pci_realize_and_unref(PCI_DEVICE(bs->pci_dev), phb->bus, &error_fatal); } static void bonito_pci_realize(PCIDevice *dev, Error **errp) @@ -752,7 +757,6 @@ PCIBus *bonito_init(qemu_irq *pic) DeviceState *dev; BonitoState *pcihost; PCIHostState *phb; - PCIDevice *d; dev = qdev_new(TYPE_BONITO_PCI_HOST_BRIDGE); phb = PCI_HOST_BRIDGE(dev); @@ -760,11 +764,6 @@ PCIBus *bonito_init(qemu_irq *pic) pcihost->pic = pic; sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - d = pci_new(PCI_DEVFN(0, 0), TYPE_PCI_BONITO); - object_property_add_const_link(OBJECT(d), "host-bridge", OBJECT(dev)); - pci_realize_and_unref(d, phb->bus, &error_fatal); - pcihost->pci_dev = PCI_BONITO(d); - return phb->bus; } From patchwork Thu Jan 5 13:07:08 2023 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: 13089840 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 79751C53210 for ; Thu, 5 Jan 2023 13:09:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pDPyO-0004g5-7o; Thu, 05 Jan 2023 08:07:56 -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 1pDPyD-0004UY-F9 for qemu-devel@nongnu.org; Thu, 05 Jan 2023 08:07:52 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDPyA-0004FG-O8 for qemu-devel@nongnu.org; Thu, 05 Jan 2023 08:07:44 -0500 Received: by mail-wm1-x32f.google.com with SMTP id p1-20020a05600c1d8100b003d8c9b191e0so1245233wms.4 for ; Thu, 05 Jan 2023 05:07:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=YGzLuFXxs66myFiViWu8pKjRIb3GrnDWVImC+7rq5TU=; b=wEnakYLUZ0LfXT6ixrHVyg3p1hiUtefBqTcnU+Z3uTcaGU8ab/crLYlEvUg3x8oacx CIDJmzJOU5mCsDsXTGcsmHaE8Cp6t9K9m8HoxDJiX71ROXTJQC9havAWHZsppQbWZ6pS g4565JYhImT2KqmVPMTHVPhQxLF+e1Q/wmEvWXi5mW3Vaf0nTrlVoDyBi7QCqvsVTXlr y77ZaKYAdKFQ7l7F3+ClA9qj25A27bhLNGN5yqqfoLW5//usTKYKKSmIWqEBkNgJ7mCn n1jcbGV1spR0bRBYz+Y5iXQQzLO1m9UT3yOuJLNvAdqyo4GZR0m5g3aJv5tpdflLrcSM HliA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=YGzLuFXxs66myFiViWu8pKjRIb3GrnDWVImC+7rq5TU=; b=zJtK4tVFRWcPRbmdANxWxHvGpxXOVYSJ3Ps4EfnzsDJtCG8MBARVp1nKIXytRBN3Rk p7dXKWS/Is1VgVr8aGcHhgrVQuuqt9+7vAq78nFPV6AekgoXxr4fY/Eyh8tRRZLNOw3K WtAKoYsKDTvM6as0/8Gxn/sp++FwS9G7yRdJR7WHdIiBMpIOlXSsZcVqp/WiuVJ9i0Bi HaP0noyQe1looM9IOmM+OZh73iYtYxu0CNv/AJWu8FQK6PQu3L8W1Wc0JZ+3/+1doOor BUBhxI5V4d4cW3sj56kYuYWgoetS8OzcVHc8f2+wyyQHCHBjMLyUK9x4cZHUVBM1b69S x/Mw== X-Gm-Message-State: AFqh2kqprk2asgpNUjNXELqRmwqLJKIV3SWxKkvfoU6gj0ojdt147D5w 2lnb9HCYUBwoG5VMhcSsyB3nQBALzcGHgO3f X-Google-Smtp-Source: AMrXdXsrA3Iy/FTkJpdRkTCdza9l0ipJZBqGpvPB14l/lJWMPQBzEFGLrUYAnY4P84ipWlUkHZdK+g== X-Received: by 2002:a05:600c:4d94:b0:3d5:3ab1:d630 with SMTP id v20-20020a05600c4d9400b003d53ab1d630mr36021102wmp.8.1672924061291; Thu, 05 Jan 2023 05:07:41 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id l24-20020a1ced18000000b003d99da8d30asm2228622wmh.46.2023.01.05.05.07.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 05 Jan 2023 05:07:40 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Huacai Chen , Bernhard Beschow , Jiaxun Yang Subject: [PATCH 6/8] hw/pci-host/bonito: Sysbus'ify outgoing IRQ Date: Thu, 5 Jan 2023 14:07:08 +0100 Message-Id: <20230105130710.49264-7-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230105130710.49264-1-philmd@linaro.org> References: <20230105130710.49264-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.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=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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Since TYPE_BONITO_PCI_HOST_BRIDGE inherits the TYPE_SYSBUS interface, use its API the manage the outgoing IRQ. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/pci-host/bonito.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index 7722636e9e..5f777f95bd 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -233,7 +233,7 @@ typedef struct PCIBonitoState PCIBonitoState; struct BonitoState { PCIHostState parent_obj; - qemu_irq *pic; + qemu_irq irq; PCIBonitoState *pci_dev; MemoryRegion pci_mem; }; @@ -556,17 +556,16 @@ static const MemoryRegionOps bonito_spciconf_ops = { static void pci_bonito_set_irq(void *opaque, int irq_num, int level) { BonitoState *s = opaque; - qemu_irq *pic = s->pic; PCIBonitoState *bonito_state = s->pci_dev; int internal_irq = irq_num - BONITO_IRQ_BASE; if (bonito_state->regs[BONITO_INTEDGE] & (1 << internal_irq)) { - qemu_irq_pulse(*pic); + qemu_irq_pulse(s->irq); } else { /* level triggered */ if (bonito_state->regs[BONITO_INTPOL] & (1 << internal_irq)) { - qemu_irq_raise(*pic); + qemu_irq_raise(s->irq); } else { - qemu_irq_lower(*pic); + qemu_irq_lower(s->irq); } } } @@ -633,6 +632,7 @@ static void bonito_host_realize(DeviceState *dev, Error **errp) BonitoState *bs = BONITO_PCI_HOST_BRIDGE(dev); MemoryRegion *pcimem_lo_alias = g_new(MemoryRegion, 3); + sysbus_init_irq(SYS_BUS_DEVICE(dev), &bs->irq); memory_region_init(&bs->pci_mem, OBJECT(dev), "pci.mem", BONITO_PCIHI_SIZE); phb->bus = pci_register_root_bus(dev, "pci", pci_bonito_set_irq, pci_bonito_map_irq, @@ -755,15 +755,14 @@ static void bonito_pci_realize(PCIDevice *dev, Error **errp) PCIBus *bonito_init(qemu_irq *pic) { DeviceState *dev; - BonitoState *pcihost; PCIHostState *phb; dev = qdev_new(TYPE_BONITO_PCI_HOST_BRIDGE); phb = PCI_HOST_BRIDGE(dev); - pcihost = BONITO_PCI_HOST_BRIDGE(dev); - pcihost->pic = pic; sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, *pic); + return phb->bus; } From patchwork Thu Jan 5 13:07:09 2023 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: 13089838 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id BB727C3DA7A for ; Thu, 5 Jan 2023 13:08:12 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pDPyM-0004al-GY; Thu, 05 Jan 2023 08:07:54 -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 1pDPyH-0004W6-9g for qemu-devel@nongnu.org; Thu, 05 Jan 2023 08:07:52 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDPyF-0004Iz-Kz for qemu-devel@nongnu.org; Thu, 05 Jan 2023 08:07:48 -0500 Received: by mail-wm1-x335.google.com with SMTP id k26-20020a05600c1c9a00b003d972646a7dso1247761wms.5 for ; Thu, 05 Jan 2023 05:07:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=y0ga69QuYArs9KgZhS/Kjl26kT//Gcu0nAdvUqhVhmk=; b=pWUB9w4TEh75/5lUOi1oX2RKZjwQytJ9dWVGmPkWQkZBC186jVuY0mwAF2AHJIyNZ6 bbXZj04rdj7ImuRt0eZPDjF4WVtySz+SCkN7Ht9uK+IF075cWnZ6+aflQv9gSYnRqJ+z UIAw6TeQWTtwjQO8Z3mWqU6t8Cbryg3Dg94TU7XFoch0JN66nrTFV841iEnckmv6W5kT TwXgHEt/0YYoH1zldj/cW8Wd33BYDxt8Au76kmO3b2ypoS9eVBUTbo23SQH8eq/zFqp2 BwImrl8GN1obETsZhSCDyawtu1oE+VIKST8hxUY7iUzT9a9xa5NrE7KRyzyuPAFYjY2q jsNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=y0ga69QuYArs9KgZhS/Kjl26kT//Gcu0nAdvUqhVhmk=; b=hRFtXzfQv3fWFqfW6Gbc+B/zQL/DhnLZ25++HgIx6YWcN6yWmibpB00eeAjdBTNp3T B8yULC+8SE28UW/RYh8CBsVUaVmPGyHDpyxfzczfBa5WuwGaTbBO/6/jFTtjABvuSddr oqGLrIayGGJgnvPZ/KHQKxphBOyqaM+DpRt+aT0d0hDgWsqD9rSfDiIdsVMhSPDVRCCS EzkpPPdPGKcT+HS8PRZ757CySqRAu99bdrsSETjnn3VV3l/uzKfMh31YM2ICjAAHIG6Z hZ5V4FCVDAqJ1dApUeemL6yC8aP1g4AoYyyKkwCuseNYGC7RMedG0kNXmS5sg3QtkEgy CjyQ== X-Gm-Message-State: AFqh2kp2eITtMc9nh2goFsII2JMY005wb8iSlpm89ppUpeNL6HmokEHt RBcXQAluqKQUxEVZZVOGJy53387BRURz24A0 X-Google-Smtp-Source: AMrXdXu0kPO8AkVnCy5HxCaLcxBgkO9we8KgXjAS+wUvmBG7SX1JPwRVWRVhiq1lX7RdyDtMgsDlUg== X-Received: by 2002:a7b:cb50:0:b0:3d1:f882:43eb with SMTP id v16-20020a7bcb50000000b003d1f88243ebmr35889014wmj.10.1672924065942; Thu, 05 Jan 2023 05:07:45 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id p3-20020a05600c358300b003d1f2c3e571sm2622654wmq.33.2023.01.05.05.07.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 05 Jan 2023 05:07:45 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Huacai Chen , Bernhard Beschow , Jiaxun Yang Subject: [PATCH 7/8] hw/pci-host/bonito: Declare TYPE_BONITO_PCI_HOST_BRIDGE in header Date: Thu, 5 Jan 2023 14:07:09 +0100 Message-Id: <20230105130710.49264-8-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230105130710.49264-1-philmd@linaro.org> References: <20230105130710.49264-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.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=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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Declare the TYPE_BONITO_PCI_HOST_BRIDGE QOM type in a header to be able to access it from board code. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- MAINTAINERS | 1 + hw/pci-host/bonito.c | 4 +--- include/hw/pci-host/bonito.h | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 include/hw/pci-host/bonito.h diff --git a/MAINTAINERS b/MAINTAINERS index 7a40d4d865..8274c45f43 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1260,6 +1260,7 @@ F: hw/isa/vt82c686.c F: hw/pci-host/bonito.c F: hw/usb/vt82c686-uhci-pci.c F: include/hw/isa/vt82c686.h +F: include/hw/pci-host/bonito.h F: tests/avocado/machine_mips_fuloong2e.py Loongson-3 virtual platforms diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index 5f777f95bd..df61b051b0 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -45,6 +45,7 @@ #include "hw/pci/pci.h" #include "hw/irq.h" #include "hw/mips/mips.h" +#include "hw/pci-host/bonito.h" #include "hw/pci/pci_host.h" #include "migration/vmstate.h" #include "sysemu/runstate.h" @@ -238,9 +239,6 @@ struct BonitoState { MemoryRegion pci_mem; }; -#define TYPE_BONITO_PCI_HOST_BRIDGE "Bonito-pcihost" -OBJECT_DECLARE_SIMPLE_TYPE(BonitoState, BONITO_PCI_HOST_BRIDGE) - #define TYPE_PCI_BONITO "Bonito" OBJECT_DECLARE_SIMPLE_TYPE(PCIBonitoState, PCI_BONITO) diff --git a/include/hw/pci-host/bonito.h b/include/hw/pci-host/bonito.h new file mode 100644 index 0000000000..b8ecf7870a --- /dev/null +++ b/include/hw/pci-host/bonito.h @@ -0,0 +1,18 @@ +/* + * QEMU Bonito64 north bridge support + * + * Copyright (c) 2008 yajin (yajin@vm-kernel.org) + * Copyright (c) 2010 Huacai Chen (zltjiangshi@gmail.com) + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef HW_PCI_HOST_BONITO_H +#define HW_PCI_HOST_BONITO_H + +#include "qom/object.h" + +#define TYPE_BONITO_PCI_HOST_BRIDGE "Bonito-pcihost" +OBJECT_DECLARE_SIMPLE_TYPE(BonitoState, BONITO_PCI_HOST_BRIDGE) + +#endif From patchwork Thu Jan 5 13:07:10 2023 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: 13089845 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C084DC3DA7A for ; Thu, 5 Jan 2023 13:11:13 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pDPyN-0004dI-Fx; Thu, 05 Jan 2023 08:07:55 -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 1pDPyL-0004Xm-QD for qemu-devel@nongnu.org; Thu, 05 Jan 2023 08:07:53 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDPyK-0004Jy-5u for qemu-devel@nongnu.org; Thu, 05 Jan 2023 08:07:53 -0500 Received: by mail-wr1-x432.google.com with SMTP id co23so36091927wrb.4 for ; Thu, 05 Jan 2023 05:07:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=gd+xC3PY2bHAZfis1Su9RMK8WeD5UdldXtzUnYRkru0=; b=Z0y3qfBIHv0QH2AAvqYrPyqd7y6iB9W7meqDbFjfCE5yrcaezfcOqf05l4CSN56gt9 pSSgglQ2qfrFPi6qt6cQDWy+GcTIcJpVQ92WoVwgXvVWEUL2s12CIK80GZyBNs4yh9iO f6xap5T3aOxkDBGmvfiWot9A9tcpa2D7YGxGgnClrl5GdJdvQLuEL2ENhVjXGFJqPBpo SkhM+x3GqQoqBHmP4Cdqzkv7+zN9VW4dhpsEnPnwygNGFBv/obDzEzblIUL6y3lFTeep Dxlu6BDviG3x5x8Fboly05Q+Sk/AWw5jc4El+Gv9k/WEzGQ2a9pyUQR6WKfqS73QUCQn Cmqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=gd+xC3PY2bHAZfis1Su9RMK8WeD5UdldXtzUnYRkru0=; b=4b+vFkUZYjzpOMnegThZ5/ERrYfHfXqApjRejseqG8mI6bO1VHHtBivhASMCBPL5X4 KiGsssLi/w5q95fgYBbrDU7fCIwCtob3P/8xMJp/CaTZQ9N96oJBhITncVyImREitiKz MZWf87VMDZBr1RywjpUfj3WM2tTzUJhMs+EJ9INiVl+INyxp6HbA2T2nuq6HzE/hXpnG 3HKTqoqZLz7oUKsm1TJmz7BUIKJRjQaRQ6O1ouQEzNOB3y35j7ecbbGbmJ7syNk3sakP MJIeYZ4cHZz48alDkgiq1svoErJIpV1GZxk1ffZTGFX7aWnXCN34oRQ5eWOtI9vf0OE+ RcYg== X-Gm-Message-State: AFqh2konxs/3H8Ft6zUZkEIKITo5My/IbHHb816WOwkYp0Rr2dr+3rN6 pZakQit6k9K+u3TpG25kywuDJEHmGR5biNcl X-Google-Smtp-Source: AMrXdXuyuk9wcUm7yY1b9cHUUbbPVaMge3sev4KRmv88uOWeMUtMrqTW8QgW5zQ5zUTgvlLmLMmSBg== X-Received: by 2002:adf:df86:0:b0:242:67f6:89c5 with SMTP id z6-20020adfdf86000000b0024267f689c5mr33055438wrl.12.1672924070619; Thu, 05 Jan 2023 05:07:50 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id z13-20020adff74d000000b002366f9bd717sm42614326wrp.45.2023.01.05.05.07.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 05 Jan 2023 05:07:50 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Huacai Chen , Bernhard Beschow , Jiaxun Yang Subject: [PATCH 8/8] hw/mips/fuloong2e: Open code bonito_init() Date: Thu, 5 Jan 2023 14:07:10 +0100 Message-Id: <20230105130710.49264-9-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230105130710.49264-1-philmd@linaro.org> References: <20230105130710.49264-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.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=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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This helper is trivial and is called once, directly open-code it. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/mips/fuloong2e.c | 6 +++++- hw/pci-host/bonito.c | 15 --------------- include/hw/mips/mips.h | 3 --- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index 34befa5dd5..f41e19dc3f 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -32,6 +32,7 @@ #include "hw/mips/bootloader.h" #include "hw/mips/cpudevs.h" #include "hw/pci/pci.h" +#include "hw/pci-host/bonito.h" #include "hw/loader.h" #include "hw/ide/pci.h" #include "hw/qdev-properties.h" @@ -292,7 +293,10 @@ static void mips_fuloong2e_init(MachineState *machine) cpu_mips_clock_init(cpu); /* North bridge, Bonito --> IP2 */ - pci_bus = bonito_init((qemu_irq *)&(env->irq[2])); + dev = qdev_new(TYPE_BONITO_PCI_HOST_BRIDGE); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, env->irq[2]); + pci_bus = PCI_BUS(qdev_get_child_bus(dev, "pci")); /* South bridge -> IP5 */ pci_dev = pci_create_simple_multifunction(pci_bus, diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index df61b051b0..ca5fa2a155 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -44,7 +44,6 @@ #include "qemu/error-report.h" #include "hw/pci/pci.h" #include "hw/irq.h" -#include "hw/mips/mips.h" #include "hw/pci-host/bonito.h" #include "hw/pci/pci_host.h" #include "migration/vmstate.h" @@ -750,20 +749,6 @@ static void bonito_pci_realize(PCIDevice *dev, Error **errp) pci_set_byte(dev->config + PCI_MAX_LAT, 0x00); } -PCIBus *bonito_init(qemu_irq *pic) -{ - DeviceState *dev; - PCIHostState *phb; - - dev = qdev_new(TYPE_BONITO_PCI_HOST_BRIDGE); - phb = PCI_HOST_BRIDGE(dev); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - - sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, *pic); - - return phb->bus; -} - static void bonito_pci_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); diff --git a/include/hw/mips/mips.h b/include/hw/mips/mips.h index 101799f7d3..4d2db99952 100644 --- a/include/hw/mips/mips.h +++ b/include/hw/mips/mips.h @@ -9,9 +9,6 @@ #include "exec/memory.h" -/* bonito.c */ -PCIBus *bonito_init(qemu_irq *pic); - /* rc4030.c */ typedef struct rc4030DMAState *rc4030_dma; void rc4030_dma_read(void *dma, uint8_t *buf, int len);