From nobody Sat Oct 25 08:50:07 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520365846185677.1159165427453; Tue, 6 Mar 2018 11:50:46 -0800 (PST) Received: from localhost ([::1]:57813 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etIbc-0000jn-Ra for importer@patchew.org; Tue, 06 Mar 2018 14:50:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59365) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etIXJ-00069C-5d for qemu-devel@nongnu.org; Tue, 06 Mar 2018 14:46:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etIXI-0001a7-1X for qemu-devel@nongnu.org; Tue, 06 Mar 2018 14:46:09 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:33250) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1etIXH-0001Zg-OU for qemu-devel@nongnu.org; Tue, 06 Mar 2018 14:46:07 -0500 Received: by mail-wr0-x244.google.com with SMTP id v18so21522640wrv.0 for ; Tue, 06 Mar 2018 11:46:07 -0800 (PST) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id f206sm2104942wmf.26.2018.03.06.11.46.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Mar 2018 11:46:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=AYECD8fH0OKWxEFOYOjMOw9SdKW8UFUmS07fmMWWiBM=; b=rQhc0wRNJEha+Mbn+S8AAuCgwOaF8on0TcZ9TtjCjCNWLsJOygXvTb8hUuHOmgxLNS 429T1qcfhCb/08p4sUJ6cmZAw+9yzF6RvrM2d2Wm0pc9IaY7synEnyUSBO3SYjxAe8OV INydPa1MHeaGHHk7DOM63ybna/enwU2atune8u1AG8AtAC1X3kTcCD/Eoz7VPYPzzPov vTiAnbKmqtzUjg0FjG3xVj+SwwyrJm+FS3uk1p9uLXRCE95KDlNk1dbeZiCsXSI+OhIK 147vkuCqoY5AsN9PuFWnv3gWWrG5SeAbPhlr3eqygly6GY9MFr+hK5/uYgCLnRW3Dvdj 5+3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=AYECD8fH0OKWxEFOYOjMOw9SdKW8UFUmS07fmMWWiBM=; b=fqqXcRhGIedaWdKmwKkqJyJWqlbZN46wwc7ORDiHvpHRJjgMEuD3CiuExjPFesMw0H u5Ldd2hFViH0fJzBK/PFxTLPKwQ74JTnx6qdp7ZQ2YZtn7mrsrWen/bH6ZMUiEZ8bJJJ OL2piLJkblMw1rffqnSF7Gf/s7B1lUio/GRwcAIlSEjg/EKIdEy2Meml48X3X90dvQTZ bpV7i40901tcKLTTSzT53NShkweuRyy0edglBqaFAgQuIVeBn1tTcnimd5H7bpW5DmLa 5qQUMck9lIpf1UviFAXI0Kt2SyRmVyUw/sPQ9pyp6EnsRoQCUPu+KvQ3+INQDXofAhQf 3sNQ== X-Gm-Message-State: APf1xPBju07geCDZFNMF3KNPMP8Hq0Twcbh+uPY4jLSRx9xk4LY492q/ HBRbxOGuQpJf91pPWc6XMKF2bhCt X-Google-Smtp-Source: AG47ELs94ogaajaEyEY/3jZsZS2Xq5LdGE2vBehtd1irg5niM5AW9SrZ8pm12S0jCcW08KGL3AC6CQ== X-Received: by 10.223.136.56 with SMTP id d53mr16391274wrd.17.1520365566203; Tue, 06 Mar 2018 11:46:06 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 6 Mar 2018 20:46:00 +0100 Message-Id: <20180306194600.9650-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180306194600.9650-1-pbonzini@redhat.com> References: <20180306194600.9650-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PATCH 3/3] q35: change default NIC to e1000e X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Wang , Thomas Huth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The e1000 NIC is getting old and is not a very good default for a PCIe machine type. Change it to e1000e, which should be supported by a good number of guests. In particular, drivers for 82574 were added first to Linux 2.6.27 (2008) and Windows 2008 R2. This does mean that Windows 2008 will not work anymore with Q35 machine types and a default "-net nic -net xxx" network configuration; it did work before because it does have an AHCI driver. However, Windows 2008 has been declared out of main stream support in 2015. It will get out of extended support in 2020. Windows 2008 R2 has the same end of support dates and, since the two are basically Vista vs. Windows 7, R2 probably is more popular. Cc: Jason Wang Cc: Thomas Huth Signed-off-by: Paolo Bonzini --- hw/i386/pc.c | 7 ++++--- hw/i386/pc_piix.c | 6 +++++- hw/i386/pc_q35.c | 8 +++++++- hw/pci/pci.c | 2 +- include/hw/i386/pc.h | 3 ++- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 35fcb6efdf..d3e1d50b59 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1619,18 +1619,19 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq= *gsi, } } =20 -void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus) +void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus) { int i; =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 : pcmc->default_nic_mo= del; =20 - if (!pci_bus || (nd->model && strcmp(nd->model, "ne2k_isa") =3D=3D= 0)) { + if (!strcmp(model, "ne2k_isa")) { pc_init_ne2k_isa(isa_bus, nd); } else { - pci_nic_init_nofail(nd, pci_bus, "e1000", NULL); + pci_nic_init_nofail(nd, pci_bus, model, NULL); } } rom_reset_order_override(); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 8658bcba63..0f1966d547 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -240,7 +240,7 @@ static void pc_init1(MachineState *machine, pc_basic_device_init(isa_bus, pcms->gsi, &rtc_state, true, (pcms->vmport !=3D ON_OFF_AUTO_ON), pcms->pit, 0x= 4); =20 - pc_nic_init(isa_bus, pci_bus); + pc_nic_init(pcmc, isa_bus, pci_bus); =20 ide_drive_get(hd, ARRAY_SIZE(hd)); if (pcmc->pci_enabled) { @@ -417,6 +417,9 @@ static void pc_xen_hvm_init(MachineState *machine) =20 static void pc_i440fx_machine_options(MachineClass *m) { + PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); + pcmc->default_nic_model =3D "e1000"; + m->family =3D "pc_piix"; m->desc =3D "Standard PC (i440FX + PIIX, 1996)"; m->default_machine_opts =3D "firmware=3Dbios-256k.bin"; @@ -1114,6 +1117,7 @@ static void isapc_machine_options(MachineClass *m) pcmc->gigabyte_align =3D false; pcmc->smbios_legacy_mode =3D true; pcmc->has_reserved_memory =3D false; + pcmc->default_nic_model =3D "ne2k_isa"; m->default_cpu_type =3D X86_CPU_TYPE_NAME("486"); } =20 diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 0c0bc48137..9ae916327e 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -272,7 +272,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(isa_bus, host_bus); + pc_nic_init(pcmc, isa_bus, host_bus); =20 if (pcms->acpi_nvdimm_state.is_enabled) { nvdimm_init_acpi_state(&pcms->acpi_nvdimm_state, system_io, @@ -294,6 +294,9 @@ static void pc_q35_init(MachineState *machine) =20 static void pc_q35_machine_options(MachineClass *m) { + PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); + pcmc->default_nic_model =3D "e1000e"; + m->family =3D "pc_q35"; m->desc =3D "Standard PC (Q35 + ICH9, 2009)"; m->units_per_default_bus =3D 1; @@ -316,7 +319,10 @@ DEFINE_Q35_MACHINE(v2_12, "pc-q35-2.12", NULL, =20 static void pc_q35_2_11_machine_options(MachineClass *m) { + PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); + pc_q35_2_12_machine_options(m); + pcmc->default_nic_model =3D "e1000"; m->alias =3D NULL; SET_MACHINE_COMPAT(m, PC_COMPAT_2_11); } diff --git a/hw/pci/pci.c b/hw/pci/pci.c index aa24a26680..3b0df51983 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1829,7 +1829,7 @@ PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *r= ootbus, int devfn; int i; =20 - if (!strcmp(nd->model, "virtio")) { + if (nd->model && !strcmp(nd->model, "virtio")) { g_free(nd->model); nd->model =3D g_strdup("virtio-net-pci"); } diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index bb49165fe0..e81654eb7f 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -114,6 +114,7 @@ struct PCMachineClass { /* Device configuration: */ bool pci_enabled; bool kvmclock_enabled; + const char *default_nic_model; =20 /* Compat options: */ =20 @@ -248,7 +249,7 @@ void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd); void pc_cmos_init(PCMachineState *pcms, BusState *ide0, BusState *ide1, ISADevice *s); -void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus); +void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus); void pc_pci_device_init(PCIBus *pci_bus); =20 typedef void (*cpu_set_smm_t)(int smm, void *arg); --=20 2.14.3