Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

soc/tegra: fuse: Add nvmem keepout list

On Tegra186 and later, various FUSE offsets are restricted and cannot be
accessed from CCPLEX. Currently nvmem binary interface allows reading
such offsets from userspace, which results in RAS errors.

Add nvmem keepout lists to avoid any reads to restricted offsets.

Signed-off-by: Kartik <kkartik@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>

authored by

Kartik and committed by
Thierry Reding
cc5b2ad5 bea06d77

+42
+2
drivers/soc/tegra/fuse/fuse-tegra.c
··· 149 149 nvmem.owner = THIS_MODULE; 150 150 nvmem.cells = fuse->soc->cells; 151 151 nvmem.ncells = fuse->soc->num_cells; 152 + nvmem.keepout = fuse->soc->keepouts; 153 + nvmem.nkeepout = fuse->soc->num_keepouts; 152 154 nvmem.type = NVMEM_TYPE_OTP; 153 155 nvmem.read_only = true; 154 156 nvmem.root_only = true;
+38
drivers/soc/tegra/fuse/fuse-tegra30.c
··· 9 9 #include <linux/io.h> 10 10 #include <linux/kernel.h> 11 11 #include <linux/nvmem-consumer.h> 12 + #include <linux/nvmem-provider.h> 12 13 #include <linux/of_device.h> 13 14 #include <linux/of_address.h> 14 15 #include <linux/platform_device.h> ··· 495 494 }, 496 495 }; 497 496 497 + static const struct nvmem_keepout tegra186_fuse_keepouts[] = { 498 + { .start = 0x01c, .end = 0x0f0 }, 499 + { .start = 0x138, .end = 0x198 }, 500 + { .start = 0x1d8, .end = 0x250 }, 501 + { .start = 0x280, .end = 0x290 }, 502 + { .start = 0x340, .end = 0x344 } 503 + }; 504 + 498 505 static const struct tegra_fuse_info tegra186_fuse_info = { 499 506 .read = tegra30_fuse_read, 500 507 .size = 0x478, ··· 516 507 .num_lookups = ARRAY_SIZE(tegra186_fuse_lookups), 517 508 .cells = tegra186_fuse_cells, 518 509 .num_cells = ARRAY_SIZE(tegra186_fuse_cells), 510 + .keepouts = tegra186_fuse_keepouts, 511 + .num_keepouts = ARRAY_SIZE(tegra186_fuse_keepouts), 519 512 .soc_attr_group = &tegra_soc_attr_group, 520 513 .clk_suspend_on = false, 521 514 }; ··· 587 576 }, 588 577 }; 589 578 579 + static const struct nvmem_keepout tegra194_fuse_keepouts[] = { 580 + { .start = 0x01c, .end = 0x0b8 }, 581 + { .start = 0x12c, .end = 0x198 }, 582 + { .start = 0x1a0, .end = 0x1bc }, 583 + { .start = 0x1d8, .end = 0x250 }, 584 + { .start = 0x270, .end = 0x290 }, 585 + { .start = 0x310, .end = 0x45c } 586 + }; 587 + 590 588 static const struct tegra_fuse_info tegra194_fuse_info = { 591 589 .read = tegra30_fuse_read, 592 590 .size = 0x650, ··· 609 589 .num_lookups = ARRAY_SIZE(tegra194_fuse_lookups), 610 590 .cells = tegra194_fuse_cells, 611 591 .num_cells = ARRAY_SIZE(tegra194_fuse_cells), 592 + .keepouts = tegra194_fuse_keepouts, 593 + .num_keepouts = ARRAY_SIZE(tegra194_fuse_keepouts), 612 594 .soc_attr_group = &tegra194_soc_attr_group, 613 595 .clk_suspend_on = false, 614 596 }; ··· 647 625 }, 648 626 }; 649 627 628 + static const struct nvmem_keepout tegra234_fuse_keepouts[] = { 629 + { .start = 0x01c, .end = 0x0c8 }, 630 + { .start = 0x12c, .end = 0x184 }, 631 + { .start = 0x190, .end = 0x198 }, 632 + { .start = 0x1a0, .end = 0x204 }, 633 + { .start = 0x21c, .end = 0x250 }, 634 + { .start = 0x25c, .end = 0x2f0 }, 635 + { .start = 0x310, .end = 0x3d8 }, 636 + { .start = 0x400, .end = 0x4f0 }, 637 + { .start = 0x4f8, .end = 0x7e8 }, 638 + { .start = 0x8d0, .end = 0x8d8 }, 639 + { .start = 0xacc, .end = 0xf00 } 640 + }; 641 + 650 642 static const struct tegra_fuse_info tegra234_fuse_info = { 651 643 .read = tegra30_fuse_read, 652 644 .size = 0x98c, ··· 674 638 .num_lookups = ARRAY_SIZE(tegra234_fuse_lookups), 675 639 .cells = tegra234_fuse_cells, 676 640 .num_cells = ARRAY_SIZE(tegra234_fuse_cells), 641 + .keepouts = tegra234_fuse_keepouts, 642 + .num_keepouts = ARRAY_SIZE(tegra234_fuse_keepouts), 677 643 .soc_attr_group = &tegra194_soc_attr_group, 678 644 .clk_suspend_on = false, 679 645 };
+2
drivers/soc/tegra/fuse/fuse.h
··· 34 34 unsigned int num_lookups; 35 35 const struct nvmem_cell_info *cells; 36 36 unsigned int num_cells; 37 + const struct nvmem_keepout *keepouts; 38 + unsigned int num_keepouts; 37 39 38 40 const struct attribute_group *soc_attr_group; 39 41