[core] honour the kernels probe requests

This commit is contained in:
Geoffrey McRae 2020-11-14 17:25:41 +11:00
parent 246f57e0b0
commit 2f588b8870
9 changed files with 18 additions and 4 deletions

View File

@ -1,5 +1,5 @@
PACKAGE_NAME="vendor-reset" PACKAGE_NAME="vendor-reset"
PACKAGE_VERSION="0.0.11" PACKAGE_VERSION="0.0.12"
BUILT_MODULE_NAME[0]="${PACKAGE_NAME}" BUILT_MODULE_NAME[0]="${PACKAGE_NAME}"
MAKE[0]="make KDIR=${kernel_source_dir}" MAKE[0]="make KDIR=${kernel_source_dir}"
CLEAN="make KDIR=${kernel_source_dir} clean" CLEAN="make KDIR=${kernel_source_dir} clean"

View File

@ -28,15 +28,19 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include "common.h" #include "common.h"
#include "compat.h" #include "compat.h"
int amd_common_probe(struct vendor_reset_cfg *cfg, struct pci_dev *dev)
{
/* disable bus reset for the card, seems to be an issue with all of them */
dev->dev_flags |= PCI_DEV_FLAGS_NO_BUS_RESET;
return 0;
}
int amd_common_pre_reset(struct vendor_reset_dev *dev) int amd_common_pre_reset(struct vendor_reset_dev *dev)
{ {
struct amd_vendor_private *priv; struct amd_vendor_private *priv;
struct pci_dev *pdev = dev->pdev; struct pci_dev *pdev = dev->pdev;
int ret, i; int ret, i;
/* disable bus reset for the card, seems to be an issue with all of em */
pdev->dev_flags |= PCI_DEV_FLAGS_NO_BUS_RESET;
/* do not try to reset the card under amdgpu, it will cause problems */ /* do not try to reset the card under amdgpu, it will cause problems */
if (pdev->driver && !strcmp(pdev->driver->name, "amdgpu")) if (pdev->driver && !strcmp(pdev->driver->name, "amdgpu"))
return -ENOTTY; return -ENOTTY;

View File

@ -123,6 +123,7 @@ static inline struct amd_vendor_private *amd_private(struct vendor_reset_dev *vd
return vdev->vendor_private; return vdev->vendor_private;
} }
int amd_common_probe(struct vendor_reset_cfg *cfg, struct pci_dev *dev);
int amd_common_pre_reset(struct vendor_reset_dev *); int amd_common_pre_reset(struct vendor_reset_dev *);
int amd_common_post_reset(struct vendor_reset_dev *); int amd_common_post_reset(struct vendor_reset_dev *);

View File

@ -260,6 +260,7 @@ free_adev:
const struct vendor_reset_ops amd_navi10_ops = const struct vendor_reset_ops amd_navi10_ops =
{ {
.version = {1, 0}, .version = {1, 0},
.probe = amd_common_probe,
.pre_reset = amd_common_pre_reset, .pre_reset = amd_common_pre_reset,
.reset = amd_navi10_reset, .reset = amd_navi10_reset,
.post_reset = amd_common_post_reset, .post_reset = amd_common_post_reset,

View File

@ -76,6 +76,7 @@ static int amd_polaris10_reset(struct vendor_reset_dev *vdev)
const struct vendor_reset_ops amd_polaris10_ops = { const struct vendor_reset_ops amd_polaris10_ops = {
.version = {1, 0}, .version = {1, 0},
.probe = amd_common_probe,
.pre_reset = amd_common_pre_reset, .pre_reset = amd_common_pre_reset,
.reset = amd_polaris10_reset, .reset = amd_polaris10_reset,
.post_reset = amd_common_post_reset, .post_reset = amd_common_post_reset,

View File

@ -280,6 +280,7 @@ free_adev:
const struct vendor_reset_ops amd_vega10_ops = { const struct vendor_reset_ops amd_vega10_ops = {
.version = {1, 0}, .version = {1, 0},
.probe = amd_common_probe,
.pre_reset = amd_common_pre_reset, .pre_reset = amd_common_pre_reset,
.reset = amd_vega10_reset, .reset = amd_vega10_reset,
.post_reset = amd_common_post_reset, .post_reset = amd_common_post_reset,

View File

@ -191,6 +191,7 @@ free_adev:
const struct vendor_reset_ops amd_vega20_ops = const struct vendor_reset_ops amd_vega20_ops =
{ {
.version = {1, 0}, .version = {1, 0},
.probe = amd_common_probe,
.pre_reset = amd_common_pre_reset, .pre_reset = amd_common_pre_reset,
.reset = amd_vega20_reset, .reset = amd_vega20_reset,
.post_reset = amd_common_post_reset, .post_reset = amd_common_post_reset,

View File

@ -38,6 +38,9 @@ static int hooked_pci_dev_specific_reset(struct pci_dev *dev, int probe)
if (!cfg) if (!cfg)
goto do_orig; goto do_orig;
if (probe)
return cfg->ops->probe(cfg, dev);
ret = vendor_reset_dev_locked(cfg, dev); ret = vendor_reset_dev_locked(cfg, dev);
if (!ret || ret != -ENOTTY) if (!ret || ret != -ENOTTY)
return ret; return ret;

View File

@ -45,6 +45,8 @@ struct vendor_reset_ops
{ {
/* version of the reset operations for logging */ /* version of the reset operations for logging */
const struct vendor_reset_ver version; const struct vendor_reset_ver version;
/* called when the kernel is probing for a working reset function */
int (*probe)(struct vendor_reset_cfg *, struct pci_dev *);
/* any pre-reset ops to do, i.e., common code between devices */ /* any pre-reset ops to do, i.e., common code between devices */
int (*pre_reset)(struct vendor_reset_dev *); int (*pre_reset)(struct vendor_reset_dev *);
/* the reset method for the device at the specified address */ /* the reset method for the device at the specified address */