From: Julien Grall <julien.grall@arm.com>
To: "Goel, Sameer" <sgoel@codeaurora.org>, xen-devel@lists.xenproject.org
Cc: Tomasz Nowicki <tn@semihalf.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
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: Tue, 12 Sep 2017 12:25:43 +0100 [thread overview]
Message-ID: <59149b5a-256c-1b03-1f18-0622a85e92a2@arm.com> (raw)
In-Reply-To: <6aeb2ed8-6aff-d921-d0c3-1b2af8f56a81@codeaurora.org>
Hi Sameer,
On 28/08/17 23:21, Goel, Sameer wrote:
> On 6/12/2017 7:24 AM, Julien Grall wrote:
>>> static int arm_smmu_iort_xlate(struct device *dev, u32 streamid,
>>> struct fwnode_handle *fwnode,
>>> const struct iommu_ops *ops)
>>> @@ -523,29 +563,24 @@ static int arm_smmu_iort_xlate(struct device *dev, u32 streamid,
>>> return ret;
>>> }
>>>
>>> -static const struct iommu_ops *iort_iommu_xlate(struct device *dev,
>>> - struct acpi_iort_node *node,
>>> - u32 streamid)
>>> +static int iort_iommu_xlate(struct device *dev, struct acpi_iort_node *node,
>>> + u32 streamid)
>>> {
>>> - const struct iommu_ops *ops = NULL;
>>> int ret = -ENODEV;
>>> struct fwnode_handle *iort_fwnode;
>>>
>>> if (node) {
>>> iort_fwnode = iort_get_fwnode(node);
>>> if (!iort_fwnode)
>>> - return NULL;
>>> -
>>> - ops = iommu_ops_from_fwnode(iort_fwnode);
>>> - if (!ops)
>>> - return NULL;
>>> + return ret;
>>>
>>> - ret = arm_smmu_iort_xlate(dev, streamid, iort_fwnode, ops);
>>> + ret = arm_smmu_iort_xlate(dev, streamid, iort_fwnode, NULL);
>>
>> Why don't you get the IOMMU ops here? This would avoid unecessary change.
> From the linux definition it seems that there will be eventually used to override the ops
> set by the bus. I did not find a use for this here, so removed it to simplify code. I can
> add these back, but see this as dead code.
You will always have dead code if you import code as it is from Linux.
This is the price to pay to help rebase the code in the future.
In that specific case, I think return the ops is the right thing to do.
Potentially it will allow us to support different IOMMU at the same time.
[...]
>>> #define IORT_IRQ_MASK(irq) (irq & 0xffffffffULL)
>>> #define IORT_IRQ_TRIGGER_MASK(irq) ((irq >> 32) & 0xffffffffULL)
>>>
>>> int iort_register_domain_token(int trans_id, struct fwnode_handle *fw_node);
>>> void iort_deregister_domain_token(int trans_id);
>>> struct fwnode_handle *iort_find_domain_token(int trans_id);
>>> -#ifdef CONFIG_ACPI_IORT
>>> +#endif
>>> +
>>> +#ifdef CONFIG_ARM_64
>>
>> Why #ifdef CONFIG_ARM_64?
> Was trying to keep the impact low for this RFC iteration (My use-case is arm64 only). Looking for the right recommendation?
IORT is not specific to ARM64. Even though ACPI is only supported for
ARM64 on Xen today, we try to keep the code as generic as possible.
In that case, you could turn CONFIG_ACPI_IORT on in the Kconfig when
ACPI is enabled.
[...]
>>
>> [...]
>>
>>> diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
>>> index 995a85a..3785fae 100644
>>> --- a/xen/include/xen/lib.h
>>> +++ b/xen/include/xen/lib.h
>>> @@ -9,7 +9,12 @@
>>> #include <asm/bug.h>
>>>
>>> #define BUG_ON(p) do { if (unlikely(p)) BUG(); } while (0)
>>> -#define WARN_ON(p) do { if (unlikely(p)) WARN(); } while (0)
>>> +#define WARN_ON(p) ({ \
>>> + int __ret_warn_on = !!(p); \
>>> + if (unlikely(__ret_warn_on)) \
>>> + WARN(); \
>>> + unlikely(__ret_warn_on); \
>>> +})
>>
>> hmmmm. Why this change?
> Was getting a compilation error when I was using WARN_ON as a conditional
> in an if statement regarding the return value. So removed the loop. This
> looks similar to Linux now.
This should belong to a separate patch with a commit message explaining
why the change.
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-09-12 11:25 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
2017-06-12 13:24 ` Julien Grall
2017-08-28 22:21 ` Goel, Sameer
2017-09-12 11:25 ` Julien Grall [this message]
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=59149b5a-256c-1b03-1f18-0622a85e92a2@arm.com \
--to=julien.grall@arm.com \
--cc=punit.agrawal@arm.com \
--cc=robin.murphy@arm.com \
--cc=sgoel@codeaurora.org \
--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).