Merge "xlat lib v2: Add support to pass shareability attribute for normal memory region" into integration
This commit is contained in:
commit
f4367eb77c
|
@ -66,6 +66,11 @@
|
||||||
#define MT_EXECUTE_SHIFT U(5)
|
#define MT_EXECUTE_SHIFT U(5)
|
||||||
/* In the EL1&0 translation regime, User (EL0) or Privileged (EL1). */
|
/* In the EL1&0 translation regime, User (EL0) or Privileged (EL1). */
|
||||||
#define MT_USER_SHIFT U(6)
|
#define MT_USER_SHIFT U(6)
|
||||||
|
|
||||||
|
/* Shareability attribute for the memory region */
|
||||||
|
#define MT_SHAREABILITY_SHIFT U(7)
|
||||||
|
#define MT_SHAREABILITY_MASK (U(3) << MT_SHAREABILITY_SHIFT)
|
||||||
|
#define MT_SHAREABILITY(_attr) ((_attr) & MT_SHAREABILITY_MASK)
|
||||||
/* All other bits are reserved */
|
/* All other bits are reserved */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -106,6 +111,18 @@
|
||||||
#define MT_USER (U(1) << MT_USER_SHIFT)
|
#define MT_USER (U(1) << MT_USER_SHIFT)
|
||||||
#define MT_PRIVILEGED (U(0) << MT_USER_SHIFT)
|
#define MT_PRIVILEGED (U(0) << MT_USER_SHIFT)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Shareability defines the visibility of any cache changes to
|
||||||
|
* all masters belonging to a shareable domain.
|
||||||
|
*
|
||||||
|
* MT_SHAREABILITY_ISH: For inner shareable domain
|
||||||
|
* MT_SHAREABILITY_OSH: For outer shareable domain
|
||||||
|
* MT_SHAREABILITY_NSH: For non shareable domain
|
||||||
|
*/
|
||||||
|
#define MT_SHAREABILITY_ISH (U(1) << MT_SHAREABILITY_SHIFT)
|
||||||
|
#define MT_SHAREABILITY_OSH (U(2) << MT_SHAREABILITY_SHIFT)
|
||||||
|
#define MT_SHAREABILITY_NSH (U(3) << MT_SHAREABILITY_SHIFT)
|
||||||
|
|
||||||
/* Compound attributes for most common usages */
|
/* Compound attributes for most common usages */
|
||||||
#define MT_CODE (MT_MEMORY | MT_RO | MT_EXECUTE)
|
#define MT_CODE (MT_MEMORY | MT_RO | MT_EXECUTE)
|
||||||
#define MT_RO_DATA (MT_MEMORY | MT_RO | MT_EXECUTE_NEVER)
|
#define MT_RO_DATA (MT_MEMORY | MT_RO | MT_EXECUTE_NEVER)
|
||||||
|
|
|
@ -109,6 +109,7 @@ uint64_t xlat_desc(const xlat_ctx_t *ctx, uint32_t attr,
|
||||||
{
|
{
|
||||||
uint64_t desc;
|
uint64_t desc;
|
||||||
uint32_t mem_type;
|
uint32_t mem_type;
|
||||||
|
uint32_t shareability_type;
|
||||||
|
|
||||||
/* Make sure that the granularity is fine enough to map this address. */
|
/* Make sure that the granularity is fine enough to map this address. */
|
||||||
assert((addr_pa & XLAT_BLOCK_MASK(level)) == 0U);
|
assert((addr_pa & XLAT_BLOCK_MASK(level)) == 0U);
|
||||||
|
@ -194,8 +195,16 @@ uint64_t xlat_desc(const xlat_ctx_t *ctx, uint32_t attr,
|
||||||
desc |= xlat_arch_regime_get_xn_desc(ctx->xlat_regime);
|
desc |= xlat_arch_regime_get_xn_desc(ctx->xlat_regime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shareability_type = MT_SHAREABILITY(attr);
|
||||||
if (mem_type == MT_MEMORY) {
|
if (mem_type == MT_MEMORY) {
|
||||||
desc |= LOWER_ATTRS(ATTR_IWBWA_OWBWA_NTR_INDEX | ISH);
|
desc |= LOWER_ATTRS(ATTR_IWBWA_OWBWA_NTR_INDEX);
|
||||||
|
if (shareability_type == MT_SHAREABILITY_NSH) {
|
||||||
|
desc |= LOWER_ATTRS(NSH);
|
||||||
|
} else if (shareability_type == MT_SHAREABILITY_OSH) {
|
||||||
|
desc |= LOWER_ATTRS(OSH);
|
||||||
|
} else {
|
||||||
|
desc |= LOWER_ATTRS(ISH);
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if Branch Target Identification is enabled */
|
/* Check if Branch Target Identification is enabled */
|
||||||
#if ENABLE_BTI
|
#if ENABLE_BTI
|
||||||
|
|
Loading…
Reference in New Issue