All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: xen-devel@lists.xenproject.org, tim@xen.org,
	stefano.stabellini@citrix.com
Subject: Re: [PATCH v3 12/13] xen/iommu: smmu: Add Xen specific code to be able to use the driver
Date: Fri, 20 Feb 2015 13:50:39 +0000	[thread overview]
Message-ID: <54E73BAF.1030807@linaro.org> (raw)
In-Reply-To: <1424438620.30924.225.camel@citrix.com>

Hi Ian,

On 20/02/15 13:23, Ian Campbell wrote:
> On Fri, 2015-02-06 at 13:20 +0000, Stefano Stabellini wrote:
>>> +#define iommu_group_get_iommudata(group) (group)->cfg
>>
>> I would move all the Xen stuff at the beginning of the file or maybe to
>> a separate file. You could #include the linux smmu driver into it.
>> Maybe we cannot have runtime patching of this file, but at least we can
>> keep Xen and Linux stuff clearly separate.
> 
> I was going to suggest something similar e.g. #include <ssmu-xen-shim.h>
> or something.

See my comment on Stefano's mail for this.

>>
>>
>>>  static DEFINE_SPINLOCK(arm_smmu_devices_lock);
>>>  static LIST_HEAD(arm_smmu_devices);
>>>  
>>> @@ -455,6 +690,8 @@ static void parse_driver_options(struct arm_smmu_device *smmu)
>>>  
>>>  static struct device_node *dev_get_dev_node(struct device *dev)
>>>  {
>>> +	/* Xen: TODO: Add support for PCI */
>>> +#if 0
>>>  	if (dev_is_pci(dev)) {
>>>  		struct pci_bus *bus = to_pci_dev(dev)->bus;
>>>  
>>> @@ -462,7 +699,7 @@ static struct device_node *dev_get_dev_node(struct device *dev)
>>>  			bus = bus->parent;
>>>  		return bus->bridge->parent->of_node;
>>>  	}
>>> -
>>> +#endif
>>
>> Would it be possible instead to add:
>>
>> #define dev_is_pci (0)
>>
>> above among the Xen definitions?
> 
> Would be preferable if possible.

It's already done but ... if (0) doesn't mean the code inside the if
could be invalid.

In this specific case, we don't have a field struct pci_bus *bus in our
pci_dev. So it won't compile.

>>   
>>> @@ -700,11 +938,10 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev)
>>>  	/* Retry or terminate any stalled transactions */
>>>  	if (fsr & FSR_SS)
>>>  		writel_relaxed(resume, cb_base + ARM_SMMU_CB_RESUME);
>>> -
>>> -	return ret;
>>>  }
>>
>> For the sake of minimizing the changes to Linux functions, could you
>> write a wrapper around this function instead? That might allow you to
>> remove the changes related to the return value.
> 
> typedef void irqreturn_t; and "#define IRQ_NONE /**/" etc perhaps?
> 
> Or even just cast the function in the call to request_irq, the differing
> return type shouldn't cause a problem in this context I think.

I can give a look.

>>
>>
>>> +/* Xen: Page tables are shared with the processor */
>>> +#if 0
>>>  static void arm_smmu_flush_pgtable(struct arm_smmu_device *smmu, void *addr,
>>>  				   size_t size)
>>>  {
>>> @@ -749,6 +987,7 @@ static void arm_smmu_flush_pgtable(struct arm_smmu_device *smmu, void *addr,
>>>  				DMA_TO_DEVICE);
>>>  	}
>>>  }
>>> +#endif
>>
>> But then you need to fix all the call sites. I think it is best to add a
>> return at the beginning of the function.
> 
> Or add a nop stub... (return sounds better though)

I don't succeed to make my point on this kind of things...

While I agree that we have to minimize the changes in the code. We
shouldn't do it at the cost of an incomprehensible cost.

The function arm_smmu_flush_pgtable doesn't make any sense at all on Xen
(the parameter are even invalid).

Furthermore there is only one call site.


>>> +#if CONFIG_ARM_32
>>> +		/* Xen: Midway is using 40-bit address space.
> 
> I'm a bit surprised that the upstream driver isn't prepared to cope with
> this sort of thing, there are a few LPAE arm32 systems around these
> days. I had the same thought around the " /* Xen: The fault address
> maybe higher than 32 bits on arm32 */" comment too.

At the time I resynced the SMMU drivers, they were using short page
tables. And therefore the number of address bits was limited for the guest.

I don't plan to lose again minimum 2 weeks for re-syncing the driver soon.

Regards,

-- 
Julien Grall

  reply	other threads:[~2015-02-20 13:51 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-30 18:49 [PATCH v3 00/13] xen/arm: Resync the SMMU driver with the Linux one Julien Grall
2015-01-30 18:49 ` [PATCH v3 01/13] xen/arm: gic-v2: Change the device name in DT_DEVICE_START Julien Grall
2015-02-20 12:16   ` Ian Campbell
2015-01-30 18:49 ` [PATCH v3 02/13] xen/arm: vgic: Drop unecessary include asm/device.h Julien Grall
2015-02-20 12:16   ` Ian Campbell
2015-01-30 18:49 ` [PATCH v3 03/13] xen/dt: Extend dt_device_match to possibly store data Julien Grall
2015-02-06 12:37   ` Stefano Stabellini
2015-02-20 12:16     ` Ian Campbell
2015-01-30 18:49 ` [PATCH v3 04/13] xen/arm: device: Rename device_type into device_class Julien Grall
2015-02-06 12:38   ` Stefano Stabellini
2015-02-20 12:17     ` Ian Campbell
2015-01-30 18:49 ` [PATCH v3 05/13] xen/iommu: arm: Remove temporary the SMMU driver Julien Grall
2015-02-20 12:18   ` Ian Campbell
2015-02-20 12:53     ` Julien Grall
2015-02-20 13:47       ` Ian Campbell
2015-02-20 13:53         ` Julien Grall
2015-02-20 14:06           ` Ian Campbell
2015-02-20 14:07             ` Julien Grall
2015-01-30 18:49 ` [PATCH v3 06/13] xen/arm: Introduce a generic way to describe device Julien Grall
2015-02-02  8:04   ` Jan Beulich
2015-02-06 12:39   ` Stefano Stabellini
2015-02-20 12:22   ` Ian Campbell
2015-02-24 14:26     ` Julien Grall
2015-02-24 14:45       ` Ian Campbell
2015-01-30 18:49 ` [PATCH v3 07/13] xen/iommu: Consolidate device assignment ops into a single set Julien Grall
2015-02-20 12:25   ` Ian Campbell
2015-01-30 18:49 ` [PATCH v3 08/13] xen/arm: Describe device supported by a driver with dt_match_node Julien Grall
2015-02-20 12:30   ` Ian Campbell
2015-02-24 14:42     ` Julien Grall
2015-01-30 18:49 ` [PATCH v3 09/13] xen/iommu: arm: Import the SMMU driver from Linux Julien Grall
2015-02-20 12:31   ` Ian Campbell
2015-02-20 13:33     ` Julien Grall
2015-02-20 13:48       ` Ian Campbell
2015-01-30 18:49 ` [PATCH v3 10/13] xen/iommu: smmu: Check for duplicate stream IDs when registering master devices Julien Grall
2015-02-20 12:35   ` Ian Campbell
2015-02-20 13:34     ` Julien Grall
2015-02-20 13:48       ` Ian Campbell
2015-02-20 14:47       ` Andreas Herrmann
2015-01-30 18:49 ` [PATCH v3 11/13] xen/iommu: smmu: Introduce automatic stream-id-masking Julien Grall
2015-02-20 13:15   ` Ian Campbell
2015-02-20 13:42     ` Julien Grall
2015-02-20 13:55       ` Ian Campbell
2015-02-20 15:07         ` Julien Grall
2015-02-23 10:42           ` Ian Campbell
2015-02-23 10:52             ` Julien Grall
2015-02-23 12:48               ` Ian Campbell
2015-01-30 18:49 ` [PATCH v3 12/13] xen/iommu: smmu: Add Xen specific code to be able to use the driver Julien Grall
2015-02-02 18:55   ` Manish
2015-02-02 23:01     ` Julien Grall
2015-02-06 13:20   ` Stefano Stabellini
2015-02-09 15:40     ` Julien Grall
2015-02-19 17:17       ` Julien Grall
2015-02-20 13:29       ` Ian Campbell
2015-02-20 14:01         ` Julien Grall
2015-02-20 13:23     ` Ian Campbell
2015-02-20 13:50       ` Julien Grall [this message]
2015-01-30 18:49 ` [PATCH v3 13/13] xen/iommu: smmu: Advertise when the SMMU support coherent table walk Julien Grall
2015-02-06 14:06   ` Stefano Stabellini
2015-02-10  1:36     ` Julien Grall
2015-02-10  1:37       ` Julien Grall
2015-02-20 13:34   ` Ian Campbell
2015-02-20 14:07     ` Julien Grall
2015-02-20 14:13       ` Ian Campbell
2015-02-20 14:15         ` Julien Grall
2015-02-20 14:28           ` Ian Campbell
2015-02-20 14:15 ` [PATCH v3 00/13] xen/arm: Resync the SMMU driver with the Linux one Ian Campbell
2015-02-20 14:19   ` Julien Grall
2015-02-20 14:27     ` Ian Campbell

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=54E73BAF.1030807@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=ian.campbell@citrix.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.