* [PATCH 0/2] Virtualization support for Tegra ADMA
@ 2024-05-20 12:23 Sameer Pujar
2024-05-20 12:23 ` [PATCH 1/2] dt-bindings: dma: Add reg-names to nvidia,tegra210-adma Sameer Pujar
2024-05-20 12:23 ` [PATCH 2/2] dmaengine: tegra210-adma: Add support for ADMA virtualization Sameer Pujar
0 siblings, 2 replies; 5+ messages in thread
From: Sameer Pujar @ 2024-05-20 12:23 UTC (permalink / raw)
To: vkoul, thierry.reding, dmaengine
Cc: jonathanh, linux-tegra, linux-kernel, mkumard, spujar, ldewangan
From: Mohan Kumar <mkumard@nvidia.com>
Tegra ADMA HW supports multiple PAGES for virtualization, to
support virtualization
- reg-names property has been added to DT binding for the hypervisor mode.
- In hypervisor mode the ADMA global registers are not accessed by guest.
Mohan Kumar (2):
dt-bindings: dma: Add reg-names to nvidia,tegra210-adma
dmaengine: tegra210-adma: Add support for ADMA virtualization
.../bindings/dma/nvidia,tegra210-adma.yaml | 10 +++++
drivers/dma/tegra210-adma.c | 44 +++++++++++++++----
2 files changed, 46 insertions(+), 8 deletions(-)
--
2.45.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] dt-bindings: dma: Add reg-names to nvidia,tegra210-adma
2024-05-20 12:23 [PATCH 0/2] Virtualization support for Tegra ADMA Sameer Pujar
@ 2024-05-20 12:23 ` Sameer Pujar
2024-05-21 9:24 ` Krzysztof Kozlowski
2024-05-20 12:23 ` [PATCH 2/2] dmaengine: tegra210-adma: Add support for ADMA virtualization Sameer Pujar
1 sibling, 1 reply; 5+ messages in thread
From: Sameer Pujar @ 2024-05-20 12:23 UTC (permalink / raw)
To: vkoul, thierry.reding, dmaengine
Cc: jonathanh, linux-tegra, linux-kernel, mkumard, spujar, ldewangan
From: Mohan Kumar <mkumard@nvidia.com>
For Non-Hypervisor mode, Tegra ADMA driver requires the register
resource range to include both global and channel page in the reg
entry. For Hypervisor more, Tegra ADMA driver requires only the
channel page and global page range is not allowed for access.
Add reg-names DT binding for Hypervisor mode to help driver to
differentiate the config between Hypervisor and Non-Hypervisor
mode of execution.
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
---
.../devicetree/bindings/dma/nvidia,tegra210-adma.yaml | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Documentation/devicetree/bindings/dma/nvidia,tegra210-adma.yaml b/Documentation/devicetree/bindings/dma/nvidia,tegra210-adma.yaml
index 877147e95ecc..ede47f4a3eec 100644
--- a/Documentation/devicetree/bindings/dma/nvidia,tegra210-adma.yaml
+++ b/Documentation/devicetree/bindings/dma/nvidia,tegra210-adma.yaml
@@ -29,8 +29,18 @@ properties:
- const: nvidia,tegra186-adma
reg:
+ description: |
+ For hypervisor mode, the address range should include a
+ ADMA channel page address range, for non-hypervisor mode
+ it starts with ADMA base address covering Global and Channel
+ page address range.
maxItems: 1
+ reg-names:
+ description: only required for Hypervisor mode.
+ items:
+ - const: vm
+
interrupts:
description: |
Should contain all of the per-channel DMA interrupts in
--
2.45.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] dmaengine: tegra210-adma: Add support for ADMA virtualization
2024-05-20 12:23 [PATCH 0/2] Virtualization support for Tegra ADMA Sameer Pujar
2024-05-20 12:23 ` [PATCH 1/2] dt-bindings: dma: Add reg-names to nvidia,tegra210-adma Sameer Pujar
@ 2024-05-20 12:23 ` Sameer Pujar
1 sibling, 0 replies; 5+ messages in thread
From: Sameer Pujar @ 2024-05-20 12:23 UTC (permalink / raw)
To: vkoul, thierry.reding, dmaengine
Cc: jonathanh, linux-tegra, linux-kernel, mkumard, spujar, ldewangan
From: Mohan Kumar <mkumard@nvidia.com>
Tegra ADMA HW supports multiple PAGES for virtualization, to
support virtualization support reg-names property has been added
to DT binding to know the hypervisor mode. Also in hypervisor
mode the ADMA global registers are not accessed by guest OS.
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
---
drivers/dma/tegra210-adma.c | 44 ++++++++++++++++++++++++++++++-------
1 file changed, 36 insertions(+), 8 deletions(-)
diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c
index 24ad7077c53b..92f1c0c949dd 100644
--- a/drivers/dma/tegra210-adma.c
+++ b/drivers/dma/tegra210-adma.c
@@ -160,6 +160,8 @@ struct tegra_adma {
/* Used to store global command register state when suspending */
unsigned int global_cmd;
+ bool is_virtualized;
+
const struct tegra_adma_chip_data *cdata;
/* Last member of the structure */
@@ -222,8 +224,15 @@ static int tegra_adma_init(struct tegra_adma *tdma)
u32 status;
int ret;
- /* Clear any interrupts */
- tdma_write(tdma, tdma->cdata->ch_base_offset + tdma->cdata->global_int_clear, 0x1);
+ if (!tdma->is_virtualized) {
+ /* Clear any interrupts */
+ tdma_write(tdma, tdma->cdata->ch_base_offset + tdma->cdata->global_int_clear, 0x1);
+ } else {
+ /* For virtualized mode, ADMA global registers are not accessed */
+ tdma_write(tdma, tdma->cdata->global_int_clear, 0x1);
+ tdma->global_cmd = 1;
+ return 0;
+ }
/* Assert soft reset */
tdma_write(tdma, ADMA_GLOBAL_SOFT_RESET, 0x1);
@@ -736,7 +745,9 @@ static int __maybe_unused tegra_adma_runtime_suspend(struct device *dev)
struct tegra_adma_chan *tdc;
int i;
- tdma->global_cmd = tdma_read(tdma, ADMA_GLOBAL_CMD);
+ if (!tdma->is_virtualized)
+ tdma->global_cmd = tdma_read(tdma, ADMA_GLOBAL_CMD);
+
if (!tdma->global_cmd)
goto clk_disable;
@@ -777,7 +788,9 @@ static int __maybe_unused tegra_adma_runtime_resume(struct device *dev)
dev_err(dev, "ahub clk_enable failed: %d\n", ret);
return ret;
}
- tdma_write(tdma, ADMA_GLOBAL_CMD, tdma->global_cmd);
+
+ if (!tdma->is_virtualized)
+ tdma_write(tdma, ADMA_GLOBAL_CMD, tdma->global_cmd);
if (!tdma->global_cmd)
return 0;
@@ -846,6 +859,8 @@ static int tegra_adma_probe(struct platform_device *pdev)
{
const struct tegra_adma_chip_data *cdata;
struct tegra_adma *tdma;
+ unsigned int ch_base_offset;
+ struct resource *res;
int ret, i;
cdata = of_device_get_match_data(&pdev->dev);
@@ -865,9 +880,22 @@ static int tegra_adma_probe(struct platform_device *pdev)
tdma->nr_channels = cdata->nr_channels;
platform_set_drvdata(pdev, tdma);
- tdma->base_addr = devm_platform_ioremap_resource(pdev, 0);
- if (IS_ERR(tdma->base_addr))
- return PTR_ERR(tdma->base_addr);
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "vm");
+ if (res) {
+ tdma->base_addr = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(tdma->base_addr))
+ return PTR_ERR(tdma->base_addr);
+
+ tdma->is_virtualized = true;
+ ch_base_offset = 0;
+ } else {
+ tdma->base_addr = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(tdma->base_addr))
+ return PTR_ERR(tdma->base_addr);
+
+ tdma->is_virtualized = false;
+ ch_base_offset = cdata->ch_base_offset;
+ }
tdma->ahub_clk = devm_clk_get(&pdev->dev, "d_audio");
if (IS_ERR(tdma->ahub_clk)) {
@@ -900,7 +928,7 @@ static int tegra_adma_probe(struct platform_device *pdev)
if (!test_bit(i, tdma->dma_chan_mask))
continue;
- tdc->chan_addr = tdma->base_addr + cdata->ch_base_offset
+ tdc->chan_addr = tdma->base_addr + ch_base_offset
+ (cdata->ch_reg_size * i);
tdc->irq = of_irq_get(pdev->dev.of_node, i);
--
2.45.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] dt-bindings: dma: Add reg-names to nvidia,tegra210-adma
2024-05-20 12:23 ` [PATCH 1/2] dt-bindings: dma: Add reg-names to nvidia,tegra210-adma Sameer Pujar
@ 2024-05-21 9:24 ` Krzysztof Kozlowski
2024-05-21 10:58 ` Sameer Pujar
0 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Kozlowski @ 2024-05-21 9:24 UTC (permalink / raw)
To: Sameer Pujar, vkoul, thierry.reding, dmaengine
Cc: jonathanh, linux-tegra, linux-kernel, mkumard, ldewangan
On 20/05/2024 14:23, Sameer Pujar wrote:
> From: Mohan Kumar <mkumard@nvidia.com>
>
> For Non-Hypervisor mode, Tegra ADMA driver requires the register
> resource range to include both global and channel page in the reg
> entry. For Hypervisor more, Tegra ADMA driver requires only the
> channel page and global page range is not allowed for access.
>
> Add reg-names DT binding for Hypervisor mode to help driver to
> differentiate the config between Hypervisor and Non-Hypervisor
> mode of execution.
>
> Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
> Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Please use scripts/get_maintainers.pl to get a list of necessary people
and lists to CC. It might happen, that command when run on an older
kernel, gives you outdated entries. Therefore please be sure you base
your patches on recent Linux kernel.
Tools like b4 or scripts/get_maintainer.pl provide you proper list of
people, so fix your workflow. Tools might also fail if you work on some
ancient tree (don't, instead use mainline), work on fork of kernel
(don't, instead use mainline) or you ignore some maintainers (really
don't). Just use b4 and everything should be fine, although remember
about `b4 prep --auto-to-cc` if you added new patches to the patchset.
You missed at least devicetree list (maybe more), so this won't be
tested by automated tooling. Performing review on untested code might be
a waste of time, thus I will skip this patch entirely till you follow
the process allowing the patch to be tested.
Please kindly resend and include all necessary To/Cc entries.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] dt-bindings: dma: Add reg-names to nvidia,tegra210-adma
2024-05-21 9:24 ` Krzysztof Kozlowski
@ 2024-05-21 10:58 ` Sameer Pujar
0 siblings, 0 replies; 5+ messages in thread
From: Sameer Pujar @ 2024-05-21 10:58 UTC (permalink / raw)
To: Krzysztof Kozlowski, vkoul, thierry.reding, dmaengine
Cc: jonathanh, linux-tegra, linux-kernel, mkumard, ldewangan
On 21-05-2024 14:54, Krzysztof Kozlowski wrote:
> On 20/05/2024 14:23, Sameer Pujar wrote:
>> From: Mohan Kumar <mkumard@nvidia.com>
>>
>> For Non-Hypervisor mode, Tegra ADMA driver requires the register
>> resource range to include both global and channel page in the reg
>> entry. For Hypervisor more, Tegra ADMA driver requires only the
>> channel page and global page range is not allowed for access.
>>
>> Add reg-names DT binding for Hypervisor mode to help driver to
>> differentiate the config between Hypervisor and Non-Hypervisor
>> mode of execution.
>>
>> Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
>> Signed-off-by: Sameer Pujar <spujar@nvidia.com>
> Please use scripts/get_maintainers.pl to get a list of necessary people
> and lists to CC. It might happen, that command when run on an older
> kernel, gives you outdated entries. Therefore please be sure you base
> your patches on recent Linux kernel.
>
> Tools like b4 or scripts/get_maintainer.pl provide you proper list of
> people, so fix your workflow. Tools might also fail if you work on some
> ancient tree (don't, instead use mainline), work on fork of kernel
> (don't, instead use mainline) or you ignore some maintainers (really
> don't). Just use b4 and everything should be fine, although remember
> about `b4 prep --auto-to-cc` if you added new patches to the patchset.
>
> You missed at least devicetree list (maybe more), so this won't be
> tested by automated tooling. Performing review on untested code might be
> a waste of time, thus I will skip this patch entirely till you follow
> the process allowing the patch to be tested.
>
> Please kindly resend and include all necessary To/Cc entries.
Sorry about this, I will resend the series. Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-05-21 10:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-20 12:23 [PATCH 0/2] Virtualization support for Tegra ADMA Sameer Pujar
2024-05-20 12:23 ` [PATCH 1/2] dt-bindings: dma: Add reg-names to nvidia,tegra210-adma Sameer Pujar
2024-05-21 9:24 ` Krzysztof Kozlowski
2024-05-21 10:58 ` Sameer Pujar
2024-05-20 12:23 ` [PATCH 2/2] dmaengine: tegra210-adma: Add support for ADMA virtualization Sameer Pujar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox