From: "Michael S. Tsirkin" <mst@redhat.com>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: qemu-devel@nongnu.org, lersek@redhat.com, marcel@redhat.com,
armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/2] pci: allow DeviceClass fw_name to override pci_dev_fw_name() if set
Date: Sun, 24 Jun 2018 06:55:24 +0300 [thread overview]
Message-ID: <20180624065424-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20180623085028.29553-3-mark.cave-ayland@ilande.co.uk>
On Sat, Jun 23, 2018 at 09:50:28AM +0100, Mark Cave-Ayland wrote:
> The current implementation of pci_dev_fw_name() scans through a fixed
> set of PCI class descriptions to determine the firmware device name
> but in some cases this isn't always appropriate, for example with
> the macio device which uses a class code of 0xff (unassigned).
>
> Rather than add a new entry for the macio device and risk a potential
> clash with another unassigned device later, add a check to
> pcibus_get_fw_dev_path() that will use DeviceClass fw_name if set in
> preference to pci_dev_fw_name().
>
> This enables PCI devices such as macio to set dc->fw_name as required
> to match the name specified in the firmware.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Do we know no existing pci device sets this?
> ---
> hw/pci/pci.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index 80bc45930d..126dd683dc 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -2411,12 +2411,14 @@ static char *pci_dev_fw_name(DeviceState *dev, char *buf, int len)
>
> static char *pcibus_get_fw_dev_path(DeviceState *dev)
> {
> + DeviceClass *dc = DEVICE_GET_CLASS(dev);
> PCIDevice *d = (PCIDevice *)dev;
> char path[50], name[33];
> int off;
>
> off = snprintf(path, sizeof(path), "%s@%x",
> - pci_dev_fw_name(dev, name, sizeof name),
> + dc->fw_name ? dc->fw_name :
> + pci_dev_fw_name(dev, name, sizeof name),
> PCI_SLOT(d->devfn));
> if (PCI_FUNC(d->devfn))
> snprintf(path + off, sizeof(path) + off, ",%x", PCI_FUNC(d->devfn));
> --
> 2.11.0
next prev parent reply other threads:[~2018-06-24 3:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-23 8:50 [Qemu-devel] [PATCH 0/2] sysbus/pci: allow better customisation of firmware device paths Mark Cave-Ayland
2018-06-23 8:50 ` [Qemu-devel] [PATCH 1/2] sysbus: always allow explicit_ofw_unit_address() to override address generation Mark Cave-Ayland
2018-06-25 7:32 ` Laszlo Ersek
2018-06-27 19:59 ` Mark Cave-Ayland
2018-06-28 9:35 ` Laszlo Ersek
2018-06-23 8:50 ` [Qemu-devel] [PATCH 2/2] pci: allow DeviceClass fw_name to override pci_dev_fw_name() if set Mark Cave-Ayland
2018-06-23 20:19 ` Philippe Mathieu-Daudé
2018-06-24 3:55 ` Michael S. Tsirkin [this message]
2018-06-24 9:38 ` Mark Cave-Ayland
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=20180624065424-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=armbru@redhat.com \
--cc=lersek@redhat.com \
--cc=marcel@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.