lkml.org 
[lkml]   [2013]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/1] x86/iommu: use bit structures for context_entry
Use lo and hi for clear, may run faster than memset.

But it is not a big problem. Never mind.

Thanks
ZhenHua

On 05/24/2013 08:36 AM, Joe Perches wrote:
> On Fri, 2013-05-24 at 08:22 +0800, Li, Zhen-Hua wrote:
>> There is a structure named context_entry used by intel iommu, and there
>> are some bit operations on it. Use bit structure may make these operations
>> easy.
> []
>> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
> []
>> @@ -221,55 +221,28 @@ get_context_addr_from_root(struct root_entry *root)
>> * 8-23: domain id
>> */
>> struct context_entry {
>> - u64 lo;
>> - u64 hi;
>> + union {
>> + struct {
>> + u64 present:1,
> why use struct and union at all?
>
> Why not just:
>
> struct context_entry {
> u64 present:1,
> fpd:1,
> translation_type:2,
> reserved_l:8,
> asr:52;
> u64 aw:3,
> avail:4,
> reserved_h1:1,
> did:16,
> reserved_h2:40;
> };
>
>> @@ -743,7 +716,8 @@ static void clear_context_table(struct intel_iommu *iommu, u8 bus, u8 devfn)
> []
>> if (context) {
>> - context_clear_entry(&context[devfn]);
>> + context[devfn].lo = 0;
>> + context[devfn].hi = 0;
> memset(&context[devfn], 0, sizeof(...))
>
>



\
 
 \ /
  Last update: 2013-05-24 03:21    [W:0.083 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site