linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Zhenyu Wang <zhenyuw@linux.intel.com>,
	Colin Xu <colin.xu@intel.com>
Subject: [PATCH 4.19 48/81] drm/i915/gvt: Init DPLL/DDI vreg for virtual display instead of inheritance.
Date: Tue, 26 May 2020 20:53:23 +0200	[thread overview]
Message-ID: <20200526183932.535281956@linuxfoundation.org> (raw)
In-Reply-To: <20200526183923.108515292@linuxfoundation.org>

From: Colin Xu <colin.xu@intel.com>

commit f965b68188ab59a40a421ced1b05a2fea638465c upstream.

Init value of some display vregs rea inherited from host pregs. When
host display in different status, i.e. all monitors unpluged, different
display configurations, etc., GVT virtual display setup don't consistent
thus may lead to guest driver consider display goes malfunctional.

The added init vreg values are based on PRMs and fixed by calcuation
from current configuration (only PIPE_A) and the virtual EDID.

Fixes: 04d348ae3f0a ("drm/i915/gvt: vGPU display virtualization")
Acked-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Colin Xu <colin.xu@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200508060506.216250-1-colin.xu@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/i915/gvt/display.c |   49 +++++++++++++++++++++++++++++++++----
 1 file changed, 44 insertions(+), 5 deletions(-)

--- a/drivers/gpu/drm/i915/gvt/display.c
+++ b/drivers/gpu/drm/i915/gvt/display.c
@@ -206,14 +206,41 @@ static void emulate_monitor_status_chang
 				SKL_FUSE_PG_DIST_STATUS(SKL_PG0) |
 				SKL_FUSE_PG_DIST_STATUS(SKL_PG1) |
 				SKL_FUSE_PG_DIST_STATUS(SKL_PG2);
-		vgpu_vreg_t(vgpu, LCPLL1_CTL) |=
-				LCPLL_PLL_ENABLE |
-				LCPLL_PLL_LOCK;
-		vgpu_vreg_t(vgpu, LCPLL2_CTL) |= LCPLL_PLL_ENABLE;
-
+		/*
+		 * Only 1 PIPE enabled in current vGPU display and PIPE_A is
+		 *  tied to TRANSCODER_A in HW, so it's safe to assume PIPE_A,
+		 *   TRANSCODER_A can be enabled. PORT_x depends on the input of
+		 *   setup_virtual_dp_monitor, we can bind DPLL0 to any PORT_x
+		 *   so we fixed to DPLL0 here.
+		 * Setup DPLL0: DP link clk 1620 MHz, non SSC, DP Mode
+		 */
+		vgpu_vreg_t(vgpu, DPLL_CTRL1) =
+			DPLL_CTRL1_OVERRIDE(DPLL_ID_SKL_DPLL0);
+		vgpu_vreg_t(vgpu, DPLL_CTRL1) |=
+			DPLL_CTRL1_LINK_RATE(DPLL_CTRL1_LINK_RATE_1620, DPLL_ID_SKL_DPLL0);
+		vgpu_vreg_t(vgpu, LCPLL1_CTL) =
+			LCPLL_PLL_ENABLE | LCPLL_PLL_LOCK;
+		vgpu_vreg_t(vgpu, DPLL_STATUS) = DPLL_LOCK(DPLL_ID_SKL_DPLL0);
+		/*
+		 * Golden M/N are calculated based on:
+		 *   24 bpp, 4 lanes, 154000 pixel clk (from virtual EDID),
+		 *   DP link clk 1620 MHz and non-constant_n.
+		 * TODO: calculate DP link symbol clk and stream clk m/n.
+		 */
+		vgpu_vreg_t(vgpu, PIPE_DATA_M1(TRANSCODER_A)) = 63 << TU_SIZE_SHIFT;
+		vgpu_vreg_t(vgpu, PIPE_DATA_M1(TRANSCODER_A)) |= 0x5b425e;
+		vgpu_vreg_t(vgpu, PIPE_DATA_N1(TRANSCODER_A)) = 0x800000;
+		vgpu_vreg_t(vgpu, PIPE_LINK_M1(TRANSCODER_A)) = 0x3cd6e;
+		vgpu_vreg_t(vgpu, PIPE_LINK_N1(TRANSCODER_A)) = 0x80000;
 	}
 
 	if (intel_vgpu_has_monitor_on_port(vgpu, PORT_B)) {
+		vgpu_vreg_t(vgpu, DPLL_CTRL2) &=
+			~DPLL_CTRL2_DDI_CLK_OFF(PORT_B);
+		vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
+			DPLL_CTRL2_DDI_CLK_SEL(DPLL_ID_SKL_DPLL0, PORT_B);
+		vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
+			DPLL_CTRL2_DDI_SEL_OVERRIDE(PORT_B);
 		vgpu_vreg_t(vgpu, SFUSE_STRAP) |= SFUSE_STRAP_DDIB_DETECTED;
 		vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &=
 			~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK |
@@ -234,6 +261,12 @@ static void emulate_monitor_status_chang
 	}
 
 	if (intel_vgpu_has_monitor_on_port(vgpu, PORT_C)) {
+		vgpu_vreg_t(vgpu, DPLL_CTRL2) &=
+			~DPLL_CTRL2_DDI_CLK_OFF(PORT_C);
+		vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
+			DPLL_CTRL2_DDI_CLK_SEL(DPLL_ID_SKL_DPLL0, PORT_C);
+		vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
+			DPLL_CTRL2_DDI_SEL_OVERRIDE(PORT_C);
 		vgpu_vreg_t(vgpu, SDEISR) |= SDE_PORTC_HOTPLUG_CPT;
 		vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &=
 			~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK |
@@ -254,6 +287,12 @@ static void emulate_monitor_status_chang
 	}
 
 	if (intel_vgpu_has_monitor_on_port(vgpu, PORT_D)) {
+		vgpu_vreg_t(vgpu, DPLL_CTRL2) &=
+			~DPLL_CTRL2_DDI_CLK_OFF(PORT_D);
+		vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
+			DPLL_CTRL2_DDI_CLK_SEL(DPLL_ID_SKL_DPLL0, PORT_D);
+		vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
+			DPLL_CTRL2_DDI_SEL_OVERRIDE(PORT_D);
 		vgpu_vreg_t(vgpu, SDEISR) |= SDE_PORTD_HOTPLUG_CPT;
 		vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &=
 			~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK |



  parent reply	other threads:[~2020-05-26 19:27 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-26 18:52 [PATCH 4.19 00/81] 4.19.125-rc1 review Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 01/81] x86/uaccess, ubsan: Fix UBSAN vs. SMAP Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 02/81] ubsan: build ubsan.c more conservatively Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 03/81] i2c: dev: Fix the race between the release of i2c_dev and cdev Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 04/81] KVM: SVM: Fix potential memory leak in svm_cpu_init() Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 05/81] riscv: set max_pfn to the PFN of the last page Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 06/81] ima: Set file->f_mode instead of file->f_flags in ima_calc_file_hash() Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 07/81] evm: Check also if *tfm is an error pointer in init_desc() Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 08/81] ima: Fix return value of ima_write_policy() Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 09/81] mtd: spinand: Propagate ECC information to the MTD structure Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 10/81] fix multiplication overflow in copy_fdtable() Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 11/81] ubifs: remove broken lazytime support Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 12/81] iommu/amd: Fix over-read of ACPI UID from IVRS table Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 13/81] i2c: mux: demux-pinctrl: Fix an error handling path in i2c_demux_pinctrl_probe() Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 14/81] ubi: Fix seq_file usage in detailed_erase_block_info debugfs file Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 15/81] gcc-common.h: Update for GCC 10 Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 16/81] HID: multitouch: add eGalaxTouch P80H84 support Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 17/81] HID: alps: Add AUI1657 device ID Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 18/81] HID: alps: ALPS_1657 is too specific; use U1_UNICORN_LEGACY instead Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 19/81] scsi: qla2xxx: Fix hang when issuing nvme disconnect-all in NPIV Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 20/81] scsi: qla2xxx: Delete all sessions before unregister local nvme port Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 21/81] configfs: fix config_item refcnt leak in configfs_rmdir() Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 22/81] vhost/vsock: fix packet delivery order to monitoring devices Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 23/81] aquantia: Fix the media type of AQC100 ethernet controller in the driver Greg Kroah-Hartman
2020-05-26 18:52 ` [PATCH 4.19 24/81] component: Silence bind error on -EPROBE_DEFER Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 25/81] scsi: ibmvscsi: Fix WARN_ON during event pool release Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 26/81] HID: i2c-hid: reset Synaptics SYNA2393 on resume Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 27/81] x86/apic: Move TSC deadline timer debug printk Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 28/81] gtp: set NLM_F_MULTI flag in gtp_genl_dump_pdp() Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 29/81] HID: quirks: Add HID_QUIRK_NO_INIT_REPORTS quirk for Dell K12A keyboard-dock Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 30/81] ceph: fix double unlock in handle_cap_export() Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 31/81] stmmac: fix pointer check after utilization in stmmac_interrupt Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 32/81] USB: core: Fix misleading driver bug report Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 33/81] platform/x86: asus-nb-wmi: Do not load on Asus T100TA and T200TA Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 34/81] ARM: futex: Address build warning Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 35/81] padata: Replace delayed timer with immediate workqueue in padata_reorder Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 36/81] padata: initialize pd->cpu with effective cpumask Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 37/81] padata: purge get_cpu and reorder_via_wq from padata_do_serial Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 38/81] ALSA: iec1712: Initialize STDSP24 properly when using the model=staudio option Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 39/81] ALSA: pcm: fix incorrect hw_base increase Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 40/81] ALSA: hda/realtek - Fix silent output on Gigabyte X570 Aorus Xtreme Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 41/81] ALSA: hda/realtek - Add more fixup entries for Clevo machines Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 42/81] drm/etnaviv: fix perfmon domain interation Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 43/81] apparmor: Fix use-after-free in aa_audit_rule_init Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 44/81] apparmor: fix potential label refcnt leak in aa_change_profile Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 45/81] apparmor: Fix aa_label refcnt leak in policy_update Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 46/81] dmaengine: tegra210-adma: Fix an error handling path in tegra_adma_probe() Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 47/81] dmaengine: owl: Use correct lock in owl_dma_get_pchan() Greg Kroah-Hartman
2020-05-26 18:53 ` Greg Kroah-Hartman [this message]
2020-05-26 18:53 ` [PATCH 4.19 49/81] powerpc: Remove STRICT_KERNEL_RWX incompatibility with RELOCATABLE Greg Kroah-Hartman
2020-05-27 13:28   ` Pavel Machek
2020-05-27 14:32     ` Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 50/81] powerpc/64s: Disable STRICT_KERNEL_RWX Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 51/81] nfit: Add Hyper-V NVDIMM DSM command set to white list Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 52/81] libnvdimm/btt: Remove unnecessary code in btt_freelist_init Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 53/81] libnvdimm/btt: Fix LBA masking during free list population Greg Kroah-Hartman
2020-05-27 13:33   ` Pavel Machek
2020-05-26 18:53 ` [PATCH 4.19 54/81] staging: most: core: replace strcpy() by strscpy() Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 55/81] thunderbolt: Drop duplicated get_switch_at_route() Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 56/81] media: fdp1: Fix R-Car M3-N naming in debug message Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 57/81] Revert "net/ibmvnic: Fix EOI when running in XIVE mode" Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 58/81] net: bcmgenet: code movement Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 59/81] net: bcmgenet: abort suspend on error Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 60/81] cxgb4: free mac_hlist properly Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 61/81] cxgb4/cxgb4vf: Fix mac_hlist initialization and free Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 62/81] tty: serial: qcom_geni_serial: Fix wrap around of TX buffer Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 63/81] brcmfmac: abort and release host after error Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 64/81] Revert "gfs2: Dont demote a glock until its revokes are written" Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 65/81] staging: iio: ad2s1210: Fix SPI reading Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 66/81] staging: greybus: Fix uninitialized scalar variable Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 67/81] iio: sca3000: Remove an erroneous get_device() Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 68/81] iio: dac: vf610: Fix an error handling path in vf610_dac_probe() Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 69/81] misc: rtsx: Add short delay after exit from ASPM Greg Kroah-Hartman
2020-05-29 16:26   ` Pavel Machek
2020-05-26 18:53 ` [PATCH 4.19 70/81] mei: release me_cl object reference Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 71/81] ipack: tpci200: fix error return code in tpci200_register() Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 72/81] rapidio: fix an error in get_user_pages_fast() error handling Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 73/81] rxrpc: Fix a memory leak in rxkad_verify_response() Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 74/81] x86/unwind/orc: Fix unwind_get_return_address_ptr() for inactive tasks Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 75/81] iio: adc: stm32-adc: Use dma_request_chan() instead dma_request_slave_channel() Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 76/81] iio: adc: stm32-adc: fix device used to request dma Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 77/81] iio: adc: stm32-dfsdm: Use dma_request_chan() instead dma_request_slave_channel() Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 78/81] iio: adc: stm32-dfsdm: fix device used to request dma Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 79/81] rxrpc: Trace discarded ACKs Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 80/81] rxrpc: Fix ack discard Greg Kroah-Hartman
2020-05-26 18:53 ` [PATCH 4.19 81/81] make user_access_begin() do access_ok() Greg Kroah-Hartman
2020-05-27  8:30 ` [PATCH 4.19 00/81] 4.19.125-rc1 review Naresh Kamboju
2020-05-27  8:33 ` Jon Hunter
2020-05-27 10:29 ` Chris Paterson
2020-05-27 11:48   ` Greg Kroah-Hartman
2020-05-27 14:02 ` Guenter Roeck
2020-05-27 15:28   ` Greg Kroah-Hartman
2020-05-27 16:38 ` shuah

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=20200526183932.535281956@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=colin.xu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=zhenyuw@linux.intel.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).