From: Thomas Hellstrom <thellstrom@vmware.com>
To: "dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
Linux-graphics-maintainer <Linux-graphics-maintainer@vmware.com>,
"Christian.Koenig@amd.com" <Christian.Koenig@amd.com>
Subject: Re: [PATCH 1/2] drm/ttm: Implement and export ttm_dma_page_alloc_enabled
Date: Mon, 28 Jan 2019 14:21:07 +0000 [thread overview]
Message-ID: <bea86173cd50bffe0c3c7a305b86bb4b8112d41b.camel@vmware.com> (raw)
In-Reply-To: <a74a5192b6be6be488fa1d5ee88b779933b12de3.camel@vmware.com>
On Mon, 2019-01-28 at 14:29 +0100, Thomas Hellström wrote:
> Hi,
>
> On Mon, 2019-01-28 at 12:21 +0000, Koenig, Christian wrote:
> > Am 25.01.19 um 14:05 schrieb Thomas Hellstrom:
> > > The vmwgfx driver needs to know whether the dma page pool is
> > > enabled
> > > to determine whether to refuse loading if the dma mode logic
> > > requests coherent memory from the dma page pool.
> > >
> > > Cc: "Koenig, Christian" <Christian.Koenig@amd.com>
> > > Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
> > > ---
> > > drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 11 +++++++++++
> > > include/drm/ttm/ttm_page_alloc.h | 4 ++++
> > > 2 files changed, 15 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
> > > b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
> > > index d594f7520b7b..adf8cc189ecc 100644
> > > --- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
> > > +++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
> > > @@ -1235,4 +1235,15 @@ int ttm_dma_page_alloc_debugfs(struct
> > > seq_file *m, void *data)
> > > }
> > > EXPORT_SYMBOL_GPL(ttm_dma_page_alloc_debugfs);
> > >
> > > +/**
> > > + * ttm_dma_page_alloc_enabled - Is the dma page pool enabled?
> > > + *
> > > + * Returns true if the dma page pool is enabled. false
> > > otherwise.
> > > + */
> > > +bool ttm_dma_page_alloc_enabled(void)
> > > +{
> > > + return !!_manager;
> > > +}
> > > +EXPORT_SYMBOL(ttm_dma_page_alloc_enabled);
> > > +
> >
> > This is completely superfluous cause the manager is enabled as soon
> > as
> > it is compiled in.
> >
> > You could just use "#if defined(CONFIG_SWIOTLB) ||
> > defined(CONFIG_INTEL_IOMMU)" instead.
> >
> > Christian.
> >
>
> Yes, that's what was done before in vmgwfx, but it's very fragile and
> based on assumptions about what various parts of TTM does and doesn't
> do. Chances are somebody would modify the enablement and forget to
> modify this function.
>
> But of course I can change it if you think that'd be better.
>
> /Thomas
>
What about
static inline bool ttm_dma_page_alloc_enabled(void)
{
return (IS_ENABLED(CONFIG_INTEL_IOMMU) ||
IS_ENABLED(CONFIG_SWIOTLB)) && _manager;
}
to avoid that layering violation?
/Thomas
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-01-28 14:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-25 13:05 [PATCH 1/2] drm/ttm: Implement and export ttm_dma_page_alloc_enabled Thomas Hellstrom
2019-01-25 13:05 ` [PATCH 2/2] drm/vmwgfx: Use ttm_dma_page_alloc_enabled Thomas Hellstrom
2019-01-25 18:22 ` Sam Ravnborg
2019-01-30 8:37 ` Thomas Hellstrom
2019-01-28 12:21 ` [PATCH 1/2] drm/ttm: Implement and export ttm_dma_page_alloc_enabled Koenig, Christian
2019-01-28 13:29 ` Thomas Hellstrom
2019-01-28 14:21 ` Thomas Hellstrom [this message]
2019-01-28 15:56 ` Koenig, Christian
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=bea86173cd50bffe0c3c7a305b86bb4b8112d41b.camel@vmware.com \
--to=thellstrom@vmware.com \
--cc=Christian.Koenig@amd.com \
--cc=Linux-graphics-maintainer@vmware.com \
--cc=dri-devel@lists.freedesktop.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