lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 10 Mar 2014 19:23:11 +0000
From:	"Sumner, William" <bill.sumner@...com>
To:	Joerg Roedel <joro@...tes.org>
CC:	"dwmw2@...radead.org" <dwmw2@...radead.org>,
	"indou.takao@...fujitsu.com" <indou.takao@...fujitsu.com>,
	"bhe@...hat.com" <bhe@...hat.com>,
	"iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
	"kexec@...ts.infradead.org" <kexec@...ts.infradead.org>,
	"alex.williamson@...hat.com" <alex.williamson@...hat.com>,
	"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"ddutile@...hat.com" <ddutile@...hat.com>,
	"ishii.hironobu@...fujitsu.com" <ishii.hironobu@...fujitsu.com>,
	"bhelgaas@...gle.com" <bhelgaas@...gle.com>,
	"Hatch, Douglas B (HPS Linux PM)" <doug.hatch@...com>,
	"Li, Zhen-Hua" <zhen-hual@...com>
Subject: RE: [PATCHv3 3/6] Crashdump-Accepting-Active-IOMMU-Domain-Interfaces

On Tue 3/4/2014 8:59 AM, Joerg Roedel wrote
>On Fri, Jan 10, 2014 at 03:07:29PM -0700, Bill Sumner wrote:
>> +context_get_entry(struct context_entry *context_addr,
>> +			struct intel_iommu *iommu, u32 bus, int devfn) {
>> +	unsigned long long q;		/* quadword scratch */
>> +	struct root_entry *root_phys;	/* Phys adr (root table entry) */
>> +	struct root_entry  root_temp;	/* Local copy of root_entry */
>> +	struct context_entry *context_phys;	/* Phys adr */
>> +
>> +	if (pr_dbg.domain_get)
>> +		pr_debug("ENTER %s B:D:F=%2.2x:%2.2x:%1.1x &context_entry:0x%llx &intel_iommu:0x%llx\n",
>> +			__func__, bus, devfn>>3, devfn&7,
>> +			(u64)context_addr, (u64)iommu);
>> +
>> +	if (bus > 255)				/* Sanity check */
>> +		return -5;
>> +	if (devfn > 255 || devfn < 0)		/* Sanity check */
>> +		return -6;
>> +
>> +	q = readq(iommu->reg + DMAR_RTADDR_REG);
>> +	pr_debug("IOMMU %d: DMAR_RTADDR_REG:0x%16.16llx\n", iommu->seq_id, q);
>> +	if (!q)
>> +		return -1;
>> +
>> +	root_phys = (struct root_entry *) q;	/* Adr(base of vector) */
>> +	root_phys += bus;			/* Adr(entry we want) */
>> +
>> +	oldcopy(&root_temp, root_phys, sizeof(root_temp));
>> +
>> +	pr_debug("root_temp.val:0x%llx .rsvd1:0x%llx root_phys:0x%llx\n",
>> +		root_temp.val, root_temp.rsvd1, (u64)root_phys);
>> +
>> +	if (!root_present(&root_temp))
>> +		return -2;
>> +
>> +	pr_debug("B:D:F=%2.2x:%2.2x:%1.1x root_temp.val: %llx .rsvd1: %llx\n",
>> +		bus, devfn >> 3, devfn & 7, root_temp.val, root_temp.rsvd1);
>> +
>> +	if (root_temp.rsvd1)			/* If (root_entry is bad) */
>> +		return -3;
>> +
>> +	context_phys = get_context_phys_from_root(&root_temp);
>> +	if (!context_phys)
>> +		return -4;
>
>What do all these magic return values mean? 

They all mean "No value to return".  The different negative values are an artifact of the development where I wanted to make it easy not only to tell that something went wrong, but also to have enough detail to figure-out what happened without having to add code and repeat the test.  I will clean-up these in the next submission -- along with a few additional places where there are similar "leftovers".  

Bill


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists