mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ZhenHua <zhen-hual@hp.com>
To: Joe Perches <joe@perches.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
	iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] x86/iommu: use bit structures for context_entry
Date: Fri, 24 May 2013 08:43:04 +0800	[thread overview]
Message-ID: <519EB798.2080904@hp.com> (raw)
In-Reply-To: <1369355784.2080.5.camel@joe-AO722>

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(...))
>
>


  reply	other threads:[~2013-05-24  0:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-24  0:22 Li, Zhen-Hua
2013-05-24  0:36 ` Joe Perches
2013-05-24  0:43   ` ZhenHua [this message]
2013-12-20  8:45 Li, Zhen-Hua
     [not found] ` <CAOtp4KqUgSnwadP0T=aWYX7rRzDBn3qkuqMzceDBO0c_bhpFwQ@mail.gmail.com>
     [not found]   ` <E959C4978C3B6342920538CF579893F001D3C26D@SHSMSX104.ccr.corp.intel.com>
2014-01-06  1:41     ` Li, ZhenHua
2014-01-07 14:41 ` Joerg Roedel
2014-01-10  7:29   ` Li, ZhenHua
2014-01-10  7:32     ` Jiang Liu
2014-01-10  8:27 Li, Zhen-Hua
2014-01-10  8:31 ` Li, ZhenHua

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=519EB798.2080904@hp.com \
    --to=zhen-hual@hp.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome