xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Goel, Sameer" <sgoel@codeaurora.org>
To: Robin Murphy <robin.murphy@arm.com>,
	xen-devel@lists.xenproject.org,
	Julien Grall <julien.grall@arm.com>
Cc: Tomasz Nowicki <tn@semihalf.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Shanker Donthineni <shankerd@codeaurora.org>,
	Punit Agrawal <punit.agrawal@arm.com>
Subject: Re: [RFC 6/6] acpi:arm64: Add support for parsing IORT table
Date: Mon, 28 Aug 2017 15:48:03 -0600	[thread overview]
Message-ID: <f0532b96-3166-80b9-9ee5-859d8185ac81@codeaurora.org> (raw)
In-Reply-To: <0354697b-28e2-1805-c2fb-bfdc8a80c637@arm.com>



On 6/9/2017 5:15 AM, Robin Murphy wrote:
> On 08/06/17 20:30, Sameer Goel wrote:
> [...]
>>  /**
>> - * iort_iommu_configure - Set-up IOMMU configuration for a device.
>> + * iort_iommu_configure - Set-up IOMMU configuration for a device. This
>> + * function sets up the fwspec as needed for a given device. Only PCI
>> + * devices are supported for now.
>>   *
>>   * @dev: device to configure
>>   *
>> - * Returns: iommu_ops pointer on configuration success
>> - *          NULL on configuration failure
>> + * Returns: Appropriate acpi_status
>>   */
>> -const struct iommu_ops *iort_iommu_configure(struct device *dev)
>> +acpi_status iort_iommu_configure(struct device *dev)
>>  {
>>  	struct acpi_iort_node *node, *parent;
>> -	const struct iommu_ops *ops = NULL;
>>  	u32 streamid = 0;
>> +	acpi_status status = AE_OK;
>>  
>>  	if (dev_is_pci(dev)) {
>> -		struct pci_bus *bus = to_pci_dev(dev)->bus;
>> +		struct pci_dev *pci_device = to_pci_dev(dev);
>>  		u32 rid;
>>  
>> -		pci_for_each_dma_alias(to_pci_dev(dev), __get_pci_rid,
>> -				       &rid);
>> +		rid = PCI_BDF2(pci_device->bus,pci_device->devfn);
> 
> Beware that the Linux code isn't actually correct to begin with[1]. I
> don't know how much Xen deals with PCI bridges and quirks, but as it
> stands you should be able to trivially expose the flaw here by plugging
> in a Marvell 88SE912x-based SATA card and watching either DMA or MSIs
> (or even both) kick up stream table faults.
> 
Appreciate the feedback Robin. I will try to incorporate the new IORT changes 
when I release the first patch set.  
> Robin.
> 
> [1]:http://www.spinics.net/lists/linux-acpi/msg74844.html
> 
>>  
>>  		node = iort_scan_node(ACPI_IORT_NODE_PCI_ROOT_COMPLEX,
>> -				      iort_match_node_callback, &bus->dev);
>> +				      iort_match_node_callback, dev);
>>  		if (!node)
>> -			return NULL;
>> +			return AE_NOT_FOUND;
>>  
>>  		parent = iort_node_map_rid(node, rid, &streamid,
>>  					   IORT_IOMMU_TYPE);
>>  
>> -		ops = iort_iommu_xlate(dev, parent, streamid);
>> +		status = iort_iommu_xlate(dev, parent, streamid);
>> +
>> +		status = status ? AE_ERROR : AE_OK;
>>  
>>  	} else {
>> +		status = AE_NOT_IMPLEMENTED;
>> +#if 0
>>  		int i = 0;
>>  
>>  		node = iort_scan_node(ACPI_IORT_NODE_NAMED_COMPONENT,
>> @@ -616,11 +655,17 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev)
>>  			parent = iort_node_get_id(node, &streamid,
>>  						  IORT_IOMMU_TYPE, i++);
>>  		}
>> +#endif
>>  	}
>>  
>> -	return ops;
>> +	return status;
>>  }
> 

-- 
 Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2017-08-28 21:48 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08 19:30 [RFC 0/6] IORT support and introduce fwspec Sameer Goel
2017-06-08 19:30 ` [RFC 1/6] passthrough/arm: Modify SMMU driver to use generic device definition Sameer Goel
2017-06-12 12:34   ` Julien Grall
2017-06-08 19:30 ` [RFC 2/6] arm64: Add definitions for fwnode_handle Sameer Goel
2017-06-08 19:47   ` Julien Grall
2017-06-08 19:59   ` Julien Grall
2017-06-08 21:42     ` Goel, Sameer
2017-06-08 21:57       ` Stefano Stabellini
2017-06-12 12:40         ` Julien Grall
2017-08-28 21:42           ` Goel, Sameer
2017-06-12 12:51       ` Julien Grall
2017-08-28 21:41         ` Goel, Sameer
2017-06-08 19:30 ` [RFC 3/6] Introduce _xrealloc Sameer Goel
2017-06-08 19:49   ` Julien Grall
2017-06-09  9:44     ` Wei Liu
2017-08-28 21:39       ` Goel, Sameer
2017-10-12 13:33         ` Julien Grall
2017-10-12 14:45           ` Wei Liu
2017-06-08 21:51   ` Stefano Stabellini
2017-06-08 19:30 ` [RFC 4/6] xen/passthrough/arm: Introduce iommu_fwspec Sameer Goel
2017-06-08 20:02   ` Julien Grall
2017-06-08 19:30 ` [RFC 5/6] ACPI: arm: Support for IORT Sameer Goel
2017-07-14 15:36   ` Jan Beulich
2017-06-08 19:30 ` [RFC 6/6] acpi:arm64: Add support for parsing IORT table Sameer Goel
2017-06-08 22:22   ` Stefano Stabellini
2017-06-09 11:15   ` Robin Murphy
2017-06-12 13:36     ` Julien Grall
2017-06-12 13:44       ` Jan Beulich
2017-06-21 16:55         ` Robin Murphy
2017-08-28 21:48     ` Goel, Sameer [this message]
2017-06-12 13:24   ` Julien Grall
2017-08-28 22:21     ` Goel, Sameer
2017-09-12 11:25       ` Julien Grall
2017-09-21  0:37         ` Goel, Sameer
2017-09-21 10:54           ` Julien Grall
2017-07-14 15:41   ` Jan Beulich

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=f0532b96-3166-80b9-9ee5-859d8185ac81@codeaurora.org \
    --to=sgoel@codeaurora.org \
    --cc=julien.grall@arm.com \
    --cc=punit.agrawal@arm.com \
    --cc=robin.murphy@arm.com \
    --cc=shankerd@codeaurora.org \
    --cc=sstabellini@kernel.org \
    --cc=tn@semihalf.com \
    --cc=xen-devel@lists.xenproject.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;
as well as URLs for NNTP newsgroup(s).