Message ID | 20200826183749.143980-9-grimm@linux.ibm.com |
---|---|
State | Changes Requested |
Headers | show |
Series | Ultravisor support in skiboot | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch master (abe4c4799ffee4be12674ad59fc0bc521b0724f3) |
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot | success | Test snowpatch/job/snowpatch-skiboot on branch master |
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco | success | Signed-off-by present |
On Thu, Aug 27, 2020 at 5:07 AM Ryan Grimm <grimm@linux.ibm.com> wrote: > > The secure memory ranges are provided by the hostboot through HDAT. > Skiboot parses HDAT and creates secure-memory@ device tree nodes. The > secure-memory nodes set dev_type to "secure-memory" so the kernel > doesn't try to use them. > > In the HDIF_ms_area_address_range structure, HDAT spec version 10.5, the > mirror attribute at offset 0x14 is renamed to memory attribute. > > The memory attribute now defines byte 3 as secure memory whereas > previously it was reserved. The rest of the attribute is unchanged: > > 1st byte -> Range is Mirrorable > 0x00 = false > 0x01 = true > 2nd byte -> Hardware Mirroring Algorithm > 0x0A – Memory Mirroring algorithm for P9 systems > 0xFF – Memory Mirroring Not Supported > 3rd byte -> SMF Memory > 0x00 = false > 0x01 = true > 4th byte -> Reserved > > Signed-off-by: Ryan Grimm <grimm@linux.ibm.com> > --- > hdata/memory.c | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) > > diff --git a/hdata/memory.c b/hdata/memory.c > index bd47fee4..9443f297 100755 > --- a/hdata/memory.c > +++ b/hdata/memory.c > @@ -32,7 +32,7 @@ struct HDIF_ms_area_address_range { > __be64 start; > __be64 end; > __be32 chip; > - __be32 mirror_attr; > + __be32 memory_attr; > __be64 mirror_start; > __be32 controller_id; > __be32 phys_attr; > @@ -66,6 +66,9 @@ struct HDIF_ms_area_address_range { > #define MS_CONTROLLER_MCC_ID(id) GETFIELD(PPC_BITMASK32(8, 15), id) > #define MS_CONTROLLER_OMI_ID(id) GETFIELD(PPC_BITMASK32(16, 31), id) > > +#define MS_ATTR_PEF PPC_BIT32(23) > +#define UV_SECURE_MEM_BIT PPC_BIT(15) Does the UV_SECURE_MEM_BIT macro still get used?
diff --git a/hdata/memory.c b/hdata/memory.c index bd47fee4..9443f297 100755 --- a/hdata/memory.c +++ b/hdata/memory.c @@ -32,7 +32,7 @@ struct HDIF_ms_area_address_range { __be64 start; __be64 end; __be32 chip; - __be32 mirror_attr; + __be32 memory_attr; __be64 mirror_start; __be32 controller_id; __be32 phys_attr; @@ -66,6 +66,9 @@ struct HDIF_ms_area_address_range { #define MS_CONTROLLER_MCC_ID(id) GETFIELD(PPC_BITMASK32(8, 15), id) #define MS_CONTROLLER_OMI_ID(id) GETFIELD(PPC_BITMASK32(16, 31), id) +#define MS_ATTR_PEF PPC_BIT32(23) +#define UV_SECURE_MEM_BIT PPC_BIT(15) + struct HDIF_ms_area_id { __be16 id; #define MS_PTYPE_RISER_CARD 0x8000 @@ -150,10 +153,10 @@ static bool add_address_range(struct dt_node *root, chip_id = pcid_to_chip_id(be32_to_cpu(arange->chip)); prlog(PR_DEBUG, " Range: 0x%016llx..0x%016llx " - "on Chip 0x%x mattr: 0x%x pattr: 0x%x status:0x%x\n", + "on Chip 0x%x memattr: 0x%08x pattr: 0x%x status:0x%x\n", (long long)be64_to_cpu(arange->start), (long long)be64_to_cpu(arange->end), - chip_id, be32_to_cpu(arange->mirror_attr), + chip_id, be32_to_cpu(arange->memory_attr), mem_type, mem_status); /* reg contains start and length */ @@ -182,6 +185,13 @@ static bool add_address_range(struct dt_node *root, return false; } + if (be32_to_cpu(arange->memory_attr) & MS_ATTR_PEF) { + prlog(PR_DEBUG, "HDAT: Found secure memory\n"); + name = "secure-memory"; + dev_type = "secure-memory"; + compat = "ibm,secure-memory"; + } + if (be16_to_cpu(id->flags) & MS_AREA_SHARED) { mem = dt_find_by_name_addr(dt_root, name, reg[0]); if (mem) {
The secure memory ranges are provided by the hostboot through HDAT. Skiboot parses HDAT and creates secure-memory@ device tree nodes. The secure-memory nodes set dev_type to "secure-memory" so the kernel doesn't try to use them. In the HDIF_ms_area_address_range structure, HDAT spec version 10.5, the mirror attribute at offset 0x14 is renamed to memory attribute. The memory attribute now defines byte 3 as secure memory whereas previously it was reserved. The rest of the attribute is unchanged: 1st byte -> Range is Mirrorable 0x00 = false 0x01 = true 2nd byte -> Hardware Mirroring Algorithm 0x0A – Memory Mirroring algorithm for P9 systems 0xFF – Memory Mirroring Not Supported 3rd byte -> SMF Memory 0x00 = false 0x01 = true 4th byte -> Reserved Signed-off-by: Ryan Grimm <grimm@linux.ibm.com> --- hdata/memory.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)