From patchwork Wed May 24 12:25:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 685342 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp219475wrt; Wed, 24 May 2023 05:26:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5GMM3alEzVZOOHa2jIPErlklcBEWhcTL/w0rGmZS4/OlkqEQXLXMlR9Wg2nJ1aNjXdMLsh X-Received: by 2002:a05:622a:a:b0:3f5:1865:8d1 with SMTP id x10-20020a05622a000a00b003f5186508d1mr26314575qtw.59.1684931192365; Wed, 24 May 2023 05:26:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684931192; cv=none; d=google.com; s=arc-20160816; b=px1O0vI18zU1+mTmiERGVkoY4niXzWHhS4+sQ3zNx17jpz7wWPoR2i6wNRyPkUKah8 65PnzHqc31RJ6+vaZ5ohVSMkQNte7edF+ZPPfaJLCR192emkZbDg2ZURl3xrtP5s6ft2 kP+rOrCWtAlK53XwJ/Vmy62tyrPwngh9aXQ//koF0haFieHiGjVwy/9/RwwDhbwIiLY4 fmlvui3fKSaIfjLaxQ0mI2A9sciest+MSzLT0ucoUauR8pOw4VPDtjaHrLsble4Fg95G 2hPo+USxCo5wwBfPL0jrdbnJYtR0DQTjHCi45qomCH88puaALS/XLu8kztpmIliHAX0Z Dj8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=Wh4OJkoX4lxoEYI9VN4kdX8ETxqPDRRE/Wr3N220VXM=; b=Ij/bF5uDkN4pfVSxtMVLJstzPcdfpgcYgXXnaqcY83Gi2rHJPrfb4VE/Ek9goVlbiZ Fz6NHnrCqFsrEArABZnCvBFRmvDRGglMZBknT94RP/jRsaAO1tVY6/GbjXSw1jED6yWw M2jQ6/3VW3QJVa+453zZv3JXfI4ZupN632MDqk2uTgcwzIIc8PNYfiKHDGj6XHYlNIwa Lo+kVi+LZR8Qch+zB1dh0h5XVSohE/gjcm6MrghwBtdekQLeQW2mBgAsKR6sgWm6BVV6 kY9ajv486OZAqh+NnjmHnMoiY3KKIQ3bw8JXWy378VjvkObs85iiMhsvJvRqN+kiV+kd RF5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h9Yn8NLy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j7-20020ac85f87000000b003ef3aa3a380si6588732qta.798.2023.05.24.05.26.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 May 2023 05:26:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h9Yn8NLy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q1nZD-0004iS-UB; Wed, 24 May 2023 08:26:11 -0400 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 1q1nZC-0004iI-7D for qemu-devel@nongnu.org; Wed, 24 May 2023 08:26:10 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1nZ7-00016s-7R for qemu-devel@nongnu.org; Wed, 24 May 2023 08:26:09 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-30959c0dfd6so735432f8f.3 for ; Wed, 24 May 2023 05:26:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684931162; x=1687523162; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Wh4OJkoX4lxoEYI9VN4kdX8ETxqPDRRE/Wr3N220VXM=; b=h9Yn8NLyZRsmea/M0g0+T381Pw3o8KykUXtzY68ZK9x5+wuD8c6gCEYpmSzUEbB/rY +VyNJo74T9eFbmi9pTIAwDl+zXLQl0Pv2YK2LaoJpFO7pZrIm5XObpO6B3spP4pota/+ 0f4LGPwrbVONMsdIz7b6yyZEjO9pTmCK5C8HE8WwTx7ZkYhIpsmbxkTRj0dSYcuPbsoE Rfn+SyGV5eOj+uf5Z+UYCIsrAVGmxKimW5TEnqAvtS2iUuJMTGDCt9Jnd85BEV84LaRg rQandSNX940eY+18zk6DKSkU1rsiX8A9bcemhGE5DQASlTjfJikjChs5XvtBrUfiljy2 b7Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684931162; x=1687523162; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Wh4OJkoX4lxoEYI9VN4kdX8ETxqPDRRE/Wr3N220VXM=; b=dFO8lkQ76GiIyWjg+HfiHbbdqmx28Qt0xh3jWzyjFt1SV4aHDkv9toezut8/7Ijlwp mkE4Z3V65bsZIJZc6LSlwhc+XITwZl0WA4ryf3/356YW3cq7NlOFhva4aDWmCX4eC8YN rEATDxd8GpeaTD1CZqx7EuEUZjDKoTvrAt74eS6TZjEHayYOS+r8Lm+IUwe62zV+jFD7 SzERAfi+OwubTP3bXifp0GQ1IriFzwJIR6/VTzcl4qnogQ4EybFKjQaugAPDKUqvJJeI ehRkNeCAHt6yxKDC6G4EnNwPpNkFv1WNwRhmeQyJ5ZHYbDhg5Oi/Xal0KmsJV4Y3s87W FIjA== X-Gm-Message-State: AC+VfDyhNZcYgwEb5Z2S0vG6rIOIPqLXwoc+EEteW8zzD1AqwTs77Ke0 21mgHtivIw4R+f0kP+ntTfhK/xM35+wXA3MRFI63Iw== X-Received: by 2002:adf:ee44:0:b0:309:421a:192c with SMTP id w4-20020adfee44000000b00309421a192cmr11599720wro.7.1684931162066; Wed, 24 May 2023 05:26:02 -0700 (PDT) Received: from localhost.localdomain (fac34-h02-176-184-31-246.dsl.sta.abo.bbox.fr. [176.184.31.246]) by smtp.gmail.com with ESMTPSA id m4-20020a5d56c4000000b003062d815fa6sm14302536wrw.85.2023.05.24.05.26.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 May 2023 05:26:01 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Huacai Chen , Thomas Huth Subject: [PATCH] hw/mips: Use MachineClass->default_nic in the virt machine Date: Wed, 24 May 2023 14:25:59 +0200 Message-Id: <20230524122559.28863-1-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Mark the default NIC via the new MachineClass->default_nic setting so that the machine-defaults code in vl.c can decide whether the default NIC is usable or not (for example when compiling with the "--without-default-devices" configure switch). Inspired-by: Thomas Huth Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth --- Based-on: <20230523110435.1375774-1-thuth@redhat.com> --- hw/mips/loongson3_virt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c index 25534288dd..216812f660 100644 --- a/hw/mips/loongson3_virt.c +++ b/hw/mips/loongson3_virt.c @@ -406,6 +406,7 @@ static inline void loongson3_virt_devices_init(MachineState *machine, PCIBus *pci_bus; DeviceState *dev; MemoryRegion *mmio_reg, *ecam_reg; + MachineClass *mc = MACHINE_GET_CLASS(machine); LoongsonMachineState *s = LOONGSON_MACHINE(machine); dev = qdev_new(TYPE_GPEX_HOST); @@ -456,7 +457,7 @@ static inline void loongson3_virt_devices_init(MachineState *machine, NICInfo *nd = &nd_table[i]; if (!nd->model) { - nd->model = g_strdup("virtio"); + nd->model = g_strdup(mc->default_nic); } pci_nic_init_nofail(nd, pci_bus, nd->model, NULL); @@ -619,6 +620,7 @@ static void loongson3v_machine_class_init(ObjectClass *oc, void *data) mc->default_ram_size = 1600 * MiB; mc->kvm_type = mips_kvm_type; mc->minimum_page_bits = 14; + mc->default_nic = "virtio-net-pci"; } static const TypeInfo loongson3_machine_types[] = {