From: David Airlie <airlied@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: dri-devel <dri-devel@lists.freedesktop.org>,
Frediano Ziglio <fziglio@redhat.com>
Subject: Re: [PATCH v2] drm/qxl: get vga ioports
Date: Thu, 22 Aug 2019 18:03:56 +1000 [thread overview]
Message-ID: <CAMwc25qp-M4peWqRLr79X0=moJkctXiFovmss9_z1xVBo7hxoA@mail.gmail.com> (raw)
In-Reply-To: <20190822065905.pl6waewl43zlcv7i@sirius.home.kraxel.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
On Thu, Aug 22, 2019 at 4:59 PM Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> On Mon, Aug 05, 2019 at 12:54:01PM +0200, Gerd Hoffmann wrote:
> > qxl has two modes: "native" (used by the drm driver) and "vga" (vga
> > compatibility mode, typically used for boot display and firmware
> > framebuffers).
> >
> > Accessing any vga ioport will switch the qxl device into vga mode.
> > The qxl driver never does that, but other drivers accessing vga ports
> > can trigger that too and therefore disturb qxl operation. So aquire
> > the legacy vga ioports from vgaarb to avoid that.
> >
> > Reproducer: Boot kvm guest with both qxl and i915 vgpu, with qxl being
> > first in pci scan order.
> >
> > v2: Skip this for secondary qxl cards which don't have vga mode in the
> > first place (Frediano).
>
> Ping, any chance for an ack?
>
> thanks,
> Gerd
>
> >
> > Cc: Frediano Ziglio <fziglio@redhat.com>
> > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > ---
> > drivers/gpu/drm/qxl/qxl_drv.c | 20 +++++++++++++++++++-
> > 1 file changed, 19 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c
> > index b57a37543613..fcb48ac60598 100644
> > --- a/drivers/gpu/drm/qxl/qxl_drv.c
> > +++ b/drivers/gpu/drm/qxl/qxl_drv.c
> > @@ -63,6 +63,11 @@ module_param_named(num_heads, qxl_num_crtc, int, 0400);
> > static struct drm_driver qxl_driver;
> > static struct pci_driver qxl_pci_driver;
> >
> > +static bool is_vga(struct pci_dev *pdev)
> > +{
> > + return pdev->class == PCI_CLASS_DISPLAY_VGA << 8;
> > +}
> > +
> > static int
> > qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> > {
> > @@ -87,9 +92,17 @@ qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> > if (ret)
> > goto disable_pci;
> >
> > + if (is_vga(pdev)) {
> > + ret = vga_get_interruptible(pdev, VGA_RSRC_LEGACY_IO);
> > + if (ret) {
> > + DRM_ERROR("can't get legacy vga ioports\n");
> > + goto disable_pci;
> > + }
> > + }
> > +
> > ret = qxl_device_init(qdev, &qxl_driver, pdev);
> > if (ret)
> > - goto disable_pci;
> > + goto put_vga;
> >
> > ret = qxl_modeset_init(qdev);
> > if (ret)
> > @@ -109,6 +122,9 @@ qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> > qxl_modeset_fini(qdev);
> > unload:
> > qxl_device_fini(qdev);
> > +put_vga:
> > + if (is_vga(pdev))
> > + vga_put(pdev, VGA_RSRC_LEGACY_IO);
> > disable_pci:
> > pci_disable_device(pdev);
> > free_dev:
> > @@ -126,6 +142,8 @@ qxl_pci_remove(struct pci_dev *pdev)
> >
> > qxl_modeset_fini(qdev);
> > qxl_device_fini(qdev);
> > + if (is_vga(pdev))
> > + vga_put(pdev, VGA_RSRC_LEGACY_IO);
> >
> > dev->dev_private = NULL;
> > kfree(qdev);
> > --
> > 2.18.1
> >
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-08-22 8:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-05 10:54 [PATCH v2] drm/qxl: get vga ioports Gerd Hoffmann
2019-08-22 6:59 ` Gerd Hoffmann
2019-08-22 8:03 ` David Airlie [this message]
2019-09-11 15:40 ` Frediano Ziglio
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='CAMwc25qp-M4peWqRLr79X0=moJkctXiFovmss9_z1xVBo7hxoA@mail.gmail.com' \
--to=airlied@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=fziglio@redhat.com \
--cc=kraxel@redhat.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).