Commit 9accf2fd authored by Emily Deng's avatar Emily Deng Committed by Alex Deucher

drm/amdgpu: Change the virtual_display type from int to char*.

For virtual display feature, as there may be multiple GPUs,
for user could choose whiche GPU need to enable this feature, change
the type of virtual_display from int to char*. The variable will be set
like this virtual_display="xxxx:xx:xx.x;xxxx:xx:xx.x;".
Signed-off-by: default avatarEmily Deng <Emily.Deng@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 4f4b7834
...@@ -92,7 +92,7 @@ extern unsigned amdgpu_cg_mask; ...@@ -92,7 +92,7 @@ extern unsigned amdgpu_cg_mask;
extern unsigned amdgpu_pg_mask; extern unsigned amdgpu_pg_mask;
extern char *amdgpu_disable_cu; extern char *amdgpu_disable_cu;
extern int amdgpu_sclk_deep_sleep_en; extern int amdgpu_sclk_deep_sleep_en;
extern int amdgpu_virtual_display; extern char *amdgpu_virtual_display;
#define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS 3000 #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS 3000
#define AMDGPU_MAX_USEC_TIMEOUT 100000 /* 100 ms */ #define AMDGPU_MAX_USEC_TIMEOUT 100000 /* 100 ms */
...@@ -2072,6 +2072,7 @@ struct amdgpu_device { ...@@ -2072,6 +2072,7 @@ struct amdgpu_device {
atomic_t gpu_reset_counter; atomic_t gpu_reset_counter;
/* display */ /* display */
bool enable_virtual_display;
struct amdgpu_mode_info mode_info; struct amdgpu_mode_info mode_info;
struct work_struct hotplug_work; struct work_struct hotplug_work;
struct amdgpu_irq_src crtc_irq; struct amdgpu_irq_src crtc_irq;
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#endif #endif
#include "vi.h" #include "vi.h"
#include "bif/bif_4_1_d.h" #include "bif/bif_4_1_d.h"
#include <linux/pci.h>
static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev); static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev);
static void amdgpu_debugfs_regs_cleanup(struct amdgpu_device *adev); static void amdgpu_debugfs_regs_cleanup(struct amdgpu_device *adev);
...@@ -1181,11 +1182,37 @@ int amdgpu_ip_block_version_cmp(struct amdgpu_device *adev, ...@@ -1181,11 +1182,37 @@ int amdgpu_ip_block_version_cmp(struct amdgpu_device *adev,
return 1; return 1;
} }
static void amdgpu_whether_enable_virtual_display(struct amdgpu_device *adev)
{
adev->enable_virtual_display = false;
if (amdgpu_virtual_display) {
struct drm_device *ddev = adev->ddev;
const char *pci_address_name = pci_name(ddev->pdev);
char *pciaddstr, *pciaddstr_tmp, *pciaddname;
pciaddstr = kstrdup(amdgpu_virtual_display, GFP_KERNEL);
pciaddstr_tmp = pciaddstr;
while ((pciaddname = strsep(&pciaddstr_tmp, ";"))) {
if (!strcmp(pci_address_name, pciaddname)) {
adev->enable_virtual_display = true;
break;
}
}
DRM_INFO("virtual display string:%s, %s:virtual_display:%d\n",
amdgpu_virtual_display, pci_address_name,
adev->enable_virtual_display);
kfree(pciaddstr);
}
}
static int amdgpu_early_init(struct amdgpu_device *adev) static int amdgpu_early_init(struct amdgpu_device *adev)
{ {
int i, r; int i, r;
DRM_INFO("virtual display enabled:%d\n", amdgpu_virtual_display); amdgpu_whether_enable_virtual_display(adev);
switch (adev->asic_type) { switch (adev->asic_type) {
case CHIP_TOPAZ: case CHIP_TOPAZ:
......
...@@ -90,7 +90,7 @@ unsigned amdgpu_pcie_lane_cap = 0; ...@@ -90,7 +90,7 @@ unsigned amdgpu_pcie_lane_cap = 0;
unsigned amdgpu_cg_mask = 0xffffffff; unsigned amdgpu_cg_mask = 0xffffffff;
unsigned amdgpu_pg_mask = 0xffffffff; unsigned amdgpu_pg_mask = 0xffffffff;
char *amdgpu_disable_cu = NULL; char *amdgpu_disable_cu = NULL;
int amdgpu_virtual_display = 0; char *amdgpu_virtual_display = NULL;
MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes"); MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
module_param_named(vramlimit, amdgpu_vram_limit, int, 0600); module_param_named(vramlimit, amdgpu_vram_limit, int, 0600);
...@@ -190,8 +190,8 @@ module_param_named(pg_mask, amdgpu_pg_mask, uint, 0444); ...@@ -190,8 +190,8 @@ module_param_named(pg_mask, amdgpu_pg_mask, uint, 0444);
MODULE_PARM_DESC(disable_cu, "Disable CUs (se.sh.cu,...)"); MODULE_PARM_DESC(disable_cu, "Disable CUs (se.sh.cu,...)");
module_param_named(disable_cu, amdgpu_disable_cu, charp, 0444); module_param_named(disable_cu, amdgpu_disable_cu, charp, 0444);
MODULE_PARM_DESC(virtual_display, "enable virtual display (0 = disable virtual display)"); MODULE_PARM_DESC(virtual_display, "Enable virtual display feature (the virtual_display will be set like xxxx:xx:xx.x;xxxx:xx:xx.x)");
module_param_named(virtual_display, amdgpu_virtual_display, int, 0444); module_param_named(virtual_display, amdgpu_virtual_display, charp, 0444);
static const struct pci_device_id pciidlist[] = { static const struct pci_device_id pciidlist[] = {
#ifdef CONFIG_DRM_AMDGPU_CIK #ifdef CONFIG_DRM_AMDGPU_CIK
......
...@@ -2323,7 +2323,7 @@ static const struct amdgpu_ip_block_version kaveri_ip_blocks_vd[] = ...@@ -2323,7 +2323,7 @@ static const struct amdgpu_ip_block_version kaveri_ip_blocks_vd[] =
int cik_set_ip_blocks(struct amdgpu_device *adev) int cik_set_ip_blocks(struct amdgpu_device *adev)
{ {
if (amdgpu_virtual_display) { if (adev->enable_virtual_display) {
switch (adev->asic_type) { switch (adev->asic_type) {
case CHIP_BONAIRE: case CHIP_BONAIRE:
adev->ip_blocks = bonaire_ip_blocks_vd; adev->ip_blocks = bonaire_ip_blocks_vd;
......
...@@ -1441,7 +1441,7 @@ static const struct amdgpu_ip_block_version cz_ip_blocks_vd[] = ...@@ -1441,7 +1441,7 @@ static const struct amdgpu_ip_block_version cz_ip_blocks_vd[] =
int vi_set_ip_blocks(struct amdgpu_device *adev) int vi_set_ip_blocks(struct amdgpu_device *adev)
{ {
if (amdgpu_virtual_display) { if (adev->enable_virtual_display) {
switch (adev->asic_type) { switch (adev->asic_type) {
case CHIP_TOPAZ: case CHIP_TOPAZ:
adev->ip_blocks = topaz_ip_blocks_vd; adev->ip_blocks = topaz_ip_blocks_vd;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment