Hi Oleksandr,
Finally I am getting around Xen grants and haven't got a running setup yet. There are few questions I have at the moment:
- Xen's libxl_arm.c creates the iommu nodes only if backend isn't in Dom0. Why are we forcing it this way ?
I am not running my backend in a separate dom as of now, as they need to share a unix socket with dom0 (with vhost-user-fronend (our virtio-disk counterpart)) for vhost-user protocol and am not sure how to set it up. Maybe I need to use "channel" ? or something else ?
- I tried to hack it up, to keep backend in Dom0 only and create the iommu nodes unconditionally and the guest kernel is crashing in drivers/iommu/iommu.c:332
iommu_dev = ops->probe_device(dev);
Since grant_dma_iommu_ops have all the fields set to NULL.
- Anything else you might want to share ?
On 30-01-23, 14:21, Viresh Kumar wrote:
I tried to hack it up, to keep backend in Dom0 only and create the iommu nodes unconditionally and the guest kernel is crashing in drivers/iommu/iommu.c:332
iommu_dev = ops->probe_device(dev);
I think your driver broke in v6.0 ?
commit 57365a04c921 ("iommu: Move bus setup to IOMMU device registration")
Hello Viresh
[Sorry for the possible format issues]
On Mon, Jan 30, 2023 at 12:10 PM Viresh Kumar viresh.kumar@linaro.org wrote:
On 30-01-23, 14:21, Viresh Kumar wrote:
I tried to hack it up, to keep backend in Dom0 only and create the iommu nodes unconditionally and the guest kernel is crashing in drivers/iommu/iommu.c:332
iommu_dev = ops->probe_device(dev);
I think your driver broke in v6.0 ?
commit 57365a04c921 ("iommu: Move bus setup to IOMMU device registration")
Interesting, thank you for the information. Last time I have checked against: https://git.kernel.org/pub/scm/linux/kernel/git/xen/tip.git/log/?h=for-linus... which doesn't seem to have that commit yet...
Anyway, I will try to get to it, but I am sure when exactly, I hope it will be next week.
-- viresh
Hello Viresh
[Sorry for the possible format issues]
On Wed, Feb 1, 2023 at 11:04 AM Oleksandr Tyshchenko olekstysh@gmail.com wrote:
Hello Viresh
[Sorry for the possible format issues]
On Mon, Jan 30, 2023 at 12:10 PM Viresh Kumar viresh.kumar@linaro.org wrote:
On 30-01-23, 14:21, Viresh Kumar wrote:
I tried to hack it up, to keep backend in Dom0 only and create the iommu nodes unconditionally and the guest kernel is crashing in drivers/iommu/iommu.c:332
iommu_dev = ops->probe_device(dev);
I think your driver broke in v6.0 ?
commit 57365a04c921 ("iommu: Move bus setup to IOMMU device registration")
Interesting, thank you for the information. Last time I have checked against:
https://git.kernel.org/pub/scm/linux/kernel/git/xen/tip.git/log/?h=for-linus... which doesn't seem to have that commit yet...
Anyway, I will try to get to it, but I am sure when exactly, I hope it will be next week.
I managed to get to my environment, rebase on the latest Linux and re-check. Can confirm, the issue is present. The following diff fixes it for me (I am not 100% sure whether it is a proper fix, but we will see during upstreaming it):
diff --git a/drivers/xen/grant-dma-iommu.c b/drivers/xen/grant-dma-iommu.c index 16b8bc0c0b33..91abb2521187 100644 --- a/drivers/xen/grant-dma-iommu.c +++ b/drivers/xen/grant-dma-iommu.c @@ -16,8 +16,15 @@ struct grant_dma_iommu_device { struct iommu_device iommu; };
-/* Nothing is really needed here */ -static const struct iommu_ops grant_dma_iommu_ops; +static struct iommu_device *grant_dma_iommu_probe_device(struct device *dev) +{ + return ERR_PTR(-ENODEV); +} + +/* At least a dummy probe_device callback is needed here */ +static const struct iommu_ops grant_dma_iommu_ops = { + .probe_device = grant_dma_iommu_probe_device, +};
static const struct of_device_id grant_dma_iommu_of_match[] = { { .compatible = "xen,grant-dma" }, (END)
I am planning to create a proper patch and send it to the mailing list in a few days.
-- viresh
-- Regards,
Oleksandr Tyshchenko
On Mon, Jan 30, 2023 at 10:51 AM Viresh Kumar viresh.kumar@linaro.org wrote:
Hi Oleksandr,
Hello Viresh
[Sorry for the possible format issues]
Finally I am getting around Xen grants and haven't got a running setup yet. There are few questions I have at the moment:
- Xen's libxl_arm.c creates the iommu nodes only if backend isn't in Dom0. Why are we forcing it this way ?
It was decided that Xen grant mappings on Arm (HVM) is a must for the backends running in other than Dom0 domain (which are not trusted by default), so the toolstack inserts required bindings only for these. Dom0 is trusted by default, so it is allowed to use Xen foreign mappings. Sure, it could also use grants, but we do not force it to do so currently (maybe, if there is a need to use grants for Dom0 as well we could probably add a configuration property for virtio devices).
I am not running my backend in a separate dom as of now, as they need to share a unix socket with dom0 (with vhost-user-fronend (our virtio-disk counterpart)) for vhost-user protocol and am not sure how to set it up. Maybe I need to use "channel" ? or something else ?
I am not sure I understand the question and use-case. Is the question how to pass some information from one domain to another? If yes, I don't know the details, but one of my colleagues uses Xen's libvchan feature for the communications between domains. https://lore.kernel.org/xen-devel/20230115113111.1207605-1-dmitry.semenets@g...
I tried to hack it up, to keep backend in Dom0 only and create the iommu nodes unconditionally and the guest kernel is crashing in drivers/iommu/iommu.c:332
iommu_dev = ops->probe_device(dev);
Since grant_dma_iommu_ops have all the fields set to NULL.
Hmm. Yes, grant-dma-iommu is a stub driver with empty ops. In a nutshell, we only need it for reusing generic IOMMU device-tree bindings.
https://git.kernel.org/pub/scm/linux/kernel/git/xen/tip.git/commit/drivers/x...
Last time, when I checked Xen grant mappings with virtio, I didn't notice any issues, it worked fine. I from time to time update Xen grant DMA-mapping layer. https://git.kernel.org/pub/scm/linux/kernel/git/xen/tip.git/log/drivers/xen/...
I think, I will need to get to my development board, rebase on the latest vanilla and re-check.
- Anything else you might want to share ?
-- viresh
stratos-dev@op-lists.linaro.org