From nobody Thu May 16 14:11:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1672924159; cv=none; d=zohomail.com; s=zohoarc; b=Nrk+R76Ov4u209DOgrO4ubeR0bUqlNdEU91y/nz5rQj/uXnMqrIWNum8DhJN24l1Q+5WoWS9bDal3CYl1YCxUUJfNNA8mZNWgD32Z8TROvZQPNGIm4DEb9cXP/IUDGLD+5yLHOguOPIAImThjoYpgzqdgYD5gth662bdzCc42wE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672924159; h=Content-Type: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=9bzKDU+QhZIYaALyoUGzm3s2plmjJ1qhwx3qEViOyr0=; b=FuIM+KB8kZTsuBHvNtPALyjN69il99bTJ/GhIlWG0l2gQa4yenbE2T5Xz/+zC+sYS2XZrYssAT2ekP7d9G6/qkPy0qSdWXDYbYz9TSRdtnOnyp3ruKq4cr3L9wwouLS1BZmHeVDy9Vv0Uy2//9qxYQQSmgzi3PGhBhM0/HWsHpo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 167292415988646.57861905715299; Thu, 5 Jan 2023 05:09:19 -0800 (PST) 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) 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) 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Huacai Chen , Bernhard Beschow , Jiaxun Yang , =?UTF-8?q?Philippe=20Mathieu-Daud=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 Content-Type: text/plain; charset="utf-8" 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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1672924160231100003 From: Philippe Mathieu-Daud=C3=A9 Convert the TYPE_PCI_BONITO class to use 3-phase reset. Signed-off-by: Philippe Mathieu-Daud=C3=A9 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 i= rq_num) } } =20 -static void bonito_reset(void *opaque) +static void bonito_reset_hold(Object *obj) { - PCIBonitoState *s =3D opaque; + PCIBonitoState *s =3D PCI_BONITO(obj); uint32_t val =3D 0; =20 /* set the default value of north bridge registers */ @@ -739,8 +738,6 @@ static void bonito_realize(PCIDevice *dev, Error **errp) =20 pci_set_byte(dev->config + PCI_MIN_GNT, 0x3c); pci_set_byte(dev->config + PCI_MAX_LAT, 0x00); - - qemu_register_reset(bonito_reset, s); } =20 PCIBus *bonito_init(qemu_irq *pic) @@ -770,7 +767,9 @@ static void bonito_class_init(ObjectClass *klass, void = *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); + ResettableClass *rc =3D RESETTABLE_CLASS(klass); =20 + rc->phases.hold =3D bonito_reset_hold; k->realize =3D bonito_realize; k->vendor_id =3D 0xdf53; k->device_id =3D 0x00d5; --=20 2.38.1 From nobody Thu May 16 14:11:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1672924088; cv=none; d=zohomail.com; s=zohoarc; b=KQK3nUcVVIQLj4NqlnHo8NnSen+gWWwAmD3rI/TeN8J+NKdaXOARfdTlSvXa+11b4F6e8+2WGkvKu4AjFQqe56ZlOE6SWgjdVid7kXYNj7dbfZ+O+sBHnGyMw9Yuig6FOTRWtt8wIIzPz4Qc0NKV+mkFXJi8uO8ZX9sFLXC7UIE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672924088; h=Content-Type: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=2LQQtF6mRwowaB8cMgADklf0rC+6ac5gfQ1xXYhmt1U=; b=fVI2EgsWkBUX4DJwjuw+8ThUUI3mnTvo1VP8BuiftD8krLP0pNNFgiZgm4LDC8urwjxIsL5aVrZ0FwLiSdmkGu+nWDDMvDlMLrlH1I8Mevm6aS8eCiqCIbrsI0BJ3jXg3W2Vzb1RBliifdt0uD+jw/4e5DIbuzZlLlvBn9RBumI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 167292408867932.79083135292433; Thu, 5 Jan 2023 05:08:08 -0800 (PST) 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) 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) 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" 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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1672924089582100003 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=C3=A9 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 =3D { } }; =20 -static void bonito_pcihost_realize(DeviceState *dev, Error **errp) +static void bonito_host_realize(DeviceState *dev, Error **errp) { PCIHostState *phb =3D PCI_HOST_BRIDGE(dev); BonitoState *bs =3D BONITO_PCI_HOST_BRIDGE(dev); @@ -795,23 +795,23 @@ static const TypeInfo bonito_info =3D { }, }; =20 -static void bonito_pcihost_class_init(ObjectClass *klass, void *data) +static void bonito_host_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 - dc->realize =3D bonito_pcihost_realize; + dc->realize =3D bonito_host_realize; } =20 -static const TypeInfo bonito_pcihost_info =3D { +static const TypeInfo bonito_host_info =3D { .name =3D TYPE_BONITO_PCI_HOST_BRIDGE, .parent =3D TYPE_PCI_HOST_BRIDGE, .instance_size =3D sizeof(BonitoState), - .class_init =3D bonito_pcihost_class_init, + .class_init =3D bonito_host_class_init, }; =20 static void bonito_register_types(void) { - type_register_static(&bonito_pcihost_info); + type_register_static(&bonito_host_info); type_register_static(&bonito_info); } =20 --=20 2.38.1 From nobody Thu May 16 14:11:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1672924077; cv=none; d=zohomail.com; s=zohoarc; b=cO5xtve5jTp5C2J3CielkC8aE4UAkBcZxwcGOyX+aLWVI30uY4DzKyttSl/dqdLcBWpNCQs+jJQTk9/t5KlYMBJONyXDEk6GgSns939zTbb4T/9t54ngzU69E0nRmkkPFXVxJV3k2+3XXjGihQGZgKyV7rXxG50rp1QkajEe/x8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672924077; h=Content-Type: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=tCZjTrjK3GXyfOZTeSp83EZ0svOoUH+ua/AMM4VRkZ0=; b=Sq1r+eYvcRve36iEOyO7ib7O0Mt1vHl8wYpk8xJbuvdxpGMHmG/gVVWbtGxyutTcjPaKBLYJBEU/XaLc/Os/H92zdbb5t5QqQp7fG6LGQQNIEqURICKLIGX1R79QTQJQnocOQviJibmg6Vwt9LqG3xWrO35QjzlUE+zh/qKNouY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 167292407735617.824984465632838; Thu, 5 Jan 2023 05:07:57 -0800 (PST) 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) 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) 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" 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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1672924079544100004 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=C3=A9 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] =3D 0x6140; } =20 -static const VMStateDescription vmstate_bonito =3D { +static const VMStateDescription vmstate_bonito_pci =3D { .name =3D "Bonito", .version_id =3D 1, .minimum_version_id =3D 1, @@ -653,7 +653,7 @@ static void bonito_host_realize(DeviceState *dev, Error= **errp) create_unimplemented_device("pci.io", BONITO_PCIIO_BASE, 1 * MiB); } =20 -static void bonito_realize(PCIDevice *dev, Error **errp) +static void bonito_pci_realize(PCIDevice *dev, Error **errp) { PCIBonitoState *s =3D PCI_BONITO(dev); SysBusDevice *sysbus =3D SYS_BUS_DEVICE(s->pcihost); @@ -763,20 +763,20 @@ PCIBus *bonito_init(qemu_irq *pic) return phb->bus; } =20 -static void bonito_class_init(ObjectClass *klass, void *data) +static void bonito_pci_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); ResettableClass *rc =3D RESETTABLE_CLASS(klass); =20 rc->phases.hold =3D bonito_reset_hold; - k->realize =3D bonito_realize; + k->realize =3D bonito_pci_realize; k->vendor_id =3D 0xdf53; k->device_id =3D 0x00d5; k->revision =3D 0x01; k->class_id =3D PCI_CLASS_BRIDGE_HOST; dc->desc =3D "Host bridge"; - dc->vmsd =3D &vmstate_bonito; + dc->vmsd =3D &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, voi= d *data) dc->user_creatable =3D false; } =20 -static const TypeInfo bonito_info =3D { +static const TypeInfo bonito_pci_info =3D { .name =3D TYPE_PCI_BONITO, .parent =3D TYPE_PCI_DEVICE, .instance_size =3D sizeof(PCIBonitoState), - .class_init =3D bonito_class_init, + .class_init =3D bonito_pci_class_init, .interfaces =3D (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, { }, @@ -812,7 +812,7 @@ static const TypeInfo bonito_host_info =3D { static void bonito_register_types(void) { type_register_static(&bonito_host_info); - type_register_static(&bonito_info); + type_register_static(&bonito_pci_info); } =20 type_init(bonito_register_types) --=20 2.38.1 From nobody Thu May 16 14:11:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1672924078; cv=none; d=zohomail.com; s=zohoarc; b=lMaItXsW52DA27nXIMERXD5brR19sOtzwsYHTepxjP+43IMtSADLLS5mHBCtJcXKib325DGdID6If1qctN53YjGtLuWuVsGSiIJVtOnNqDOVPtnHgrWIaLu1bmqiyxg9TrFrMJNVLIFnDTsc0nkSMVrkpvpCHw1T9IsCyZSvvaQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672924078; h=Content-Type: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=g9+vx6ckYIqNiK6kSQbDp2C/LOtZEZcv8fwDtklzB2Y=; b=gQlL+obC6sicmOUSWAKnvCJalvNIp7KG0OZiQkIZk3rCkMUWMKbzzFVwF5dhgyD2DK4DMx4z8GWu3WzqRorGmSKyRlhT/2blBwPV5JAEle7KXnkWTDZ6TAlf1emVM41zv8LttmVrfUo1ZLEyEwJ7/tzFgKcJjccwwmouJemn9/c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1672924078234490.4798176904933; Thu, 5 Jan 2023 05:07:58 -0800 (PST) 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) 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) 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" 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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1672924079542100003 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=C3=A9 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, Err= or **errp) static void bonito_pci_realize(PCIDevice *dev, Error **errp) { PCIBonitoState *s =3D PCI_BONITO(dev); - SysBusDevice *sysbus =3D SYS_BUS_DEVICE(s->pcihost); - PCIHostState *phb =3D PCI_HOST_BRIDGE(s->pcihost); - BonitoState *bs =3D BONITO_PCI_HOST_BRIDGE(s->pcihost); MemoryRegion *pcimem_alias =3D g_new(MemoryRegion, 1); + SysBusDevice *sysbus; + PCIHostState *phb; + BonitoState *bs; + Object *obj; + + obj =3D object_property_get_link(OBJECT(dev), "host-bridge", &error_ab= ort); + s->pcihost =3D BONITO_PCI_HOST_BRIDGE(obj); + sysbus =3D SYS_BUS_DEVICE(obj); + phb =3D PCI_HOST_BRIDGE(obj); + bs =3D BONITO_PCI_HOST_BRIDGE(obj); =20 /* * 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; =20 dev =3D 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); =20 d =3D pci_new(PCI_DEVFN(0, 0), TYPE_PCI_BONITO); - s =3D PCI_BONITO(d); - s->pcihost =3D pcihost; - pcihost->pci_dev =3D s; + object_property_add_const_link(OBJECT(d), "host-bridge", OBJECT(dev)); pci_realize_and_unref(d, phb->bus, &error_fatal); + pcihost->pci_dev =3D PCI_BONITO(d); =20 return phb->bus; } --=20 2.38.1 From nobody Thu May 16 14:11:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1672924270; cv=none; d=zohomail.com; s=zohoarc; b=Clp7t0rPL/E2Mt7wrofk7mh1j0tyNwaDOXoAsc4ePtQ/bAG+0rvzVORJ/+QCbpVwa1IrCzMsPkpX+8Jn/sM1a/weFPP5qLBHojEC6mRheJ1TGrWgf60kt6cA9tEK8LGO2USKyyZPcODjHT5ZhTe6GkbY8AF7BaKsIG39rny8j1A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672924270; h=Content-Type: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=0b6s6o5206pTndNparQo6CPOMKbDBezGjOtaupQnzDA=; b=Ri4z6z5zcCLr0bX0WDEi5hz9BRnyXHvDesvzU25luvMMS7PCiIRMVRwQYeb3tjUZpcaXjABtPNd2BGInnywrAPlDK1Q7Vi9G63ydxisqT9OCKguFF+yow7RL6mVYrCfEZHzQybwt+U0pAxhzTmVVdwFAKebTz/6TE4bBZbGdzVU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1672924270864679.7676281957905; Thu, 5 Jan 2023 05:11:10 -0800 (PST) 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) 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) 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" 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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1672924272014100001 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=C3=A9 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, Erro= r **errp) } =20 create_unimplemented_device("pci.io", BONITO_PCIIO_BASE, 1 * MiB); + + bs->pci_dev =3D 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); } =20 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; =20 dev =3D qdev_new(TYPE_BONITO_PCI_HOST_BRIDGE); phb =3D PCI_HOST_BRIDGE(dev); @@ -760,11 +764,6 @@ PCIBus *bonito_init(qemu_irq *pic) pcihost->pic =3D pic; sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); =20 - d =3D 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 =3D PCI_BONITO(d); - return phb->bus; } =20 --=20 2.38.1 From nobody Thu May 16 14:11:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1672924140; cv=none; d=zohomail.com; s=zohoarc; b=O59Z9fN9ZY1m922MpTUoylOEzmwZUe+g/FSPyYbcSiZzbsEZUgaPEehd7+cWG3z1V56q0/m5b9SJHpe0XWR68FlDKbI8Tlo2deRs8IUOSsbVkpmh86JpSaE2Do2WYiVCO2oxKBws8rm2AG2WwsY8rf62N3zAGBW4LtTnsUYe2TE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672924140; h=Content-Type: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=YGzLuFXxs66myFiViWu8pKjRIb3GrnDWVImC+7rq5TU=; b=ZVZHQS4rdA8bCGScfmDoNMgv2ZXnwNd9rdygAXM8AQcDeFaIs6Q+X/q8pVFefDWyFHxBS7gqZUrDlGMRlIrYa7t7uN8pBrugKSgOSJcTGOQJdk18QvEA5qYY3Wnt0oX9RTyVJPIRZjuLLzi+zkJkz5hfUZ02O0ORV32B/21RUCE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1672924140709138.0548090006548; Thu, 5 Jan 2023 05:09:00 -0800 (PST) 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) 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) 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" 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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1672924142128100003 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=C3=A9 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; =20 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 =3D { static void pci_bonito_set_irq(void *opaque, int irq_num, int level) { BonitoState *s =3D opaque; - qemu_irq *pic =3D s->pic; PCIBonitoState *bonito_state =3D s->pci_dev; int internal_irq =3D irq_num - BONITO_IRQ_BASE; =20 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 =3D BONITO_PCI_HOST_BRIDGE(dev); MemoryRegion *pcimem_lo_alias =3D g_new(MemoryRegion, 3); =20 + sysbus_init_irq(SYS_BUS_DEVICE(dev), &bs->irq); memory_region_init(&bs->pci_mem, OBJECT(dev), "pci.mem", BONITO_PCIHI_= SIZE); phb->bus =3D pci_register_root_bus(dev, "pci", pci_bonito_set_irq, pci_bonito_map_ir= q, @@ -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; =20 dev =3D qdev_new(TYPE_BONITO_PCI_HOST_BRIDGE); phb =3D PCI_HOST_BRIDGE(dev); - pcihost =3D BONITO_PCI_HOST_BRIDGE(dev); - pcihost->pic =3D pic; sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); =20 + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, *pic); + return phb->bus; } =20 --=20 2.38.1 From nobody Thu May 16 14:11:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1672924093; cv=none; d=zohomail.com; s=zohoarc; b=gIp/MJMQOY4Gb7HkAlagJBw615eAMJqogPMPSOvQb9ZPM8KbNz/LavYZ8o+XAvoUF5t9oZXNwYwUIwJF2DNzCx3lFveDjpIfM4TTcg0h9wYBhj+dQoG+wi4KFRLSRt4ET07P+L+4YXje0D0S8hY0bKT4Oj/GhVSvUNhfQQsvjMI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672924093; h=Content-Type: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=y0ga69QuYArs9KgZhS/Kjl26kT//Gcu0nAdvUqhVhmk=; b=ap1fDhjuakHZEhkbKyL1vbMHHf0bCRD0dBU2W9EyqsTqGWr6bOGGLsWu0JjIJgot4gmOqgJQhDNkiIZzTYPfkagWsu1J0qaft0PgtMEujHVwEsq5uZn4G9vQQGE3BWTXLm4W//LtzllwCyy9VyPA8ADeZm8fnD1wGB6rAyhp4c8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1672924093577216.23260242023923; Thu, 5 Jan 2023 05:08:13 -0800 (PST) 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) 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) 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" 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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1672924095621100003 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=C3=A9 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 =20 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; }; =20 -#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) =20 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 --=20 2.38.1 From nobody Thu May 16 14:11:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1672924274; cv=none; d=zohomail.com; s=zohoarc; b=PwasfFfxv9kobkn+E9yXU7pByy0ddzDFWFVkHUT3m6BYDpNdeN0DpbBb33C79N5FENyQcDH2ldzZspxXpN5wLTMA1ulDPPy69cZgCG6SLwCjKqKIOEYu/aUlo7bN1eNgJp15Cy4r1j4eN2gYHoBToIUdBmwH8fT5BvcZUI03LBk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672924274; h=Content-Type: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=gd+xC3PY2bHAZfis1Su9RMK8WeD5UdldXtzUnYRkru0=; b=BH0zyySIRWoQyWvRALXpieIxwuAI0rzcPzKtdqE8oqUolPMx67S3DkE3S5JmRd8UDaNx7yviyz3Z+3/Ned4RWLglWtxj+fO3ikzcbJZ7AS9ccnFzjnx+dHOZXlVNLu/0YQGVvquWREsV4N0cRe3X8GTSMpmCfC3msb1q62aetYE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1672924274155811.9556520640167; Thu, 5 Jan 2023 05:11:14 -0800 (PST) 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) 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) 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" 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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1672924275980100001 This helper is trivial and is called once, directly open-code it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 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); =20 /* North bridge, Bonito --> IP2 */ - pci_bus =3D bonito_init((qemu_irq *)&(env->irq[2])); + dev =3D 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 =3D PCI_BUS(qdev_get_child_bus(dev, "pci")); =20 /* South bridge -> IP5 */ pci_dev =3D 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); } =20 -PCIBus *bonito_init(qemu_irq *pic) -{ - DeviceState *dev; - PCIHostState *phb; - - dev =3D qdev_new(TYPE_BONITO_PCI_HOST_BRIDGE); - phb =3D 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 =3D 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 @@ =20 #include "exec/memory.h" =20 -/* 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); --=20 2.38.1