qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Jason Wang <jasowang@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH v3 00/46] Rework matching of network devices to -nic options
Date: Wed, 24 Jan 2024 13:13:49 +0000	[thread overview]
Message-ID: <ec354ea42daa8c7ae8bb1fbb521db9d69e6d0fc9.camel@infradead.org> (raw)
In-Reply-To: <20240108204909.564514-1-dwmw2@infradead.org>

[-- Attachment #1: Type: text/plain, Size: 12179 bytes --]

Hi Jason,

I think this series probably lives or dies with you. I think it's a
worthwhile cleanup, but I no longer have an immediate need for it; I
shipped a slightly ugly workaround in QEMU 8.2.

Please could you let me know if it's worth persisting with it?

Thanks.

On Mon, 2024-01-08 at 20:26 +0000, David Woodhouse wrote:
> 
> Most platforms iterating directly over the nd_table[] are doing one of 
> two things. Either they are creating the NIC for their platform and want
> to find a matching -nic configuration for it, if such exists. Or they
> are only going to create that platform NIC if a matching config *does*
> exist.
> 
> All of those can be converted to the new qemu_configure_nic_device()
> and qemu_create_nic_device() functions. The latter of which will call
> qdev_new() to create the device (and apply the config) if a matching
> NIC config does exist for it. The existing behaviour of each platform
> has been preserved for now, despite it being apparently fairly random.
> 
> PCI and indeed XenBus can use a qemu_create_nic_bus_devices() which will 
> create all NICs that live on a given bus type. That covers most 
> platforms, but some PCI platforms do something special with the first
> NIC of a given type, placing it in the slot where it would have been on 
> the real hardware. There were various inconsistencies in the way the 
> platforms did so, and whether they cared what model the NIC was. Those 
> subtle behavioural changes I *have* allowed to change, and now the 
> pci_init_nic_slot() function will pick the first NIC that the user 
> specified which isn't explicitly *not* the default type, and put that
> in the specified slot.
> 
> The tests for npcm7xx used to lament that they had to instantiate both
> NICs even when they wanted to test only the second, because there was
> no way to specify which hardware devices gets which configuration. I
> made that untrue, by allowing 'emc0' and 'emc1' aliases, and fixed up
> the test accordingly.
> 
> There are one or two special cases which want to do special things with
> the MAC address of the primary NIC, to set up a system identification
> (or force it to use an Apple OUI, in the case of m68k/q400). All those
> work out relatively cleanly too.
> 
> And I can clean up the ugly patch which fixed up the Xen network device 
> handling, and replace it with a simple call to the new 
> qemu_create_nic_bus_devices() function.
> 
> I suspect that we can remove the pci_init_nic_devices() from platform
> code and just do it later, except for platforms which *care* which
> PCI bus the dynamic devices go on (is that just sun4u which puts its
> primary NIC onto a different bus?).
> 
> Finally, while we're at it, clean up -nic model=help to only print
> the device models which are actually usable on the given platform
> rather than just listing them *all*.
> 
> And now we can make nd_table[] and nb_nics static in net/net.c because
> nothing else has any business poking at them directly.
> 
>  v3: Rebase to 8.2
> 
>  v2: Some build fixes after better coverage testing, revert the Xen fix
>      in this series because I'm putting the less invasive hack into 8.2
>      (hopefully).
> 
> David Woodhouse (46):
>       net: add qemu_{configure,create}_nic_device(), qemu_find_nic_info()
>       net: report list of available models according to platform
>       net: add qemu_create_nic_bus_devices()
>       hw/pci: add pci_init_nic_devices(), pci_init_nic_in_slot()
>       hw/i386/pc: use qemu_get_nic_info() and pci_init_nic_devices()
>       hw/xen: use qemu_create_nic_bus_devices() to instantiate Xen NICs
>       hw/alpha/dp264: use pci_init_nic_devices()
>       hw/arm/sbsa-ref: use pci_init_nic_devices()
>       hw/arm/virt: use pci_init_nic_devices()
>       hw/hppa: use pci_init_nic_devices()
>       hw/loongarch: use pci_init_nic_devices()
>       hw/mips/fuloong2e: use pci_init_nic_devices()
>       hw/mips/malta: use pci_init_nic_devices()
>       hw/mips/loongson3_virt: use pci_init_nic_devices()
>       hw/ppc/prep: use pci_init_nic_devices()
>       hw/ppc/spapr: use qemu_get_nic_info() and pci_init_nic_devices()
>       hw/ppc: use pci_init_nic_devices()
>       hw/sh4/r2d: use pci_init_nic_devices()
>       hw/sparc64/sun4u: use pci_init_nic_devices()
>       hw/xtensa/virt: use pci_init_nic_devices()
>       hw/arm/allwinner: use qemu_configure_nic_device()
>       hw/arm/aspeed: use qemu_configure_nic_device()
>       hw/arm/exynos4: use qemu_create_nic_device()
>       hw/arm/fsl: use qemu_configure_nic_device()
>       hw/net/smc91c111: use qemu_configure_nic_device()
>       hw/net/lan9118: use qemu_configure_nic_device()
>       hw/arm/highbank: use qemu_create_nic_device()
>       hw/arm/npcm7xx: use qemu_configure_nic_device, allow emc0/emc1 as aliases
>       hw/arm/stellaris: use qemu_find_nic_info()
>       hw/arm: use qemu_configure_nic_device()
>       hw/net/etraxfs-eth: use qemu_configure_nic_device()
>       hw/m68k/mcf5208: use qemu_create_nic_device()
>       hw/m68k/q800: use qemu_find_nic_info()
>       hw/microblaze: use qemu_configure_nic_device()
>       hw/mips/mipssim: use qemu_create_nic_device()
>       hw/mips/jazz: use qemu_find_nic_info()
>       hw/net/lasi_i82596: use qemu_configure_nic_device()
>       hw/openrisc/openrisc_sim: use qemu_create_nic_device()
>       hw/riscv: use qemu_configure_nic_device()
>       hw/s390x/s390-virtio-ccw: use qemu_create_nic_device()
>       hw/sparc/sun4m: use qemu_find_nic_info()
>       hw/xtensa/xtfpga: use qemu_create_nic_device()
>       net: remove qemu_check_nic_model()
>       hw/pci: remove pci_nic_init_nofail()
>       net: remove qemu_show_nic_models(), qemu_find_nic_model()
>       net: make nb_nics and nd_table[] static in net/net.c
> 
>  hw/alpha/dp264.c                         |   4 +-
>  hw/arm/allwinner-a10.c                   |   6 +-
>  hw/arm/allwinner-h3.c                    |   6 +-
>  hw/arm/allwinner-r40.c                   |  27 +---
>  hw/arm/aspeed.c                          |   9 +-
>  hw/arm/exynos4_boards.c                  |   6 +-
>  hw/arm/fsl-imx25.c                       |   2 +-
>  hw/arm/fsl-imx6.c                        |   2 +-
>  hw/arm/fsl-imx6ul.c                      |   2 +-
>  hw/arm/fsl-imx7.c                        |   2 +-
>  hw/arm/gumstix.c                         |   6 +-
>  hw/arm/highbank.c                        |  12 +-
>  hw/arm/integratorcp.c                    |   5 +-
>  hw/arm/kzm.c                             |   4 +-
>  hw/arm/mainstone.c                       |   3 +-
>  hw/arm/mps2-tz.c                         |   8 +-
>  hw/arm/mps2.c                            |   2 +-
>  hw/arm/msf2-soc.c                        |   6 +-
>  hw/arm/musicpal.c                        |   3 +-
>  hw/arm/npcm7xx.c                         |  16 +-
>  hw/arm/realview.c                        |  25 ++-
>  hw/arm/sbsa-ref.c                        |   4 +-
>  hw/arm/stellaris.c                       |  30 +++-
>  hw/arm/versatilepb.c                     |  15 +-
>  hw/arm/vexpress.c                        |   4 +-
>  hw/arm/virt.c                            |   4 +-
>  hw/arm/xilinx_zynq.c                     |  11 +-
>  hw/arm/xlnx-versal.c                     |   7 +-
>  hw/arm/xlnx-zynqmp.c                     |   8 +-
>  hw/cris/axis_dev88.c                     |   9 +-
>  hw/hppa/machine.c                        |   7 +-
>  hw/i386/pc.c                             |  33 ++--
>  hw/i386/pc_piix.c                        |   2 +-
>  hw/i386/pc_q35.c                         |   2 +-
>  hw/loongarch/virt.c                      |   4 +-
>  hw/m68k/mcf5208.c                        |  19 +--
>  hw/m68k/q800.c                           |  29 ++--
>  hw/microblaze/petalogix_ml605_mmu.c      |   3 +-
>  hw/microblaze/petalogix_s3adsp1800_mmu.c |   3 +-
>  hw/mips/fuloong2e.c                      |  16 +-
>  hw/mips/jazz.c                           |  15 +-
>  hw/mips/loongson3_virt.c                 |   4 +-
>  hw/mips/malta.c                          |  15 +-
>  hw/mips/mipssim.c                        |  13 +-
>  hw/net/etraxfs_eth.c                     |   5 +-
>  hw/net/lan9118.c                         |   5 +-
>  hw/net/lasi_i82596.c                     |   3 +-
>  hw/net/smc91c111.c                       |   5 +-
>  hw/openrisc/openrisc_sim.c               |  18 +--
>  hw/pci/pci.c                             |  73 +++------
>  hw/ppc/e500.c                            |   4 +-
>  hw/ppc/mac_newworld.c                    |   4 +-
>  hw/ppc/mac_oldworld.c                    |   4 +-
>  hw/ppc/ppc440_bamboo.c                   |  14 +-
>  hw/ppc/prep.c                            |   8 +-
>  hw/ppc/spapr.c                           |  18 +--
>  hw/riscv/microchip_pfsoc.c               |  14 +-
>  hw/riscv/sifive_u.c                      |   7 +-
>  hw/s390x/s390-virtio-ccw.c               |  11 +-
>  hw/sh4/r2d.c                             |   6 +-
>  hw/sparc/sun4m.c                         |  20 ++-
>  hw/sparc64/sun4u.c                       |  27 +---
>  hw/xen/xen-bus.c                         |   6 +-
>  hw/xen/xen_devconfig.c                   |  25 ---
>  hw/xenpv/xen_machine_pv.c                |   9 --
>  hw/xtensa/virt.c                         |   4 +-
>  hw/xtensa/xtfpga.c                       |  13 +-
>  include/hw/cris/etraxfs.h                |   2 +-
>  include/hw/i386/pc.h                     |   4 +-
>  include/hw/net/lan9118.h                 |   2 +-
>  include/hw/net/ne2000-isa.h              |   2 -
>  include/hw/net/smc91c111.h               |   2 +-
>  include/hw/pci/pci.h                     |   7 +-
>  include/hw/xen/xen-bus.h                 |   2 +-
>  include/hw/xen/xen-legacy-backend.h      |   1 -
>  include/net/net.h                        |  18 +--
>  net/net.c                                | 253 +++++++++++++++++++++++++------
>  system/globals.c                         |   2 -
>  tests/qtest/npcm7xx_emc-test.c           |  18 +--
>  79 files changed, 479 insertions(+), 550 deletions(-)
> 
> 
> 
> 


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5965 bytes --]

  parent reply	other threads:[~2024-01-24 13:14 UTC|newest]

Thread overview: 105+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-08 20:26 [PATCH v3 00/46] Rework matching of network devices to -nic options David Woodhouse
2024-01-08 20:26 ` [PATCH v3 01/46] net: add qemu_{configure, create}_nic_device(), qemu_find_nic_info() David Woodhouse
2024-01-26 11:10   ` Thomas Huth
2024-01-26 14:16     ` David Woodhouse
2024-01-26 14:24       ` Thomas Huth
2024-01-26 14:34         ` David Woodhouse
2024-01-26 14:39           ` Thomas Huth
2024-01-26 14:43   ` Peter Maydell
2024-01-26 15:19     ` [PATCH v3 01/46] net: add qemu_{configure,create}_nic_device(), qemu_find_nic_info() David Woodhouse
2024-01-26 15:33       ` [PATCH v3 01/46] net: add qemu_{configure, create}_nic_device(), qemu_find_nic_info() Peter Maydell
2024-01-26 15:43         ` [PATCH v3 01/46] net: add qemu_{configure,create}_nic_device(), qemu_find_nic_info() David Woodhouse
2024-01-08 20:26 ` [PATCH v3 02/46] net: report list of available models according to platform David Woodhouse
2024-01-26 14:33   ` Thomas Huth
2024-01-26 14:46     ` David Woodhouse
2024-01-26 14:50       ` Thomas Huth
2024-01-08 20:26 ` [PATCH v3 03/46] net: add qemu_create_nic_bus_devices() David Woodhouse
2024-01-26 14:41   ` Thomas Huth
2024-01-08 20:26 ` [PATCH v3 04/46] hw/pci: add pci_init_nic_devices(), pci_init_nic_in_slot() David Woodhouse
2024-01-08 20:26 ` [PATCH v3 05/46] hw/i386/pc: use qemu_get_nic_info() and pci_init_nic_devices() David Woodhouse
2024-01-26 10:43   ` Thomas Huth
2024-01-26 11:13     ` David Woodhouse
2024-01-26 11:20       ` Thomas Huth
2024-01-26 11:25         ` David Woodhouse
2024-01-26 13:45           ` Thomas Huth
2024-01-26 13:56             ` David Woodhouse
2024-01-08 20:26 ` [PATCH v3 06/46] hw/xen: use qemu_create_nic_bus_devices() to instantiate Xen NICs David Woodhouse
2024-01-08 20:26 ` [PATCH v3 07/46] hw/alpha/dp264: use pci_init_nic_devices() David Woodhouse
2024-01-26 15:28   ` Thomas Huth
2024-01-08 20:26 ` [PATCH v3 08/46] hw/arm/sbsa-ref: " David Woodhouse
2024-01-08 20:26 ` [PATCH v3 09/46] hw/arm/virt: " David Woodhouse
2024-01-26 15:30   ` Thomas Huth
2024-01-08 20:26 ` [PATCH v3 10/46] hw/hppa: " David Woodhouse
2024-01-26 15:38   ` Thomas Huth
2024-01-08 20:26 ` [PATCH v3 11/46] hw/loongarch: " David Woodhouse
2024-01-09  1:50   ` gaosong
2024-01-08 20:26 ` [PATCH v3 12/46] hw/mips/fuloong2e: " David Woodhouse
2024-01-26 13:53   ` Thomas Huth
2024-01-08 20:26 ` [PATCH v3 13/46] hw/mips/malta: " David Woodhouse
2024-01-26 13:57   ` Thomas Huth
2024-01-08 20:26 ` [PATCH v3 14/46] hw/mips/loongson3_virt: " David Woodhouse
2024-01-26 13:58   ` Thomas Huth
2024-01-08 20:26 ` [PATCH v3 15/46] hw/ppc/prep: " David Woodhouse
2024-01-26 14:06   ` Thomas Huth
2024-01-08 20:26 ` [PATCH v3 16/46] hw/ppc/spapr: use qemu_get_nic_info() and pci_init_nic_devices() David Woodhouse
2024-01-26 14:09   ` Thomas Huth
2024-01-08 20:26 ` [PATCH v3 17/46] hw/ppc: use pci_init_nic_devices() David Woodhouse
2024-01-26 14:14   ` Thomas Huth
2024-01-08 20:26 ` [PATCH v3 18/46] hw/sh4/r2d: " David Woodhouse
2024-01-08 20:26 ` [PATCH v3 19/46] hw/sparc64/sun4u: " David Woodhouse
2024-01-26 14:21   ` Thomas Huth
2024-01-08 20:26 ` [PATCH v3 20/46] hw/xtensa/virt: " David Woodhouse
2024-01-26 14:47   ` Thomas Huth
2024-01-08 20:26 ` [PATCH v3 21/46] hw/arm/allwinner: use qemu_configure_nic_device() David Woodhouse
2024-01-26 14:58   ` Thomas Huth
2024-01-08 20:26 ` [PATCH v3 22/46] hw/arm/aspeed: " David Woodhouse
2024-01-16 13:32   ` Cédric Le Goater
2024-01-08 20:26 ` [PATCH v3 23/46] hw/arm/exynos4: use qemu_create_nic_device() David Woodhouse
2024-01-26 15:01   ` Thomas Huth
2024-01-08 20:26 ` [PATCH v3 24/46] hw/arm/fsl: use qemu_configure_nic_device() David Woodhouse
2024-01-26 15:03   ` Thomas Huth
2024-01-08 20:26 ` [PATCH v3 25/46] hw/net/smc91c111: " David Woodhouse
2024-01-26 15:14   ` Thomas Huth
2024-01-26 15:37     ` David Woodhouse
2024-01-08 20:26 ` [PATCH v3 26/46] hw/net/lan9118: " David Woodhouse
2024-01-08 20:26 ` [PATCH v3 27/46] hw/arm/highbank: use qemu_create_nic_device() David Woodhouse
2024-01-26 15:48   ` Thomas Huth
2024-01-08 20:26 ` [PATCH v3 28/46] hw/arm/npcm7xx: use qemu_configure_nic_device, allow emc0/emc1 as aliases David Woodhouse
2024-01-08 20:26 ` [PATCH v3 29/46] hw/arm/stellaris: use qemu_find_nic_info() David Woodhouse
2024-01-08 20:26 ` [PATCH v3 30/46] hw/arm: use qemu_configure_nic_device() David Woodhouse
2024-01-08 20:27 ` [PATCH v3 31/46] hw/net/etraxfs-eth: " David Woodhouse
2024-01-26 16:23   ` Thomas Huth
2024-01-08 20:27 ` [PATCH v3 32/46] hw/m68k/mcf5208: use qemu_create_nic_device() David Woodhouse
2024-01-26 15:51   ` Thomas Huth
2024-01-08 20:27 ` [PATCH v3 33/46] hw/m68k/q800: use qemu_find_nic_info() David Woodhouse
2024-01-08 20:27 ` [PATCH v3 34/46] hw/microblaze: use qemu_configure_nic_device() David Woodhouse
2024-01-26 15:57   ` Thomas Huth
2024-01-08 20:27 ` [PATCH v3 35/46] hw/mips/mipssim: use qemu_create_nic_device() David Woodhouse
2024-01-26 16:20   ` Thomas Huth
2024-01-08 20:27 ` [PATCH v3 36/46] hw/mips/jazz: use qemu_find_nic_info() David Woodhouse
2024-01-26 16:29   ` Thomas Huth
2024-01-26 16:38     ` David Woodhouse
2024-01-08 20:27 ` [PATCH v3 37/46] hw/net/lasi_i82596: use qemu_configure_nic_device() David Woodhouse
2024-01-26 16:30   ` Thomas Huth
2024-01-08 20:27 ` [PATCH v3 38/46] hw/openrisc/openrisc_sim: use qemu_create_nic_device() David Woodhouse
2024-01-26 16:34   ` Thomas Huth
2024-01-08 20:27 ` [PATCH v3 39/46] hw/riscv: use qemu_configure_nic_device() David Woodhouse
2024-01-26 16:36   ` Thomas Huth
2024-01-08 20:27 ` [PATCH v3 40/46] hw/s390x/s390-virtio-ccw: use qemu_create_nic_device() David Woodhouse
2024-01-16 13:26   ` Thomas Huth
2024-01-08 20:27 ` [PATCH v3 41/46] hw/sparc/sun4m: use qemu_find_nic_info() David Woodhouse
2024-01-08 20:27 ` [PATCH v3 42/46] hw/xtensa/xtfpga: use qemu_create_nic_device() David Woodhouse
2024-01-26 16:43   ` Thomas Huth
2024-01-08 20:27 ` [PATCH v3 43/46] net: remove qemu_check_nic_model() David Woodhouse
2024-01-26 16:01   ` Thomas Huth
2024-01-08 20:27 ` [PATCH v3 44/46] hw/pci: remove pci_nic_init_nofail() David Woodhouse
2024-01-26 16:03   ` Thomas Huth
2024-01-08 20:27 ` [PATCH v3 45/46] net: remove qemu_show_nic_models(), qemu_find_nic_model() David Woodhouse
2024-01-26 16:49   ` Thomas Huth
2024-01-26 16:54     ` David Woodhouse
2024-01-08 20:27 ` [PATCH v3 46/46] net: make nb_nics and nd_table[] static in net/net.c David Woodhouse
2024-01-26 16:08   ` Thomas Huth
2024-01-24 13:13 ` David Woodhouse [this message]
2024-01-25  0:38   ` [PATCH v3 00/46] Rework matching of network devices to -nic options Jason Wang
2024-01-26 16:51     ` Thomas Huth
2024-01-28 12:37       ` 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=ec354ea42daa8c7ae8bb1fbb521db9d69e6d0fc9.camel@infradead.org \
    --to=dwmw2@infradead.org \
    --cc=jasowang@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).