* [PATCH] sparc64: Add ADI capability to cpu capabilities
@ 2015-12-02 23:06 ` Khalid Aziz
0 siblings, 0 replies; 7+ messages in thread
From: Khalid Aziz @ 2015-12-02 23:06 UTC (permalink / raw)
To: davem; +Cc: Khalid Aziz, linux-kernel, sparclinux
Add ADI (Application Data Integrity) capability to cpu capabilities list.
ADI capability allows virtual addresses to be encoded with a tag in
bits 63-60. This tag serves as an access control key for the regions
of virtual address with ADI enabled and a key set on them. Hypervisor
encodes this capability as "adp" in "hwcap-list" property in machine
description.
Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
---
arch/sparc/include/asm/elf_64.h | 1 +
arch/sparc/kernel/setup_64.c | 23 +++++++++++++++--------
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/arch/sparc/include/asm/elf_64.h b/arch/sparc/include/asm/elf_64.h
index 370ca1e..9331083 100644
--- a/arch/sparc/include/asm/elf_64.h
+++ b/arch/sparc/include/asm/elf_64.h
@@ -95,6 +95,7 @@
* really available. So we simply advertise only "crypto" support.
*/
#define HWCAP_SPARC_CRYPTO 0x04000000 /* CRYPTO insns available */
+#define HWCAP_SPARC_ADI 0x08000000 /* ADI available */
#define CORE_DUMP_USE_REGSET
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
index f7b2617..22c3566 100644
--- a/arch/sparc/kernel/setup_64.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -380,7 +380,8 @@ static const char *hwcaps[] = {
*/
"mul32", "div32", "fsmuld", "v8plus", "popc", "vis", "vis2",
"ASIBlkInit", "fmaf", "vis3", "hpc", "random", "trans", "fjfmau",
- "ima", "cspare", "pause", "cbcond",
+ "ima", "cspare", "pause", "cbcond", NULL /*reserved for crypto */,
+ "adp",
};
static const char *crypto_hwcaps[] = {
@@ -396,9 +397,13 @@ void cpucap_info(struct seq_file *m)
seq_puts(m, "cpucaps\t\t: ");
for (i = 0; i < ARRAY_SIZE(hwcaps); i++) {
unsigned long bit = 1UL << i;
- if (caps & bit) {
- seq_printf(m, "%s%s",
- printed ? "," : "", hwcaps[i]);
+ if (hwcaps[i] && (caps & bit)) {
+ if (strcmp(hwcaps[i], "adp") = 0)
+ seq_printf(m, "%sadi",
+ printed ? "," : "");
+ else
+ seq_printf(m, "%s%s",
+ printed ? "," : "", hwcaps[i]);
printed++;
}
}
@@ -422,8 +427,10 @@ static void __init report_one_hwcap(int *printed, const char *name)
{
if ((*printed) = 0)
printk(KERN_INFO "CPU CAPS: [");
- printk(KERN_CONT "%s%s",
- (*printed) ? "," : "", name);
+ if (strcmp(name, "adp") = 0)
+ pr_cont("%sadi", (*printed) ? "," : "");
+ else
+ pr_cont("%s%s", (*printed) ? "," : "", name);
if (++(*printed) = 8) {
printk(KERN_CONT "]\n");
*printed = 0;
@@ -450,7 +457,7 @@ static void __init report_hwcaps(unsigned long caps)
for (i = 0; i < ARRAY_SIZE(hwcaps); i++) {
unsigned long bit = 1UL << i;
- if (caps & bit)
+ if (hwcaps[i] && (caps & bit))
report_one_hwcap(&printed, hwcaps[i]);
}
if (caps & HWCAP_SPARC_CRYPTO)
@@ -485,7 +492,7 @@ static unsigned long __init mdesc_cpu_hwcap_list(void)
for (i = 0; i < ARRAY_SIZE(hwcaps); i++) {
unsigned long bit = 1UL << i;
- if (!strcmp(prop, hwcaps[i])) {
+ if (hwcaps[i] && !strcmp(prop, hwcaps[i])) {
caps |= bit;
break;
}
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] sparc64: Add ADI capability to cpu capabilities
@ 2015-12-02 23:06 ` Khalid Aziz
0 siblings, 0 replies; 7+ messages in thread
From: Khalid Aziz @ 2015-12-02 23:06 UTC (permalink / raw)
To: davem; +Cc: Khalid Aziz, linux-kernel, sparclinux
Add ADI (Application Data Integrity) capability to cpu capabilities list.
ADI capability allows virtual addresses to be encoded with a tag in
bits 63-60. This tag serves as an access control key for the regions
of virtual address with ADI enabled and a key set on them. Hypervisor
encodes this capability as "adp" in "hwcap-list" property in machine
description.
Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
---
arch/sparc/include/asm/elf_64.h | 1 +
arch/sparc/kernel/setup_64.c | 23 +++++++++++++++--------
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/arch/sparc/include/asm/elf_64.h b/arch/sparc/include/asm/elf_64.h
index 370ca1e..9331083 100644
--- a/arch/sparc/include/asm/elf_64.h
+++ b/arch/sparc/include/asm/elf_64.h
@@ -95,6 +95,7 @@
* really available. So we simply advertise only "crypto" support.
*/
#define HWCAP_SPARC_CRYPTO 0x04000000 /* CRYPTO insns available */
+#define HWCAP_SPARC_ADI 0x08000000 /* ADI available */
#define CORE_DUMP_USE_REGSET
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
index f7b2617..22c3566 100644
--- a/arch/sparc/kernel/setup_64.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -380,7 +380,8 @@ static const char *hwcaps[] = {
*/
"mul32", "div32", "fsmuld", "v8plus", "popc", "vis", "vis2",
"ASIBlkInit", "fmaf", "vis3", "hpc", "random", "trans", "fjfmau",
- "ima", "cspare", "pause", "cbcond",
+ "ima", "cspare", "pause", "cbcond", NULL /*reserved for crypto */,
+ "adp",
};
static const char *crypto_hwcaps[] = {
@@ -396,9 +397,13 @@ void cpucap_info(struct seq_file *m)
seq_puts(m, "cpucaps\t\t: ");
for (i = 0; i < ARRAY_SIZE(hwcaps); i++) {
unsigned long bit = 1UL << i;
- if (caps & bit) {
- seq_printf(m, "%s%s",
- printed ? "," : "", hwcaps[i]);
+ if (hwcaps[i] && (caps & bit)) {
+ if (strcmp(hwcaps[i], "adp") == 0)
+ seq_printf(m, "%sadi",
+ printed ? "," : "");
+ else
+ seq_printf(m, "%s%s",
+ printed ? "," : "", hwcaps[i]);
printed++;
}
}
@@ -422,8 +427,10 @@ static void __init report_one_hwcap(int *printed, const char *name)
{
if ((*printed) == 0)
printk(KERN_INFO "CPU CAPS: [");
- printk(KERN_CONT "%s%s",
- (*printed) ? "," : "", name);
+ if (strcmp(name, "adp") == 0)
+ pr_cont("%sadi", (*printed) ? "," : "");
+ else
+ pr_cont("%s%s", (*printed) ? "," : "", name);
if (++(*printed) == 8) {
printk(KERN_CONT "]\n");
*printed = 0;
@@ -450,7 +457,7 @@ static void __init report_hwcaps(unsigned long caps)
for (i = 0; i < ARRAY_SIZE(hwcaps); i++) {
unsigned long bit = 1UL << i;
- if (caps & bit)
+ if (hwcaps[i] && (caps & bit))
report_one_hwcap(&printed, hwcaps[i]);
}
if (caps & HWCAP_SPARC_CRYPTO)
@@ -485,7 +492,7 @@ static unsigned long __init mdesc_cpu_hwcap_list(void)
for (i = 0; i < ARRAY_SIZE(hwcaps); i++) {
unsigned long bit = 1UL << i;
- if (!strcmp(prop, hwcaps[i])) {
+ if (hwcaps[i] && !strcmp(prop, hwcaps[i])) {
caps |= bit;
break;
}
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] sparc64: Add ADI capability to cpu capabilities
2015-12-02 23:06 ` Khalid Aziz
(?)
@ 2015-12-16 0:11 ` Josip Rodin
-1 siblings, 0 replies; 7+ messages in thread
From: Josip Rodin @ 2015-12-16 0:11 UTC (permalink / raw)
To: sparclinux
On Wed, Dec 02, 2015 at 04:06:40PM -0700, Khalid Aziz wrote:
> Add ADI (Application Data Integrity) capability to cpu capabilities list.
> ADI capability allows virtual addresses to be encoded with a tag in
> bits 63-60. This tag serves as an access control key for the regions
> of virtual address with ADI enabled and a key set on them. Hypervisor
> encodes this capability as "adp" in "hwcap-list" property in machine
> description.
> + if (strcmp(hwcaps[i], "adp") = 0)
> + seq_printf(m, "%sadi",
> + printed ? "," : "");
> + else
> + seq_printf(m, "%s%s",
> + printed ? "," : "", hwcaps[i]);
> + if (strcmp(name, "adp") = 0)
> + pr_cont("%sadi", (*printed) ? "," : "");
> + else
> + pr_cont("%s%s", (*printed) ? "," : "", name);
Why is it necessary to change the string from adp to adi in this output?
--
2. That which causes joy or happiness.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] sparc64: Add ADI capability to cpu capabilities
2015-12-02 23:06 ` Khalid Aziz
(?)
(?)
@ 2015-12-16 0:25 ` Khalid Aziz
-1 siblings, 0 replies; 7+ messages in thread
From: Khalid Aziz @ 2015-12-16 0:25 UTC (permalink / raw)
To: sparclinux
On 12/15/2015 05:11 PM, Josip Rodin wrote:
> On Wed, Dec 02, 2015 at 04:06:40PM -0700, Khalid Aziz wrote:
>> Add ADI (Application Data Integrity) capability to cpu capabilities list.
>> ADI capability allows virtual addresses to be encoded with a tag in
>> bits 63-60. This tag serves as an access control key for the regions
>> of virtual address with ADI enabled and a key set on them. Hypervisor
>> encodes this capability as "adp" in "hwcap-list" property in machine
>> description.
>
>> + if (strcmp(hwcaps[i], "adp") = 0)
>> + seq_printf(m, "%sadi",
>> + printed ? "," : "");
>> + else
>> + seq_printf(m, "%s%s",
>> + printed ? "," : "", hwcaps[i]);
>
>> + if (strcmp(name, "adp") = 0)
>> + pr_cont("%sadi", (*printed) ? "," : "");
>> + else
>> + pr_cont("%s%s", (*printed) ? "," : "", name);
>
> Why is it necessary to change the string from adp to adi in this output?
>
adi is the externally visible name for this feature and that is how it
is referenced in the docs. Firmware encodes it as "adp" for its internal
use and that is how it shows up in hwcap-list property. So this code
translates it from firmware internal name to the external name which
would make sense to someone looking at /proc/cpuinfo.
Thanks,
Khalid
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] sparc64: Add ADI capability to cpu capabilities
2015-12-02 23:06 ` Khalid Aziz
` (2 preceding siblings ...)
(?)
@ 2015-12-16 3:13 ` David Miller
-1 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2015-12-16 3:13 UTC (permalink / raw)
To: sparclinux
From: Khalid Aziz <khalid.aziz@oracle.com>
Date: Tue, 15 Dec 2015 17:25:42 -0700
> adi is the externally visible name for this feature and that is how it
> is referenced in the docs. Firmware encodes it as "adp" for its
> internal use and that is how it shows up in hwcap-list property. So
> this code translates it from firmware internal name to the external
> name which would make sense to someone looking at /proc/cpuinfo.
I totally disagree with changing the string.
If the firmware provides X that's what we should publish in the
cap list. It doesn't really matter what the docs say.
Otherwise we have this rediculous set of translations whenever
something like this pops up again, and that kind of crud tends
to accumulate.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] sparc64: Add ADI capability to cpu capabilities
2015-12-02 23:06 ` Khalid Aziz
` (3 preceding siblings ...)
(?)
@ 2015-12-16 15:01 ` Khalid Aziz
-1 siblings, 0 replies; 7+ messages in thread
From: Khalid Aziz @ 2015-12-16 15:01 UTC (permalink / raw)
To: sparclinux
On 12/15/2015 08:13 PM, David Miller wrote:
> From: Khalid Aziz <khalid.aziz@oracle.com>
> Date: Tue, 15 Dec 2015 17:25:42 -0700
>
>> adi is the externally visible name for this feature and that is how it
>> is referenced in the docs. Firmware encodes it as "adp" for its
>> internal use and that is how it shows up in hwcap-list property. So
>> this code translates it from firmware internal name to the external
>> name which would make sense to someone looking at /proc/cpuinfo.
>
> I totally disagree with changing the string.
>
> If the firmware provides X that's what we should publish in the
> cap list. It doesn't really matter what the docs say.
>
> Otherwise we have this rediculous set of translations whenever
> something like this pops up again, and that kind of crud tends
> to accumulate.
>
It is a marketing/copyright thing, but I agree with you :) Let me check
with marketing if they are ok with not doing the translation.
Thanks,
Khalid
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] sparc64: Add ADI capability to cpu capabilities
2015-12-02 23:06 ` Khalid Aziz
` (4 preceding siblings ...)
(?)
@ 2015-12-16 16:06 ` David Miller
-1 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2015-12-16 16:06 UTC (permalink / raw)
To: sparclinux
From: Khalid Aziz <khalid.aziz@oracle.com>
Date: Wed, 16 Dec 2015 08:01:03 -0700
> On 12/15/2015 08:13 PM, David Miller wrote:
>> From: Khalid Aziz <khalid.aziz@oracle.com>
>> Date: Tue, 15 Dec 2015 17:25:42 -0700
>>
>>> adi is the externally visible name for this feature and that is how it
>>> is referenced in the docs. Firmware encodes it as "adp" for its
>>> internal use and that is how it shows up in hwcap-list property. So
>>> this code translates it from firmware internal name to the external
>>> name which would make sense to someone looking at /proc/cpuinfo.
>>
>> I totally disagree with changing the string.
>>
>> If the firmware provides X that's what we should publish in the
>> cap list. It doesn't really matter what the docs say.
>>
>> Otherwise we have this rediculous set of translations whenever
>> something like this pops up again, and that kind of crud tends
>> to accumulate.
>>
>
> It is a marketing/copyright thing, but I agree with you :) Let me
> check with marketing if they are ok with not doing the translation.
You marketing team doesn't get to decide what string we end up
publishing to the user for this feature.
So if you don't do something reasonable, I will.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-12-16 16:06 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-02 23:06 [PATCH] sparc64: Add ADI capability to cpu capabilities Khalid Aziz
2015-12-02 23:06 ` Khalid Aziz
2015-12-16 0:11 ` Josip Rodin
2015-12-16 0:25 ` Khalid Aziz
2015-12-16 3:13 ` David Miller
2015-12-16 15:01 ` Khalid Aziz
2015-12-16 16:06 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.