* [PATCH 0/5] Use MachineClass->default_nic in more machines
@ 2023-05-23 11:04 Thomas Huth
2023-05-23 11:04 ` [PATCH 1/5] hw/hppa: Use MachineClass->default_nic in the hppa machine Thomas Huth
` (6 more replies)
0 siblings, 7 replies; 9+ messages in thread
From: Thomas Huth @ 2023-05-23 11:04 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Helge Deller, Xiaojuan Yang, Song Gao,
Max Filippov, Jason Wang
These patches are required for running more tests with "make check"
on builds that use "--without-default-devices". By marking the
default NIC in the generic MachineClass, the main code can decide
whether the NIC is available in the binary or not, so the instantiation
can be skipped if it has not been compiled in.
See https://lore.kernel.org/qemu-devel/20230512124033.502654-5-thuth@redhat.com/
and the other patches in that series for more information.
Thomas Huth (5):
hw/hppa: Use MachineClass->default_nic in the hppa machine
hw/alpha: Use MachineClass->default_nic in the alpha machine
hw/arm: Use MachineClass->default_nic in the virt machine
hw/loongarch64: Use MachineClass->default_nic in the virt machine
hw/xtensa: Use MachineClass->default_nic in the virt machine
hw/alpha/dp264.c | 4 +++-
hw/arm/virt.c | 4 +++-
hw/hppa/machine.c | 4 +++-
hw/loongarch/virt.c | 4 +++-
hw/xtensa/virt.c | 9 ++++++---
5 files changed, 18 insertions(+), 7 deletions(-)
--
2.31.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/5] hw/hppa: Use MachineClass->default_nic in the hppa machine
2023-05-23 11:04 [PATCH 0/5] Use MachineClass->default_nic in more machines Thomas Huth
@ 2023-05-23 11:04 ` Thomas Huth
2023-05-23 11:04 ` [PATCH 2/5] hw/alpha: Use MachineClass->default_nic in the alpha machine Thomas Huth
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Thomas Huth @ 2023-05-23 11:04 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Helge Deller, Xiaojuan Yang, Song Gao,
Max Filippov, Jason Wang
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).
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
hw/hppa/machine.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index 8fea5fa6b8..b00a91ecfe 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -177,6 +177,7 @@ static void machine_hppa_init(MachineState *machine)
const char *kernel_filename = machine->kernel_filename;
const char *kernel_cmdline = machine->kernel_cmdline;
const char *initrd_filename = machine->initrd_filename;
+ MachineClass *mc = MACHINE_GET_CLASS(machine);
DeviceState *dev, *dino_dev, *lasi_dev;
PCIBus *pci_bus;
ISABus *isa_bus;
@@ -272,7 +273,7 @@ static void machine_hppa_init(MachineState *machine)
for (i = 0; i < nb_nics; i++) {
if (!enable_lasi_lan()) {
- pci_nic_init_nofail(&nd_table[i], pci_bus, "tulip", NULL);
+ pci_nic_init_nofail(&nd_table[i], pci_bus, mc->default_nic, NULL);
}
}
@@ -462,6 +463,7 @@ static void hppa_machine_init_class_init(ObjectClass *oc, void *data)
mc->default_ram_size = 512 * MiB;
mc->default_boot_order = "cd";
mc->default_ram_id = "ram";
+ mc->default_nic = "tulip";
nc->nmi_monitor_handler = hppa_nmi;
}
--
2.31.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/5] hw/alpha: Use MachineClass->default_nic in the alpha machine
2023-05-23 11:04 [PATCH 0/5] Use MachineClass->default_nic in more machines Thomas Huth
2023-05-23 11:04 ` [PATCH 1/5] hw/hppa: Use MachineClass->default_nic in the hppa machine Thomas Huth
@ 2023-05-23 11:04 ` Thomas Huth
2023-05-23 11:04 ` [PATCH 3/5] hw/arm: Use MachineClass->default_nic in the virt machine Thomas Huth
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Thomas Huth @ 2023-05-23 11:04 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Helge Deller, Xiaojuan Yang, Song Gao,
Max Filippov, Jason Wang
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).
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
hw/alpha/dp264.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
index 4161f559a7..03495e1e60 100644
--- a/hw/alpha/dp264.c
+++ b/hw/alpha/dp264.c
@@ -49,6 +49,7 @@ static void clipper_init(MachineState *machine)
const char *kernel_filename = machine->kernel_filename;
const char *kernel_cmdline = machine->kernel_cmdline;
const char *initrd_filename = machine->initrd_filename;
+ MachineClass *mc = MACHINE_GET_CLASS(machine);
AlphaCPU *cpus[4];
PCIBus *pci_bus;
PCIDevice *pci_dev;
@@ -124,7 +125,7 @@ static void clipper_init(MachineState *machine)
/* Network setup. e1000 is good enough, failing Tulip support. */
for (i = 0; i < nb_nics; i++) {
- pci_nic_init_nofail(&nd_table[i], pci_bus, "e1000", NULL);
+ pci_nic_init_nofail(&nd_table[i], pci_bus, mc->default_nic, NULL);
}
/* Super I/O */
@@ -213,6 +214,7 @@ static void clipper_machine_init(MachineClass *mc)
mc->is_default = true;
mc->default_cpu_type = ALPHA_CPU_TYPE_NAME("ev67");
mc->default_ram_id = "ram";
+ mc->default_nic = "e1000";
}
DEFINE_MACHINE("clipper", clipper_machine_init)
--
2.31.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/5] hw/arm: Use MachineClass->default_nic in the virt machine
2023-05-23 11:04 [PATCH 0/5] Use MachineClass->default_nic in more machines Thomas Huth
2023-05-23 11:04 ` [PATCH 1/5] hw/hppa: Use MachineClass->default_nic in the hppa machine Thomas Huth
2023-05-23 11:04 ` [PATCH 2/5] hw/alpha: Use MachineClass->default_nic in the alpha machine Thomas Huth
@ 2023-05-23 11:04 ` Thomas Huth
2023-05-23 11:04 ` [PATCH 4/5] hw/loongarch64: " Thomas Huth
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Thomas Huth @ 2023-05-23 11:04 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Helge Deller, Xiaojuan Yang, Song Gao,
Max Filippov, Jason Wang
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).
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
hw/arm/virt.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index b99ae18501..9b9f7d9c68 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1426,6 +1426,7 @@ static void create_pcie(VirtMachineState *vms)
int i, ecam_id;
PCIHostState *pci;
MachineState *ms = MACHINE(vms);
+ MachineClass *mc = MACHINE_GET_CLASS(ms);
dev = qdev_new(TYPE_GPEX_HOST);
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
@@ -1479,7 +1480,7 @@ static void create_pcie(VirtMachineState *vms)
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);
@@ -3033,6 +3034,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
mc->auto_enable_numa_with_memhp = true;
mc->auto_enable_numa_with_memdev = true;
mc->default_ram_id = "mach-virt.ram";
+ mc->default_nic = "virtio-net-pci";
object_class_property_add(oc, "acpi", "OnOffAuto",
virt_get_acpi, virt_set_acpi,
--
2.31.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/5] hw/loongarch64: Use MachineClass->default_nic in the virt machine
2023-05-23 11:04 [PATCH 0/5] Use MachineClass->default_nic in more machines Thomas Huth
` (2 preceding siblings ...)
2023-05-23 11:04 ` [PATCH 3/5] hw/arm: Use MachineClass->default_nic in the virt machine Thomas Huth
@ 2023-05-23 11:04 ` Thomas Huth
2023-05-25 12:56 ` Song Gao
2023-05-23 11:04 ` [PATCH 5/5] hw/xtensa: " Thomas Huth
` (2 subsequent siblings)
6 siblings, 1 reply; 9+ messages in thread
From: Thomas Huth @ 2023-05-23 11:04 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Helge Deller, Xiaojuan Yang, Song Gao,
Max Filippov, Jason Wang
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).
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
hw/loongarch/virt.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index 2b7588e32a..ceddec1b23 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -474,6 +474,7 @@ static DeviceState *create_platform_bus(DeviceState *pch_pic)
static void loongarch_devices_init(DeviceState *pch_pic, LoongArchMachineState *lams)
{
+ MachineClass *mc = MACHINE_GET_CLASS(lams);
DeviceState *gpex_dev;
SysBusDevice *d;
PCIBus *pci_bus;
@@ -528,7 +529,7 @@ static void loongarch_devices_init(DeviceState *pch_pic, LoongArchMachineState *
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);
@@ -1038,6 +1039,7 @@ static void loongarch_class_init(ObjectClass *oc, void *data)
mc->default_boot_order = "c";
mc->no_cdrom = 1;
mc->get_hotplug_handler = virt_machine_get_hotplug_handler;
+ mc->default_nic = "virtio-net-pci";
hc->plug = loongarch_machine_device_plug_cb;
hc->pre_plug = virt_machine_device_pre_plug;
hc->unplug_request = virt_machine_device_unplug_request;
--
2.31.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/5] hw/xtensa: Use MachineClass->default_nic in the virt machine
2023-05-23 11:04 [PATCH 0/5] Use MachineClass->default_nic in more machines Thomas Huth
` (3 preceding siblings ...)
2023-05-23 11:04 ` [PATCH 4/5] hw/loongarch64: " Thomas Huth
@ 2023-05-23 11:04 ` Thomas Huth
2023-05-23 15:03 ` [PATCH 0/5] Use MachineClass->default_nic in more machines Richard Henderson
2023-05-24 13:55 ` Philippe Mathieu-Daudé
6 siblings, 0 replies; 9+ messages in thread
From: Thomas Huth @ 2023-05-23 11:04 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Helge Deller, Xiaojuan Yang, Song Gao,
Max Filippov, Jason Wang
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).
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
hw/xtensa/virt.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/hw/xtensa/virt.c b/hw/xtensa/virt.c
index a18e3fc910..b87f842e74 100644
--- a/hw/xtensa/virt.c
+++ b/hw/xtensa/virt.c
@@ -38,7 +38,8 @@
#include "xtensa_memory.h"
#include "xtensa_sim.h"
-static void create_pcie(CPUXtensaState *env, int irq_base, hwaddr addr_base)
+static void create_pcie(MachineState *ms, CPUXtensaState *env, int irq_base,
+ hwaddr addr_base)
{
hwaddr base_ecam = addr_base + 0x00100000;
hwaddr size_ecam = 0x03f00000;
@@ -54,6 +55,7 @@ static void create_pcie(CPUXtensaState *env, int irq_base, hwaddr addr_base)
MemoryRegion *mmio_alias;
MemoryRegion *mmio_reg;
+ MachineClass *mc = MACHINE_GET_CLASS(ms);
DeviceState *dev;
PCIHostState *pci;
qemu_irq *extints;
@@ -104,7 +106,7 @@ static void create_pcie(CPUXtensaState *env, int irq_base, hwaddr addr_base)
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);
@@ -117,7 +119,7 @@ static void xtensa_virt_init(MachineState *machine)
XtensaCPU *cpu = xtensa_sim_common_init(machine);
CPUXtensaState *env = &cpu->env;
- create_pcie(env, 0, 0xf0000000);
+ create_pcie(machine, env, 0, 0xf0000000);
xtensa_sim_load_kernel(cpu, machine);
}
@@ -127,6 +129,7 @@ static void xtensa_virt_machine_init(MachineClass *mc)
mc->init = xtensa_virt_init;
mc->max_cpus = 32;
mc->default_cpu_type = XTENSA_DEFAULT_CPU_TYPE;
+ mc->default_nic = "virtio-net-pci";
}
DEFINE_MACHINE("virt", xtensa_virt_machine_init)
--
2.31.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 0/5] Use MachineClass->default_nic in more machines
2023-05-23 11:04 [PATCH 0/5] Use MachineClass->default_nic in more machines Thomas Huth
` (4 preceding siblings ...)
2023-05-23 11:04 ` [PATCH 5/5] hw/xtensa: " Thomas Huth
@ 2023-05-23 15:03 ` Richard Henderson
2023-05-24 13:55 ` Philippe Mathieu-Daudé
6 siblings, 0 replies; 9+ messages in thread
From: Richard Henderson @ 2023-05-23 15:03 UTC (permalink / raw)
To: Thomas Huth, qemu-devel
Cc: Peter Maydell, Helge Deller, Xiaojuan Yang, Song Gao,
Max Filippov, Jason Wang
On 5/23/23 04:04, Thomas Huth wrote:
> These patches are required for running more tests with "make check"
> on builds that use "--without-default-devices". By marking the
> default NIC in the generic MachineClass, the main code can decide
> whether the NIC is available in the binary or not, so the instantiation
> can be skipped if it has not been compiled in.
>
> Seehttps://lore.kernel.org/qemu-devel/20230512124033.502654-5-thuth@redhat.com/
> and the other patches in that series for more information.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/5] Use MachineClass->default_nic in more machines
2023-05-23 11:04 [PATCH 0/5] Use MachineClass->default_nic in more machines Thomas Huth
` (5 preceding siblings ...)
2023-05-23 15:03 ` [PATCH 0/5] Use MachineClass->default_nic in more machines Richard Henderson
@ 2023-05-24 13:55 ` Philippe Mathieu-Daudé
6 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-05-24 13:55 UTC (permalink / raw)
To: Thomas Huth, qemu-devel
Cc: Peter Maydell, Helge Deller, Xiaojuan Yang, Song Gao,
Max Filippov, Jason Wang
On 23/5/23 13:04, Thomas Huth wrote:
> These patches are required for running more tests with "make check"
> on builds that use "--without-default-devices". By marking the
> default NIC in the generic MachineClass, the main code can decide
> whether the NIC is available in the binary or not, so the instantiation
> can be skipped if it has not been compiled in.
>
> See https://lore.kernel.org/qemu-devel/20230512124033.502654-5-thuth@redhat.com/
> and the other patches in that series for more information.
>
> Thomas Huth (5):
> hw/hppa: Use MachineClass->default_nic in the hppa machine
> hw/alpha: Use MachineClass->default_nic in the alpha machine
> hw/arm: Use MachineClass->default_nic in the virt machine
> hw/loongarch64: Use MachineClass->default_nic in the virt machine
> hw/xtensa: Use MachineClass->default_nic in the virt machine
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4/5] hw/loongarch64: Use MachineClass->default_nic in the virt machine
2023-05-23 11:04 ` [PATCH 4/5] hw/loongarch64: " Thomas Huth
@ 2023-05-25 12:56 ` Song Gao
0 siblings, 0 replies; 9+ messages in thread
From: Song Gao @ 2023-05-25 12:56 UTC (permalink / raw)
To: Thomas Huth, qemu-devel
Cc: Peter Maydell, Helge Deller, Xiaojuan Yang, Max Filippov,
Jason Wang
在 2023/5/23 下午7:04, Thomas Huth 写道:
> 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).
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> hw/loongarch/virt.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Tested-by: Song Gao <gaosong@loongson.cn>
Reviewed-by: Song Gao <gaosong@loongson.cn>
Thanks.
Song Gao
> diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
> index 2b7588e32a..ceddec1b23 100644
> --- a/hw/loongarch/virt.c
> +++ b/hw/loongarch/virt.c
> @@ -474,6 +474,7 @@ static DeviceState *create_platform_bus(DeviceState *pch_pic)
>
> static void loongarch_devices_init(DeviceState *pch_pic, LoongArchMachineState *lams)
> {
> + MachineClass *mc = MACHINE_GET_CLASS(lams);
> DeviceState *gpex_dev;
> SysBusDevice *d;
> PCIBus *pci_bus;
> @@ -528,7 +529,7 @@ static void loongarch_devices_init(DeviceState *pch_pic, LoongArchMachineState *
> 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);
> @@ -1038,6 +1039,7 @@ static void loongarch_class_init(ObjectClass *oc, void *data)
> mc->default_boot_order = "c";
> mc->no_cdrom = 1;
> mc->get_hotplug_handler = virt_machine_get_hotplug_handler;
> + mc->default_nic = "virtio-net-pci";
> hc->plug = loongarch_machine_device_plug_cb;
> hc->pre_plug = virt_machine_device_pre_plug;
> hc->unplug_request = virt_machine_device_unplug_request;
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-05-25 12:56 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-23 11:04 [PATCH 0/5] Use MachineClass->default_nic in more machines Thomas Huth
2023-05-23 11:04 ` [PATCH 1/5] hw/hppa: Use MachineClass->default_nic in the hppa machine Thomas Huth
2023-05-23 11:04 ` [PATCH 2/5] hw/alpha: Use MachineClass->default_nic in the alpha machine Thomas Huth
2023-05-23 11:04 ` [PATCH 3/5] hw/arm: Use MachineClass->default_nic in the virt machine Thomas Huth
2023-05-23 11:04 ` [PATCH 4/5] hw/loongarch64: " Thomas Huth
2023-05-25 12:56 ` Song Gao
2023-05-23 11:04 ` [PATCH 5/5] hw/xtensa: " Thomas Huth
2023-05-23 15:03 ` [PATCH 0/5] Use MachineClass->default_nic in more machines Richard Henderson
2023-05-24 13:55 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).