mirror of
https://github.com/armbian/linux-cix.git
synced 2026-01-06 12:30:45 -08:00
Merge tag 'char-misc-5.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver fixes from Greg KH: "Here is a big set of char/misc/other driver fixes for 5.13-rc3. The majority here is the fallout of the umn.edu re-review of all prior submissions. That resulted in a bunch of reverts along with the "correct" changes made, such that there is no regression of any of the potential fixes that were made by those individuals. I would like to thank the over 80 different developers who helped with the review and fixes for this mess. Other than that, there's a few habanna driver fixes for reported issues, and some dyndbg fixes for reported problems. All of these have been in linux-next for a while with no reported problems" * tag 'char-misc-5.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (82 commits) misc: eeprom: at24: check suspend status before disable regulator uio_hv_generic: Fix another memory leak in error handling paths uio_hv_generic: Fix a memory leak in error handling paths uio/uio_pci_generic: fix return value changed in refactoring Revert "Revert "ALSA: usx2y: Fix potential NULL pointer dereference"" dyndbg: drop uninformative vpr_info dyndbg: avoid calling dyndbg_emit_prefix when it has no work binder: Return EFAULT if we fail BINDER_ENABLE_ONEWAY_SPAM_DETECTION cdrom: gdrom: initialize global variable at init time brcmfmac: properly check for bus register errors Revert "brcmfmac: add a check for the status of usb_register" video: imsttfb: check for ioremap() failures Revert "video: imsttfb: fix potential NULL pointer dereferences" net: liquidio: Add missing null pointer checks Revert "net: liquidio: fix a NULL pointer dereference" media: gspca: properly check for errors in po1030_probe() Revert "media: gspca: Check the return value of write_bridge for timeout" media: gspca: mt9m111: Check write_bridge for timeout Revert "media: gspca: mt9m111: Check write_bridge for timeout" media: dvb: Add check on sp8870_readreg return ...
This commit is contained in:
@@ -4918,7 +4918,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
uint32_t enable;
|
||||
|
||||
if (copy_from_user(&enable, ubuf, sizeof(enable))) {
|
||||
ret = -EINVAL;
|
||||
ret = -EFAULT;
|
||||
goto err;
|
||||
}
|
||||
binder_inner_proc_lock(proc);
|
||||
|
||||
@@ -744,6 +744,13 @@ static const struct blk_mq_ops gdrom_mq_ops = {
|
||||
static int probe_gdrom(struct platform_device *devptr)
|
||||
{
|
||||
int err;
|
||||
|
||||
/*
|
||||
* Ensure our "one" device is initialized properly in case of previous
|
||||
* usages of it
|
||||
*/
|
||||
memset(&gd, 0, sizeof(gd));
|
||||
|
||||
/* Start the device */
|
||||
if (gdrom_execute_diagnostic() != 1) {
|
||||
pr_warn("ATA Probe for GDROM failed\n");
|
||||
@@ -830,6 +837,8 @@ static int remove_gdrom(struct platform_device *devptr)
|
||||
if (gdrom_major)
|
||||
unregister_blkdev(gdrom_major, GDROM_DEV_NAME);
|
||||
unregister_cdrom(gd.cd_info);
|
||||
kfree(gd.cd_info);
|
||||
kfree(gd.toc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -845,7 +854,7 @@ static struct platform_driver gdrom_driver = {
|
||||
static int __init init_gdrom(void)
|
||||
{
|
||||
int rc;
|
||||
gd.toc = NULL;
|
||||
|
||||
rc = platform_driver_register(&gdrom_driver);
|
||||
if (rc)
|
||||
return rc;
|
||||
@@ -861,8 +870,6 @@ static void __exit exit_gdrom(void)
|
||||
{
|
||||
platform_device_unregister(pd);
|
||||
platform_driver_unregister(&gdrom_driver);
|
||||
kfree(gd.toc);
|
||||
kfree(gd.cd_info);
|
||||
}
|
||||
|
||||
module_init(init_gdrom);
|
||||
|
||||
@@ -984,6 +984,8 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data)
|
||||
hdp->hd_phys_address = fixmem32->address;
|
||||
hdp->hd_address = ioremap(fixmem32->address,
|
||||
HPET_RANGE_SIZE);
|
||||
if (!hdp->hd_address)
|
||||
return AE_ERROR;
|
||||
|
||||
if (hpet_is_known(hdp)) {
|
||||
iounmap(hdp->hd_address);
|
||||
|
||||
@@ -442,7 +442,6 @@ static int nitrox_probe(struct pci_dev *pdev,
|
||||
err = pci_request_mem_regions(pdev, nitrox_driver_name);
|
||||
if (err) {
|
||||
pci_disable_device(pdev);
|
||||
dev_err(&pdev->dev, "Failed to request mem regions!\n");
|
||||
return err;
|
||||
}
|
||||
pci_set_master(pdev);
|
||||
|
||||
@@ -418,8 +418,23 @@ static int __init hidma_mgmt_init(void)
|
||||
hidma_mgmt_of_populate_channels(child);
|
||||
}
|
||||
#endif
|
||||
return platform_driver_register(&hidma_mgmt_driver);
|
||||
/*
|
||||
* We do not check for return value here, as it is assumed that
|
||||
* platform_driver_register must not fail. The reason for this is that
|
||||
* the (potential) hidma_mgmt_of_populate_channels calls above are not
|
||||
* cleaned up if it does fail, and to do this work is quite
|
||||
* complicated. In particular, various calls of of_address_to_resource,
|
||||
* of_irq_to_resource, platform_device_register_full, of_dma_configure,
|
||||
* and of_msi_configure which then call other functions and so on, must
|
||||
* be cleaned up - this is not a trivial exercise.
|
||||
*
|
||||
* Currently, this module is not intended to be unloaded, and there is
|
||||
* no module_exit function defined which does the needed cleanup. For
|
||||
* this reason, we have to assume success here.
|
||||
*/
|
||||
platform_driver_register(&hidma_mgmt_driver);
|
||||
|
||||
return 0;
|
||||
}
|
||||
module_init(hidma_mgmt_init);
|
||||
MODULE_LICENSE("GPL v2");
|
||||
|
||||
@@ -596,7 +596,6 @@ static int lm80_probe(struct i2c_client *client)
|
||||
struct device *dev = &client->dev;
|
||||
struct device *hwmon_dev;
|
||||
struct lm80_data *data;
|
||||
int rv;
|
||||
|
||||
data = devm_kzalloc(dev, sizeof(struct lm80_data), GFP_KERNEL);
|
||||
if (!data)
|
||||
@@ -609,14 +608,8 @@ static int lm80_probe(struct i2c_client *client)
|
||||
lm80_init_client(client);
|
||||
|
||||
/* A few vars need to be filled upon startup */
|
||||
rv = lm80_read_value(client, LM80_REG_FAN_MIN(1));
|
||||
if (rv < 0)
|
||||
return rv;
|
||||
data->fan[f_min][0] = rv;
|
||||
rv = lm80_read_value(client, LM80_REG_FAN_MIN(2));
|
||||
if (rv < 0)
|
||||
return rv;
|
||||
data->fan[f_min][1] = rv;
|
||||
data->fan[f_min][0] = lm80_read_value(client, LM80_REG_FAN_MIN(1));
|
||||
data->fan[f_min][1] = lm80_read_value(client, LM80_REG_FAN_MIN(2));
|
||||
|
||||
hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name,
|
||||
data, lm80_groups);
|
||||
|
||||
@@ -46,7 +46,7 @@ static void hfcsusb_start_endpoint(struct hfcsusb *hw, int channel);
|
||||
static void hfcsusb_stop_endpoint(struct hfcsusb *hw, int channel);
|
||||
static int hfcsusb_setup_bch(struct bchannel *bch, int protocol);
|
||||
static void deactivate_bchannel(struct bchannel *bch);
|
||||
static void hfcsusb_ph_info(struct hfcsusb *hw);
|
||||
static int hfcsusb_ph_info(struct hfcsusb *hw);
|
||||
|
||||
/* start next background transfer for control channel */
|
||||
static void
|
||||
@@ -241,7 +241,7 @@ hfcusb_l2l1B(struct mISDNchannel *ch, struct sk_buff *skb)
|
||||
* send full D/B channel status information
|
||||
* as MPH_INFORMATION_IND
|
||||
*/
|
||||
static void
|
||||
static int
|
||||
hfcsusb_ph_info(struct hfcsusb *hw)
|
||||
{
|
||||
struct ph_info *phi;
|
||||
@@ -250,7 +250,7 @@ hfcsusb_ph_info(struct hfcsusb *hw)
|
||||
|
||||
phi = kzalloc(struct_size(phi, bch, dch->dev.nrbchan), GFP_ATOMIC);
|
||||
if (!phi)
|
||||
return;
|
||||
return -ENOMEM;
|
||||
|
||||
phi->dch.ch.protocol = hw->protocol;
|
||||
phi->dch.ch.Flags = dch->Flags;
|
||||
@@ -263,6 +263,8 @@ hfcsusb_ph_info(struct hfcsusb *hw)
|
||||
_queue_data(&dch->dev.D, MPH_INFORMATION_IND, MISDN_ID_ANY,
|
||||
struct_size(phi, bch, dch->dev.nrbchan), phi, GFP_ATOMIC);
|
||||
kfree(phi);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -347,8 +349,7 @@ hfcusb_l2l1D(struct mISDNchannel *ch, struct sk_buff *skb)
|
||||
ret = l1_event(dch->l1, hh->prim);
|
||||
break;
|
||||
case MPH_INFORMATION_REQ:
|
||||
hfcsusb_ph_info(hw);
|
||||
ret = 0;
|
||||
ret = hfcsusb_ph_info(hw);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -403,8 +404,7 @@ hfc_l1callback(struct dchannel *dch, u_int cmd)
|
||||
hw->name, __func__, cmd);
|
||||
return -1;
|
||||
}
|
||||
hfcsusb_ph_info(hw);
|
||||
return 0;
|
||||
return hfcsusb_ph_info(hw);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -746,8 +746,7 @@ hfcsusb_setup_bch(struct bchannel *bch, int protocol)
|
||||
handle_led(hw, (bch->nr == 1) ? LED_B1_OFF :
|
||||
LED_B2_OFF);
|
||||
}
|
||||
hfcsusb_ph_info(hw);
|
||||
return 0;
|
||||
return hfcsusb_ph_info(hw);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -630,17 +630,19 @@ static void
|
||||
release_io(struct inf_hw *hw)
|
||||
{
|
||||
if (hw->cfg.mode) {
|
||||
if (hw->cfg.p) {
|
||||
if (hw->cfg.mode == AM_MEMIO) {
|
||||
release_mem_region(hw->cfg.start, hw->cfg.size);
|
||||
iounmap(hw->cfg.p);
|
||||
if (hw->cfg.p)
|
||||
iounmap(hw->cfg.p);
|
||||
} else
|
||||
release_region(hw->cfg.start, hw->cfg.size);
|
||||
hw->cfg.mode = AM_NONE;
|
||||
}
|
||||
if (hw->addr.mode) {
|
||||
if (hw->addr.p) {
|
||||
if (hw->addr.mode == AM_MEMIO) {
|
||||
release_mem_region(hw->addr.start, hw->addr.size);
|
||||
iounmap(hw->addr.p);
|
||||
if (hw->addr.p)
|
||||
iounmap(hw->addr.p);
|
||||
} else
|
||||
release_region(hw->addr.start, hw->addr.size);
|
||||
hw->addr.mode = AM_NONE;
|
||||
@@ -670,9 +672,12 @@ setup_io(struct inf_hw *hw)
|
||||
(ulong)hw->cfg.start, (ulong)hw->cfg.size);
|
||||
return err;
|
||||
}
|
||||
if (hw->ci->cfg_mode == AM_MEMIO)
|
||||
hw->cfg.p = ioremap(hw->cfg.start, hw->cfg.size);
|
||||
hw->cfg.mode = hw->ci->cfg_mode;
|
||||
if (hw->ci->cfg_mode == AM_MEMIO) {
|
||||
hw->cfg.p = ioremap(hw->cfg.start, hw->cfg.size);
|
||||
if (!hw->cfg.p)
|
||||
return -ENOMEM;
|
||||
}
|
||||
if (debug & DEBUG_HW)
|
||||
pr_notice("%s: IO cfg %lx (%lu bytes) mode%d\n",
|
||||
hw->name, (ulong)hw->cfg.start,
|
||||
@@ -697,12 +702,12 @@ setup_io(struct inf_hw *hw)
|
||||
(ulong)hw->addr.start, (ulong)hw->addr.size);
|
||||
return err;
|
||||
}
|
||||
hw->addr.mode = hw->ci->addr_mode;
|
||||
if (hw->ci->addr_mode == AM_MEMIO) {
|
||||
hw->addr.p = ioremap(hw->addr.start, hw->addr.size);
|
||||
if (unlikely(!hw->addr.p))
|
||||
if (!hw->addr.p)
|
||||
return -ENOMEM;
|
||||
}
|
||||
hw->addr.mode = hw->ci->addr_mode;
|
||||
if (debug & DEBUG_HW)
|
||||
pr_notice("%s: IO addr %lx (%lu bytes) mode%d\n",
|
||||
hw->name, (ulong)hw->addr.start,
|
||||
|
||||
@@ -307,7 +307,7 @@ static int lp5523_init_program_engine(struct lp55xx_chip *chip)
|
||||
usleep_range(3000, 6000);
|
||||
ret = lp55xx_read(chip, LP5523_REG_STATUS, &status);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto out;
|
||||
status &= LP5523_ENG_STATUS_MASK;
|
||||
|
||||
if (status != LP5523_ENG_STATUS_MASK) {
|
||||
|
||||
@@ -281,7 +281,7 @@ static int sp8870_set_frontend_parameters(struct dvb_frontend *fe)
|
||||
|
||||
// read status reg in order to clear pending irqs
|
||||
err = sp8870_readreg(state, 0x200);
|
||||
if (err)
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
// system controller start
|
||||
|
||||
@@ -915,7 +915,6 @@ static int rcar_drif_g_fmt_sdr_cap(struct file *file, void *priv,
|
||||
{
|
||||
struct rcar_drif_sdr *sdr = video_drvdata(file);
|
||||
|
||||
memset(f->fmt.sdr.reserved, 0, sizeof(f->fmt.sdr.reserved));
|
||||
f->fmt.sdr.pixelformat = sdr->fmt->pixelformat;
|
||||
f->fmt.sdr.buffersize = sdr->fmt->buffersize;
|
||||
|
||||
|
||||
@@ -1424,7 +1424,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
|
||||
{
|
||||
struct sd *sd = (struct sd *) gspca_dev;
|
||||
struct cam *cam;
|
||||
int ret;
|
||||
|
||||
sd->mainsFreq = FREQ_DEF == V4L2_CID_POWER_LINE_FREQUENCY_60HZ;
|
||||
reset_camera_params(gspca_dev);
|
||||
@@ -1436,10 +1435,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
|
||||
cam->cam_mode = mode;
|
||||
cam->nmodes = ARRAY_SIZE(mode);
|
||||
|
||||
ret = goto_low_power(gspca_dev);
|
||||
if (ret)
|
||||
gspca_err(gspca_dev, "Cannot go to low power mode: %d\n",
|
||||
ret);
|
||||
goto_low_power(gspca_dev);
|
||||
/* Check the firmware version. */
|
||||
sd->params.version.firmwareVersion = 0;
|
||||
get_version_information(gspca_dev);
|
||||
|
||||
@@ -195,7 +195,7 @@ static const struct v4l2_ctrl_config mt9m111_greenbal_cfg = {
|
||||
int mt9m111_probe(struct sd *sd)
|
||||
{
|
||||
u8 data[2] = {0x00, 0x00};
|
||||
int i, rc = 0;
|
||||
int i, err;
|
||||
struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
|
||||
|
||||
if (force_sensor) {
|
||||
@@ -213,18 +213,18 @@ int mt9m111_probe(struct sd *sd)
|
||||
/* Do the preinit */
|
||||
for (i = 0; i < ARRAY_SIZE(preinit_mt9m111); i++) {
|
||||
if (preinit_mt9m111[i][0] == BRIDGE) {
|
||||
rc |= m5602_write_bridge(sd,
|
||||
preinit_mt9m111[i][1],
|
||||
preinit_mt9m111[i][2]);
|
||||
err = m5602_write_bridge(sd,
|
||||
preinit_mt9m111[i][1],
|
||||
preinit_mt9m111[i][2]);
|
||||
} else {
|
||||
data[0] = preinit_mt9m111[i][2];
|
||||
data[1] = preinit_mt9m111[i][3];
|
||||
rc |= m5602_write_sensor(sd,
|
||||
preinit_mt9m111[i][1], data, 2);
|
||||
err = m5602_write_sensor(sd,
|
||||
preinit_mt9m111[i][1], data, 2);
|
||||
}
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
if (m5602_read_sensor(sd, MT9M111_SC_CHIPVER, data, 2))
|
||||
return -ENODEV;
|
||||
|
||||
@@ -154,8 +154,8 @@ static const struct v4l2_ctrl_config po1030_greenbal_cfg = {
|
||||
|
||||
int po1030_probe(struct sd *sd)
|
||||
{
|
||||
int rc = 0;
|
||||
u8 dev_id_h = 0, i;
|
||||
int err;
|
||||
struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
|
||||
|
||||
if (force_sensor) {
|
||||
@@ -174,14 +174,14 @@ int po1030_probe(struct sd *sd)
|
||||
for (i = 0; i < ARRAY_SIZE(preinit_po1030); i++) {
|
||||
u8 data = preinit_po1030[i][2];
|
||||
if (preinit_po1030[i][0] == SENSOR)
|
||||
rc |= m5602_write_sensor(sd,
|
||||
preinit_po1030[i][1], &data, 1);
|
||||
err = m5602_write_sensor(sd, preinit_po1030[i][1],
|
||||
&data, 1);
|
||||
else
|
||||
rc |= m5602_write_bridge(sd, preinit_po1030[i][1],
|
||||
data);
|
||||
err = m5602_write_bridge(sd, preinit_po1030[i][1],
|
||||
data);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
if (m5602_read_sensor(sd, PO1030_DEVID_H, &dev_id_h, 1))
|
||||
return -ENODEV;
|
||||
|
||||
@@ -763,7 +763,8 @@ static int at24_probe(struct i2c_client *client)
|
||||
at24->nvmem = devm_nvmem_register(dev, &nvmem_config);
|
||||
if (IS_ERR(at24->nvmem)) {
|
||||
pm_runtime_disable(dev);
|
||||
regulator_disable(at24->vcc_reg);
|
||||
if (!pm_runtime_status_suspended(dev))
|
||||
regulator_disable(at24->vcc_reg);
|
||||
return PTR_ERR(at24->nvmem);
|
||||
}
|
||||
|
||||
@@ -774,7 +775,8 @@ static int at24_probe(struct i2c_client *client)
|
||||
err = at24_read(at24, 0, &test_byte, 1);
|
||||
if (err) {
|
||||
pm_runtime_disable(dev);
|
||||
regulator_disable(at24->vcc_reg);
|
||||
if (!pm_runtime_status_suspended(dev))
|
||||
regulator_disable(at24->vcc_reg);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
||||
@@ -2017,7 +2017,7 @@ wait_again:
|
||||
if (completion_value >= target_value) {
|
||||
*status = CS_WAIT_STATUS_COMPLETED;
|
||||
} else {
|
||||
timeout -= jiffies_to_usecs(completion_rc);
|
||||
timeout = completion_rc;
|
||||
goto wait_again;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -362,12 +362,9 @@ static int fw_read_errors(struct hl_device *hdev, u32 boot_err0_reg,
|
||||
}
|
||||
|
||||
if (err_val & CPU_BOOT_ERR0_SECURITY_NOT_RDY) {
|
||||
dev_warn(hdev->dev,
|
||||
dev_err(hdev->dev,
|
||||
"Device boot warning - security not ready\n");
|
||||
/* This is a warning so we don't want it to disable the
|
||||
* device
|
||||
*/
|
||||
err_val &= ~CPU_BOOT_ERR0_SECURITY_NOT_RDY;
|
||||
err_exists = true;
|
||||
}
|
||||
|
||||
if (err_val & CPU_BOOT_ERR0_SECURITY_FAIL) {
|
||||
@@ -403,7 +400,8 @@ static int fw_read_errors(struct hl_device *hdev, u32 boot_err0_reg,
|
||||
err_exists = true;
|
||||
}
|
||||
|
||||
if (err_exists)
|
||||
if (err_exists && ((err_val & ~CPU_BOOT_ERR0_ENABLED) &
|
||||
lower_32_bits(hdev->boot_error_status_mask)))
|
||||
return -EIO;
|
||||
|
||||
return 0;
|
||||
@@ -661,18 +659,13 @@ int hl_fw_cpucp_total_energy_get(struct hl_device *hdev, u64 *total_energy)
|
||||
return rc;
|
||||
}
|
||||
|
||||
int get_used_pll_index(struct hl_device *hdev, enum pll_index input_pll_index,
|
||||
int get_used_pll_index(struct hl_device *hdev, u32 input_pll_index,
|
||||
enum pll_index *pll_index)
|
||||
{
|
||||
struct asic_fixed_properties *prop = &hdev->asic_prop;
|
||||
u8 pll_byte, pll_bit_off;
|
||||
bool dynamic_pll;
|
||||
|
||||
if (input_pll_index >= PLL_MAX) {
|
||||
dev_err(hdev->dev, "PLL index %d is out of range\n",
|
||||
input_pll_index);
|
||||
return -EINVAL;
|
||||
}
|
||||
int fw_pll_idx;
|
||||
|
||||
dynamic_pll = prop->fw_security_status_valid &&
|
||||
(prop->fw_app_security_map & CPU_BOOT_DEV_STS0_DYN_PLL_EN);
|
||||
@@ -680,28 +673,39 @@ int get_used_pll_index(struct hl_device *hdev, enum pll_index input_pll_index,
|
||||
if (!dynamic_pll) {
|
||||
/*
|
||||
* in case we are working with legacy FW (each asic has unique
|
||||
* PLL numbering) extract the legacy numbering
|
||||
* PLL numbering) use the driver based index as they are
|
||||
* aligned with fw legacy numbering
|
||||
*/
|
||||
*pll_index = hdev->legacy_pll_map[input_pll_index];
|
||||
*pll_index = input_pll_index;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* PLL map is a u8 array */
|
||||
pll_byte = prop->cpucp_info.pll_map[input_pll_index >> 3];
|
||||
pll_bit_off = input_pll_index & 0x7;
|
||||
|
||||
if (!(pll_byte & BIT(pll_bit_off))) {
|
||||
dev_err(hdev->dev, "PLL index %d is not supported\n",
|
||||
input_pll_index);
|
||||
/* retrieve a FW compatible PLL index based on
|
||||
* ASIC specific user request
|
||||
*/
|
||||
fw_pll_idx = hdev->asic_funcs->map_pll_idx_to_fw_idx(input_pll_index);
|
||||
if (fw_pll_idx < 0) {
|
||||
dev_err(hdev->dev, "Invalid PLL index (%u) error %d\n",
|
||||
input_pll_index, fw_pll_idx);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
*pll_index = input_pll_index;
|
||||
/* PLL map is a u8 array */
|
||||
pll_byte = prop->cpucp_info.pll_map[fw_pll_idx >> 3];
|
||||
pll_bit_off = fw_pll_idx & 0x7;
|
||||
|
||||
if (!(pll_byte & BIT(pll_bit_off))) {
|
||||
dev_err(hdev->dev, "PLL index %d is not supported\n",
|
||||
fw_pll_idx);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
*pll_index = fw_pll_idx;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hl_fw_cpucp_pll_info_get(struct hl_device *hdev, enum pll_index pll_index,
|
||||
int hl_fw_cpucp_pll_info_get(struct hl_device *hdev, u32 pll_index,
|
||||
u16 *pll_freq_arr)
|
||||
{
|
||||
struct cpucp_packet pkt;
|
||||
@@ -844,8 +848,13 @@ int hl_fw_read_preboot_status(struct hl_device *hdev, u32 cpu_boot_status_reg,
|
||||
if (rc) {
|
||||
dev_err(hdev->dev, "Failed to read preboot version\n");
|
||||
detect_cpu_boot_status(hdev, status);
|
||||
fw_read_errors(hdev, boot_err0_reg,
|
||||
cpu_security_boot_status_reg);
|
||||
|
||||
/* If we read all FF, then something is totally wrong, no point
|
||||
* of reading specific errors
|
||||
*/
|
||||
if (status != -1)
|
||||
fw_read_errors(hdev, boot_err0_reg,
|
||||
cpu_security_boot_status_reg);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
||||
@@ -930,6 +930,9 @@ enum div_select_defs {
|
||||
* driver is ready to receive asynchronous events. This
|
||||
* function should be called during the first init and
|
||||
* after every hard-reset of the device
|
||||
* @get_msi_info: Retrieve asic-specific MSI ID of the f/w async event
|
||||
* @map_pll_idx_to_fw_idx: convert driver specific per asic PLL index to
|
||||
* generic f/w compatible PLL Indexes
|
||||
*/
|
||||
struct hl_asic_funcs {
|
||||
int (*early_init)(struct hl_device *hdev);
|
||||
@@ -1054,6 +1057,7 @@ struct hl_asic_funcs {
|
||||
u32 block_id, u32 block_size);
|
||||
void (*enable_events_from_fw)(struct hl_device *hdev);
|
||||
void (*get_msi_info)(u32 *table);
|
||||
int (*map_pll_idx_to_fw_idx)(u32 pll_idx);
|
||||
};
|
||||
|
||||
|
||||
@@ -1950,8 +1954,6 @@ struct hl_mmu_funcs {
|
||||
* @aggregated_cs_counters: aggregated cs counters among all contexts
|
||||
* @mmu_priv: device-specific MMU data.
|
||||
* @mmu_func: device-related MMU functions.
|
||||
* @legacy_pll_map: map holding map between dynamic (common) PLL indexes and
|
||||
* static (asic specific) PLL indexes.
|
||||
* @dram_used_mem: current DRAM memory consumption.
|
||||
* @timeout_jiffies: device CS timeout value.
|
||||
* @max_power: the max power of the device, as configured by the sysadmin. This
|
||||
@@ -1960,6 +1962,12 @@ struct hl_mmu_funcs {
|
||||
* @clock_gating_mask: is clock gating enabled. bitmask that represents the
|
||||
* different engines. See debugfs-driver-habanalabs for
|
||||
* details.
|
||||
* @boot_error_status_mask: contains a mask of the device boot error status.
|
||||
* Each bit represents a different error, according to
|
||||
* the defines in hl_boot_if.h. If the bit is cleared,
|
||||
* the error will be ignored by the driver during
|
||||
* device initialization. Mainly used to debug and
|
||||
* workaround firmware bugs
|
||||
* @in_reset: is device in reset flow.
|
||||
* @curr_pll_profile: current PLL profile.
|
||||
* @card_type: Various ASICs have several card types. This indicates the card
|
||||
@@ -2071,12 +2079,11 @@ struct hl_device {
|
||||
struct hl_mmu_priv mmu_priv;
|
||||
struct hl_mmu_funcs mmu_func[MMU_NUM_PGT_LOCATIONS];
|
||||
|
||||
enum pll_index *legacy_pll_map;
|
||||
|
||||
atomic64_t dram_used_mem;
|
||||
u64 timeout_jiffies;
|
||||
u64 max_power;
|
||||
u64 clock_gating_mask;
|
||||
u64 boot_error_status_mask;
|
||||
atomic_t in_reset;
|
||||
enum hl_pll_frequency curr_pll_profile;
|
||||
enum cpucp_card_types card_type;
|
||||
@@ -2387,9 +2394,9 @@ int hl_fw_cpucp_pci_counters_get(struct hl_device *hdev,
|
||||
struct hl_info_pci_counters *counters);
|
||||
int hl_fw_cpucp_total_energy_get(struct hl_device *hdev,
|
||||
u64 *total_energy);
|
||||
int get_used_pll_index(struct hl_device *hdev, enum pll_index input_pll_index,
|
||||
int get_used_pll_index(struct hl_device *hdev, u32 input_pll_index,
|
||||
enum pll_index *pll_index);
|
||||
int hl_fw_cpucp_pll_info_get(struct hl_device *hdev, enum pll_index pll_index,
|
||||
int hl_fw_cpucp_pll_info_get(struct hl_device *hdev, u32 pll_index,
|
||||
u16 *pll_freq_arr);
|
||||
int hl_fw_cpucp_power_get(struct hl_device *hdev, u64 *power);
|
||||
int hl_fw_init_cpu(struct hl_device *hdev, u32 cpu_boot_status_reg,
|
||||
@@ -2411,9 +2418,9 @@ int hl_pci_set_outbound_region(struct hl_device *hdev,
|
||||
int hl_pci_init(struct hl_device *hdev);
|
||||
void hl_pci_fini(struct hl_device *hdev);
|
||||
|
||||
long hl_get_frequency(struct hl_device *hdev, enum pll_index pll_index,
|
||||
long hl_get_frequency(struct hl_device *hdev, u32 pll_index,
|
||||
bool curr);
|
||||
void hl_set_frequency(struct hl_device *hdev, enum pll_index pll_index,
|
||||
void hl_set_frequency(struct hl_device *hdev, u32 pll_index,
|
||||
u64 freq);
|
||||
int hl_get_temperature(struct hl_device *hdev,
|
||||
int sensor_index, u32 attr, long *value);
|
||||
|
||||
@@ -30,6 +30,7 @@ static DEFINE_MUTEX(hl_devs_idr_lock);
|
||||
static int timeout_locked = 30;
|
||||
static int reset_on_lockup = 1;
|
||||
static int memory_scrub = 1;
|
||||
static ulong boot_error_status_mask = ULONG_MAX;
|
||||
|
||||
module_param(timeout_locked, int, 0444);
|
||||
MODULE_PARM_DESC(timeout_locked,
|
||||
@@ -43,6 +44,10 @@ module_param(memory_scrub, int, 0444);
|
||||
MODULE_PARM_DESC(memory_scrub,
|
||||
"Scrub device memory in various states (0 = no, 1 = yes, default yes)");
|
||||
|
||||
module_param(boot_error_status_mask, ulong, 0444);
|
||||
MODULE_PARM_DESC(boot_error_status_mask,
|
||||
"Mask of the error status during device CPU boot (If bitX is cleared then error X is masked. Default all 1's)");
|
||||
|
||||
#define PCI_VENDOR_ID_HABANALABS 0x1da3
|
||||
|
||||
#define PCI_IDS_GOYA 0x0001
|
||||
@@ -319,6 +324,8 @@ int create_hdev(struct hl_device **dev, struct pci_dev *pdev,
|
||||
hdev->major = hl_major;
|
||||
hdev->reset_on_lockup = reset_on_lockup;
|
||||
hdev->memory_scrub = memory_scrub;
|
||||
hdev->boot_error_status_mask = boot_error_status_mask;
|
||||
|
||||
hdev->pldm = 0;
|
||||
|
||||
set_driver_behavior_per_device(hdev);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <linux/pci.h>
|
||||
|
||||
long hl_get_frequency(struct hl_device *hdev, enum pll_index pll_index,
|
||||
long hl_get_frequency(struct hl_device *hdev, u32 pll_index,
|
||||
bool curr)
|
||||
{
|
||||
struct cpucp_packet pkt;
|
||||
@@ -44,7 +44,7 @@ long hl_get_frequency(struct hl_device *hdev, enum pll_index pll_index,
|
||||
return (long) result;
|
||||
}
|
||||
|
||||
void hl_set_frequency(struct hl_device *hdev, enum pll_index pll_index,
|
||||
void hl_set_frequency(struct hl_device *hdev, u32 pll_index,
|
||||
u64 freq)
|
||||
{
|
||||
struct cpucp_packet pkt;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user