Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tzc update #1994

Merged
merged 2 commits into from
Jan 17, 2018
Merged

Tzc update #1994

merged 2 commits into from
Jan 17, 2018

Conversation

MrVan
Copy link
Contributor

@MrVan MrVan commented Dec 8, 2017

  1. Do not touch reserved bits for region 0.
  2. Export more API for flexible configuration.

@@ -117,8 +117,13 @@ void tzc_configure_region(uint8_t region, vaddr_t region_base, uint32_t attr)

assert(region < tzc.num_regions);

tzc_write_region_base_low(tzc.base, region, addr_low(region_base));
tzc_write_region_base_high(tzc.base, region, addr_high(region_base));
if (!region) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wouldn't hurt with a comment here with something about region0

write32(1, base + SECURITY_INV_EN_OFF);
}

void tzc_enable_region(uint8_t region)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tzc_region_enable() would be more consistent with for instance tzc_security_inversion_en() and tzc_int_clear()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wouldn't hurt with a comment with a short description of some of the more important functions

@MrVan
Copy link
Contributor Author

MrVan commented Dec 20, 2017

Updated with more comments added. And tzc_enable_region -> tzc_region_enable

@jenswi-linaro
Copy link
Contributor

Acked-by: Jens Wiklander <jens.wiklander@linaro.org>

@@ -59,6 +61,11 @@ static void tzc_write_action(vaddr_t base, enum tzc_action action)
write32(action, base + ACTION_OFF);
}

static uint32_t tzc_read_region_attributes(vaddr_t base, uint32_t region)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: maybe move right above tzc_write_region_attributes

EMSG("Fail address Low %x\n", read32(base + 0x20));
EMSG("Fail address High %x\n", read32(base + 0x24));
EMSG("Fail Control %x\n", read32(base + 0x28));
EMSG("Fail Id %x\n", read32(base + 0x2C));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use define macros for the offsets?

#define TZC_FAIL_ADDRESS_LOW	0x20
#define TZC_FAIL_ADDRESS_HIGH	0x24
#define TZC_FAIL_CONTROL		0x28
#define TZC_FAIL_ID				0x2C

* For region 0, this high/low/size/en field is Read Only (RO).
* So should not configure those field for region 0.
*/
if (!region) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/!region/region/

@MrVan
Copy link
Contributor Author

MrVan commented Dec 22, 2017

Updated. Use macros for tzc_fail_dump. "s/!region/region/", in my local, I use "region != 0", my bad that not use up to date patch, in last pull request.

@jforissier
Copy link
Contributor

@etienne-lms ping

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on 2nd commit comment:
Also enable tzasc_int to catch some illegal access with tzc_fail_dump and tzc_int_clear.
Maybe rephrase without the reference to tzasc_int

Otherwise, look ok to me.

vaddr_t base __maybe_unused = core_mmu_get_va(tzc.base,
MEM_AREA_IO_SEC);

EMSG("Fail address Low %x\n", read32(base + FAIL_ADDRESS_LOW_OFF));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace %x with %" PRIx32 ", here and below.

@MrVan
Copy link
Contributor Author

MrVan commented Jan 17, 2018

Updated with "Replace %x with 0x%" PRIx32 ", 2nd commit log refined.

@jforissier
Copy link
Contributor

Thanks @MrVan . I think we can consider @etienne-lms's "looks ok to me" as an Acked-by: Etienne Carriere <etienne.carriere@linaro.org>. Can you please add it?

MrVan added 2 commits January 17, 2018 22:02
For region0, only SP is configurable, so should not configure
region low/high.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Introduce tzc_security_inversion_en tzc_enable_region tzc_fail_dump and
tzc_int_clear.

When we want to block secure access to region configured TZC_ATTR_SP_NS_RW,
need to use tzc_security_inversion_en.

Sometimes we need to configure the regions first, then enable the
region.

tzasc380 interrupt could be enabled to catch some illegal access
with tzc_fail_dump and tzc_int_clear.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
@MrVan
Copy link
Contributor Author

MrVan commented Jan 17, 2018

@jforissier Updated. Thanks.

@jforissier jforissier merged commit 343c157 into OP-TEE:master Jan 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants