mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-06 12:44:14 +08:00
ASoC: SOF: Intel: initialise and verify FW crash dump data.
FW mailbox offset was not set before use and HDR size was not validated. Fix this. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20190927200538.660-12-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
4ff5f6439f
commit
ff2be86563
@ -37,6 +37,7 @@
|
|||||||
#define MBOX_SIZE 0x1000
|
#define MBOX_SIZE 0x1000
|
||||||
#define MBOX_DUMP_SIZE 0x30
|
#define MBOX_DUMP_SIZE 0x30
|
||||||
#define EXCEPT_OFFSET 0x800
|
#define EXCEPT_OFFSET 0x800
|
||||||
|
#define EXCEPT_MAX_HDR_SIZE 0x400
|
||||||
|
|
||||||
/* DSP peripherals */
|
/* DSP peripherals */
|
||||||
#define DMAC0_OFFSET 0xFE000
|
#define DMAC0_OFFSET 0xFE000
|
||||||
@ -228,6 +229,11 @@ static void bdw_get_registers(struct snd_sof_dev *sdev,
|
|||||||
/* note: variable AR register array is not read */
|
/* note: variable AR register array is not read */
|
||||||
|
|
||||||
/* then get panic info */
|
/* then get panic info */
|
||||||
|
if (xoops->arch_hdr.totalsize > EXCEPT_MAX_HDR_SIZE) {
|
||||||
|
dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n",
|
||||||
|
xoops->arch_hdr.totalsize);
|
||||||
|
return;
|
||||||
|
}
|
||||||
offset += xoops->arch_hdr.totalsize;
|
offset += xoops->arch_hdr.totalsize;
|
||||||
sof_mailbox_read(sdev, offset, panic_info, sizeof(*panic_info));
|
sof_mailbox_read(sdev, offset, panic_info, sizeof(*panic_info));
|
||||||
|
|
||||||
@ -451,6 +457,7 @@ static int bdw_probe(struct snd_sof_dev *sdev)
|
|||||||
/* TODO: add offsets */
|
/* TODO: add offsets */
|
||||||
sdev->mmio_bar = BDW_DSP_BAR;
|
sdev->mmio_bar = BDW_DSP_BAR;
|
||||||
sdev->mailbox_bar = BDW_DSP_BAR;
|
sdev->mailbox_bar = BDW_DSP_BAR;
|
||||||
|
sdev->dsp_oops_offset = MBOX_OFFSET;
|
||||||
|
|
||||||
/* PCI base */
|
/* PCI base */
|
||||||
mmio = platform_get_resource(pdev, IORESOURCE_MEM,
|
mmio = platform_get_resource(pdev, IORESOURCE_MEM,
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#define MBOX_OFFSET 0x144000
|
#define MBOX_OFFSET 0x144000
|
||||||
#define MBOX_SIZE 0x1000
|
#define MBOX_SIZE 0x1000
|
||||||
#define EXCEPT_OFFSET 0x800
|
#define EXCEPT_OFFSET 0x800
|
||||||
|
#define EXCEPT_MAX_HDR_SIZE 0x400
|
||||||
|
|
||||||
/* DSP peripherals */
|
/* DSP peripherals */
|
||||||
#define DMAC0_OFFSET 0x098000
|
#define DMAC0_OFFSET 0x098000
|
||||||
@ -126,6 +127,11 @@ static void byt_get_registers(struct snd_sof_dev *sdev,
|
|||||||
/* note: variable AR register array is not read */
|
/* note: variable AR register array is not read */
|
||||||
|
|
||||||
/* then get panic info */
|
/* then get panic info */
|
||||||
|
if (xoops->arch_hdr.totalsize > EXCEPT_MAX_HDR_SIZE) {
|
||||||
|
dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n",
|
||||||
|
xoops->arch_hdr.totalsize);
|
||||||
|
return;
|
||||||
|
}
|
||||||
offset += xoops->arch_hdr.totalsize;
|
offset += xoops->arch_hdr.totalsize;
|
||||||
sof_mailbox_read(sdev, offset, panic_info, sizeof(*panic_info));
|
sof_mailbox_read(sdev, offset, panic_info, sizeof(*panic_info));
|
||||||
|
|
||||||
|
@ -35,6 +35,8 @@
|
|||||||
#define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348)
|
#define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348)
|
||||||
#define IS_CNL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9dc8)
|
#define IS_CNL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9dc8)
|
||||||
|
|
||||||
|
#define EXCEPT_MAX_HDR_SIZE 0x400
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Debug
|
* Debug
|
||||||
*/
|
*/
|
||||||
@ -131,6 +133,11 @@ static void hda_dsp_get_registers(struct snd_sof_dev *sdev,
|
|||||||
/* note: variable AR register array is not read */
|
/* note: variable AR register array is not read */
|
||||||
|
|
||||||
/* then get panic info */
|
/* then get panic info */
|
||||||
|
if (xoops->arch_hdr.totalsize > EXCEPT_MAX_HDR_SIZE) {
|
||||||
|
dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n",
|
||||||
|
xoops->arch_hdr.totalsize);
|
||||||
|
return;
|
||||||
|
}
|
||||||
offset += xoops->arch_hdr.totalsize;
|
offset += xoops->arch_hdr.totalsize;
|
||||||
sof_block_read(sdev, sdev->mmio_bar, offset,
|
sof_block_read(sdev, sdev->mmio_bar, offset,
|
||||||
panic_info, sizeof(*panic_info));
|
panic_info, sizeof(*panic_info));
|
||||||
|
Loading…
Reference in New Issue
Block a user