Ville Syrjälä
13367132a7
drm/i915/bios: Reorder panel DTD parsing
...
Reorder things so that we can parse the entier LFP data block
in one go. For now we just stick to parsing the DTD from it.
Also fix the misleading comment about block 42 being deprecated.
Only the DTD part is deprecated, the rest is still very much needed.
v2: Move the version check+comment into parse_generic_dtd() (Jani)
Reviewed-by: Jani Nikula <jani.nikula@intel.com >
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220504150440.13748-2-ville.syrjala@linux.intel.com
2022-05-05 18:25:09 +03:00
Ville Syrjälä
bb7acf59a1
drm/i915: Use drm_mode_init() for on-stack modes
...
Initialize on-stack modes with drm_mode_init() to guarantee
no stack garbage in the list head, or that we aren't copying
over another mode's list head.
Based on the following cocci script, with manual fixups:
@decl@
identifier M;
expression E;
@@
- struct drm_display_mode M = E;
+ struct drm_display_mode M;
@@
identifier decl.M;
expression decl.E;
statement S, S1;
@@
struct drm_display_mode M;
... when != S
+ drm_mode_init(&M, &E);
+
S1
@@
expression decl.E;
@@
- &*E
+ E
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220218100403.7028-19-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com >
2022-05-05 18:23:55 +03:00
Jani Nikula
e0602d3a13
drm/i915: warn about missing ->get_buf_trans initialization
...
Make sure each DDI platform has sane ->get_buf_trans initialized.
Suggested-by: Matt Roper <matthew.d.roper@intel.com >
Cc: Matt Roper <matthew.d.roper@intel.com >
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
Reviewed-by: Arun R Murthy <arun.r.murthy@intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220503082134.4128355-1-jani.nikula@intel.com
2022-05-04 21:39:27 +03:00
Jani Nikula
c140915c00
drm/i915: move tons of power well initializers to rodata
...
Using compound literals for initialization can be tricky. Lacking a
const qualifier, they won't end up in rodata, which is probably not
expected or intended. Add const to move a whopping 136 initializers to
rodata.
Compare:
$ objdump --syms drivers/gpu/drm/i915/display/intel_display_power_map.o | grep "\.rodata.*__compound_literal"
$ objdump --syms drivers/gpu/drm/i915/display/intel_display_power_map.o | grep "\.data.*__compound_literal"
Before and after the change.
Fixes: c32ffce42a ("drm/i915: Convert the power well descriptor domain mask to an array of domains")
Fixes: 4a845ff0c0 ("drm/i915: Simplify power well definitions by adding power well instances")
Cc: Imre Deak <imre.deak@intel.com >
Cc: Jouni Högander <jouni.hogander@intel.com >
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
Reviewed-by: Imre Deak <imre.deak@intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220429142140.2671828-1-jani.nikula@intel.com
2022-05-02 11:37:10 +03:00
Jani Nikula
119125d96b
Merge tag 'gvt-next-2022-04-29' of https://github.com/intel/gvt-linux into drm-intel-next
...
gvt-next-2022-04-29
Introduce fixes from previous pull.
- Fix a compiling warning of non-static funtion only having one caller.
- Fix a potential NULL pointer reference in the code re-factor.
- Fix a compiling error when CONFIG_DRM_I915_DEBUG_RUNTIME_PM=n
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
From: "Wang, Zhi A" <zhi.a.wang@intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/9c2fc678-2e6e-a9d5-a540-2a6bfda31196@intel.com
2022-04-29 12:58:41 +03:00
Wan Jiabing
419f8299dd
i915/gvt: Fix NULL pointer dereference in init_mmio_block_handlers
...
Fix following coccicheck error:
./drivers/gpu/drm/i915/gvt/handlers.c:2925:35-41: ERROR: block is NULL but dereferenced.
Use gvt->mmio.mmio_block instead of block to avoid NULL pointer
dereference when find_mmio_block returns NULL.
Fixes: e0f74ed463 ("i915/gvt: Separate the MMIO tracking table from GVT-g")
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220427115457.836729-1-wanjiabing@vivo.com
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-28 17:06:02 -04:00
Zhi Wang
5b95b9d58f
drm/i915/gvt: Fix the compiling error when CONFIG_DRM_I915_DEBUG_RUNTIME_PM=n
...
A compiling error was reported when CONFIG_DRM_I915_DEBUG_RUNTIME_PM=n.
Fix the problem by using the pre-defined macro.
Cc: Jason Gunthorpe <jgg@nvidia.com >
Cc: Jani Nikula <jani.nikula@linux.intel.com >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220427212849.18109-2-zhi.a.wang@intel.com
Reviewed-by: Jani Nikula <jani.nikula@linux.intel.com >
2022-04-28 17:01:17 -04:00
Zhi Wang
fa630c304b
drm/i915/gvt: Make intel_gvt_match_device() static
...
After the refactor of GVT-g, the reference of intel_gvt_match_device()
only happens in handlers.c. Make it static to let the compiler be
happy.
Fixes: e0f74ed463 ("i915/gvt: Separate the MMIO tracking table from GVT-g")
Cc: Jason Gunthorpe <jgg@nvidia.com >
Cc: Jani Nikula <jani.nikula@linux.intel.com >
Cc: Robert Beckett <bob.beckett@collabora.com >
Cc: Lucas De Marchi <lucas.demarchi@intel.com >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220427212849.18109-1-zhi.a.wang@intel.com
Reviewed-by: Cc: Jani Nikula <jani.nikula@linux.intel.com >
2022-04-28 16:59:01 -04:00
Matt Roper
1bc4ae0ccb
drm/i915: Add first set of DG2 PCI IDs
...
The IDs added here are the subset reserved for 'motherboard down'
designs of DG2. We have all the necessary support upstream to enable
these now (although they'll continue to require force_probe until the
usual requirements are met).
The remaining DG2 IDs for add-in cards will come in a future patch once
some additional required functionality has fully landed.
Bspec: 44477
Cc: Lucas De Marchi <lucas.demarchi@intel.com >
Cc: Daniel Vetter <daniel@ffwll.ch >
Cc: Dave Airlie <airlied@gmail.com >
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com >
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Cc: Jani Nikula <jani.nikula@intel.com >
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com >
Signed-off-by: Matt Roper <matthew.d.roper@intel.com >
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220425211251.77154-3-matthew.d.roper@intel.com
2022-04-27 16:17:45 -07:00
Imre Deak
eddbb074ce
drm/i915/dp: Add workaround for spurious AUX timeouts/hotplugs on LTTPR links
...
To avoid AUX timeouts and subsequent spurious hotplug interrupts, make
sure that the first DPCD access during detection is a read from an LTTPR
register.
Some ADLP DP link configuration at least with multiple LTTPRs expects
the first DPCD access during the LTTPR/DPCD detection after hotplug to
be a read from the LTTPR range starting with
DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV. The side effect of
this read is to put each LTTPR into the LTTPR transparent or LTTPR
non-transparent mode.
The lack of the above read may leave some of the LTTPRs in non-LTTPR
mode, while other LTTPRs in LTTPR transparent or LTTPR non-transparent
mode (for instance LTTPRs after system suspend/resume that kept their
mode from before suspend). Due to the different AUX timeouts the
different modes imply, the DPCD access from a non-LTTPR range will
timeout and lead to an LTTPR generated hotplug towards the source (which
the LTTPR firmware uses to account for buggy TypeC adapters with a long
wake-up delay).
SYSCROS: 72939
v2: Keep DPCD read-out working on non-LTTPR platforms.
v3: Summarize what and why the patch does at the beginning of the commit
log. (Jani)
Signed-off-by: Imre Deak <imre.deak@intel.com >
Reviewed-by: Jani Nikula <jani.nikula@intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220408224629.845887-1-imre.deak@intel.com
2022-04-27 09:52:40 +03:00
Jani Nikula
3e8d34ed49
Merge drm/drm-next into drm-intel-next
...
Need to bring commit d8bb92e70a ("drm/dp: Factor out a function to
probe a DPCD address") back as a dependency to further work in
drm-intel-next.
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
2022-04-26 16:44:31 +03:00
Jani Nikula
f08699ec5b
Merge tag 'gvt-next-2022-04-26' of https://github.com/intel/gvt-linux into drm-intel-next
...
gvt-next-2022-04-26
- Add two missing exports of symbols when i915 debug is enabled
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
From: "Wang, Zhi A" <zhi.a.wang@intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/c5cf6773-e7a2-8ba8-4cde-0bb14007bc6b@intel.com
2022-04-26 11:29:31 +03:00
Zhi Wang
5e9ae5c470
drm/i915/gvt: Add missing symbol export.
...
When CONFIG_DRM_I915_DEBUG_RUNTIME and CONFIG_DRM_I915_DEBUG_PM
are enabled, two more extra symols in i915 are required to be
exported.
Cc: Jani Nikula <jani.nikula@intel.com >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220425220331.24865-1-zhi.a.wang@intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com >
2022-04-26 04:18:43 -04:00
Ville Syrjälä
a8e85faaa5
drm/i915: Add crtc .crtc_get_shared_dpll()
...
Start splitting the .compute_crtc_clock() into two parts; one
part does the computation, the second part does the shared dpll
assignment. I want to move the actual computation part much earlier
into the compute_config() phase.
v2: dg2_crtc_get_shared_dpll() not needed (Jani)
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220325123205.22140-10-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com >
2022-04-25 21:15:12 +03:00
Ville Syrjälä
3bb9e25767
drm/i915: Split out dg2_crtc_compute_clock()
...
DG2 doesn't currently used the shared_dpll stuff so let's just
split it out from hsw_crtc_compute_clock() entirely.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220325123205.22140-9-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com >
2022-04-25 21:06:59 +03:00
Ville Syrjälä
e2f5f399af
drm/i915: Clear the dpll_hw_state when disabling a pipe
...
Clear the dpll_hw_state when we're about disable the pipe.
Previously it looks like we just left the old junk in there.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220325123205.22140-8-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com >
2022-04-25 21:06:47 +03:00
Ville Syrjälä
ad3da340f9
drm/i915: Move the dpll_hw_state clearing to intel_dpll_crtc_compute_clock()
...
All .crtc_compute_clock() implementations do the same memset() to
clear the dpll_hw_state (since we preserve it across
intel_crtc_prepare_cleared_state()). Move the memset() to the common
wrapper.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220325123205.22140-7-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com >
2022-04-25 21:06:22 +03:00
Ville Syrjälä
155a27172f
drm/i915: Move stuff into intel_dpll_crtc_compute_clock()
...
Move some checks into intel_dpll_crtc_compute_clock() from the
caller. Avoids the caller from having to worry about all this
crap.
We'll also reorder the hw.enable vs. shared_dpll checks since
it makes sense to sanity check that we've cleared out the
old shared_dpll even if the pipe is getting disabled.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220325123205.22140-6-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com >
2022-04-25 21:06:12 +03:00
Ville Syrjälä
7275f630d8
drm/i915: Adjust .crtc_compute_clock() calling convention
...
Pass the full atomic state+crtc rather than the redundant
crtc+crtc_state pair. We already need the full atomic state
in the hsw+ codepath anyway.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220325123205.22140-5-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com >
2022-04-25 21:04:29 +03:00
Ville Syrjälä
e87ba18b4c
drm/i915: Remove pointless dpll_funcs checks
...
All platforms have dpll_funcs. Remove the pointless NULL checks.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220325123205.22140-4-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com >
2022-04-25 21:04:13 +03:00
Ville Syrjälä
8e272b3af3
drm/i915: Pass dev_priv to intel_shared_dpll_init()
...
Stop passing around the drm_device and just pass the
dev_priv instead.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220325123205.22140-3-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com >
2022-04-25 21:04:02 +03:00
Ville Syrjälä
9274229af2
drm/i915: Make .get_dplls() return int
...
Get rid of the confusing back and forth between bools and ints
in the .get_dplls() stuff. Just make everything return an int.
Initial conversion done with cocci, with some manual fixups on top:
@find@
identifier func !~ "get_hw_state|_is_|needed";
typedef bool;
parameter list[N] P;
@@
- bool
+ int
func(P)
{
<...
(
- return true;
+ return 0;
|
- return false;
+ return -EINVAL;
)
...>
}
@@
identifier find.func;
expression list[find.N] E;
expression X;
@@
- if (!func(E))
+ ret = func(E);
+ if (ret)
{
...
- return X;
+ return ret;
}
@@
identifier find.func;
expression X;
expression list[find.N] E;
@@
- if (!func(E))
+ ret = func(E);
+ if (ret)
- return X;
+ return ret;
@@
identifier find.func;
expression list[find.N] E;
expression O, X;
typedef bool;
bool B;
@@
- B = func(E);
- if (O && !B)
+ if (O) {
+ ret = func(E);
+ if (ret)
- return X;
+ return ret;
+ }
@@
identifier find.func;
expression list[find.N] E;
expression O, X;
@@
- if (O && !func(E))
+ if (O) {
+ ret = func(E);
+ if (ret)
- return X;
+ return ret;
+ }
@@
identifier find.func;
expression list[find.N] E;
expression X;
typedef bool;
bool B;
@@
- B = func(E);
- if (!B)
+ ret = func(E);
+ if (ret)
{
...
- return X;
+ return ret;
}
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220325123205.22140-2-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com >
2022-04-25 21:03:15 +03:00
Ville Syrjälä
14eb76f73e
drm/i915/fbc: s/false/0/
...
intel_fbc_check_plane() is supposed to an int, not a boolean.
So replace the bogus 'return false's with the correct 'return 0's.
These were accidental copy-paste mistakes when the code got moved
into intel_fbc_check_plane() from somewhere else tht did return
a boolean.
No functional issue here since false==0.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220413152852.7336-2-ville.syrjala@linux.intel.com
Reviewed-by: Manasi Navare <manasi.d.navare@intel.com >
2022-04-25 18:48:03 +03:00
Ville Syrjälä
3e1faae339
drm/i915/fbc: Consult hw.crtc instead of uapi.crtc
...
plane_state->uapi.crtc is not what we want to be looking at.
If bigjoiner is used hw.crtc is what tells us what crtc the plane
is supposedly using.
Not an actual problem on current hardware as the only FBC capable
pipe (A) can't be a bigjoiner slave and thus uapi.crtc==hw.crtc
always here. But when we get more FBC instances this will become
actually important.
Fixes: 2e6c99f886 ("drm/i915/fbc: Nuke lots of crap from intel_fbc_state_cache")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220413152852.7336-1-ville.syrjala@linux.intel.com
Reviewed-by: Manasi Navare <manasi.d.navare@intel.com >
2022-04-25 18:47:50 +03:00
Imre Deak
af2cbc6ef9
drm/i915: Fix SEL_FETCH_PLANE_*(PIPE_B+) register addresses
...
Fix typo in the _SEL_FETCH_PLANE_BASE_1_B register base address.
Fixes: a5523e2ff0 ("drm/i915: Add PSR2 selective fetch registers")
References: https://gitlab.freedesktop.org/drm/intel/-/issues/5400
Cc: José Roberto de Souza <jose.souza@intel.com >
Cc: <stable@vger.kernel.org > # v5.9+
Signed-off-by: Imre Deak <imre.deak@intel.com >
Reviewed-by: José Roberto de Souza <jose.souza@intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220421162221.2261895-1-imre.deak@intel.com
2022-04-25 14:45:33 +03:00
Jani Nikula
1e1d2e1853
Merge tag 'gvt-next-2022-04-21-for-christoph' of https://github.com/intel/gvt-linux into drm-intel-next
...
gvt-next-2022-04-21-for-christoph
- Separating the MMIO table from GVT-g. (Zhi)
- GVT-g re-factor. (Christoph)
- GVT-g mdev API cleanup. (Jason)
- GVT-g trace/makefile cleanup. (Jani)
[Jani: added #include to adapt to header refactoring in drm-intel-next]
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
From: "Wang, Zhi A" <zhi.a.wang@intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/25a713cd-0b7d-4c09-7d91-4f4ef6c9eb11@intel.com
2022-04-25 11:20:57 +03:00
Dave Airlie
19df0cfa25
Merge tag 'drm-misc-next-2022-04-21' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
...
drm-misc-next for 5.19-rc1
UAPI Changes:
Cross-subsystem Changes:
- of: Create a platform_device for offb
Core Changes:
- edid: block read refactoring
- ttm: Add common debugfs code for resource managers
Driver Changes:
- bridges:
- adv7611: Enable DRM_BRIDGE_OP_HPD if there's an interrupt
- anx7625: Fill ELD if no monitor is connected
- dw_hdmi: Add General Parallel Audio support
- icn6211: Add data-lanes DT property
- new driver: Lontium LT9211
- nouveau: make some structures static
- tidss: Reset DISPC on startup
- solomon: SPI Support and DT bindings improvements
Signed-off-by: Dave Airlie <airlied@redhat.com >
From: Maxime Ripard <maxime@cerno.tech >
Link: https://patchwork.freedesktop.org/patch/msgid/20220421065948.2pyp3j7acxtl6pz5@houat
2022-04-22 11:15:30 +10:00
Jouni Högander
b4b157577c
drm/i915: Check EDID for HDR static metadata when choosing blc
...
We have now seen panel (XMG Core 15 e21 laptop) advertizing support
for Intel proprietary eDP backlight control via DPCD registers, but
actually working only with legacy pwm control.
This patch adds panel EDID check for possible HDR static metadata and
Intel proprietary eDP backlight control is used only if that exists.
Missing HDR static metadata is ignored if user specifically asks for
Intel proprietary eDP backlight control via enable_dpcd_backlight
parameter.
v2 :
- Ignore missing HDR static metadata if Intel proprietary eDP
backlight control is forced via i915.enable_dpcd_backlight
- Printout info message if panel is missing HDR static metadata and
support for Intel proprietary eDP backlight control is detected
Fixes: 4a8d79901d ("drm/i915/dp: Enable Intel's HDR backlight interface (only SDR for now)")
Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/5284
Cc: Lyude Paul <lyude@redhat.com >
Cc: Mika Kahola <mika.kahola@intel.com >
Cc: Jani Nikula <jani.nikula@intel.com >
Cc: Filippo Falezza <filippo.falezza@outlook.it >
Cc: stable@vger.kernel.org
Signed-off-by: Jouni Högander <jouni.hogander@intel.com >
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20220413082826.120634-1-jouni.hogander@intel.com
Reviewed-by: Lyude Paul <lyude@redhat.com >
2022-04-21 16:57:01 +03:00
Jason Gunthorpe
2917f53113
vfio/mdev: Remove mdev drvdata
...
This is no longer used, remove it.
All usages were moved over to either use container_of() from a vfio_device
or to use dev_drvdata() directly on the mdev.
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com >
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-35-hch@lst.de
Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com >
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-21 07:36:56 -04:00
Jason Gunthorpe
2aa72ec97c
vfio/mdev: Use the driver core to create the 'remove' file
...
The device creator is supposed to use the dev.groups value to add sysfs
files before device_add is called, not call sysfs_create_files() after
device_add() returns. This creates a race with uevent delivery where the
extra attribute will not be visible.
This was being done because the groups had been co-opted by the mdev
driver, now that prior patches have moved the driver's groups to the
struct device_driver the dev.group is properly free for use here.
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com >
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-34-hch@lst.de
Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com >
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-21 07:36:56 -04:00
Jason Gunthorpe
6b42f491e1
vfio/mdev: Remove mdev_parent_ops
...
The last useful member in this struct is the supported_type_groups, move
it to the mdev_driver and delete mdev_parent_ops.
Replace it with mdev_driver as an argument to mdev_register_device()
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com >
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-33-hch@lst.de
Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com >
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-21 07:36:56 -04:00
Jason Gunthorpe
e6486939d8
vfio/mdev: Remove mdev_parent_ops dev_attr_groups
...
This is only used by one sample to print a fixed string that is pointless.
In general, having a device driver attach sysfs attributes to the parent
is horrific. This should never happen, and always leads to some kind of
liftime bug as it become very difficult for the sysfs attribute to go back
to any data owned by the device driver.
Remove the general mechanism to create this abuse.
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com >
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-32-hch@lst.de
Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com >
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-21 07:36:56 -04:00
Jason Gunthorpe
6c7f98b334
vfio/mdev: Remove vfio_mdev.c
...
Now that all mdev drivers directly create their own mdev_device driver and
directly register with the vfio core's vfio_device_ops this is all dead
code.
Delete vfio_mdev.c and the mdev_parent_ops members that are connected to
it.
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com >
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-31-hch@lst.de
Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com >
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-21 07:36:56 -04:00
Christoph Hellwig
cba619cb0d
drm/i915/gvt: merge gvt.c into kvmgvt.c
...
The code in both files is deeply interconnected, so merge it and
keep a bunch of structures and functions static.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-30-hch@lst.de
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-21 07:36:56 -04:00
Christoph Hellwig
978cf586ac
drm/i915/gvt: convert to use vfio_register_emulated_iommu_dev
...
This is straightforward conversion, the intel_vgpu already has a pointer
to the vfio_dev, which can be replaced with the embedded structure and
we can replace all the mdev_get_drvdata() with a simple container_of().
Based on an patch from Jason Gunthorpe.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-29-hch@lst.de
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-21 07:36:56 -04:00
Christoph Hellwig
0e09f4066a
drm/i915/gvt: remove kvmgt_guest_{init,exit}
...
Merge these into their only callers.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-28-hch@lst.de
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-21 07:36:56 -04:00
Christoph Hellwig
7f11e6893f
drm/i915/gvt: pass a struct intel_vgpu to the vfio read/write helpers
...
Pass the structure we actually care about instead of deriving it from
the mdev_device in the lower level code.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-27-hch@lst.de
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-21 07:36:56 -04:00
Christoph Hellwig
4456641232
drm/i915/gvt: streamline intel_vgpu_create
...
Initialize variables at declaration time, avoid pointless gotos and
cater for the fact that intel_gvt_create_vgpu can't return NULL.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-26-hch@lst.de
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-21 07:36:56 -04:00
Christoph Hellwig
37e4bdbd5b
drm/i915/gvt: remove the extra vfio_device refcounting for dmabufs
...
All the dmabufs are torn down when th VGPU is released, so there is
no need for extra refcounting here.
Based on an patch from Jason Gunthorpe.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-25-hch@lst.de
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-21 07:36:56 -04:00
Christoph Hellwig
5f8f3fe67c
drm/i915/gvt: remove struct intel_gvt_mpt
...
Just call the initializion and exit functions directly and remove
this abstraction entirely.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-24-hch@lst.de
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-21 07:36:56 -04:00
Christoph Hellwig
91879bbaf8
drm/i915/gvt: devirtualize dma_pin_guest_page
...
Just call the function directly and remove a pointless wrapper.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-23-hch@lst.de
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-21 07:36:56 -04:00
Christoph Hellwig
8398eee85f
drm/i915/gvt: devirtualize ->dma_{,un}map_guest_page
...
Just call the functions directly. Also remove a pointless wrapper.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-22-hch@lst.de
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-21 07:36:56 -04:00
Christoph Hellwig
4c2baaaf76
drm/i915/gvt: devirtualize ->{enable,disable}_page_track
...
Just call the kvmgt functions directly.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-21-hch@lst.de
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-21 07:36:56 -04:00
Christoph Hellwig
4050dab598
drm/i915/gvt: devirtualize ->gfn_to_mfn
...
Just open code it in the only caller.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-20-hch@lst.de
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-21 07:36:56 -04:00
Christoph Hellwig
bd73b4b193
drm/i915/gvt: devirtualize ->is_valid_gfn
...
Just call the code directly and move towards the callers.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-19-hch@lst.de
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-21 07:36:56 -04:00
Christoph Hellwig
b3bece3495
drm/i915/gvt: devirtualize ->inject_msi
...
Just open code the MSI injection in a single place instead of going
through the method table.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-18-hch@lst.de
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-21 07:36:56 -04:00
Christoph Hellwig
4c705ad0d7
drm/i915/gvt: devirtualize ->detach_vgpu
...
Just call the function directly.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-17-hch@lst.de
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-21 07:36:56 -04:00
Christoph Hellwig
f9399b0e4a
drm/i915/gvt: devirtualize ->set_edid and ->set_opregion
...
Just call the code to setup the opregions and EDID data directly.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-16-hch@lst.de
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-21 07:36:56 -04:00
Christoph Hellwig
fe902f0ce6
drm/i915/gvt: devirtualize ->{get,put}_vfio_device
...
Just open code the calls to the VFIO APIs.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-15-hch@lst.de
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-21 07:36:56 -04:00
Christoph Hellwig
e3d7640eee
drm/i915/gvt: devirtualize ->{read,write}_gpa
...
Just call the VFIO functions directly instead of through the method
table.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Signed-off-by: Zhi Wang <zhi.a.wang@intel.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20220411141403.86980-14-hch@lst.de
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com >
Reviewed-by: Zhi Wang <zhi.a.wang@intel.com >
2022-04-21 07:36:56 -04:00