* amd_iommu_init.c: possible problem with IVHD_FLAG_HT_TUN_EN
@ 2009-05-02 13:20 Julia Lawall
2009-05-04 8:13 ` Joerg Roedel
0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2009-05-02 13:20 UTC (permalink / raw)
To: joerg.roedel, iommu, linux-kernel, kernel-janitors
The file arch/x86/kernel/amd_iommu_init.c contains the following code:
(starting at line 586 in a recent linux-next)
h->flags & IVHD_FLAG_HT_TUN_EN ?
iommu_feature_enable(iommu, CONTROL_HT_TUN_EN) :
iommu_feature_disable(iommu, CONTROL_HT_TUN_EN);
h->flags & IVHD_FLAG_PASSPW_EN ?
iommu_feature_enable(iommu, CONTROL_PASSPW_EN) :
iommu_feature_disable(iommu, CONTROL_PASSPW_EN);
h->flags & IVHD_FLAG_RESPASSPW_EN ?
iommu_feature_enable(iommu, CONTROL_RESPASSPW_EN) :
iommu_feature_disable(iommu, CONTROL_RESPASSPW_EN);
h->flags & IVHD_FLAG_ISOC_EN ?
iommu_feature_enable(iommu, CONTROL_ISOC_EN) :
iommu_feature_disable(iommu, CONTROL_ISOC_EN);
The only possible value of IVHD_FLAG_HT_TUN_EN, however, seems to be 0, as
defined in the same file, and thus the first test is never true. Is this
what is intended, or should the test be expressed in another way?
julia
This problem was found using the following semantic match:
(http://www.emn.fr/x-info/coccinelle/)
@r expression@
identifier C;
expression E;
position p;
@@
(
E & C@p && ...
|
E & C@p || ...
)
@s@
identifier r.C;
position p1;
@@
#define C 0
@t@
identifier r.C;
expression E != 0;
@@
#define C E
@script:python depends on s && !t@
p << r.p;
C << r.C;
@@
cocci.print_main("and with 0", p)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: amd_iommu_init.c: possible problem with IVHD_FLAG_HT_TUN_EN
2009-05-02 13:20 amd_iommu_init.c: possible problem with IVHD_FLAG_HT_TUN_EN Julia Lawall
@ 2009-05-04 8:13 ` Joerg Roedel
0 siblings, 0 replies; 2+ messages in thread
From: Joerg Roedel @ 2009-05-04 8:13 UTC (permalink / raw)
To: Julia Lawall; +Cc: iommu, linux-kernel, kernel-janitors
On Sat, May 02, 2009 at 03:20:23PM +0200, Julia Lawall wrote:
> The file arch/x86/kernel/amd_iommu_init.c contains the following code:
>
> (starting at line 586 in a recent linux-next)
>
> h->flags & IVHD_FLAG_HT_TUN_EN ?
> iommu_feature_enable(iommu, CONTROL_HT_TUN_EN) :
> iommu_feature_disable(iommu, CONTROL_HT_TUN_EN);
>
> h->flags & IVHD_FLAG_PASSPW_EN ?
> iommu_feature_enable(iommu, CONTROL_PASSPW_EN) :
> iommu_feature_disable(iommu, CONTROL_PASSPW_EN);
>
> h->flags & IVHD_FLAG_RESPASSPW_EN ?
> iommu_feature_enable(iommu, CONTROL_RESPASSPW_EN) :
> iommu_feature_disable(iommu, CONTROL_RESPASSPW_EN);
>
> h->flags & IVHD_FLAG_ISOC_EN ?
> iommu_feature_enable(iommu, CONTROL_ISOC_EN) :
> iommu_feature_disable(iommu, CONTROL_ISOC_EN);
>
> The only possible value of IVHD_FLAG_HT_TUN_EN, however, seems to be 0, as
> defined in the same file, and thus the first test is never true. Is this
> what is intended, or should the test be expressed in another way?
Very true. Another bug because I mixed up bit shifts with bit masks :-(
Thanks for reporting this. I will send a patch to fix it.
Joerg
--
| Advanced Micro Devices GmbH
Operating | Karl-Hammerschmidt-Str. 34, 85609 Dornach bei München
System |
Research | Geschäftsführer: Jochen Polster, Thomas M. McCoy, Giuliano Meroni
Center | Sitz: Dornach, Gemeinde Aschheim, Landkreis München
| Registergericht München, HRB Nr. 43632
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-05-04 8:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-02 13:20 amd_iommu_init.c: possible problem with IVHD_FLAG_HT_TUN_EN Julia Lawall
2009-05-04 8:13 ` Joerg Roedel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).