[PATCH v7 01/12] exec/memtxattr: add process identifier to the transaction attributes

Daniel Henrique Barboza posted 12 patches 2 months, 3 weeks ago
There is a newer version of this series
[PATCH v7 01/12] exec/memtxattr: add process identifier to the transaction attributes
Posted by Daniel Henrique Barboza 2 months, 3 weeks ago
From: Tomasz Jeznach <tjeznach@rivosinc.com>

Extend memory transaction attributes with process identifier to allow
per-request address translation logic to use requester_id / process_id
to identify memory mapping (e.g. enabling IOMMU w/ PASID translations).

Signed-off-by: Tomasz Jeznach <tjeznach@rivosinc.com>
Reviewed-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Jason Chien <jason.chien@sifive.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
---
 include/exec/memattrs.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/exec/memattrs.h b/include/exec/memattrs.h
index 14cdd8d582..e27c18f3dc 100644
--- a/include/exec/memattrs.h
+++ b/include/exec/memattrs.h
@@ -52,6 +52,11 @@ typedef struct MemTxAttrs {
     unsigned int memory:1;
     /* Requester ID (for MSI for example) */
     unsigned int requester_id:16;
+
+    /*
+     * PID (PCI PASID) support: Limited to 8 bits process identifier.
+     */
+    unsigned int pid:8;
 } MemTxAttrs;
 
 /* Bus masters which don't specify any attributes will get this,
-- 
2.45.2
Re: [PATCH v7 01/12] exec/memtxattr: add process identifier to the transaction attributes
Posted by Richard Henderson 2 months, 3 weeks ago
On 9/3/24 13:16, Daniel Henrique Barboza wrote:
> From: Tomasz Jeznach <tjeznach@rivosinc.com>
> 
> Extend memory transaction attributes with process identifier to allow
> per-request address translation logic to use requester_id / process_id
> to identify memory mapping (e.g. enabling IOMMU w/ PASID translations).
> 
> Signed-off-by: Tomasz Jeznach <tjeznach@rivosinc.com>
> Reviewed-by: Frank Chang <frank.chang@sifive.com>
> Reviewed-by: Jason Chien <jason.chien@sifive.com>
> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
> ---
>   include/exec/memattrs.h | 5 +++++
>   1 file changed, 5 insertions(+)

What is this for?  What is different about it than requester_id?


r~

> 
> diff --git a/include/exec/memattrs.h b/include/exec/memattrs.h
> index 14cdd8d582..e27c18f3dc 100644
> --- a/include/exec/memattrs.h
> +++ b/include/exec/memattrs.h
> @@ -52,6 +52,11 @@ typedef struct MemTxAttrs {
>       unsigned int memory:1;
>       /* Requester ID (for MSI for example) */
>       unsigned int requester_id:16;
> +
> +    /*
> +     * PID (PCI PASID) support: Limited to 8 bits process identifier.
> +     */
> +    unsigned int pid:8;
>   } MemTxAttrs;
>   
>   /* Bus masters which don't specify any attributes will get this,
Re: [PATCH v7 01/12] exec/memtxattr: add process identifier to the transaction attributes
Posted by Daniel Henrique Barboza 2 months, 3 weeks ago

On 9/3/24 5:31 PM, Richard Henderson wrote:
> On 9/3/24 13:16, Daniel Henrique Barboza wrote:
>> From: Tomasz Jeznach <tjeznach@rivosinc.com>
>>
>> Extend memory transaction attributes with process identifier to allow
>> per-request address translation logic to use requester_id / process_id
>> to identify memory mapping (e.g. enabling IOMMU w/ PASID translations).
>>
>> Signed-off-by: Tomasz Jeznach <tjeznach@rivosinc.com>
>> Reviewed-by: Frank Chang <frank.chang@sifive.com>
>> Reviewed-by: Jason Chien <jason.chien@sifive.com>
>> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
>> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
>> ---
>>   include/exec/memattrs.h | 5 +++++
>>   1 file changed, 5 insertions(+)
> 
> What is this for?  What is different about it than requester_id?

The IOMMU memory region uses both the requester_id (internally called device_id) and
the process id (the PASID for PCI devices) to identify a context because the IOMMU
allows the same PID to be used by multiple requester_ids. Using only the requester_id
is not enough to identify the IOMMU context.


Thanks,

Daniel

> 
> 
> r~
> 
>>
>> diff --git a/include/exec/memattrs.h b/include/exec/memattrs.h
>> index 14cdd8d582..e27c18f3dc 100644
>> --- a/include/exec/memattrs.h
>> +++ b/include/exec/memattrs.h
>> @@ -52,6 +52,11 @@ typedef struct MemTxAttrs {
>>       unsigned int memory:1;
>>       /* Requester ID (for MSI for example) */
>>       unsigned int requester_id:16;
>> +
>> +    /*
>> +     * PID (PCI PASID) support: Limited to 8 bits process identifier.
>> +     */
>> +    unsigned int pid:8;
>>   } MemTxAttrs;
>>   /* Bus masters which don't specify any attributes will get this,
>