diff mbox series

[hyperv-next,v5,07/11] dt-bindings: microsoft,vmbus: Add interrupts and DMA coherence

Message ID 20250307220304.247725-8-romank@linux.microsoft.com (mailing list archive)
State Handled Elsewhere
Delegated to: Krzysztof WilczyƄski
Headers show
Series arm64: hyperv: Support Virtual Trust Level Boot | expand

Commit Message

Roman Kisel March 7, 2025, 10:02 p.m. UTC
To boot on ARM64, VMBus requires configuring interrupts. Missing
DMA coherence property is sub-optimal as the VMBus transations are
cache-coherent.

Add interrupts to be able to boot on ARM64. Add DMA coherence to
avoid doing extra work on maintaining caches on ARM64.

Signed-off-by: Roman Kisel <romank@linux.microsoft.com>
---
 .../devicetree/bindings/bus/microsoft,vmbus.yaml          | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Krzysztof Kozlowski March 10, 2025, 9:28 a.m. UTC | #1
On Fri, Mar 07, 2025 at 02:02:59PM -0800, Roman Kisel wrote:
> To boot on ARM64, VMBus requires configuring interrupts. Missing
> DMA coherence property is sub-optimal as the VMBus transations are
> cache-coherent.
> 
> Add interrupts to be able to boot on ARM64. Add DMA coherence to
> avoid doing extra work on maintaining caches on ARM64.

How do you add it?

> 
> Signed-off-by: Roman Kisel <romank@linux.microsoft.com>
> ---
>  .../devicetree/bindings/bus/microsoft,vmbus.yaml          | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml b/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml
> index a8d40c766dcd..3ab7d0116626 100644
> --- a/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml
> +++ b/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml
> @@ -28,13 +28,16 @@ properties:
>  required:
>    - compatible
>    - ranges
> +  - interrupts
>    - '#address-cells'
>    - '#size-cells'
>  
> -additionalProperties: false
> +additionalProperties: true

This is neither explained in commit msg nor correct.

Drop the change. You cannot have device bindings ending with 'true'
here - see talks, example-bindings, writing-schema and whatever resource
is there.

Best regards,
Krzysztof
Roman Kisel March 10, 2025, 5:05 p.m. UTC | #2
On 3/10/2025 2:28 AM, Krzysztof Kozlowski wrote:
> On Fri, Mar 07, 2025 at 02:02:59PM -0800, Roman Kisel wrote:
>> To boot on ARM64, VMBus requires configuring interrupts. Missing
>> DMA coherence property is sub-optimal as the VMBus transations are
>> cache-coherent.
>>
>> Add interrupts to be able to boot on ARM64. Add DMA coherence to
>> avoid doing extra work on maintaining caches on ARM64.
> 
> How do you add it?
> 

I added properties to the node. Should I fix the description, or I am
misunderstanding the question?

>>
>> Signed-off-by: Roman Kisel <romank@linux.microsoft.com>
>> ---
>>   .../devicetree/bindings/bus/microsoft,vmbus.yaml          | 8 +++++++-
>>   1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml b/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml
>> index a8d40c766dcd..3ab7d0116626 100644
>> --- a/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml
>> +++ b/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml
>> @@ -28,13 +28,16 @@ properties:
>>   required:
>>     - compatible
>>     - ranges
>> +  - interrupts
>>     - '#address-cells'
>>     - '#size-cells'
>>   
>> -additionalProperties: false
>> +additionalProperties: true
> 
> This is neither explained in commit msg nor correct.
> 

Not explained, as there is no good explanation as described below.

> Drop the change. You cannot have device bindings ending with 'true'
> here - see talks, example-bindings, writing-schema and whatever resource
> is there.
> 

Thanks, I'll put more effort into bringing this into a better form!
If you have time, could you comment on the below?

The Documentation says

   * additionalProperties: true
     Rare case, used for schemas implementing common set of properties.
Such schemas are supposed to be referenced by other schemas, which then 
use 'unevaluatedProperties: false'.  Typically bus or common-part schemas.

This is a bus so I added that line to the YAML, and I saw it in many
other YAML files. Without that line, there was a warning from the local
DT validation described in the Documentation about not having pin
controls which was weird, and adding

"additionalProperties: true"

fixed the warnings (didn't debug much though). As a side note, there was
a similar warning coming from another YAML during running DT schema
validation as described in the Documentation so maybe warnings are fine.

> Best regards,
> Krzysztof
>
Krzysztof Kozlowski March 10, 2025, 5:40 p.m. UTC | #3
On 10/03/2025 18:05, Roman Kisel wrote:
> 
> 
> On 3/10/2025 2:28 AM, Krzysztof Kozlowski wrote:
>> On Fri, Mar 07, 2025 at 02:02:59PM -0800, Roman Kisel wrote:
>>> To boot on ARM64, VMBus requires configuring interrupts. Missing
>>> DMA coherence property is sub-optimal as the VMBus transations are
>>> cache-coherent.
>>>
>>> Add interrupts to be able to boot on ARM64. Add DMA coherence to
>>> avoid doing extra work on maintaining caches on ARM64.
>>
>> How do you add it?
>>
> 
> I added properties to the node. Should I fix the description, or I am
> misunderstanding the question?

I saw interrupts in the schema, but I did not see dma-coherence. I also
did not see any DTS patches here, so I don't understand what node you
are referring to.

> 
>>>
>>> Signed-off-by: Roman Kisel <romank@linux.microsoft.com>
>>> ---
>>>   .../devicetree/bindings/bus/microsoft,vmbus.yaml          | 8 +++++++-
>>>   1 file changed, 7 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml b/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml
>>> index a8d40c766dcd..3ab7d0116626 100644
>>> --- a/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml
>>> +++ b/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml
>>> @@ -28,13 +28,16 @@ properties:
>>>   required:
>>>     - compatible
>>>     - ranges
>>> +  - interrupts
>>>     - '#address-cells'
>>>     - '#size-cells'
>>>   
>>> -additionalProperties: false
>>> +additionalProperties: true
>>
>> This is neither explained in commit msg nor correct.
>>
> 
> Not explained, as there is no good explanation as described below.
> 
>> Drop the change. You cannot have device bindings ending with 'true'
>> here - see talks, example-bindings, writing-schema and whatever resource
>> is there.
>>
> 
> Thanks, I'll put more effort into bringing this into a better form!
> If you have time, could you comment on the below?
> 
> The Documentation says
> 
>    * additionalProperties: true
>      Rare case, used for schemas implementing common set of properties.
> Such schemas are supposed to be referenced by other schemas, which then 
> use 'unevaluatedProperties: false'.  Typically bus or common-part schemas.
> 
> This is a bus so I added that line to the YAML, and I saw it in many

If this is a bus, then where is schema using it for
bus-attached-devices? You cannot have bus without devices.

You *must* fulfill that part:
"Such schemas are supposed to be referenced by other schemas, which then"

instead of calling it bus...

Please upstream bindings for the bus devices and extend the example here
with these devices.

Or this is not bus (calling something vmpony does not make it a pony).


Best regards,
Krzysztof
Roman Kisel March 10, 2025, 6:07 p.m. UTC | #4
On 3/10/2025 10:40 AM, Krzysztof Kozlowski wrote:
> On 10/03/2025 18:05, Roman Kisel wrote:
>>
>>
>> On 3/10/2025 2:28 AM, Krzysztof Kozlowski wrote:
>>> On Fri, Mar 07, 2025 at 02:02:59PM -0800, Roman Kisel wrote:
>>>> To boot on ARM64, VMBus requires configuring interrupts. Missing
>>>> DMA coherence property is sub-optimal as the VMBus transations are
>>>> cache-coherent.
>>>>
>>>> Add interrupts to be able to boot on ARM64. Add DMA coherence to
>>>> avoid doing extra work on maintaining caches on ARM64.
>>>
>>> How do you add it?
>>>
>>
>> I added properties to the node. Should I fix the description, or I am
>> misunderstanding the question?
> 
> I saw interrupts in the schema, but I did not see dma-coherence. I also
> did not see any DTS patches here, so I don't understand what node you
> are referring to.
> 

I will refer to talks, example-bindings, writing-schema you've suggested
to waste your time less. It appears there is some fundamental flaw in my
understanding of how these YAML files work so much so that I cannot even
write a commit description that can be understood, for the 5th time in
the row, sorry about that.

>>
>>>>
>>>> Signed-off-by: Roman Kisel <romank@linux.microsoft.com>
>>>> ---
>>>>    .../devicetree/bindings/bus/microsoft,vmbus.yaml          | 8 +++++++-
>>>>    1 file changed, 7 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml b/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml
>>>> index a8d40c766dcd..3ab7d0116626 100644
>>>> --- a/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml
>>>> +++ b/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml
>>>> @@ -28,13 +28,16 @@ properties:
>>>>    required:
>>>>      - compatible
>>>>      - ranges
>>>> +  - interrupts
>>>>      - '#address-cells'
>>>>      - '#size-cells'
>>>>    
>>>> -additionalProperties: false
>>>> +additionalProperties: true
>>>
>>> This is neither explained in commit msg nor correct.
>>>
>>
>> Not explained, as there is no good explanation as described below.
>>
>>> Drop the change. You cannot have device bindings ending with 'true'
>>> here - see talks, example-bindings, writing-schema and whatever resource
>>> is there.
>>>
>>
>> Thanks, I'll put more effort into bringing this into a better form!
>> If you have time, could you comment on the below?
>>
>> The Documentation says
>>
>>     * additionalProperties: true
>>       Rare case, used for schemas implementing common set of properties.
>> Such schemas are supposed to be referenced by other schemas, which then
>> use 'unevaluatedProperties: false'.  Typically bus or common-part schemas.
>>
>> This is a bus so I added that line to the YAML, and I saw it in many
> 
> If this is a bus, then where is schema using it for
> bus-attached-devices? You cannot have bus without devices.
> 
> You *must* fulfill that part:
> "Such schemas are supposed to be referenced by other schemas, which then"
> 
> instead of calling it bus...
> 

It is modeled as a bus in the kernel:
https://www.kernel.org/doc/html/latest/virt/hyperv/vmbus.html

> Please upstream bindings for the bus devices and extend the example here
> with these devices.

The set of synthetic devices that reside on the bus isn't fixed, and
they don't require description neither in ACPI nor in DT as
the devices negotiate their MMIO regions through the hyperv driver.

Perhaps, it is not as much bus as expected by the YAML files.

> 
> Or this is not bus (calling something vmpony does not make it a pony).
> 
 > > Best regards,
> Krzysztof
Krzysztof Kozlowski March 10, 2025, 9:17 p.m. UTC | #5
On 10/03/2025 19:07, Roman Kisel wrote:
> 
> It is modeled as a bus in the kernel:
> https://www.kernel.org/doc/html/latest/virt/hyperv/vmbus.html
> 
>> Please upstream bindings for the bus devices and extend the example here
>> with these devices.
> 
> The set of synthetic devices that reside on the bus isn't fixed, and
> they don't require description neither in ACPI nor in DT as
> the devices negotiate their MMIO regions through the hyperv driver.
> 
> Perhaps, it is not as much bus as expected by the YAML files.

OK, then this is not really a bus from the bindings point of view. It is
a device schema which should end with additionalProperties: false.

If you have report about that pinctrl-0, it means you have undocumented
properties in your DTS. Maybe that's the dma-coherence you mentioned in
the commit msg.


Best regards,
Krzysztof
Roman Kisel March 10, 2025, 9:51 p.m. UTC | #6
On 3/10/2025 2:17 PM, Krzysztof Kozlowski wrote:
> On 10/03/2025 19:07, Roman Kisel wrote:
>>
>> It is modeled as a bus in the kernel:
>> https://www.kernel.org/doc/html/latest/virt/hyperv/vmbus.html
>>
>>> Please upstream bindings for the bus devices and extend the example here
>>> with these devices.
>>
>> The set of synthetic devices that reside on the bus isn't fixed, and
>> they don't require description neither in ACPI nor in DT as
>> the devices negotiate their MMIO regions through the hyperv driver.
>>
>> Perhaps, it is not as much bus as expected by the YAML files.
> 
> OK, then this is not really a bus from the bindings point of view. It is
> a device schema which should end with additionalProperties: false.
> 
> If you have report about that pinctrl-0, it means you have undocumented
> properties in your DTS. Maybe that's the dma-coherence you mentioned in
> the commit msg.
> 

Much appreciated! I started reviewing the learning materials you
mentioned, and I think I already see where my understanding went
sideways: I perceived the example as the central part of the bindings
whereas it seems to be just what the name suggests: an example. Yet,
the example shall conform to the *schema* iiuc, and that is what the
tooling validates.

Hopefully, I am starting to be getting what this is all about :)
Thanks for your help again!

I've worked out what makes (more) sense (to me at least):

 From 475fb74b49dc4987ca8b9117186941d848f0aacd Mon Sep 17 00:00:00 2001
From: Roman Kisel <romank@linux.microsoft.com>
Date: Mon, 10 Mar 2025 14:39:41 -0700
Subject: [PATCH] dt-bindings: microsoft,vmbus: Add interrupt and DMA
   coherence properties

To boot in the VTL mode, VMBus on arm64 needs interrupt description
which the binding documentation lacks. The transactions on the bus are
DMA coherent which is not mentioned as well.

Add the interrupt property and the DMA coherence property to the VMBus
binding. Update the example to match that. Fix typos.

Signed-off-by: Roman Kisel <romank@linux.microsoft.com>
---
  .../bindings/bus/microsoft,vmbus.yaml           | 17 +++++++++++++++--
  1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml 
b/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml
index a8d40c766dcd..b175ad01f219 100644
--- a/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml
+++ b/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml
@@ -10,8 +10,8 @@ maintainers:
    - Saurabh Sengar <ssengar@linux.microsoft.com>

  description:
-  VMBus is a software bus that implement the protocols for communication
-  between the root or host OS and guest OSs (virtual machines).
+  VMBus is a software bus that implements the protocols for communication
+  between the root or host OS and guest OS'es (virtual machines).

  properties:
    compatible:
@@ -25,9 +25,17 @@ properties:
    '#size-cells':
      const: 1

+  dma-coherent: true
+
+  interrupts:
+    maxItems: 1
+    description: |
+      This interrupt signals a message from the host.
+
  required:
    - compatible
    - ranges
+  - interrupts
    - '#address-cells'
    - '#size-cells'

@@ -35,6 +43,8 @@ additionalProperties: false

  examples:
    - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
      soc {
          #address-cells = <2>;
          #size-cells = <1>;
@@ -49,6 +59,9 @@ examples:
                  #address-cells = <2>;
                  #size-cells = <1>;
                  ranges = <0x0f 0xf0000000 0x0f 0xf0000000 0x10000000>;
+                dma-coherent;
+                interrupt-parent = <&gic>;
+                interrupts = <GIC_PPI 2 IRQ_TYPE_EDGE_RISING>;
              };
          };
      };
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml b/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml
index a8d40c766dcd..3ab7d0116626 100644
--- a/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml
+++ b/Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml
@@ -28,13 +28,16 @@  properties:
 required:
   - compatible
   - ranges
+  - interrupts
   - '#address-cells'
   - '#size-cells'
 
-additionalProperties: false
+additionalProperties: true
 
 examples:
   - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
     soc {
         #address-cells = <2>;
         #size-cells = <1>;
@@ -49,6 +52,9 @@  examples:
                 #address-cells = <2>;
                 #size-cells = <1>;
                 ranges = <0x0f 0xf0000000 0x0f 0xf0000000 0x10000000>;
+                dma-coherent;
+                interrupt-parent = <&gic>;
+                interrupts = <GIC_PPI 2 IRQ_TYPE_EDGE_RISING>;
             };
         };
     };