From: "Michael S. Tsirkin" <mst@redhat.com>
To: Mike Nawrocki <michael.nawrocki@gtri.gatech.edu>
Cc: qemu-devel@nongnu.org, jasowang@redhat.com, marcel@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 2/2] Add new PCI ID for i82559a
Date: Tue, 7 Nov 2017 18:12:46 +0200 [thread overview]
Message-ID: <20171107181002-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20171106203520.7880-3-michael.nawrocki@gtri.gatech.edu>
On Mon, Nov 06, 2017 at 03:35:20PM -0500, Mike Nawrocki wrote:
> Adds a new PCI ID for the i82559a (0x8086 0x1030) interface. Enables
> this ID with a new property "use-alt-device-id" to preserve
> compatibility.
>
> Signed-off-by: Mike Nawrocki <michael.nawrocki@gtri.gatech.edu>
> ---
> hw/net/eepro100.c | 12 ++++++++++++
> include/hw/pci/pci.h | 1 +
> qemu-options.hx | 2 +-
> 3 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c
> index 91dd058010..66f2d2b9e7 100644
> --- a/hw/net/eepro100.c
> +++ b/hw/net/eepro100.c
> @@ -132,6 +132,7 @@ typedef struct {
> const char *name;
> const char *desc;
> uint16_t device_id;
> + uint16_t alt_device_id;
> uint8_t revision;
> uint16_t subsystem_vendor_id;
> uint16_t subsystem_id;
> @@ -276,6 +277,7 @@ typedef struct {
> /* Quasi static device properties (no need to save them). */
> uint16_t stats_size;
> bool has_extended_tcb_support;
> + bool use_alt_device_id;
> } EEPRO100State;
>
> /* Word indices in EEPROM. */
> @@ -1855,6 +1857,14 @@ static void e100_nic_realize(PCIDevice *pci_dev, Error **errp)
>
> TRACE(OTHER, logout("\n"));
>
> + /* By default, the i82559a adapter uses the legacy PCI ID (for the
> + * i82557). This allows the PCI ID to be changed to the alternate
> + * i82559 ID if needed.
> + */
> + if (s->use_alt_device_id) {
> + pci_config_set_device_id(s->dev.config, info->alt_device_id);
> + }
> +
> s->device = info->device;
>
> e100_pci_reset(s, &local_err);
> @@ -1974,6 +1984,7 @@ static E100PCIDeviceInfo e100_devices[] = {
> .desc = "Intel i82559A Ethernet",
> .device = i82559A,
> .device_id = PCI_DEVICE_ID_INTEL_82557,
> + .alt_device_id = PCI_DEVICE_ID_INTEL_82559,
> .revision = 0x06,
> .stats_size = 80,
> .has_extended_tcb_support = true,
> @@ -2067,6 +2078,7 @@ static E100PCIDeviceInfo *eepro100_get_class(EEPRO100State *s)
>
> static Property e100_properties[] = {
> DEFINE_NIC_PROPERTIES(EEPRO100State, conf),
> + DEFINE_PROP_BOOL("use-alt-device-id", EEPRO100State, use_alt_device_id, 0),
0 -> false
> DEFINE_PROP_END_OF_LIST(),
> };
>
Do I understand it correctly that the only reason we really
want it enabled by default, you only set it to 0 for
compatibility?
If yes there's a way to keep it enabled by default:
- add x- in front of the property, set to true by default,
then tweak it to false in include/hw/compat.h
> diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
> index 8d02a0a383..f30e2cfb72 100644
> --- a/include/hw/pci/pci.h
> +++ b/include/hw/pci/pci.h
> @@ -70,6 +70,7 @@ extern bool pci_available;
> /* Intel (0x8086) */
> #define PCI_DEVICE_ID_INTEL_82551IT 0x1209
> #define PCI_DEVICE_ID_INTEL_82557 0x1229
> +#define PCI_DEVICE_ID_INTEL_82559 0x1030
> #define PCI_DEVICE_ID_INTEL_82801IR 0x2922
>
> /* Red Hat / Qumranet (for QEMU) -- see pci-ids.txt */
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 3728e9b4dd..a39c7e44b3 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -2047,7 +2047,7 @@ that the card should have; this option currently only affects virtio cards; set
> @var{v} = 0 to disable MSI-X. If no @option{-net} option is specified, a single
> NIC is created. QEMU can emulate several different models of network card.
> Valid values for @var{type} are
> -@code{virtio}, @code{i82551}, @code{i82557b}, @code{i82559er},
> +@code{virtio}, @code{i82551}, @code{i82557b}, @code{i82559a}, @code{i82559er},
> @code{ne2k_pci}, @code{ne2k_isa}, @code{pcnet}, @code{rtl8139},
> @code{e1000}, @code{smc91c111}, @code{lance} and @code{mcf_fec}.
> Not all devices are supported on all targets. Use @code{-net nic,model=help}
> --
> 2.14.2
next prev parent reply other threads:[~2017-11-07 16:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-06 20:35 [Qemu-devel] [PATCH v2 0/2] Fix eepro100 simple transmission, add i82559 PCI ID Mike Nawrocki
2017-11-06 20:35 ` [Qemu-devel] [PATCH v2 1/2] Fix eepro100 simple transmission mode Mike Nawrocki
2017-11-16 16:59 ` Thomas Huth
2017-11-16 17:43 ` Thomas Huth
2017-11-16 18:09 ` Michael Nawrocki
2017-11-06 20:35 ` [Qemu-devel] [PATCH v2 2/2] Add new PCI ID for i82559a Mike Nawrocki
2017-11-07 16:12 ` Michael S. Tsirkin [this message]
2017-11-07 18:25 ` Michael Nawrocki
2017-11-14 21:41 ` Stefan Weil
2017-11-15 11:20 ` Jason Wang
2017-11-15 13:09 ` Michael Nawrocki
2017-11-16 2:33 ` Jason Wang
2017-11-16 6:40 ` Stefan Weil
2017-11-16 8:59 ` Jason Wang
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=20171107181002-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=jasowang@redhat.com \
--cc=marcel@redhat.com \
--cc=michael.nawrocki@gtri.gatech.edu \
--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).