From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806116735520.2380679471827; Thu, 1 Feb 2024 08:48:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaB1-0002ta-IN; Thu, 01 Feb 2024 11:44:35 -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 1rVaAr-0002r6-OX for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:25 -0500 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAm-0002T1-AB for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:25 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000009cLx-0lVS for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-00000003ILq-093v for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=l9x9HGNJH5fBiIeKzePXsIuGh5SQlI6/4CQcfviByuY=; b=NvcRHT+ld+VhyS11El94WCGBx5 nbwVR47WJ+pc2NZLPlvSXq/l4ksOMpjabHce4ztOAlq30lsjPiKRd/gIRS7GExLQ6VZF5/bCufo5r tmXk+G2cg5h8taCaPuKAiQb9JED68/8zEDmHD6y4cHo6wYeO2SSj0v4vw8l9n1U6MtGPlJPscKaDR 6iSCINgfiACRVpP+8qDbRRMwn1M5nEvx3v2FL8Tx8V6+bDIXjQY07lz/QfpU90R2CiqmmP/vwIEVA 9SyJf+DuslB5xkRgVcecr+5McJZKF6tkm2afDjWZFZcVKJV4UiMbLiFCBhaKvuXp6ipaXpl/OPpOz Q+n3A01g==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 01/47] net: add qemu_{configure, create}_nic_device(), qemu_find_nic_info() Date: Thu, 1 Feb 2024 16:43:26 +0000 Message-ID: <20240201164412.785520-2-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; envelope-from=BATV+1220c4869a9b484313cc+7466+infradead.org+dwmw2@desiato.srs.infradead.org; helo=desiato.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806117130100004 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Most code which directly accesses nd_table[] and nb_nics uses them for one of two things. Either "I have created a NIC device and I'd like a configuration for it", or "I will create a NIC device *if* there is a configuration for it". With some variants on the theme around whether they actually *check* if the model specified in the configuration is the right one. Provide functions which perform both of those, allowing platforms to be a little more consistent and as a step towards making nd_table[] and nb_nics private to the net code. One might argue that platforms ought to be consistent about whether they create the unconfigured devices or not, but making significant user-visible changes is explicitly *not* the intent right now. The new functions leave the 'model' field of the NICInfo as NULL after using it for the default NIC model, unlike the qemu_check_nic_model() function which does set nd->model to match default_model explicitly. This is acceptable because there is no code which consumes nd->model except this NIC-matching code in net/net.c, and no reasonable excuse for any code wanting to use nd->model in future. Also export the qemu_find_nic_info() helper, as some platforms have special cases they need to handle. Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant Reviewed-by: Thomas Huth --- include/net/net.h | 40 +++++++++++++++++++++++++++++++++++++ net/net.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) diff --git a/include/net/net.h b/include/net/net.h index ffbd2c8d56..dff1872b4d 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -207,7 +207,47 @@ int qemu_show_nic_models(const char *arg, const char *= const *models); void qemu_check_nic_model(NICInfo *nd, const char *model); int qemu_find_nic_model(NICInfo *nd, const char * const *models, const char *default_model); +/** + * qemu_find_nic_info: Obtain NIC configuration information + * @typename: Name of device object type + * @match_default: Match NIC configurations with no model specified + * @alias: Additional model string to match (for user convenience and + * backward compatibility). + * + * Search for a NIC configuration matching the NIC model constraints. + */ +NICInfo *qemu_find_nic_info(const char *typename, bool match_default, + const char *alias); +/** + * qemu_configure_nic_device: Apply NIC configuration to a given device + * @dev: Network device to be configured + * @match_default: Match NIC configurations with no model specified + * @alias: Additional model string to match + * + * Search for a NIC configuration for the provided device, using the + * additionally specified matching constraints. If found, apply the + * configuration using qdev_set_nic_properties() and return %true. + * + * This is used by platform code which creates the device anyway, + * regardless of whether there is a configuration for it. This tends + * to be platforms which ignore `--nodefaults` and create net devices + * anyway, for example because the Ethernet device on that board is + * always physically present. + */ +bool qemu_configure_nic_device(DeviceState *dev, bool match_default, + const char *alias); =20 +/** + * qemu_create_nic_device: Create a NIC device if a configuration exists f= or it + * @typename: Object typename of network device + * @match_default: Match NIC configurations with no model specified + * @alias: Additional model string to match + * + * Search for a NIC configuration for the provided device type. If found, + * create an object of the corresponding type and return it. + */ +DeviceState *qemu_create_nic_device(const char *typename, bool match_defau= lt, + const char *alias); void print_net_client(Monitor *mon, NetClientState *nc); void net_socket_rs_init(SocketReadState *rs, SocketReadStateFinalize *finalize, diff --git a/net/net.c b/net/net.c index 0520bc1681..aeb7f573fc 100644 --- a/net/net.c +++ b/net/net.c @@ -1087,6 +1087,57 @@ static int net_init_nic(const Netdev *netdev, const = char *name, return idx; } =20 +NICInfo *qemu_find_nic_info(const char *typename, bool match_default, + const char *alias) +{ + NICInfo *nd; + int i; + + for (i =3D 0; i < nb_nics; i++) { + nd =3D &nd_table[i]; + + if (!nd->used || nd->instantiated) { + continue; + } + + if ((match_default && !nd->model) || !g_strcmp0(nd->model, typenam= e) + || (alias && !g_strcmp0(nd->model, alias))) { + return nd; + } + } + return NULL; +} + + +/* "I have created a device. Please configure it if you can" */ +bool qemu_configure_nic_device(DeviceState *dev, bool match_default, + const char *alias) +{ + NICInfo *nd =3D qemu_find_nic_info(object_get_typename(OBJECT(dev)), + match_default, alias); + + if (nd) { + qdev_set_nic_properties(dev, nd); + return true; + } + return false; +} + +/* "Please create a device, if you have a configuration for it" */ +DeviceState *qemu_create_nic_device(const char *typename, bool match_defau= lt, + const char *alias) +{ + NICInfo *nd =3D qemu_find_nic_info(typename, match_default, alias); + DeviceState *dev; + + if (!nd) { + return NULL; + } + + dev =3D qdev_new(typename); + qdev_set_nic_properties(dev, nd); + return dev; +} =20 static int (* const net_client_init_fun[NET_CLIENT_DRIVER__MAX])( const Netdev *netdev, --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17068067180911017.6249302910792; Thu, 1 Feb 2024 08:58:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaDy-0007nA-7q; Thu, 01 Feb 2024 11:47:38 -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 1rVaAq-0002qf-Rg for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:25 -0500 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAm-0002Sx-9a for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:23 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000009cLy-0nwC for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-00000003ILu-0U81 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=XmoH6A+nBWef4HqrfR783ZSUxaA8W49f9I7azkQqtOs=; b=L6A48sQWTXEKiDU25DrwNLuuaH jz8bG/G9TFXNGvz3VBepCg/8rBwvUsjT47JtVVd2cFzRES5ZmumoHVsGLE2z21yel+9EE32r1YVVF 9r5LfM2LixUlbf6Z/EZGBYrC6gw2u43xFOJ+Bu/HiW9EcfOQCGEzSgNEhRwTKegm3+jpepdX+RlN6 KQogDHeHq4fXkIfHsHpdaObkPvgHqWJFPfaY0nY735qxQAm2qa1O2LtfyyqKlKYsRx8gujc8eYXMK p0IlFRca+FLZ3AQVIPzRv49Cy/3WSj7p+hjueS80in0TyZG+PcTQ05Xz2CvEDvvIjb798iBve1Kbx zbPBoj5A==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 02/47] net: report list of available models according to platform Date: Thu, 1 Feb 2024 16:43:27 +0000 Message-ID: <20240201164412.785520-3-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; envelope-from=BATV+1220c4869a9b484313cc+7466+infradead.org+dwmw2@desiato.srs.infradead.org; helo=desiato.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806719100100001 Content-Type: text/plain; charset="utf-8" From: David Woodhouse By noting the models for which a configuration was requested, we can give the user an accurate list of which NIC models were actually available on the platform/configuration that was otherwise chosen. Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- net/net.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/net/net.c b/net/net.c index aeb7f573fc..962904eaef 100644 --- a/net/net.c +++ b/net/net.c @@ -75,6 +75,8 @@ typedef QSIMPLEQ_HEAD(, NetdevQueueEntry) NetdevQueue; =20 static NetdevQueue nd_queue =3D QSIMPLEQ_HEAD_INITIALIZER(nd_queue); =20 +static GHashTable *nic_model_help; + /***********************************************************/ /* network device redirectors */ =20 @@ -1087,12 +1089,94 @@ static int net_init_nic(const Netdev *netdev, const= char *name, return idx; } =20 +static gboolean add_nic_result(gpointer key, gpointer value, gpointer user= _data) +{ + GPtrArray *results =3D user_data; + GPtrArray *alias_list =3D value; + const char *model =3D key; + char *result; + + if (!alias_list) { + result =3D g_strdup(model); + } else { + GString *result_str =3D g_string_new(model); + int i; + + g_string_append(result_str, " (aka "); + for (i =3D 0; i < alias_list->len; i++) { + if (i) { + g_string_append(result_str, ", "); + } + g_string_append(result_str, alias_list->pdata[i]); + } + g_string_append(result_str, ")"); + result =3D result_str->str; + g_string_free(result_str, false); + g_ptr_array_unref(alias_list); + } + g_ptr_array_add(results, result); + return true; +} + +static int model_cmp(char **a, char **b) +{ + return strcmp(*a, *b); +} + +static void show_nic_models(void) +{ + GPtrArray *results =3D g_ptr_array_new(); + int i; + + g_hash_table_foreach_remove(nic_model_help, add_nic_result, results); + g_ptr_array_sort(results, (GCompareFunc)model_cmp); + + printf("Available NIC models for this configuration:\n"); + for (i =3D 0 ; i < results->len; i++) { + printf("%s\n", (char *)results->pdata[i]); + } + g_hash_table_unref(nic_model_help); + nic_model_help =3D NULL; +} + +static void add_nic_model_help(const char *model, const char *alias) +{ + GPtrArray *alias_list =3D NULL; + + if (g_hash_table_lookup_extended(nic_model_help, model, NULL, + (gpointer *)&alias_list)) { + /* Already exists, no alias to add: return */ + if (!alias) { + return; + } + if (alias_list) { + /* Check if this alias is already in the list. Add if not. */ + if (!g_ptr_array_find_with_equal_func(alias_list, alias, + g_str_equal, NULL)) { + g_ptr_array_add(alias_list, g_strdup(alias)); + } + return; + } + } + /* Either this model wasn't in the list already, or a first alias adde= d */ + if (alias) { + alias_list =3D g_ptr_array_new(); + g_ptr_array_set_free_func(alias_list, g_free); + g_ptr_array_add(alias_list, g_strdup(alias)); + } + g_hash_table_replace(nic_model_help, g_strdup(model), alias_list); +} + NICInfo *qemu_find_nic_info(const char *typename, bool match_default, const char *alias) { NICInfo *nd; int i; =20 + if (nic_model_help) { + add_nic_model_help(typename, alias); + } + for (i =3D 0; i < nb_nics; i++) { nd =3D &nd_table[i]; =20 @@ -1606,6 +1690,10 @@ void net_check_clients(void) NetClientState *nc; int i; =20 + if (nic_model_help) { + show_nic_models(); + exit(0); + } net_hub_check_clients(); =20 QTAILQ_FOREACH(nc, &net_clients, next) { @@ -1685,6 +1773,12 @@ static int net_param_nic(void *dummy, QemuOpts *opts= , Error **errp) memset(ni, 0, sizeof(*ni)); ni->model =3D qemu_opt_get_del(opts, "model"); =20 + if (!nic_model_help && !g_strcmp0(ni->model, "help")) { + nic_model_help =3D g_hash_table_new_full(g_str_hash, g_str_equal, + g_free, NULL); + return 0; + } + /* Create an ID if the user did not specify one */ nd_id =3D g_strdup(qemu_opts_id(opts)); if (!nd_id) { --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806337428419.6493089892514; Thu, 1 Feb 2024 08:52:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaCD-0003yQ-5B; Thu, 01 Feb 2024 11:45:51 -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 1rVaB3-0002vA-4p for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:37 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAt-0002Pq-Vq for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:36 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAe-0000000GIcv-1p9A for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:13 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-00000003ILy-0mkl for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To: From:Reply-To:Cc:Content-ID:Content-Description; bh=OdxzKrubfC0ZaYycLGHWamGW/MHu3AZpCkbdAJlgMyI=; b=c7Q9gZLKv3gFOjxuzCTKtS4S6H tsXHqR3S92hJu2aPpNyzNdi7/PZ7h/jk0aOmwbrd7NuWpoAoI/elMeOJlJ6uOW+rXsC6mri2wKBsW 7uKpkHe4aF0Y/I9vMemY7eVwaBMY5Ur6L4rur/84mm3b7p7yZ5Rn6pjephA0kh78e4CbSgNX8G0Tj 77UNnJLMAX1m2LzZRxAbJfyNhcqqEqomCYSnkYOWA0orEutz+A4ifyFgSIbONeoTaxsR7BKk8619G N4EPoR9R7EeOJKBH7JHXoe4Uf23ccLnyZboarvtnLYuFZAm/DFdWn4cwhWqcf0IeI2ITBe3hDuIft mEZH/jNg==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 03/47] net: add qemu_create_nic_bus_devices() Date: Thu, 1 Feb 2024 16:43:28 +0000 Message-ID: <20240201164412.785520-4-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806337885100002 From: David Woodhouse This will instantiate any NICs which live on a given bus type. Each bus is allowed *one* substitution (for PCI it's virtio =E2=86=92 virtio-net-pci= , for Xen it's xen =E2=86=92 xen-net-device; no point in overengineering it unles= s we actually want more). Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant Reviewed-by: Thomas Huth --- include/net/net.h | 22 ++++++++++++++++++++ net/net.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/include/net/net.h b/include/net/net.h index dff1872b4d..728ca965af 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -248,6 +248,28 @@ bool qemu_configure_nic_device(DeviceState *dev, bool = match_default, */ DeviceState *qemu_create_nic_device(const char *typename, bool match_defau= lt, const char *alias); + +/* + * qemu_create_nic_bus_devices: Create configured NIC devices for a given = bus + * @bus: Bus on which to create devices + * @parent_type: Object type for devices to be created (e.g. TYPE_PCI_DEVI= CE) + * @default_model: Object type name for default NIC model (or %NULL) + * @alias: Additional model string to replace, for user convenience + * @alias_target: Actual object type name to be used in place of @alias + * + * Instantiate dynamic NICs on a given bus, typically a PCI bus. This scans + * for available NIC configurations which either specify a model which is + * a child type of @parent_type, or which do not specify a model when + * @default_model is non-NULL. Each device is instantiated on the given @b= us. + * + * A single substitution is supported, e.g. "xen" =E2=86=92 "xen-net-devic= e" for the + * Xen bus, or "virtio" =E2=86=92 "virtio-net-pci" for PCI. This allows th= e user to + * specify a more understandable "model=3D" parameter on the command line,= not + * only the real object typename. + */ +void qemu_create_nic_bus_devices(BusState *bus, const char *parent_type, + const char *default_model, + const char *alias, const char *alias_targ= et); void print_net_client(Monitor *mon, NetClientState *nc); void net_socket_rs_init(SocketReadState *rs, SocketReadStateFinalize *finalize, diff --git a/net/net.c b/net/net.c index 962904eaef..4651b3f443 100644 --- a/net/net.c +++ b/net/net.c @@ -1223,6 +1223,59 @@ DeviceState *qemu_create_nic_device(const char *type= name, bool match_default, return dev; } =20 +void qemu_create_nic_bus_devices(BusState *bus, const char *parent_type, + const char *default_model, + const char *alias, const char *alias_targ= et) +{ + GPtrArray *nic_models =3D qemu_get_nic_models(parent_type); + const char *model; + DeviceState *dev; + NICInfo *nd; + int i; + + if (nic_model_help) { + if (alias_target) { + add_nic_model_help(alias_target, alias); + } + for (i =3D 0; i < nic_models->len - 1; i++) { + add_nic_model_help(nic_models->pdata[i], NULL); + } + } + + /* Drop the NULL terminator which would make g_str_equal() unhappy */ + nic_models->len--; + + for (i =3D 0; i < nb_nics; i++) { + nd =3D &nd_table[i]; + + if (!nd->used || nd->instantiated) { + continue; + } + + model =3D nd->model ? nd->model : default_model; + if (!model) { + continue; + } + + /* Each bus type is allowed *one* substitution */ + if (g_str_equal(model, alias)) { + model =3D alias_target; + } + + if (!g_ptr_array_find_with_equal_func(nic_models, model, + g_str_equal, NULL)) { + /* This NIC does not live on this bus. */ + continue; + } + + dev =3D qdev_new(model); + qdev_set_nic_properties(dev, nd); + qdev_realize_and_unref(dev, bus, &error_fatal); + } + + g_ptr_array_free(nic_models, true); +} + static int (* const net_client_init_fun[NET_CLIENT_DRIVER__MAX])( const Netdev *netdev, const char *name, --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806758268228.22279516483843; Thu, 1 Feb 2024 08:59:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaDn-0007Ck-Pd; Thu, 01 Feb 2024 11:47: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 1rVaB2-0002tu-1l for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:36 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAt-0002Pt-RU for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:35 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAe-0000000GIcw-1g7S for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:13 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-00000003IM2-148m for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=dpw3DRxnhjEAefg4lwR8FOrDMECu9upnm/FS6/8ckXY=; b=sMhEF2mohBz5yqjxntMPS1FtRH 9iecihKVygOk9WKa3fBgtbjc+oZGxqvMLtie8nHqY7L9a/tQ8K8+VNZIL1PW96f/cL+/S1IFzAxrW aS8tTea7XynpySMhv8OGhbqRf0IrjHSMtBlJS0EKA2LI0icfTshqWL0ACi8KIqmnGHAdxli62P4hF IM3rf7CD2dUANkFtJK+iLLAMcjDvppxDnet97cP8zwOCf8b3E+VhHJnUXrcywK8o11sHCghi7EJ9E de/knMjW+dBsu4GlDYlSotfGGhtFezyt5MBJWoMUDwuscB8O9VhbLB/e6SueQOVuM+zr14YrbHdrH KipP/+eQ==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 04/47] hw/pci: add pci_init_nic_devices(), pci_init_nic_in_slot() Date: Thu, 1 Feb 2024 16:43:29 +0000 Message-ID: <20240201164412.785520-5-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806759212100006 Content-Type: text/plain; charset="utf-8" From: David Woodhouse The loop over nd_table[] to add PCI NICs is repeated in quite a few places. Add a helper function to do it. Some platforms also try to instantiate a specific model in a specific slot, to match the real hardware. Add pci_init_nic_in_slot() for that purpose. Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- hw/pci/pci.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ include/hw/pci/pci.h | 4 +++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 76080af580..5849606f66 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1925,6 +1925,51 @@ PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *= rootbus, return pci_dev; } =20 +void pci_init_nic_devices(PCIBus *bus, const char *default_model) +{ + qemu_create_nic_bus_devices(&bus->qbus, TYPE_PCI_DEVICE, default_model, + "virtio", "virtio-net-pci"); +} + +bool pci_init_nic_in_slot(PCIBus *rootbus, const char *model, + const char *alias, const char *devaddr) +{ + NICInfo *nd =3D qemu_find_nic_info(model, true, alias); + int dom, busnr, devfn; + PCIDevice *pci_dev; + unsigned slot; + PCIBus *bus; + + if (!nd) { + return false; + } + + if (!devaddr || pci_parse_devaddr(devaddr, &dom, &busnr, &slot, NULL) = < 0) { + error_report("Invalid PCI device address %s for device %s", + devaddr, model); + exit(1); + } + + if (dom !=3D 0) { + error_report("No support for non-zero PCI domains"); + exit(1); + } + + devfn =3D PCI_DEVFN(slot, 0); + + bus =3D pci_find_bus_nr(rootbus, busnr); + if (!bus) { + error_report("Invalid PCI device address %s for device %s", + devaddr, model); + exit(1); + } + + pci_dev =3D pci_new(devfn, model); + qdev_set_nic_properties(&pci_dev->qdev, nd); + pci_realize_and_unref(pci_dev, bus, &error_fatal); + return true; +} + PCIDevice *pci_vga_init(PCIBus *bus) { vga_interface_created =3D true; diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index fa6313aabc..6ff0b95a02 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -317,7 +317,9 @@ void pci_device_reset(PCIDevice *dev); PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus, const char *default_model, const char *default_devaddr); - +void pci_init_nic_devices(PCIBus *bus, const char *default_model); +bool pci_init_nic_in_slot(PCIBus *rootbus, const char *default_model, + const char *alias, const char *devaddr); PCIDevice *pci_vga_init(PCIBus *bus); =20 static inline PCIBus *pci_get_bus(const PCIDevice *dev) --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806109664818.3908688863042; Thu, 1 Feb 2024 08:48:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaCe-0004NC-Lr; Thu, 01 Feb 2024 11:46:19 -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 1rVaB6-0002xg-DK for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:41 -0500 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAv-0002St-1p for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:40 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000009cLz-0m7K for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:15 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-00000003IM6-1LeT for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=aYJS/1ZmHvWqcX4ZFiiuaV9MoKjFfmvD/b97zwR6RTs=; b=Er0Jz5qlmqqRMlQldC8zhwLAIT 9ukAVW2piO/2sdvnt9Td/W+G81N7Aj6ENE+Q//Q8hRSNKfSATColxhRP24Qe7yFxhuLnpWChIsKuz JxNPwOHhx0k2h0Cf6HVMxjNXfgesfzD6t413dI6R06nX7nukioi3oFZ+fUGULgejXJcP38z8vTZbk jrj3uUR1cciIpe3oiNc2NFuDGAB0tR1nql6IoCqp8DmnOHK46A4f5jBdExXUEZsVr/RLDg1kGkPh8 khlYsVc7fCANFiVqNmBpyfaPyUevXeot+XB/q5Hp9ys4gdY/846PjnqPOa9n+8y8sWVN6/pfvRkof TGkN08yw==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 05/47] hw/i386/pc: use qemu_get_nic_info() and pci_init_nic_devices() Date: Thu, 1 Feb 2024 16:43:30 +0000 Message-ID: <20240201164412.785520-6-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; envelope-from=BATV+1220c4869a9b484313cc+7466+infradead.org+dwmw2@desiato.srs.infradead.org; helo=desiato.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806111124100006 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Eliminate direct access to nd_table[] and nb_nics by processing the the Xen and ISA NICs first and then calling pci_init_nic_devices() for the rest. Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- hw/i386/pc.c | 31 +++++++++++++++++++------------ include/hw/net/ne2000-isa.h | 2 -- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 803244e5cc..ebb0b1c667 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -654,15 +654,19 @@ static const int ne2000_io[NE2000_NB_MAX] =3D { 0x300= , 0x320, 0x340, 0x360, 0x280, 0x380 }; static const int ne2000_irq[NE2000_NB_MAX] =3D { 9, 10, 11, 3, 4, 5 }; =20 -static void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd) +static gboolean pc_init_ne2k_isa(ISABus *bus, NICInfo *nd, Error **errp) { static int nb_ne2k =3D 0; =20 - if (nb_ne2k =3D=3D NE2000_NB_MAX) - return; + if (nb_ne2k =3D=3D NE2000_NB_MAX) { + error_setg(errp, + "maximum number of ISA NE2000 devices exceeded"); + return false; + } isa_ne2000_init(bus, ne2000_io[nb_ne2k], ne2000_irq[nb_ne2k], nd); nb_ne2k++; + return true; } =20 void pc_acpi_smi_interrupt(void *opaque, int irq, int level) @@ -1297,23 +1301,26 @@ void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_= bus, PCIBus *pci_bus, BusState *xen_bus) { MachineClass *mc =3D MACHINE_CLASS(pcmc); - int i; + bool default_is_ne2k =3D g_str_equal(mc->default_nic, TYPE_ISA_NE2000); + NICInfo *nd; =20 rom_set_order_override(FW_CFG_ORDER_OVERRIDE_NIC); - for (i =3D 0; i < nb_nics; i++) { - NICInfo *nd =3D &nd_table[i]; - const char *model =3D nd->model ? nd->model : mc->default_nic; =20 - if (xen_bus && (!nd->model || g_str_equal(model, "xen-net-device")= )) { + if (xen_bus) { + while ((nd =3D qemu_find_nic_info("xen-net-device", true, NULL))) { DeviceState *dev =3D qdev_new("xen-net-device"); qdev_set_nic_properties(dev, nd); qdev_realize_and_unref(dev, xen_bus, &error_fatal); - } else if (g_str_equal(model, "ne2k_isa")) { - pc_init_ne2k_isa(isa_bus, nd); - } else { - pci_nic_init_nofail(nd, pci_bus, model, NULL); } } + + while ((nd =3D qemu_find_nic_info(TYPE_ISA_NE2000, default_is_ne2k, NU= LL))) { + pc_init_ne2k_isa(isa_bus, nd, &error_fatal); + } + + /* Anything remaining should be a PCI NIC */ + pci_init_nic_devices(pci_bus, mc->default_nic); + rom_reset_order_override(); } =20 diff --git a/include/hw/net/ne2000-isa.h b/include/hw/net/ne2000-isa.h index af59ee0b02..73bae10ad1 100644 --- a/include/hw/net/ne2000-isa.h +++ b/include/hw/net/ne2000-isa.h @@ -22,8 +22,6 @@ static inline ISADevice *isa_ne2000_init(ISABus *bus, int= base, int irq, { ISADevice *d; =20 - qemu_check_nic_model(nd, "ne2k_isa"); - d =3D isa_try_new(TYPE_ISA_NE2000); if (d) { DeviceState *dev =3D DEVICE(d); --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806558494933.1856096893055; Thu, 1 Feb 2024 08:55:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaBI-00030h-Id; Thu, 01 Feb 2024 11:44: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 1rVaAr-0002rj-UK for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:26 -0500 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAm-0002Sw-AH for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:25 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000009cM0-0u4A for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-00000003IMA-1e8d for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=tD5qNwo6WTjFe97d4nPQafto5xogGJwduqrsT8Y/lfs=; b=BJ1JVDa/u6xblXrdTUIHIAW4W0 npVOqDXxfjcS2/RcuNn2Z7IRPqE10y8se9PkO89oBIyv6P99JC0v9VD+7UCMK6Yjj//wRCxbiZrA4 6mkO3vltmYoAS1cjAA7YJuiDwEEbjVQK9nc3a37zZ8eWuj2GXBLx5sAB4Hi1mLsE6HqLM4gLzQFSu j2MiPmizssROhcir6AWUMWw1lbFE9JHT2kNWOvSD1WQMifr2k4WkzCIwIPJB38dlw0dinDPZCqa2d khMr4p+DAgBKrm/2/JUIqCz02EjpQoWE45h5M6sQu2WkcYv2oYlPTVBVLHCJ0xJnEs9UaZ9SrQgNf TiCIBVXg==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 06/47] hw/xen: use qemu_create_nic_bus_devices() to instantiate Xen NICs Date: Thu, 1 Feb 2024 16:43:31 +0000 Message-ID: <20240201164412.785520-7-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; envelope-from=BATV+1220c4869a9b484313cc+7466+infradead.org+dwmw2@desiato.srs.infradead.org; helo=desiato.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806560732100007 Content-Type: text/plain; charset="utf-8" From: David Woodhouse When instantiating XenBus itself, for each NIC which is configured with either the model unspecified, or set to to "xen" or "xen-net-device", create a corresponding xen-net-device for it. Now we can revert the previous more hackish version which relied on the platform code explicitly registering the NICs on its own XenBus, having returned the BusState* from xen_bus_init() itself. This also fixes the setup for Xen PV guests, which was previously broken in various ways and never actually managed to peer with the netdev. Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- hw/i386/pc.c | 13 ++----------- hw/i386/pc_piix.c | 2 +- hw/i386/pc_q35.c | 2 +- hw/xen/xen-bus.c | 6 ++++-- hw/xen/xen_devconfig.c | 25 ------------------------- hw/xenpv/xen_machine_pv.c | 9 --------- include/hw/i386/pc.h | 4 +--- include/hw/xen/xen-bus.h | 2 +- include/hw/xen/xen-legacy-backend.h | 1 - 9 files changed, 10 insertions(+), 54 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index ebb0b1c667..196827531a 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1269,7 +1269,7 @@ void pc_basic_device_init(struct PCMachineState *pcms, if (pcms->bus) { pci_create_simple(pcms->bus, -1, "xen-platform"); } - pcms->xenbus =3D xen_bus_init(); + xen_bus_init(); xen_be_init(); } #endif @@ -1297,8 +1297,7 @@ void pc_basic_device_init(struct PCMachineState *pcms, pcms->vmport !=3D ON_OFF_AUTO_ON); } =20 -void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus, - BusState *xen_bus) +void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus) { MachineClass *mc =3D MACHINE_CLASS(pcmc); bool default_is_ne2k =3D g_str_equal(mc->default_nic, TYPE_ISA_NE2000); @@ -1306,14 +1305,6 @@ void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_b= us, PCIBus *pci_bus, =20 rom_set_order_override(FW_CFG_ORDER_OVERRIDE_NIC); =20 - if (xen_bus) { - while ((nd =3D qemu_find_nic_info("xen-net-device", true, NULL))) { - DeviceState *dev =3D qdev_new("xen-net-device"); - qdev_set_nic_properties(dev, nd); - qdev_realize_and_unref(dev, xen_bus, &error_fatal); - } - } - while ((nd =3D qemu_find_nic_info(TYPE_ISA_NE2000, default_is_ne2k, NU= LL))) { pc_init_ne2k_isa(isa_bus, nd, &error_fatal); } diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index abfcfe4d2b..70d12bb1b5 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -339,7 +339,7 @@ static void pc_init1(MachineState *machine, pc_basic_device_init(pcms, isa_bus, x86ms->gsi, rtc_state, true, 0x4); =20 - pc_nic_init(pcmc, isa_bus, pci_bus, pcms->xenbus); + pc_nic_init(pcmc, isa_bus, pci_bus); =20 if (pcmc->pci_enabled) { pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state); diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index f43d5142b8..7ca3f465e0 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -340,7 +340,7 @@ static void pc_q35_init(MachineState *machine) =20 /* the rest devices to which pci devfn is automatically assigned */ pc_vga_init(isa_bus, host_bus); - pc_nic_init(pcmc, isa_bus, host_bus, pcms->xenbus); + pc_nic_init(pcmc, isa_bus, host_bus); =20 if (machine->nvdimms_state->is_enabled) { nvdimm_init_acpi_state(machine->nvdimms_state, system_io, diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c index 4973e7d9c9..fb82cc33e4 100644 --- a/hw/xen/xen-bus.c +++ b/hw/xen/xen-bus.c @@ -19,6 +19,7 @@ #include "qapi/error.h" #include "qapi/qmp/qdict.h" #include "sysemu/sysemu.h" +#include "net/net.h" #include "trace.h" =20 static char *xen_device_get_backend_path(XenDevice *xendev) @@ -1133,7 +1134,7 @@ static void xen_register_types(void) =20 type_init(xen_register_types) =20 -BusState *xen_bus_init(void) +void xen_bus_init(void) { DeviceState *dev =3D qdev_new(TYPE_XEN_BRIDGE); BusState *bus =3D qbus_new(TYPE_XEN_BUS, dev, NULL); @@ -1141,5 +1142,6 @@ BusState *xen_bus_init(void) sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); qbus_set_bus_hotplug_handler(bus); =20 - return bus; + qemu_create_nic_bus_devices(bus, TYPE_XEN_DEVICE, "xen-net-device", + "xen", "xen-net-device"); } diff --git a/hw/xen/xen_devconfig.c b/hw/xen/xen_devconfig.c index 3f77c675c6..2150869f60 100644 --- a/hw/xen/xen_devconfig.c +++ b/hw/xen/xen_devconfig.c @@ -46,31 +46,6 @@ static int xen_config_dev_all(char *fe, char *be) =20 /* ------------------------------------------------------------- */ =20 -int xen_config_dev_nic(NICInfo *nic) -{ - char fe[256], be[256]; - char mac[20]; - int vlan_id =3D -1; - - net_hub_id_for_client(nic->netdev, &vlan_id); - snprintf(mac, sizeof(mac), "%02x:%02x:%02x:%02x:%02x:%02x", - nic->macaddr.a[0], nic->macaddr.a[1], nic->macaddr.a[2], - nic->macaddr.a[3], nic->macaddr.a[4], nic->macaddr.a[5]); - xen_pv_printf(NULL, 1, "config nic %d: mac=3D\"%s\"\n", vlan_id, mac); - xen_config_dev_dirs("vif", "qnic", vlan_id, fe, be, sizeof(fe)); - - /* frontend */ - xenstore_write_int(fe, "handle", vlan_id); - xenstore_write_str(fe, "mac", mac); - - /* backend */ - xenstore_write_int(be, "handle", vlan_id); - xenstore_write_str(be, "mac", mac); - - /* common stuff */ - return xen_config_dev_all(fe, be); -} - int xen_config_dev_vfb(int vdev, const char *type) { char fe[256], be[256]; diff --git a/hw/xenpv/xen_machine_pv.c b/hw/xenpv/xen_machine_pv.c index 9f9f137f99..1130d1a147 100644 --- a/hw/xenpv/xen_machine_pv.c +++ b/hw/xenpv/xen_machine_pv.c @@ -32,8 +32,6 @@ =20 static void xen_init_pv(MachineState *machine) { - int i; - setup_xen_backend_ops(); =20 /* Initialize backend core & drivers */ @@ -62,13 +60,6 @@ static void xen_init_pv(MachineState *machine) vga_interface_created =3D true; } =20 - /* configure nics */ - for (i =3D 0; i < nb_nics; i++) { - if (!nd_table[i].model || 0 !=3D strcmp(nd_table[i].model, "xen")) - continue; - xen_config_dev_nic(nd_table + i); - } - xen_bus_init(); =20 /* config cleanup hook */ diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 916af29f7c..ec0e5efcb2 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -33,7 +33,6 @@ typedef struct PCMachineState { =20 /* Pointers to devices and objects: */ PCIBus *bus; - BusState *xenbus; I2CBus *smbus; PFlashCFI01 *flash[2]; ISADevice *pcspk; @@ -185,8 +184,7 @@ void pc_basic_device_init(struct PCMachineState *pcms, void pc_cmos_init(PCMachineState *pcms, BusState *ide0, BusState *ide1, ISADevice *s); -void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus, - BusState *xen_bus); +void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus); =20 void pc_i8259_create(ISABus *isa_bus, qemu_irq *i8259_irqs); =20 diff --git a/include/hw/xen/xen-bus.h b/include/hw/xen/xen-bus.h index 334ddd1ff6..38d40afa37 100644 --- a/include/hw/xen/xen-bus.h +++ b/include/hw/xen/xen-bus.h @@ -75,7 +75,7 @@ struct XenBusClass { OBJECT_DECLARE_TYPE(XenBus, XenBusClass, XEN_BUS) =20 -BusState *xen_bus_init(void); +void xen_bus_init(void); =20 void xen_device_backend_set_state(XenDevice *xendev, enum xenbus_state state); diff --git a/include/hw/xen/xen-legacy-backend.h b/include/hw/xen/xen-legac= y-backend.h index fc42146bc2..2cca174778 100644 --- a/include/hw/xen/xen-legacy-backend.h +++ b/include/hw/xen/xen-legacy-backend.h @@ -81,7 +81,6 @@ extern struct XenDevOps xen_usb_ops; /* xen-usb.= c */ =20 /* configuration (aka xenbus setup) */ void xen_config_cleanup(void); -int xen_config_dev_nic(NICInfo *nic); int xen_config_dev_vfb(int vdev, const char *type); int xen_config_dev_vkbd(int vdev); int xen_config_dev_console(int vdev); --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170680600790394.64600053423305; Thu, 1 Feb 2024 08:46:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaAq-0002qR-LC; Thu, 01 Feb 2024 11:44:25 -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 1rVaAl-0002pC-K8 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:19 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAj-0002Pr-5N for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:19 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAe-0000000GIcx-1gwe for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:13 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-00000003IMG-1yMG for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=C7nZq/xI+tHeWx5EE1R48ZvurCMfWCSLsOC+/dyJjdk=; b=TehMQsDu/jhHwwMBE+S3qYecIw nhAARAec1eqZpmfNr/jZchOOFGH1y7Fnb4xka6QBfisYBXDYJZkNJj524wvbXQ3obd9FicChslbLn NLuF8fYQvwTlFiXsmkF/sysMeJmz6tWL88vZ6MLGAl/vDMLfrei7DRHd3MSlimAPmj5HrinbkapPd 0k8iVSnxZNB2A73NuK5DcXtc2VeinRNR8r/DHu+kLqwCPgfzAUFtCzxqyrN75d5hBsJKJCNs4miK5 WJyblrfFcU8/1t9G601AykuMS2rBe9Fm2vv4XskWmrPLTkxSlDaQ1C/Sal473FDuMT2ton4DwCJb/ SjikzJ4A==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 07/47] hw/alpha/dp264: use pci_init_nic_devices() Date: Thu, 1 Feb 2024 16:43:32 +0000 Message-ID: <20240201164412.785520-8-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806008837100005 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/alpha/dp264.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index 03495e1e60..52a1fa310b 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -124,9 +124,7 @@ static void clipper_init(MachineState *machine) pci_vga_init(pci_bus); =20 /* Network setup. e1000 is good enough, failing Tulip support. */ - for (i =3D 0; i < nb_nics; i++) { - pci_nic_init_nofail(&nd_table[i], pci_bus, mc->default_nic, NULL); - } + pci_init_nic_devices(pci_bus, mc->default_nic); =20 /* Super I/O */ isa_create_simple(isa_bus, TYPE_SMC37C669_SUPERIO); --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806847447663.47282964775; Thu, 1 Feb 2024 09:00:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaD8-0005h3-3I; Thu, 01 Feb 2024 11:46:46 -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 1rVaB4-0002vI-2I for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:39 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAt-0002Pp-Sq for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:37 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAe-0000000GIcy-2hSt for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-00000003IMK-253F for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=5UKFkHiz+IiNYOcDnAfWAdDSJCkk6kLbMMON/gDXwYM=; b=PRo09XwWz4rY3IcEXHXbqll7eq U2yd34Nh5YdErMvdu2x4J/LA1wBy8rokt50v09pDmmzjGlk6FmrBRut8SqDMzVpz6T3ck3zUVHXCd N+Ov+D+hUfedvuR6JX6RzdTHP4CkV+58aO2FbTn8V/cKet91IqWlI+C5LZKRkrKw/aeAKQBY+4Fr/ TQmEFyDNw3rEbU0yjUcgLRW6+bdgOhbt2FQDVIo14PQD4R1n4xGT10gwcY9JhvrlknArtchlO1Fwl DH759daDTzLoywdE2WSnkLLxTOWKWi7UmlCgeLfaNib1S5F1/c2u1yswgPS25E34UL0bx+KVqcdcI SD7CYoWA==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 08/47] hw/arm/sbsa-ref: use pci_init_nic_devices() Date: Thu, 1 Feb 2024 16:43:33 +0000 Message-ID: <20240201164412.785520-9-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806849662100001 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Leif Lindholm --- hw/arm/sbsa-ref.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index 85cb68d546..f2adf30337 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -673,9 +673,7 @@ static void create_pcie(SBSAMachineState *sms) =20 pci =3D PCI_HOST_BRIDGE(dev); if (pci->bus) { - for (i =3D 0; i < nb_nics; i++) { - pci_nic_init_nofail(&nd_table[i], pci->bus, mc->default_nic, N= ULL); - } + pci_init_nic_devices(pci->bus, mc->default_nic); } =20 pci_create_simple(pci->bus, -1, "bochs-display"); --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706805991035948.2821830690317; Thu, 1 Feb 2024 08:46:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaBc-0003IQ-T7; Thu, 01 Feb 2024 11:45:13 -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 1rVaAq-0002qe-Qi for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:25 -0500 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAm-0002T0-A7 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:24 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000009cM1-0ue9 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-00000003IMO-2Mu9 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=X8HABeQWYWDEMC8Cu9m1h/KbQFN3HQ6PU+iqyRJhTPQ=; b=Oxh3VZtBf7VklEgH7RMYqZXMaj e4GOexI0Z0KDJH5HzJ0ExSAjIRomoT3EUPmjqrcmw9cEitjfHp6HKr+5mDxrT3EgYpulaGOoHQ+tD SvrADFSJuPi5xWCqDExZIPbUhqfNTnfKH3tD3DvorNXx0Nq8eeKariTW/nB74ukIRMijp2kLscRCS 5PoLMK6h94tF0KojxHdj5m7elACG8mMMEsrnJu/9dmLowChdeIuGwIxSke0WmWQcJC5Z4VdxXOGFZ vYN4pMHhYssY9C4NVik0Tj7VnTDm8Sw65zs8WFV++g0Y6A+mZ/bG6gH4WQZ9HVYemnosQvzVN37Zs 9edTMaLw==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 09/47] hw/arm/virt: use pci_init_nic_devices() Date: Thu, 1 Feb 2024 16:43:34 +0000 Message-ID: <20240201164412.785520-10-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; envelope-from=BATV+1220c4869a9b484313cc+7466+infradead.org+dwmw2@desiato.srs.infradead.org; helo=desiato.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706805992747100003 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/arm/virt.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index e6ead2c5c8..368c2a415a 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1457,9 +1457,7 @@ static void create_pcie(VirtMachineState *vms) pci->bypass_iommu =3D vms->default_bus_bypass_iommu; vms->bus =3D pci->bus; if (vms->bus) { - for (i =3D 0; i < nb_nics; i++) { - pci_nic_init_nofail(&nd_table[i], pci->bus, mc->default_nic, N= ULL); - } + pci_init_nic_devices(pci->bus, mc->default_nic); } =20 nodename =3D vms->pciehb_nodename =3D g_strdup_printf("/pcie@%" PRIx64= , base); --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706807066733486.34912780136165; Thu, 1 Feb 2024 09:04:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaCn-0004UN-JR; Thu, 01 Feb 2024 11:46: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 1rVaB4-0002vK-2q for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:39 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAt-0002Qe-Uu for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:37 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAe-0000000GIcz-3rCU for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-00000003IMS-2fHf for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=mlzjYpSZjZYD2hYts+UpgvgXir7egBvmFzjPnPYKEbw=; b=npLRH8w1qzNycnHMMtiO+GfrT9 3yH7QQz4lmqgxO9kkdiu6ZHsus3GtnVUmQB7JxXerXJf7SOXdmeXW9dGYUE8WXv8NPKi8tE1K7WT+ UCE+/zqshHMuorgrFPD3LGk5hgvd1Xo3kU9Xegt/lGWlk/I4Sgxs1vJ82iYEzVV36/we1hA5XyaD/ ZpFuJRD74aUsF5KJ3Pxk0eHsfwp8FL17hEtRgepSRdUtntZJt3324p7vnHhji90kSy2Gs2BHW4ndz dcxMr5b5HEqYw7XUXku/NcVH9kM4UZbkIZuzIWGtbTTQvneXHxr68RS5iSkjnMIHSf46AwoO2RoT0 GdH3kTxQ==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 10/47] hw/hppa: use pci_init_nic_devices() Date: Thu, 1 Feb 2024 16:43:35 +0000 Message-ID: <20240201164412.785520-11-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706807068916100003 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/hppa/machine.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 9e611620cc..a1045b48cc 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -342,7 +342,6 @@ static void machine_HP_common_init_tail(MachineState *m= achine, PCIBus *pci_bus, uint64_t kernel_entry =3D 0, kernel_low, kernel_high; MemoryRegion *addr_space =3D get_system_memory(); MemoryRegion *rom_region; - long i; unsigned int smp_cpus =3D machine->smp.cpus; SysBusDevice *s; =20 @@ -368,10 +367,8 @@ static void machine_HP_common_init_tail(MachineState *= machine, PCIBus *pci_bus, qdev_get_gpio_in(lasi_dev, LASI_IRQ_LAN_HPA)); } =20 - for (i =3D 0; i < nb_nics; i++) { - if (!enable_lasi_lan()) { - pci_nic_init_nofail(&nd_table[i], pci_bus, mc->default_nic, NU= LL); - } + if (!enable_lasi_lan()) { + pci_init_nic_devices(pci_bus, mc->default_nic); } =20 /* BMC board: HP Powerbar SP2 Diva (with console only) */ --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806713445725.3469857410626; Thu, 1 Feb 2024 08:58:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaD0-00051s-OE; Thu, 01 Feb 2024 11:46:38 -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 1rVaB5-0002wB-D6 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:39 -0500 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAu-0002Sq-LP for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:38 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000009cM2-0q0s for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-00000003IMW-2rCn for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=afu5SeBMsL4uhfrFSeYnQUM9L+/AYnp0sc/n0TEsd5I=; b=GKhcAumGGuz/Clc3ij4venEeO0 /bGGyigQsifjm4psdVDNVDAwKX3qznMKg9fEOsgnopd70s6xkmZNZYxHqNb7NkxGI4wDmc9SXQY3H ULX2RZZrdvPVv83UMLKM1lV5+Lrf3sIzh44Y5dmj5x/LG99NTS64gptJ3gUUhYxiFPVluQmpI+aHd arTw6Bf3OKpIeu9Sr1hSCiYNDApJvZS+57oTmsdQ7Ms7CAhPpVheP+2a8XhD4lhOZqZhEsM6spT7G EtBXsemx/8SzX78iujbN1uzzB8NFena388BjDWJY9cUtG6tcKZBvTOS6Ff9mG9nxGhdstZ/eSS39b GGU18ePg==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 11/47] hw/loongarch: use pci_init_nic_devices() Date: Thu, 1 Feb 2024 16:43:36 +0000 Message-ID: <20240201164412.785520-12-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; envelope-from=BATV+1220c4869a9b484313cc+7466+infradead.org+dwmw2@desiato.srs.infradead.org; helo=desiato.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806715090100003 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Song Gao --- hw/loongarch/virt.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index c9a680e61a..0ad7d8c887 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -504,9 +504,7 @@ static void loongarch_devices_init(DeviceState *pch_pic= , LoongArchMachineState * fdt_add_uart_node(lams); =20 /* Network init */ - for (i =3D 0; i < nb_nics; i++) { - pci_nic_init_nofail(&nd_table[i], pci_bus, mc->default_nic, NULL); - } + pci_init_nic_devices(pci_bus, mc->default_nic); =20 /* * There are some invalid guest memory access. --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806736633862.1445896139563; Thu, 1 Feb 2024 08:58:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaD8-0005sI-VL; Thu, 01 Feb 2024 11:46:47 -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 1rVaB6-0002xf-Ba for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:41 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAv-0002Ps-1u for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:40 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAe-0000000GId0-2rFg for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-00000003IMa-2ye1 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=4LcthZeMhomcS7qQ4JhYfqujNilKqWbfcJYcyaxs+fc=; b=R5ob6XwqdmMHLIgOQOYJG6+jiH d+wasNW0ZwEuwrhOqAoJrMZszyz6Y9IeltL3bpUNquqTYo6L5KTuLZcwFzIUD2eC/LZ6o+Feus6xK UkqTsRe0OKUZudM3uJs+Nx9ftG6lKrm+ZuMaQ2Iqgz3m9tdS9e6m0XDE4fEj4A+yDVyZztpoiB39Z 0mf+/1kEAWtIuiz/dRgdfrna+QHfYnoYMd4l+Tf0MvCmeDvt7akm+AZybB8jvLgEce3pdmm/6HMrb eJ69tb7UbdSe02d2PXqc+LmhvZPGLC1tUkfE4iyCTh7iMNmPG1wqA5qBjEQBowWijJtEQGaZ0zZUZ Mh595NSg==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 12/47] hw/mips/fuloong2e: use pci_init_nic_devices() Date: Thu, 1 Feb 2024 16:43:37 +0000 Message-ID: <20240201164412.785520-13-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806737154100006 Content-Type: text/plain; charset="utf-8" From: David Woodhouse The previous behaviour was: *if* the first NIC specified on the command line was an RTL8139 (or unspecified model) then it gets assigned to PCI slot 7, which is where the Fuloong board had an RTL8139. All other devices (including the first, if it was specified as anything other than an rtl8319) get dynamically assigned on the bus. The new behaviour is subtly different: If the first NIC was given a specific model *other* than rtl8139, and a subsequent NIC was not, then the rtl8139 (or unspecified) NIC will go to slot 7 and the rest will be dynamically assigned. Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/mips/fuloong2e.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index 97b2c8ed8e..a45aac368c 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -201,19 +201,9 @@ static void main_cpu_reset(void *opaque) /* Network support */ static void network_init(PCIBus *pci_bus) { - int i; - - for (i =3D 0; i < nb_nics; i++) { - NICInfo *nd =3D &nd_table[i]; - const char *default_devaddr =3D NULL; - - if (i =3D=3D 0 && (!nd->model || strcmp(nd->model, "rtl8139") =3D= =3D 0)) { - /* The Fuloong board has a RTL8139 card using PCI SLOT 7 */ - default_devaddr =3D "07"; - } - - pci_nic_init_nofail(nd, pci_bus, "rtl8139", default_devaddr); - } + /* The Fuloong board has a RTL8139 card using PCI SLOT 7 */ + pci_init_nic_in_slot(pci_bus, "rtl8139", NULL, "07"); + pci_init_nic_devices(pci_bus, "rtl8139"); } =20 static void mips_fuloong2e_init(MachineState *machine) --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170680616085591.7711856150612; Thu, 1 Feb 2024 08:49:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaBd-0003Lh-9M; Thu, 01 Feb 2024 11:45:13 -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 1rVaAn-0002q5-QN for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:22 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAj-0002Qc-5X for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:21 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAe-0000000GId1-3i6Q for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-00000003IMe-38HG for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=1By8MLkJQQ5aDNY2GpLO8Lg7eMBepYz9kIQOUj3RWg4=; b=tH7fBugHc7cnkncQebfFsrKPhe 4xOK7lcuYgqDdmUf0q9T2VzD3zkKPyxoJO989Fr3YNLd409DfhNmOpYNBif/X5KRMcf5sBn+BqlKE Pu66Ukotosqh6BjcUtB4grmPgXuxUD5gNmm4g8ixkpTxPF+47idpPhWp99KPAoQ2fKfR9mRJcGIZ3 mL3zkN+V5z48i8t4g4y3lApXCri3OoIWPqD14wysly520QZfvJDIMjCFEhqopETMwTpAP8AzQC2Wm nXqx9Wom3oqocm7ItGFAWkPgWQA18qz+l50Pti1CVR4mr9rM/D80x/3F3aipkAI5G2/fqLNzsbrHM 7QdqQL2A==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 13/47] hw/mips/malta: use pci_init_nic_devices() Date: Thu, 1 Feb 2024 16:43:38 +0000 Message-ID: <20240201164412.785520-14-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806161209100001 Content-Type: text/plain; charset="utf-8" From: David Woodhouse The Malta board setup code would previously place the first NIC into PCI slot 11 if was a PCNet card, and the rest (including the first if it was anything other than a PCNet card) would be dynamically assigned. Now it will place any PCNet NIC into slot 11, and then anything else will be dynamically assigned. Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/mips/malta.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/hw/mips/malta.c b/hw/mips/malta.c index d22bb1edef..af74008c82 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -612,18 +612,9 @@ static MaltaFPGAState *malta_fpga_init(MemoryRegion *a= ddress_space, /* Network support */ static void network_init(PCIBus *pci_bus) { - int i; - - for (i =3D 0; i < nb_nics; i++) { - NICInfo *nd =3D &nd_table[i]; - const char *default_devaddr =3D NULL; - - if (i =3D=3D 0 && (!nd->model || strcmp(nd->model, "pcnet") =3D=3D= 0)) - /* The malta board has a PCNet card using PCI SLOT 11 */ - default_devaddr =3D "0b"; - - pci_nic_init_nofail(nd, pci_bus, "pcnet", default_devaddr); - } + /* The malta board has a PCNet card using PCI SLOT 11 */ + pci_init_nic_in_slot(pci_bus, "pcnet", NULL, "0b"); + pci_init_nic_devices(pci_bus, "pcnet"); } =20 static void bl_setup_gt64120_jump_kernel(void **p, uint64_t run_addr, --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170680673599931.847724193184717; Thu, 1 Feb 2024 08:58:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaDg-0006i1-CG; Thu, 01 Feb 2024 11:47:23 -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 1rVaAq-0002qg-Rk for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:25 -0500 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAm-0002Sz-9a for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:22 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000009cM3-0tA8 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-00000003IMi-3QZg for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=7Uppd3XmmgMw4XasqXjrqhb0RWV0UlzHWXb7dMHxQkk=; b=ZZEanmBS960hi51lWxEiSCFaL2 O1lw3xcimaMRZx+0WkPyuqi01AX6j0AOAc/Ey1lrqrV4GB+9f3tTq/hvnfTBRQ4bHksx+qzsod1Ka u5umNPHDAPx3qH5RquTze8WcCnjYFwUlh/P9iFyYUk2qiYJxQgAcGvLSs/QgSI/8O+C2s0pkT8Yr2 jYFvFRxKDPU+ExKNTNpZf+QbqfUgSthoPaf8nse7F/UgRZ/9siEXo8C6Dimku4wpe/s5LiF7z3MkK DdPhjB2gJC8in36kkp+98XsXGpAgRdbZD+HyLooqSBjk51CcFmrULCwlGUvfV6n4CTC8dAaYDbwEz 7d6jadIw==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 14/47] hw/mips/loongson3_virt: use pci_init_nic_devices() Date: Thu, 1 Feb 2024 16:43:39 +0000 Message-ID: <20240201164412.785520-15-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; envelope-from=BATV+1220c4869a9b484313cc+7466+infradead.org+dwmw2@desiato.srs.infradead.org; helo=desiato.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806737146100004 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/mips/loongson3_virt.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c index 33eae01eca..caedde2df0 100644 --- a/hw/mips/loongson3_virt.c +++ b/hw/mips/loongson3_virt.c @@ -451,9 +451,7 @@ static inline void loongson3_virt_devices_init(MachineS= tate *machine, usb_create_simple(usb_bus_find(-1), "usb-tablet"); } =20 - for (i =3D 0; i < nb_nics; i++) { - pci_nic_init_nofail(&nd_table[i], pci_bus, mc->default_nic, NULL); - } + pci_init_nic_devices(pci_bus, mc->default_nic); } =20 static void mips_loongson3_virt_init(MachineState *machine) --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806188241238.96255207381944; Thu, 1 Feb 2024 08:49:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaB1-0002tb-P9; Thu, 01 Feb 2024 11:44:35 -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 1rVaAq-0002ql-Ug for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:25 -0500 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAm-0002Ss-8i for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:22 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000009cM4-0sa7 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-00000003IMm-3d5L for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=g6ItrTH6xUERJPwo+cm9fCEJutLCoak9PKJqL8zqcI4=; b=c+inkfXLw6SLtGwj6q+ZPhgFmH l/alEf3s8a6oHniM3Q6x0cYlCOjMlDH1xopwZ9tA/rGdtgEHe0dSc5z6aJEw6PDG8S9RVXT6W85y5 +e+hHQKinAgQCGwJTx9CIFKQtcmuWl36v/+CcJJHmgxgud+K/h5SBYZTddRkNhQKfrY62BWwLdBr/ KAqqGMUdQyjsmzbnZn+0ubOANxWtOdjTNzsEVVdf5HyeEhHvW2nZIrhOogx0vyACW+U+QbRy3lKFE xmeDWEjKRlUTZtHI+TkUnlrxD30BkHMN4w1TIxB+C9e0gBWqwFvUGGXB0M+tmQoNrU1RjSk33XOeI W59nvlOw==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 15/47] hw/ppc/prep: use pci_init_nic_devices() Date: Thu, 1 Feb 2024 16:43:40 +0000 Message-ID: <20240201164412.785520-16-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; envelope-from=BATV+1220c4869a9b484313cc+7466+infradead.org+dwmw2@desiato.srs.infradead.org; helo=desiato.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806189274100003 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Previously, the first PCI NIC would be placed in PCI slot 3 and the rest would be dynamically assigned. Even if the user overrode the default NIC type and made it something other than PCNet. Now, the first PCNet NIC (that is, anything not explicitly specified to be anything different) will go to slot 3 even if it isn't the first NIC specified on the command line. And anything else will be dynamically assigned. Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/ppc/prep.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 137276bcb9..1a6cd05c61 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -241,7 +241,6 @@ static void ibm_40p_init(MachineState *machine) ISADevice *isa_dev; ISABus *isa_bus; void *fw_cfg; - int i; uint32_t kernel_base =3D 0, initrd_base =3D 0; long kernel_size =3D 0, initrd_size =3D 0; char boot_device; @@ -336,10 +335,9 @@ static void ibm_40p_init(MachineState *machine) /* XXX: s3-trio at PCI_DEVFN(2, 0) */ pci_vga_init(pci_bus); =20 - for (i =3D 0; i < nb_nics; i++) { - pci_nic_init_nofail(&nd_table[i], pci_bus, mc->default_nic, - i =3D=3D 0 ? "3" : NULL); - } + /* First PCNET device at PCI_DEVFN(3, 0) */ + pci_init_nic_in_slot(pci_bus, mc->default_nic, NULL, "3"); + pci_init_nic_devices(pci_bus, mc->default_nic); } =20 /* Prepare firmware configuration for OpenBIOS */ --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806917263106.07653498701586; Thu, 1 Feb 2024 09:01:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaDv-0007j0-DB; Thu, 01 Feb 2024 11:47:35 -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 1rVaB7-0002yW-Fw for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:42 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAv-0002Qb-7z for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:41 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAe-0000000GId6-3eDE for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-00000003IMq-3uLu for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=IsEBwT+a/9aBHnvV7Yr1FI82jfvo4oBFxfzxJeL3Zis=; b=rq42cqYzyWxFpDk3fm0+D3DIqe VK1STEYJ77v7+NF9huhIY+AYda4YwZQvK/W58FLTDkrpWeBLXZxNBGNHrj1YauZ67yTV9rgSk7F0V 2bnyAgMI4aUno8y0OZDWpL4BwkugYz3mTx8zNY03FnAPO1bRgS7ucdMliGt4tTH1thW82T2DymWEF tlucJlU0z3wAguqvk51CJ9Truvhyfbnh8XC71J/VdufAUxaQO5KifEOhUYgp0ITM4epWvTqrwmVDZ XRG13UdhJgM0wrdXY6kKW0vpBNZs05L77A/VdY9oj+HAPe+Fc3iiyRMUz098E8r2NKSqrjeSsptb+ +D8xgfQQ==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 16/47] hw/ppc/spapr: use qemu_get_nic_info() and pci_init_nic_devices() Date: Thu, 1 Feb 2024 16:43:41 +0000 Message-ID: <20240201164412.785520-17-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806918031100002 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Avoid directly referencing nd_table[] by first instantiating any spapr-vlan devices using a qemu_get_nic_info() loop, then calling pci_init_nic_devices() to do the rest. No functional change intended. Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/ppc/spapr.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index e8dabc8614..0d72d286d8 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2796,6 +2796,7 @@ static void spapr_machine_init(MachineState *machine) MemoryRegion *sysmem =3D get_system_memory(); long load_limit, fw_size; Error *resize_hpt_err =3D NULL; + NICInfo *nd; =20 if (!filename) { error_report("Could not find LPAR firmware '%s'", bios_name); @@ -2996,21 +2997,12 @@ static void spapr_machine_init(MachineState *machin= e) =20 phb =3D spapr_create_default_phb(); =20 - for (i =3D 0; i < nb_nics; i++) { - NICInfo *nd =3D &nd_table[i]; - - if (!nd->model) { - nd->model =3D g_strdup("spapr-vlan"); - } - - if (g_str_equal(nd->model, "spapr-vlan") || - g_str_equal(nd->model, "ibmveth")) { - spapr_vlan_create(spapr->vio_bus, nd); - } else { - pci_nic_init_nofail(&nd_table[i], phb->bus, nd->model, NULL); - } + while ((nd =3D qemu_find_nic_info("spapr-vlan", true, "ibmveth"))) { + spapr_vlan_create(spapr->vio_bus, nd); } =20 + pci_init_nic_devices(phb->bus, NULL); + for (i =3D 0; i <=3D drive_get_max_bus(IF_SCSI); i++) { spapr_vscsi_create(spapr->vio_bus); } --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706807106595586.4428718323371; Thu, 1 Feb 2024 09:05:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaDs-0007cd-NE; Thu, 01 Feb 2024 11:47:33 -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 1rVaB4-0002vJ-2b for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:39 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAt-0002RZ-Kb for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:37 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-0000000GId7-0H8y for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-00000003IMu-41Jc for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=11Xexm/zfEQsP0C5lVH66y3jNuSB03J3oevWpWV4QDE=; b=i5olHCjlVv4bTBrMOtoK/4xAeC Dku4TLDNLXJbIQOJnYpFjOcRxwy4poIXeAP+8+MlZ4IVPSAAb8IGJVm7j/FPlz2Og0cdLd9NtaEYh UfNGXkU3XZauVQQ3355ekUG1f3srPSFVZDuH683+Do4s8eg/QwHmVlOlatdVJTGmkMR97BLTg4tuE 3IR/uqY5a/gSDfJNLxPjMD3a2UjPt2goQsVHtZsQsNeJYAhJ39q2dWe1iGdTZ3Wn0eTkApk1Iz1ps RvnZ36eENp1tnaLpXAwuUKLVLmjtThz+Q7aw/XkmaxG4i8A3X14CIqpy7I0fxTZaKP7i6B1DSeX1Y 2lGHgMLA==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 17/47] hw/ppc: use pci_init_nic_devices() Date: Thu, 1 Feb 2024 16:43:42 +0000 Message-ID: <20240201164412.785520-18-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706807106891100003 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/ppc/e500.c | 4 +--- hw/ppc/mac_newworld.c | 4 +--- hw/ppc/mac_oldworld.c | 4 +--- hw/ppc/ppc440_bamboo.c | 14 +++++--------- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index 566f1200dd..3bd12b54ab 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -1079,9 +1079,7 @@ void ppce500_init(MachineState *machine) =20 if (pci_bus) { /* Register network interfaces. */ - for (i =3D 0; i < nb_nics; i++) { - pci_nic_init_nofail(&nd_table[i], pci_bus, mc->default_nic, NU= LL); - } + pci_init_nic_devices(pci_bus, mc->default_nic); } =20 /* Register spinning region */ diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 535710314a..b36dbaf2b6 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -444,9 +444,7 @@ static void ppc_core99_init(MachineState *machine) graphic_depth =3D 15; } =20 - for (i =3D 0; i < nb_nics; i++) { - pci_nic_init_nofail(&nd_table[i], pci_bus, mc->default_nic, NULL); - } + pci_init_nic_devices(pci_bus, mc->default_nic); =20 /* The NewWorld NVRAM is not located in the MacIO device */ if (kvm_enabled() && qemu_real_host_page_size() > 4096) { diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 9acc7adfc9..1981d3d8f6 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -277,9 +277,7 @@ static void ppc_heathrow_init(MachineState *machine) =20 pci_vga_init(pci_bus); =20 - for (i =3D 0; i < nb_nics; i++) { - pci_nic_init_nofail(&nd_table[i], pci_bus, mc->default_nic, NULL); - } + pci_init_nic_devices(pci_bus, mc->default_nic); =20 /* MacIO IDE */ ide_drive_get(hd, ARRAY_SIZE(hd)); diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c index a189942de4..c75c3083e6 100644 --- a/hw/ppc/ppc440_bamboo.c +++ b/hw/ppc/ppc440_bamboo.c @@ -161,7 +161,6 @@ static void bamboo_init(MachineState *machine) DeviceState *uicdev; SysBusDevice *uicsbd; int success; - int i; =20 if (kvm_enabled()) { error_report("machine %s does not support the KVM accelerator", @@ -234,14 +233,11 @@ static void bamboo_init(MachineState *machine) } =20 if (pcibus) { - /* Register network interfaces. */ - for (i =3D 0; i < nb_nics; i++) { - /* - * There are no PCI NICs on the Bamboo board, but there are - * PCI slots, so we can pick whatever default model we want. - */ - pci_nic_init_nofail(&nd_table[i], pcibus, mc->default_nic, NUL= L); - } + /* + * There are no PCI NICs on the Bamboo board, but there are + * PCI slots, so we can pick whatever default model we want. + */ + pci_init_nic_devices(pcibus, mc->default_nic); } =20 /* Load kernel. */ --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806697295178.14800907879408; Thu, 1 Feb 2024 08:58:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaB2-0002ua-Qk; Thu, 01 Feb 2024 11:44:37 -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 1rVaAm-0002ph-S1 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:20 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAj-0002RY-5Q for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:20 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-0000000GId8-0EoU for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-00000003IMy-48d2 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=XNIjAmOhj+SZtS07BQBFCx/gbJe5yDDVggy1z+Bpirk=; b=k59RMKrQA9kIzT0EmRo6ycmpXH 49xo1PitXVZ1DXE3pd/KeuSKXwziywaVd5oPMVVPwtOJSKF2QeC60EKfG2nCP8+UKTrQcf54P6dQR ubXhldH8WQPt5xJoTtYo4vxmdQv2wCoUGdJHIStcgXasscdMrTM3CIfBCK3knwxyxtZLewusR8PZE bBiDyM2PmVOjBqgMAsx22x8B9YWQ9ZGysePE0wo6eAdnJcx4jyPYeLjX9hfuYkPg7SNOEIl5lqSKZ nWw99ELcpKQpsWB8loOibpLj6IBT3YOQnoKs/QhoFjwTwpwI6ZnrMDc/pYpWLnOa/nFULhWgHdXsT eMbEvnkQ==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 18/47] hw/sh4/r2d: use pci_init_nic_devices() Date: Thu, 1 Feb 2024 16:43:43 +0000 Message-ID: <20240201164412.785520-19-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806699022100003 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Previously, the first PCI NIC would be assigned to slot 2 even if the user override the model and made it something other than an rtl8139 which is the default. Everything else would be dynamically assigned. Now, the first rtl8139 gets slot 2 and everything else is dynamic. Signed-off-by: David Woodhouse Reviewed-by: Yoshinori Sato --- hw/sh4/r2d.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c index 4944994e9c..e9f316a6ce 100644 --- a/hw/sh4/r2d.c +++ b/hw/sh4/r2d.c @@ -240,7 +240,6 @@ static void r2d_init(MachineState *machine) MemoryRegion *sdram =3D g_new(MemoryRegion, 1); qemu_irq *irq; DriveInfo *dinfo; - int i; DeviceState *dev; SysBusDevice *busdev; MemoryRegion *address_space_mem =3D get_system_memory(); @@ -309,9 +308,8 @@ static void r2d_init(MachineState *machine) 0x555, 0x2aa, 0); =20 /* NIC: rtl8139 on-board, and 2 slots. */ - for (i =3D 0; i < nb_nics; i++) - pci_nic_init_nofail(&nd_table[i], pci_bus, - mc->default_nic, i =3D=3D 0 ? "2" : NULL); + pci_init_nic_in_slot(pci_bus, mc->default_nic, NULL, "2"); + pci_init_nic_devices(pci_bus, mc->default_nic); =20 /* USB keyboard */ usb_create_simple(usb_bus_find(-1), "usb-kbd"); --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806198062418.72952660632063; Thu, 1 Feb 2024 08:49:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaAw-0002sD-AW; Thu, 01 Feb 2024 11:44:30 -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 1rVaAo-0002q6-0R for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:22 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAl-0002Rb-6Q for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:21 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-0000000GId9-0HEW for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003IN3-03I9 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=OKm118/V6gxksMAtfnJ8Ufap3iGAGMSmq6JcPfpdm/s=; b=cUqX9MJOiEYyfJIVox0HrzpTM0 ldwC14FaAsiRE+x3Z7QD8oL6Bc1+440d1+SIaTapK9O069E2Sx4FXuwQMNuHLmbDpFn9f+Q43QHUe SKHJsq2XHtW+o5CCAIfddV/pJROinDHhIfIjBcX+CyVivEjOfhQCyh+iLMgqxo7+vIrsyUJ5S9G9N Te3qNe6o5vS7HsVGtm6pzBGOPIZjQ1stP6tgqcGHJRm7Yo/0KAJf8Yt2shivUdZHkhMLz/r04eoaq DkLzTCPBxrxG74Ehdq+1KRPhIWRkeX+pbItCIrohvtzxnr+XD6g8ML2UPfs6h+0XD6MvBKGE59+1m UNUte/cg==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 19/47] hw/sparc64/sun4u: use pci_init_nic_devices() Date: Thu, 1 Feb 2024 16:43:44 +0000 Message-ID: <20240201164412.785520-20-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806199323100003 Content-Type: text/plain; charset="utf-8" From: David Woodhouse The first sunhme NIC gets placed a function 1 on slot 1 of PCI bus A, and the rest are dynamically assigned on PCI bus B. Previously, any PCI NIC would get the special treatment purely by virtue of being first in the list. Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/sparc64/sun4u.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 24d53bf5fd..eda9b58a21 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -639,29 +639,18 @@ static void sun4uv_init(MemoryRegion *address_space_m= em, =20 memset(&macaddr, 0, sizeof(MACAddr)); onboard_nic =3D false; - for (i =3D 0; i < nb_nics; i++) { - PCIBus *bus; - nd =3D &nd_table[i]; - - if (!nd->model || strcmp(nd->model, mc->default_nic) =3D=3D 0) { - if (!onboard_nic) { - pci_dev =3D pci_new_multifunction(PCI_DEVFN(1, 1), mc->def= ault_nic); - bus =3D pci_busA; - memcpy(&macaddr, &nd->macaddr.a, sizeof(MACAddr)); - onboard_nic =3D true; - } else { - pci_dev =3D pci_new(-1, mc->default_nic); - bus =3D pci_busB; - } - } else { - pci_dev =3D pci_new(-1, nd->model); - bus =3D pci_busB; - } =20 + nd =3D qemu_find_nic_info(mc->default_nic, true, NULL); + if (nd) { + pci_dev =3D pci_new_multifunction(PCI_DEVFN(1, 1), mc->default_nic= ); dev =3D &pci_dev->qdev; qdev_set_nic_properties(dev, nd); - pci_realize_and_unref(pci_dev, bus, &error_fatal); + pci_realize_and_unref(pci_dev, pci_busA, &error_fatal); + + memcpy(&macaddr, &nd->macaddr.a, sizeof(MACAddr)); + onboard_nic =3D true; } + pci_init_nic_devices(pci_busB, mc->default_nic); =20 /* If we don't have an onboard NIC, grab a default MAC address so that * we have a valid machine id */ --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706805902819619.6022467446106; Thu, 1 Feb 2024 08:45:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaAz-0002tC-VZ; Thu, 01 Feb 2024 11:44:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAq-0002qd-Qj for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:25 -0500 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAm-0002Sv-6b for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:22 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000009cM5-0ue2 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003IN9-09PG for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=35K3x9bzhCjbbLdjF5dN7+yX0Fl3u32uZ8IZYdqJ3uI=; b=eBfqHmBJtmQPXvcQvXeIDqNVxc OUzbY10CVSmGZ+WNo3UvtGzFlw+Hk573ddDFvw9WbrOl5TtGtKTLm0nVmSbr0Y2y1/bODz+TsI4D8 NxoSjduqrmmepGsEgSxuPV68qdNdE2x7GAjPMCewDEo2cz+nHFeE+hUwARvIm7CnvRbbYkxYcKOpy d4rMZjIajFrjrJqijhaCfgbbe3Ibqyuzn6MwworGJd/wD0m5GaM2+1VWZj+bVTwODcOy93AfeOtZJ RV0eXlY/wr6ubr+kfh/uzJ2XA4iIXjFhCiJqlJ3A7m2uk2dbtNuPriU3JSL7Pa++VEchu9b6biB2N lJVOCVOA==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 20/47] hw/xtensa/virt: use pci_init_nic_devices() Date: Thu, 1 Feb 2024 16:43:45 +0000 Message-ID: <20240201164412.785520-21-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; envelope-from=BATV+1220c4869a9b484313cc+7466+infradead.org+dwmw2@desiato.srs.infradead.org; helo=desiato.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706805904953100005 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/xtensa/virt.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/xtensa/virt.c b/hw/xtensa/virt.c index a6cf646e99..5310a88861 100644 --- a/hw/xtensa/virt.c +++ b/hw/xtensa/virt.c @@ -102,9 +102,7 @@ static void create_pcie(MachineState *ms, CPUXtensaStat= e *env, int irq_base, =20 pci =3D PCI_HOST_BRIDGE(dev); if (pci->bus) { - for (i =3D 0; i < nb_nics; i++) { - pci_nic_init_nofail(&nd_table[i], pci->bus, mc->default_nic, N= ULL); - } + pci_init_nic_devices(pci->bus, mc->default_nic); } } =20 --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806017938158.6435858570328; Thu, 1 Feb 2024 08:46:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaCz-0004y2-Cr; Thu, 01 Feb 2024 11:46:37 -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 1rVaB2-0002tt-1V for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:36 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAt-0002Rk-Uj for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:35 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-0000000GIdH-0T5m for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003IND-0R9c for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=RCl8hqYlbROKaeF8tiGKXTzuLjfG6ujmrLDps4PRhaM=; b=cyc6mUeJ8/CiLQeqFQsxzonMq+ Js72u7dOnhXJIFA4S8aUD92IjsOkwbeNDzyjnENnBqB1ejL8zjI/A7UpETrr1t8O2g/v0i+4iJbEs zwOS+dE66E+ch+B/ERWZrPZARg2Rx0KynymcgFnlFB4cOBOzLW0TX1k2OV98AeDb+1D7+oDWPne/O Xutzkqub1ZMPwtmvXf3DI3g3kWqI7JAVc9PjgAIPt7IkKLoyHB4DgQIt2XJxSs7YeJ8Ctkf3nPqfW 4F4TRgW/CUM+kATq8L6GK/ezah4p8iy8MfuPySakRh+rj6as9QwjGnywA7CKZXQbE+4pQ2qEFqGSs gjwK0cIQ==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 21/47] hw/arm/allwinner: use qemu_configure_nic_device() Date: Thu, 1 Feb 2024 16:43:46 +0000 Message-ID: <20240201164412.785520-22-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806018870100003 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/arm/allwinner-a10.c | 6 +----- hw/arm/allwinner-h3.c | 6 +----- hw/arm/allwinner-r40.c | 27 ++------------------------- 3 files changed, 4 insertions(+), 35 deletions(-) diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c index 581dd45edf..57d5d80159 100644 --- a/hw/arm/allwinner-a10.c +++ b/hw/arm/allwinner-a10.c @@ -138,11 +138,7 @@ static void aw_a10_realize(DeviceState *dev, Error **e= rrp) sysbus_realize(SYS_BUS_DEVICE(&s->dramc), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(&s->dramc), 0, AW_A10_DRAMC_BASE); =20 - /* FIXME use qdev NIC properties instead of nd_table[] */ - if (nd_table[0].used) { - qemu_check_nic_model(&nd_table[0], TYPE_AW_EMAC); - qdev_set_nic_properties(DEVICE(&s->emac), &nd_table[0]); - } + qemu_configure_nic_device(DEVICE(&s->emac), true, NULL); if (!sysbus_realize(SYS_BUS_DEVICE(&s->emac), errp)) { return; } diff --git a/hw/arm/allwinner-h3.c b/hw/arm/allwinner-h3.c index 380e0ec11d..6870c3fe96 100644 --- a/hw/arm/allwinner-h3.c +++ b/hw/arm/allwinner-h3.c @@ -371,11 +371,7 @@ static void allwinner_h3_realize(DeviceState *dev, Err= or **errp) "sd-bus"); =20 /* EMAC */ - /* FIXME use qdev NIC properties instead of nd_table[] */ - if (nd_table[0].used) { - qemu_check_nic_model(&nd_table[0], TYPE_AW_SUN8I_EMAC); - qdev_set_nic_properties(DEVICE(&s->emac), &nd_table[0]); - } + qemu_configure_nic_device(DEVICE(&s->emac), true, NULL); object_property_set_link(OBJECT(&s->emac), "dma-memory", OBJECT(get_system_memory()), &error_fatal); sysbus_realize(SYS_BUS_DEVICE(&s->emac), &error_fatal); diff --git a/hw/arm/allwinner-r40.c b/hw/arm/allwinner-r40.c index eef1fc196e..b8c7202133 100644 --- a/hw/arm/allwinner-r40.c +++ b/hw/arm/allwinner-r40.c @@ -318,7 +318,6 @@ static void allwinner_r40_init(Object *obj) =20 static void allwinner_r40_realize(DeviceState *dev, Error **errp) { - const char *r40_nic_models[] =3D { "gmac", "emac", NULL }; AwR40State *s =3D AW_R40(dev); =20 /* CPUs */ @@ -512,31 +511,8 @@ static void allwinner_r40_realize(DeviceState *dev, Er= ror **errp) sysbus_mmio_map(SYS_BUS_DEVICE(&s->dramc), 2, s->memmap[AW_R40_DEV_DRAMPHY]); =20 - /* nic support gmac and emac */ - for (int i =3D 0; i < ARRAY_SIZE(r40_nic_models) - 1; i++) { - NICInfo *nic =3D &nd_table[i]; - - if (!nic->used) { - continue; - } - if (qemu_show_nic_models(nic->model, r40_nic_models)) { - exit(0); - } - - switch (qemu_find_nic_model(nic, r40_nic_models, r40_nic_models[0]= )) { - case 0: /* gmac */ - qdev_set_nic_properties(DEVICE(&s->gmac), nic); - break; - case 1: /* emac */ - qdev_set_nic_properties(DEVICE(&s->emac), nic); - break; - default: - exit(1); - break; - } - } - /* GMAC */ + qemu_configure_nic_device(DEVICE(&s->gmac), true, "gmac"); object_property_set_link(OBJECT(&s->gmac), "dma-memory", OBJECT(get_system_memory()), &error_f= atal); sysbus_realize(SYS_BUS_DEVICE(&s->gmac), &error_fatal); @@ -545,6 +521,7 @@ static void allwinner_r40_realize(DeviceState *dev, Err= or **errp) qdev_get_gpio_in(DEVICE(&s->gic), AW_R40_GIC_SPI_GM= AC)); =20 /* EMAC */ + qemu_configure_nic_device(DEVICE(&s->emac), true, "emac"); sysbus_realize(SYS_BUS_DEVICE(&s->emac), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(&s->emac), 0, s->memmap[AW_R40_DEV_EMAC= ]); sysbus_connect_irq(SYS_BUS_DEVICE(&s->emac), 0, --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806600684665.671668581046; Thu, 1 Feb 2024 08:56:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaC2-0003mY-QX; Thu, 01 Feb 2024 11:45:40 -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 1rVaB8-0002yY-1E for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:42 -0500 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAv-0002Uz-HU for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:41 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAh-00000009cM6-1umv for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:15 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003INH-0Xyc for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To: From:Reply-To:Cc:Content-ID:Content-Description; bh=SETeMI08AM2lMjqffLMkXtCwCyDYFW94A6cTEws52F8=; b=ddMt9CQdO0FifPWxQ9ap+iZXIg pRlKQbR1riMAUXpJSrfHescjJxguqtlGOP+2I1sLiFXsjWOD9PGpW8oFRb4bd9F7AO7vlOXip1Oin aTBfZ/r4TCn/cT3poUnCHz6q2hr8LKqZZXNShRsj6WiSMgqebEAeSQhedLlI7JNC69B5QP4t2rbRw 0NpH4Axo2jUe53WkdPOgldMOdjSFKTtXp7h+tCIm9ZCzfjyOoRv0eHgngjp3HA3wFOeveObofXiqK JDGTBvBaZbLC9JlBxJEk9ALnxgOxUyL9uBcBh+QLK//iP3g9AiiADhnRLBkeohN92UT2O4V7F8uVq 5aKhahJA==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 22/47] hw/arm/aspeed: use qemu_configure_nic_device() Date: Thu, 1 Feb 2024 16:43:47 +0000 Message-ID: <20240201164412.785520-23-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; envelope-from=BATV+1220c4869a9b484313cc+7466+infradead.org+dwmw2@desiato.srs.infradead.org; helo=desiato.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806602760100003 From: David Woodhouse Signed-off-by: David Woodhouse Acked-by: C=C3=A9dric Le Goater Reviewed-by: C=C3=A9dric Le Goater --- hw/arm/aspeed.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index cc59176563..bed5e4f40b 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -356,7 +356,6 @@ static void aspeed_machine_init(MachineState *machine) AspeedMachineClass *amc =3D ASPEED_MACHINE_GET_CLASS(machine); AspeedSoCClass *sc; int i; - NICInfo *nd =3D &nd_table[0]; =20 bmc->soc =3D ASPEED_SOC(object_new(amc->soc_name)); object_property_add_child(OBJECT(machine), "soc", OBJECT(bmc->soc)); @@ -371,10 +370,10 @@ static void aspeed_machine_init(MachineState *machine) &error_fatal); =20 for (i =3D 0; i < sc->macs_num; i++) { - if ((amc->macs_mask & (1 << i)) && nd->used) { - qemu_check_nic_model(nd, TYPE_FTGMAC100); - qdev_set_nic_properties(DEVICE(&bmc->soc->ftgmac100[i]), nd); - nd++; + if ((amc->macs_mask & (1 << i)) && + !qemu_configure_nic_device(DEVICE(&bmc->soc->ftgmac100[i]), + true, NULL)) { + break; /* No configs left; stop asking */ } } =20 --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706805954265695.7611559054732; Thu, 1 Feb 2024 08:45:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaAo-0002ps-FK; Thu, 01 Feb 2024 11:44:24 -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 1rVaAl-0002pD-L0 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:19 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAj-0002Rl-H3 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:19 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-0000000GIdI-0ToH for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003INM-0fZE for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=dzXOsNH9wRjvHj3st0gxTJIXdksb3OkDh+zWazNsC/A=; b=PUkvRD0XKLL5fhxelP/3UNIrvr UrImTTkk02VHnS/MEFK/OngrxNpfwSaWcKyTiZcGILQADEzSKEbZVFBwuVxhk+iz1zeoZG+J9P3Pi H9CxW8vXshTfbsIE1IHpVnSORZLzeZfbbZ5EwY+TzKPGUx68ium9QmFoA3xVdgleRI/j62FZQ6/gr 2n/Ca62HMSyjD7thYw27vHb2mlqjYG8P9KuW07/cBgdTH3qPlBPtA5YdQX8Rr1Zgw2vIgzrLt7hgF sQEE+y89gNRPuohusUNvMRk3eFaTmK7s3ZYtBxtQr6MtRhcKgbD9SaycaJEzNi6zwC7K0HgvXiFca BY76Tfmg==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 23/47] hw/arm/exynos4: use qemu_create_nic_device() Date: Thu, 1 Feb 2024 16:43:48 +0000 Message-ID: <20240201164412.785520-24-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706805954662100001 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/arm/exynos4_boards.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c index b0e13eb4f0..003992189b 100644 --- a/hw/arm/exynos4_boards.c +++ b/hw/arm/exynos4_boards.c @@ -76,10 +76,8 @@ static void lan9215_init(uint32_t base, qemu_irq irq) SysBusDevice *s; =20 /* This should be a 9215 but the 9118 is close enough */ - if (nd_table[0].used) { - qemu_check_nic_model(&nd_table[0], "lan9118"); - dev =3D qdev_new(TYPE_LAN9118); - qdev_set_nic_properties(dev, &nd_table[0]); + dev =3D qemu_create_nic_device(TYPE_LAN9118, true, NULL); + if (dev) { qdev_prop_set_uint32(dev, "mode_16bit", 1); s =3D SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(s, &error_fatal); --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806337291327.07244638672285; Thu, 1 Feb 2024 08:52:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaDq-0007RE-CF; Thu, 01 Feb 2024 11:47:30 -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 1rVaB2-0002us-Mv for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:36 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAt-0002Ry-Tq for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:36 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-0000000GIdJ-0hOi for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003INQ-0nN4 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=u6cMnsKwi3z8moyI4Kw4dqIt2PvtJGq8iMY86X2p0ns=; b=ovNQ70sgxrUUBnq+i/DROTGyDi +GxbAbreDZI8QeXtBx6dicKXbIaK8YZ3juKxwptsGBsIGpjDmqB241rTJv9tiqN0mQloKZz2keoBm ZIOb5zVBaYuyfuCFETD025vuUWBlBnvO4owcnZhOocXC69xXPewxfBk6SS8d6uA1qRWmNM2cYfycF NG1zqU0zpitaex5/U809RFJZ3Ov6SoB5aQxeX1Eo3Dp+ia9GJuknsTpezdGK7JlVM+rKeRxGdRYCD BvLUhff6P9s6knbIYltmSduAUgNOJ6WE1+NgElTAXULjrLloNoohyiF7von+GIqjBFfNAZudkGegy 83IpDbzQ==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 24/47] hw/arm/fsl: use qemu_configure_nic_device() Date: Thu, 1 Feb 2024 16:43:49 +0000 Message-ID: <20240201164412.785520-25-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806337872100001 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/arm/fsl-imx25.c | 2 +- hw/arm/fsl-imx6.c | 2 +- hw/arm/fsl-imx6ul.c | 2 +- hw/arm/fsl-imx7.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c index 4a49507ef1..5ed87edfe4 100644 --- a/hw/arm/fsl-imx25.c +++ b/hw/arm/fsl-imx25.c @@ -171,7 +171,7 @@ static void fsl_imx25_realize(DeviceState *dev, Error *= *errp) =20 object_property_set_uint(OBJECT(&s->fec), "phy-num", s->phy_num, &error_abort); - qdev_set_nic_properties(DEVICE(&s->fec), &nd_table[0]); + qemu_configure_nic_device(DEVICE(&s->fec), true, NULL); =20 if (!sysbus_realize(SYS_BUS_DEVICE(&s->fec), errp)) { return; diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c index b7f93d8d9c..85748cb233 100644 --- a/hw/arm/fsl-imx6.c +++ b/hw/arm/fsl-imx6.c @@ -388,7 +388,7 @@ static void fsl_imx6_realize(DeviceState *dev, Error **= errp) =20 object_property_set_uint(OBJECT(&s->eth), "phy-num", s->phy_num, &error_abort); - qdev_set_nic_properties(DEVICE(&s->eth), &nd_table[0]); + qemu_configure_nic_device(DEVICE(&s->eth), true, NULL); if (!sysbus_realize(SYS_BUS_DEVICE(&s->eth), errp)) { return; } diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c index 343bd65d1b..19f443570b 100644 --- a/hw/arm/fsl-imx6ul.c +++ b/hw/arm/fsl-imx6ul.c @@ -473,7 +473,7 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error = **errp) s->phy_num[i], &error_abort); object_property_set_uint(OBJECT(&s->eth[i]), "tx-ring-num", FSL_IMX6UL_ETH_NUM_TX_RINGS, &error_abort= ); - qdev_set_nic_properties(DEVICE(&s->eth[i]), &nd_table[i]); + qemu_configure_nic_device(DEVICE(&s->eth[i]), true, NULL); sysbus_realize(SYS_BUS_DEVICE(&s->eth[i]), &error_abort); =20 sysbus_mmio_map(SYS_BUS_DEVICE(&s->eth[i]), 0, diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c index 5728109491..9f2ef34555 100644 --- a/hw/arm/fsl-imx7.c +++ b/hw/arm/fsl-imx7.c @@ -447,7 +447,7 @@ static void fsl_imx7_realize(DeviceState *dev, Error **= errp) s->phy_num[i], &error_abort); object_property_set_uint(OBJECT(&s->eth[i]), "tx-ring-num", FSL_IMX7_ETH_NUM_TX_RINGS, &error_abort); - qdev_set_nic_properties(DEVICE(&s->eth[i]), &nd_table[i]); + qemu_configure_nic_device(DEVICE(&s->eth[i]), true, NULL); sysbus_realize(SYS_BUS_DEVICE(&s->eth[i]), &error_abort); =20 sysbus_mmio_map(SYS_BUS_DEVICE(&s->eth[i]), 0, FSL_IMX7_ENETn_ADDR= [i]); --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706805903008626.6703491178755; Thu, 1 Feb 2024 08:45:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaAz-0002tA-VR; Thu, 01 Feb 2024 11:44:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAq-0002qi-To for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:25 -0500 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAm-0002Uq-9b for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:24 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAh-00000009cM7-1xcE for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:15 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003INU-11KH for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=TA17OVi49hCfDCSb/FocGIXS9Sfw+etv8YHmfCgYILA=; b=aCMip3eP7NY1og3yZWUHI9qERA o0rZx2ET/NFIHjfYEAZUbizWkoOCs2BKgY55ujW4lsSD7y919NWhMBf99wQWfQ5CdJdV0ifzAaPLl 6Q+Vo/pmfgL/9UmjNIrJztUyAsQrIvdgHbS/iOM1difqzz4ZwnNe4DQ6sg4HDwPLLFsGFS/mLBWCD 11q0685D+smrusQLuk6eBA7if/xR18ERt/toF+IsayaK88arMt6QktDy+UTcsFzrKCcg7HO3S1WWE /KPEuevNZNb8zQ7ccuBOpJNtTKmgrwywWBiZf0cyLUBN+hazTlzNs5Ltg/dSxOTTrId9orduY7c4Y QSqGSmFQ==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 25/47] hw/net/smc91c111: use qemu_configure_nic_device() Date: Thu, 1 Feb 2024 16:43:50 +0000 Message-ID: <20240201164412.785520-26-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; envelope-from=BATV+1220c4869a9b484313cc+7466+infradead.org+dwmw2@desiato.srs.infradead.org; helo=desiato.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706805904983100007 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Some callers instantiate the device unconditionally, others will do so only if there is a NICInfo to go with it. This appears to be fairly random, but preserve the existing behaviour of each caller for now. Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/arm/gumstix.c | 6 ++---- hw/arm/integratorcp.c | 5 +++-- hw/arm/mainstone.c | 3 +-- hw/arm/realview.c | 25 ++++++++++--------------- hw/arm/versatilepb.c | 15 ++++----------- hw/net/smc91c111.c | 5 ++--- include/hw/net/smc91c111.h | 2 +- 7 files changed, 23 insertions(+), 38 deletions(-) diff --git a/hw/arm/gumstix.c b/hw/arm/gumstix.c index 3f2bcaa24e..d5de5409e1 100644 --- a/hw/arm/gumstix.c +++ b/hw/arm/gumstix.c @@ -73,8 +73,7 @@ static void connex_init(MachineState *machine) FLASH_SECTOR_SIZE, 2, 0, 0, 0, 0, 0); =20 /* Interrupt line of NIC is connected to GPIO line 36 */ - smc91c111_init(&nd_table[0], 0x04000300, - qdev_get_gpio_in(cpu->gpio, 36)); + smc91c111_init(0x04000300, qdev_get_gpio_in(cpu->gpio, 36)); } =20 static void verdex_init(MachineState *machine) @@ -97,8 +96,7 @@ static void verdex_init(MachineState *machine) FLASH_SECTOR_SIZE, 2, 0, 0, 0, 0, 0); =20 /* Interrupt line of NIC is connected to GPIO line 99 */ - smc91c111_init(&nd_table[0], 0x04000300, - qdev_get_gpio_in(cpu->gpio, 99)); + smc91c111_init(0x04000300, qdev_get_gpio_in(cpu->gpio, 99)); } =20 static void connex_class_init(ObjectClass *oc, void *data) diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c index 793262eca8..f016d20485 100644 --- a/hw/arm/integratorcp.c +++ b/hw/arm/integratorcp.c @@ -666,8 +666,9 @@ static void integratorcp_init(MachineState *machine) sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x1d000000); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[25]); =20 - if (nd_table[0].used) - smc91c111_init(&nd_table[0], 0xc8000000, pic[27]); + if (qemu_find_nic_info("smc91c111", true, NULL)) { + smc91c111_init(0xc8000000, pic[27]); + } =20 sysbus_create_simple("pl110", 0xc0000000, pic[22]); =20 diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c index fc14e05060..d2e2e68aa3 100644 --- a/hw/arm/mainstone.c +++ b/hw/arm/mainstone.c @@ -152,8 +152,7 @@ static void mainstone_common_init(MachineState *machine, qdev_get_gpio_in(mst_irq, S1_IRQ), qdev_get_gpio_in(mst_irq, S1_CD_IRQ)); =20 - smc91c111_init(&nd_table[0], MST_ETH_PHYS, - qdev_get_gpio_in(mst_irq, ETHERNET_IRQ)); + smc91c111_init(MST_ETH_PHYS, qdev_get_gpio_in(mst_irq, ETHERNET_IRQ)); =20 mainstone_binfo.board_id =3D arm_id; arm_load_kernel(mpu->cpu, machine, &mainstone_binfo); diff --git a/hw/arm/realview.c b/hw/arm/realview.c index 566deff9ce..c6bd6e5961 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -90,7 +90,6 @@ static void realview_init(MachineState *machine, I2CBus *i2c; int n; unsigned int smp_cpus =3D machine->smp.cpus; - int done_nic =3D 0; qemu_irq cpu_irq[4]; int is_mpcore =3D 0; int is_pb =3D 0; @@ -296,24 +295,20 @@ static void realview_init(MachineState *machine, n--; } } - for(n =3D 0; n < nb_nics; n++) { - nd =3D &nd_table[n]; - - if (!done_nic && (!nd->model || - strcmp(nd->model, is_pb ? "lan9118" : "smc91c111") =3D= =3D 0)) { - if (is_pb) { - lan9118_init(nd, 0x4e000000, pic[28]); - } else { - smc91c111_init(nd, 0x4e000000, pic[28]); - } - done_nic =3D 1; + + nd =3D qemu_find_nic_info(is_pb ? "lan9118" : "smc91c111", true, NULL); + if (nd) { + if (is_pb) { + lan9118_init(nd, 0x4e000000, pic[28]); } else { - if (pci_bus) { - pci_nic_init_nofail(nd, pci_bus, "rtl8139", NULL); - } + smc91c111_init(0x4e000000, pic[28]); } } =20 + if (pci_bus) { + pci_init_nic_devices(pci_bus, "rtl8139"); + } + dev =3D sysbus_create_simple(TYPE_ARM_SBCON_I2C, 0x10002000, NULL); i2c =3D (I2CBus *)qdev_get_child_bus(dev, "i2c"); i2c_slave_create_simple(i2c, "ds1338", 0x68); diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c index 1d813aa23b..d10b75dfdb 100644 --- a/hw/arm/versatilepb.c +++ b/hw/arm/versatilepb.c @@ -192,10 +192,8 @@ static void versatile_init(MachineState *machine, int = board_id) SysBusDevice *busdev; DeviceState *pl041; PCIBus *pci_bus; - NICInfo *nd; I2CBus *i2c; int n; - int done_smc =3D 0; DriveInfo *dinfo; =20 if (machine->ram_size > 0x10000000) { @@ -263,16 +261,11 @@ static void versatile_init(MachineState *machine, int= board_id) sysbus_connect_irq(busdev, 3, sic[30]); pci_bus =3D (PCIBus *)qdev_get_child_bus(dev, "pci"); =20 - for(n =3D 0; n < nb_nics; n++) { - nd =3D &nd_table[n]; - - if (!done_smc && (!nd->model || strcmp(nd->model, "smc91c111") =3D= =3D 0)) { - smc91c111_init(nd, 0x10010000, sic[25]); - done_smc =3D 1; - } else { - pci_nic_init_nofail(nd, pci_bus, "rtl8139", NULL); - } + if (qemu_find_nic_info("smc91c111", true, NULL)) { + smc91c111_init(0x10010000, sic[25]); } + pci_init_nic_devices(pci_bus, "rtl8139"); + if (machine_usb(machine)) { pci_create_simple(pci_bus, -1, "pci-ohci"); } diff --git a/hw/net/smc91c111.c b/hw/net/smc91c111.c index 49b7c26102..702d0e8e83 100644 --- a/hw/net/smc91c111.c +++ b/hw/net/smc91c111.c @@ -818,14 +818,13 @@ static void smc91c111_register_types(void) =20 /* Legacy helper function. Should go away when machine config files are implemented. */ -void smc91c111_init(NICInfo *nd, uint32_t base, qemu_irq irq) +void smc91c111_init(uint32_t base, qemu_irq irq) { DeviceState *dev; SysBusDevice *s; =20 - qemu_check_nic_model(nd, "smc91c111"); dev =3D qdev_new(TYPE_SMC91C111); - qdev_set_nic_properties(dev, nd); + qemu_configure_nic_device(dev, true, NULL); s =3D SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(s, &error_fatal); sysbus_mmio_map(s, 0, base); diff --git a/include/hw/net/smc91c111.h b/include/hw/net/smc91c111.h index df5b11dcef..dba32a233f 100644 --- a/include/hw/net/smc91c111.h +++ b/include/hw/net/smc91c111.h @@ -13,6 +13,6 @@ =20 #include "net/net.h" =20 -void smc91c111_init(NICInfo *, uint32_t, qemu_irq); +void smc91c111_init(uint32_t, qemu_irq); =20 #endif --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806008383652.5845324935224; Thu, 1 Feb 2024 08:46:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaB5-0002vN-UW; Thu, 01 Feb 2024 11:44:40 -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 1rVaAq-0002qh-Rx for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:25 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAj-0002SU-Gb for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:23 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-0000000GIdK-1IdB for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003INZ-1IT5 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=Qspogv9stZB79QEZpJwewrrR9VbTKEbvJpFBcADIitI=; b=oiTRvCcC0RbEWdhP1WAkNJlFHP m34ojOv1OSTpspO9HvBgKhWRuHv6qkEBKbHSrqZmVy2CVjd9rDWzr+KqtkZSmiuVOKOYctlj0Cfkt uXMATvUCCPSKlaDKtnKNFFl3oLqP7jtNLsxO0HGkhXtUeiQsROJ14rQ0wijU1Dkw1uaNQORIrJGpe c90fykPIB7ENun1osAamC74cFQQVm3u6VJl8kVt3LIOBjNnGQtYcE4NOc+4wII+nhAxWowAIK3kse A5jU5IAZoHHWR0aZCUDmKNhaiZLCaROcSdJI2L/nARJx2okFYvm64zbU74KGwlzQOSTe9NJezfXAw 5EsnOxfw==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 26/47] hw/net/lan9118: use qemu_configure_nic_device() Date: Thu, 1 Feb 2024 16:43:51 +0000 Message-ID: <20240201164412.785520-27-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806008860100008 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Some callers instantiate the device unconditionally, others will do so only if there is a NICInfo to go with it. This appears to be fairly random, but preseve the existing behaviour for now. Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/arm/kzm.c | 4 ++-- hw/arm/mps2.c | 2 +- hw/arm/realview.c | 6 ++---- hw/arm/vexpress.c | 4 ++-- hw/net/lan9118.c | 5 ++--- include/hw/net/lan9118.h | 2 +- 6 files changed, 10 insertions(+), 13 deletions(-) diff --git a/hw/arm/kzm.c b/hw/arm/kzm.c index 9be91ebeaa..2ccd6f8a76 100644 --- a/hw/arm/kzm.c +++ b/hw/arm/kzm.c @@ -113,8 +113,8 @@ static void kzm_init(MachineState *machine) alias_offset +=3D ram[i].size; } =20 - if (nd_table[0].used) { - lan9118_init(&nd_table[0], KZM_LAN9118_ADDR, + if (qemu_find_nic_info("lan9118", true, NULL)) { + lan9118_init(KZM_LAN9118_ADDR, qdev_get_gpio_in(DEVICE(&s->soc.avic), 52)); } =20 diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c index bd873cc5de..50919ee46d 100644 --- a/hw/arm/mps2.c +++ b/hw/arm/mps2.c @@ -456,7 +456,7 @@ static void mps2_common_init(MachineState *machine) /* In hardware this is a LAN9220; the LAN9118 is software compatible * except that it doesn't support the checksum-offload feature. */ - lan9118_init(&nd_table[0], mmc->ethernet_base, + lan9118_init(mmc->ethernet_base, qdev_get_gpio_in(armv7m, mmc->fpga_type =3D=3D FPGA_AN511 ? 47 : = 13)); =20 diff --git a/hw/arm/realview.c b/hw/arm/realview.c index c6bd6e5961..9058f5b414 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -85,7 +85,6 @@ static void realview_init(MachineState *machine, SysBusDevice *busdev; qemu_irq pic[64]; PCIBus *pci_bus =3D NULL; - NICInfo *nd; DriveInfo *dinfo; I2CBus *i2c; int n; @@ -296,10 +295,9 @@ static void realview_init(MachineState *machine, } } =20 - nd =3D qemu_find_nic_info(is_pb ? "lan9118" : "smc91c111", true, NULL); - if (nd) { + if (qemu_find_nic_info(is_pb ? "lan9118" : "smc91c111", true, NULL)) { if (is_pb) { - lan9118_init(nd, 0x4e000000, pic[28]); + lan9118_init(0x4e000000, pic[28]); } else { smc91c111_init(0x4e000000, pic[28]); } diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index f1b45245d5..e5fb3ab1f9 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -679,8 +679,8 @@ static void vexpress_common_init(MachineState *machine) memory_region_add_subregion(sysmem, map[VE_VIDEORAM], &vms->vram); =20 /* 0x4e000000 LAN9118 Ethernet */ - if (nd_table[0].used) { - lan9118_init(&nd_table[0], map[VE_ETHERNET], pic[15]); + if (qemu_find_nic_info("lan9118", true, NULL)) { + lan9118_init(map[VE_ETHERNET], pic[15]); } =20 /* VE_USB: not modelled */ diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index 598dd79e17..47ff25b441 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -1408,14 +1408,13 @@ static void lan9118_register_types(void) =20 /* Legacy helper function. Should go away when machine config files are implemented. */ -void lan9118_init(NICInfo *nd, uint32_t base, qemu_irq irq) +void lan9118_init(uint32_t base, qemu_irq irq) { DeviceState *dev; SysBusDevice *s; =20 - qemu_check_nic_model(nd, "lan9118"); dev =3D qdev_new(TYPE_LAN9118); - qdev_set_nic_properties(dev, nd); + qemu_configure_nic_device(dev, true, NULL); s =3D SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(s, &error_fatal); sysbus_mmio_map(s, 0, base); diff --git a/include/hw/net/lan9118.h b/include/hw/net/lan9118.h index 3d0c67f339..4bf9da7a63 100644 --- a/include/hw/net/lan9118.h +++ b/include/hw/net/lan9118.h @@ -15,6 +15,6 @@ =20 #define TYPE_LAN9118 "lan9118" =20 -void lan9118_init(NICInfo *, uint32_t, qemu_irq); +void lan9118_init(uint32_t, qemu_irq); =20 #endif --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806558356477.07775453683973; Thu, 1 Feb 2024 08:55:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaE1-0007r1-As; Thu, 01 Feb 2024 11:47:41 -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 1rVaB5-0002wC-D1 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:39 -0500 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAu-0002Up-MT for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:38 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAh-00000009cM8-1xgQ for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:15 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003INd-1PEf for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=9dHA4yvR5zgy9wGYmYhDI2MzGMa5tnlxfToC7F7mpyQ=; b=U6lKgoeX1DAKpbdBBCZe7PlvTX PRCjX4dLFR8+EH7lEyW8XR8YD8K9w0HH6QIZj9k1obbTPBKYQH7F3DFbGz5fE96RVaL9sJYoDpUw1 7ANxhVmU0dE7ueGfoWDht3K7l5ttiEuT1wF8ZfuOQAZycKBeWwy0NdyY0OU898RzR0fQUpvgeLG6y 1a9ilLJ0D6ottRwMDXv+5jWoGVHqA704pXq3jZPQhwzCUx+jxZQgYCGsAR4GDEJKbQCBX6v6h5TYX N5lm/3h2FEbZ+bzQ4/7eEB2pZim27x7oW7rsHpgbSXmt9/S41iqdnzEIriL/S+j4LPCsG/j66Ti1K EWig1psA==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 27/47] hw/arm/highbank: use qemu_create_nic_device() Date: Thu, 1 Feb 2024 16:43:52 +0000 Message-ID: <20240201164412.785520-28-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; envelope-from=BATV+1220c4869a9b484313cc+7466+infradead.org+dwmw2@desiato.srs.infradead.org; helo=desiato.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806558667100001 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/arm/highbank.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c index e6e27d69af..e12374766e 100644 --- a/hw/arm/highbank.c +++ b/hw/arm/highbank.c @@ -297,19 +297,17 @@ static void calxeda_init(MachineState *machine, enum = cxmachines machine_id) =20 sysbus_create_simple(TYPE_SYSBUS_AHCI, 0xffe08000, pic[83]); =20 - if (nd_table[0].used) { - qemu_check_nic_model(&nd_table[0], "xgmac"); - dev =3D qdev_new("xgmac"); - qdev_set_nic_properties(dev, &nd_table[0]); + dev =3D qemu_create_nic_device("xgmac", true, NULL); + if (dev) { sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xfff50000); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[77]); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 1, pic[78]); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 2, pic[79]); + } =20 - qemu_check_nic_model(&nd_table[1], "xgmac"); - dev =3D qdev_new("xgmac"); - qdev_set_nic_properties(dev, &nd_table[1]); + dev =3D qemu_create_nic_device("xgmac", true, NULL); + if (dev) { sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xfff51000); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[80]); --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806115346252.61869592330447; Thu, 1 Feb 2024 08:48:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaDw-0007kb-89; Thu, 01 Feb 2024 11:47:36 -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 1rVaB4-0002vS-G7 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:39 -0500 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAu-0002Uf-Kz for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:38 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAh-00000009cM9-1pWN for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:15 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003INh-1VfV for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=NAFailTVHq4EPBiJNmHs5TSVCP00PxDiqkCa6dKLaHU=; b=DDiufEJH52yHUFN8UhMl+UfnqZ zbH9176KlbOmo98lt7weZqy5PKICQuOcusmo1hlyeNwmDwj+KGNoAxjOxDfxMbyp754zfnfDS9x6V Uxe690rlBytsy5w97WygiskGalUAcOIQXlCjK8kwVdtIbc+ZdKkE/OcKTM/PJDIweIQduo1Yq1hOq zrOnRytdUYTyRirumd1MLjJMhbUysTiUMy783CdFVl4K6afHgbPFRluvGJkfpXeXtmmuOBGt95TD5 euRDsYsAbdCWb9qJuzElxWqQgXX6Nj2HFJkli8QwakTsJHVCPDsf5S/qzFEY9LMeXP88b+kd6HQqC lu49MpWg==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 28/47] hw/arm/npcm7xx: use qemu_configure_nic_device, allow emc0/emc1 as aliases Date: Thu, 1 Feb 2024 16:43:53 +0000 Message-ID: <20240201164412.785520-29-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; envelope-from=BATV+1220c4869a9b484313cc+7466+infradead.org+dwmw2@desiato.srs.infradead.org; helo=desiato.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806117125100003 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Also update the test to specify which device to attach the test socket to, and remove the comment lamenting the fact that we can't do so. Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/arm/npcm7xx.c | 16 +++++++++------- tests/qtest/npcm7xx_emc-test.c | 18 ++++-------------- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/hw/arm/npcm7xx.c b/hw/arm/npcm7xx.c index e3243a520d..bdc609b5fb 100644 --- a/hw/arm/npcm7xx.c +++ b/hw/arm/npcm7xx.c @@ -656,8 +656,9 @@ static void npcm7xx_realize(DeviceState *dev, Error **e= rrp) =20 /* * EMC Modules. Cannot fail. - * The mapping of the device to its netdev backend works as follows: - * emc[i] =3D nd_table[i] + * Use the available NIC configurations in order, allowing 'emc0' and + * 'emc1' to by used as aliases for the model=3D parameter to override. + * * This works around the inability to specify the netdev property for = the * emc device: it's not pluggable and thus the -device option can't be * used. @@ -665,12 +666,13 @@ static void npcm7xx_realize(DeviceState *dev, Error *= *errp) QEMU_BUILD_BUG_ON(ARRAY_SIZE(npcm7xx_emc_addr) !=3D ARRAY_SIZE(s->emc)= ); QEMU_BUILD_BUG_ON(ARRAY_SIZE(s->emc) !=3D 2); for (i =3D 0; i < ARRAY_SIZE(s->emc); i++) { - s->emc[i].emc_num =3D i; SysBusDevice *sbd =3D SYS_BUS_DEVICE(&s->emc[i]); - if (nd_table[i].used) { - qemu_check_nic_model(&nd_table[i], TYPE_NPCM7XX_EMC); - qdev_set_nic_properties(DEVICE(sbd), &nd_table[i]); - } + char alias[6]; + + s->emc[i].emc_num =3D i; + snprintf(alias, sizeof(alias), "emc%u", i); + qemu_configure_nic_device(DEVICE(sbd), true, alias); + /* * The device exists regardless of whether it's connected to a QEMU * netdev backend. So always instantiate it even if there is no diff --git a/tests/qtest/npcm7xx_emc-test.c b/tests/qtest/npcm7xx_emc-test.c index b046f1d76a..f7646fae2c 100644 --- a/tests/qtest/npcm7xx_emc-test.c +++ b/tests/qtest/npcm7xx_emc-test.c @@ -225,21 +225,11 @@ static int *packet_test_init(int module_num, GString = *cmd_line) g_assert_cmpint(ret, !=3D , -1); =20 /* - * KISS and use -nic. We specify two nics (both emc{0,1}) because ther= e's - * currently no way to specify only emc1: The driver implicitly relies= on - * emc[i] =3D=3D nd_table[i]. + * KISS and use -nic. The driver accepts 'emc0' and 'emc1' as aliases + * in the 'model' field to specify the device to match. */ - if (module_num =3D=3D 0) { - g_string_append_printf(cmd_line, - " -nic socket,fd=3D%d,model=3D" TYPE_NPCM7X= X_EMC " " - " -nic user,model=3D" TYPE_NPCM7XX_EMC " ", - test_sockets[1]); - } else { - g_string_append_printf(cmd_line, - " -nic user,model=3D" TYPE_NPCM7XX_EMC " " - " -nic socket,fd=3D%d,model=3D" TYPE_NPCM7X= X_EMC " ", - test_sockets[1]); - } + g_string_append_printf(cmd_line, " -nic socket,fd=3D%d,model=3Demc%d ", + test_sockets[1], module_num); =20 g_test_queue_destroy(packet_test_clear, test_sockets); return test_sockets; --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806394426932.3789319579283; Thu, 1 Feb 2024 08:53:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaBk-0003Tq-6J; Thu, 01 Feb 2024 11:45:21 -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 1rVaB2-0002v9-Vu for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:37 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAt-0002SV-Qu for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:36 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-0000000GIdR-1gqx for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003INl-1cJq for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=/ulRku6s7viRleZiI+J1AG9hPUHHwrzfLVNgMu8tpd0=; b=ZpJ+PauTQV6lng/LOMvpfOse6C RDtEaRsiI6XoNWHW6kP5SFrqe3rxz0egAdzxVV8LFd/GV9atiTf6sqj9XNTzMDTlHsKfsw5FjwIDE P751UW3WjzU5g2n7rfPFbziohf9EYba+ow4jyu9EjTlAJwX/pGL2NDQcTt7MYddQWe7Fuozu/8czr rywAbLAGXLcfxGhOCKfxkayRxeEwKQ+jGouuk2b68MsMaxu/XM+7JSetJpFnFsJoo0PoFj/GthDiK vVRUnfUb6yFcqYUGRwCIjiabGVRIha83hG/knSWoMgX9coRmETrJH9he2Lz7SkhsrlzsaSG2olM+g 0NgYucmA==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 29/47] hw/arm/stellaris: use qemu_find_nic_info() Date: Thu, 1 Feb 2024 16:43:54 +0000 Message-ID: <20240201164412.785520-30-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806396026100003 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Rather than just using qemu_configure_nic_device(), populate the MAC address in the system-registers device by peeking at the NICInfo before it's assigned to the device. Generate the MAC address early, if there is no matching -nic option. Otherwise the MAC address wouldn't be generated until net_client_init1() runs. Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/arm/stellaris.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index d18b1144af..34c5a86ac2 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -1028,7 +1028,8 @@ static void stellaris_init(MachineState *ms, stellari= s_board_info *board) DeviceState *ssys_dev; int i; int j; - const uint8_t *macaddr; + NICInfo *nd; + MACAddr mac; =20 MemoryRegion *sram =3D g_new(MemoryRegion, 1); MemoryRegion *flash =3D g_new(MemoryRegion, 1); @@ -1051,12 +1052,22 @@ static void stellaris_init(MachineState *ms, stella= ris_board_info *board) * need its sysclk output. */ ssys_dev =3D qdev_new(TYPE_STELLARIS_SYS); - /* Most devices come preprogrammed with a MAC address in the user data= . */ - macaddr =3D nd_table[0].macaddr.a; + + /* + * Most devices come preprogrammed with a MAC address in the user data. + * Generate a MAC address now, if there isn't a matching -nic for it. + */ + nd =3D qemu_find_nic_info("stellaris_enet", true, "stellaris"); + if (nd) { + memcpy(mac.a, nd->macaddr.a, sizeof(mac.a)); + } else { + qemu_macaddr_default_if_unset(&mac); + } + qdev_prop_set_uint32(ssys_dev, "user0", - macaddr[0] | (macaddr[1] << 8) | (macaddr[2] << 1= 6)); + mac.a[0] | (mac.a[1] << 8) | (mac.a[2] << 16)); qdev_prop_set_uint32(ssys_dev, "user1", - macaddr[3] | (macaddr[4] << 8) | (macaddr[5] << 1= 6)); + mac.a[3] | (mac.a[4] << 8) | (mac.a[5] << 16)); qdev_prop_set_uint32(ssys_dev, "did0", board->did0); qdev_prop_set_uint32(ssys_dev, "did1", board->did1); qdev_prop_set_uint32(ssys_dev, "dc0", board->dc0); @@ -1269,10 +1280,13 @@ static void stellaris_init(MachineState *ms, stella= ris_board_info *board) if (board->dc4 & (1 << 28)) { DeviceState *enet; =20 - qemu_check_nic_model(&nd_table[0], "stellaris"); - enet =3D qdev_new("stellaris_enet"); - qdev_set_nic_properties(enet, &nd_table[0]); + if (nd) { + qdev_set_nic_properties(enet, nd); + } else { + qdev_prop_set_macaddr(enet, "mac", mac.a); + } + sysbus_realize_and_unref(SYS_BUS_DEVICE(enet), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(enet), 0, 0x40048000); sysbus_connect_irq(SYS_BUS_DEVICE(enet), 0, qdev_get_gpio_in(nvic,= 42)); --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170680619265857.14586274757778; Thu, 1 Feb 2024 08:49:52 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaD1-0005EL-N9; Thu, 01 Feb 2024 11:46:40 -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 1rVaB4-0002vQ-8e for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:39 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAt-0002SW-Uh for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:37 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-0000000GIdS-1ggH for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003INp-1uCF for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=3dQ2dtRjo0uSs9MkgXkmPl7/brA9aWPKOEIpDR/YgVw=; b=jo4nG8Fpnb6Yqsy0ki7VOKQgDN wnMjk3IcdjAwqiWZ5+nq7ddCyFKfWPOYwuYkzVlYuY7OEB95UzdPGAAiBALk/Szk0YD0m4YrI3C5I x1S2IY19AeDgtHEixZ/ztC+9xUHrSI4CE1DIds2DJptsaZN7AzKx4RLP4o428vg8QhyLgl5oapU0L GgjRiZWeHN2GaNwLqzll7KVOBZfLHczoQ+PSfWgYs9kk5ZgmH0nlgY39LUanU3a29kKxmO49kMj+u 3MmtVt0rhy39Gx57VVn0TI2QxpKKgc39GotoH/M28J1ISghuuBQWDkoDTR/nhKRsBDVcXVk7KVDqf 3BLeN89A==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 30/47] hw/arm: use qemu_configure_nic_device() Date: Thu, 1 Feb 2024 16:43:55 +0000 Message-ID: <20240201164412.785520-31-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806193304100003 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/arm/mps2-tz.c | 8 ++------ hw/arm/msf2-soc.c | 6 +----- hw/arm/musicpal.c | 3 +-- hw/arm/xilinx_zynq.c | 11 ++++------- hw/arm/xlnx-versal.c | 7 +------ hw/arm/xlnx-zynqmp.c | 8 +------- 6 files changed, 10 insertions(+), 33 deletions(-) diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c index 5d8cdc1a4c..a2d18afd79 100644 --- a/hw/arm/mps2-tz.c +++ b/hw/arm/mps2-tz.c @@ -503,14 +503,12 @@ static MemoryRegion *make_eth_dev(MPS2TZMachineState = *mms, void *opaque, const PPCExtraData *extradata) { SysBusDevice *s; - NICInfo *nd =3D &nd_table[0]; =20 /* In hardware this is a LAN9220; the LAN9118 is software compatible * except that it doesn't support the checksum-offload feature. */ - qemu_check_nic_model(nd, "lan9118"); mms->lan9118 =3D qdev_new(TYPE_LAN9118); - qdev_set_nic_properties(mms->lan9118, nd); + qemu_configure_nic_device(mms->lan9118, true, NULL); =20 s =3D SYS_BUS_DEVICE(mms->lan9118); sysbus_realize_and_unref(s, &error_fatal); @@ -528,7 +526,6 @@ static MemoryRegion *make_eth_usb(MPS2TZMachineState *m= ms, void *opaque, * irqs[] is the ethernet IRQ. */ SysBusDevice *s; - NICInfo *nd =3D &nd_table[0]; =20 memory_region_init(&mms->eth_usb_container, OBJECT(mms), "mps2-tz-eth-usb-container", 0x200000); @@ -537,9 +534,8 @@ static MemoryRegion *make_eth_usb(MPS2TZMachineState *m= ms, void *opaque, * In hardware this is a LAN9220; the LAN9118 is software compatible * except that it doesn't support the checksum-offload feature. */ - qemu_check_nic_model(nd, "lan9118"); mms->lan9118 =3D qdev_new(TYPE_LAN9118); - qdev_set_nic_properties(mms->lan9118, nd); + qemu_configure_nic_device(mms->lan9118, true, NULL); =20 s =3D SYS_BUS_DEVICE(mms->lan9118); sysbus_realize_and_unref(s, &error_fatal); diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c index b5fe9f364d..35bf1d64e1 100644 --- a/hw/arm/msf2-soc.c +++ b/hw/arm/msf2-soc.c @@ -197,12 +197,8 @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, E= rror **errp) g_free(bus_name); } =20 - /* FIXME use qdev NIC properties instead of nd_table[] */ - if (nd_table[0].used) { - qemu_check_nic_model(&nd_table[0], TYPE_MSS_EMAC); - qdev_set_nic_properties(DEVICE(&s->emac), &nd_table[0]); - } dev =3D DEVICE(&s->emac); + qemu_configure_nic_device(dev, true, NULL); object_property_set_link(OBJECT(&s->emac), "ahb-bus", OBJECT(get_system_memory()), &error_abort); if (!sysbus_realize(SYS_BUS_DEVICE(&s->emac), errp)) { diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index 0fe0160b48..2020f73a57 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -1277,9 +1277,8 @@ static void musicpal_init(MachineState *machine) } sysbus_create_simple(TYPE_MV88W8618_FLASHCFG, MP_FLASHCFG_BASE, NULL); =20 - qemu_check_nic_model(&nd_table[0], "mv88w8618"); dev =3D qdev_new(TYPE_MV88W8618_ETH); - qdev_set_nic_properties(dev, &nd_table[0]); + qemu_configure_nic_device(dev, true, "mv88w8618"); object_property_set_link(OBJECT(dev), "dma-memory", OBJECT(get_system_memory()), &error_fatal); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c index 66d0de139f..35fa804b7d 100644 --- a/hw/arm/xilinx_zynq.c +++ b/hw/arm/xilinx_zynq.c @@ -109,16 +109,13 @@ static void zynq_write_board_setup(ARMCPU *cpu, =20 static struct arm_boot_info zynq_binfo =3D {}; =20 -static void gem_init(NICInfo *nd, uint32_t base, qemu_irq irq) +static void gem_init(uint32_t base, qemu_irq irq) { DeviceState *dev; SysBusDevice *s; =20 dev =3D qdev_new(TYPE_CADENCE_GEM); - if (nd->used) { - qemu_check_nic_model(nd, TYPE_CADENCE_GEM); - qdev_set_nic_properties(dev, nd); - } + qemu_configure_nic_device(dev, true, NULL); object_property_set_int(OBJECT(dev), "phy-addr", 7, &error_abort); s =3D SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(s, &error_fatal); @@ -280,8 +277,8 @@ static void zynq_init(MachineState *machine) sysbus_create_varargs("cadence_ttc", 0xF8002000, pic[69-IRQ_OFFSET], pic[70-IRQ_OFFSET], pic[71-IRQ_OFFSET], NU= LL); =20 - gem_init(&nd_table[0], 0xE000B000, pic[54-IRQ_OFFSET]); - gem_init(&nd_table[1], 0xE000C000, pic[77-IRQ_OFFSET]); + gem_init(0xE000B000, pic[54 - IRQ_OFFSET]); + gem_init(0xE000C000, pic[77 - IRQ_OFFSET]); =20 for (n =3D 0; n < 2; n++) { int hci_irq =3D n ? 79 : 56; diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c index 2798df3730..50cb0606cb 100644 --- a/hw/arm/xlnx-versal.c +++ b/hw/arm/xlnx-versal.c @@ -256,18 +256,13 @@ static void versal_create_gems(Versal *s, qemu_irq *p= ic) static const int irqs[] =3D { VERSAL_GEM0_IRQ_0, VERSAL_GEM1_IRQ_0= }; static const uint64_t addrs[] =3D { MM_GEM0, MM_GEM1 }; char *name =3D g_strdup_printf("gem%d", i); - NICInfo *nd =3D &nd_table[i]; DeviceState *dev; MemoryRegion *mr; =20 object_initialize_child(OBJECT(s), name, &s->lpd.iou.gem[i], TYPE_CADENCE_GEM); dev =3D DEVICE(&s->lpd.iou.gem[i]); - /* FIXME use qdev NIC properties instead of nd_table[] */ - if (nd->used) { - qemu_check_nic_model(nd, "cadence_gem"); - qdev_set_nic_properties(dev, nd); - } + qemu_configure_nic_device(dev, true, NULL); object_property_set_int(OBJECT(dev), "phy-addr", 23, &error_abort); object_property_set_int(OBJECT(dev), "num-priority-queues", 2, &error_abort); diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c index 65901c6e74..afeb3f88f8 100644 --- a/hw/arm/xlnx-zynqmp.c +++ b/hw/arm/xlnx-zynqmp.c @@ -618,13 +618,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Erro= r **errp) } =20 for (i =3D 0; i < XLNX_ZYNQMP_NUM_GEMS; i++) { - NICInfo *nd =3D &nd_table[i]; - - /* FIXME use qdev NIC properties instead of nd_table[] */ - if (nd->used) { - qemu_check_nic_model(nd, TYPE_CADENCE_GEM); - qdev_set_nic_properties(DEVICE(&s->gem[i]), nd); - } + qemu_configure_nic_device(DEVICE(&s->gem[i]), true, NULL); object_property_set_int(OBJECT(&s->gem[i]), "revision", GEM_REVISI= ON, &error_abort); object_property_set_int(OBJECT(&s->gem[i]), "phy-addr", 23, --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806183521161.38214919465304; Thu, 1 Feb 2024 08:49:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaCb-0004Jb-Bp; Thu, 01 Feb 2024 11:46:15 -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 1rVaB7-0002yX-OC for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:42 -0500 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAv-0002V0-Fr for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:41 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAh-00000009cMA-1xzF for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:15 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003INw-20d9 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=qZJ5znInl8VUzkg42vOEqkv8s7zoSUtbb4o7syIWshQ=; b=K1kMAqPPnWYvrh6WYsADaHmQEG B/Z59qM5EltBywto1ODQXc7mb/fvPxTJPwd2ocufkPYo+/59g1mnFMoHg0QpVfqAwIwaGXrDUkEJ5 KVZ3BxLDKWkk39nDkeJKj/pEs5CCNWGC7qFCUY4UkTbOGYuihIbQZlk4rJRYnRDkMVHyAoE4nBMWB OlpUulzreDLY+1Ll53jq5V9kkKcgo/snEsqARONQdO8XQMHemllbTchLt6OsOvUdGDmf4ifo7jt+0 1/ITatLUVJqia09c5JphlFjlXZJZolxFxhgghzPsoZ4NLmO3I8OlhJaffGMcP3FBGSw52rJHv48bX TrTaqkVQ==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 31/47] hw/net/etraxfs-eth: use qemu_configure_nic_device() Date: Thu, 1 Feb 2024 16:43:56 +0000 Message-ID: <20240201164412.785520-32-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; envelope-from=BATV+1220c4869a9b484313cc+7466+infradead.org+dwmw2@desiato.srs.infradead.org; helo=desiato.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806185353100003 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/cris/axis_dev88.c | 9 ++++----- hw/net/etraxfs_eth.c | 5 ++--- include/hw/cris/etraxfs.h | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/hw/cris/axis_dev88.c b/hw/cris/axis_dev88.c index d82050d927..5556634921 100644 --- a/hw/cris/axis_dev88.c +++ b/hw/cris/axis_dev88.c @@ -308,15 +308,14 @@ void axisdev88_init(MachineState *machine) =20 /* Add the two ethernet blocks. */ dma_eth =3D g_malloc0(sizeof dma_eth[0] * 4); /* Allocate 4 channels. = */ - etraxfs_eth_init(&nd_table[0], 0x30034000, 1, &dma_eth[0], &dma_eth[1]= ); - if (nb_nics > 1) { - etraxfs_eth_init(&nd_table[1], 0x30036000, 2, &dma_eth[2], &dma_et= h[3]); - } =20 + etraxfs_eth_init(0x30034000, 1, &dma_eth[0], &dma_eth[1]); /* The DMA Connector block is missing, hardwire things for now. */ etraxfs_dmac_connect_client(etraxfs_dmac, 0, &dma_eth[0]); etraxfs_dmac_connect_client(etraxfs_dmac, 1, &dma_eth[1]); - if (nb_nics > 1) { + + if (qemu_find_nic_info("etraxfs-eth", true, "fseth")) { + etraxfs_eth_init(0x30036000, 2, &dma_eth[2], &dma_eth[3]); etraxfs_dmac_connect_client(etraxfs_dmac, 6, &dma_eth[2]); etraxfs_dmac_connect_client(etraxfs_dmac, 7, &dma_eth[3]); } diff --git a/hw/net/etraxfs_eth.c b/hw/net/etraxfs_eth.c index ba57a978d1..5faf20c782 100644 --- a/hw/net/etraxfs_eth.c +++ b/hw/net/etraxfs_eth.c @@ -647,15 +647,14 @@ static void etraxfs_eth_class_init(ObjectClass *klass= , void *data) =20 /* Instantiate an ETRAXFS Ethernet MAC. */ DeviceState * -etraxfs_eth_init(NICInfo *nd, hwaddr base, int phyaddr, +etraxfs_eth_init(hwaddr base, int phyaddr, struct etraxfs_dma_client *dma_out, struct etraxfs_dma_client *dma_in) { DeviceState *dev; - qemu_check_nic_model(nd, "fseth"); =20 dev =3D qdev_new("etraxfs-eth"); - qdev_set_nic_properties(dev, nd); + qemu_configure_nic_device(dev, true, "fseth"); qdev_prop_set_uint32(dev, "phyaddr", phyaddr); =20 /* diff --git a/include/hw/cris/etraxfs.h b/include/hw/cris/etraxfs.h index 467b529dc0..012c4e9974 100644 --- a/include/hw/cris/etraxfs.h +++ b/include/hw/cris/etraxfs.h @@ -31,7 +31,7 @@ #include "hw/sysbus.h" #include "qapi/error.h" =20 -DeviceState *etraxfs_eth_init(NICInfo *nd, hwaddr base, int phyaddr, +DeviceState *etraxfs_eth_init(hwaddr base, int phyaddr, struct etraxfs_dma_client *dma_out, struct etraxfs_dma_client *dma_in); =20 --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806411754217.27412880196107; Thu, 1 Feb 2024 08:53:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaD6-0005XM-UK; Thu, 01 Feb 2024 11:46:45 -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 1rVaB8-0002yZ-68 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:42 -0500 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAv-0002Uo-JT for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:41 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAh-00000009cMB-1yp0 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:15 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003IO0-27IQ for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=GkywRXV+y0p7Nt5wgFGuell3roGE2NQ8qPpvNbU7STs=; b=OgSXjY2jyahgurNfKx423g5dhL hCkgMxuh6ndDhoRipzmOWZgr2E9JDzMatg0p9kabdqmB/QtAGUICWuq2HOe1W1tj8DeSTyfzMw9ld Zb9ttDEokX/KpYq0H97F+A23T0kIs8nTZVSa2LI9tJLKHhCrrv+zICzypBB3Ncz54BrEduV3z0Kul MT6xdhsB7WhlzF0rWkmDkj5dKXRaxFX200j+yKcfi2wLdRMeKJ0PdiktX2im3IETkOsVQkGMqmg/W JQ8ysDbAodZyQYaVRER46fm5+3M3FQ0miuwu48Uu7mbxPxHwNRJvUsOAGI05xu3JJXwDPCydWwlCJ u44+SBZg==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 32/47] hw/m68k/mcf5208: use qemu_create_nic_device() Date: Thu, 1 Feb 2024 16:43:57 +0000 Message-ID: <20240201164412.785520-33-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; envelope-from=BATV+1220c4869a9b484313cc+7466+infradead.org+dwmw2@desiato.srs.infradead.org; helo=desiato.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806412069100001 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/m68k/mcf5208.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c index d22d8536db..0cfb806c20 100644 --- a/hw/m68k/mcf5208.c +++ b/hw/m68k/mcf5208.c @@ -206,16 +206,16 @@ static void mcf5208_sys_init(MemoryRegion *address_sp= ace, qemu_irq *pic) } } =20 -static void mcf_fec_init(MemoryRegion *sysmem, NICInfo *nd, hwaddr base, - qemu_irq *irqs) +static void mcf_fec_init(MemoryRegion *sysmem, hwaddr base, qemu_irq *irqs) { DeviceState *dev; SysBusDevice *s; int i; =20 - qemu_check_nic_model(nd, TYPE_MCF_FEC_NET); - dev =3D qdev_new(TYPE_MCF_FEC_NET); - qdev_set_nic_properties(dev, nd); + dev =3D qemu_create_nic_device(TYPE_MCF_FEC_NET, true, NULL); + if (!dev) { + return; + } =20 s =3D SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(s, &error_fatal); @@ -267,14 +267,7 @@ static void mcf5208evb_init(MachineState *machine) =20 mcf5208_sys_init(address_space_mem, pic); =20 - if (nb_nics > 1) { - error_report("Too many NICs"); - exit(1); - } - if (nd_table[0].used) { - mcf_fec_init(address_space_mem, &nd_table[0], - 0xfc030000, pic + 36); - } + mcf_fec_init(address_space_mem, 0xfc030000, pic + 36); =20 g_free(pic); =20 --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806221973119.6632047832801; Thu, 1 Feb 2024 08:50:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaE4-0007uK-Rb; Thu, 01 Feb 2024 11:47:45 -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 1rVaB7-0002yF-Cn for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:42 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAv-0002Sc-2K for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:41 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-0000000GIdT-2IoD for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003IO4-2D6w for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=m7jMvVP0UpN6AMOjQGouoZqSl/IYWhHtH7lX+Ejn/NM=; b=DWjdfy5ZXbzudbvX+YP/FM+19o 2771+Es9CzTgc5mc5Ts04xW22aq7n9Nb/U68h1kiISya0OkW6wTJpQCt+zUdpNByvVGbVoEYjTP6v p2LW7sjJOZDlm98NYfHKSTkpAl8/7hHctsA9qEvzAHw4Y1ZTpWYbpLvUKJB8T103WfjArrVqK+ivP NT33AHf96AMJ6SbCAwFS/zUG77sc8UbbMaAZBrRd6fG5RiLtASHO6ubK2aOQJHATaeC2JH7qOFu8M rVe9e07LuJuqUa1r3s2czxc0PL7uVIh8tMG7UA1T/In0j5+hn/cMpnRTHSi8nwiuR6tIzY2g6Za3H MIKE38+Q==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 33/47] hw/m68k/q800: use qemu_find_nic_info() Date: Thu, 1 Feb 2024 16:43:58 +0000 Message-ID: <20240201164412.785520-34-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806223399100003 Content-Type: text/plain; charset="utf-8" From: David Woodhouse If a corresponding NIC configuration was found, it will have a MAC address already assigned, so use that. Else, generate and assign a default one. Using qemu_find_nic_info() is simpler than the alternative of using qemu_configure_nic_device() and then having to fetch the "mac" property as a string and convert it. Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/m68k/q800.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index b80a3b6d5f..fa7683bf76 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -48,6 +48,7 @@ #include "hw/display/macfb.h" #include "hw/block/swim.h" #include "net/net.h" +#include "net/util.h" #include "qapi/error.h" #include "qemu/error-report.h" #include "sysemu/qtest.h" @@ -270,6 +271,8 @@ static void q800_machine_init(MachineState *machine) BusState *adb_bus; NubusBus *nubus; DriveInfo *dinfo; + NICInfo *nd; + MACAddr mac; uint8_t rng_seed[32]; =20 linux_boot =3D (kernel_filename !=3D NULL); @@ -370,13 +373,6 @@ static void q800_machine_init(MachineState *machine) =20 /* MACSONIC */ =20 - if (nb_nics > 1) { - error_report("q800 can only have one ethernet interface"); - exit(1); - } - - qemu_check_nic_model(&nd_table[0], "dp83932"); - /* * MacSonic driver needs an Apple MAC address * Valid prefix are: @@ -386,14 +382,21 @@ static void q800_machine_init(MachineState *machine) * 08:00:07 Apple * (Q800 use the last one) */ - nd_table[0].macaddr.a[0] =3D 0x08; - nd_table[0].macaddr.a[1] =3D 0x00; - nd_table[0].macaddr.a[2] =3D 0x07; - object_initialize_child(OBJECT(machine), "dp8393x", &m->dp8393x, TYPE_DP8393X); dev =3D DEVICE(&m->dp8393x); - qdev_set_nic_properties(dev, &nd_table[0]); + nd =3D qemu_find_nic_info(TYPE_DP8393X, true, "dp83932"); + if (nd) { + qdev_set_nic_properties(dev, nd); + memcpy(mac.a, nd->macaddr.a, sizeof(mac.a)); + } else { + qemu_macaddr_default_if_unset(&mac); + } + mac.a[0] =3D 0x08; + mac.a[1] =3D 0x00; + mac.a[2] =3D 0x07; + qdev_prop_set_macaddr(dev, "mac", mac.a); + qdev_prop_set_uint8(dev, "it_shift", 2); qdev_prop_set_bit(dev, "big_endian", true); object_property_set_link(OBJECT(dev), "dma_mr", @@ -414,7 +417,7 @@ static void q800_machine_init(MachineState *machine) prom =3D memory_region_get_ram_ptr(&m->dp8393x_prom); checksum =3D 0; for (i =3D 0; i < 6; i++) { - prom[i] =3D revbit8(nd_table[0].macaddr.a[i]); + prom[i] =3D revbit8(mac.a[i]); checksum ^=3D prom[i]; } prom[7] =3D 0xff - checksum; --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170680600807525.140122133120258; Thu, 1 Feb 2024 08:46:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaBo-0003Vb-37; Thu, 01 Feb 2024 11:45:25 -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 1rVaB2-0002v8-Vk for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:37 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAt-0002Sb-O2 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:36 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-0000000GIda-2GZO for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003IO8-2J0P for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=RalmZg2g2HcWNPspE1WbCMjLC5xu8xXxgPEaYu8kgcA=; b=rURX+KXRFUM+an/qE6Q2aFplzO 6QlcoAoIW62Mq/X194zvBvooVS4b7KzwQrWYlXGZYEAkj14al6DwZ09YnECcHTipogJ3AQSJmxc/G qqtYC5Ifp9u5RHYAAtMmNY/fk6xQZ6KiC8uNaMbMBm04KOJXvJHm2ioaH6R+V2XNOKxYtNJd1YAiq MM2owT0XXZlVDxONwazax3FWXWEckVgqgYi0SLNfbcsO/saptXAJSh4M/e2vLl+5knUFw4x4NFRY4 NCr5IaUoIms9m0lA9aqWRgzo74S/A/bF0Bd29Bj9sZ0k2dcPMkITejpmNggJFZ9xI34CLTsxc25nC 9CM+yFPQ==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 34/47] hw/microblaze: use qemu_configure_nic_device() Date: Thu, 1 Feb 2024 16:43:59 +0000 Message-ID: <20240201164412.785520-35-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806008843100006 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/microblaze/petalogix_ml605_mmu.c | 3 +-- hw/microblaze/petalogix_s3adsp1800_mmu.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/microblaze/petalogix_ml605_mmu.c b/hw/microblaze/petalogix_= ml605_mmu.c index fb7889cf67..0f5fabc32e 100644 --- a/hw/microblaze/petalogix_ml605_mmu.c +++ b/hw/microblaze/petalogix_ml605_mmu.c @@ -133,7 +133,6 @@ petalogix_ml605_init(MachineState *machine) sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq[TIMER_IRQ]); =20 /* axi ethernet and dma initialization. */ - qemu_check_nic_model(&nd_table[0], "xlnx.axi-ethernet"); eth0 =3D qdev_new("xlnx.axi-ethernet"); dma =3D qdev_new("xlnx.axi-dma"); =20 @@ -145,7 +144,7 @@ petalogix_ml605_init(MachineState *machine) "axistream-connected-target", NULL); cs =3D object_property_get_link(OBJECT(dma), "axistream-control-connected-target", NU= LL); - qdev_set_nic_properties(eth0, &nd_table[0]); + qemu_configure_nic_device(eth0, true, NULL); qdev_prop_set_uint32(eth0, "rxmem", 0x1000); qdev_prop_set_uint32(eth0, "txmem", 0x1000); object_property_set_link(OBJECT(eth0), "axistream-connected", ds, diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petal= ogix_s3adsp1800_mmu.c index 505639c298..dad46bd7f9 100644 --- a/hw/microblaze/petalogix_s3adsp1800_mmu.c +++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c @@ -114,9 +114,8 @@ petalogix_s3adsp1800_init(MachineState *machine) sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, TIMER_BASEADDR); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq[TIMER_IRQ]); =20 - qemu_check_nic_model(&nd_table[0], "xlnx.xps-ethernetlite"); dev =3D qdev_new("xlnx.xps-ethernetlite"); - qdev_set_nic_properties(dev, &nd_table[0]); + qemu_configure_nic_device(dev, true, NULL); qdev_prop_set_uint32(dev, "tx-ping-pong", 0); qdev_prop_set_uint32(dev, "rx-ping-pong", 0); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806758024125.40364432477338; Thu, 1 Feb 2024 08:59:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaAy-0002sk-3N; Thu, 01 Feb 2024 11:44: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 1rVaAq-0002qj-Tt for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:25 -0500 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAm-0002Us-A8 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:24 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAh-00000009cMD-23TP for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:15 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003IOC-2afD for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=xr1/NyJ+W/G/dImXr8onvTyjdbNR/se0e2ncI/Tuy90=; b=mJebKQrxWQWU7swGGKS4onomzs XtD1uMdpNCOPRw47+TDn0r4/nZ9AuwA4/74DDubzlTXpyJdw10taOmm39oYllqY+4jq35iFAvvXk2 H1w8x8tm2V8PWV29JC34gvDJA5rtkFV7zC+AKXH4fxhRoDk3ZkndX50GwXENKIsSPSWEjv2gM27hr dB6tPWXYDhXmAFD5YMH6NQRcSo0lz9YNpLR+7gWBtoSKltV24CQ8hKIeBghWmjGlwnmhx8i2GdaVM aE4Xsp6S3Jkfie9NFVxMts07p7NXhC4iK0sJNXjJNsfmDLKt7iJTCLFGxePj7rmeXpDOLcHXMspcw 40bMI4Tg==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 35/47] hw/mips/mipssim: use qemu_create_nic_device() Date: Thu, 1 Feb 2024 16:44:00 +0000 Message-ID: <20240201164412.785520-36-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; envelope-from=BATV+1220c4869a9b484313cc+7466+infradead.org+dwmw2@desiato.srs.infradead.org; helo=desiato.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806759213100007 Content-Type: text/plain; charset="utf-8" From: David Woodhouse The MIPS SIM platform instantiates its NIC only if a corresponding configuration exists for it. Use qemu_create_nic_device() function for that. Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/mips/mipssim.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/mips/mipssim.c b/hw/mips/mipssim.c index 01e323904d..16af31648e 100644 --- a/hw/mips/mipssim.c +++ b/hw/mips/mipssim.c @@ -118,13 +118,15 @@ static void main_cpu_reset(void *opaque) } } =20 -static void mipsnet_init(int base, qemu_irq irq, NICInfo *nd) +static void mipsnet_init(int base, qemu_irq irq) { DeviceState *dev; SysBusDevice *s; =20 - dev =3D qdev_new("mipsnet"); - qdev_set_nic_properties(dev, nd); + dev =3D qemu_create_nic_device("mipsnet", true, NULL); + if (!dev) { + return; + } =20 s =3D SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(s, &error_fatal); @@ -225,9 +227,8 @@ mips_mipssim_init(MachineState *machine) sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0)); } =20 - if (nd_table[0].used) - /* MIPSnet uses the MIPS CPU INT0, which is interrupt 2. */ - mipsnet_init(0x4200, env->irq[2], &nd_table[0]); + /* MIPSnet uses the MIPS CPU INT0, which is interrupt 2. */ + mipsnet_init(0x4200, env->irq[2]); } =20 static void mips_mipssim_machine_init(MachineClass *mc) --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806109699848.9289734909694; Thu, 1 Feb 2024 08:48:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaDJ-0006Dv-D6; Thu, 01 Feb 2024 11:47:00 -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 1rVaB6-0002wi-1i for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:40 -0500 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAv-0002Ut-1X for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:39 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAh-00000009cME-1xFD for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:15 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003IOG-2hTV for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=TVv/AOdOYH5a2U0HTHi4RTU6DjGrYfL4+2ys8pUR+jg=; b=hYyP0bZDziJB2oS/CGESKD4WTk RwR9kSD9znQ9kBzCwimL9ljPeNsgQVBs4bt3741MJlp6kv/Q0FAXZtr4OaEVXcgJPQmu5ty/YNkuN +Gj8sCUnhaEyv/BQ1ja5FE4svojwMl4VB4OSdGkbbDDSHHEXTb98uE/OXNR8E23ibGGti6dUiRBCP r7J3t1GcA4obnzhPttU/+ArwQxpWERwOqu4RjsdOQ3x8LekL36G4z6QJPTCcbLTEHB0nCGyNOw8yK 8VHE8ygZvHYNrETRy43v855H06a2I9JFVt78hBG7ORl5FzuitI4BdsJCgUJ+68d+mD8bmNfMOlK/T 6ASqmJgg==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 36/47] hw/mips/jazz: use qemu_find_nic_info() Date: Thu, 1 Feb 2024 16:44:01 +0000 Message-ID: <20240201164412.785520-37-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; envelope-from=BATV+1220c4869a9b484313cc+7466+infradead.org+dwmw2@desiato.srs.infradead.org; helo=desiato.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806111121100005 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/mips/jazz.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c index 0d2348aa5a..5bf3e328db 100644 --- a/hw/mips/jazz.c +++ b/hw/mips/jazz.c @@ -119,15 +119,19 @@ static const MemoryRegionOps dma_dummy_ops =3D { .endianness =3D DEVICE_NATIVE_ENDIAN, }; =20 -static void mips_jazz_init_net(NICInfo *nd, IOMMUMemoryRegion *rc4030_dma_= mr, +static void mips_jazz_init_net(IOMMUMemoryRegion *rc4030_dma_mr, DeviceState *rc4030, MemoryRegion *dp8393x_= prom) { DeviceState *dev; SysBusDevice *sysbus; int checksum, i; uint8_t *prom; + NICInfo *nd; =20 - qemu_check_nic_model(nd, "dp83932"); + nd =3D qemu_find_nic_info("dp8393x", true, "dp82932"); + if (!nd) { + return; + } =20 dev =3D qdev_new("dp8393x"); qdev_set_nic_properties(dev, nd); @@ -324,12 +328,7 @@ static void mips_jazz_init(MachineState *machine, } =20 /* Network controller */ - if (nb_nics =3D=3D 1) { - mips_jazz_init_net(&nd_table[0], rc4030_dma_mr, rc4030, dp8393x_pr= om); - } else if (nb_nics > 1) { - error_report("This machine only supports one NIC"); - exit(1); - } + mips_jazz_init_net(rc4030_dma_mr, rc4030, dp8393x_prom); =20 /* SCSI adapter */ dev =3D qdev_new(TYPE_SYSBUS_ESP); --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806261935727.524061335652; Thu, 1 Feb 2024 08:51:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaDG-0006Ch-AJ; Thu, 01 Feb 2024 11:46:57 -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 1rVaAo-0002q7-1C for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:22 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAj-0002TS-5z for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:21 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-0000000GIdh-2ji3 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:15 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003ION-2pbn for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=cI5cE7Mqa56oXquPAqcBShZgLjDP9Pq4cQYsmEeMuWM=; b=B8+9GumPRaJbx6e32Ayg9CfCSA JECO8B0ZJpuXiEoajR1EeOJZSm8kviU3lu9Zs+FvIDjXwbiqvwMNBeUX2BMU3xGcujo158OTX5LYS xS0CqCJPLDITACwjSbQzfS6TzCyVKtdoN9IWg8XRpz45vtUJCvP4pecITKoSjgX+op1hvkY+TmqMP NOcNcW3f1awp3xdSYgkT37qBrdcLrg7ARWAtf0YrwEhBSh7E7+FahG64HhUnaRl5VmFVeiVWSSdCl S3VwFLtBNy7KAQj3dzFaoq9+CHikoDAeVTa3KiaRpLitf7YKP1GW4rEZDXDpjhHIzDj12p5dKOYW3 FYFVeNBA==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 37/47] hw/net/lasi_i82596: Re-enable build Date: Thu, 1 Feb 2024 16:44:02 +0000 Message-ID: <20240201164412.785520-38-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806263689100003 Content-Type: text/plain; charset="utf-8" From: David Woodhouse When converting to the shiny build-system-du-jour, a typo prevented the last_i82596 driver from being built. Correct the config option name to re-enable the build. And include "sysemu/sysemu.h" so it actually builds. Fixes: b1419fa66558 ("meson: convert hw/net") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2144 Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/net/lasi_i82596.c | 1 + hw/net/meson.build | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/net/lasi_i82596.c b/hw/net/lasi_i82596.c index 6a3147fe2d..09e830ba5f 100644 --- a/hw/net/lasi_i82596.c +++ b/hw/net/lasi_i82596.c @@ -14,6 +14,7 @@ #include "qapi/error.h" #include "qemu/timer.h" #include "hw/sysbus.h" +#include "sysemu/sysemu.h" #include "net/eth.h" #include "hw/net/lasi_82596.h" #include "hw/net/i82596.h" diff --git a/hw/net/meson.build b/hw/net/meson.build index 9afceb0619..2b426d3d5a 100644 --- a/hw/net/meson.build +++ b/hw/net/meson.build @@ -33,7 +33,7 @@ system_ss.add(when: 'CONFIG_MARVELL_88W8618', if_true: fi= les('mv88w8618_eth.c')) system_ss.add(when: 'CONFIG_CADENCE', if_true: files('cadence_gem.c')) system_ss.add(when: 'CONFIG_STELLARIS_ENET', if_true: files('stellaris_ene= t.c')) system_ss.add(when: 'CONFIG_LANCE', if_true: files('lance.c')) -system_ss.add(when: 'CONFIG_LASI_I82596', if_true: files('lasi_i82596.c')) +system_ss.add(when: 'CONFIG_LASI_82596', if_true: files('lasi_i82596.c')) system_ss.add(when: 'CONFIG_I82596_COMMON', if_true: files('i82596.c')) system_ss.add(when: 'CONFIG_SUNHME', if_true: files('sunhme.c')) system_ss.add(when: 'CONFIG_FTGMAC100', if_true: files('ftgmac100.c')) --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706807062915273.3109738758087; Thu, 1 Feb 2024 09:04:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaDn-0007CU-NF; Thu, 01 Feb 2024 11:47: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 1rVaB6-0002xh-Mc for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:41 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAv-0002Tk-1Y for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:40 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-0000000GIdi-2iUh for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:15 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003IOT-2wV4 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=/MTEStVe8JsIJfw31uF1pPqlJs68QbDUjigCzt5wrRY=; b=MN83k/OsTtGDYfxCHsF1QRBpBS H6KVR1OH6b7fXUxXcBrbp8Cf51izgrrmCF9bRph7zPJ6kqu5d8ZE+lMZTHsu8s44Ty1oWBzBEbWtZ iF2RUzru7uTVMDB1soWEEm63xgjjlq8IiFZ3fXYf926158X3qyqN8U2nPoNgaMHvNCh58pdCZwDH4 MdT6ruEOjCzJCWqHW1QQ5yiT1ZYBbBYpLeVetd0uFOU1byMhKRoWi2BAY9cmwOlFsqDlexp1x0ehm 6gMeq/DfiYT0tb7mX/04pJiZfh2WPoFUf06sxbbgoJ1armnu4kUQMuV0aGCPgrYhplKeZxttjg5cn oete+4wA==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 38/47] hw/net/lasi_i82596: use qemu_create_nic_device() Date: Thu, 1 Feb 2024 16:44:03 +0000 Message-ID: <20240201164412.785520-39-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706807064969100003 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Create the device only if there is a corresponding NIC config for it. Remove the explicit check on nd_table[0].used from hw/hppa/machine.c which (since commit d8a3220005d7) tries to do the same thing. The lasi_82596 support has been disabled since it was first introduced, since enable_lasi_lan() has always been zero. This allows the user to enable it by explicitly requesting a NIC model 'lasi_82596' or just using the alias 'lasi'. Otherwise, it defaults to a PCI NIC as before. Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/hppa/machine.c | 11 ++++------- hw/net/lasi_i82596.c | 12 +++++++----- include/hw/net/lasi_82596.h | 4 ++-- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index a1045b48cc..5ae4f176f6 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -362,14 +362,11 @@ static void machine_HP_common_init_tail(MachineState = *machine, PCIBus *pci_bus, } =20 /* Network setup. */ - if (nd_table[0].used && enable_lasi_lan()) { - lasi_82596_init(addr_space, translate(NULL, LASI_LAN_HPA), - qdev_get_gpio_in(lasi_dev, LASI_IRQ_LAN_HPA)); - } + lasi_82596_init(addr_space, translate(NULL, LASI_LAN_HPA), + qdev_get_gpio_in(lasi_dev, LASI_IRQ_LAN_HPA), + enable_lasi_lan()); =20 - if (!enable_lasi_lan()) { - pci_init_nic_devices(pci_bus, mc->default_nic); - } + pci_init_nic_devices(pci_bus, mc->default_nic); =20 /* BMC board: HP Powerbar SP2 Diva (with console only) */ pci_dev =3D pci_new(-1, "pci-serial"); diff --git a/hw/net/lasi_i82596.c b/hw/net/lasi_i82596.c index 09e830ba5f..fcf7fae941 100644 --- a/hw/net/lasi_i82596.c +++ b/hw/net/lasi_i82596.c @@ -118,19 +118,21 @@ static void lasi_82596_realize(DeviceState *dev, Erro= r **errp) i82596_common_init(dev, s, &net_lasi_82596_info); } =20 -SysBusI82596State *lasi_82596_init(MemoryRegion *addr_space, - hwaddr hpa, qemu_irq lan_irq) +SysBusI82596State *lasi_82596_init(MemoryRegion *addr_space, hwaddr hpa, + qemu_irq lan_irq, gboolean match_defaul= t) { DeviceState *dev; SysBusI82596State *s; static const MACAddr HP_MAC =3D { .a =3D { 0x08, 0x00, 0x09, 0xef, 0x34, 0xf6 } }; =20 - qemu_check_nic_model(&nd_table[0], TYPE_LASI_82596); - dev =3D qdev_new(TYPE_LASI_82596); + dev =3D qemu_create_nic_device(TYPE_LASI_82596, match_default, "lasi"); + if (!dev) { + return NULL; + } + s =3D SYSBUS_I82596(dev); s->state.irq =3D lan_irq; - qdev_set_nic_properties(dev, &nd_table[0]); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); s->state.conf.macaddr =3D HP_MAC; /* set HP MAC prefix */ =20 diff --git a/include/hw/net/lasi_82596.h b/include/hw/net/lasi_82596.h index 3ef2f47ba2..439356ec19 100644 --- a/include/hw/net/lasi_82596.h +++ b/include/hw/net/lasi_82596.h @@ -25,7 +25,7 @@ struct SysBusI82596State { int val_index:1; }; =20 -SysBusI82596State *lasi_82596_init(MemoryRegion *addr_space, - hwaddr hpa, qemu_irq irq); +SysBusI82596State *lasi_82596_init(MemoryRegion *addr_space, hwaddr hpa, + qemu_irq irq, gboolean match_default); =20 #endif --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806021839663.9776407168333; Thu, 1 Feb 2024 08:47:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaAt-0002rx-KW; Thu, 01 Feb 2024 11:44:28 -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 1rVaAm-0002pg-Qc for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:20 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAk-0002Tl-7y for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:20 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-0000000GIdj-2cKU for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:15 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003IOY-33aJ for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=3fkwqn/oQ2lTIBRIwv3DeL/yQVsijuQk7CJbx2zLVp8=; b=eMq0A9+n0tUeL8fppCRvG+lUdJ U4UX2Zpv1In6Grmzt5aEKij6RhapBwFaoiE9Dhf0ek1kLN3Ag/VMY6VYRHai271TzDcQPADklJ7tZ XIB4bDqJug3ETnSzKjPzbgYdQMIHSsNu9cKOx9RR9c2xq9HE8EDyHpP5sGGgz6EBNB53LNuIWvG9M V7KePstZo+ApiVudse15L037G8v2FGPKlToCH+SfHpbzXDfWsv/1qf1Z+dp/paMeBxew1hXn6J/mX jDxXczK058XhDYpOElLbBr0ilJhNaj4Leiji5EaiOOdY9SGd1WBR26WWUKr2sPb5FL/6hRUHuwE5s kMpQhcQg==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 39/47] hw/openrisc/openrisc_sim: use qemu_create_nic_device() Date: Thu, 1 Feb 2024 16:44:04 +0000 Message-ID: <20240201164412.785520-40-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806022890100003 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/openrisc/openrisc_sim.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c index 35da123aef..bffd6f721f 100644 --- a/hw/openrisc/openrisc_sim.c +++ b/hw/openrisc/openrisc_sim.c @@ -170,7 +170,7 @@ static void openrisc_create_fdt(Or1ksimState *state, =20 static void openrisc_sim_net_init(Or1ksimState *state, hwaddr base, hwaddr= size, int num_cpus, OpenRISCCPU *cpus[], - int irq_pin, NICInfo *nd) + int irq_pin) { void *fdt =3D state->fdt; DeviceState *dev; @@ -178,8 +178,10 @@ static void openrisc_sim_net_init(Or1ksimState *state,= hwaddr base, hwaddr size, char *nodename; int i; =20 - dev =3D qdev_new("open_eth"); - qdev_set_nic_properties(dev, nd); + dev =3D qemu_create_nic_device("open_eth", true, NULL); + if (!dev) { + return; + } =20 s =3D SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(s, &error_fatal); @@ -313,12 +315,10 @@ static void openrisc_sim_init(MachineState *machine) openrisc_create_fdt(state, or1ksim_memmap, smp_cpus, machine->ram_size, machine->kernel_cmdline); =20 - if (nd_table[0].used) { - openrisc_sim_net_init(state, or1ksim_memmap[OR1KSIM_ETHOC].base, - or1ksim_memmap[OR1KSIM_ETHOC].size, - smp_cpus, cpus, - OR1KSIM_ETHOC_IRQ, nd_table); - } + openrisc_sim_net_init(state, or1ksim_memmap[OR1KSIM_ETHOC].base, + or1ksim_memmap[OR1KSIM_ETHOC].size, + smp_cpus, cpus, + OR1KSIM_ETHOC_IRQ); =20 if (smp_cpus > 1) { openrisc_sim_ompic_init(state, or1ksim_memmap[OR1KSIM_OMPIC].base, --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170680622587961.81448894718062; Thu, 1 Feb 2024 08:50:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaB1-0002tZ-Dg; Thu, 01 Feb 2024 11:44:35 -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 1rVaAn-0002pw-6u for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:21 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAk-0002TR-7w for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:20 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-0000000GIdk-2gKd for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:15 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003IOc-3AQU for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=IXEZX2HEBbMBwUhayue76+vBPs8XLNbiy1LneqBnSSQ=; b=Y107nbmpkS+UHJVhwfdj5/jMEC VRijhUDwEfrhSuftAMm3mom1il52hKxAXBiTMoHa0KZM99D178pWT1BBDT7nztU1qo49EP8VxsF1W 51bcCFvN32AsatgZF5/Ov33bBSP5qs1lA7wbMPfPl2DLUgRfH8v1eyAvk/I1+38acde4d+v3UIrUu 4Qs7VP+hbJzYe7bGEMsdTZmYoglQU8DfhY8akLlQXWzdzfLxajD2trPWEvYksIh4/ktJpjlGbK7fx p+3891Pu5Z1kj7/bOdQJ0EKKBMIPdyeozQgymi2YNuHT18oBzV2/fuPT+KoUWBmsZud//3lolcppi UoxvQHVQ==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 40/47] hw/riscv: use qemu_configure_nic_device() Date: Thu, 1 Feb 2024 16:44:05 +0000 Message-ID: <20240201164412.785520-41-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806227424100003 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/riscv/microchip_pfsoc.c | 14 ++------------ hw/riscv/sifive_u.c | 7 +------ 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/hw/riscv/microchip_pfsoc.c b/hw/riscv/microchip_pfsoc.c index b775aa8946..7725dfbde5 100644 --- a/hw/riscv/microchip_pfsoc.c +++ b/hw/riscv/microchip_pfsoc.c @@ -202,7 +202,6 @@ static void microchip_pfsoc_soc_realize(DeviceState *de= v, Error **errp) MemoryRegion *envm_data =3D g_new(MemoryRegion, 1); MemoryRegion *qspi_xip_mem =3D g_new(MemoryRegion, 1); char *plic_hart_config; - NICInfo *nd; int i; =20 sysbus_realize(SYS_BUS_DEVICE(&s->e_cpus), &error_abort); @@ -411,17 +410,8 @@ static void microchip_pfsoc_soc_realize(DeviceState *d= ev, Error **errp) memmap[MICROCHIP_PFSOC_USB].size); =20 /* GEMs */ - - nd =3D &nd_table[0]; - if (nd->used) { - qemu_check_nic_model(nd, TYPE_CADENCE_GEM); - qdev_set_nic_properties(DEVICE(&s->gem0), nd); - } - nd =3D &nd_table[1]; - if (nd->used) { - qemu_check_nic_model(nd, TYPE_CADENCE_GEM); - qdev_set_nic_properties(DEVICE(&s->gem1), nd); - } + qemu_configure_nic_device(DEVICE(&s->gem0), true, NULL); + qemu_configure_nic_device(DEVICE(&s->gem1), true, NULL); =20 object_property_set_int(OBJECT(&s->gem0), "revision", GEM_REVISION, er= rp); object_property_set_int(OBJECT(&s->gem0), "phy-addr", 8, errp); diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index ec76dce6c9..5207ec1fa5 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -789,7 +789,6 @@ static void sifive_u_soc_realize(DeviceState *dev, Erro= r **errp) MemoryRegion *l2lim_mem =3D g_new(MemoryRegion, 1); char *plic_hart_config; int i, j; - NICInfo *nd =3D &nd_table[0]; =20 qdev_prop_set_uint32(DEVICE(&s->u_cpus), "num-harts", ms->smp.cpus - 1= ); qdev_prop_set_uint32(DEVICE(&s->u_cpus), "hartid-base", 1); @@ -893,11 +892,7 @@ static void sifive_u_soc_realize(DeviceState *dev, Err= or **errp) } sysbus_mmio_map(SYS_BUS_DEVICE(&s->otp), 0, memmap[SIFIVE_U_DEV_OTP].b= ase); =20 - /* FIXME use qdev NIC properties instead of nd_table[] */ - if (nd->used) { - qemu_check_nic_model(nd, TYPE_CADENCE_GEM); - qdev_set_nic_properties(DEVICE(&s->gem), nd); - } + qemu_configure_nic_device(DEVICE(&s->gem), true, NULL); object_property_set_int(OBJECT(&s->gem), "revision", GEM_REVISION, &error_abort); if (!sysbus_realize(SYS_BUS_DEVICE(&s->gem), errp)) { --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170680684463320.75710869425984; Thu, 1 Feb 2024 09:00:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaDR-0006P4-B8; Thu, 01 Feb 2024 11:47:07 -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 1rVaB7-0002xi-44 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:41 -0500 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAv-0002Ud-2B for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:40 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAh-00000009cMN-1pv8 for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:15 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003IOg-3GaH for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=OcUPxqWmRn2W/vBLc1vAUxfRYXil4peX6g1xYhANngU=; b=YB5FdLaVXMAp71+NowjXjAty7x b6NT5HuscTzgh6sC6DXXw8sbcCagEDEeRsn8RybNb4+bOFlPLgXXA5J+hcXaSrQ+uIfwb9c9+PpnY /JNnFnd4pLNbEbzxW66YYFdDj5oxwauR1pd/jDHGi+VWHCWNra7696keIaXbJm9clVlXhoPweHHAf dR4x1FC9MbDl0vMn8yxODNTF7gfq8TQI87CImZw/XrCz1mcZQ54wu4CpZ9ip4taJ8RBSMMlDQHFuk twvdeNIXWQ7VsooW2oEMiS10m/mvr8C6xivP+M/hyUY9BiSMLZpDQZ8mP3YiZ+ueAk2RnhlbbPGsq /UVEF6Bw==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 41/47] hw/s390x/s390-virtio-ccw: use qemu_create_nic_device() Date: Thu, 1 Feb 2024 16:44:06 +0000 Message-ID: <20240201164412.785520-42-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; envelope-from=BATV+1220c4869a9b484313cc+7466+infradead.org+dwmw2@desiato.srs.infradead.org; helo=desiato.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806845630100001 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Signed-off-by: David Woodhouse Acked-by: Thomas Huth --- hw/s390x/s390-virtio-ccw.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index c99682b07d..62804cc228 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -229,16 +229,9 @@ static void s390_init_ipl_dev(const char *kernel_filen= ame, =20 static void s390_create_virtio_net(BusState *bus, const char *name) { - int i; - - for (i =3D 0; i < nb_nics; i++) { - NICInfo *nd =3D &nd_table[i]; - DeviceState *dev; - - qemu_check_nic_model(nd, "virtio"); + DeviceState *dev; =20 - dev =3D qdev_new(name); - qdev_set_nic_properties(dev, nd); + while ((dev =3D qemu_create_nic_device(name, true, "virtio"))) { qdev_realize_and_unref(dev, bus, &error_fatal); } } --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806758251123.82707111864329; Thu, 1 Feb 2024 08:59:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaDj-0006uv-BS; Thu, 01 Feb 2024 11:47:25 -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 1rVaB8-0002yb-KF for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:42 -0500 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAv-0002Un-Kg for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:42 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAh-00000009cMO-1xPm for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:15 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003IOk-3MmN for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=mAI+pje2IHyDnEouIzhJkV5N4vbFYGUKvrHpNRj8FXs=; b=ACY4qryZhdhbHuCgN8/n7fxAWV g0QsS9zRc3wLPr0VPfoAOD/D+HIW/kVFo9fYURufojC0SpFdroAtedsZd2T5kmFUa1X+ylgU1l0Ob XqUc1aPynHJL7xsodGvJvjdGcLgFbm7+B45BaPk7XwZgszwqib9QBGz7BK7HnW/65IUmAfSUTpZGm 7pKA0pr1H5e74ynHkD9dhOrVz4OHtyIoMUO2FB70jXEfv5YjlhHEW/+ut+o/1Rb8w2X/dAv5wBEMu I2YAAF6EvdkmbtJRK1WuOKsaIfW17Ax9EjqzvYjSFC+3VM6srFi/+Ynitt0bnI+qc/MyH+bvAsadQ JCJRXLeQ==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 42/47] hw/sparc/sun4m: use qemu_find_nic_info() Date: Thu, 1 Feb 2024 16:44:07 +0000 Message-ID: <20240201164412.785520-43-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; envelope-from=BATV+1220c4869a9b484313cc+7466+infradead.org+dwmw2@desiato.srs.infradead.org; helo=desiato.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806759224100012 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Obtain the MAC address from the NIC configuration if there is one, or generate one explicitly so that it can be placed in the PROM. Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/sparc/sun4m.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 550af01690..e782c8ec7a 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -299,13 +299,15 @@ static void *iommu_init(hwaddr addr, uint32_t version= , qemu_irq irq) =20 static void *sparc32_dma_init(hwaddr dma_base, hwaddr esp_base, qemu_irq espdma_irq, - hwaddr le_base, qemu_irq ledma_irq, NICInfo = *nd) + hwaddr le_base, qemu_irq ledma_irq, + MACAddr *mac) { DeviceState *dma; ESPDMADeviceState *espdma; LEDMADeviceState *ledma; SysBusESPState *esp; SysBusPCNetState *lance; + NICInfo *nd =3D qemu_find_nic_info("lance", true, NULL); =20 dma =3D qdev_new(TYPE_SPARC32_DMA); espdma =3D SPARC32_ESPDMA_DEVICE(object_resolve_path_component( @@ -320,7 +322,14 @@ static void *sparc32_dma_init(hwaddr dma_base, =20 lance =3D SYSBUS_PCNET(object_resolve_path_component( OBJECT(ledma), "lance")); - qdev_set_nic_properties(DEVICE(lance), nd); + + if (nd) { + qdev_set_nic_properties(DEVICE(lance), nd); + memcpy(mac->a, nd->macaddr.a, sizeof(mac->a)); + } else { + qemu_macaddr_default_if_unset(mac); + qdev_prop_set_macaddr(DEVICE(lance), "mac", mac->a); + } =20 sysbus_realize_and_unref(SYS_BUS_DEVICE(dma), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dma), 0, dma_base); @@ -823,7 +832,7 @@ static void sun4m_hw_init(MachineState *machine) unsigned int smp_cpus =3D machine->smp.cpus; unsigned int max_cpus =3D machine->smp.max_cpus; HostMemoryBackend *ram_memdev =3D machine->memdev; - NICInfo *nd =3D &nd_table[0]; + MACAddr hostid; =20 if (machine->ram_size > hwdef->max_mem) { error_report("Too much memory for this machine: %" PRId64 "," @@ -884,10 +893,9 @@ static void sun4m_hw_init(MachineState *machine) hwdef->iommu_pad_base, hwdef->iommu_pad_len); } =20 - qemu_check_nic_model(nd, TYPE_LANCE); sparc32_dma_init(hwdef->dma_base, hwdef->esp_base, slavio_irq[18], - hwdef->le_base, slavio_irq[16], nd); + hwdef->le_base, slavio_irq[16], &hostid); =20 if (graphic_depth !=3D 8 && graphic_depth !=3D 24) { error_report("Unsupported depth: %d", graphic_depth); @@ -1039,7 +1047,7 @@ static void sun4m_hw_init(MachineState *machine) machine->initrd_filename, machine->ram_size, &initrd_size); =20 - nvram_init(nvram, (uint8_t *)&nd->macaddr, machine->kernel_cmdline, + nvram_init(nvram, hostid.a, machine->kernel_cmdline, machine->boot_config.order, machine->ram_size, kernel_size, graphic_width, graphic_height, graphic_depth, hwdef->nvram_machine_id, "Sun4m"); --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806901371941.2081765191494; Thu, 1 Feb 2024 09:01:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaD5-0005Ms-NJ; Thu, 01 Feb 2024 11:46:43 -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 1rVaB2-0002v7-Vp for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:37 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAt-0002Ts-RX for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:36 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-0000000GIdo-3E7W for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:15 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003IOo-3SlE for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=mX/hl3L+uzP16qDkLnKIjlw9AZT6Th7nY6ik791ai64=; b=KeAFudZpNkpdLQhrbPEchfbIzn cj5W54SNpt/VZF5MMo6prJlIJgIl8Kcht8oD5KDcUE41ZKfs0yDfmzVxxwQc6uqmIGwYLOxx+KJqR D9D+THyPneXQaSQc2yxDi3J0J7jA6Avmfz6/Q2DDyzNYfx7E8YdhdVquQzdYbXxDKvYJJheoWSn4e KjEBp8xt5fH8RqUpIabgG2wgfptt/2jqezX4aQapW9YQqn0HzC4L6gWRSSm1xGoFsnz/g4VXANAJo d/bxCoovG2Lg7JgifVz960uusavMY8biHFVVlXO4UJhKY88BScXwh2k4EWWWcenfYmk07+vkOyyBy gF71dMvg==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 43/47] hw/xtensa/xtfpga: use qemu_create_nic_device() Date: Thu, 1 Feb 2024 16:44:08 +0000 Message-ID: <20240201164412.785520-44-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806901919100001 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/xtensa/xtfpga.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index fbad1c83a3..f49e6591dc 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -141,14 +141,16 @@ static void xtfpga_net_init(MemoryRegion *address_spa= ce, hwaddr base, hwaddr descriptors, hwaddr buffers, - qemu_irq irq, NICInfo *nd) + qemu_irq irq) { DeviceState *dev; SysBusDevice *s; MemoryRegion *ram; =20 - dev =3D qdev_new("open_eth"); - qdev_set_nic_properties(dev, nd); + dev =3D qemu_create_nic_device("open_eth", true, NULL); + if (!dev) { + return; + } =20 s =3D SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(s, &error_fatal); @@ -301,10 +303,7 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, = MachineState *machine) memory_region_add_subregion(system_memory, board->io[1], io); } xtfpga_fpga_init(system_io, 0x0d020000, freq); - if (nd_table[0].used) { - xtfpga_net_init(system_io, 0x0d030000, 0x0d030400, 0x0d800000, - extints[1], nd_table); - } + xtfpga_net_init(system_io, 0x0d030000, 0x0d030400, 0x0d800000, extints= [1]); =20 serial_mm_init(system_io, 0x0d050020, 2, extints[0], 115200, serial_hd(0), DEVICE_NATIVE_ENDIAN); --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706805958878397.88519697913125; Thu, 1 Feb 2024 08:45:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaB5-0002vM-VH; Thu, 01 Feb 2024 11:44:40 -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 1rVaAq-0002qk-Tw for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:25 -0500 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAm-0002U1-9u for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:23 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAh-00000009cMP-1qSw for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:15 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003IOs-3Ygv for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=bWvWof/1cmcc1j4iR+WvmK21dtpKtWiHn2Gmk5c5D+g=; b=VUnPwvHEyNOBgqxJMYIf/eC+QF EUrvA3SmO+CPVnw6i0BKegDC63H4tk76q9kq/7PvPZLubieq7VP/vzQeN7kEe72s0Uhet0REyGXzp jIHGtK0+5FSBA/wCLEqtcyWlGv+Id4iqhqifmnTnIDDT50/DJVl4KymmhZMlrOw8MtIYee4TSXc1v siKdGDQemduNxuAWX4TcNkaCAsINPd/9/Paa/V1W6JNuztTsOYxNd1qs3NJTGoQEA55XKURqBXSNg stVYhdwGucYiOQU+hCir6POp7NFrrCaZFXaU+EOHvhCVOI+uwh6wYdURtIpLE5zIdoIzeioTiC+Zm 2ayKhZ6A==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 44/47] net: remove qemu_check_nic_model() Date: Thu, 1 Feb 2024 16:44:09 +0000 Message-ID: <20240201164412.785520-45-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; envelope-from=BATV+1220c4869a9b484313cc+7466+infradead.org+dwmw2@desiato.srs.infradead.org; helo=desiato.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706805960510100003 Content-Type: text/plain; charset="utf-8" From: David Woodhouse There are no callers of this function any more, as they have all been converted to qemu_{create,configure}_nic_device(). Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- include/net/net.h | 1 - net/net.c | 13 ------------- 2 files changed, 14 deletions(-) diff --git a/include/net/net.h b/include/net/net.h index 728ca965af..00ee1af7ab 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -204,7 +204,6 @@ int qemu_set_vnet_le(NetClientState *nc, bool is_le); int qemu_set_vnet_be(NetClientState *nc, bool is_be); void qemu_macaddr_default_if_unset(MACAddr *macaddr); int qemu_show_nic_models(const char *arg, const char *const *models); -void qemu_check_nic_model(NICInfo *nd, const char *model); int qemu_find_nic_model(NICInfo *nd, const char * const *models, const char *default_model); /** diff --git a/net/net.c b/net/net.c index 4651b3f443..ffd4b42d5a 100644 --- a/net/net.c +++ b/net/net.c @@ -992,19 +992,6 @@ int qemu_show_nic_models(const char *arg, const char *= const *models) return 1; } =20 -void qemu_check_nic_model(NICInfo *nd, const char *model) -{ - const char *models[2]; - - models[0] =3D model; - models[1] =3D NULL; - - if (qemu_show_nic_models(nd->model, models)) - exit(0); - if (qemu_find_nic_model(nd, models, model) < 0) - exit(1); -} - int qemu_find_nic_model(NICInfo *nd, const char * const *models, const char *default_model) { --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170680611769635.2048855884517; Thu, 1 Feb 2024 08:48:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaAw-0002s9-Ap; Thu, 01 Feb 2024 11:44:30 -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 1rVaAl-0002pX-Tp for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:20 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAj-0002Tn-GK for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:19 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-0000000GIdr-39Mn for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:15 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003IOx-3eXV for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=q/lRu96lP+9hig2DfITdw70Fa08pfxR/d1NeEVgyLNY=; b=DvayeRybb7sOVjJOO2Pg7YOk7y hC+0U7o2k84rqdJG72vlIoNYBppBOqWb8li0qkb5zeaR694yGJEPlmOsp4oWj6zNLLBROTzngtExn vzjWtRglViR7pij5/+BFyPiylqSCP1sPPwRMUloxAuuAJeI8j6vvjgjguMEGfiTwFsaF8KIQ+HAZQ x7mpJHV3UfH1mOdiGerhFRQXc71jGWBxV9dwB73FRuJVpXKOAG5M1Dw998kM23hVCpXuhIxYkxqXz UYzzIy0lXdYb9sSBIwp3ML0UcJeROJmpUm9Kog/u+uHVD5YghnK1fTgtiMKFM9MxynZXX/gDaTMwx BwwZLLNQ==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 45/47] hw/pci: remove pci_nic_init_nofail() Date: Thu, 1 Feb 2024 16:44:10 +0000 Message-ID: <20240201164412.785520-46-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806119168100011 Content-Type: text/plain; charset="utf-8" From: David Woodhouse This function is no longer used, as all its callers have been converted to use pci_init_nic_devices() instead. Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/pci/pci.c | 72 -------------------------------------------- include/hw/pci/pci.h | 3 -- 2 files changed, 75 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 5849606f66..449abfb182 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1853,78 +1853,6 @@ const pci_class_desc *get_class_desc(int class) return desc; } =20 -/* Initialize a PCI NIC. */ -PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus, - const char *default_model, - const char *default_devaddr) -{ - const char *devaddr =3D nd->devaddr ? nd->devaddr : default_devaddr; - GPtrArray *pci_nic_models; - PCIBus *bus; - PCIDevice *pci_dev; - DeviceState *dev; - int devfn; - int i; - int dom, busnr; - unsigned slot; - - if (nd->model && !strcmp(nd->model, "virtio")) { - g_free(nd->model); - nd->model =3D g_strdup("virtio-net-pci"); - } - - pci_nic_models =3D qemu_get_nic_models(TYPE_PCI_DEVICE); - - if (qemu_show_nic_models(nd->model, (const char **)pci_nic_models->pda= ta)) { - exit(0); - } - - i =3D qemu_find_nic_model(nd, (const char **)pci_nic_models->pdata, - default_model); - if (i < 0) { - exit(1); - } - - if (!rootbus) { - error_report("No primary PCI bus"); - exit(1); - } - - assert(!rootbus->parent_dev); - - if (!devaddr) { - devfn =3D -1; - busnr =3D 0; - } else { - if (pci_parse_devaddr(devaddr, &dom, &busnr, &slot, NULL) < 0) { - error_report("Invalid PCI device address %s for device %s", - devaddr, nd->model); - exit(1); - } - - if (dom !=3D 0) { - error_report("No support for non-zero PCI domains"); - exit(1); - } - - devfn =3D PCI_DEVFN(slot, 0); - } - - bus =3D pci_find_bus_nr(rootbus, busnr); - if (!bus) { - error_report("Invalid PCI device address %s for device %s", - devaddr, nd->model); - exit(1); - } - - pci_dev =3D pci_new(devfn, nd->model); - dev =3D &pci_dev->qdev; - qdev_set_nic_properties(dev, nd); - pci_realize_and_unref(pci_dev, bus, &error_fatal); - g_ptr_array_free(pci_nic_models, true); - return pci_dev; -} - void pci_init_nic_devices(PCIBus *bus, const char *default_model) { qemu_create_nic_bus_devices(&bus->qbus, TYPE_PCI_DEVICE, default_model, diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 6ff0b95a02..eaa3fc99d8 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -314,9 +314,6 @@ void pci_device_set_intx_routing_notifier(PCIDevice *de= v, PCIINTxRoutingNotifier notifier); void pci_device_reset(PCIDevice *dev); =20 -PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus, - const char *default_model, - const char *default_devaddr); void pci_init_nic_devices(PCIBus *bus, const char *default_model); bool pci_init_nic_in_slot(PCIBus *rootbus, const char *default_model, const char *alias, const char *devaddr); --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806758006463.49796103281756; Thu, 1 Feb 2024 08:59:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaDy-0007o2-TA; Thu, 01 Feb 2024 11:47:39 -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 1rVaB5-0002wE-Fa for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:39 -0500 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAu-0002V1-Mc for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:39 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAh-00000009cMQ-1wQe for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:15 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003IP1-3k3W for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=Tq1LmBh+MmuhiCak6nrzlmMj512p18L5BwdUzqW/HzI=; b=SYkgSu89QcvLc653lXLhzKzzG2 NQ2rZW4l0JGzAfTHkVHzlV5tJCVq/lD+p+QYtkiaCipHYa4azvZhYyJWdpQEcZtJz3WaNntTPPqGl MZXlQxadRumaR5aeflF3UeCuOO8HgMN5T3VvbKH67bVKj8Cj0yHctUDrbTVvUifcTdqe4LwbNe8aH PJFEb+A/2LJMDNQUWyJ/0b8rIKpQccyCsPNa3g0FousN2sfdqgabBTz0kLNLSTfTdh6ng3ukx6lHb cTpc4hUnahKkvwlO4rDzIT+EVHwcqTlAhrbBhpjR5KTk6tgErNr3IItkzDR3ux8SUmHRDD5KGBr5+ EwsXbrCg==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 46/47] net: remove qemu_show_nic_models(), qemu_find_nic_model() Date: Thu, 1 Feb 2024 16:44:11 +0000 Message-ID: <20240201164412.785520-47-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; envelope-from=BATV+1220c4869a9b484313cc+7466+infradead.org+dwmw2@desiato.srs.infradead.org; helo=desiato.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806759213100008 Content-Type: text/plain; charset="utf-8" From: David Woodhouse These old functions can be removed now too. Let net_param_nic() print the full set of network devices directly, and also make it note that a list more specific to this platform/config will be available by using '-nic model=3Dhelp' instead. Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- include/net/net.h | 3 --- net/net.c | 39 ++++++--------------------------------- 2 files changed, 6 insertions(+), 36 deletions(-) diff --git a/include/net/net.h b/include/net/net.h index 00ee1af7ab..588ee55f28 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -203,9 +203,6 @@ void qemu_set_vnet_hdr_len(NetClientState *nc, int len); int qemu_set_vnet_le(NetClientState *nc, bool is_le); int qemu_set_vnet_be(NetClientState *nc, bool is_be); void qemu_macaddr_default_if_unset(MACAddr *macaddr); -int qemu_show_nic_models(const char *arg, const char *const *models); -int qemu_find_nic_model(NICInfo *nd, const char * const *models, - const char *default_model); /** * qemu_find_nic_info: Obtain NIC configuration information * @typename: Name of device object type diff --git a/net/net.c b/net/net.c index ffd4b42d5a..d705e9b0fd 100644 --- a/net/net.c +++ b/net/net.c @@ -977,38 +977,6 @@ GPtrArray *qemu_get_nic_models(const char *device_type) return nic_models; } =20 -int qemu_show_nic_models(const char *arg, const char *const *models) -{ - int i; - - if (!arg || !is_help_option(arg)) { - return 0; - } - - printf("Available NIC models:\n"); - for (i =3D 0 ; models[i]; i++) { - printf("%s\n", models[i]); - } - return 1; -} - -int qemu_find_nic_model(NICInfo *nd, const char * const *models, - const char *default_model) -{ - int i; - - if (!nd->model) - nd->model =3D g_strdup(default_model); - - for (i =3D 0 ; models[i]; i++) { - if (strcmp(nd->model, models[i]) =3D=3D 0) - return i; - } - - error_report("Unsupported NIC model: %s", nd->model); - return -1; -} - static int net_init_nic(const Netdev *netdev, const char *name, NetClientState *peer, Error **errp) { @@ -1791,9 +1759,14 @@ static int net_param_nic(void *dummy, QemuOpts *opts= , Error **errp) } if (is_help_option(type)) { GPtrArray *nic_models =3D qemu_get_nic_models(TYPE_DEVICE); + int i; show_netdevs(); printf("\n"); - qemu_show_nic_models(type, (const char **)nic_models->pdata); + printf("Available NIC models " + "(use -nic model=3Dhelp for a filtered list):\n"); + for (i =3D 0 ; nic_models->pdata[i]; i++) { + printf("%s\n", (char *)nic_models->pdata[i]); + } g_ptr_array_free(nic_models, true); exit(0); } --=20 2.43.0 From nobody Tue Nov 26 12:48:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706806012814900.6936694793379; Thu, 1 Feb 2024 08:46:52 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVaBg-0003Qj-Bz; Thu, 01 Feb 2024 11:45:18 -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 1rVaB5-0002wD-Dn for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:39 -0500 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVaAu-0002Tr-LZ for qemu-devel@nongnu.org; Thu, 01 Feb 2024 11:44:38 -0500 Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAf-0000000GIdt-3p4J for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:15 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVaAg-00000003IP6-3ppq for qemu-devel@nongnu.org; Thu, 01 Feb 2024 16:44:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description; bh=mMqmzYHdP9y/z29knSdyyl/j1smIAiKPsHboaiDoM8A=; b=NF+mzlBi2DUXjLUWt2oYxQ5rNg fth1fWhQUWyxt2PZmJuQ1ufN6827/piC0i8d/6HReljxKQVkfpxzPcctqdUHGK+Jwz2F0gHyiHn4k kdSqnWLIEX+Dz9ps2/tBxmu7y0ZhAbhIyBCrDAJWDnwXPx6UdclCe3kWaykmnMnsWGcua1jomAykM JX9f2eRCPG+WYcJniqroBmwoE1hUIXO4jvAYFGfwQPrzA06pZDhoxyIYLudDObUSFAMQJO0MBcnS1 zgtvsmz+KsR9FGlJmyTsntPapzQCG0dnmuMUkYs3hq8rAczC6H8V7OrCoviQt0tcjv4GKgJqCDwqQ Ijwf66rQ==; From: David Woodhouse To: qemu-devel@nongnu.org Subject: [PULL 47/47] net: make nb_nics and nd_table[] static in net/net.c Date: Thu, 1 Feb 2024 16:44:12 +0000 Message-ID: <20240201164412.785520-48-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org> References: <20240201164412.785520-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+16c2638fe4346fda554c+7466+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1706806014846100003 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Also remove the stale declaration of host_net_devices; the actual definition was removed long ago in commit 7cc28cb06104 ("net: Remove the deprecated 'host_net_add' and 'host_net_remove' HMP commands") Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- include/net/net.h | 4 ---- net/net.c | 3 +++ system/globals.c | 2 -- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/include/net/net.h b/include/net/net.h index 588ee55f28..b1f9b35fcc 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -301,10 +301,6 @@ struct NICInfo { int nvectors; }; =20 -extern int nb_nics; -extern NICInfo nd_table[MAX_NICS]; -extern const char *host_net_devices[]; - /* from net.c */ extern NetClientStateList net_clients; bool netdev_is_modern(const char *optstr); diff --git a/net/net.c b/net/net.c index d705e9b0fd..a2f0c828bb 100644 --- a/net/net.c +++ b/net/net.c @@ -77,6 +77,9 @@ static NetdevQueue nd_queue =3D QSIMPLEQ_HEAD_INITIALIZER= (nd_queue); =20 static GHashTable *nic_model_help; =20 +static int nb_nics; +static NICInfo nd_table[MAX_NICS]; + /***********************************************************/ /* network device redirectors */ =20 diff --git a/system/globals.c b/system/globals.c index e83b5428d1..b6d4e72530 100644 --- a/system/globals.c +++ b/system/globals.c @@ -36,8 +36,6 @@ int display_opengl; const char* keyboard_layout; bool enable_mlock; bool enable_cpu_pm; -int nb_nics; -NICInfo nd_table[MAX_NICS]; int autostart =3D 1; int vga_interface_type =3D VGA_NONE; bool vga_interface_created; --=20 2.43.0