From: Thomas Huth <thuth@redhat.com>
To: David Woodhouse <dwmw2@infradead.org>,
qemu-devel@nongnu.org,
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: "Richard Henderson" <richard.henderson@linaro.org>,
"Beniamino Galvani" <b.galvani@gmail.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Strahinja Jankovic" <strahinja.p.jankovic@gmail.com>,
"Niek Linnenbank" <nieklinnenbank@gmail.com>,
"Cédric Le Goater" <clg@kaod.org>,
"Andrew Jeffery" <andrew@codeconstruct.com.au>,
"Joel Stanley" <joel@jms.id.au>,
"Igor Mitsyanko" <i.mitsyanko@gmail.com>,
"Jean-Christophe Dubois" <jcd@tribudubois.net>,
"Andrey Smirnov" <andrew.smirnov@gmail.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Rob Herring" <robh@kernel.org>,
"Subbaraya Sundeep" <sundeep.lkml@gmail.com>,
"Jan Kiszka" <jan.kiszka@web.de>,
"Tyrone Ting" <kfting@nuvoton.com>,
"Hao Wu" <wuhaotsh@google.com>,
"Radoslaw Biernacki" <rad@semihalf.com>,
"Leif Lindholm" <quic_llindhol@quicinc.com>,
"Marcin Juszkiewicz" <marcin.juszkiewicz@linaro.org>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Alistair Francis" <alistair@alistair23.me>,
"Helge Deller" <deller@gmx.de>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Song Gao" <gaosong@loongson.cn>,
"Laurent Vivier" <laurent@vivier.eu>,
"Huacai Chen" <chenhuacai@kernel.org>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Jason Wang" <jasowang@redhat.com>, "Jia Liu" <proljc@gmail.com>,
"Stafford Horne" <shorne@gmail.com>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Daniel Henrique Barboza" <danielhb413@gmail.com>,
"David Gibson" <david@gibson.dropbear.id.au>,
"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
"Bin Meng" <bin.meng@windriver.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Weiwei Li" <liwei1518@gmail.com>,
"Liu Zhiwei" <zhiwei_liu@linux.alibaba.com>,
"Halil Pasic" <pasic@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Eric Farman" <farman@linux.ibm.com>,
"David Hildenbrand" <david@redhat.com>,
"Ilya Leoshkevich" <iii@linux.ibm.com>,
"Yoshinori Sato" <ysato@users.sourceforge.jp>,
"Magnus Damm" <magnus.damm@gmail.com>,
"Artyom Tarasenko" <atar4qemu@gmail.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Anthony Perard" <anthony.perard@citrix.com>,
"Paul Durrant" <paul@xen.org>,
"Max Filippov" <jcmvbkbc@gmail.com>,
"David Woodhouse" <dwmw@amazon.co.uk>
Subject: Re: [PATCH v4 42/47] hw/sparc/sun4m: use qemu_find_nic_info()
Date: Wed, 31 Jan 2024 13:06:33 +0100 [thread overview]
Message-ID: <3c496c3a-9aa7-4759-b08d-afab6b6063fc@redhat.com> (raw)
In-Reply-To: <20240126173228.394202-43-dwmw2@infradead.org>
On 26/01/2024 18.25, David Woodhouse wrote:
> From: David Woodhouse <dwmw@amazon.co.uk>
>
> 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 <dwmw@amazon.co.uk>
> ---
> 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)
>
> 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 = qemu_find_nic_info("lance", true, NULL);
>
> dma = qdev_new(TYPE_SPARC32_DMA);
> espdma = SPARC32_ESPDMA_DEVICE(object_resolve_path_component(
> @@ -320,7 +322,14 @@ static void *sparc32_dma_init(hwaddr dma_base,
>
> lance = 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);
> + }
>
> 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 = machine->smp.cpus;
> unsigned int max_cpus = machine->smp.max_cpus;
> HostMemoryBackend *ram_memdev = machine->memdev;
> - NICInfo *nd = &nd_table[0];
> + MACAddr hostid;
>
> 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);
> }
>
> - 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);
>
> if (graphic_depth != 8 && graphic_depth != 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);
>
> - 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");
Reviewed-by: Thomas Huth <thuth@redhat.com>
next prev parent reply other threads:[~2024-01-31 12:07 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-26 17:24 [PATCH v4 00/47] Rework matching of network devices to -nic options David Woodhouse
2024-01-26 17:24 ` [PATCH v4 01/47] net: add qemu_{configure, create}_nic_device(), qemu_find_nic_info() David Woodhouse
2024-01-26 17:24 ` [PATCH v4 02/47] net: report list of available models according to platform David Woodhouse
2024-01-26 17:24 ` [PATCH v4 03/47] net: add qemu_create_nic_bus_devices() David Woodhouse
2024-01-26 17:24 ` [PATCH v4 04/47] hw/pci: add pci_init_nic_devices(), pci_init_nic_in_slot() David Woodhouse
2024-01-26 17:24 ` [PATCH v4 05/47] hw/i386/pc: use qemu_get_nic_info() and pci_init_nic_devices() David Woodhouse
2024-01-26 17:24 ` [PATCH v4 06/47] hw/xen: use qemu_create_nic_bus_devices() to instantiate Xen NICs David Woodhouse
2024-01-26 17:24 ` [PATCH v4 07/47] hw/alpha/dp264: use pci_init_nic_devices() David Woodhouse
2024-01-26 17:24 ` [PATCH v4 08/47] hw/arm/sbsa-ref: " David Woodhouse
2024-01-26 17:24 ` [PATCH v4 09/47] hw/arm/virt: " David Woodhouse
2024-01-26 17:24 ` [PATCH v4 10/47] hw/hppa: " David Woodhouse
2024-01-26 17:24 ` [PATCH v4 11/47] hw/loongarch: " David Woodhouse
2024-01-26 17:24 ` [PATCH v4 12/47] hw/mips/fuloong2e: " David Woodhouse
2024-01-26 17:24 ` [PATCH v4 13/47] hw/mips/malta: " David Woodhouse
2024-01-26 17:24 ` [PATCH v4 14/47] hw/mips/loongson3_virt: " David Woodhouse
2024-01-26 17:24 ` [PATCH v4 15/47] hw/ppc/prep: " David Woodhouse
2024-01-26 17:24 ` [PATCH v4 16/47] hw/ppc/spapr: use qemu_get_nic_info() and pci_init_nic_devices() David Woodhouse
2024-01-26 17:24 ` [PATCH v4 17/47] hw/ppc: use pci_init_nic_devices() David Woodhouse
2024-01-26 17:24 ` [PATCH v4 18/47] hw/sh4/r2d: " David Woodhouse
2024-01-26 17:24 ` [PATCH v4 19/47] hw/sparc64/sun4u: " David Woodhouse
2024-01-26 17:24 ` [PATCH v4 20/47] hw/xtensa/virt: " David Woodhouse
2024-01-26 17:24 ` [PATCH v4 21/47] hw/arm/allwinner: use qemu_configure_nic_device() David Woodhouse
2024-01-26 17:24 ` [PATCH v4 22/47] hw/arm/aspeed: " David Woodhouse
2024-02-01 16:19 ` Cédric Le Goater
2024-01-26 17:25 ` [PATCH v4 23/47] hw/arm/exynos4: use qemu_create_nic_device() David Woodhouse
2024-01-26 17:25 ` [PATCH v4 24/47] hw/arm/fsl: use qemu_configure_nic_device() David Woodhouse
2024-01-26 17:25 ` [PATCH v4 25/47] hw/net/smc91c111: " David Woodhouse
2024-01-26 17:25 ` [PATCH v4 26/47] hw/net/lan9118: " David Woodhouse
2024-01-31 7:04 ` Thomas Huth
2024-01-26 17:25 ` [PATCH v4 27/47] hw/arm/highbank: use qemu_create_nic_device() David Woodhouse
2024-01-26 17:25 ` [PATCH v4 28/47] hw/arm/npcm7xx: use qemu_configure_nic_device, allow emc0/emc1 as aliases David Woodhouse
2024-01-31 7:08 ` Thomas Huth
2024-01-26 17:25 ` [PATCH v4 29/47] hw/arm/stellaris: use qemu_find_nic_info() David Woodhouse
2024-01-31 12:13 ` Thomas Huth
2024-01-31 14:13 ` David Woodhouse
2024-01-31 14:28 ` Peter Maydell
2024-01-26 17:25 ` [PATCH v4 30/47] hw/arm: use qemu_configure_nic_device() David Woodhouse
2024-01-31 8:45 ` Thomas Huth
2024-01-26 17:25 ` [PATCH v4 31/47] hw/net/etraxfs-eth: " David Woodhouse
2024-01-26 17:25 ` [PATCH v4 32/47] hw/m68k/mcf5208: use qemu_create_nic_device() David Woodhouse
2024-01-26 17:25 ` [PATCH v4 33/47] hw/m68k/q800: use qemu_find_nic_info() David Woodhouse
2024-01-31 12:18 ` Thomas Huth
2024-01-31 14:18 ` David Woodhouse
2024-02-01 10:30 ` Thomas Huth
2024-02-01 16:07 ` David Woodhouse
2024-02-01 16:13 ` Peter Maydell
2024-01-26 17:25 ` [PATCH v4 34/47] hw/microblaze: use qemu_configure_nic_device() David Woodhouse
2024-01-26 17:25 ` [PATCH v4 35/47] hw/mips/mipssim: use qemu_create_nic_device() David Woodhouse
2024-01-31 8:51 ` Thomas Huth
2024-01-26 17:25 ` [PATCH v4 36/47] hw/mips/jazz: use qemu_find_nic_info() David Woodhouse
2024-01-31 11:35 ` Thomas Huth
2024-01-26 17:25 ` [PATCH v4 37/47] hw/net/lasi_i82596: Re-enable build David Woodhouse
2024-01-31 11:59 ` Thomas Huth
2024-02-01 8:59 ` Thomas Huth
2024-01-26 17:25 ` [PATCH v4 38/47] hw/net/lasi_i82596: use qemu_create_nic_device() David Woodhouse
2024-02-02 16:22 ` [PATCH v4.1 " David Woodhouse
2024-01-26 17:25 ` [PATCH v4 39/47] hw/openrisc/openrisc_sim: " David Woodhouse
2024-01-31 12:01 ` Thomas Huth
2024-01-26 17:25 ` [PATCH v4 40/47] hw/riscv: use qemu_configure_nic_device() David Woodhouse
2024-01-26 17:25 ` [PATCH v4 41/47] hw/s390x/s390-virtio-ccw: use qemu_create_nic_device() David Woodhouse
2024-01-26 17:25 ` [PATCH v4 42/47] hw/sparc/sun4m: use qemu_find_nic_info() David Woodhouse
2024-01-31 12:06 ` Thomas Huth [this message]
2024-01-26 17:25 ` [PATCH v4 43/47] hw/xtensa/xtfpga: use qemu_create_nic_device() David Woodhouse
2024-01-26 17:25 ` [PATCH v4 44/47] net: remove qemu_check_nic_model() David Woodhouse
2024-01-26 17:25 ` [PATCH v4 45/47] hw/pci: remove pci_nic_init_nofail() David Woodhouse
2024-01-26 17:25 ` [PATCH v4 46/47] net: remove qemu_show_nic_models(), qemu_find_nic_model() David Woodhouse
2024-01-31 12:08 ` Thomas Huth
2024-01-26 17:25 ` [PATCH v4 47/47] net: make nb_nics and nd_table[] static in net/net.c David Woodhouse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3c496c3a-9aa7-4759-b08d-afab6b6063fc@redhat.com \
--to=thuth@redhat.com \
--cc=aleksandar.rikalo@syrmia.com \
--cc=alistair@alistair23.me \
--cc=andrew.smirnov@gmail.com \
--cc=andrew@codeconstruct.com.au \
--cc=anthony.perard@citrix.com \
--cc=atar4qemu@gmail.com \
--cc=aurelien@aurel32.net \
--cc=b.galvani@gmail.com \
--cc=bin.meng@windriver.com \
--cc=borntraeger@linux.ibm.com \
--cc=chenhuacai@kernel.org \
--cc=clg@kaod.org \
--cc=danielhb413@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=david@redhat.com \
--cc=deller@gmx.de \
--cc=dwmw2@infradead.org \
--cc=dwmw@amazon.co.uk \
--cc=edgar.iglesias@gmail.com \
--cc=eduardo@habkost.net \
--cc=farman@linux.ibm.com \
--cc=gaosong@loongson.cn \
--cc=harshpb@linux.ibm.com \
--cc=hpoussin@reactos.org \
--cc=i.mitsyanko@gmail.com \
--cc=iii@linux.ibm.com \
--cc=jan.kiszka@web.de \
--cc=jasowang@redhat.com \
--cc=jcd@tribudubois.net \
--cc=jcmvbkbc@gmail.com \
--cc=jiaxun.yang@flygoat.com \
--cc=joel@jms.id.au \
--cc=kfting@nuvoton.com \
--cc=laurent@vivier.eu \
--cc=liwei1518@gmail.com \
--cc=magnus.damm@gmail.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=marcin.juszkiewicz@linaro.org \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mst@redhat.com \
--cc=nieklinnenbank@gmail.com \
--cc=npiggin@gmail.com \
--cc=palmer@dabbelt.com \
--cc=pasic@linux.ibm.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=proljc@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=quic_llindhol@quicinc.com \
--cc=rad@semihalf.com \
--cc=richard.henderson@linaro.org \
--cc=robh@kernel.org \
--cc=shorne@gmail.com \
--cc=sstabellini@kernel.org \
--cc=strahinja.p.jankovic@gmail.com \
--cc=sundeep.lkml@gmail.com \
--cc=wuhaotsh@google.com \
--cc=ysato@users.sourceforge.jp \
--cc=zhiwei_liu@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).