diff options
author | Monk Liu <Monk.Liu@amd.com> | 2016-03-31 01:26:59 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-09-19 14:45:52 -0400 |
commit | 4e99a44e37bfed8c4f25c94687e8e4ac4ae65086 (patch) | |
tree | e8a95a6c2135115ca60ee8ca6bde7d33746b60d0 /drivers/gpu/drm/amd/amdgpu/amdgpu.h | |
parent | ecab76688a0785fbcddcd1ff638a3fc76db073aa (diff) |
drm/amdgpu:changes of virtualization cases probe (v3)
1,Changes on virtualization detections
2,Don't load smu & mc firmware if using sr-iov bios
3,skip vPost for sriov & force vPost if dev pass-through
v2: agd: squash in Rays's fix for the missed SI case
v3: agd: squash in additional fixes for CIK, SI, cleanup
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu.h')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu.h | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index ee45d9f7f3dc..fb8d6030a64d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -1827,6 +1827,7 @@ struct amdgpu_asic_funcs { | |||
1827 | bool (*read_disabled_bios)(struct amdgpu_device *adev); | 1827 | bool (*read_disabled_bios)(struct amdgpu_device *adev); |
1828 | bool (*read_bios_from_rom)(struct amdgpu_device *adev, | 1828 | bool (*read_bios_from_rom)(struct amdgpu_device *adev, |
1829 | u8 *bios, u32 length_bytes); | 1829 | u8 *bios, u32 length_bytes); |
1830 | void (*detect_hw_virtualization) (struct amdgpu_device *adev); | ||
1830 | int (*read_register)(struct amdgpu_device *adev, u32 se_num, | 1831 | int (*read_register)(struct amdgpu_device *adev, u32 se_num, |
1831 | u32 sh_num, u32 reg_offset, u32 *value); | 1832 | u32 sh_num, u32 reg_offset, u32 *value); |
1832 | void (*set_vga_state)(struct amdgpu_device *adev, bool state); | 1833 | void (*set_vga_state)(struct amdgpu_device *adev, bool state); |
@@ -1836,8 +1837,6 @@ struct amdgpu_asic_funcs { | |||
1836 | /* MM block clocks */ | 1837 | /* MM block clocks */ |
1837 | int (*set_uvd_clocks)(struct amdgpu_device *adev, u32 vclk, u32 dclk); | 1838 | int (*set_uvd_clocks)(struct amdgpu_device *adev, u32 vclk, u32 dclk); |
1838 | int (*set_vce_clocks)(struct amdgpu_device *adev, u32 evclk, u32 ecclk); | 1839 | int (*set_vce_clocks)(struct amdgpu_device *adev, u32 evclk, u32 ecclk); |
1839 | /* query virtual capabilities */ | ||
1840 | u32 (*get_virtual_caps)(struct amdgpu_device *adev); | ||
1841 | /* static power management */ | 1840 | /* static power management */ |
1842 | int (*get_pcie_lanes)(struct amdgpu_device *adev); | 1841 | int (*get_pcie_lanes)(struct amdgpu_device *adev); |
1843 | void (*set_pcie_lanes)(struct amdgpu_device *adev, int lanes); | 1842 | void (*set_pcie_lanes)(struct amdgpu_device *adev, int lanes); |
@@ -1934,15 +1933,36 @@ struct cgs_device *amdgpu_cgs_create_device(struct amdgpu_device *adev); | |||
1934 | void amdgpu_cgs_destroy_device(struct cgs_device *cgs_device); | 1933 | void amdgpu_cgs_destroy_device(struct cgs_device *cgs_device); |
1935 | 1934 | ||
1936 | 1935 | ||
1936 | #define AMDGPU_SRIOV_CAPS_SRIOV_VBIOS (1 << 0) /* vBIOS is sr-iov ready */ | ||
1937 | #define AMDGPU_SRIOV_CAPS_ENABLE_IOV (1 << 1) /* sr-iov is enabled on this GPU */ | ||
1938 | #define AMDGPU_SRIOV_CAPS_IS_VF (1 << 2) /* this GPU is a virtual function */ | ||
1939 | #define AMDGPU_PASSTHROUGH_MODE (1 << 3) /* thw whole GPU is pass through for VM */ | ||
1937 | /* GPU virtualization */ | 1940 | /* GPU virtualization */ |
1938 | #define AMDGPU_VIRT_CAPS_SRIOV_EN (1 << 0) | ||
1939 | #define AMDGPU_VIRT_CAPS_IS_VF (1 << 1) | ||
1940 | struct amdgpu_virtualization { | 1941 | struct amdgpu_virtualization { |
1941 | bool supports_sr_iov; | 1942 | uint32_t virtual_caps; |
1942 | bool is_virtual; | ||
1943 | u32 caps; | ||
1944 | }; | 1943 | }; |
1945 | 1944 | ||
1945 | #define amdgpu_sriov_enabled(adev) \ | ||
1946 | ((adev)->virtualization.virtual_caps & AMDGPU_SRIOV_CAPS_ENABLE_IOV) | ||
1947 | |||
1948 | #define amdgpu_sriov_vf(adev) \ | ||
1949 | ((adev)->virtualization.virtual_caps & AMDGPU_SRIOV_CAPS_IS_VF) | ||
1950 | |||
1951 | #define amdgpu_sriov_bios(adev) \ | ||
1952 | ((adev)->virtualization.virtual_caps & AMDGPU_SRIOV_CAPS_SRIOV_VBIOS) | ||
1953 | |||
1954 | #define amdgpu_passthrough(adev) \ | ||
1955 | ((adev)->virtualization.virtual_caps & AMDGPU_PASSTHROUGH_MODE) | ||
1956 | |||
1957 | static inline bool is_virtual_machine(void) | ||
1958 | { | ||
1959 | #ifdef CONFIG_X86 | ||
1960 | return boot_cpu_has(X86_FEATURE_HYPERVISOR); | ||
1961 | #else | ||
1962 | return false; | ||
1963 | #endif | ||
1964 | } | ||
1965 | |||
1946 | /* | 1966 | /* |
1947 | * Core structure, functions and helpers. | 1967 | * Core structure, functions and helpers. |
1948 | */ | 1968 | */ |
@@ -2260,12 +2280,12 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring) | |||
2260 | #define amdgpu_asic_get_xclk(adev) (adev)->asic_funcs->get_xclk((adev)) | 2280 | #define amdgpu_asic_get_xclk(adev) (adev)->asic_funcs->get_xclk((adev)) |
2261 | #define amdgpu_asic_set_uvd_clocks(adev, v, d) (adev)->asic_funcs->set_uvd_clocks((adev), (v), (d)) | 2281 | #define amdgpu_asic_set_uvd_clocks(adev, v, d) (adev)->asic_funcs->set_uvd_clocks((adev), (v), (d)) |
2262 | #define amdgpu_asic_set_vce_clocks(adev, ev, ec) (adev)->asic_funcs->set_vce_clocks((adev), (ev), (ec)) | 2282 | #define amdgpu_asic_set_vce_clocks(adev, ev, ec) (adev)->asic_funcs->set_vce_clocks((adev), (ev), (ec)) |
2263 | #define amdgpu_asic_get_virtual_caps(adev) ((adev)->asic_funcs->get_virtual_caps((adev))) | ||
2264 | #define amdgpu_get_pcie_lanes(adev) (adev)->asic_funcs->get_pcie_lanes((adev)) | 2283 | #define amdgpu_get_pcie_lanes(adev) (adev)->asic_funcs->get_pcie_lanes((adev)) |
2265 | #define amdgpu_set_pcie_lanes(adev, l) (adev)->asic_funcs->set_pcie_lanes((adev), (l)) | 2284 | #define amdgpu_set_pcie_lanes(adev, l) (adev)->asic_funcs->set_pcie_lanes((adev), (l)) |
2266 | #define amdgpu_asic_get_gpu_clock_counter(adev) (adev)->asic_funcs->get_gpu_clock_counter((adev)) | 2285 | #define amdgpu_asic_get_gpu_clock_counter(adev) (adev)->asic_funcs->get_gpu_clock_counter((adev)) |
2267 | #define amdgpu_asic_read_disabled_bios(adev) (adev)->asic_funcs->read_disabled_bios((adev)) | 2286 | #define amdgpu_asic_read_disabled_bios(adev) (adev)->asic_funcs->read_disabled_bios((adev)) |
2268 | #define amdgpu_asic_read_bios_from_rom(adev, b, l) (adev)->asic_funcs->read_bios_from_rom((adev), (b), (l)) | 2287 | #define amdgpu_asic_read_bios_from_rom(adev, b, l) (adev)->asic_funcs->read_bios_from_rom((adev), (b), (l)) |
2288 | #define amdgpu_asic_detect_hw_virtualization(adev) (adev)->asic_funcs->detect_hw_virtualization((adev)) | ||
2269 | #define amdgpu_asic_read_register(adev, se, sh, offset, v)((adev)->asic_funcs->read_register((adev), (se), (sh), (offset), (v))) | 2289 | #define amdgpu_asic_read_register(adev, se, sh, offset, v)((adev)->asic_funcs->read_register((adev), (se), (sh), (offset), (v))) |
2270 | #define amdgpu_gart_flush_gpu_tlb(adev, vmid) (adev)->gart.gart_funcs->flush_gpu_tlb((adev), (vmid)) | 2290 | #define amdgpu_gart_flush_gpu_tlb(adev, vmid) (adev)->gart.gart_funcs->flush_gpu_tlb((adev), (vmid)) |
2271 | #define amdgpu_gart_set_pte_pde(adev, pt, idx, addr, flags) (adev)->gart.gart_funcs->set_pte_pde((adev), (pt), (idx), (addr), (flags)) | 2291 | #define amdgpu_gart_set_pte_pde(adev, pt, idx, addr, flags) (adev)->gart.gart_funcs->set_pte_pde((adev), (pt), (idx), (addr), (flags)) |