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: 639258 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp215131pvb; Thu, 5 Jan 2023 05:09:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXtoSqcx3fcw3KlY9Ws53FMHY3wjpIMIr5lABEnjDZ5+WqJIVRf2xlui4jz5zPk7mzL1oVp3 X-Received: by 2002:a05:6214:319c:b0:4c6:e395:b702 with SMTP id lb28-20020a056214319c00b004c6e395b702mr78287403qvb.34.1672924159057; Thu, 05 Jan 2023 05:09:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672924159; cv=none; d=google.com; s=arc-20160816; b=xksKZMR9UQlYatQsZTXpf33KSdw75rGKwfyXz+XVFzX0qjeLA3uW4yOL8WzRZr6PCf k18NWjBFqM9HODSF2g9ceRBDI6TRx9jj1afuKL/5o5i+kSxWS6lee500KlBo0lKh9vn+ 71d3IdJv76pec04Q1LEK45sogVb+MzxMSTYiYKFTmrJyN92HVWtWWJOo4iVjfxrY4d45 kdVdf2gCD459Yp4K8t5DQySjjn9nA9xZi8xCXrNHLGJmayQhWKIaVf4giy8M3WBFmKOb r9HfFgYa7czxDBdStvyKRJ8xWpsmGy0aXt7uIGS3xEkZ9MIpdpt5wGgvIypzVHNpJZ+4 ZpoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9bzKDU+QhZIYaALyoUGzm3s2plmjJ1qhwx3qEViOyr0=; b=i1DmXptVa0BPbui/dgbV/J59+xRQ1GtlorplUQXanNzyumwSrPoFUX13SXszCBUo/w CV/Yif2PZmOI/nDWFWZaeca9UFo3zAJOYq6nLzinS+/wAulIq6M/lxMRQ1GXMk0pYS58 DC/O/E9e83g0RVLONHhyhDBcvjieF09Bwx8NrnwXE5QLsJEVu7QKYute5kwiHg/8xF3j DcCyWwG/8RnlsLC5I6YnIYIKY+CPvXv6iGlKebV4/WDr8BYXKVoqx3INzeUIilJz5B7Y qMhzq2bVw+yTB22s2Tni1t4YxZEEiFjwdhJiqhug1y7j2uzIaif/wtBGfT7idKbqXeD3 SXXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vPm5fUvX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j12-20020a05621419cc00b00531b965490dsi9223177qvc.143.2023.01.05.05.09.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 05:09:19 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vPm5fUvX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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: 639254 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp214537pvb; Thu, 5 Jan 2023 05:08:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXsoIP57eo4eYcxLZ+JJ4y+PKQBgpTUgI/02Y/E1cs2eUp4g/e41PA1g2M32SY2rn81knXg8 X-Received: by 2002:a81:d58:0:b0:45f:ab6c:3d01 with SMTP id 85-20020a810d58000000b0045fab6c3d01mr44916405ywn.51.1672924087925; Thu, 05 Jan 2023 05:08:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672924087; cv=none; d=google.com; s=arc-20160816; b=iaPUBgxz4Ehaf3jO4MfPsCMZDy93IFzmzIrzUFJJ6RRlT+dMHt4uEchXSu+QFllNvv 9im/6G7mp9h8ULvLyBUelwklRPLGx47pX7t/q1PMUybCkjMEt98AVgxKM0hQQGQMaow8 d71j/TuYA/WJBnbQGSUjl1hV3o5PC9tqT8iDNo1825UmqCwgk/gYnT0Nz+XaYI6Zfnzc 66qpHyohyYYvo7/aImDuzsP9QoLFVrE7qbpDOeNR74vdSmUa8PA/6CVLiGnFqJwxfsxU m8DFJwi7GEGma1BrFX7Sc4DvWqykV2B4vvvYi6qpL2miHdCtyS3FRjI3K7RJ1eJj3Qku 5ZzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2LQQtF6mRwowaB8cMgADklf0rC+6ac5gfQ1xXYhmt1U=; b=U+GBQ4xn67sC8bbE+dN1eN0W8+7bGrqMA6PQCdFGkGfgfJ1L70RUlojwlBfJsUKJ1U y6zn0WMmeK0LpUnnDPy3UNwygizDF61wK8fMCCcUq0TaraC5IMEAyP4MtaCNGNC/YLsN K7stgRhIlNF7e7miQtY8hySnZZ6yxlIvh+AOlNADH6CnEiTjMxNEE8tTfGDcGNBba42+ XclXTHhdFoNZml8QvQHPDIZjOPuVDKmyzMhUdGQ9+4DIzgKItxkz8s4YRJBim8dlrgC2 gq7VyrZrxE+5A4N0jtw9wXBeOZdc6B8jw3RzFA2D3Aac91VrfIosV+pXNDZ8aLe8hlMY EuTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fab5WOaH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y3-20020a37f603000000b006eb3dd880aasi17978049qkj.433.2023.01.05.05.08.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 05:08:07 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fab5WOaH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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: 639252 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp214391pvb; Thu, 5 Jan 2023 05:07:56 -0800 (PST) X-Google-Smtp-Source: AMrXdXv+fF+w9KRYOJzj4usKcezMCI+Q/iq8pTWiN1EOfXTs2tTQIY4hXbQwlSJhvopL9+lKYXKF X-Received: by 2002:a05:7500:2c8e:b0:ea:46c5:6933 with SMTP id es14-20020a0575002c8e00b000ea46c56933mr2419915gab.7.1672924076217; Thu, 05 Jan 2023 05:07:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672924076; cv=none; d=google.com; s=arc-20160816; b=mRzJJX6rV++49XVLY+zZ6s7hvNRttJLWvC21vAVHc+hp0pHynDocu2odhgfMdnvIGZ ZX3Fv8T3EZJiV48FPZgx9KXjAj3PGdMlj6yadZjZqvNsqH1cmpkDmU/Y+WfLjlYegjEf R6t0StoMT8UBp4d1TNpuY/+gbzwsnXjvD0lDlDneb37boGQw+nhsX9z1MIpTRLySSJlB CuBzyIymURQzz3oex2I0x30/JNxZbsl+pQeUMXt8/VeGWiKPcSbRZtkOY9yKkrf5OS/2 07Ha7j1/pDcoPPCH3Gh1Tz2r0KTAdFEcw6sHMZkhN+1YA4rsW7lbupqB6Dhrdhxq9+Ij pgTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tCZjTrjK3GXyfOZTeSp83EZ0svOoUH+ua/AMM4VRkZ0=; b=UBTvtPFRVj1/rcsC4JUi9Th9Qpf6rQEuVy40UAkFxqrPJYg5Fm4jdKYs7K0ENsjxAC QXhIJWm672dbj40wpi6NXCGrzfkEtW2cE7TYHO7RJsX9+LegDQ6yL+yXqBgmljUDef5H FrIAiR3QqIeutt3wLXvGHM6JwScWXNYX0LXQ2WTfYk77/8OMuzHCNVr6+mrk2zNYZmQi Y56wExSKVfZU+wNZABoMXQ5aryTqo35+Hv7yfuV8FbGRpj5jiMPUXS+iZ9IkFvbtowJc 9jneZMpHtVJnLWCBFgl+srF2lKmH1f1KYEfiFQgrwq+2ynsrdcwBjKVuMXhBE10prPe0 3z8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BkFp411H; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bl14-20020a05620a1a8e00b006faffa7168asi19723491qkb.574.2023.01.05.05.07.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 05:07:56 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BkFp411H; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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: 639253 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp214403pvb; Thu, 5 Jan 2023 05:07:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXuHpKY+YxKYmx+uRwVrw8PY0CQX1MTKxe/1xX6TsSOLntK0CZ4XuhEMP/G6RSka0ywleoKt X-Received: by 2002:a05:7508:3827:b0:47:1223:962f with SMTP id cg39-20020a057508382700b000471223962fmr3154188gbb.4.1672924077718; Thu, 05 Jan 2023 05:07:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672924077; cv=none; d=google.com; s=arc-20160816; b=LUO7B1ZwglilNitPT/UkkWd6h6TyrO5A/0k0kL+MedsxgcjscUkaP5rRLhhgvs05pN kXs3mr+7Wcu3+EJ/Jj/tOztVJcZwbPljLZiH+vg8PBIsm/TH9riVOMzWbPGkiCtLZ1Fw smIYUvc8NzFSnSmsSWyh7dVBE5bXXQ1BC7ScgqEfRGwyI+2D2mvau6wkNuzIWVVLk96H gsha99h7fy1ZrbT7nWbxQUtxyLZ9/KbnHBPy5fPiJ0bFhJt6Cxdrjo+VZo6QMI+YMi3s H6iFzft8fC0pwKu1tQwQ6UMjKaO39XffJEVZaJwhTDbCKg58Ek0Ia2TOY2+vcnI1dI2r NFAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g9+vx6ckYIqNiK6kSQbDp2C/LOtZEZcv8fwDtklzB2Y=; b=0DwNk0VT2xJjqVFTDz5bGSRhvV8x5QfWpKTSICOq/Fz3ir/N0tlJ3konJLyrY7GvgN CKUqf6YKvPDBzA83qqgZNHpYSb+DYHLGop/XcIstVRWZNyh52A+VFeKYKoSagl1s74MD Svt8AObPgWL7hgDYhJ10FNRig62iBjvzGKuD1CoZg7lYk9YyBE633ahtlbFe/N56WFJA hUdpR5x8es/yZWs/Ji2uRKuyKBzdU+gOXqrEGnvH7/FE/Tf2l2z532yOlBM0whw4abjA 7iS5go4dBs4VBhguDSIlAH4jG1piyre8JB7b0axK2+I+oYDdulOzokXHXCLg6aQ81kOw QhQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rprm4epU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id br19-20020a05622a1e1300b003a7e45b3b85si20294555qtb.351.2023.01.05.05.07.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 05:07:57 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rprm4epU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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: 639260 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp216192pvb; Thu, 5 Jan 2023 05:11:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXsKXG6e/lVW+sLFl0rKqha70ZbYKkraif/KzcaKs+96aTTK5gBlmBVOnOePL95nvIs8A5u7 X-Received: by 2002:ac8:528c:0:b0:395:396f:a519 with SMTP id s12-20020ac8528c000000b00395396fa519mr69143718qtn.0.1672924269628; Thu, 05 Jan 2023 05:11:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672924269; cv=none; d=google.com; s=arc-20160816; b=jbiZ0LTrzwt0ZcQk3DfcMGqR5Z5cq+pO0XW29D18Of/9UEuA3zsr9G7e66A+s+U0wz TEnXBkLS4YXPvniy0sPzdiYYKM3M+jD9ErkLjcjqQbA3FXUmsvRMJ4mM5ZgcmXKScBvf WAr6ofTEWx6MLCy+rPIaGm2frkXd9YCMECBZVzMI3ipglYpBmWic2bgJ05VK3hxsrMWY 157atSMbioWJ41UU5wV4Qm98nHqh63oeuyAUqXKHoB+C15+n0s0wEegCgtwz75V8216A qnzQgaHYtMb3vsddX92ONqe/GgAGt/bBi6+Fp6zNYwyPldulJ7lBbnH8nG0DSqz5tQZP yz7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0b6s6o5206pTndNparQo6CPOMKbDBezGjOtaupQnzDA=; b=0/6JvVICQjpcCbRe4/cvR0jKgOXGi06/eLxHQxqvpE0LMeJ4Z65yuyw755Qo2sC7MC pt7AYW4nRWuWSEIfV3dZ1oamMSJQBEEkL3Nf+xj9O/wL4rlFIpeaty1FIxr62D2pSc0q B9QTMULe3HktwvAUJYYmj79AK+DLlFtz/4nZUYTtUx/W8udAXUc83fkkbiinfRdkMMds MhQ71juQNdSy51KKl5bnAUO60sYK9LPfzoR5pHnibd/DJ5taYMG0tKAIPwmD1CyPUKqX NC37orDbc1KZWxk6xi/gJ/7sms8s32DGH3eMDi532iqNqdLFgTjbtF+AVBxJnOI3m0tQ 0LzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o8uMe4XO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h12-20020ac8776c000000b003a69c77eb09si18828804qtu.706.2023.01.05.05.11.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 05:11:09 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o8uMe4XO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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: 639257 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp214904pvb; Thu, 5 Jan 2023 05:09:00 -0800 (PST) X-Google-Smtp-Source: AMrXdXs7LiUDtntSUrQB+YPu7ZpS49yluSTWL2AAByVaJ7d5iNDRzEVx7H+5hWmWXijfdDpwJk0I X-Received: by 2002:a05:7508:1389:b0:49:2818:1194 with SMTP id df9-20020a057508138900b0004928181194mr50880gbb.8.1672924140129; Thu, 05 Jan 2023 05:09:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672924140; cv=none; d=google.com; s=arc-20160816; b=YHdanolBIRRevQlNq4NDPhNtrHJ3DpZJD4LqTq7Vs9u3MwDhdKTydb27iqro3K+EdZ biqKBguOdDT7/0HS+03QrV9nl8VpzWoy2RcD+Ql5WBzJ8G3igmuiZ6vJjPN2NWCsOnup AeUwI6+g6tWrSwV/QGvmF3aO7dKqOlRalNhENQfeXMF5eKui16gIyoWhRioeL8nKEj7y lYWjQTtz71RmjcUNfA3sYFasol3Zcj6xOtBCjQepjCatv/8igRfzRAhPhrD8qt3hUk/J YWBJ4EfRdomyXlbheYLnPf1G9oC3S5F5nXpSkEpEF0w/hzcS2/M8fg2OyY8bjf6xDflM Ki3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YGzLuFXxs66myFiViWu8pKjRIb3GrnDWVImC+7rq5TU=; b=DWqIyFf6sD3Vwj6Px+DOq2+9DCEK44eeSBX1CjUZSPLC0N1LUKVaCpZavrQ6+A6VMb Gw8gQJ3BEZKI5byJ5lIyKLuyii+exyXuMxoWltzU9dKJ4K9m9182DtbU7p2hW05jRGZ4 YJrLnMFNiVDf3kf3XbeUmaLd5RUaPnXJF+GoCsbP7Xyw1+Il7mTGDm1EuR67bqGyDSTV UXpHfypvRqLq+LZE6bPM2yAzzBe/nBKRce51IHTzyXSJLkSoER30ojSoXaDIri7Jobdb B4IVwkEEa/BiWDxkKqxcn9nEJL1fE3zWFN3TxMmAz8fXiM2ZP5CNFr9H+Xwb51/wnVbV QFhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wEnakYLU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x132-20020a1f318a000000b003d5a97a3a31si2574836vkx.140.2023.01.05.05.08.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 05:09:00 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wEnakYLU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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: 639255 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp214563pvb; Thu, 5 Jan 2023 05:08:12 -0800 (PST) X-Google-Smtp-Source: AMrXdXuSf78AnIpttLi0cnK6BxFiBlY21lsjzG8JqJ57ymeHzyoz16w5Sn7M/ij3wlzfRa08ymN0 X-Received: by 2002:a0d:eec6:0:b0:472:764e:bfad with SMTP id x189-20020a0deec6000000b00472764ebfadmr30988001ywe.21.1672924092450; Thu, 05 Jan 2023 05:08:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672924092; cv=none; d=google.com; s=arc-20160816; b=yPbzqPmFYt5CXNrk2sXheZUX500UKAck4khjDAdPJUo5HN6e9zDg3MAqIp25xlQURV vZDO4MOGD2SvGk8rf9aO+ygOW1xKQ5VnJGvCYcbd/mGkmpSO9C/jys7+2qucriTtgezp 9MdFV0Y2ZaDnJ0pGygTnss/5zOqeOXIFnmDrM596eikUSFnESM0VjHsdQyzIxyuaMv6X xWOaXmzEvXXIbl9nxe7nbe85P3zD3dxGPtNVjD7iCYR+aSUzcbM37aZPuDL9nDRjxiW/ PiMsgE7UQJh2RQY2+OSmGYd7xnVYpv573rFZ6h4fXBOalnbCQbkx8Oz4q9bon9OSzIjE x/JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=y0ga69QuYArs9KgZhS/Kjl26kT//Gcu0nAdvUqhVhmk=; b=nHz/BJlDXFGgJWUXfhLROVoamFoSHvoFJIZN5SGwGqY4yvPw29SJzd8zrrWlvtQV1T P/tK+NBXNbM4JAmXGGDhYdxTCDP9/d0tna77nvc0uXXQAuRLstsz2s/7x8+owvQ0L4F6 RJ7Kd2vCE4aQF7qQyIl/abZpJ1u5AcFOi66GnSOB7H/WxdQTr8l18TPHE7u+2jbwlMIx X+5dTxGzkBtp/HCJax6QWIu6gSwy7LuyaGH1XsJxFGuAs38Q7TDyLzUEo5jerC/j5IHn FEDCa+yRDQ9CvTXVkqCkHgbv7IfxsGtL2PsTS1+/dd8s4xFRQ7H+GuoqoYP4hy8RC3/w +K+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pWUB9w4T; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ou25-20020a05620a621900b006fbeca246a0si17879733qkn.379.2023.01.05.05.08.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 05:08:12 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pWUB9w4T; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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: 639261 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp216228pvb; Thu, 5 Jan 2023 05:11:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXtbrn97nzjNSkTu/rFwGFeSUixfgLZryrDGYAS0GVQnYa/2cpuICueNwPlzqOQx7u83g2Pb X-Received: by 2002:a25:da93:0:b0:767:b792:2a73 with SMTP id n141-20020a25da93000000b00767b7922a73mr45507020ybf.45.1672924273524; Thu, 05 Jan 2023 05:11:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672924273; cv=none; d=google.com; s=arc-20160816; b=eX4EUnboVG0RoBHBf/iglrq6h4deBBXY7w67Jt2DUGuBmngLLpC0ooeMvGJFRY10v5 helDLQ+IBf7odJkkGmBVem6YVssCfJDTSEqEeD2LLdVHJyRJDszlQxGNpBVjuyvwtQ0r QiQ0i2L9QnQyngSwwufs4kfGbofJvLIFK5yVgqv961SqJ3paKQSmt2UPa5ATwKse1PMT I9yV5E+l0AwwR9B+RoTwEA3Tnjpsj6hju0XkjBwYVrG1MsAMpXzug/DlGIUqWP3Tu11h 74oU1v1CvGF4YlYU8ld9Ale0ulRlngbnRAOe60FcQF+HV+kbuy5f0DfiKYcRKfTthXxE YkPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gd+xC3PY2bHAZfis1Su9RMK8WeD5UdldXtzUnYRkru0=; b=huHJWRzliQYp9jfVlmC3jtZjtka3BWYtGpzXDvHiebOjLHFl2spjpMG+/36bpSDFBw NrYx0Ekaf7dKdNFiRbIOx6Au9g48jXnJ2SJvIwE/mMPXSoOGI+kB1r7MXnunkmm9EUPk YonZRpfxcddZWOpps/c5shJJxrj5C/ciLQufjQUsYCfpS1yfP7GMkN1ZMT96srf2/xyG 3KLel+SQLFoXe3cMlR14S+vTEhCJaNDbpR0wtB/LD+mLnz5DBvfYuClWchijFhHpZPFx w+yE84lnPy4lja0PPRy+CtH5u0kWQiL7OmBvJR6kWGiyObULG9rN9pj5BpjixAcXMfNy xDCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z0y3qfBI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j8-20020ae9c208000000b006fcb485a4d5si18323057qkg.331.2023.01.05.05.11.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Jan 2023 05:11:13 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z0y3qfBI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 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-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.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);